drizzle-cube 0.4.29 → 0.4.31
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/anthropic-BIva8k1r.cjs +1 -0
- package/dist/adapters/anthropic-B_rg0BhK.js +140 -0
- package/dist/adapters/dist-Boc63-1q.cjs +2 -0
- package/dist/adapters/dist-De5fzUEM.js +581 -0
- package/dist/adapters/express/index.cjs +2 -10
- package/dist/adapters/express/index.d.ts +1 -1
- package/dist/adapters/express/index.js +232 -342
- package/dist/adapters/fastify/index.cjs +2 -10
- package/dist/adapters/fastify/index.d.ts +1 -1
- package/dist/adapters/fastify/index.js +275 -424
- package/dist/adapters/google-CT4kgmBf.js +154 -0
- package/dist/adapters/google-Dgo9-Kb5.cjs +2 -0
- package/dist/adapters/handler-BiVT5Sa4.js +2951 -0
- package/dist/adapters/handler-GLMhjuwG.cjs +25 -0
- package/dist/adapters/hono/index.cjs +2 -10
- package/dist/adapters/hono/index.d.ts +1 -1
- package/dist/adapters/hono/index.js +307 -402
- package/dist/adapters/mcp-prompts-BAutSQYA.js +344 -0
- package/dist/adapters/mcp-prompts-DsAkafVn.cjs +5 -0
- package/dist/adapters/mcp-transport-Cs6gEFCi.js +8127 -0
- package/dist/adapters/mcp-transport-nyTtswLM.cjs +254 -0
- package/dist/adapters/nextjs/index.cjs +1 -9
- package/dist/adapters/nextjs/index.d.ts +1 -1
- package/dist/adapters/nextjs/index.js +377 -600
- package/dist/adapters/openai-C5Brybjm.cjs +1 -0
- package/dist/adapters/openai-D1zCEi6A.cjs +16 -0
- package/dist/adapters/openai-DPuFtYsB.js +4136 -0
- package/dist/adapters/openai-wU05wYGL.js +153 -0
- package/dist/adapters/types.cjs +0 -1
- package/dist/adapters/types.js +0 -1
- package/dist/adapters/utils-Dj1adfDc.js +5399 -0
- package/dist/adapters/utils-cb6OWP7J.cjs +15 -0
- package/dist/adapters/utils.cjs +1 -19
- package/dist/adapters/utils.d.ts +1 -1
- package/dist/adapters/utils.js +2 -21333
- package/dist/client/charts.js +15 -186
- package/dist/client/chunks/DashboardEditModal-DenRJiYr.js +6678 -0
- package/dist/client/chunks/DashboardEditModal-DenRJiYr.js.map +1 -0
- package/dist/client/chunks/FieldSearchModal-BQS1v1up.js +2631 -0
- package/dist/client/chunks/FieldSearchModal-BQS1v1up.js.map +1 -0
- package/dist/client/chunks/RetentionCombinedChart-D4Yf1TnQ.js +270 -0
- package/dist/client/chunks/RetentionCombinedChart-D4Yf1TnQ.js.map +1 -0
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js +56 -0
- package/dist/client/chunks/RetentionCombinedChart.config-DprbXd1N.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js +193 -0
- package/dist/client/chunks/RetentionHeatmap-BoGY6mlZ.js.map +1 -0
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js +25 -0
- package/dist/client/chunks/RetentionHeatmap.config-cbaNExVy.js.map +1 -0
- package/dist/client/chunks/analysis-builder-DG38V1gO.js +6105 -0
- package/dist/client/chunks/analysis-builder-DG38V1gO.js.map +1 -0
- package/dist/client/chunks/analysis-builder-shared-DaFu78dk.js +3116 -0
- package/dist/client/chunks/analysis-builder-shared-DaFu78dk.js.map +1 -0
- package/dist/client/chunks/chart-activity-grid-wR2Twpo7.js +806 -0
- package/dist/client/chunks/chart-activity-grid-wR2Twpo7.js.map +1 -0
- package/dist/client/chunks/chart-area-e9ysnatQ.js +449 -0
- package/dist/client/chunks/chart-area-e9ysnatQ.js.map +1 -0
- package/dist/client/chunks/chart-bar-Bx4oKlqo.js +270 -0
- package/dist/client/chunks/chart-bar-Bx4oKlqo.js.map +1 -0
- package/dist/client/chunks/chart-box-plot-CVIi1aM5.js +377 -0
- package/dist/client/chunks/chart-box-plot-CVIi1aM5.js.map +1 -0
- package/dist/client/chunks/chart-bubble-DvyG15UB.js +273 -0
- package/dist/client/chunks/chart-bubble-DvyG15UB.js.map +1 -0
- package/dist/client/chunks/chart-candlestick-caHyxB9O.js +306 -0
- package/dist/client/chunks/chart-candlestick-caHyxB9O.js.map +1 -0
- package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js +51 -0
- package/dist/client/chunks/chart-config-activity-grid-USo7JrPh.js.map +1 -0
- package/dist/client/chunks/chart-config-area-D_ZufYzg.js +93 -0
- package/dist/client/chunks/chart-config-area-D_ZufYzg.js.map +1 -0
- package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js +87 -0
- package/dist/client/chunks/chart-config-bar-BCi2Wmd6.js.map +1 -0
- package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js +35 -0
- package/dist/client/chunks/chart-config-box-plot-afKLzJSp.js.map +1 -0
- package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js +82 -0
- package/dist/client/chunks/chart-config-bubble-CgbBjPv8.js.map +1 -0
- package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js +72 -0
- package/dist/client/chunks/chart-config-candlestick-7boGjZ-A.js.map +1 -0
- package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js +30 -0
- package/dist/client/chunks/chart-config-data-table-Cl7sBasW.js.map +1 -0
- package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js +93 -0
- package/dist/client/chunks/chart-config-funnel-CXPYQtTl.js.map +1 -0
- package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js +64 -0
- package/dist/client/chunks/chart-config-gauge-DUNEUCvh.js.map +1 -0
- package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js +91 -0
- package/dist/client/chunks/chart-config-heat-map-BFf1tO11.js.map +1 -0
- package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js +94 -0
- package/dist/client/chunks/chart-config-kpi-delta-C5k2waIJ.js.map +1 -0
- package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js +75 -0
- package/dist/client/chunks/chart-config-kpi-number-DptOyhk0.js.map +1 -0
- package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js +47 -0
- package/dist/client/chunks/chart-config-kpi-text-D9DdVWqd.js.map +1 -0
- package/dist/client/chunks/chart-config-line-B3NgLF7K.js +104 -0
- package/dist/client/chunks/chart-config-line-B3NgLF7K.js.map +1 -0
- package/dist/client/chunks/chart-config-markdown-tlfivQTt.js +117 -0
- package/dist/client/chunks/chart-config-markdown-tlfivQTt.js.map +1 -0
- package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js +82 -0
- package/dist/client/chunks/chart-config-measure-profile-D7XDwrU2.js.map +1 -0
- package/dist/client/chunks/chart-config-pie-wY0B52PC.js +68 -0
- package/dist/client/chunks/chart-config-pie-wY0B52PC.js.map +1 -0
- package/dist/client/chunks/chart-config-radar-DRpJBy1M.js +49 -0
- package/dist/client/chunks/chart-config-radar-DRpJBy1M.js.map +1 -0
- package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js +38 -0
- package/dist/client/chunks/chart-config-radial-bar-DCUpXv9G.js.map +1 -0
- package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js +66 -0
- package/dist/client/chunks/chart-config-sankey-CdOhlm4h.js.map +1 -0
- package/dist/client/chunks/chart-config-scatter-B2su_x8f.js +61 -0
- package/dist/client/chunks/chart-config-scatter-B2su_x8f.js.map +1 -0
- package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js +45 -0
- package/dist/client/chunks/chart-config-sunburst-BPdjbk18.js.map +1 -0
- package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js +51 -0
- package/dist/client/chunks/chart-config-tree-map-Cbsh2fe2.js.map +1 -0
- package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js +59 -0
- package/dist/client/chunks/chart-config-waterfall-DGmuZfQF.js.map +1 -0
- package/dist/client/chunks/chart-data-table-B2m_6EZe.js +4088 -0
- package/dist/client/chunks/chart-data-table-B2m_6EZe.js.map +1 -0
- package/dist/client/chunks/chart-funnel-C9JRW79j.js +447 -0
- package/dist/client/chunks/chart-funnel-C9JRW79j.js.map +1 -0
- package/dist/client/chunks/chart-gauge-BLLJqeXo.js +424 -0
- package/dist/client/chunks/chart-gauge-BLLJqeXo.js.map +1 -0
- package/dist/client/chunks/chart-heat-map-f2fM2mDC.js +236 -0
- package/dist/client/chunks/chart-heat-map-f2fM2mDC.js.map +1 -0
- package/dist/client/chunks/chart-kpi-delta-S6qDEoJO.js +343 -0
- package/dist/client/chunks/chart-kpi-delta-S6qDEoJO.js.map +1 -0
- package/dist/client/chunks/chart-kpi-number-CEUBsVW2.js +326 -0
- package/dist/client/chunks/chart-kpi-number-CEUBsVW2.js.map +1 -0
- package/dist/client/chunks/chart-kpi-text-DgRig_jQ.js +149 -0
- package/dist/client/chunks/chart-kpi-text-DgRig_jQ.js.map +1 -0
- package/dist/client/chunks/chart-line-CPhQRMZ7.js +432 -0
- package/dist/client/chunks/chart-line-CPhQRMZ7.js.map +1 -0
- package/dist/client/chunks/chart-markdown-DXxc43w1.js +3457 -0
- package/dist/client/chunks/chart-markdown-DXxc43w1.js.map +1 -0
- package/dist/client/chunks/chart-measure-profile-CVlqGslU.js +179 -0
- package/dist/client/chunks/chart-measure-profile-CVlqGslU.js.map +1 -0
- package/dist/client/chunks/chart-pie-DafSc9sE.js +172 -0
- package/dist/client/chunks/chart-pie-DafSc9sE.js.map +1 -0
- package/dist/client/chunks/chart-radar-Dz9F5k-B.js +154 -0
- package/dist/client/chunks/chart-radar-Dz9F5k-B.js.map +1 -0
- package/dist/client/chunks/chart-radial-bar-N3MNUL7o.js +148 -0
- package/dist/client/chunks/chart-radial-bar-N3MNUL7o.js.map +1 -0
- package/dist/client/chunks/chart-sankey-8nRYnupt.js +222 -0
- package/dist/client/chunks/chart-sankey-8nRYnupt.js.map +1 -0
- package/dist/client/chunks/chart-scatter-J2JNi88S.js +255 -0
- package/dist/client/chunks/chart-scatter-J2JNi88S.js.map +1 -0
- package/dist/client/chunks/chart-sunburst-D1NFQjqk.js +221 -0
- package/dist/client/chunks/chart-sunburst-D1NFQjqk.js.map +1 -0
- package/dist/client/chunks/chart-tree-map-CbYjko2s.js +298 -0
- package/dist/client/chunks/chart-tree-map-CbYjko2s.js.map +1 -0
- package/dist/client/chunks/chart-waterfall-Z65TGMUO.js +237 -0
- package/dist/client/chunks/chart-waterfall-Z65TGMUO.js.map +1 -0
- package/dist/client/chunks/charts-core-CJlGzwsW.js +215 -0
- package/dist/client/chunks/charts-core-CJlGzwsW.js.map +1 -0
- package/dist/client/chunks/charts-loader-BI07yxaQ.js +259 -0
- package/dist/client/chunks/charts-loader-BI07yxaQ.js.map +1 -0
- package/dist/client/chunks/core-D1TOj17W.js +845 -0
- package/dist/client/chunks/core-D1TOj17W.js.map +1 -0
- package/dist/client/chunks/dist-DDBeV_JI.js +847 -0
- package/dist/client/chunks/dist-DDBeV_JI.js.map +1 -0
- package/dist/client/chunks/javascript-BBwTSo6e.js +438 -0
- package/dist/client/chunks/javascript-BBwTSo6e.js.map +1 -0
- package/dist/client/chunks/json-BpTrLZSh.js +38 -0
- package/dist/client/chunks/json-BpTrLZSh.js.map +1 -0
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js +149 -0
- package/dist/client/chunks/lazyChartConfigRegistry-BjhxDaSf.js.map +1 -0
- package/dist/client/chunks/providers-DX3Vw5kc.js +7 -0
- package/dist/client/chunks/providers-DX3Vw5kc.js.map +1 -0
- package/dist/client/chunks/retention-UEXlSdZ-.js +132 -0
- package/dist/client/chunks/retention-UEXlSdZ-.js.map +1 -0
- package/dist/client/chunks/rolldown-runtime-lc2dmIiU.js +20 -0
- package/dist/client/chunks/schema-visualization-DPL5_Tkh.js +1073 -0
- package/dist/client/chunks/schema-visualization-DPL5_Tkh.js.map +1 -0
- package/dist/client/chunks/sql-B0chxcEK.js +120 -0
- package/dist/client/chunks/sql-B0chxcEK.js.map +1 -0
- package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js +30 -0
- package/dist/client/chunks/syntaxHighlighting-87bOwTxj.js.map +1 -0
- package/dist/client/chunks/useDebounce-DkuM7nQk.js +1394 -0
- package/dist/client/chunks/useDebounce-DkuM7nQk.js.map +1 -0
- package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js +66 -0
- package/dist/client/chunks/useDirtyStateTracking-CgKZWkel.js.map +1 -0
- package/dist/client/chunks/useExplainAI-RflLTDVL.js +203 -0
- package/dist/client/chunks/useExplainAI-RflLTDVL.js.map +1 -0
- package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js +37 -0
- package/dist/client/chunks/useNotebookLayout-BFZ_33Kb.js.map +1 -0
- package/dist/client/chunks/utils--32ZtfbZ.js +128 -0
- package/dist/client/chunks/utils--32ZtfbZ.js.map +1 -0
- package/dist/client/chunks/vendor-CZX7UVzM.js +828 -0
- package/dist/client/chunks/vendor-CZX7UVzM.js.map +1 -0
- package/dist/client/components/AnalysisBuilder/AnalysisModeErrorBoundary.d.ts +0 -1
- package/dist/client/components.js +4 -18
- package/dist/client/hooks.js +6 -58
- package/dist/client/icons.js +2 -15
- package/dist/client/index.js +1061 -1295
- package/dist/client/index.js.map +1 -1
- package/dist/client/providers.js +3 -9
- package/dist/client/styles.css +2 -1
- package/dist/client/types.d.ts +1 -0
- package/dist/client/utils.js +7 -74
- package/dist/client-bundle-stats.html +1 -1
- package/dist/server/anthropic-BsNspi1r.js +140 -0
- package/dist/server/anthropic-DsCEX6Fm.cjs +1 -0
- package/dist/server/dist-CMWZC51B.js +581 -0
- package/dist/server/dist-DxegvyZF.cjs +2 -0
- package/dist/server/google-BXwMolCu.js +154 -0
- package/dist/server/google-DzQWXFwF.cjs +2 -0
- package/dist/server/index.cjs +110 -129
- package/dist/server/index.d.ts +43 -9
- package/dist/server/index.js +15398 -34394
- package/dist/server/openai-CucrxPHM.cjs +16 -0
- package/dist/server/openai-DiyuZ3ds.cjs +1 -0
- package/dist/server/openai-nZJcAzON.js +4136 -0
- package/dist/server/openai-owPdq1yN.js +153 -0
- package/package.json +18 -8
- package/dist/adapters/anthropic-BTkjgFpT.cjs +0 -1
- package/dist/adapters/anthropic-CTu9E801.js +0 -126
- package/dist/adapters/google-BAK9pnQf.cjs +0 -2
- package/dist/adapters/google-DficVAsJ.js +0 -146
- package/dist/adapters/handler-BHguLZOY.js +0 -2713
- package/dist/adapters/handler-DOIyiFPg.cjs +0 -39
- package/dist/adapters/index-BgCeQBuN.cjs +0 -2
- package/dist/adapters/index-C3PskWTr.js +0 -5353
- package/dist/adapters/index-C45_meK_.js +0 -719
- package/dist/adapters/index-ht4NPca9.cjs +0 -23
- package/dist/adapters/mcp-transport-CWGqDQSI.cjs +0 -259
- package/dist/adapters/mcp-transport-CyeHMDPl.js +0 -11055
- package/dist/adapters/openai-BvA6eLs8.cjs +0 -1
- package/dist/adapters/openai-mcE24du8.js +0 -131
- package/dist/client/charts.js.map +0 -1
- package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js +0 -256
- package/dist/client/chunks/RetentionCombinedChart--SnU4Y_I.js.map +0 -1
- package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js +0 -48
- package/dist/client/chunks/RetentionCombinedChart.config-Bbp2ghim.js.map +0 -1
- package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js +0 -178
- package/dist/client/chunks/RetentionHeatmap-BHYU8MXY.js.map +0 -1
- package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js +0 -29
- package/dist/client/chunks/RetentionHeatmap.config-BWf_-vdj.js.map +0 -1
- package/dist/client/chunks/analysis-builder-DMFoAkjT.js +0 -6203
- package/dist/client/chunks/analysis-builder-DMFoAkjT.js.map +0 -1
- package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js +0 -3140
- package/dist/client/chunks/analysis-builder-shared-CunrT3gi.js.map +0 -1
- package/dist/client/chunks/chart-activity-grid-DCznpK6N.js +0 -347
- package/dist/client/chunks/chart-activity-grid-DCznpK6N.js.map +0 -1
- package/dist/client/chunks/chart-area-CqKRIUpj.js +0 -234
- package/dist/client/chunks/chart-area-CqKRIUpj.js.map +0 -1
- package/dist/client/chunks/chart-bar-Bl5jvrU_.js +0 -267
- package/dist/client/chunks/chart-bar-Bl5jvrU_.js.map +0 -1
- package/dist/client/chunks/chart-box-plot-CzMb00z_.js +0 -322
- package/dist/client/chunks/chart-box-plot-CzMb00z_.js.map +0 -1
- package/dist/client/chunks/chart-bubble-BF8Z52eW.js +0 -249
- package/dist/client/chunks/chart-bubble-BF8Z52eW.js.map +0 -1
- package/dist/client/chunks/chart-candlestick-ByWS945g.js +0 -269
- package/dist/client/chunks/chart-candlestick-ByWS945g.js.map +0 -1
- package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js +0 -50
- package/dist/client/chunks/chart-config-activity-grid-CmOqDuOT.js.map +0 -1
- package/dist/client/chunks/chart-config-area-CK_GVApT.js +0 -77
- package/dist/client/chunks/chart-config-area-CK_GVApT.js.map +0 -1
- package/dist/client/chunks/chart-config-bar-C8uzktxl.js +0 -71
- package/dist/client/chunks/chart-config-bar-C8uzktxl.js.map +0 -1
- package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js +0 -38
- package/dist/client/chunks/chart-config-box-plot-D_E_SSc2.js.map +0 -1
- package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js +0 -71
- package/dist/client/chunks/chart-config-bubble-q3DoQX5F.js.map +0 -1
- package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js +0 -70
- package/dist/client/chunks/chart-config-candlestick-CRCpD43-.js.map +0 -1
- package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js +0 -28
- package/dist/client/chunks/chart-config-data-table-B20Y5JCm.js.map +0 -1
- package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js +0 -92
- package/dist/client/chunks/chart-config-funnel-3eYnGg8M.js.map +0 -1
- package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js +0 -64
- package/dist/client/chunks/chart-config-gauge-CQx9w3d4.js.map +0 -1
- package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js +0 -77
- package/dist/client/chunks/chart-config-heat-map-_wEnTnRA.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js +0 -97
- package/dist/client/chunks/chart-config-kpi-delta-DLGZ2A3X.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js +0 -75
- package/dist/client/chunks/chart-config-kpi-number-K-wzviXF.js.map +0 -1
- package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js +0 -47
- package/dist/client/chunks/chart-config-kpi-text-BjYqwqaJ.js.map +0 -1
- package/dist/client/chunks/chart-config-line-JNagi9tf.js +0 -88
- package/dist/client/chunks/chart-config-line-JNagi9tf.js.map +0 -1
- package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js +0 -97
- package/dist/client/chunks/chart-config-markdown-BWQSjJpy.js.map +0 -1
- package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js +0 -70
- package/dist/client/chunks/chart-config-measure-profile-ZYaMrtws.js.map +0 -1
- package/dist/client/chunks/chart-config-pie-CNLXb-fr.js +0 -39
- package/dist/client/chunks/chart-config-pie-CNLXb-fr.js.map +0 -1
- package/dist/client/chunks/chart-config-radar-oxHfRAa3.js +0 -44
- package/dist/client/chunks/chart-config-radar-oxHfRAa3.js.map +0 -1
- package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js +0 -37
- package/dist/client/chunks/chart-config-radial-bar-_Aw3jAEm.js.map +0 -1
- package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js +0 -61
- package/dist/client/chunks/chart-config-sankey-C8FX9hGF.js.map +0 -1
- package/dist/client/chunks/chart-config-scatter-DFKM80eO.js +0 -53
- package/dist/client/chunks/chart-config-scatter-DFKM80eO.js.map +0 -1
- package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js +0 -50
- package/dist/client/chunks/chart-config-sunburst-BmC0NLTU.js.map +0 -1
- package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js +0 -47
- package/dist/client/chunks/chart-config-tree-map-DGMbNTaa.js.map +0 -1
- package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js +0 -60
- package/dist/client/chunks/chart-config-waterfall-DTyXV_fo.js.map +0 -1
- package/dist/client/chunks/chart-data-table-HwfF-Ujv.js +0 -293
- package/dist/client/chunks/chart-data-table-HwfF-Ujv.js.map +0 -1
- package/dist/client/chunks/chart-funnel-WmuoWlCq.js +0 -259
- package/dist/client/chunks/chart-funnel-WmuoWlCq.js.map +0 -1
- package/dist/client/chunks/chart-gauge-Cot4By-w.js +0 -374
- package/dist/client/chunks/chart-gauge-Cot4By-w.js.map +0 -1
- package/dist/client/chunks/chart-heat-map-bGNtsZMr.js +0 -231
- package/dist/client/chunks/chart-heat-map-bGNtsZMr.js.map +0 -1
- package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js +0 -351
- package/dist/client/chunks/chart-kpi-delta-DeyKMxgq.js.map +0 -1
- package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js +0 -476
- package/dist/client/chunks/chart-kpi-number-D1z1gxXO.js.map +0 -1
- package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js +0 -165
- package/dist/client/chunks/chart-kpi-text-b7q6KWc0.js.map +0 -1
- package/dist/client/chunks/chart-line-3Nf-EPqJ.js +0 -450
- package/dist/client/chunks/chart-line-3Nf-EPqJ.js.map +0 -1
- package/dist/client/chunks/chart-markdown-BT_-MBq1.js +0 -2721
- package/dist/client/chunks/chart-markdown-BT_-MBq1.js.map +0 -1
- package/dist/client/chunks/chart-measure-profile-BVjUonqU.js +0 -114
- package/dist/client/chunks/chart-measure-profile-BVjUonqU.js.map +0 -1
- package/dist/client/chunks/chart-pie-DblG6w7g.js +0 -137
- package/dist/client/chunks/chart-pie-DblG6w7g.js.map +0 -1
- package/dist/client/chunks/chart-radar-BHZbeeTg.js +0 -129
- package/dist/client/chunks/chart-radar-BHZbeeTg.js.map +0 -1
- package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js +0 -119
- package/dist/client/chunks/chart-radial-bar-AlEJC1Jo.js.map +0 -1
- package/dist/client/chunks/chart-sankey-E8vYKjQF.js +0 -189
- package/dist/client/chunks/chart-sankey-E8vYKjQF.js.map +0 -1
- package/dist/client/chunks/chart-scatter-Bbxqi0iw.js +0 -202
- package/dist/client/chunks/chart-scatter-Bbxqi0iw.js.map +0 -1
- package/dist/client/chunks/chart-sunburst-BgnTKolT.js +0 -188
- package/dist/client/chunks/chart-sunburst-BgnTKolT.js.map +0 -1
- package/dist/client/chunks/chart-tree-map-i9LGCLwl.js +0 -284
- package/dist/client/chunks/chart-tree-map-i9LGCLwl.js.map +0 -1
- package/dist/client/chunks/chart-waterfall-BeIhCm83.js +0 -191
- package/dist/client/chunks/chart-waterfall-BeIhCm83.js.map +0 -1
- package/dist/client/chunks/charts-core-BUUO36OM.js +0 -692
- package/dist/client/chunks/charts-core-BUUO36OM.js.map +0 -1
- package/dist/client/chunks/charts-loader-goTYnavu.js +0 -258
- package/dist/client/chunks/charts-loader-goTYnavu.js.map +0 -1
- package/dist/client/chunks/components-BFgYvFq6.js +0 -10066
- package/dist/client/chunks/components-BFgYvFq6.js.map +0 -1
- package/dist/client/chunks/core-Y9e-sNfb.js +0 -1068
- package/dist/client/chunks/core-Y9e-sNfb.js.map +0 -1
- package/dist/client/chunks/flow-utils-CjQZG5qq.js +0 -16
- package/dist/client/chunks/flow-utils-CjQZG5qq.js.map +0 -1
- package/dist/client/chunks/funnel-utils-CyonoNeC.js +0 -135
- package/dist/client/chunks/funnel-utils-CyonoNeC.js.map +0 -1
- package/dist/client/chunks/icons-CwvgmdIP.js +0 -1636
- package/dist/client/chunks/icons-CwvgmdIP.js.map +0 -1
- package/dist/client/chunks/index-CApFCBF9.js +0 -81
- package/dist/client/chunks/index-CApFCBF9.js.map +0 -1
- package/dist/client/chunks/index-_2PSgbkC.js +0 -1046
- package/dist/client/chunks/index-_2PSgbkC.js.map +0 -1
- package/dist/client/chunks/javascript-DII1YQGr.js +0 -659
- package/dist/client/chunks/javascript-DII1YQGr.js.map +0 -1
- package/dist/client/chunks/json-C_6Prymp.js +0 -39
- package/dist/client/chunks/json-C_6Prymp.js.map +0 -1
- package/dist/client/chunks/providers-Ds7DRmnO.js +0 -554
- package/dist/client/chunks/providers-Ds7DRmnO.js.map +0 -1
- package/dist/client/chunks/retention-CzCo8262.js +0 -120
- package/dist/client/chunks/retention-CzCo8262.js.map +0 -1
- package/dist/client/chunks/schema-visualization-B97a1Ybu.js +0 -772
- package/dist/client/chunks/schema-visualization-B97a1Ybu.js.map +0 -1
- package/dist/client/chunks/sql-IeKX8fQ8.js +0 -616
- package/dist/client/chunks/sql-IeKX8fQ8.js.map +0 -1
- package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js +0 -34
- package/dist/client/chunks/syntaxHighlighting-DAMSW_A6.js.map +0 -1
- package/dist/client/chunks/theme-Dp3hFed1.js +0 -112
- package/dist/client/chunks/theme-Dp3hFed1.js.map +0 -1
- package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js +0 -1231
- package/dist/client/chunks/useDirtyStateTracking-CyAXd07d.js.map +0 -1
- package/dist/client/chunks/useExplainAI-CfQ_JmF1.js +0 -182
- package/dist/client/chunks/useExplainAI-CfQ_JmF1.js.map +0 -1
- package/dist/client/chunks/vendor-B2EH3V58.js +0 -2892
- package/dist/client/chunks/vendor-B2EH3V58.js.map +0 -1
- package/dist/client/components.js.map +0 -1
- package/dist/client/hooks.js.map +0 -1
- package/dist/client/icons.js.map +0 -1
- package/dist/client/providers.js.map +0 -1
- package/dist/client/utils.js.map +0 -1
- package/dist/server/anthropic-BTkjgFpT.cjs +0 -1
- package/dist/server/anthropic-CTu9E801.js +0 -126
- package/dist/server/google-BAK9pnQf.cjs +0 -2
- package/dist/server/google-DficVAsJ.js +0 -146
- package/dist/server/index-BgCeQBuN.cjs +0 -2
- package/dist/server/index-C3PskWTr.js +0 -5353
- package/dist/server/index-C45_meK_.js +0 -719
- package/dist/server/index-ht4NPca9.cjs +0 -23
- package/dist/server/openai-BvA6eLs8.cjs +0 -1
- package/dist/server/openai-mcE24du8.js +0 -131
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class{client;constructor(e){this.apiKey=e}apiKey;initialized=!1;async ensureClient(){if(this.initialized)return;let e;try{let t=await import(`@anthropic-ai/sdk`);e=t.default||t.Anthropic||t}catch{throw Error(`@anthropic-ai/sdk is required for the Anthropic provider. Install it with: npm install @anthropic-ai/sdk`)}this.client=new e({apiKey:this.apiKey}),this.initialized=!0}async createStream(e){await this.ensureClient();let{messages:t,system:n}=this.formatMessages(e.messages,e.system);return this.client.messages.create({model:e.model,max_tokens:e.maxTokens,system:n,tools:this.formatTools(e.tools),messages:t,stream:!0})}async*parseStreamEvents(e){for await(let t of e){let e=t;switch(e.type){case`content_block_start`:{let t=e.content_block;t.type===`tool_use`&&(yield{type:`tool_use_start`,id:t.id,name:t.name});break}case`content_block_delta`:{let t=e.delta;t.type===`text_delta`&&t.text?yield{type:`text_delta`,text:t.text}:t.type===`input_json_delta`&&t.partial_json&&(yield{type:`tool_input_delta`,json:t.partial_json});break}case`content_block_stop`:yield{type:`tool_use_end`};break;case`message_start`:{let t=e.message;t?.usage?.input_tokens!=null&&(yield{type:`message_meta`,inputTokens:t.usage.input_tokens,stopReason:``});break}case`message_delta`:{let t=e.usage,n=e.delta?.stop_reason||``;yield{type:`message_meta`,outputTokens:t?.output_tokens,stopReason:n};break}}}}formatTools(e){return e.map(e=>({name:e.name,description:e.description,input_schema:e.parameters}))}formatMessages(e,t){return{messages:e.map(e=>e.role===`tool_result`?{role:`user`,content:e.content}:{role:e.role,content:e.content}),system:t}}formatToolResults(e){return{role:`user`,content:e.map(e=>({type:`tool_result`,tool_use_id:e.toolUseId,content:e.content,...e.isError?{is_error:!0}:{}}))}}shouldContinue(e){return e===`tool_use`}formatError(e){if(!e||!(e instanceof Error))return`Something went wrong. Please try again.`;let t=e.message||``,n={overloaded_error:`The AI service is temporarily overloaded. Please try again in a moment.`,rate_limit_error:`Too many requests. Please wait a moment and try again.`,api_error:`The AI service encountered an error. Please try again.`,authentication_error:`Authentication failed. Please check your API key configuration.`,invalid_request_error:`There was a problem with the request. Please try again.`},r=e;if(r.status||r.type){let e=r.error?.type||r.type||``;if(n[e])return n[e]}if(t.startsWith(`{`)||t.startsWith(`Error: {`)){try{let e=JSON.parse(t.replace(/^Error:\s*/,``)),r=e.error?.type||e.type||``;if(n[r])return n[r]}catch{}return`The AI service encountered an error. Please try again.`}return t}};exports.AnthropicProvider=e;
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
//#region src/server/agent/providers/anthropic.ts
|
|
2
|
+
var e = class {
|
|
3
|
+
client;
|
|
4
|
+
constructor(e) {
|
|
5
|
+
this.apiKey = e;
|
|
6
|
+
}
|
|
7
|
+
apiKey;
|
|
8
|
+
initialized = !1;
|
|
9
|
+
async ensureClient() {
|
|
10
|
+
if (this.initialized) return;
|
|
11
|
+
let e;
|
|
12
|
+
try {
|
|
13
|
+
let t = await import(
|
|
14
|
+
/* webpackIgnore: true */
|
|
15
|
+
"@anthropic-ai/sdk"
|
|
16
|
+
);
|
|
17
|
+
e = t.default || t.Anthropic || t;
|
|
18
|
+
} catch {
|
|
19
|
+
throw Error("@anthropic-ai/sdk is required for the Anthropic provider. Install it with: npm install @anthropic-ai/sdk");
|
|
20
|
+
}
|
|
21
|
+
this.client = new e({ apiKey: this.apiKey }), this.initialized = !0;
|
|
22
|
+
}
|
|
23
|
+
async createStream(e) {
|
|
24
|
+
await this.ensureClient();
|
|
25
|
+
let { messages: t, system: n } = this.formatMessages(e.messages, e.system);
|
|
26
|
+
return this.client.messages.create({
|
|
27
|
+
model: e.model,
|
|
28
|
+
max_tokens: e.maxTokens,
|
|
29
|
+
system: n,
|
|
30
|
+
tools: this.formatTools(e.tools),
|
|
31
|
+
messages: t,
|
|
32
|
+
stream: !0
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async *parseStreamEvents(e) {
|
|
36
|
+
for await (let t of e) {
|
|
37
|
+
let e = t;
|
|
38
|
+
switch (e.type) {
|
|
39
|
+
case "content_block_start": {
|
|
40
|
+
let t = e.content_block;
|
|
41
|
+
t.type === "tool_use" && (yield {
|
|
42
|
+
type: "tool_use_start",
|
|
43
|
+
id: t.id,
|
|
44
|
+
name: t.name
|
|
45
|
+
});
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "content_block_delta": {
|
|
49
|
+
let t = e.delta;
|
|
50
|
+
t.type === "text_delta" && t.text ? yield {
|
|
51
|
+
type: "text_delta",
|
|
52
|
+
text: t.text
|
|
53
|
+
} : t.type === "input_json_delta" && t.partial_json && (yield {
|
|
54
|
+
type: "tool_input_delta",
|
|
55
|
+
json: t.partial_json
|
|
56
|
+
});
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "content_block_stop":
|
|
60
|
+
yield { type: "tool_use_end" };
|
|
61
|
+
break;
|
|
62
|
+
case "message_start": {
|
|
63
|
+
let t = e.message;
|
|
64
|
+
t?.usage?.input_tokens != null && (yield {
|
|
65
|
+
type: "message_meta",
|
|
66
|
+
inputTokens: t.usage.input_tokens,
|
|
67
|
+
stopReason: ""
|
|
68
|
+
});
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
case "message_delta": {
|
|
72
|
+
let t = e.usage, n = e.delta?.stop_reason || "";
|
|
73
|
+
yield {
|
|
74
|
+
type: "message_meta",
|
|
75
|
+
outputTokens: t?.output_tokens,
|
|
76
|
+
stopReason: n
|
|
77
|
+
};
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
formatTools(e) {
|
|
84
|
+
return e.map((e) => ({
|
|
85
|
+
name: e.name,
|
|
86
|
+
description: e.description,
|
|
87
|
+
input_schema: e.parameters
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
formatMessages(e, t) {
|
|
91
|
+
return {
|
|
92
|
+
messages: e.map((e) => e.role === "tool_result" ? {
|
|
93
|
+
role: "user",
|
|
94
|
+
content: e.content
|
|
95
|
+
} : {
|
|
96
|
+
role: e.role,
|
|
97
|
+
content: e.content
|
|
98
|
+
}),
|
|
99
|
+
system: t
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
formatToolResults(e) {
|
|
103
|
+
return {
|
|
104
|
+
role: "user",
|
|
105
|
+
content: e.map((e) => ({
|
|
106
|
+
type: "tool_result",
|
|
107
|
+
tool_use_id: e.toolUseId,
|
|
108
|
+
content: e.content,
|
|
109
|
+
...e.isError ? { is_error: !0 } : {}
|
|
110
|
+
}))
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
shouldContinue(e) {
|
|
114
|
+
return e === "tool_use";
|
|
115
|
+
}
|
|
116
|
+
formatError(e) {
|
|
117
|
+
if (!e || !(e instanceof Error)) return "Something went wrong. Please try again.";
|
|
118
|
+
let t = e.message || "", n = {
|
|
119
|
+
overloaded_error: "The AI service is temporarily overloaded. Please try again in a moment.",
|
|
120
|
+
rate_limit_error: "Too many requests. Please wait a moment and try again.",
|
|
121
|
+
api_error: "The AI service encountered an error. Please try again.",
|
|
122
|
+
authentication_error: "Authentication failed. Please check your API key configuration.",
|
|
123
|
+
invalid_request_error: "There was a problem with the request. Please try again."
|
|
124
|
+
}, r = e;
|
|
125
|
+
if (r.status || r.type) {
|
|
126
|
+
let e = r.error?.type || r.type || "";
|
|
127
|
+
if (n[e]) return n[e];
|
|
128
|
+
}
|
|
129
|
+
if (t.startsWith("{") || t.startsWith("Error: {")) {
|
|
130
|
+
try {
|
|
131
|
+
let e = JSON.parse(t.replace(/^Error:\s*/, "")), r = e.error?.type || e.type || "";
|
|
132
|
+
if (n[r]) return n[r];
|
|
133
|
+
} catch {}
|
|
134
|
+
return "The AI service encountered an error. Please try again.";
|
|
135
|
+
}
|
|
136
|
+
return t;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
//#endregion
|
|
140
|
+
export { e as AnthropicProvider };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var e;(function(e){e.STRING=`string`,e.NUMBER=`number`,e.INTEGER=`integer`,e.BOOLEAN=`boolean`,e.ARRAY=`array`,e.OBJECT=`object`})(e||={});var t;(function(e){e.LANGUAGE_UNSPECIFIED=`language_unspecified`,e.PYTHON=`python`})(t||={});var n;(function(e){e.OUTCOME_UNSPECIFIED=`outcome_unspecified`,e.OUTCOME_OK=`outcome_ok`,e.OUTCOME_FAILED=`outcome_failed`,e.OUTCOME_DEADLINE_EXCEEDED=`outcome_deadline_exceeded`})(n||={});var r=[`user`,`model`,`function`,`system`],i;(function(e){e.HARM_CATEGORY_UNSPECIFIED=`HARM_CATEGORY_UNSPECIFIED`,e.HARM_CATEGORY_HATE_SPEECH=`HARM_CATEGORY_HATE_SPEECH`,e.HARM_CATEGORY_SEXUALLY_EXPLICIT=`HARM_CATEGORY_SEXUALLY_EXPLICIT`,e.HARM_CATEGORY_HARASSMENT=`HARM_CATEGORY_HARASSMENT`,e.HARM_CATEGORY_DANGEROUS_CONTENT=`HARM_CATEGORY_DANGEROUS_CONTENT`,e.HARM_CATEGORY_CIVIC_INTEGRITY=`HARM_CATEGORY_CIVIC_INTEGRITY`})(i||={});var a;(function(e){e.HARM_BLOCK_THRESHOLD_UNSPECIFIED=`HARM_BLOCK_THRESHOLD_UNSPECIFIED`,e.BLOCK_LOW_AND_ABOVE=`BLOCK_LOW_AND_ABOVE`,e.BLOCK_MEDIUM_AND_ABOVE=`BLOCK_MEDIUM_AND_ABOVE`,e.BLOCK_ONLY_HIGH=`BLOCK_ONLY_HIGH`,e.BLOCK_NONE=`BLOCK_NONE`})(a||={});var o;(function(e){e.HARM_PROBABILITY_UNSPECIFIED=`HARM_PROBABILITY_UNSPECIFIED`,e.NEGLIGIBLE=`NEGLIGIBLE`,e.LOW=`LOW`,e.MEDIUM=`MEDIUM`,e.HIGH=`HIGH`})(o||={});var s;(function(e){e.BLOCKED_REASON_UNSPECIFIED=`BLOCKED_REASON_UNSPECIFIED`,e.SAFETY=`SAFETY`,e.OTHER=`OTHER`})(s||={});var c;(function(e){e.FINISH_REASON_UNSPECIFIED=`FINISH_REASON_UNSPECIFIED`,e.STOP=`STOP`,e.MAX_TOKENS=`MAX_TOKENS`,e.SAFETY=`SAFETY`,e.RECITATION=`RECITATION`,e.LANGUAGE=`LANGUAGE`,e.BLOCKLIST=`BLOCKLIST`,e.PROHIBITED_CONTENT=`PROHIBITED_CONTENT`,e.SPII=`SPII`,e.MALFORMED_FUNCTION_CALL=`MALFORMED_FUNCTION_CALL`,e.OTHER=`OTHER`})(c||={});var l;(function(e){e.TASK_TYPE_UNSPECIFIED=`TASK_TYPE_UNSPECIFIED`,e.RETRIEVAL_QUERY=`RETRIEVAL_QUERY`,e.RETRIEVAL_DOCUMENT=`RETRIEVAL_DOCUMENT`,e.SEMANTIC_SIMILARITY=`SEMANTIC_SIMILARITY`,e.CLASSIFICATION=`CLASSIFICATION`,e.CLUSTERING=`CLUSTERING`})(l||={});var u;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.AUTO=`AUTO`,e.ANY=`ANY`,e.NONE=`NONE`})(u||={});var d;(function(e){e.MODE_UNSPECIFIED=`MODE_UNSPECIFIED`,e.MODE_DYNAMIC=`MODE_DYNAMIC`})(d||={});var f=class extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}},p=class extends f{constructor(e,t){super(e),this.response=t}},m=class extends f{constructor(e,t,n,r){super(e),this.status=t,this.statusText=n,this.errorDetails=r}},h=class extends f{},g=class extends f{},ee=`https://generativelanguage.googleapis.com`,_=`v1beta`,v=`0.24.1`,te=`genai-js`,y;(function(e){e.GENERATE_CONTENT=`generateContent`,e.STREAM_GENERATE_CONTENT=`streamGenerateContent`,e.COUNT_TOKENS=`countTokens`,e.EMBED_CONTENT=`embedContent`,e.BATCH_EMBED_CONTENTS=`batchEmbedContents`})(y||={});var b=class{constructor(e,t,n,r,i){this.model=e,this.task=t,this.apiKey=n,this.stream=r,this.requestOptions=i}toString(){let e=this.requestOptions?.apiVersion||_,t=`${this.requestOptions?.baseUrl||ee}/${e}/${this.model}:${this.task}`;return this.stream&&(t+=`?alt=sse`),t}};function x(e){let t=[];return e?.apiClient&&t.push(e.apiClient),t.push(`${te}/${v}`),t.join(` `)}async function S(e){let t=new Headers;t.append(`Content-Type`,`application/json`),t.append(`x-goog-api-client`,x(e.requestOptions)),t.append(`x-goog-api-key`,e.apiKey);let n=e.requestOptions?.customHeaders;if(n){if(!(n instanceof Headers))try{n=new Headers(n)}catch(e){throw new h(`unable to convert customHeaders value ${JSON.stringify(n)} to Headers: ${e.message}`)}for(let[e,r]of n.entries()){if(e===`x-goog-api-key`)throw new h(`Cannot set reserved header name ${e}`);if(e===`x-goog-api-client`)throw new h(`Header name ${e} can only be set using the apiClient field`);t.append(e,r)}}return t}async function ne(e,t,n,r,i,a){let o=new b(e,t,n,r,a);return{url:o.toString(),fetchOptions:Object.assign(Object.assign({},D(a)),{method:`POST`,headers:await S(o),body:i})}}async function C(e,t,n,r,i,a={},o=fetch){let{url:s,fetchOptions:c}=await ne(e,t,n,r,i,a);return w(s,c,o)}async function w(e,t,n=fetch){let r;try{r=await n(e,t)}catch(t){T(t,e)}return r.ok||await E(r,e),r}function T(e,t){let n=e;throw n.name===`AbortError`?(n=new g(`Request aborted when fetching ${t.toString()}: ${e.message}`),n.stack=e.stack):e instanceof m||e instanceof h||(n=new f(`Error fetching from ${t.toString()}: ${e.message}`),n.stack=e.stack),n}async function E(e,t){let n=``,r;try{let t=await e.json();n=t.error.message,t.error.details&&(n+=` ${JSON.stringify(t.error.details)}`,r=t.error.details)}catch{}throw new m(`Error fetching from ${t.toString()}: [${e.status} ${e.statusText}] ${n}`,e.status,e.statusText,r)}function D(e){let t={};if(e?.signal!==void 0||e?.timeout>=0){let n=new AbortController;e?.timeout>=0&&setTimeout(()=>n.abort(),e.timeout),e?.signal&&e.signal.addEventListener(`abort`,()=>{n.abort()}),t.signal=n.signal}return t}function O(e){return e.text=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return k(e)}else if(e.promptFeedback)throw new p(`Text not available. ${M(e)}`,e);return``},e.functionCall=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return console.warn(`response.functionCall() is deprecated. Use response.functionCalls() instead.`),A(e)[0]}else if(e.promptFeedback)throw new p(`Function call not available. ${M(e)}`,e)},e.functionCalls=()=>{if(e.candidates&&e.candidates.length>0){if(e.candidates.length>1&&console.warn(`This response had ${e.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),j(e.candidates[0]))throw new p(`${M(e)}`,e);return A(e)}else if(e.promptFeedback)throw new p(`Function call not available. ${M(e)}`,e)},e}function k(e){let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.text&&t.push(n.text),n.executableCode&&t.push("\n```"+n.executableCode.language+`
|
|
2
|
+
`+n.executableCode.code+"\n```\n"),n.codeExecutionResult&&t.push("\n```\n"+n.codeExecutionResult.output+"\n```\n");return t.length>0?t.join(``):``}function A(e){let t=[];if(e.candidates?.[0].content?.parts)for(let n of e.candidates?.[0].content?.parts)n.functionCall&&t.push(n.functionCall);if(t.length>0)return t}var re=[c.RECITATION,c.SAFETY,c.LANGUAGE];function j(e){return!!e.finishReason&&re.includes(e.finishReason)}function M(e){let t=``;if((!e.candidates||e.candidates.length===0)&&e.promptFeedback)t+=`Response was blocked`,e.promptFeedback?.blockReason&&(t+=` due to ${e.promptFeedback.blockReason}`),e.promptFeedback?.blockReasonMessage&&(t+=`: ${e.promptFeedback.blockReasonMessage}`);else if(e.candidates?.[0]){let n=e.candidates[0];j(n)&&(t+=`Candidate was blocked due to ${n.finishReason}`,n.finishMessage&&(t+=`: ${n.finishMessage}`))}return t}function N(e){return this instanceof N?(this.v=e,this):new N(e)}function P(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof N?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}var F=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function I(e){let[t,n]=z(e.body.pipeThrough(new TextDecoderStream(`utf8`,{fatal:!0}))).tee();return{stream:R(t),response:L(n)}}async function L(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)return O(B(t));t.push(r)}}function R(e){return P(this,arguments,function*(){let t=e.getReader();for(;;){let{value:e,done:n}=yield N(t.read());if(n)break;yield yield N(O(e))}})}function z(e){let t=e.getReader();return new ReadableStream({start(e){let n=``;return r();function r(){return t.read().then(({value:t,done:i})=>{if(i){if(n.trim()){e.error(new f(`Failed to parse stream`));return}e.close();return}n+=t;let a=n.match(F),o;for(;a;){try{o=JSON.parse(a[1])}catch{e.error(new f(`Error parsing JSON response: "${a[1]}"`));return}e.enqueue(o),n=n.substring(a[0].length),a=n.match(F)}return r()}).catch(e=>{let t=e;throw t.stack=e.stack,t=t.name===`AbortError`?new g(`Request aborted when reading from the stream`):new f(`Error reading from the stream`),t})}}})}function B(e){let t={promptFeedback:e[e.length-1]?.promptFeedback};for(let n of e){if(n.candidates){let e=0;for(let r of n.candidates)if(t.candidates||=[],t.candidates[e]||(t.candidates[e]={index:e}),t.candidates[e].citationMetadata=r.citationMetadata,t.candidates[e].groundingMetadata=r.groundingMetadata,t.candidates[e].finishReason=r.finishReason,t.candidates[e].finishMessage=r.finishMessage,t.candidates[e].safetyRatings=r.safetyRatings,r.content&&r.content.parts){t.candidates[e].content||(t.candidates[e].content={role:r.content.role||`user`,parts:[]});let n={};for(let i of r.content.parts)i.text&&(n.text=i.text),i.functionCall&&(n.functionCall=i.functionCall),i.executableCode&&(n.executableCode=i.executableCode),i.codeExecutionResult&&(n.codeExecutionResult=i.codeExecutionResult),Object.keys(n).length===0&&(n.text=``),t.candidates[e].content.parts.push(n)}e++}n.usageMetadata&&(t.usageMetadata=n.usageMetadata)}return t}async function V(e,t,n,r){return I(await C(t,y.STREAM_GENERATE_CONTENT,e,!0,JSON.stringify(n),r))}async function H(e,t,n,r){return{response:O(await(await C(t,y.GENERATE_CONTENT,e,!1,JSON.stringify(n),r)).json())}}function U(e){if(e!=null){if(typeof e==`string`)return{role:`system`,parts:[{text:e}]};if(e.text)return{role:`system`,parts:[e]};if(e.parts)return e.role?e:{role:`system`,parts:e.parts}}}function W(e){let t=[];if(typeof e==`string`)t=[{text:e}];else for(let n of e)typeof n==`string`?t.push({text:n}):t.push(n);return G(t)}function G(e){let t={role:`user`,parts:[]},n={role:`function`,parts:[]},r=!1,i=!1;for(let a of e)`functionResponse`in a?(n.parts.push(a),i=!0):(t.parts.push(a),r=!0);if(r&&i)throw new f(`Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.`);if(!r&&!i)throw new f(`No content is provided for sending chat message.`);return r?t:n}function K(e,t){let n={model:t?.model,generationConfig:t?.generationConfig,safetySettings:t?.safetySettings,tools:t?.tools,toolConfig:t?.toolConfig,systemInstruction:t?.systemInstruction,cachedContent:t?.cachedContent?.name,contents:[]},r=e.generateContentRequest!=null;if(e.contents){if(r)throw new h(`CountTokensRequest must have one of contents or generateContentRequest, not both.`);n.contents=e.contents}else if(r)n=Object.assign(Object.assign({},n),e.generateContentRequest);else{let t=W(e);n.contents=[t]}return{generateContentRequest:n}}function q(e){let t;return t=e.contents?e:{contents:[W(e)]},e.systemInstruction&&(t.systemInstruction=U(e.systemInstruction)),t}function J(e){return typeof e==`string`||Array.isArray(e)?{content:W(e)}:e}var Y=[`text`,`inlineData`,`functionCall`,`functionResponse`,`executableCode`,`codeExecutionResult`],ie={user:[`text`,`inlineData`],function:[`functionResponse`],model:[`text`,`functionCall`,`executableCode`,`codeExecutionResult`],system:[`text`]};function ae(e){let t=!1;for(let n of e){let{role:e,parts:i}=n;if(!t&&e!==`user`)throw new f(`First content should be with role 'user', got ${e}`);if(!r.includes(e))throw new f(`Each item should include role field. Got ${e} but valid roles are: ${JSON.stringify(r)}`);if(!Array.isArray(i))throw new f(`Content should have 'parts' property with an array of Parts`);if(i.length===0)throw new f(`Each Content should have at least one part`);let a={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(let e of i)for(let t of Y)t in e&&(a[t]+=1);let o=ie[e];for(let t of Y)if(!o.includes(t)&&a[t]>0)throw new f(`Content with role '${e}' can't contain '${t}' part`);t=!0}}function X(e){if(e.candidates===void 0||e.candidates.length===0)return!1;let t=e.candidates[0]?.content;if(t===void 0||t.parts===void 0||t.parts.length===0)return!1;for(let e of t.parts)if(e===void 0||Object.keys(e).length===0||e.text!==void 0&&e.text===``)return!1;return!0}var Z=`SILENT_ERROR`,Q=class{constructor(e,t,n,r={}){this.model=t,this.params=n,this._requestOptions=r,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,n?.history&&(ae(n.history),this._history=n.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,t={}){await this._sendPromise;let n=W(e),r={safetySettings:this.params?.safetySettings,generationConfig:this.params?.generationConfig,tools:this.params?.tools,toolConfig:this.params?.toolConfig,systemInstruction:this.params?.systemInstruction,cachedContent:this.params?.cachedContent,contents:[...this._history,n]},i=Object.assign(Object.assign({},this._requestOptions),t),a;return this._sendPromise=this._sendPromise.then(()=>H(this._apiKey,this.model,r,i)).then(e=>{if(X(e.response)){this._history.push(n);let t=Object.assign({parts:[],role:`model`},e.response.candidates?.[0].content);this._history.push(t)}else{let t=M(e.response);t&&console.warn(`sendMessage() was unsuccessful. ${t}. Inspect response object for details.`)}a=e}).catch(e=>{throw this._sendPromise=Promise.resolve(),e}),await this._sendPromise,a}async sendMessageStream(e,t={}){await this._sendPromise;let n=W(e),r={safetySettings:this.params?.safetySettings,generationConfig:this.params?.generationConfig,tools:this.params?.tools,toolConfig:this.params?.toolConfig,systemInstruction:this.params?.systemInstruction,cachedContent:this.params?.cachedContent,contents:[...this._history,n]},i=Object.assign(Object.assign({},this._requestOptions),t),a=V(this._apiKey,this.model,r,i);return this._sendPromise=this._sendPromise.then(()=>a).catch(e=>{throw Error(Z)}).then(e=>e.response).then(e=>{if(X(e)){this._history.push(n);let t=Object.assign({},e.candidates[0].content);t.role||=`model`,this._history.push(t)}else{let t=M(e);t&&console.warn(`sendMessageStream() was unsuccessful. ${t}. Inspect response object for details.`)}}).catch(e=>{e.message!==Z&&console.error(e)}),a}};async function oe(e,t,n,r){return(await C(t,y.COUNT_TOKENS,e,!1,JSON.stringify(n),r)).json()}async function se(e,t,n,r){return(await C(t,y.EMBED_CONTENT,e,!1,JSON.stringify(n),r)).json()}async function ce(e,t,n,r){let i=n.requests.map(e=>Object.assign(Object.assign({},e),{model:t}));return(await C(t,y.BATCH_EMBED_CONTENTS,e,!1,JSON.stringify({requests:i}),r)).json()}var $=class{constructor(e,t,n={}){this.apiKey=e,this._requestOptions=n,t.model.includes(`/`)?this.model=t.model:this.model=`models/${t.model}`,this.generationConfig=t.generationConfig||{},this.safetySettings=t.safetySettings||[],this.tools=t.tools,this.toolConfig=t.toolConfig,this.systemInstruction=U(t.systemInstruction),this.cachedContent=t.cachedContent}async generateContent(e,t={}){let n=q(e),r=Object.assign(Object.assign({},this._requestOptions),t);return H(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},n),r)}async generateContentStream(e,t={}){let n=q(e),r=Object.assign(Object.assign({},this._requestOptions),t);return V(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},n),r)}startChat(e){return new Q(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent?.name},e),this._requestOptions)}async countTokens(e,t={}){let n=K(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),r=Object.assign(Object.assign({},this._requestOptions),t);return oe(this.apiKey,this.model,n,r)}async embedContent(e,t={}){let n=J(e),r=Object.assign(Object.assign({},this._requestOptions),t);return se(this.apiKey,this.model,n,r)}async batchEmbedContents(e,t={}){let n=Object.assign(Object.assign({},this._requestOptions),t);return ce(this.apiKey,this.model,e,n)}},le=class{constructor(e){this.apiKey=e}getGenerativeModel(e,t){if(!e.model)throw new f(`Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })`);return new $(this.apiKey,e,t)}getGenerativeModelFromCachedContent(e,t,n){if(!e.name)throw new h("Cached content must contain a `name` field.");if(!e.model)throw new h("Cached content must contain a `model` field.");for(let n of[`model`,`systemInstruction`])if(t?.[n]&&e[n]&&t?.[n]!==e[n]){if(n===`model`&&(t.model.startsWith(`models/`)?t.model.replace(`models/`,``):t.model)===(e.model.startsWith(`models/`)?e.model.replace(`models/`,``):e.model))continue;throw new h(`Different value for "${n}" specified in modelParams (${t[n]}) and cachedContent (${e[n]})`)}let r=Object.assign(Object.assign({},t),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new $(this.apiKey,r,n)}};Object.defineProperty(exports,`BlockReason`,{enumerable:!0,get:function(){return s}}),exports.ChatSession=Q,Object.defineProperty(exports,`DynamicRetrievalMode`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`ExecutableCodeLanguage`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`FinishReason`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`FunctionCallingMode`,{enumerable:!0,get:function(){return u}}),exports.GenerativeModel=$,exports.GoogleGenerativeAI=le,exports.GoogleGenerativeAIAbortError=g,exports.GoogleGenerativeAIError=f,exports.GoogleGenerativeAIFetchError=m,exports.GoogleGenerativeAIRequestInputError=h,exports.GoogleGenerativeAIResponseError=p,Object.defineProperty(exports,`HarmBlockThreshold`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`HarmCategory`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`HarmProbability`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`Outcome`,{enumerable:!0,get:function(){return n}}),exports.POSSIBLE_ROLES=r,Object.defineProperty(exports,`SchemaType`,{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,`TaskType`,{enumerable:!0,get:function(){return l}});
|