drizzle-cube 0.5.3 → 0.5.5
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.
- package/dist/adapters/express/index.cjs +2 -2
- package/dist/adapters/express/index.js +105 -104
- package/dist/adapters/fastify/index.cjs +2 -2
- package/dist/adapters/fastify/index.js +107 -106
- package/dist/adapters/{google-CBfBGU4F.js → google-CT4kgmBf.js} +1 -1
- package/dist/adapters/{google-BOAwi9Ib.cjs → google-Dgo9-Kb5.cjs} +1 -1
- package/dist/adapters/{handler-Cqf-CqAS.cjs → handler-C1Qs8JMY.cjs} +13 -13
- package/dist/adapters/{handler-BC3nFNxV.js → handler-CoaNnZyf.js} +154 -34
- package/dist/adapters/hono/index.cjs +1 -1
- package/dist/adapters/hono/index.js +99 -98
- package/dist/adapters/{locale-BoiA6WiV.cjs → locale-CTuvUGBs.cjs} +7 -7
- package/dist/adapters/{locale-D9VQkLXt.js → locale-wMBdZ3Ks.js} +1 -1
- package/dist/adapters/mcp-tools.cjs +1 -1
- package/dist/adapters/mcp-tools.js +8 -3
- package/dist/adapters/mcp-transport-B_HoB1HQ.js +579 -0
- package/dist/adapters/mcp-transport-bQzyrBPI.cjs +40 -0
- package/dist/adapters/mcp-transport.d.ts +22 -0
- package/dist/adapters/nextjs/index.cjs +1 -1
- package/dist/adapters/nextjs/index.js +136 -135
- package/dist/adapters/{openai-B4N3KfTG.cjs → openai-BjLV_Wjx.cjs} +1 -1
- package/dist/adapters/{openai-BWdm0JvG.js → openai-DQawCWQb.js} +1 -1
- package/dist/adapters/utils-CIRA5_JO.cjs +128 -0
- package/dist/adapters/{utils-CTYvfZ3I.js → utils-hC7Z8V39.js} +1114 -664
- package/dist/adapters/utils.cjs +1 -1
- package/dist/adapters/utils.d.ts +52 -5
- package/dist/adapters/utils.js +1 -1
- package/dist/client/charts/chartConfigs.d.ts +34 -0
- package/dist/client/charts.js +12 -12
- package/dist/client/chunks/{DashboardEditModal-IU_0dgfC.js → DashboardEditModal-DayTXEH0.js} +10 -10
- package/dist/client/chunks/{DashboardEditModal-IU_0dgfC.js.map → DashboardEditModal-DayTXEH0.js.map} +1 -1
- package/dist/client/chunks/{FieldSearchModal-BCWanpPX.js → FieldSearchModal-B7Mr8UNT.js} +4 -4
- package/dist/client/chunks/{FieldSearchModal-BCWanpPX.js.map → FieldSearchModal-B7Mr8UNT.js.map} +1 -1
- package/dist/client/chunks/KpiDelta-C-hZ1x01.js +2 -0
- package/dist/client/chunks/KpiNumber-Beo8CK0a.js +2 -0
- package/dist/client/chunks/KpiText-ytYiRTRO.js +2 -0
- package/dist/client/chunks/{RetentionCombinedChart-CQMBODsK.js → RetentionCombinedChart-D3dRmoos.js} +3 -3
- package/dist/client/chunks/{RetentionCombinedChart-CQMBODsK.js.map → RetentionCombinedChart-D3dRmoos.js.map} +1 -1
- package/dist/client/chunks/{RetentionHeatmap-B_5sewwi.js → RetentionHeatmap-DHPnn0qH.js} +2 -2
- package/dist/client/chunks/{RetentionHeatmap-B_5sewwi.js.map → RetentionHeatmap-DHPnn0qH.js.map} +1 -1
- package/dist/client/chunks/SchemaVisualization-DbYZBTyi.js +2 -0
- package/dist/client/chunks/SchemaVisualizationLazy-BGo-1S3q.js +2 -0
- package/dist/client/chunks/{af-ZA-xDmO5F0s.js → af-ZA-BtTNqvHF.js} +8 -3
- package/dist/client/chunks/af-ZA-BtTNqvHF.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-Dm6eD_AX.js → analysis-builder-lcGl099d.js} +245 -255
- package/dist/client/chunks/analysis-builder-lcGl099d.js.map +1 -0
- package/dist/client/chunks/{analysis-builder-shared-DT5bXwCA.js → analysis-builder-shared-6BRZcEnu.js} +391 -459
- package/dist/client/chunks/analysis-builder-shared-6BRZcEnu.js.map +1 -0
- package/dist/client/chunks/{chart-activity-grid-CWT0gLv4.js → chart-activity-grid-BnY-jaoa.js} +26 -6
- package/dist/client/chunks/chart-activity-grid-BnY-jaoa.js.map +1 -0
- package/dist/client/chunks/{chart-area-DDti9Qtp.js → chart-area-G3OvLLK4.js} +2 -2
- package/dist/client/chunks/{chart-area-DDti9Qtp.js.map → chart-area-G3OvLLK4.js.map} +1 -1
- package/dist/client/chunks/{chart-bar-B3s9qDlh.js → chart-bar-MLIWiLrc.js} +3 -3
- package/dist/client/chunks/{chart-bar-B3s9qDlh.js.map → chart-bar-MLIWiLrc.js.map} +1 -1
- package/dist/client/chunks/{chart-box-plot-o-h9MRX5.js → chart-box-plot-c2XqKTWq.js} +2 -2
- package/dist/client/chunks/{chart-box-plot-o-h9MRX5.js.map → chart-box-plot-c2XqKTWq.js.map} +1 -1
- package/dist/client/chunks/{chart-bubble-CMDp4Pfm.js → chart-bubble-CAGvnYb1.js} +2 -2
- package/dist/client/chunks/{chart-bubble-CMDp4Pfm.js.map → chart-bubble-CAGvnYb1.js.map} +1 -1
- package/dist/client/chunks/{chart-candlestick-WyANJ0Ky.js → chart-candlestick-oSPk-KQp.js} +2 -2
- package/dist/client/chunks/{chart-candlestick-WyANJ0Ky.js.map → chart-candlestick-oSPk-KQp.js.map} +1 -1
- package/dist/client/chunks/{chart-config-activity-grid-C-EkgYoa.js → chart-config-activity-grid-Dssynumw.js} +8 -1
- package/dist/client/chunks/chart-config-activity-grid-Dssynumw.js.map +1 -0
- package/dist/client/chunks/{chart-config-area-CMZpbIah.js → chart-config-area-40fbx2Ah.js} +8 -1
- package/dist/client/chunks/chart-config-area-40fbx2Ah.js.map +1 -0
- package/dist/client/chunks/{chart-config-bar-B8_V4YLg.js → chart-config-bar-CUWHwOPN.js} +8 -1
- package/dist/client/chunks/chart-config-bar-CUWHwOPN.js.map +1 -0
- package/dist/client/chunks/{chart-config-box-plot-Dwj7sEbU.js → chart-config-box-plot-D3Y0ien3.js} +8 -1
- package/dist/client/chunks/chart-config-box-plot-D3Y0ien3.js.map +1 -0
- package/dist/client/chunks/{chart-config-bubble-B0w0ZVp4.js → chart-config-bubble-BXSTKLn-.js} +8 -1
- package/dist/client/chunks/chart-config-bubble-BXSTKLn-.js.map +1 -0
- package/dist/client/chunks/{chart-config-candlestick-Bvo3zeIn.js → chart-config-candlestick-DEuD2Av0.js} +8 -1
- package/dist/client/chunks/chart-config-candlestick-DEuD2Av0.js.map +1 -0
- package/dist/client/chunks/{chart-config-gauge-C5ZiyZy7.js → chart-config-gauge-CCva3FfA.js} +5 -1
- package/dist/client/chunks/chart-config-gauge-CCva3FfA.js.map +1 -0
- package/dist/client/chunks/{chart-config-heat-map-Cv8qNnVP.js → chart-config-heat-map-Db4Z8UUn.js} +8 -1
- package/dist/client/chunks/chart-config-heat-map-Db4Z8UUn.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-delta-BraHQc2E.js → chart-config-kpi-delta-BfLf3iyi.js} +8 -1
- package/dist/client/chunks/chart-config-kpi-delta-BfLf3iyi.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-number-CeCkx7mC.js → chart-config-kpi-number-DWKFc9PX.js} +5 -1
- package/dist/client/chunks/chart-config-kpi-number-DWKFc9PX.js.map +1 -0
- package/dist/client/chunks/{chart-config-kpi-text-CImM3SvH.js → chart-config-kpi-text-Dr4OG6cY.js} +5 -1
- package/dist/client/chunks/chart-config-kpi-text-Dr4OG6cY.js.map +1 -0
- package/dist/client/chunks/{chart-config-line-BVKapAQK.js → chart-config-line-DGYYdDw9.js} +8 -1
- package/dist/client/chunks/chart-config-line-DGYYdDw9.js.map +1 -0
- package/dist/client/chunks/{chart-config-measure-profile-KTVV1gO3.js → chart-config-measure-profile-sB3n_Azv.js} +5 -1
- package/dist/client/chunks/chart-config-measure-profile-sB3n_Azv.js.map +1 -0
- package/dist/client/chunks/{chart-config-pie-BZxVl25X.js → chart-config-pie-kte7OXa9.js} +8 -1
- package/dist/client/chunks/chart-config-pie-kte7OXa9.js.map +1 -0
- package/dist/client/chunks/{chart-config-radar-B7FByX3t.js → chart-config-radar-C9IxP5tc.js} +8 -1
- package/dist/client/chunks/chart-config-radar-C9IxP5tc.js.map +1 -0
- package/dist/client/chunks/{chart-config-radial-bar-UfW_3yyX.js → chart-config-radial-bar-C3WJ8Uhm.js} +8 -1
- package/dist/client/chunks/chart-config-radial-bar-C3WJ8Uhm.js.map +1 -0
- package/dist/client/chunks/{chart-config-scatter-BVVJuOnt.js → chart-config-scatter-BVN_29G5.js} +8 -1
- package/dist/client/chunks/chart-config-scatter-BVN_29G5.js.map +1 -0
- package/dist/client/chunks/{chart-config-tree-map-IHp97OyV.js → chart-config-tree-map-meeJEDi8.js} +8 -1
- package/dist/client/chunks/chart-config-tree-map-meeJEDi8.js.map +1 -0
- package/dist/client/chunks/{chart-config-waterfall-BdqG1V-x.js → chart-config-waterfall-CaPeWZMl.js} +8 -1
- package/dist/client/chunks/chart-config-waterfall-CaPeWZMl.js.map +1 -0
- package/dist/client/chunks/{chart-data-table-Qrt6EAno.js → chart-data-table-BRXHT2H-.js} +68 -68
- package/dist/client/chunks/chart-data-table-BRXHT2H-.js.map +1 -0
- package/dist/client/chunks/{chart-funnel-C7pgktN5.js → chart-funnel-aQ7G_CqU.js} +2 -2
- package/dist/client/chunks/{chart-funnel-C7pgktN5.js.map → chart-funnel-aQ7G_CqU.js.map} +1 -1
- package/dist/client/chunks/{chart-gauge-D2r2B_AR.js → chart-gauge-DqbDKr9E.js} +2 -2
- package/dist/client/chunks/{chart-gauge-D2r2B_AR.js.map → chart-gauge-DqbDKr9E.js.map} +1 -1
- package/dist/client/chunks/{chart-heat-map-Dw2yjwfO.js → chart-heat-map--6QnhUM8.js} +2 -2
- package/dist/client/chunks/{chart-heat-map-Dw2yjwfO.js.map → chart-heat-map--6QnhUM8.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-delta-CgldZ7zO.js → chart-kpi-delta-DOSpRjfs.js} +3 -3
- package/dist/client/chunks/{chart-kpi-delta-CgldZ7zO.js.map → chart-kpi-delta-DOSpRjfs.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-number-ByfuX1ki.js → chart-kpi-number-BcMjeKm8.js} +5 -5
- package/dist/client/chunks/{chart-kpi-number-ByfuX1ki.js.map → chart-kpi-number-BcMjeKm8.js.map} +1 -1
- package/dist/client/chunks/{chart-kpi-text-DeNuDraJ.js → chart-kpi-text-BI9isc2i.js} +3 -3
- package/dist/client/chunks/{chart-kpi-text-DeNuDraJ.js.map → chart-kpi-text-BI9isc2i.js.map} +1 -1
- package/dist/client/chunks/{chart-line-RdZwtk27.js → chart-line-C0IHQteu.js} +3 -3
- package/dist/client/chunks/{chart-line-RdZwtk27.js.map → chart-line-C0IHQteu.js.map} +1 -1
- package/dist/client/chunks/{chart-markdown-CiGRZdJj.js → chart-markdown-BmgSMqPg.js} +2 -2
- package/dist/client/chunks/{chart-markdown-CiGRZdJj.js.map → chart-markdown-BmgSMqPg.js.map} +1 -1
- package/dist/client/chunks/{chart-measure-profile-Ckjw9bX6.js → chart-measure-profile-DEyLW1fd.js} +3 -3
- package/dist/client/chunks/{chart-measure-profile-Ckjw9bX6.js.map → chart-measure-profile-DEyLW1fd.js.map} +1 -1
- package/dist/client/chunks/{chart-pie-BvY4FY__.js → chart-pie-DSIekr7p.js} +3 -3
- package/dist/client/chunks/{chart-pie-BvY4FY__.js.map → chart-pie-DSIekr7p.js.map} +1 -1
- package/dist/client/chunks/{chart-radar-DjiiEAmc.js → chart-radar-SGl62hK8.js} +3 -3
- package/dist/client/chunks/{chart-radar-DjiiEAmc.js.map → chart-radar-SGl62hK8.js.map} +1 -1
- package/dist/client/chunks/{chart-radial-bar-lla_JEYu.js → chart-radial-bar-C42EykOa.js} +3 -3
- package/dist/client/chunks/{chart-radial-bar-lla_JEYu.js.map → chart-radial-bar-C42EykOa.js.map} +1 -1
- package/dist/client/chunks/{chart-sankey-WwkZAhLy.js → chart-sankey-DguImp0W.js} +2 -2
- package/dist/client/chunks/{chart-sankey-WwkZAhLy.js.map → chart-sankey-DguImp0W.js.map} +1 -1
- package/dist/client/chunks/{chart-scatter-DwXnI0rr.js → chart-scatter-Doeox4OP.js} +3 -3
- package/dist/client/chunks/{chart-scatter-DwXnI0rr.js.map → chart-scatter-Doeox4OP.js.map} +1 -1
- package/dist/client/chunks/{chart-sunburst-CIDB_pTl.js → chart-sunburst-F3tgCpL-.js} +3 -3
- package/dist/client/chunks/{chart-sunburst-CIDB_pTl.js.map → chart-sunburst-F3tgCpL-.js.map} +1 -1
- package/dist/client/chunks/{chart-tree-map-DJHoA26f.js → chart-tree-map-DvuSCIc8.js} +3 -3
- package/dist/client/chunks/{chart-tree-map-DJHoA26f.js.map → chart-tree-map-DvuSCIc8.js.map} +1 -1
- package/dist/client/chunks/{chart-waterfall-Y7c8csO5.js → chart-waterfall-Be5duXlO.js} +3 -3
- package/dist/client/chunks/{chart-waterfall-Y7c8csO5.js.map → chart-waterfall-Be5duXlO.js.map} +1 -1
- package/dist/client/chunks/{charts-core-BXOqaYFn.js → charts-core-XlOwoP_r.js} +2 -2
- package/dist/client/chunks/{charts-core-BXOqaYFn.js.map → charts-core-XlOwoP_r.js.map} +1 -1
- package/dist/client/chunks/{nl-NL-vCifBijs.js → nl-NL-BLDeSy_P.js} +24 -4
- package/dist/client/chunks/nl-NL-BLDeSy_P.js.map +1 -0
- package/dist/client/chunks/{schema-visualization-DWwJukK7.js → schema-visualization-CM5ikSWB.js} +4 -4
- package/dist/client/chunks/{schema-visualization-DWwJukK7.js.map → schema-visualization-CM5ikSWB.js.map} +1 -1
- package/dist/client/chunks/{useDebounce-DyJVREop.js → useDebounce-NEZQbfxN.js} +4 -4
- package/dist/client/chunks/{useDebounce-DyJVREop.js.map → useDebounce-NEZQbfxN.js.map} +1 -1
- package/dist/client/chunks/{useExplainAI-CxSkjocM.js → useExplainAI-DivfI0dW.js} +4 -4
- package/dist/client/chunks/{useExplainAI-CxSkjocM.js.map → useExplainAI-DivfI0dW.js.map} +1 -1
- package/dist/client/chunks/{utils-BHZdKxua.js → utils-Ctl_cVNR.js} +2 -2
- package/dist/client/chunks/{utils-BHZdKxua.js.map → utils-Ctl_cVNR.js.map} +1 -1
- package/dist/client/chunks/{vendor-CBD_Olr0.js → vendor-BcLQ6iVZ.js} +2 -2
- package/dist/client/chunks/{vendor-CBD_Olr0.js.map → vendor-BcLQ6iVZ.js.map} +1 -1
- package/dist/client/components/AnalysisBuilder/types.d.ts +2 -2
- package/dist/client/components.js +3 -3
- package/dist/client/hooks.js +3 -3
- package/dist/client/icons.js +1 -1
- package/dist/client/index.js +14 -14
- package/dist/client/providers.js +1 -1
- package/dist/client/schema.js +1 -1
- package/dist/client/shared/chartDefaults.d.ts +5 -10
- package/dist/client/utils.js +5 -5
- package/dist/client-bundle-stats.html +1 -1
- package/dist/mcp-app/mcp-app.html +24 -24
- package/dist/server/index.cjs +135 -134
- package/dist/server/index.js +1128 -948
- package/package.json +2 -2
- package/dist/adapters/mcp-prompts-BUFyQLHQ.js +0 -377
- package/dist/adapters/mcp-prompts-B_NvEJT_.cjs +0 -111
- package/dist/adapters/mcp-transport-B0mgxRnJ.js +0 -579
- package/dist/adapters/mcp-transport-irsahKmD.cjs +0 -39
- package/dist/adapters/utils-XPOzzMdY.cjs +0 -17
- package/dist/client/chunks/KpiDelta-_igN6cJa.js +0 -2
- package/dist/client/chunks/KpiNumber-t5n8PtRU.js +0 -2
- package/dist/client/chunks/KpiText-BCZJJ6a0.js +0 -2
- package/dist/client/chunks/SchemaVisualization-BUUhlOvG.js +0 -2
- package/dist/client/chunks/SchemaVisualizationLazy-CwaPCUL0.js +0 -2
- package/dist/client/chunks/af-ZA-xDmO5F0s.js.map +0 -1
- package/dist/client/chunks/analysis-builder-Dm6eD_AX.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-DT5bXwCA.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-CWT0gLv4.js.map +0 -1
- package/dist/client/chunks/chart-config-activity-grid-C-EkgYoa.js.map +0 -1
- package/dist/client/chunks/chart-config-area-CMZpbIah.js.map +0 -1
- package/dist/client/chunks/chart-config-bar-B8_V4YLg.js.map +0 -1
- package/dist/client/chunks/chart-config-box-plot-Dwj7sEbU.js.map +0 -1
- package/dist/client/chunks/chart-config-bubble-B0w0ZVp4.js.map +0 -1
- package/dist/client/chunks/chart-config-candlestick-Bvo3zeIn.js.map +0 -1
- package/dist/client/chunks/chart-config-gauge-C5ZiyZy7.js.map +0 -1
- package/dist/client/chunks/chart-config-heat-map-Cv8qNnVP.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-delta-BraHQc2E.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-number-CeCkx7mC.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-text-CImM3SvH.js.map +0 -1
- package/dist/client/chunks/chart-config-line-BVKapAQK.js.map +0 -1
- package/dist/client/chunks/chart-config-measure-profile-KTVV1gO3.js.map +0 -1
- package/dist/client/chunks/chart-config-pie-BZxVl25X.js.map +0 -1
- package/dist/client/chunks/chart-config-radar-B7FByX3t.js.map +0 -1
- package/dist/client/chunks/chart-config-radial-bar-UfW_3yyX.js.map +0 -1
- package/dist/client/chunks/chart-config-scatter-BVVJuOnt.js.map +0 -1
- package/dist/client/chunks/chart-config-tree-map-IHp97OyV.js.map +0 -1
- package/dist/client/chunks/chart-config-waterfall-BdqG1V-x.js.map +0 -1
- package/dist/client/chunks/chart-data-table-Qrt6EAno.js.map +0 -1
- package/dist/client/chunks/nl-NL-vCifBijs.js.map +0 -1
- /package/dist/adapters/{anthropic-Cto4Jxqt.cjs → anthropic-BIva8k1r.cjs} +0 -0
- /package/dist/adapters/{anthropic-DpEbCVvF.js → anthropic-B_rg0BhK.js} +0 -0
- /package/dist/adapters/{dist-BnyV9wfA.cjs → dist-Boc63-1q.cjs} +0 -0
- /package/dist/adapters/{dist-DjVh2RFz.js → dist-De5fzUEM.js} +0 -0
- /package/dist/adapters/{openai-CoqT_FM5.cjs → openai-Bgri5TJc.cjs} +0 -0
- /package/dist/adapters/{openai-D0Nsvc9L.js → openai-CuUGrKaK.js} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
const e=require(`./utils-
|
|
2
|
-
`)}function
|
|
1
|
+
const e=require(`./utils-CIRA5_JO.cjs`);function t(e){if(e.length===0)return`No cubes are currently available.`;let t=[`## Available Cubes`,``];for(let n of e){if(t.push(`### ${n.name}`),n.description&&t.push(n.description),n.measures&&n.measures.length>0){t.push(``),t.push(`**Measures:**`);for(let e of n.measures){let r=e.description?` - ${e.description}`:``;t.push(`- \`${n.name}.${e.name}\` (${e.type})${r}`)}}if(n.dimensions&&n.dimensions.length>0){t.push(``),t.push(`**Dimensions:**`);for(let e of n.dimensions){let r=e.description?` - ${e.description}`:``;t.push(`- \`${n.name}.${e.name}\` (${e.type})${r}`)}}if(n.relationships&&n.relationships.length>0){t.push(``),t.push(`**Joins:**`);for(let e of n.relationships)t.push(`- → \`${e.targetCube}\` (${e.relationship})`)}n.meta?.eventStream&&(t.push(``),t.push(`**Event Stream:** Yes (supports funnel, flow, retention queries)`),n.meta.eventStream.bindingKey&&t.push(`- Binding key: \`${n.name}.${n.meta.eventStream.bindingKey}\``),n.meta.eventStream.timeDimension&&t.push(`- Time dimension: \`${n.name}.${n.meta.eventStream.timeDimension}\``)),t.push(``)}return t.join(`
|
|
2
|
+
`)}function n(e){return e.messages.map(e=>e.content.text).join(`
|
|
3
3
|
|
|
4
|
-
`)}function i(e){return[`# Drizzle Cube Analytics Agent`,``,`You are an analytics agent that helps users explore and visualize data.`,`You have access to a semantic layer with cubes (data models) that you can query.`,``,`## Your Workflow`,``,`For EACH insight, follow this cycle — do NOT batch all queries first:`,``,"1. **Discover** available cubes using `discover_cubes` (once at the start)",`2. **For each analysis point**, repeat this cycle:`," a. `execute_query` — get the data"," b. `add_markdown` — explain the results and insight"," c. `add_portlet` — visualize the results",``,`Call all three (query → markdown → portlet) in a single turn before moving on to the next analysis.`,`Do NOT run multiple queries first and add charts later — the user sees results in real-time.`,``,`## Important Guidelines`,``,`- ALWAYS discover cubes first before attempting queries`,"- Field names MUST be EXACTLY `CubeName.fieldName` — two parts separated by a single dot. Examples: `PullRequests.count`, `Teams.name`, `Employees.department`."," WRONG patterns that WILL FAIL: `Teams.Teams.name` (double-prefixed), `PullRequests.PullRequests.count` (double-prefixed), `PullRequests` (bare cube), `Teams_count` (underscore). Use the EXACT field names from discover results — copy them verbatim, do not prefix them again.",`- Order keys MUST be one of the measures or dimensions already listed in that query. You CANNOT order by a field that is not in measures or dimensions — add it to measures first, or remove it from order.`,"- After EVERY `execute_query`, IMMEDIATELY call `add_markdown` and `add_portlet` in the SAME turn — never defer visualizations to a later turn",`- Choose appropriate chart types: bar for categories, line for trends, table for detailed data`,`- If a query fails, explain the error and try an alternative approach`,``,`## Output Format Rules`,``,`### CRITICAL: Always think before acting`,`- EVERY single turn MUST begin with a text message (1-2 sentences) BEFORE any tool calls. This is your #1 rule — never violate it.`,`- This applies to EVERY turn, including turns where you are adding visualizations or explanations to the notebook.`,`- Even when adding multiple charts in sequence, each turn must start with a brief status like "Now I'll chart the productivity breakdown." or "Next, let me show the department comparison."`,`- Example good turn: "Let me see what data is available." → discover_cubes`,`- Example good turn: "I'll add a chart showing the top employees." → add_markdown → add_portlet`,`- Example bad turn: (no text) → add_portlet ← NEVER do this`,``,`### Text vs Notebook`,"- ALL analysis, findings, methodology, and insights MUST go through `add_markdown` tool calls — never in your text responses",`- Your text responses must be 1-2 short sentences (under 50 words) summarizing what you are about to do next — status updates only`,`- Never use markdown formatting (headers, bullets, bold, code blocks) in text responses — plain sentences only`,`- Write text responses as a friendly analyst would — use plain business language the user understands`,`- NEVER mention internal terms like "cube", "query syntax", "field names", "measures", "dimensions", "portlet", "prefix format", or tool names in text responses`,`- Instead of "Let me correct the query syntax and retry" → "Let me fix that and try again"`,`- Instead of "I'll query the PullRequests cube" → "I'll look at the pull request data"`,`- Instead of "Adding a portlet with the results" → "Here's a chart of the results"`,``,`### Notebook content rules`,"- Before each `add_portlet`, ALWAYS call `add_markdown` first to explain WHY you are adding this visualization and what it shows","- Before calling `add_portlet`, verify the query is valid: all fields in `order` must also appear in `measures` or `dimensions`",'- Never put data tables in markdown blocks — use `add_portlet` with chartType "table" instead',"- Think out loud in the notebook: use `add_markdown` to share your reasoning at each step so users can follow along",`- NEVER use emojis in text responses or markdown content — no 📊, 📈, ✅, 🔍, etc. Write in plain, professional language.`,``,`## Chart Selection Guide`,``,`Choose the chart type that best communicates the answer to the user's question. Think about what the data represents and what insight the user needs — do NOT default to the first option in this table. Consider the number of data points, whether values are categorical or temporal, and whether the user is comparing, trending, or summarizing.`,``,`| Intent / Data Shape | Chart Type |`,`|---|---|`,"| Compare discrete categories or rankings | `bar` |","| Trend over time (one or few series) | `line` |","| Trend over time showing volume/magnitude | `area` |","| Part-of-whole breakdown | `pie` (≤7 slices) |","| Correlation between two measures | `scatter` |","| Correlation with size/color third dimension | `bubble` |","| Intensity across two categorical dimensions | `heatmap` |","| Multi-variable comparison across categories | `radar` |","| Distribution/spread of values | `boxPlot` |","| Detailed row-level data or many columns | `table` |","| Single headline number — ONLY when user explicitly asks for a KPI card or single number | `kpiNumber` |","| Headline metric with period-over-period change — ONLY when user asks about change in a single metric | `kpiDelta` |",``,`Analysis-mode-specific chart types (require the corresponding analysis mode):`,``,`| Analysis Mode | Chart Type | Description |`,`|---|---|---|`,"| Funnel | `funnel` | Sequential step conversion bars with conversion rates |","| Flow | `sankey` | Flow diagram showing paths between states/steps |","| Flow | `sunburst` | Radial rings showing forward paths from a starting event |","| Retention | `retentionHeatmap` | Cohort × period retention matrix |","| Retention | `retentionCombined` | Retention with line chart, heatmap, or combined modes |",``,'**Chart selection priorities:** Default to `bar` for categories, `line` for time series, `table` for exploratory data. Use `kpiNumber`/`kpiDelta` only as a last resort — they are appropriate only when the user explicitly asks for a single headline number or KPI card. If the query returns multiple rows or the user asks a general question like "show me revenue", prefer `bar` or `table` over `kpiNumber`.',``,`## Chart Axis Configuration Rules`,``,"**Bar charts MUST have an xAxis.** Put a dimension in `chartConfig.xAxis` so bars have category labels. If your query has no dimensions, add one or use `table` instead.",``,"**Never duplicate xAxis in series.** Putting the same dimension in both `xAxis` and `series` creates a sparse, broken-looking chart. The `series` field is ONLY for splitting bars into grouped/stacked sub-series by a SECOND dimension.",``,`Correct bar chart examples:`,'- Categories only: `xAxis: ["Cube.category"], yAxis: ["Cube.count"]` — no series needed','- Grouped bars: `xAxis: ["Cube.category"], yAxis: ["Cube.count"], series: ["Cube.status"]` — series is a DIFFERENT dimension','- Multiple measures: `xAxis: ["Cube.category"], yAxis: ["Cube.count", "Cube.total"]` — each measure becomes a bar group',``,`Wrong:`,'- `xAxis: [], yAxis: ["Cube.avg1", "Cube.avg2"]` — missing xAxis, bars have no labels','- `xAxis: ["Cube.size"], series: ["Cube.size"]` — same field in both, creates sparse chart',``,"**Dual Y-axis for multi-measure charts.** When a `bar`, `line`, or `area` chart has 2+ measures with different scales (e.g. revenue in thousands vs conversion rate as a percentage), use `chartConfig.yAxisAssignment` to put them on separate axes:","```json",`{`,` "xAxis": ["Sales.month"],`,` "yAxis": ["Sales.revenue", "Sales.conversionRate"],`,` "yAxisAssignment": { "Sales.revenue": "left", "Sales.conversionRate": "right" }`,`}`,"```",`Only use dual axis when measures have genuinely different scales. If both measures share the same unit/scale, keep them on the same (left) axis — omit yAxisAssignment entirely.`,``,`## Analysis Mode Decision Tree`,``,`The default mode is **query** (standard measures/dimensions). Switch to a special mode only when the user's question matches:`,``,`- **Funnel mode** — "What is the conversion rate from step A → B → C?"`," - Requires: an event-stream cube with `capabilities.funnel = true` from `discover_cubes`"," - Execute: `execute_query` with `funnel` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", steps: [{ name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, { name: "Purchase", filter: { member: "Events.eventName", operator: "equals", values: ["purchase"] }}] }`',' - Visualize: `add_portlet` with `chartType: "funnel"` and `query` as JSON string containing `{ "funnel": { ... } }`',``,`- **Flow mode** — "What paths do users take after signup?"`," - Requires: `capabilities.flow = true` from `discover_cubes`"," - Execute: `execute_query` with `flow` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", eventDimension: "Events.eventName", startingStep: { name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, stepsBefore: 0, stepsAfter: 3 }`',' - Visualize: `add_portlet` with `chartType: "sankey"` (or `"sunburst"`) and `query` as JSON string containing `{ "flow": { ... } }`',``,`- **Retention mode** — "What % of users come back after 7 days?"`," - Requires: `capabilities.retention = true` from `discover_cubes`"," - Execute: `execute_query` with `retention` param:",' `{ timeDimension: "Events.timestamp", bindingKey: "Events.userId", dateRange: { start: "2024-01-01", end: "2024-03-31" }, granularity: "week", periods: 8, retentionType: "classic" }`',' - Visualize: `add_portlet` with `chartType: "retentionCombined"` (or `"retentionHeatmap"`) and `query` as JSON string containing `{ "retention": { ... } }`',``,"Before using funnel/flow/retention, check the `capabilities` object returned by `discover_cubes`. If the required capability is `false`, explain to the user that the data model does not support that analysis mode.",``,`Event-stream cubes are marked in the Available Cubes section below with **Event Stream: Yes** and list their binding key and time dimension.`,``,`---`,``,r(t.n),``,`---`,``,r(t.r),``,`---`,``,r(t.t),``,`---`,``,`## Save as Dashboard`,``,"ONLY call `save_as_dashboard` when the user EXPLICITLY asks to save, export, or convert the notebook into a dashboard. NEVER save a dashboard on your own initiative — wait for the user to request it.",``,`### Layout Rules`,`- Dashboard grid is 12 columns wide`,`- KPI cards: w=3, h=3 — place at the top in a row of 4`,`- Overview charts (bar, line, area): w=6, h=4`,`- Wide charts (heatmap, table): w=12, h=5`,`- Section headers (markdown): w=12, h=1`,``,`### Section Headers`,'Use `chartType: "markdown"` portlets as section headers to organize the dashboard:',"```json",`{`,` "id": "header-overview",`,` "title": "Overview",`,` "chartType": "markdown",`,` "displayConfig": {`,` "content": "## Overview",`,` "hideHeader": true,`,` "transparentBackground": true,`,` "autoHeight": true`,` },`,` "w": 12, "h": 1, "x": 0, "y": 0`,`}`,"```",``,`### Dashboard Filters`,"- ALWAYS include a universal date filter with `isUniversalTime: true`",`- Add dimension filters for key fields used across portlets (e.g., department, status, region)`,`- Use human-readable labels (e.g., "Department" not "Employees.departmentName")`,"- Map filters to portlets using `dashboardFilterMapping` — list the filter IDs that apply",`- When promoting a hardcoded filter to a dashboard filter, REMOVE that filter from the portlet query`,``,`### Analysis Types`,'- Standard query portlets: `analysisType: "query"` (default)','- Funnel portlets: `analysisType: "funnel"`, query contains `{ "funnel": {...} }`, chartType `"funnel"`','- Flow portlets: `analysisType: "flow"`, query contains `{ "flow": {...} }`, chartType `"sankey"` or `"sunburst"`','- Retention portlets: `analysisType: "retention"`, query contains `{ "retention": {...} }`, chartType `"retentionHeatmap"` or `"retentionCombined"`',``,`### CRITICAL: Only use portlets from the notebook`,"- ONLY include portlets that you already added to the notebook via `add_portlet` during this conversation",`- Do NOT invent new queries or charts that were not part of the analysis — the dashboard is a direct conversion of the notebook`,`- Reuse the exact same queries, chart types, and chart configs from the notebook portlets`,`- Arrange the existing portlets in a sensible layout (KPIs at top, charts in middle, tables at bottom)`,`- You may add section header markdown portlets to organize the layout, but do not add new data portlets`,``,`---`,``,n(e)].join(`
|
|
5
|
-
`)}var a={bar:{label:`chart.bar.label`,description:`chart.bar.description`,useCase:`chart.bar.useCase`,clickableElements:{bar:!0},dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.dropZone.xAxis.description`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.bar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_bar_heights`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.bar.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.dropZone.series.label`,description:`chart.dropZone.series.description`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.bar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_bar_series`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},line:{label:`chart.line.label`,description:`chart.line.description`,useCase:`chart.line.useCase`,clickableElements:{point:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.line.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_line_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.line.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_multiple_lines`,description:`chart.configText.dimensions_to_create_separate_lines`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.line.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`priorPeriodStyle`,label:`chart.option.priorPeriodStyle.label`,type:`select`,defaultValue:`dashed`,options:[{value:`dashed`,label:`chart.option.priorPeriodStyle.dashed`},{value:`dotted`,label:`chart.option.priorPeriodStyle.dotted`},{value:`solid`,label:`chart.option.priorPeriodStyle.solid`}],description:`chart.option.priorPeriodStyle.description`},{key:`priorPeriodOpacity`,label:`chart.option.priorPeriodOpacity.label`,type:`number`,defaultValue:.5,min:.1,max:1,step:.1,description:`chart.option.priorPeriodOpacity.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},area:{label:`chart.area.label`,description:`chart.area.description`,useCase:`chart.area.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.area.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_area_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.area.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_stack_areas`,description:`chart.configText.dimensions_to_create_stacked_areas`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.area.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_area_series`},{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},pie:{label:`chart.pie.label`,description:`chart.pie.description`,useCase:`chart.pie.useCase`,clickableElements:{slice:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimension_for_pie_slices`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.pie.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measure_for_slice_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.pie.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`select`,description:`chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style`,defaultValue:`0%`,options:[{value:`0%`,label:`chart.configText.none_pie`},{value:`20%`,label:`chart.configText.20_percent`},{value:`40%`,label:`chart.configText.40_percent`},{value:`60%`,label:`chart.configText.60_percent`},{value:`80%`,label:`chart.configText.80_percent`}]},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},scatter:{label:`chart.scatter.label`,description:`chart.scatter.description`,useCase:`chart.scatter.useCase`,dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.measure_or_dimension_for_x_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.scatter.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.measure_for_y_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.scatter.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_color_groups`,description:`chart.configText.dimension_to_color_points_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.scatter.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.option.yAxisFormat.description`}]},bubble:{label:`chart.bubble.label`,description:`chart.bubble.description`,useCase:`chart.bubble.useCase`,dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.horizontal_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.bubble.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.vertical_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.yAxis.empty`},{key:`sizeField`,label:`chart.configText.bubble_radius`,description:`chart.configText.size_of_bubbles_based_on_this_measure`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.sizeField.empty`},{key:`series`,label:`chart.configText.bubble_labels`,description:`chart.configText.field_to_use_for_bubble_labels_and_identification`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.bubble.dropZone.series.empty`},{key:`colorField`,label:`chart.configText.bubble_colour`,description:`chart.configText.color_bubbles_by_this_field_optional`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`measure`],emptyText:`chart.bubble.dropZone.colorField.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`minBubbleSize`,`maxBubbleSize`,`bubbleOpacity`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_and_values`}]},radar:{label:`chart.radar.label`,description:`chart.radar.description`,useCase:`chart.radar.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.axes_categories`,description:`chart.configText.dimensions_for_radar_axes`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radar_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.radar.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_multiple_shapes`,description:`chart.configText.dimensions_to_create_multiple_radar_shapes`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},radialBar:{label:`chart.radialBar.label`,description:`chart.radialBar.description`,useCase:`chart.radialBar.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_radial_segments`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radialBar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radial_bar_lengths`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.radialBar.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},treemap:{label:`chart.treemap.label`,description:`chart.treemap.description`,useCase:`chart.treemap.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_treemap_rectangles`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.size`,description:`chart.configText.measure_for_rectangle_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.treemap.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.color_groups`,description:`chart.configText.dimension_to_color_rectangles_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.series.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_size_values`}],clickableElements:{cell:!0}},table:{label:`chart.table.label`,description:`chart.table.description`,useCase:`chart.table.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.columns`,description:`chart.configText.all_fields_to_display_as_columns`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.table.dropZone.xAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_numeric_values`}]},activityGrid:{label:`chart.activityGrid.label`,description:`chart.activityGrid.description`,useCase:`chart.activityGrid.useCase`,dropZones:[{key:`dateField`,label:`chart.configText.time_dimension`,description:`chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`],emptyText:`chart.activityGrid.dropZone.dateField.empty`},{key:`valueField`,label:`chart.configText.activity_measure`,description:`chart.configText.measure_used_for_activity_intensity_color_coding`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.activityGrid.dropZone.valueField.empty`}],displayOptions:[`showLabels`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`fitToWidth`,label:`chart.option.fitToWidth.label`,type:`boolean`,defaultValue:!1,description:`chart.option.fitToWidth.description`}],validate:e=>{let{dateField:t,valueField:n}=e;return!t||Array.isArray(t)&&t.length===0?{isValid:!1,message:`chart.activityGrid.validation.timeDimensionRequired`}:!n||Array.isArray(n)&&n.length===0?{isValid:!1,message:`chart.activityGrid.validation.measureRequired`}:{isValid:!0}},clickableElements:{cell:!0}},kpiNumber:{label:`chart.kpiNumber.label`,description:`chart.kpiNumber.description`,useCase:`chart.kpiNumber.useCase`,dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_as_kpi_number`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiNumber.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`target`,label:`chart.runtime.tooltip.targetValue`,type:`string`,placeholder:`e.g., 100`,description:`chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided`},{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`]},kpiDelta:{label:`chart.kpiDelta.label`,description:`chart.kpiDelta.description`,useCase:`chart.kpiDelta.useCase`,dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_track_changes_for`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiDelta.dropZone.yAxis.empty`},{key:`xAxis`,label:`chart.configText.dimension_optional`,description:`chart.configText.dimension_for_ordering_data_typically_time`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.kpiDelta.dropZone.xAxis.empty`}],displayOptionsConfig:[{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:1,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`positiveColorIndex`,label:`chart.configText.positive_change_color`,type:`paletteColor`,defaultValue:2,description:`chart.configText.color_for_positive_changes_increases`},{key:`negativeColorIndex`,label:`chart.configText.negative_change_color`,type:`paletteColor`,defaultValue:3,description:`chart.configText.color_for_negative_changes_decreases`},{key:`showHistogram`,label:`chart.option.showHistogram.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showHistogram.description`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`],validate:e=>!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0?{isValid:!1,message:`chart.kpiDelta.validation.measureRequired`}:{isValid:!0}},kpiText:{label:`chart.kpiText.label`,description:`chart.kpiText.description`,useCase:`chart.kpiText.useCase`,dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_in_the_kpi_text_template`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiText.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`template`,label:`chart.configText.text_template`,type:`string`,placeholder:"e.g., Total Revenue: ${value}",description:`chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.configText.number_of_decimal_places_to_display_for_numeric_values`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`}],displayOptions:[`hideHeader`]},markdown:{label:`chart.markdown.label`,description:`chart.markdown.description`,useCase:`chart.markdown.useCase`,skipQuery:!0,dropZones:[],displayOptionsConfig:[{key:`content`,label:`chart.configText.markdown_content`,type:`string`,placeholder:`# Welcome
|
|
4
|
+
`)}function r(r){return[`# Drizzle Cube Analytics Agent`,``,`You are an analytics agent that helps users explore and visualize data.`,`You have access to a semantic layer with cubes (data models) that you can query.`,``,`## Your Workflow`,``,`For EACH insight, follow this cycle — do NOT batch all queries first:`,``,"1. **Discover** available cubes using `discover_cubes` (once at the start)",`2. **For each analysis point**, repeat this cycle:`," a. `execute_query` — get the data"," b. `add_markdown` — explain the results and insight"," c. `add_portlet` — visualize the results",``,`Call all three (query → markdown → portlet) in a single turn before moving on to the next analysis.`,`Do NOT run multiple queries first and add charts later — the user sees results in real-time.`,``,`## Important Guidelines`,``,`- ALWAYS discover cubes first before attempting queries`,"- Field names MUST be EXACTLY `CubeName.fieldName` — two parts separated by a single dot. Examples: `PullRequests.count`, `Teams.name`, `Employees.department`."," WRONG patterns that WILL FAIL: `Teams.Teams.name` (double-prefixed), `PullRequests.PullRequests.count` (double-prefixed), `PullRequests` (bare cube), `Teams_count` (underscore). Use the EXACT field names from discover results — copy them verbatim, do not prefix them again.",`- Order keys MUST be one of the measures or dimensions already listed in that query. You CANNOT order by a field that is not in measures or dimensions — add it to measures first, or remove it from order.`,"- After EVERY `execute_query`, IMMEDIATELY call `add_markdown` and `add_portlet` in the SAME turn — never defer visualizations to a later turn",`- Choose appropriate chart types: bar for categories, line for trends, table for detailed data`,`- If a query fails, explain the error and try an alternative approach`,``,`## Output Format Rules`,``,`### CRITICAL: Always think before acting`,`- EVERY single turn MUST begin with a text message (1-2 sentences) BEFORE any tool calls. This is your #1 rule — never violate it.`,`- This applies to EVERY turn, including turns where you are adding visualizations or explanations to the notebook.`,`- Even when adding multiple charts in sequence, each turn must start with a brief status like "Now I'll chart the productivity breakdown." or "Next, let me show the department comparison."`,`- Example good turn: "Let me see what data is available." → discover_cubes`,`- Example good turn: "I'll add a chart showing the top employees." → add_markdown → add_portlet`,`- Example bad turn: (no text) → add_portlet ← NEVER do this`,``,`### Text vs Notebook`,"- ALL analysis, findings, methodology, and insights MUST go through `add_markdown` tool calls — never in your text responses",`- Your text responses must be 1-2 short sentences (under 50 words) summarizing what you are about to do next — status updates only`,`- Never use markdown formatting (headers, bullets, bold, code blocks) in text responses — plain sentences only`,`- Write text responses as a friendly analyst would — use plain business language the user understands`,`- NEVER mention internal terms like "cube", "query syntax", "field names", "measures", "dimensions", "portlet", "prefix format", or tool names in text responses`,`- Instead of "Let me correct the query syntax and retry" → "Let me fix that and try again"`,`- Instead of "I'll query the PullRequests cube" → "I'll look at the pull request data"`,`- Instead of "Adding a portlet with the results" → "Here's a chart of the results"`,``,`### Notebook content rules`,"- Before each `add_portlet`, ALWAYS call `add_markdown` first to explain WHY you are adding this visualization and what it shows","- Before calling `add_portlet`, verify the query is valid: all fields in `order` must also appear in `measures` or `dimensions`",'- Never put data tables in markdown blocks — use `add_portlet` with chartType "table" instead',"- Think out loud in the notebook: use `add_markdown` to share your reasoning at each step so users can follow along",`- NEVER use emojis in text responses or markdown content — no 📊, 📈, ✅, 🔍, etc. Write in plain, professional language.`,``,`## Chart Selection Guide`,``,`Choose the chart type that best communicates the answer to the user's question. Think about what the data represents and what insight the user needs — do NOT default to the first option in this table. Consider the number of data points, whether values are categorical or temporal, and whether the user is comparing, trending, or summarizing.`,``,`| Intent / Data Shape | Chart Type |`,`|---|---|`,"| Compare discrete categories or rankings | `bar` |","| Trend over time (one or few series) | `line` |","| Trend over time showing volume/magnitude | `area` |","| Part-of-whole breakdown | `pie` (≤7 slices) |","| Correlation between two measures | `scatter` |","| Correlation with size/color third dimension | `bubble` |","| Intensity across two categorical dimensions | `heatmap` |","| Multi-variable comparison across categories | `radar` |","| Distribution/spread of values | `boxPlot` |","| Detailed row-level data or many columns | `table` |","| Single headline number — ONLY when user explicitly asks for a KPI card or single number | `kpiNumber` |","| Headline metric with period-over-period change — ONLY when user asks about change in a single metric | `kpiDelta` |",``,`Analysis-mode-specific chart types (require the corresponding analysis mode):`,``,`| Analysis Mode | Chart Type | Description |`,`|---|---|---|`,"| Funnel | `funnel` | Sequential step conversion bars with conversion rates |","| Flow | `sankey` | Flow diagram showing paths between states/steps |","| Flow | `sunburst` | Radial rings showing forward paths from a starting event |","| Retention | `retentionHeatmap` | Cohort × period retention matrix |","| Retention | `retentionCombined` | Retention with line chart, heatmap, or combined modes |",``,'**Chart selection priorities:** Default to `bar` for categories, `line` for time series, `table` for exploratory data. Use `kpiNumber`/`kpiDelta` only as a last resort — they are appropriate only when the user explicitly asks for a single headline number or KPI card. If the query returns multiple rows or the user asks a general question like "show me revenue", prefer `bar` or `table` over `kpiNumber`.',``,`## Chart Axis Configuration Rules`,``,"**Bar charts MUST have an xAxis.** Put a dimension in `chartConfig.xAxis` so bars have category labels. If your query has no dimensions, add one or use `table` instead.",``,"**Never duplicate xAxis in series.** Putting the same dimension in both `xAxis` and `series` creates a sparse, broken-looking chart. The `series` field is ONLY for splitting bars into grouped/stacked sub-series by a SECOND dimension.",``,`Correct bar chart examples:`,'- Categories only: `xAxis: ["Cube.category"], yAxis: ["Cube.count"]` — no series needed','- Grouped bars: `xAxis: ["Cube.category"], yAxis: ["Cube.count"], series: ["Cube.status"]` — series is a DIFFERENT dimension','- Multiple measures: `xAxis: ["Cube.category"], yAxis: ["Cube.count", "Cube.total"]` — each measure becomes a bar group',``,`Wrong:`,'- `xAxis: [], yAxis: ["Cube.avg1", "Cube.avg2"]` — missing xAxis, bars have no labels','- `xAxis: ["Cube.size"], series: ["Cube.size"]` — same field in both, creates sparse chart',``,"**Dual Y-axis for multi-measure charts.** When a `bar`, `line`, or `area` chart has 2+ measures with different scales (e.g. revenue in thousands vs conversion rate as a percentage), use `chartConfig.yAxisAssignment` to put them on separate axes:","```json",`{`,` "xAxis": ["Sales.month"],`,` "yAxis": ["Sales.revenue", "Sales.conversionRate"],`,` "yAxisAssignment": { "Sales.revenue": "left", "Sales.conversionRate": "right" }`,`}`,"```",`Only use dual axis when measures have genuinely different scales. If both measures share the same unit/scale, keep them on the same (left) axis — omit yAxisAssignment entirely.`,``,`## Analysis Mode Decision Tree`,``,`The default mode is **query** (standard measures/dimensions). Switch to a special mode only when the user's question matches:`,``,`- **Funnel mode** — "What is the conversion rate from step A → B → C?"`," - Requires: an event-stream cube with `capabilities.funnel = true` from `discover_cubes`"," - Execute: `execute_query` with `funnel` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", steps: [{ name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, { name: "Purchase", filter: { member: "Events.eventName", operator: "equals", values: ["purchase"] }}] }`',' - Visualize: `add_portlet` with `chartType: "funnel"` and `query` as JSON string containing `{ "funnel": { ... } }`',``,`- **Flow mode** — "What paths do users take after signup?"`," - Requires: `capabilities.flow = true` from `discover_cubes`"," - Execute: `execute_query` with `flow` param:",' `{ bindingKey: "Events.userId", timeDimension: "Events.timestamp", eventDimension: "Events.eventName", startingStep: { name: "Signup", filter: { member: "Events.eventName", operator: "equals", values: ["signup"] }}, stepsBefore: 0, stepsAfter: 3 }`',' - Visualize: `add_portlet` with `chartType: "sankey"` (or `"sunburst"`) and `query` as JSON string containing `{ "flow": { ... } }`',``,`- **Retention mode** — "What % of users come back after 7 days?"`," - Requires: `capabilities.retention = true` from `discover_cubes`"," - Execute: `execute_query` with `retention` param:",' `{ timeDimension: "Events.timestamp", bindingKey: "Events.userId", dateRange: { start: "2024-01-01", end: "2024-03-31" }, granularity: "week", periods: 8, retentionType: "classic" }`',' - Visualize: `add_portlet` with `chartType: "retentionCombined"` (or `"retentionHeatmap"`) and `query` as JSON string containing `{ "retention": { ... } }`',``,"Before using funnel/flow/retention, check the `capabilities` object returned by `discover_cubes`. If the required capability is `false`, explain to the user that the data model does not support that analysis mode.",``,`Event-stream cubes are marked in the Available Cubes section below with **Event Stream: Yes** and list their binding key and time dimension.`,``,`---`,``,n(e.v),``,`---`,``,n(e.y),``,`---`,``,n(e._),``,`---`,``,`## Save as Dashboard`,``,"ONLY call `save_as_dashboard` when the user EXPLICITLY asks to save, export, or convert the notebook into a dashboard. NEVER save a dashboard on your own initiative — wait for the user to request it.",``,`### Layout Rules`,`- Dashboard grid is 12 columns wide`,`- KPI cards: w=3, h=3 — place at the top in a row of 4`,`- Overview charts (bar, line, area): w=6, h=4`,`- Wide charts (heatmap, table): w=12, h=5`,`- Section headers (markdown): w=12, h=1`,``,`### Section Headers`,'Use `chartType: "markdown"` portlets as section headers to organize the dashboard:',"```json",`{`,` "id": "header-overview",`,` "title": "Overview",`,` "chartType": "markdown",`,` "displayConfig": {`,` "content": "## Overview",`,` "hideHeader": true,`,` "transparentBackground": true,`,` "autoHeight": true`,` },`,` "w": 12, "h": 1, "x": 0, "y": 0`,`}`,"```",``,`### Dashboard Filters`,"- ALWAYS include a universal date filter with `isUniversalTime: true`",`- Add dimension filters for key fields used across portlets (e.g., department, status, region)`,`- Use human-readable labels (e.g., "Department" not "Employees.departmentName")`,"- Map filters to portlets using `dashboardFilterMapping` — list the filter IDs that apply",`- When promoting a hardcoded filter to a dashboard filter, REMOVE that filter from the portlet query`,``,`### Analysis Types`,'- Standard query portlets: `analysisType: "query"` (default)','- Funnel portlets: `analysisType: "funnel"`, query contains `{ "funnel": {...} }`, chartType `"funnel"`','- Flow portlets: `analysisType: "flow"`, query contains `{ "flow": {...} }`, chartType `"sankey"` or `"sunburst"`','- Retention portlets: `analysisType: "retention"`, query contains `{ "retention": {...} }`, chartType `"retentionHeatmap"` or `"retentionCombined"`',``,`### CRITICAL: Only use portlets from the notebook`,"- ONLY include portlets that you already added to the notebook via `add_portlet` during this conversation",`- Do NOT invent new queries or charts that were not part of the analysis — the dashboard is a direct conversion of the notebook`,`- Reuse the exact same queries, chart types, and chart configs from the notebook portlets`,`- Arrange the existing portlets in a sensible layout (KPIs at top, charts in middle, tables at bottom)`,`- You may add section header markdown portlets to organize the layout, but do not add new data portlets`,``,`---`,``,t(r)].join(`
|
|
5
|
+
`)}var i={bar:{label:`chart.bar.label`,description:`chart.bar.description`,useCase:`chart.bar.useCase`,clickableElements:{bar:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.dropZone.xAxis.description`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.bar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_bar_heights`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.bar.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.dropZone.series.label`,description:`chart.dropZone.series.description`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.bar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_bar_series`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},line:{label:`chart.line.label`,description:`chart.line.description`,useCase:`chart.line.useCase`,clickableElements:{point:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.line.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_line_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.line.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_multiple_lines`,description:`chart.configText.dimensions_to_create_separate_lines`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.line.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`priorPeriodStyle`,label:`chart.option.priorPeriodStyle.label`,type:`select`,defaultValue:`dashed`,options:[{value:`dashed`,label:`chart.option.priorPeriodStyle.dashed`},{value:`dotted`,label:`chart.option.priorPeriodStyle.dotted`},{value:`solid`,label:`chart.option.priorPeriodStyle.solid`}],description:`chart.option.priorPeriodStyle.description`},{key:`priorPeriodOpacity`,label:`chart.option.priorPeriodOpacity.label`,type:`number`,defaultValue:.5,min:.1,max:1,step:.1,description:`chart.option.priorPeriodOpacity.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},area:{label:`chart.area.label`,description:`chart.area.description`,useCase:`chart.area.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_categories`,description:`chart.configText.time_dimensions_or_dimensions_for_x_axis`,mandatory:!0,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.area.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.dropZone.yAxis.label`,description:`chart.configText.measures_for_area_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.area.dropZone.yAxis.empty`,enableDualAxis:!0},{key:`series`,label:`chart.configText.series_stack_areas`,description:`chart.configText.dimensions_to_create_stacked_areas`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.area.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`stackType`,label:`chart.option.stacking.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`normal`,label:`chart.option.stacking.stacked`},{value:`percent`,label:`chart.option.stacking.percent`}],description:`chart.configText.how_to_stack_multiple_area_series`},{key:`connectNulls`,label:`chart.option.connectNulls.label`,type:`boolean`,defaultValue:!1,description:`chart.option.connectNulls.description`},{key:`target`,label:`chart.option.target.label`,type:`string`,placeholder:`e.g., 100 or 50,75 for spread`,description:`chart.option.target.description`},{key:`leftYAxisFormat`,label:`chart.option.leftYAxisFormat.label`,type:`axisFormat`,description:`chart.option.leftYAxisFormat.description`},{key:`rightYAxisFormat`,label:`chart.option.rightYAxisFormat.label`,type:`axisFormat`,description:`chart.option.rightYAxisFormat.description`}]},pie:{label:`chart.pie.label`,description:`chart.pie.description`,useCase:`chart.pie.useCase`,clickableElements:{slice:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimension_for_pie_slices`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.pie.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measure_for_slice_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.pie.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`select`,description:`chart.configText.hollow_center_size_0_percent_solid_pie_higher_donut_style`,defaultValue:`0%`,options:[{value:`0%`,label:`chart.configText.none_pie`},{value:`20%`,label:`chart.configText.20_percent`},{value:`40%`,label:`chart.configText.40_percent`},{value:`60%`,label:`chart.configText.60_percent`},{value:`80%`,label:`chart.configText.80_percent`}]},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},scatter:{label:`chart.scatter.label`,description:`chart.scatter.description`,useCase:`chart.scatter.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:e<2&&t<1?{available:!1,reason:`chart.availability.scatter`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.measure_or_dimension_for_x_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.scatter.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.measure_for_y_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.scatter.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_color_groups`,description:`chart.configText.dimension_to_color_points_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.scatter.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.option.yAxisFormat.description`}]},bubble:{label:`chart.bubble.label`,description:`chart.bubble.description`,useCase:`chart.bubble.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<2?{available:!1,reason:`chart.availability.requiresTwoMeasures`}:t<1?{available:!1,reason:`chart.availability.bubble`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.runtime.axisFormat.xAxis`,description:`chart.configText.horizontal_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.bubble.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis`,description:`chart.configText.vertical_axis_position`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.yAxis.empty`},{key:`sizeField`,label:`chart.configText.bubble_radius`,description:`chart.configText.size_of_bubbles_based_on_this_measure`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.bubble.dropZone.sizeField.empty`},{key:`series`,label:`chart.configText.bubble_labels`,description:`chart.configText.field_to_use_for_bubble_labels_and_identification`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.bubble.dropZone.series.empty`},{key:`colorField`,label:`chart.configText.bubble_colour`,description:`chart.configText.color_bubbles_by_this_field_optional`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`measure`],emptyText:`chart.bubble.dropZone.colorField.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`minBubbleSize`,`maxBubbleSize`,`bubbleOpacity`,`hideHeader`],displayOptionsConfig:[{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.option.xAxisFormat.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_and_values`}]},radar:{label:`chart.radar.label`,description:`chart.radar.description`,useCase:`chart.radar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.axes_categories`,description:`chart.configText.dimensions_for_radar_axes`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radar_values`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.radar.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_multiple_shapes`,description:`chart.configText.dimensions_to_create_multiple_radar_shapes`,mandatory:!1,acceptTypes:[`dimension`],emptyText:`chart.radar.dropZone.series.empty`}],displayOptions:[`showLegend`,`showGrid`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},radialBar:{label:`chart.radialBar.label`,description:`chart.radialBar.description`,useCase:`chart.radialBar.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_radial_segments`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.radialBar.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.values`,description:`chart.configText.measures_for_radial_bar_lengths`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.radialBar.dropZone.yAxis.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.option.valueFormat.description`}]},treemap:{label:`chart.treemap.label`,description:`chart.treemap.description`,useCase:`chart.treemap.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.categories`,description:`chart.configText.dimensions_for_treemap_rectangles`,mandatory:!0,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.size`,description:`chart.configText.measure_for_rectangle_sizes`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.treemap.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.color_groups`,description:`chart.configText.dimension_to_color_rectangles_by_category`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.treemap.dropZone.series.empty`}],displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_size_values`}],clickableElements:{cell:!0}},table:{label:`chart.table.label`,description:`chart.table.description`,useCase:`chart.table.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.columns`,description:`chart.configText.all_fields_to_display_as_columns`,mandatory:!1,acceptTypes:[`dimension`,`timeDimension`,`measure`],emptyText:`chart.table.dropZone.xAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_numeric_values`}]},activityGrid:{label:`chart.activityGrid.label`,description:`chart.activityGrid.description`,useCase:`chart.activityGrid.useCase`,isAvailable:({measureCount:e,timeDimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresTimeDimension`}:{available:!0},dropZones:[{key:`dateField`,label:`chart.configText.time_dimension`,description:`chart.configText.time_field_that_determines_grid_structure_granularity_affects_layout`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`],emptyText:`chart.activityGrid.dropZone.dateField.empty`},{key:`valueField`,label:`chart.configText.activity_measure`,description:`chart.configText.measure_used_for_activity_intensity_color_coding`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.activityGrid.dropZone.valueField.empty`}],displayOptions:[`showLabels`,`showTooltip`,`hideHeader`],displayOptionsConfig:[{key:`fitToWidth`,label:`chart.option.fitToWidth.label`,type:`boolean`,defaultValue:!1,description:`chart.option.fitToWidth.description`}],validate:e=>{let{dateField:t,valueField:n}=e;return!t||Array.isArray(t)&&t.length===0?{isValid:!1,message:`chart.activityGrid.validation.timeDimensionRequired`}:!n||Array.isArray(n)&&n.length===0?{isValid:!1,message:`chart.activityGrid.validation.measureRequired`}:{isValid:!0}},clickableElements:{cell:!0}},kpiNumber:{label:`chart.kpiNumber.label`,description:`chart.kpiNumber.description`,useCase:`chart.kpiNumber.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_as_kpi_number`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiNumber.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`target`,label:`chart.runtime.tooltip.targetValue`,type:`string`,placeholder:`e.g., 100`,description:`chart.configText.target_value_to_compare_against_first_value_used_if_multiple_provided`},{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_aggregation_e_g_partial_week_mont`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`]},kpiDelta:{label:`chart.kpiDelta.label`,description:`chart.kpiDelta.description`,useCase:`chart.kpiDelta.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_track_changes_for`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiDelta.dropZone.yAxis.empty`},{key:`xAxis`,label:`chart.configText.dimension_optional`,description:`chart.configText.dimension_for_ordering_data_typically_time`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.kpiDelta.dropZone.xAxis.empty`}],displayOptionsConfig:[{key:`prefix`,label:`chart.option.prefix.label`,type:`string`,placeholder:`e.g., $, €, #`,description:`chart.option.prefix.description`},{key:`suffix`,label:`chart.option.suffix.label`,type:`string`,placeholder:`e.g., %, units, items`,description:`chart.option.suffix.description`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:1,min:0,max:10,step:1,description:`chart.option.decimals.description`},{key:`positiveColorIndex`,label:`chart.configText.positive_change_color`,type:`paletteColor`,defaultValue:2,description:`chart.configText.color_for_positive_changes_increases`},{key:`negativeColorIndex`,label:`chart.configText.negative_change_color`,type:`paletteColor`,defaultValue:3,description:`chart.configText.color_for_negative_changes_decreases`},{key:`showHistogram`,label:`chart.option.showHistogram.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showHistogram.description`},{key:`useLastCompletePeriod`,label:`chart.option.useLastCompletePeriod.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.exclude_current_incomplete_period_from_delta_calculation_e_g_partial_wee`},{key:`skipLastPeriod`,label:`chart.option.skipLastPeriod.label`,type:`boolean`,defaultValue:!1,description:`chart.option.skipLastPeriod.description`}],displayOptions:[`hideHeader`],validate:e=>!e.yAxis||Array.isArray(e.yAxis)&&e.yAxis.length===0?{isValid:!1,message:`chart.kpiDelta.validation.measureRequired`}:{isValid:!0}},kpiText:{label:`chart.kpiText.label`,description:`chart.kpiText.description`,useCase:`chart.kpiText.useCase`,isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value`,description:`chart.configText.measure_to_display_in_the_kpi_text_template`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.kpiText.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`template`,label:`chart.configText.text_template`,type:`string`,placeholder:"e.g., Total Revenue: ${value}",description:`chart.configText.template_for_displaying_the_text_use_value_to_insert_the_measure_value`},{key:`decimals`,label:`chart.option.decimals.label`,type:`number`,defaultValue:0,min:0,max:10,step:1,description:`chart.configText.number_of_decimal_places_to_display_for_numeric_values`},{key:`valueColorIndex`,label:`chart.configText.value_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_the_kpi_value_text`}],displayOptions:[`hideHeader`]},markdown:{label:`chart.markdown.label`,description:`chart.markdown.description`,useCase:`chart.markdown.useCase`,skipQuery:!0,dropZones:[],displayOptionsConfig:[{key:`content`,label:`chart.configText.markdown_content`,type:`string`,placeholder:`# Welcome
|
|
6
6
|
|
|
7
7
|
Add your **markdown** content here:
|
|
8
8
|
|
|
@@ -12,14 +12,14 @@ Add your **markdown** content here:
|
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
|
-
Use --- for horizontal rules.`,description:`chart.configText.enter_markdown_text_supports_headers_bold_text_italic_text_links_text_ur`},{key:`accentColorIndex`,label:`chart.configText.accent_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_headers_bullets_and_links`},{key:`fontSize`,label:`chart.option.fontSize.label`,type:`select`,defaultValue:`medium`,options:[{value:`small`,label:`chart.option.fontSize.small`},{value:`medium`,label:`chart.option.fontSize.medium`},{value:`large`,label:`chart.option.fontSize.large`}],description:`chart.configText.overall_text_size_for_the_markdown_content`},{key:`alignment`,label:`chart.option.alignment.label`,type:`select`,defaultValue:`left`,options:[{value:`left`,label:`chart.option.accentBorder.left`},{value:`center`,label:`chart.option.alignment.center`},{value:`right`,label:`chart.option.alignment.right`}],description:`chart.configText.horizontal_alignment_of_the_markdown_content`},{key:`hideHeader`,label:`chart.option.hideHeader.label`,type:`boolean`,defaultValue:!0,description:`chart.option.hideHeader.description`},{key:`transparentBackground`,label:`chart.option.transparentBackground.label`,type:`boolean`,defaultValue:!1,description:`chart.option.transparentBackground.description`},{key:`autoHeight`,label:`chart.option.autoHeight.label`,type:`boolean`,defaultValue:!0,description:`chart.option.autoHeight.description`},{key:`accentBorder`,label:`chart.option.accentBorder.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`left`,label:`chart.option.accentBorder.left`},{value:`top`,label:`chart.option.accentBorder.top`},{value:`bottom`,label:`chart.option.accentBorder.bottom`}],description:`chart.configText.add_an_accent_colored_border_on_one_side_of_the_content`}]},funnel:{label:`chart.funnel.label`,description:`chart.funnel.description`,useCase:`chart.funnel.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.step_name`,description:`chart.configText.step_names_auto_populated_from_funnel_steps`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.funnel.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.step_count`,description:`chart.configText.count_at_each_step_auto_calculated`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.funnel.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`funnelStyle`,label:`chart.option.funnelStyle.label`,type:`buttonGroup`,defaultValue:`bars`,options:[{value:`bars`,label:`chart.option.funnelStyle.bars`},{value:`funnel`,label:`chart.option.funnelStyle.funnel`}],description:`chart.configText.visualization_style`},{key:`funnelOrientation`,label:`chart.option.funnelOrientation.label`,type:`buttonGroup`,defaultValue:`horizontal`,options:[{value:`horizontal`,label:`chart.option.funnelOrientation.horizontal`},{value:`vertical`,label:`chart.option.funnelOrientation.vertical`}]},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!1,description:`chart.option.hideSummaryFooter.description`},{key:`showFunnelConversion`,label:`chart.option.showConversion.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showConversion.description`},{key:`showFunnelAvgTime`,label:`chart.option.showAvgTime.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showAvgTime.description`},{key:`showFunnelMedianTime`,label:`chart.option.showMedianTime.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showMedianTime.description`},{key:`showFunnelP90Time`,label:`chart.option.showP90Time.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showP90Time.description`}]},sankey:{label:`chart.sankey.label`,description:`chart.sankey.description`,useCase:`chart.sankey.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.event_type`,description:`chart.configText.event_dimension_that_categorizes_flow_nodes`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.sankey.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.flow_count`,description:`chart.configText.count_of_entities_following_each_path`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.sankey.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`linkOpacity`,label:`chart.option.linkOpacity.label`,type:`buttonGroup`,defaultValue:`0.5`,options:[{value:`0.3`,label:`chart.option.linkOpacity.light`},{value:`0.5`,label:`chart.option.fontSize.medium`},{value:`0.7`,label:`chart.option.linkOpacity.dark`}],description:`chart.configText.opacity_of_flow_links`},{key:`showNodeLabels`,label:`chart.option.showNodeLabels.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showNodeLabels.description`},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.hide_the_statistics_footer_below_the_chart`}]},sunburst:{label:`chart.sunburst.label`,description:`chart.sunburst.description`,useCase:`chart.sunburst.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.event_type`,description:`chart.configText.event_dimension_that_categorizes_flow_nodes`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.sunburst.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.flow_count`,description:`chart.configText.count_of_entities_following_each_path`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.sunburst.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`number`,defaultValue:40,min:0,max:100,step:10,description:`chart.configText.size_of_the_center_hole_0_for_full_circle`},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.hide_the_statistics_footer_below_the_chart`}]},heatmap:{label:`chart.heatmap.label`,description:`chart.heatmap.description`,useCase:`chart.heatmap.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.columns_x_axis`,description:`chart.configText.dimension_for_column_categories`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.heatmap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.rows_y_axis`,description:`chart.configText.dimension_for_row_categories`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.heatmap.dropZone.yAxis.empty`},{key:`valueField`,label:`chart.configText.value_color_intensity`,description:`chart.configText.measure_that_determines_cell_color`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.heatmap.dropZone.valueField.empty`}],displayOptions:[`showLegend`,`showTooltip`],displayOptionsConfig:[{key:`showLabels`,label:`chart.option.showLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showLabels.description`},{key:`cellShape`,label:`chart.option.cellShape.label`,type:`select`,defaultValue:`rect`,options:[{value:`rect`,label:`chart.option.cellShape.rectangle`},{value:`circle`,label:`chart.option.cellShape.circle`}]},{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_x_axis_labels`},{key:`yAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_labels`},{key:`valueFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_cell_values_and_legend`}],validate:e=>e.xAxis?.length?e.yAxis?.length?e.valueField?.length?{isValid:!0}:{isValid:!1,message:`chart.heatmap.validation.valueRequired`}:{isValid:!1,message:`chart.heatmap.validation.yAxisRequired`}:{isValid:!1,message:`chart.heatmap.validation.xAxisRequired`}},retentionHeatmap:{label:`chart.retentionHeatmap.label`,dropZones:[],displayOptionsConfig:[{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_the_color_intensity_legend`},{key:`showTooltip`,label:`chart.option.showTooltip.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTooltip.description`}],description:`chart.retentionHeatmap.description`,useCase:`chart.retentionHeatmap.useCase`},retentionCombined:{label:`chart.retentionCombined.label`,dropZones:[],displayOptionsConfig:[{key:`retentionDisplayMode`,label:`chart.option.retentionDisplayMode.label`,type:`select`,defaultValue:`line`,options:[{value:`line`,label:`chart.option.retentionDisplayMode.lineChart`},{value:`heatmap`,label:`chart.option.retentionDisplayMode.heatmapTable`},{value:`combined`,label:`chart.option.retentionDisplayMode.combined`}],description:`chart.configText.choose_how_to_visualize_retention_data`},{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_the_legend_for_breakdown_segments`},{key:`showGrid`,label:`chart.option.showGrid.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showGrid.description`},{key:`showTooltip`,label:`chart.option.showTooltip.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTooltip.description`}],description:`chart.retentionCombined.description`,useCase:`chart.retentionCombined.useCase`},boxPlot:{label:`chart.boxPlot.label`,description:`chart.boxPlot.description`,useCase:`chart.boxPlot.useCase`,displayOptions:[`hideHeader`],dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_groups`,description:`chart.configText.dimension_to_group_boxes_by_e_g_symbol_platform`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.boxPlot.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis_measures`,description:`chart.configText.drop_1_measure_for_auto_mode_3_for_avg_stddev_median_mode_or_5_for_min_q`,mandatory:!0,maxItems:5,acceptTypes:[`measure`],emptyText:`chart.boxPlot.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_value_axis`}]},waterfall:{label:`chart.waterfall.label`,description:`chart.waterfall.description`,useCase:`chart.waterfall.useCase`,clickableElements:{bar:!0},displayOptions:[`showTooltip`,`hideHeader`],dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.configText.dimension_labels_for_each_bar_segment_e_g_symbol_transaction_type`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.waterfall.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis_value`,description:`chart.configText.single_measure_whose_values_are_summed_cumulatively`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.waterfall.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`showTotal`,label:`chart.option.showTotal.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTotal.description`},{key:`showConnectorLine`,label:`chart.option.showConnectorLine.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showConnectorLine.description`},{key:`showDataLabels`,label:`chart.option.showDataLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.configText.display_the_value_above_each_bar_segment`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_y_axis`}]},candlestick:{label:`chart.candlestick.label`,description:`chart.candlestick.description`,useCase:`chart.candlestick.useCase`,clickableElements:{bar:!0},displayOptions:[`hideHeader`],dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_category`,description:`chart.configText.time_dimension_or_category_for_each_candle_e_g_date_symbol`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`,`dimension`],emptyText:`chart.candlestick.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.ohlc_measures_open_close_high_low`,description:`chart.configText.drop_2_4_measures_in_order_open_close_high_low_ohlc_mode_for_range_mode_`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.candlestick.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`rangeMode`,label:`chart.option.rangeMode.label`,type:`select`,defaultValue:`ohlc`,options:[{value:`ohlc`,label:`chart.option.rangeMode.ohlc`},{value:`range`,label:`chart.option.rangeMode.range`}],description:`chart.option.rangeMode.description`},{key:`bullColor`,label:`chart.option.bullColor.label`,type:`color`,defaultValue:`#22c55e`,description:`chart.option.bullColor.description`},{key:`bearColor`,label:`chart.option.bearColor.label`,type:`color`,defaultValue:`#ef4444`,description:`chart.option.bearColor.description`},{key:`showWicks`,label:`chart.option.showWicks.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showWicks.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_price_axis`}]},measureProfile:{label:`chart.measureProfile.label`,description:`chart.measureProfile.description`,useCase:`chart.measureProfile.useCase`,displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],dropZones:[{key:`yAxis`,label:`chart.configText.measures_x_axis_order`,description:`chart.configText.add_2_or_more_measures_they_become_the_x_axis_categories_in_the_order_li`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.measureProfile.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_split_into_multiple_lines`,description:`chart.configText.dimension_to_split_data_into_separate_profile_lines_e_g_symbol_platform`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.measureProfile.dropZone.series.empty`}],displayOptionsConfig:[{key:`showReferenceLineAtZero`,label:`chart.option.showReferenceLineAtZero.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showReferenceLineAtZero.description`},{key:`showDataLabels`,label:`chart.option.showDataLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.configText.display_value_at_each_data_point`},{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_series_legend_only_visible_with_a_series_dimension`},{key:`lineType`,label:`chart.option.lineType.label`,type:`select`,defaultValue:`monotone`,options:[{value:`monotone`,label:`chart.option.lineType.smooth`},{value:`linear`,label:`chart.option.lineType.linear`},{value:`step`,label:`chart.option.lineType.step`}],description:`chart.option.lineType.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_y_axis`}]},gauge:{label:`chart.gauge.label`,description:`chart.gauge.description`,useCase:`chart.gauge.useCase`,clickableElements:{},displayOptions:[`hideHeader`],dropZones:[{key:`yAxis`,label:`chart.configText.value_measure`,description:`chart.configText.current_value_to_display_on_the_gauge_e_g_current_equity_margin_used`,mandatory:!0,maxItems:2,acceptTypes:[`measure`],emptyText:`chart.gauge.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`minValue`,label:`chart.option.minValue.label`,type:`number`,defaultValue:0,description:`chart.option.minValue.description`},{key:`maxValue`,label:`chart.option.maxValue.label`,type:`number`,description:`chart.option.maxValue.description`},{key:`thresholds`,label:`chart.configText.threshold_bands`,type:`string`,placeholder:`[{"value":0.33,"color":"#22c55e"},{"value":0.66,"color":"#f59e0b"},{"value":1,"color":"#ef4444"}]`,description:`chart.configText.array_of_value_0_1_fraction_color_bands_shown_as_outer_arc_markers`},{key:`showCenterLabel`,label:`chart.option.showCentreLabel.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showCentreLabel.description`},{key:`showPercentage`,label:`chart.option.showPercentage.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showPercentage.description`},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_displayed_value_and_axis_labels`}]}};function o(t,n,r){let i=a[t];if(!i||i.skipQuery)return{isValid:!0,errors:[]};let o=[];for(let r of i.dropZones){if(!r.mandatory)continue;let i=n?.[r.key];if(!(Array.isArray(i)?i.length>0:i)){let n=r.acceptTypes?.join(`/`)??`fields`;o.push(e._(`server.validation.chart.dropZoneRequired`,{key:r.key,chartType:t,label:r.label,acceptDesc:n}))}}if(t===`bar`){let t=n?.xAxis;if(!(Array.isArray(t)?t.length>0:t)){let t=r.dimensions??[],n=r.timeDimensions??[];t.length>0||n.length>0?o.push(e._(`server.validation.chart.barXAxisRequired`)):o.push(e._(`server.validation.chart.barNeedsDimension`))}}if(n?.xAxis&&n?.series){let t=new Set(Array.isArray(n.xAxis)?n.xAxis:[n.xAxis]),r=(Array.isArray(n.series)?n.series:[n.series]).filter(e=>t.has(e));r.length>0&&o.push(e._(`server.validation.chart.seriesDuplicatesXAxis`,{duplicates:r.join(`, `)}))}return{isValid:o.length===0,errors:o}}function s(e,t,n){let r=a[e];if(!r)return t??{};let i={...t},o=n.measures??[],s=n.dimensions??[],c=(n.timeDimensions??[]).map(e=>e.dimension);for(let e of r.dropZones){let t=i[e.key];if(Array.isArray(t)?t.length>0:t)continue;let n=e.acceptTypes??[];if(e.key===`sizeField`||e.key===`colorField`){if(n.includes(`measure`)){let t=new Set;for(let n of r.dropZones){if(n.key===e.key)continue;let r=i[n.key];Array.isArray(r)?r.forEach(e=>t.add(e)):typeof r==`string`&&t.add(r)}let n=o.filter(e=>!t.has(e));n.length>0&&(i[e.key]=n[0])}continue}let a=[];if(n.includes(`dimension`)&&a.push(...s),n.includes(`timeDimension`)&&a.push(...c),n.includes(`measure`)&&a.push(...o),a.length===0)continue;let l=a;if(e.key===`series`){let e=new Set(Array.isArray(i.xAxis)?i.xAxis:i.xAxis?[i.xAxis]:[]);if(l=a.filter(t=>!e.has(t)),l.length===0)continue}let u=e.maxItems??1/0,d=l.slice(0,u);d.length>0&&(i[e.key]=d)}return i}function c(e){let t=[`
|
|
16
|
-
Chart config requirements by type:`];for(let n of e){let e=
|
|
17
|
-
`)}var
|
|
18
|
-
`+c
|
|
19
|
-
The query is validated before adding. The portlet fetches its own data.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the visualization`},query:{type:`string`,description:`JSON string of the query. Standard: {"measures":[...],"dimensions":[...]}. Funnel: {"funnel":{"bindingKey":"...","timeDimension":"...","steps":[...]}}. Flow: {"flow":{"bindingKey":"...","timeDimension":"...","eventDimension":"...","startingStep":{...}}}. Retention: {"retention":{"timeDimension":"...","bindingKey":"...","dateRange":{"start":"...","end":"..."},"granularity":"...","periods":N}}.`},chartType:{type:`string`,enum:
|
|
20
|
-
[IMPORTANT: Your next response MUST start with a brief text message BEFORE any tool calls.]`}}),i.set(`get_cube_metadata`,async()=>{let e=n.getMetadata();return{result:JSON.stringify(e)}});let
|
|
15
|
+
Use --- for horizontal rules.`,description:`chart.configText.enter_markdown_text_supports_headers_bold_text_italic_text_links_text_ur`},{key:`accentColorIndex`,label:`chart.configText.accent_color`,type:`paletteColor`,defaultValue:0,description:`chart.configText.color_from_the_dashboard_palette_for_headers_bullets_and_links`},{key:`fontSize`,label:`chart.option.fontSize.label`,type:`select`,defaultValue:`medium`,options:[{value:`small`,label:`chart.option.fontSize.small`},{value:`medium`,label:`chart.option.fontSize.medium`},{value:`large`,label:`chart.option.fontSize.large`}],description:`chart.configText.overall_text_size_for_the_markdown_content`},{key:`alignment`,label:`chart.option.alignment.label`,type:`select`,defaultValue:`left`,options:[{value:`left`,label:`chart.option.accentBorder.left`},{value:`center`,label:`chart.option.alignment.center`},{value:`right`,label:`chart.option.alignment.right`}],description:`chart.configText.horizontal_alignment_of_the_markdown_content`},{key:`hideHeader`,label:`chart.option.hideHeader.label`,type:`boolean`,defaultValue:!0,description:`chart.option.hideHeader.description`},{key:`transparentBackground`,label:`chart.option.transparentBackground.label`,type:`boolean`,defaultValue:!1,description:`chart.option.transparentBackground.description`},{key:`autoHeight`,label:`chart.option.autoHeight.label`,type:`boolean`,defaultValue:!0,description:`chart.option.autoHeight.description`},{key:`accentBorder`,label:`chart.option.accentBorder.label`,type:`select`,defaultValue:`none`,options:[{value:`none`,label:`chart.option.accentBorder.none`},{value:`left`,label:`chart.option.accentBorder.left`},{value:`top`,label:`chart.option.accentBorder.top`},{value:`bottom`,label:`chart.option.accentBorder.bottom`}],description:`chart.configText.add_an_accent_colored_border_on_one_side_of_the_content`}]},funnel:{label:`chart.funnel.label`,description:`chart.funnel.description`,useCase:`chart.funnel.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.step_name`,description:`chart.configText.step_names_auto_populated_from_funnel_steps`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.funnel.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.step_count`,description:`chart.configText.count_at_each_step_auto_calculated`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.funnel.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`funnelStyle`,label:`chart.option.funnelStyle.label`,type:`buttonGroup`,defaultValue:`bars`,options:[{value:`bars`,label:`chart.option.funnelStyle.bars`},{value:`funnel`,label:`chart.option.funnelStyle.funnel`}],description:`chart.configText.visualization_style`},{key:`funnelOrientation`,label:`chart.option.funnelOrientation.label`,type:`buttonGroup`,defaultValue:`horizontal`,options:[{value:`horizontal`,label:`chart.option.funnelOrientation.horizontal`},{value:`vertical`,label:`chart.option.funnelOrientation.vertical`}]},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!1,description:`chart.option.hideSummaryFooter.description`},{key:`showFunnelConversion`,label:`chart.option.showConversion.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showConversion.description`},{key:`showFunnelAvgTime`,label:`chart.option.showAvgTime.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showAvgTime.description`},{key:`showFunnelMedianTime`,label:`chart.option.showMedianTime.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showMedianTime.description`},{key:`showFunnelP90Time`,label:`chart.option.showP90Time.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showP90Time.description`}]},sankey:{label:`chart.sankey.label`,description:`chart.sankey.description`,useCase:`chart.sankey.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.event_type`,description:`chart.configText.event_dimension_that_categorizes_flow_nodes`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.sankey.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.flow_count`,description:`chart.configText.count_of_entities_following_each_path`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.sankey.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`linkOpacity`,label:`chart.option.linkOpacity.label`,type:`buttonGroup`,defaultValue:`0.5`,options:[{value:`0.3`,label:`chart.option.linkOpacity.light`},{value:`0.5`,label:`chart.option.fontSize.medium`},{value:`0.7`,label:`chart.option.linkOpacity.dark`}],description:`chart.configText.opacity_of_flow_links`},{key:`showNodeLabels`,label:`chart.option.showNodeLabels.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showNodeLabels.description`},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.hide_the_statistics_footer_below_the_chart`}]},sunburst:{label:`chart.sunburst.label`,description:`chart.sunburst.description`,useCase:`chart.sunburst.useCase`,dropZones:[{key:`xAxis`,label:`chart.configText.event_type`,description:`chart.configText.event_dimension_that_categorizes_flow_nodes`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.sunburst.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.flow_count`,description:`chart.configText.count_of_entities_following_each_path`,mandatory:!1,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.sunburst.dropZone.yAxis.empty`}],displayOptions:[`hideHeader`],displayOptionsConfig:[{key:`innerRadius`,label:`chart.option.innerRadius.label`,type:`number`,defaultValue:40,min:0,max:100,step:10,description:`chart.configText.size_of_the_center_hole_0_for_full_circle`},{key:`hideSummaryFooter`,label:`chart.option.hideSummaryFooter.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.hide_the_statistics_footer_below_the_chart`}]},heatmap:{label:`chart.heatmap.label`,description:`chart.heatmap.description`,useCase:`chart.heatmap.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<2?{available:!1,reason:`chart.availability.requiresTwoDimensions`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.columns_x_axis`,description:`chart.configText.dimension_for_column_categories`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.heatmap.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.rows_y_axis`,description:`chart.configText.dimension_for_row_categories`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.heatmap.dropZone.yAxis.empty`},{key:`valueField`,label:`chart.configText.value_color_intensity`,description:`chart.configText.measure_that_determines_cell_color`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.heatmap.dropZone.valueField.empty`}],displayOptions:[`showLegend`,`showTooltip`],displayOptionsConfig:[{key:`showLabels`,label:`chart.option.showLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showLabels.description`},{key:`cellShape`,label:`chart.option.cellShape.label`,type:`select`,defaultValue:`rect`,options:[{value:`rect`,label:`chart.option.cellShape.rectangle`},{value:`circle`,label:`chart.option.cellShape.circle`}]},{key:`xAxisFormat`,label:`chart.option.xAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_x_axis_labels`},{key:`yAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_y_axis_labels`},{key:`valueFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_cell_values_and_legend`}],validate:e=>e.xAxis?.length?e.yAxis?.length?e.valueField?.length?{isValid:!0}:{isValid:!1,message:`chart.heatmap.validation.valueRequired`}:{isValid:!1,message:`chart.heatmap.validation.yAxisRequired`}:{isValid:!1,message:`chart.heatmap.validation.xAxisRequired`}},retentionHeatmap:{label:`chart.retentionHeatmap.label`,dropZones:[],displayOptionsConfig:[{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_the_color_intensity_legend`},{key:`showTooltip`,label:`chart.option.showTooltip.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTooltip.description`}],description:`chart.retentionHeatmap.description`,useCase:`chart.retentionHeatmap.useCase`},retentionCombined:{label:`chart.retentionCombined.label`,dropZones:[],displayOptionsConfig:[{key:`retentionDisplayMode`,label:`chart.option.retentionDisplayMode.label`,type:`select`,defaultValue:`line`,options:[{value:`line`,label:`chart.option.retentionDisplayMode.lineChart`},{value:`heatmap`,label:`chart.option.retentionDisplayMode.heatmapTable`},{value:`combined`,label:`chart.option.retentionDisplayMode.combined`}],description:`chart.configText.choose_how_to_visualize_retention_data`},{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_the_legend_for_breakdown_segments`},{key:`showGrid`,label:`chart.option.showGrid.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showGrid.description`},{key:`showTooltip`,label:`chart.option.showTooltip.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTooltip.description`}],description:`chart.retentionCombined.description`,useCase:`chart.retentionCombined.useCase`},boxPlot:{label:`chart.boxPlot.label`,description:`chart.boxPlot.description`,useCase:`chart.boxPlot.useCase`,isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},displayOptions:[`hideHeader`],dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_groups`,description:`chart.configText.dimension_to_group_boxes_by_e_g_symbol_platform`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.boxPlot.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis_measures`,description:`chart.configText.drop_1_measure_for_auto_mode_3_for_avg_stddev_median_mode_or_5_for_min_q`,mandatory:!0,maxItems:5,acceptTypes:[`measure`],emptyText:`chart.boxPlot.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_value_axis`}]},waterfall:{label:`chart.waterfall.label`,description:`chart.waterfall.description`,useCase:`chart.waterfall.useCase`,clickableElements:{bar:!0},isAvailable:({measureCount:e,dimensionCount:t})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},displayOptions:[`showTooltip`,`hideHeader`],dropZones:[{key:`xAxis`,label:`chart.dropZone.xAxis.label`,description:`chart.configText.dimension_labels_for_each_bar_segment_e_g_symbol_transaction_type`,mandatory:!0,maxItems:1,acceptTypes:[`dimension`,`timeDimension`],emptyText:`chart.waterfall.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.y_axis_value`,description:`chart.configText.single_measure_whose_values_are_summed_cumulatively`,mandatory:!0,maxItems:1,acceptTypes:[`measure`],emptyText:`chart.waterfall.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`showTotal`,label:`chart.option.showTotal.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showTotal.description`},{key:`showConnectorLine`,label:`chart.option.showConnectorLine.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showConnectorLine.description`},{key:`showDataLabels`,label:`chart.option.showDataLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.configText.display_the_value_above_each_bar_segment`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_y_axis`}]},candlestick:{label:`chart.candlestick.label`,description:`chart.candlestick.description`,useCase:`chart.candlestick.useCase`,clickableElements:{bar:!0},displayOptions:[`hideHeader`],isAvailable:({measureCount:e,dimensionCount:t})=>e<2?{available:!1,reason:`chart.availability.requiresTwoMeasures`}:t<1?{available:!1,reason:`chart.availability.requiresDimension`}:{available:!0},dropZones:[{key:`xAxis`,label:`chart.configText.x_axis_time_category`,description:`chart.configText.time_dimension_or_category_for_each_candle_e_g_date_symbol`,mandatory:!0,maxItems:1,acceptTypes:[`timeDimension`,`dimension`],emptyText:`chart.candlestick.dropZone.xAxis.empty`},{key:`yAxis`,label:`chart.configText.ohlc_measures_open_close_high_low`,description:`chart.configText.drop_2_4_measures_in_order_open_close_high_low_ohlc_mode_for_range_mode_`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.candlestick.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`rangeMode`,label:`chart.option.rangeMode.label`,type:`select`,defaultValue:`ohlc`,options:[{value:`ohlc`,label:`chart.option.rangeMode.ohlc`},{value:`range`,label:`chart.option.rangeMode.range`}],description:`chart.option.rangeMode.description`},{key:`bullColor`,label:`chart.option.bullColor.label`,type:`color`,defaultValue:`#22c55e`,description:`chart.option.bullColor.description`},{key:`bearColor`,label:`chart.option.bearColor.label`,type:`color`,defaultValue:`#ef4444`,description:`chart.option.bearColor.description`},{key:`showWicks`,label:`chart.option.showWicks.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showWicks.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_price_axis`}]},measureProfile:{label:`chart.measureProfile.label`,description:`chart.measureProfile.description`,useCase:`chart.measureProfile.useCase`,displayOptions:[`showLegend`,`showTooltip`,`hideHeader`],isAvailable:({measureCount:e})=>e<2?{available:!1,reason:`chart.availability.requiresTwoMeasures`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.measures_x_axis_order`,description:`chart.configText.add_2_or_more_measures_they_become_the_x_axis_categories_in_the_order_li`,mandatory:!0,acceptTypes:[`measure`],emptyText:`chart.measureProfile.dropZone.yAxis.empty`},{key:`series`,label:`chart.configText.series_split_into_multiple_lines`,description:`chart.configText.dimension_to_split_data_into_separate_profile_lines_e_g_symbol_platform`,mandatory:!1,maxItems:1,acceptTypes:[`dimension`],emptyText:`chart.measureProfile.dropZone.series.empty`}],displayOptionsConfig:[{key:`showReferenceLineAtZero`,label:`chart.option.showReferenceLineAtZero.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showReferenceLineAtZero.description`},{key:`showDataLabels`,label:`chart.option.showDataLabels.label`,type:`boolean`,defaultValue:!1,description:`chart.configText.display_value_at_each_data_point`},{key:`showLegend`,label:`chart.option.showLegend.label`,type:`boolean`,defaultValue:!0,description:`chart.configText.show_series_legend_only_visible_with_a_series_dimension`},{key:`lineType`,label:`chart.option.lineType.label`,type:`select`,defaultValue:`monotone`,options:[{value:`monotone`,label:`chart.option.lineType.smooth`},{value:`linear`,label:`chart.option.lineType.linear`},{value:`step`,label:`chart.option.lineType.step`}],description:`chart.option.lineType.description`},{key:`leftYAxisFormat`,label:`chart.option.yAxisFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_y_axis`}]},gauge:{label:`chart.gauge.label`,description:`chart.gauge.description`,useCase:`chart.gauge.useCase`,clickableElements:{},displayOptions:[`hideHeader`],isAvailable:({measureCount:e})=>e<1?{available:!1,reason:`chart.availability.requiresMeasure`}:{available:!0},dropZones:[{key:`yAxis`,label:`chart.configText.value_measure`,description:`chart.configText.current_value_to_display_on_the_gauge_e_g_current_equity_margin_used`,mandatory:!0,maxItems:2,acceptTypes:[`measure`],emptyText:`chart.gauge.dropZone.yAxis.empty`}],displayOptionsConfig:[{key:`minValue`,label:`chart.option.minValue.label`,type:`number`,defaultValue:0,description:`chart.option.minValue.description`},{key:`maxValue`,label:`chart.option.maxValue.label`,type:`number`,description:`chart.option.maxValue.description`},{key:`thresholds`,label:`chart.configText.threshold_bands`,type:`string`,placeholder:`[{"value":0.33,"color":"#22c55e"},{"value":0.66,"color":"#f59e0b"},{"value":1,"color":"#ef4444"}]`,description:`chart.configText.array_of_value_0_1_fraction_color_bands_shown_as_outer_arc_markers`},{key:`showCenterLabel`,label:`chart.option.showCentreLabel.label`,type:`boolean`,defaultValue:!0,description:`chart.option.showCentreLabel.description`},{key:`showPercentage`,label:`chart.option.showPercentage.label`,type:`boolean`,defaultValue:!1,description:`chart.option.showPercentage.description`},{key:`leftYAxisFormat`,label:`chart.option.valueFormat.label`,type:`axisFormat`,description:`chart.configText.number_formatting_for_the_displayed_value_and_axis_labels`}]}};function a(t,n,r){let a=i[t];if(!a||a.skipQuery)return{isValid:!0,errors:[]};let o=[];for(let r of a.dropZones){if(!r.mandatory)continue;let i=n?.[r.key];if(!(Array.isArray(i)?i.length>0:i)){let n=r.acceptTypes?.join(`/`)??`fields`;o.push(e.C(`server.validation.chart.dropZoneRequired`,{key:r.key,chartType:t,label:r.label,acceptDesc:n}))}}if(t===`bar`){let t=n?.xAxis;if(!(Array.isArray(t)?t.length>0:t)){let t=r.dimensions??[],n=r.timeDimensions??[];t.length>0||n.length>0?o.push(e.C(`server.validation.chart.barXAxisRequired`)):o.push(e.C(`server.validation.chart.barNeedsDimension`))}}if(n?.xAxis&&n?.series){let t=new Set(Array.isArray(n.xAxis)?n.xAxis:[n.xAxis]),r=(Array.isArray(n.series)?n.series:[n.series]).filter(e=>t.has(e));r.length>0&&o.push(e.C(`server.validation.chart.seriesDuplicatesXAxis`,{duplicates:r.join(`, `)}))}return{isValid:o.length===0,errors:o}}function o(e,t,n){let r=i[e];if(!r)return t??{};let a={...t},o=n.measures??[],s=n.dimensions??[],c=(n.timeDimensions??[]).map(e=>e.dimension);for(let e of r.dropZones){let t=a[e.key];if(Array.isArray(t)?t.length>0:t)continue;let n=e.acceptTypes??[];if(e.key===`sizeField`||e.key===`colorField`){if(n.includes(`measure`)){let t=new Set;for(let n of r.dropZones){if(n.key===e.key)continue;let r=a[n.key];Array.isArray(r)?r.forEach(e=>t.add(e)):typeof r==`string`&&t.add(r)}let n=o.filter(e=>!t.has(e));n.length>0&&(a[e.key]=n[0])}continue}let i=[];if(n.includes(`dimension`)&&i.push(...s),n.includes(`timeDimension`)&&i.push(...c),n.includes(`measure`)&&i.push(...o),i.length===0)continue;let l=i;if(e.key===`series`){let e=new Set(Array.isArray(a.xAxis)?a.xAxis:a.xAxis?[a.xAxis]:[]);if(l=i.filter(t=>!e.has(t)),l.length===0)continue}let u=e.maxItems??1/0,d=l.slice(0,u);d.length>0&&(a[e.key]=d)}return a}function s(e){let t=[`
|
|
16
|
+
Chart config requirements by type:`];for(let n of e){let e=i[n];if(!e)continue;let r=[e.description??``,e.useCase??``].filter(Boolean).join(`. `),a=r?` — ${r}.`:``,o=e.dropZones.filter(e=>e.mandatory);if(o.length===0&&!e.skipQuery){t.push(` ${n}${a} chartConfig auto-inferred from query.`);continue}if(e.skipQuery){t.push(` ${n}${a} No query needed.`);continue}let s=o.map(e=>{let t=e.acceptTypes?.join(`/`)??`any`,n=e.maxItems?` (max ${e.maxItems})`:``;return`${e.key}=[${t}]${n}`});t.push(` ${n}${a} Requires ${s.join(`, `)}.`)}return t.join(`
|
|
17
|
+
`)}var c=[`bar`,`line`,`area`,`pie`,`scatter`,`radar`,`bubble`,`table`,`kpiNumber`,`kpiDelta`,`funnel`,`heatmap`,`sankey`,`sunburst`,`retentionHeatmap`,`retentionCombined`,`boxPlot`,`markdown`];function l(){return[{name:`discover_cubes`,description:`Search for available data cubes by topic or intent. Call this FIRST to understand what data is available. Returns cube names, measures, dimensions, and relationships.`,parameters:{type:`object`,properties:{topic:{type:`string`,description:`Keyword to search (e.g., "sales", "employees")`},intent:{type:`string`,description:`Natural language goal (e.g., "analyze productivity trends")`},limit:{type:`number`,description:`Max results (default: 10)`},minScore:{type:`number`,description:`Min relevance 0-1 (default: 0.1)`}}}},{name:`get_cube_metadata`,description:`Get full metadata for all registered cubes including all measures, dimensions, types, and relationships. Use this for detailed schema information.`,parameters:{type:`object`,properties:{}}},{name:`execute_query`,description:`Execute a semantic query and return data results. Supports standard queries (measures/dimensions) and analysis modes (funnel/flow/retention). Only provide ONE mode per call.`,parameters:{type:`object`,properties:e.S}},{name:`add_portlet`,description:`Add a chart visualization to the notebook.
|
|
18
|
+
`+s(c)+`
|
|
19
|
+
The query is validated before adding. The portlet fetches its own data.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Title for the visualization`},query:{type:`string`,description:`JSON string of the query. Standard: {"measures":[...],"dimensions":[...]}. Funnel: {"funnel":{"bindingKey":"...","timeDimension":"...","steps":[...]}}. Flow: {"flow":{"bindingKey":"...","timeDimension":"...","eventDimension":"...","startingStep":{...}}}. Retention: {"retention":{"timeDimension":"...","bindingKey":"...","dateRange":{"start":"...","end":"..."},"granularity":"...","periods":N}}.`},chartType:{type:`string`,enum:c,description:`Chart type to render`},chartConfig:{type:`object`,properties:{xAxis:{type:`array`,items:{type:`string`}},yAxis:{type:`array`,items:{type:`string`}},series:{type:`array`,items:{type:`string`}},sizeField:{type:`string`},colorField:{type:`string`},yAxisAssignment:{type:`object`,description:`Dual Y-axis: map measure fields to "left" or "right" axis. Only for bar, line, area charts with 2+ measures of different scales. Example: {"Sales.revenue": "left", "Sales.conversionRate": "right"}`}},description:`Chart axis configuration`},displayConfig:{type:`object`,properties:{showLegend:{type:`boolean`},showGrid:{type:`boolean`},showTooltip:{type:`boolean`},stacked:{type:`boolean`},orientation:{type:`string`,enum:[`horizontal`,`vertical`]}},description:`Chart display configuration`}},required:[`title`,`query`,`chartType`]}},{name:`add_markdown`,description:`Add an explanation or analysis text block to the notebook. Use markdown formatting. Use this to explain findings, methodology, and insights alongside visualizations.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Optional title for the text block`},content:{type:`string`,description:`Markdown content to display`}},required:[`content`]}},{name:`save_as_dashboard`,description:`Convert the current notebook analysis into a persistent dashboard. Constructs a professional DashboardConfig with proper grid layout, section headers (markdown portlets), and dashboard-level filters. Call this when the user asks to save/export the notebook as a dashboard.`,parameters:{type:`object`,properties:{title:{type:`string`,description:`Dashboard title`},description:{type:`string`,description:`Optional dashboard description`},portlets:{type:`array`,items:{type:`object`,properties:{id:{type:`string`,description:`Unique portlet ID`},title:{type:`string`,description:`Portlet title`},chartType:{type:`string`,enum:c,description:`Chart type. Use "markdown" for section headers.`},query:{type:`string`,description:`JSON string of the query. Omit or leave empty for markdown portlets.`},chartConfig:{type:`object`,properties:{xAxis:{type:`array`,items:{type:`string`}},yAxis:{type:`array`,items:{type:`string`}},series:{type:`array`,items:{type:`string`}},sizeField:{type:`string`},colorField:{type:`string`}},description:`Chart axis configuration`},displayConfig:{type:`object`,description:`Chart display configuration (for markdown: { content, hideHeader, transparentBackground, autoHeight })`},dashboardFilterMapping:{type:`array`,items:{type:`string`},description:`Array of dashboard filter IDs that apply to this portlet`},analysisType:{type:`string`,enum:[`query`,`funnel`,`flow`,`retention`],description:`Analysis type (default: "query")`},w:{type:`number`,description:`Grid width (1-12)`},h:{type:`number`,description:`Grid height in row units`},x:{type:`number`,description:`Grid x position (0-11)`},y:{type:`number`,description:`Grid y position`}},required:[`id`,`title`,`chartType`,`w`,`h`,`x`,`y`]},description:`Array of portlet configurations for the dashboard`},filters:{type:`array`,items:{type:`object`,properties:{id:{type:`string`,description:`Unique filter ID`},label:{type:`string`,description:`Display label for the filter`},filter:{type:`object`,properties:{member:{type:`string`},operator:{type:`string`},values:{type:`array`,items:{}}},required:[`member`,`operator`],description:`The filter definition`},isUniversalTime:{type:`boolean`,description:`When true, applies to all time dimensions in portlets`}},required:[`id`,`label`,`filter`]},description:`Dashboard-level filters`},colorPalette:{type:`string`,description:`Color palette name`}},required:[`title`,`portlets`]}}]}function u(t){let{semanticLayer:n,securityContext:r}=t,i=new Map;i.set(`discover_cubes`,async t=>{let r={cubes:(await e.d(n,{topic:t.topic,intent:t.intent,limit:t.limit,minScore:t.minScore})).cubes.map(e=>({cube:e.cube,title:e.title,description:e.description,relevanceScore:e.relevanceScore,suggestedMeasures:e.suggestedMeasures,suggestedDimensions:e.suggestedDimensions,capabilities:e.capabilities,...e.capabilities.funnel||e.capabilities.flow||e.capabilities.retention?{analysisConfig:{candidateBindingKeys:e.analysisConfig?.candidateBindingKeys?.map(e=>e.dimension)??[],candidateTimeDimensions:e.analysisConfig?.candidateTimeDimensions?.map(e=>e.dimension)??[],...e.analysisConfig?.candidateEventDimensions?.length?{candidateEventDimensions:e.analysisConfig.candidateEventDimensions.map(e=>e.dimension)}:{}}}:{}}))};return{result:JSON.stringify(r)+`
|
|
20
|
+
[IMPORTANT: Your next response MUST start with a brief text message BEFORE any tool calls.]`}}),i.set(`get_cube_metadata`,async()=>{let e=n.getMetadata();return{result:JSON.stringify(e)}});let s=new Map;for(let e of n.getMetadata())s.set(e.name,{measures:(e.measures||[]).map(e=>e.name),dimensions:(e.dimensions||[]).map(e=>e.name)});let c=(e,t)=>{let n=s.get(e),r=t===`measures`?n?.measures:n?.dimensions;return!r||r.length===0?``:` Available ${t}: ${r.slice(0,5).map(e=>`"${e}"`).join(`, `)}`};return i.set(`execute_query`,async t=>{try{let i=(e,t)=>{if(!Array.isArray(e))return;let n=[];for(let r of e){if(typeof r!=`string`)continue;let e=r.split(`.`);e.length===1?n.push(`"${r}" is not valid — must be "CubeName.fieldName".${c(r,t)}`):e.length===2&&e[0]===e[1]&&n.push(`"${r}" is WRONG — "${e[0]}" is the cube name, not a ${t.replace(/s$/,``)}.${c(e[0],t)}`)}if(n.length>0)throw Error(`Invalid ${t}:\n${n.join(`
|
|
21
21
|
`)}`)};i(t.measures,`measures`),i(t.dimensions,`dimensions`);let a;a=t.funnel?{funnel:t.funnel}:t.flow?{flow:t.flow}:t.retention?{retention:t.retention}:{measures:t.measures,dimensions:t.dimensions,filters:t.filters,timeDimensions:t.timeDimensions,order:t.order,limit:t.limit,offset:t.offset,ungrouped:t.ungrouped};let o=await e.p(n,r,{query:a});return{result:JSON.stringify({rowCount:o.data.length,data:o.data,annotation:o.annotation})+`
|
|
22
|
-
[IMPORTANT: Your next response MUST start with a brief text message BEFORE any tool calls. Now call add_markdown and add_portlet to visualize these results.]`}}catch(e){let n={measures:t.measures,dimensions:t.dimensions,filters:t.filters,timeDimensions:t.timeDimensions,order:t.order,limit:t.limit,...t.funnel?{funnel:t.funnel}:{},...t.flow?{flow:t.flow}:{},...t.retention?{retention:t.retention}:{}};return{result:`Query execution failed: ${e instanceof Error?e.message:`Unknown error`}\n\nAttempted query:\n${JSON.stringify(n,null,2)}`,isError:!0}}}),i.set(`add_portlet`,async t=>{let r={number:`kpiNumber`,retention:`retentionHeatmap`}[t.chartType]??t.chartType,i;try{i=JSON.parse(t.query)}catch{return{result:"Invalid query: could not parse JSON string. Ensure `query` is a valid JSON string.",isError:!0}}i=e.g(i);let
|
|
23
|
-
`)}\n\nAttempted query:\n${JSON.stringify(i,null,2)}`,isError:!0};let c=!!(i.funnel||i.flow||i.retention),l;if(c)l=t.chartConfig??{};else{let e=
|
|
22
|
+
[IMPORTANT: Your next response MUST start with a brief text message BEFORE any tool calls. Now call add_markdown and add_portlet to visualize these results.]`}}catch(e){let n={measures:t.measures,dimensions:t.dimensions,filters:t.filters,timeDimensions:t.timeDimensions,order:t.order,limit:t.limit,...t.funnel?{funnel:t.funnel}:{},...t.flow?{flow:t.flow}:{},...t.retention?{retention:t.retention}:{}};return{result:`Query execution failed: ${e instanceof Error?e.message:`Unknown error`}\n\nAttempted query:\n${JSON.stringify(n,null,2)}`,isError:!0}}}),i.set(`add_portlet`,async t=>{let r={number:`kpiNumber`,retention:`retentionHeatmap`}[t.chartType]??t.chartType,i;try{i=JSON.parse(t.query)}catch{return{result:"Invalid query: could not parse JSON string. Ensure `query` is a valid JSON string.",isError:!0}}i=e.g(i);let s=n.validateQuery(i);if(!s.isValid)return{result:`Invalid query — fix these errors and retry:\n${s.errors.join(`
|
|
23
|
+
`)}\n\nAttempted query:\n${JSON.stringify(i,null,2)}`,isError:!0};let c=!!(i.funnel||i.flow||i.retention),l;if(c)l=t.chartConfig??{};else{let e=o(r,t.chartConfig,i),n=a(r,e,i);if(!n.isValid)return{result:`Chart config invalid — fix these errors and retry:\n${n.errors.join(`
|
|
24
24
|
`)}`,isError:!0};l=e}let u=`portlet-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,d={id:u,title:t.title,query:t.query,chartType:r,chartConfig:l,displayConfig:t.displayConfig};return{result:`Portlet "${t.title}" added to notebook (id: ${u}, chart: ${r}). [Reminder: in your next response, start with a brief sentence about what you will do next BEFORE making any tool calls.]`,sideEffect:{type:`add_portlet`,data:d}}}),i.set(`add_markdown`,async e=>{let t=`markdown-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,n=e.content||e.text||e.markdown||``,r={id:t,title:e.title,content:n};return{result:`Markdown block added to notebook (id: ${t}). [Reminder: in your next response, start with a brief sentence about what you will do next BEFORE making any tool calls.]`,sideEffect:{type:`add_markdown`,data:r}}}),i.set(`save_as_dashboard`,async t=>{try{let r=t.portlets;if(!r||r.length===0)return{result:`Dashboard must contain at least one portlet.`,isError:!0};let i=[];for(let t of r){if(t.chartType===`markdown`)continue;let r=t.query;if(!r){i.push(`Portlet "${t.title}": missing query`);continue}let a;try{a=JSON.parse(r)}catch{i.push(`Portlet "${t.title}": invalid JSON query`);continue}a=e.g(a);let o=n.validateQuery(a);o.isValid||i.push(`Portlet "${t.title}": ${o.errors.join(`, `)}`)}if(i.length>0)return{result:`Dashboard has invalid portlets — fix these errors and retry:\n${i.join(`
|
|
25
|
-
`)}`,isError:!0};let a={portlets:r.map(e=>{let t=e.chartType,n=t===`markdown`,r=n?`query`:e.analysisType||`query`,i=r===`funnel`?`funnel`:r===`flow`?`flow`:r===`retention`?`retention`:`query`,a=e.query||`{}`,o;try{o=JSON.parse(a)}catch{o={}}let s={version:1,analysisType:i,activeView:`chart`,charts:{[i]:{chartType:t,chartConfig:e.chartConfig||{},displayConfig:e.displayConfig||{}}},query:n?{}:o};return{id:e.id,title:e.title,analysisConfig:s,dashboardFilterMapping:e.dashboardFilterMapping,w:e.w,h:e.h,x:e.x,y:e.y}}),filters:t.filters,colorPalette:t.colorPalette},o=t.title;return{result:`Dashboard "${o}" created with ${a.portlets.length} portlets and ${a.filters?.length||0} filters.`,sideEffect:{type:`dashboard_saved`,data:{title:o,description:t.description,dashboardConfig:a}}}}catch(e){return{result:`Failed to save dashboard: ${e instanceof Error?e.message:`Unknown error`}`,isError:!0}}}),i}async function
|
|
25
|
+
`)}`,isError:!0};let a={portlets:r.map(e=>{let t=e.chartType,n=t===`markdown`,r=n?`query`:e.analysisType||`query`,i=r===`funnel`?`funnel`:r===`flow`?`flow`:r===`retention`?`retention`:`query`,a=e.query||`{}`,o;try{o=JSON.parse(a)}catch{o={}}let s={version:1,analysisType:i,activeView:`chart`,charts:{[i]:{chartType:t,chartConfig:e.chartConfig||{},displayConfig:e.displayConfig||{}}},query:n?{}:o};return{id:e.id,title:e.title,analysisConfig:s,dashboardFilterMapping:e.dashboardFilterMapping,w:e.w,h:e.h,x:e.x,y:e.y}}),filters:t.filters,colorPalette:t.colorPalette},o=t.title;return{result:`Dashboard "${o}" created with ${a.portlets.length} portlets and ${a.filters?.length||0} filters.`,sideEffect:{type:`dashboard_saved`,data:{title:o,description:t.description,dashboardConfig:a}}}}catch(e){return{result:`Failed to save dashboard: ${e instanceof Error?e.message:`Unknown error`}`,isError:!0}}}),i}async function d(e,t,n){switch(e){case`anthropic`:{let{AnthropicProvider:e}=await Promise.resolve().then(()=>require(`./anthropic-BIva8k1r.cjs`));return new e(t)}case`openai`:{let{OpenAIProvider:e}=await Promise.resolve().then(()=>require(`./openai-BjLV_Wjx.cjs`));return new e(t,n)}case`google`:{let{GoogleProvider:e}=await Promise.resolve().then(()=>require(`./google-Dgo9-Kb5.cjs`));return new e(t)}default:throw Error(`Unknown LLM provider: "${e}". Supported providers: anthropic, openai, google`)}}var f={anthropic:`claude-sonnet-4-6`,openai:`gpt-4.1-mini`,google:`gemini-3-flash-preview`};async function*p(t){let{message:n,history:i,semanticLayer:a,securityContext:o,agentConfig:s,apiKey:c}=t,p=t.sessionId||crypto.randomUUID(),m=s.observability,h=crypto.randomUUID(),g=Date.now(),_=t.providerOverride||s.provider||`anthropic`,v=t.modelOverride||s.model||f[_]||`claude-sonnet-4-6`,y=t.baseURLOverride||s.baseURL,b=s.maxTurns||25,x=s.maxTokens||4096,S;try{S=await d(_,c,{baseURL:y})}catch(t){console.error(`[agent] Failed to create %s provider: %s`,String(_).replace(/\n|\r/g,``),String(t instanceof Error?t.message:t).replace(/\n|\r/g,``)),yield{type:`error`,data:{message:t instanceof Error?t.message:e.C(`server.errors.llmInitFailed`)}};return}let C=l(),w=u({semanticLayer:a,securityContext:o}),T=r(a.getMetadata());t.systemContext&&(T+=`\n\n## User Context\n\n${t.systemContext}`);try{m?.onChatStart?.({traceId:h,sessionId:p,message:n,model:v,historyLength:i?.length??0})}catch{}let E=[];if(i&&i.length>0){for(let e of i)if(e.role===`user`)E.push({role:`user`,content:e.content});else if(e.role===`assistant`){let t=[];if(e.content&&t.push({type:`text`,text:e.content}),e.toolCalls&&e.toolCalls.length>0){for(let n of e.toolCalls)t.push({type:`tool_use`,id:n.id,name:n.name,input:n.input||{}});E.push({role:`assistant`,content:t});let n=e.toolCalls.map(e=>({toolUseId:e.id,toolName:e.name,content:typeof e.result==`string`?e.result:JSON.stringify(e.result??``),isError:e.status===`error`})),r=S.formatToolResults(n);if(Array.isArray(r))for(let e of r)E.push(e);else E.push(r)}else t.length>0&&E.push({role:`assistant`,content:e.content})}}E.push({role:`user`,content:n});let D=0;try{for(let e=0;e<b;e++){D=e+1;let t=await S.createStream({model:v,maxTokens:x,system:T,tools:C,messages:E}),n=[],r=``,i=``,a,o,s=Date.now(),c=!1;for await(let e of S.parseStreamEvents(t)){let t=e;switch(t.type){case`text_delta`:{let e=n[n.length-1];e&&e.type===`text`?e.text=(e.text||``)+t.text:n.push({type:`text`,text:t.text}),yield{type:`text_delta`,data:t.text};break}case`tool_use_start`:if(c&&r){let e=n[n.length-1];if(e?.type===`tool_use`)try{e.input=JSON.parse(r)}catch{}}n.push({type:`tool_use`,id:t.id,name:t.name,input:{},...t.metadata?{metadata:t.metadata}:{}}),r=``,c=!0,yield{type:`tool_use_start`,data:{id:t.id,name:t.name,input:void 0}};break;case`tool_input_delta`:r+=t.json;break;case`tool_use_end`:if(t.id&&t.input){let e=n.find(e=>e.type===`tool_use`&&e.id===t.id);e&&(e.input=t.input)}else if(c){let e=n[n.length-1];if(e?.type===`tool_use`&&r){try{e.input=JSON.parse(r)}catch{e.input={}}r=``}c=!1}break;case`message_meta`:t.inputTokens!=null&&(a=t.inputTokens),t.outputTokens!=null&&(o=t.outputTokens),t.stopReason&&(i=t.stopReason);break}}try{m?.onGenerationEnd?.({traceId:h,turn:e,model:v,stopReason:i,inputTokens:a,outputTokens:o,durationMs:Date.now()-s,input:E,output:n})}catch{}if(E.push({role:`assistant`,content:n}),!S.shouldContinue(i))break;let l=[];for(let t of n){if(t.type!==`tool_use`)continue;let n=t.name,r=t.input||{},i=t.id,a=w.get(n);if(!a){l.push({toolUseId:i,toolName:n,content:`Unknown tool: ${n}`,isError:!0}),yield{type:`tool_use_result`,data:{id:i,name:n,result:`Unknown tool: ${n}`,isError:!0}};continue}let o=Date.now();try{let t=await a(r);t.sideEffect&&(yield t.sideEffect),l.push({toolUseId:i,toolName:n,content:t.result,...t.isError?{isError:!0}:{}}),yield{type:`tool_use_result`,data:{id:i,name:n,result:t.result,...t.isError?{isError:!0}:{}}};try{m?.onToolEnd?.({traceId:h,turn:e,toolName:n,toolUseId:i,isError:!!t.isError,durationMs:Date.now()-o})}catch{}}catch(t){let r=t instanceof Error?t.message:`Tool execution failed`;l.push({toolUseId:i,toolName:n,content:r,isError:!0}),yield{type:`tool_use_result`,data:{id:i,name:n,result:r,isError:!0}};try{m?.onToolEnd?.({traceId:h,turn:e,toolName:n,toolUseId:i,isError:!0,durationMs:Date.now()-o})}catch{}}}yield{type:`turn_complete`,data:{}};let u=S.formatToolResults(l);if(Array.isArray(u))for(let e of u)E.push(e);else E.push(u)}try{m?.onChatEnd?.({traceId:h,sessionId:p,totalTurns:D,durationMs:Date.now()-g})}catch{}yield{type:`done`,data:{sessionId:p||``,traceId:h}}}catch(e){try{m?.onChatEnd?.({traceId:h,sessionId:p,totalTurns:0,durationMs:Date.now()-g,error:e instanceof Error?e.message:`Unknown error`})}catch{}console.error(`[agent] Chat error (provider=%s, model=%s): %s`,String(_).replace(/\n|\r/g,``),String(v).replace(/\n|\r/g,``),String(e instanceof Error?e.message:e).replace(/\n|\r/g,``)),yield{type:`error`,data:{message:S.formatError(e)}}}}exports.handleAgentChat=p;
|