drizzle-cube 0.4.28 → 0.4.30
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.js +232 -342
- package/dist/adapters/fastify/index.cjs +2 -10
- 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-B8vuFQYP.cjs +25 -0
- package/dist/adapters/handler-D-2-6uLM.js +2951 -0
- package/dist/adapters/hono/index.cjs +2 -10
- 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-CuugoG8t.js +7821 -0
- package/dist/adapters/mcp-transport-Dpp6hdZe.cjs +253 -0
- package/dist/adapters/nextjs/index.cjs +1 -9
- package/dist/adapters/nextjs/index.js +377 -600
- package/dist/adapters/openai-CjBvA6mK.js +4114 -0
- package/dist/adapters/openai-DhLE0A9Z.cjs +1 -0
- package/dist/adapters/openai-Zjw4Zo4R.js +153 -0
- package/dist/adapters/openai-eJBw3LfQ.cjs +16 -0
- package/dist/adapters/types.cjs +0 -1
- package/dist/adapters/types.js +0 -1
- package/dist/adapters/utils-ChhNGUOF.js +5396 -0
- package/dist/adapters/utils-CwJplXR5.cjs +15 -0
- package/dist/adapters/utils.cjs +1 -19
- package/dist/adapters/utils.js +2 -21333
- package/dist/client/charts.js +15 -186
- package/dist/client/chunks/DashboardEditModal-C076pscL.js +6678 -0
- package/dist/client/chunks/DashboardEditModal-C076pscL.js.map +1 -0
- package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js +2631 -0
- package/dist/client/chunks/FieldSearchModal-C0DjSWk3.js.map +1 -0
- package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.js +270 -0
- package/dist/client/chunks/RetentionCombinedChart-DuGXc-AP.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-DF0XntqC.js +6111 -0
- package/dist/client/chunks/analysis-builder-DF0XntqC.js.map +1 -0
- package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js +3114 -0
- package/dist/client/chunks/analysis-builder-shared-2QhKYbs6.js.map +1 -0
- package/dist/client/chunks/chart-activity-grid-CNES9VBk.js +803 -0
- package/dist/client/chunks/chart-activity-grid-CNES9VBk.js.map +1 -0
- package/dist/client/chunks/chart-area-CRJc3KOu.js +449 -0
- package/dist/client/chunks/chart-area-CRJc3KOu.js.map +1 -0
- package/dist/client/chunks/chart-bar-DD2PjJ5n.js +270 -0
- package/dist/client/chunks/chart-bar-DD2PjJ5n.js.map +1 -0
- package/dist/client/chunks/chart-box-plot-BcqleldJ.js +377 -0
- package/dist/client/chunks/chart-box-plot-BcqleldJ.js.map +1 -0
- package/dist/client/chunks/chart-bubble-BmQkVk4K.js +273 -0
- package/dist/client/chunks/chart-bubble-BmQkVk4K.js.map +1 -0
- package/dist/client/chunks/chart-candlestick-C3Rep469.js +306 -0
- package/dist/client/chunks/chart-candlestick-C3Rep469.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-DehW1C1G.js +4088 -0
- package/dist/client/chunks/chart-data-table-DehW1C1G.js.map +1 -0
- package/dist/client/chunks/chart-funnel-BjkpnG5g.js +447 -0
- package/dist/client/chunks/chart-funnel-BjkpnG5g.js.map +1 -0
- package/dist/client/chunks/chart-gauge-BWW_HEfg.js +424 -0
- package/dist/client/chunks/chart-gauge-BWW_HEfg.js.map +1 -0
- package/dist/client/chunks/chart-heat-map-BWuOuDcm.js +236 -0
- package/dist/client/chunks/chart-heat-map-BWuOuDcm.js.map +1 -0
- package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js +343 -0
- package/dist/client/chunks/chart-kpi-delta-D5OHtDJx.js.map +1 -0
- package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js +326 -0
- package/dist/client/chunks/chart-kpi-number-C9zH-aKC.js.map +1 -0
- package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js +149 -0
- package/dist/client/chunks/chart-kpi-text-ChVn3S7j.js.map +1 -0
- package/dist/client/chunks/chart-line-DOIMkP0b.js +431 -0
- package/dist/client/chunks/chart-line-DOIMkP0b.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-C6wrr9il.js +179 -0
- package/dist/client/chunks/chart-measure-profile-C6wrr9il.js.map +1 -0
- package/dist/client/chunks/chart-pie-BU_FgwDc.js +172 -0
- package/dist/client/chunks/chart-pie-BU_FgwDc.js.map +1 -0
- package/dist/client/chunks/chart-radar-DlufwnAX.js +154 -0
- package/dist/client/chunks/chart-radar-DlufwnAX.js.map +1 -0
- package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js +148 -0
- package/dist/client/chunks/chart-radial-bar-B5vS_Aw5.js.map +1 -0
- package/dist/client/chunks/chart-sankey-FChb26UX.js +222 -0
- package/dist/client/chunks/chart-sankey-FChb26UX.js.map +1 -0
- package/dist/client/chunks/chart-scatter-DW0cAZ2H.js +255 -0
- package/dist/client/chunks/chart-scatter-DW0cAZ2H.js.map +1 -0
- package/dist/client/chunks/chart-sunburst-Clf-6WxW.js +221 -0
- package/dist/client/chunks/chart-sunburst-Clf-6WxW.js.map +1 -0
- package/dist/client/chunks/chart-tree-map-p_VwUJPF.js +298 -0
- package/dist/client/chunks/chart-tree-map-p_VwUJPF.js.map +1 -0
- package/dist/client/chunks/chart-waterfall-jt44IQ-w.js +237 -0
- package/dist/client/chunks/chart-waterfall-jt44IQ-w.js.map +1 -0
- package/dist/client/chunks/charts-core-CUVzf4cV.js +215 -0
- package/dist/client/chunks/charts-core-CUVzf4cV.js.map +1 -0
- package/dist/client/chunks/charts-loader-AGpph8_I.js +259 -0
- package/dist/client/chunks/charts-loader-AGpph8_I.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-ZugB4Io9.js +1073 -0
- package/dist/client/chunks/schema-visualization-ZugB4Io9.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-BQjNWndQ.js +1394 -0
- package/dist/client/chunks/useDebounce-BQjNWndQ.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-c_bHxZe5.js +203 -0
- package/dist/client/chunks/useExplainAI-c_bHxZe5.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-A54Ny29G.js +128 -0
- package/dist/client/chunks/utils-A54Ny29G.js.map +1 -0
- package/dist/client/chunks/vendor-CoPBRumI.js +828 -0
- package/dist/client/chunks/vendor-CoPBRumI.js.map +1 -0
- 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 +109 -127
- package/dist/server/index.d.ts +13 -4
- package/dist/server/index.js +15089 -34349
- package/dist/server/openai-BPhmb8mi.js +4114 -0
- package/dist/server/openai-CLsoLaue.cjs +1 -0
- package/dist/server/openai-D1kZ5sdM.js +153 -0
- package/dist/server/openai-DkOKbVLC.cjs +16 -0
- package/package.json +5 -5
- 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-BV2_dul8.js +0 -2713
- package/dist/adapters/handler-LMRPeTNJ.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-B6ZudTSk.js +0 -11010
- package/dist/adapters/mcp-transport-DCiSGtp1.cjs +0 -257
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/client/hooks.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sources":["../../src/client/hooks/useNotebookLayout.ts"],"sourcesContent":["/**\n * Container-width-based layout mode hook for AgenticNotebook.\n * Uses ResizeObserver + RefCallback + window resize fallback\n * following the useResponsiveDashboard pattern.\n */\n\nimport { useState, useEffect, useRef, useCallback, type RefCallback } from 'react'\n\nexport type NotebookLayoutMode = 'wide' | 'narrow'\n\nconst NARROW_THRESHOLD = 768\n\nexport interface UseNotebookLayoutResult {\n containerRef: RefCallback<HTMLDivElement>\n layoutMode: NotebookLayoutMode\n containerWidth: number\n}\n\nexport function useNotebookLayout(): UseNotebookLayoutResult {\n const [containerWidth, setContainerWidth] = useState(() =>\n typeof window !== 'undefined' ? window.innerWidth : NARROW_THRESHOLD + 1\n )\n const observerRef = useRef<ResizeObserver | null>(null)\n const elementRef = useRef<HTMLDivElement | null>(null)\n\n const containerRef = useCallback((node: HTMLDivElement | null) => {\n if (observerRef.current) {\n observerRef.current.disconnect()\n observerRef.current = null\n }\n\n elementRef.current = node\n\n if (node) {\n const initialWidth = node.offsetWidth\n if (initialWidth > 0) {\n setContainerWidth(initialWidth)\n }\n\n observerRef.current = new ResizeObserver((entries) => {\n const width = entries[0]?.contentRect.width\n if (width && width > 0) {\n setContainerWidth(width)\n }\n })\n observerRef.current.observe(node)\n }\n }, [])\n\n useEffect(() => {\n return () => {\n if (observerRef.current) {\n observerRef.current.disconnect()\n }\n }\n }, [])\n\n useEffect(() => {\n const handleWindowResize = () => {\n if (elementRef.current) {\n const width = elementRef.current.offsetWidth\n if (width > 0) {\n setContainerWidth(width)\n }\n }\n }\n\n window.addEventListener('resize', handleWindowResize)\n const timeoutId = setTimeout(handleWindowResize, 100)\n\n return () => {\n window.removeEventListener('resize', handleWindowResize)\n clearTimeout(timeoutId)\n }\n }, [])\n\n const layoutMode: NotebookLayoutMode = containerWidth >= NARROW_THRESHOLD ? 'wide' : 'narrow'\n\n return { containerRef, layoutMode, containerWidth }\n}\n"],"names":["NARROW_THRESHOLD","useNotebookLayout","containerWidth","setContainerWidth","useState","observerRef","useRef","elementRef","containerRef","useCallback","node","initialWidth","entries","width","useEffect","handleWindowResize","timeoutId","layoutMode"],"mappings":";;;;AAUA,MAAMA,IAAmB;AAQlB,SAASC,IAA6C;AAC3D,QAAM,CAACC,GAAgBC,CAAiB,IAAIC;AAAA,IAAS,MACnD,OAAO,SAAW,MAAc,OAAO,aAAaJ,IAAmB;AAAA,EAAA,GAEnEK,IAAcC,EAA8B,IAAI,GAChDC,IAAaD,EAA8B,IAAI,GAE/CE,IAAeC,EAAY,CAACC,MAAgC;AAQhE,QAPIL,EAAY,YACdA,EAAY,QAAQ,WAAA,GACpBA,EAAY,UAAU,OAGxBE,EAAW,UAAUG,GAEjBA,GAAM;AACR,YAAMC,IAAeD,EAAK;AAC1B,MAAIC,IAAe,KACjBR,EAAkBQ,CAAY,GAGhCN,EAAY,UAAU,IAAI,eAAe,CAACO,MAAY;AACpD,cAAMC,IAAQD,EAAQ,CAAC,GAAG,YAAY;AACtC,QAAIC,KAASA,IAAQ,KACnBV,EAAkBU,CAAK;AAAA,MAE3B,CAAC,GACDR,EAAY,QAAQ,QAAQK,CAAI;AAAA,IAClC;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,EAAAI,EAAU,MACD,MAAM;AACX,IAAIT,EAAY,WACdA,EAAY,QAAQ,WAAA;AAAA,EAExB,GACC,CAAA,CAAE,GAELS,EAAU,MAAM;AACd,UAAMC,IAAqB,MAAM;AAC/B,UAAIR,EAAW,SAAS;AACtB,cAAMM,IAAQN,EAAW,QAAQ;AACjC,QAAIM,IAAQ,KACVV,EAAkBU,CAAK;AAAA,MAE3B;AAAA,IACF;AAEA,WAAO,iBAAiB,UAAUE,CAAkB;AACpD,UAAMC,IAAY,WAAWD,GAAoB,GAAG;AAEpD,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAUA,CAAkB,GACvD,aAAaC,CAAS;AAAA,IACxB;AAAA,EACF,GAAG,CAAA,CAAE;AAEL,QAAMC,IAAiCf,KAAkBF,IAAmB,SAAS;AAErF,SAAO,EAAE,cAAAQ,GAAc,YAAAS,GAAY,gBAAAf,EAAA;AACrC;"}
|
package/dist/client/icons.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"providers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/client/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/client/utils/measureIcons.tsx"],"sourcesContent":["import React from 'react'\nimport { getMeasureTypeIcon } from '../icons'\n\n/**\n * Get the appropriate icon component for a given measure type\n * All icons use amber coloring for consistency\n */\nexport function getMeasureIcon(\n measureType: string | undefined,\n className: string = 'w-4 h-4'\n): React.ReactElement {\n const IconComponent = getMeasureTypeIcon(measureType)\n return <IconComponent className={className} />\n}\n\n/**\n * Get all available measure type icons\n * Useful for documentation or UI that shows all measure types\n */\nexport function getAllMeasureIcons(): Record<string, React.ReactElement> {\n const types = ['count', 'countDistinct', 'countDistinctApprox', 'sum', 'avg', 'min', 'max', 'runningTotal', 'calculated', 'number']\n const icons: Record<string, React.ReactElement> = {}\n\n for (const type of types) {\n const IconComponent = getMeasureTypeIcon(type)\n icons[type] = <IconComponent className=\"dc:w-4 dc:h-4\" />\n }\n\n return icons\n}\n"],"names":["getMeasureIcon","measureType","className","IconComponent","getMeasureTypeIcon","jsx","getAllMeasureIcons","types","icons","type"],"mappings":";;;;;;;;;AAOO,SAASA,EACdC,GACAC,IAAoB,WACA;AACpB,QAAMC,IAAgBC,EAAmBH,CAAW;AACpD,SAAO,gBAAAI,EAACF,KAAc,WAAAD,GAAsB;AAC9C;AAMO,SAASI,IAAyD;AACvE,QAAMC,IAAQ,CAAC,SAAS,iBAAiB,uBAAuB,OAAO,OAAO,OAAO,OAAO,gBAAgB,cAAc,QAAQ,GAC5HC,IAA4C,CAAA;AAElD,aAAWC,KAAQF,GAAO;AACxB,UAAMJ,IAAgBC,EAAmBK,CAAI;AAC7C,IAAAD,EAAMC,CAAI,IAAI,gBAAAJ,EAACF,GAAA,EAAc,WAAU,iBAAgB;AAAA,EACzD;AAEA,SAAOK;AACT;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var l=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var y=(o,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of u(e))!d.call(o,t)&&t!==r&&i(o,t,{get:()=>e[t],enumerable:!(s=c(e,t))||s.enumerable});return o};var m=(o,e,r)=>(r=o!=null?l(p(o)):{},y(e||!o||!o.__esModule?i(r,"default",{value:o,enumerable:!0}):r,o));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class _{client;constructor(e){this.apiKey=e}apiKey;initialized=!1;async ensureClient(){if(this.initialized)return;let e;try{const r=await import("@anthropic-ai/sdk");e=r.default||r.Anthropic||r}catch{throw new 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();const{messages:r,system:s}=this.formatMessages(e.messages,e.system);return this.client.messages.create({model:e.model,max_tokens:e.maxTokens,system:s,tools:this.formatTools(e.tools),messages:r,stream:!0})}async*parseStreamEvents(e){for await(const r of e){const s=r;switch(s.type){case"content_block_start":{const t=s.content_block;t.type==="tool_use"&&(yield{type:"tool_use_start",id:t.id,name:t.name});break}case"content_block_delta":{const t=s.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":{const t=s.message;t?.usage?.input_tokens!=null&&(yield{type:"message_meta",inputTokens:t.usage.input_tokens,stopReason:""});break}case"message_delta":{const t=s.usage,a=s.delta?.stop_reason||"";yield{type:"message_meta",outputTokens:t?.output_tokens,stopReason:a};break}}}}formatTools(e){return e.map(r=>({name:r.name,description:r.description,input_schema:r.parameters}))}formatMessages(e,r){return{messages:e.map(t=>t.role==="tool_result"?{role:"user",content:t.content}:{role:t.role,content:t.content}),system:r}}formatToolResults(e){return{role:"user",content:e.map(r=>({type:"tool_result",tool_use_id:r.toolUseId,content:r.content,...r.isError?{is_error:!0}:{}}))}}shouldContinue(e){return e==="tool_use"}formatError(e){if(!e||!(e instanceof Error))return"Something went wrong. Please try again.";const r=e.message||"",s={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."},t=e;if(t.status||t.type){const a=t.error?.type||t.type||"";if(s[a])return s[a]}if(r.startsWith("{")||r.startsWith("Error: {")){try{const a=JSON.parse(r.replace(/^Error:\s*/,"")),n=a.error?.type||a.type||"";if(s[n])return s[n]}catch{}return"The AI service encountered an error. Please try again."}return r}}exports.AnthropicProvider=_;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
class i {
|
|
2
|
-
client;
|
|
3
|
-
constructor(e) {
|
|
4
|
-
this.apiKey = e;
|
|
5
|
-
}
|
|
6
|
-
apiKey;
|
|
7
|
-
initialized = !1;
|
|
8
|
-
async ensureClient() {
|
|
9
|
-
if (this.initialized) return;
|
|
10
|
-
let e;
|
|
11
|
-
try {
|
|
12
|
-
const r = await import(
|
|
13
|
-
/* webpackIgnore: true */
|
|
14
|
-
"@anthropic-ai/sdk"
|
|
15
|
-
);
|
|
16
|
-
e = r.default || r.Anthropic || r;
|
|
17
|
-
} catch {
|
|
18
|
-
throw new Error("@anthropic-ai/sdk is required for the Anthropic provider. Install it with: npm install @anthropic-ai/sdk");
|
|
19
|
-
}
|
|
20
|
-
this.client = new e({ apiKey: this.apiKey }), this.initialized = !0;
|
|
21
|
-
}
|
|
22
|
-
async createStream(e) {
|
|
23
|
-
await this.ensureClient();
|
|
24
|
-
const { messages: r, system: s } = this.formatMessages(e.messages, e.system);
|
|
25
|
-
return this.client.messages.create({
|
|
26
|
-
model: e.model,
|
|
27
|
-
max_tokens: e.maxTokens,
|
|
28
|
-
system: s,
|
|
29
|
-
tools: this.formatTools(e.tools),
|
|
30
|
-
messages: r,
|
|
31
|
-
stream: !0
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
async *parseStreamEvents(e) {
|
|
35
|
-
for await (const r of e) {
|
|
36
|
-
const s = r;
|
|
37
|
-
switch (s.type) {
|
|
38
|
-
case "content_block_start": {
|
|
39
|
-
const t = s.content_block;
|
|
40
|
-
t.type === "tool_use" && (yield { type: "tool_use_start", id: t.id, name: t.name });
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
case "content_block_delta": {
|
|
44
|
-
const t = s.delta;
|
|
45
|
-
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 });
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
case "content_block_stop": {
|
|
49
|
-
yield { type: "tool_use_end" };
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case "message_start": {
|
|
53
|
-
const t = s.message;
|
|
54
|
-
t?.usage?.input_tokens != null && (yield {
|
|
55
|
-
type: "message_meta",
|
|
56
|
-
inputTokens: t.usage.input_tokens,
|
|
57
|
-
stopReason: ""
|
|
58
|
-
});
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
case "message_delta": {
|
|
62
|
-
const t = s.usage, o = s.delta?.stop_reason || "";
|
|
63
|
-
yield {
|
|
64
|
-
type: "message_meta",
|
|
65
|
-
outputTokens: t?.output_tokens,
|
|
66
|
-
stopReason: o
|
|
67
|
-
};
|
|
68
|
-
break;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
formatTools(e) {
|
|
74
|
-
return e.map((r) => ({
|
|
75
|
-
name: r.name,
|
|
76
|
-
description: r.description,
|
|
77
|
-
input_schema: r.parameters
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
formatMessages(e, r) {
|
|
81
|
-
return { messages: e.map((t) => t.role === "tool_result" ? { role: "user", content: t.content } : { role: t.role, content: t.content }), system: r };
|
|
82
|
-
}
|
|
83
|
-
formatToolResults(e) {
|
|
84
|
-
return {
|
|
85
|
-
role: "user",
|
|
86
|
-
content: e.map((r) => ({
|
|
87
|
-
type: "tool_result",
|
|
88
|
-
tool_use_id: r.toolUseId,
|
|
89
|
-
content: r.content,
|
|
90
|
-
...r.isError ? { is_error: !0 } : {}
|
|
91
|
-
}))
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
shouldContinue(e) {
|
|
95
|
-
return e === "tool_use";
|
|
96
|
-
}
|
|
97
|
-
formatError(e) {
|
|
98
|
-
if (!e || !(e instanceof Error))
|
|
99
|
-
return "Something went wrong. Please try again.";
|
|
100
|
-
const r = e.message || "", s = {
|
|
101
|
-
overloaded_error: "The AI service is temporarily overloaded. Please try again in a moment.",
|
|
102
|
-
rate_limit_error: "Too many requests. Please wait a moment and try again.",
|
|
103
|
-
api_error: "The AI service encountered an error. Please try again.",
|
|
104
|
-
authentication_error: "Authentication failed. Please check your API key configuration.",
|
|
105
|
-
invalid_request_error: "There was a problem with the request. Please try again."
|
|
106
|
-
}, t = e;
|
|
107
|
-
if (t.status || t.type) {
|
|
108
|
-
const o = t.error?.type || t.type || "";
|
|
109
|
-
if (s[o])
|
|
110
|
-
return s[o];
|
|
111
|
-
}
|
|
112
|
-
if (r.startsWith("{") || r.startsWith("Error: {")) {
|
|
113
|
-
try {
|
|
114
|
-
const o = JSON.parse(r.replace(/^Error:\s*/, "")), a = o.error?.type || o.type || "";
|
|
115
|
-
if (s[a])
|
|
116
|
-
return s[a];
|
|
117
|
-
} catch {
|
|
118
|
-
}
|
|
119
|
-
return "The AI service encountered an error. Please try again.";
|
|
120
|
-
}
|
|
121
|
-
return r;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
export {
|
|
125
|
-
i as AnthropicProvider
|
|
126
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function l(u){const e={};for(const[t,s]of Object.entries(u))if(t==="type"&&typeof s=="string")e[t]=s.toUpperCase();else if(t==="properties"&&typeof s=="object"&&s!==null){const n={};for(const[a,o]of Object.entries(s))typeof o=="object"&&o!==null?n[a]=l(o):n[a]=o;e[t]=n}else t==="items"&&typeof s=="object"&&s!==null?e[t]=l(s):e[t]=s;return e}class p{apiKey;sdk;initialized=!1;constructor(e){this.apiKey=e}async ensureSDK(){if(!this.initialized){try{this.sdk=await Promise.resolve().then(()=>require("./index-BgCeQBuN.cjs"))}catch{throw new Error("@google/generative-ai is required for the Google provider. Install it with: npm install @google/generative-ai")}this.initialized=!0}}async createStream(e){await this.ensureSDK();const{GoogleGenerativeAI:t}=this.sdk,n=new t(this.apiKey).getGenerativeModel({model:e.model,systemInstruction:e.system,generationConfig:{maxOutputTokens:e.maxTokens}}),{messages:a}=this.formatMessages(e.messages,e.system),o=this.formatTools(e.tools);return(await n.generateContentStream({contents:a,tools:o.length>0?[{functionDeclarations:o}]:void 0})).stream}async*parseStreamEvents(e){let t="stop",s=!1;for await(const n of e){const a=n;a.usageMetadata&&(yield{type:"message_meta",inputTokens:a.usageMetadata.promptTokenCount,outputTokens:a.usageMetadata.candidatesTokenCount,stopReason:""});const o=a.candidates?.[0];if(!o)continue;o.finishReason&&(o.finishReason==="STOP"?t="stop":o.finishReason==="MAX_TOKENS"?t="max_tokens":t=o.finishReason);const i=o.content?.parts;if(i){for(const r of i)if(r.text&&!r.thought&&(yield{type:"text_delta",text:r.text}),r.functionCall){s=!0;const f=`gemini-tc-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,c=r.thoughtSignature?{thoughtSignature:r.thoughtSignature}:void 0;yield{type:"tool_use_start",id:f,name:r.functionCall.name,...c?{metadata:c}:{}},yield{type:"tool_input_delta",json:JSON.stringify(r.functionCall.args||{})},yield{type:"tool_use_end"}}}}yield{type:"message_meta",stopReason:s?"tool_use":t}}formatTools(e){return e.map(t=>({name:t.name,description:t.description,parameters:l(t.parameters)}))}formatMessages(e,t){const s=[];for(const n of e)if(n.role==="tool_result"){const a=n._toolResults;if(a&&a.length>0)s.push({role:"user",parts:a.map(o=>({functionResponse:{name:o.toolName||o.toolUseId,response:{content:o.content,isError:o.isError||!1}}}))});else{const o=typeof n.content=="string"?n.content:JSON.stringify(n.content);o&&s.push({role:"user",parts:[{text:o}]})}}else if(n.role==="user"){const a=typeof n.content=="string"?n.content:JSON.stringify(n.content);s.push({role:"user",parts:[{text:a}]})}else if(n.role==="assistant")if(typeof n.content=="string")s.push({role:"model",parts:[{text:n.content}]});else{const a=n.content,o=[];for(const i of a)if(i.type==="text"&&i.text)o.push({text:i.text});else if(i.type==="tool_use"){const r={functionCall:{name:i.name,args:i.input||{}}};i.metadata?.thoughtSignature&&(r.thoughtSignature=i.metadata.thoughtSignature),o.push(r)}o.length>0&&s.push({role:"model",parts:o})}return{messages:s}}formatToolResults(e){return{role:"tool_result",content:e.map(t=>`${t.toolName||t.toolUseId}: ${t.content}`).join(`
|
|
2
|
-
`),_toolResults:e}}shouldContinue(e){return e==="tool_use"}formatError(e){if(!e||!(e instanceof Error))return"Something went wrong. Please try again.";const t=e.message||"",s=e;return s.status===429?"Too many requests. Please wait a moment and try again.":s.status===403||s.status===401?"Authentication failed. Please check your API key configuration.":s.status===503||s.status===500?"The AI service is temporarily unavailable. Please try again in a moment.":t.includes("SAFETY")?"The request was blocked by safety filters. Please rephrase your request.":t.includes("RECITATION")?"The response was blocked due to recitation concerns. Please try a different query.":t.startsWith("{")||t.startsWith("[")?"The AI service encountered an error. Please try again.":t}}exports.GoogleProvider=p;
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
function l(u) {
|
|
2
|
-
const t = {};
|
|
3
|
-
for (const [e, s] of Object.entries(u))
|
|
4
|
-
if (e === "type" && typeof s == "string")
|
|
5
|
-
t[e] = s.toUpperCase();
|
|
6
|
-
else if (e === "properties" && typeof s == "object" && s !== null) {
|
|
7
|
-
const n = {};
|
|
8
|
-
for (const [a, o] of Object.entries(s))
|
|
9
|
-
typeof o == "object" && o !== null ? n[a] = l(o) : n[a] = o;
|
|
10
|
-
t[e] = n;
|
|
11
|
-
} else e === "items" && typeof s == "object" && s !== null ? t[e] = l(s) : t[e] = s;
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
class p {
|
|
15
|
-
apiKey;
|
|
16
|
-
sdk;
|
|
17
|
-
initialized = !1;
|
|
18
|
-
constructor(t) {
|
|
19
|
-
this.apiKey = t;
|
|
20
|
-
}
|
|
21
|
-
async ensureSDK() {
|
|
22
|
-
if (!this.initialized) {
|
|
23
|
-
try {
|
|
24
|
-
this.sdk = await import(
|
|
25
|
-
/* webpackIgnore: true */
|
|
26
|
-
"./index-C45_meK_.js"
|
|
27
|
-
);
|
|
28
|
-
} catch {
|
|
29
|
-
throw new Error("@google/generative-ai is required for the Google provider. Install it with: npm install @google/generative-ai");
|
|
30
|
-
}
|
|
31
|
-
this.initialized = !0;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
async createStream(t) {
|
|
35
|
-
await this.ensureSDK();
|
|
36
|
-
const { GoogleGenerativeAI: e } = this.sdk, n = new e(this.apiKey).getGenerativeModel({
|
|
37
|
-
model: t.model,
|
|
38
|
-
systemInstruction: t.system,
|
|
39
|
-
generationConfig: {
|
|
40
|
-
maxOutputTokens: t.maxTokens
|
|
41
|
-
}
|
|
42
|
-
}), { messages: a } = this.formatMessages(t.messages, t.system), o = this.formatTools(t.tools);
|
|
43
|
-
return (await n.generateContentStream({
|
|
44
|
-
contents: a,
|
|
45
|
-
tools: o.length > 0 ? [{ functionDeclarations: o }] : void 0
|
|
46
|
-
})).stream;
|
|
47
|
-
}
|
|
48
|
-
async *parseStreamEvents(t) {
|
|
49
|
-
let e = "stop", s = !1;
|
|
50
|
-
for await (const n of t) {
|
|
51
|
-
const a = n;
|
|
52
|
-
a.usageMetadata && (yield {
|
|
53
|
-
type: "message_meta",
|
|
54
|
-
inputTokens: a.usageMetadata.promptTokenCount,
|
|
55
|
-
outputTokens: a.usageMetadata.candidatesTokenCount,
|
|
56
|
-
stopReason: ""
|
|
57
|
-
});
|
|
58
|
-
const o = a.candidates?.[0];
|
|
59
|
-
if (!o) continue;
|
|
60
|
-
o.finishReason && (o.finishReason === "STOP" ? e = "stop" : o.finishReason === "MAX_TOKENS" ? e = "max_tokens" : e = o.finishReason);
|
|
61
|
-
const i = o.content?.parts;
|
|
62
|
-
if (i) {
|
|
63
|
-
for (const r of i)
|
|
64
|
-
if (r.text && !r.thought && (yield { type: "text_delta", text: r.text }), r.functionCall) {
|
|
65
|
-
s = !0;
|
|
66
|
-
const f = `gemini-tc-${Date.now()}-${Math.random().toString(36).slice(2, 7)}`, c = r.thoughtSignature ? { thoughtSignature: r.thoughtSignature } : void 0;
|
|
67
|
-
yield { type: "tool_use_start", id: f, name: r.functionCall.name, ...c ? { metadata: c } : {} }, yield { type: "tool_input_delta", json: JSON.stringify(r.functionCall.args || {}) }, yield { type: "tool_use_end" };
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
yield {
|
|
72
|
-
type: "message_meta",
|
|
73
|
-
stopReason: s ? "tool_use" : e
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
formatTools(t) {
|
|
77
|
-
return t.map((e) => ({
|
|
78
|
-
name: e.name,
|
|
79
|
-
description: e.description,
|
|
80
|
-
parameters: l(e.parameters)
|
|
81
|
-
}));
|
|
82
|
-
}
|
|
83
|
-
formatMessages(t, e) {
|
|
84
|
-
const s = [];
|
|
85
|
-
for (const n of t)
|
|
86
|
-
if (n.role === "tool_result") {
|
|
87
|
-
const a = n._toolResults;
|
|
88
|
-
if (a && a.length > 0)
|
|
89
|
-
s.push({
|
|
90
|
-
role: "user",
|
|
91
|
-
parts: a.map((o) => ({
|
|
92
|
-
functionResponse: {
|
|
93
|
-
name: o.toolName || o.toolUseId,
|
|
94
|
-
response: { content: o.content, isError: o.isError || !1 }
|
|
95
|
-
}
|
|
96
|
-
}))
|
|
97
|
-
});
|
|
98
|
-
else {
|
|
99
|
-
const o = typeof n.content == "string" ? n.content : JSON.stringify(n.content);
|
|
100
|
-
o && s.push({ role: "user", parts: [{ text: o }] });
|
|
101
|
-
}
|
|
102
|
-
} else if (n.role === "user") {
|
|
103
|
-
const a = typeof n.content == "string" ? n.content : JSON.stringify(n.content);
|
|
104
|
-
s.push({ role: "user", parts: [{ text: a }] });
|
|
105
|
-
} else if (n.role === "assistant")
|
|
106
|
-
if (typeof n.content == "string")
|
|
107
|
-
s.push({ role: "model", parts: [{ text: n.content }] });
|
|
108
|
-
else {
|
|
109
|
-
const a = n.content, o = [];
|
|
110
|
-
for (const i of a)
|
|
111
|
-
if (i.type === "text" && i.text)
|
|
112
|
-
o.push({ text: i.text });
|
|
113
|
-
else if (i.type === "tool_use") {
|
|
114
|
-
const r = {
|
|
115
|
-
functionCall: {
|
|
116
|
-
name: i.name,
|
|
117
|
-
args: i.input || {}
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
i.metadata?.thoughtSignature && (r.thoughtSignature = i.metadata.thoughtSignature), o.push(r);
|
|
121
|
-
}
|
|
122
|
-
o.length > 0 && s.push({ role: "model", parts: o });
|
|
123
|
-
}
|
|
124
|
-
return { messages: s };
|
|
125
|
-
}
|
|
126
|
-
formatToolResults(t) {
|
|
127
|
-
return {
|
|
128
|
-
role: "tool_result",
|
|
129
|
-
content: t.map((e) => `${e.toolName || e.toolUseId}: ${e.content}`).join(`
|
|
130
|
-
`),
|
|
131
|
-
_toolResults: t
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
shouldContinue(t) {
|
|
135
|
-
return t === "tool_use";
|
|
136
|
-
}
|
|
137
|
-
formatError(t) {
|
|
138
|
-
if (!t || !(t instanceof Error))
|
|
139
|
-
return "Something went wrong. Please try again.";
|
|
140
|
-
const e = t.message || "", s = t;
|
|
141
|
-
return s.status === 429 ? "Too many requests. Please wait a moment and try again." : s.status === 403 || s.status === 401 ? "Authentication failed. Please check your API key configuration." : s.status === 503 || s.status === 500 ? "The AI service is temporarily unavailable. Please try again in a moment." : e.includes("SAFETY") ? "The request was blocked by safety filters. Please rephrase your request." : e.includes("RECITATION") ? "The response was blocked due to recitation concerns. Please try a different query." : e.startsWith("{") || e.startsWith("[") ? "The AI service encountered an error. Please try again." : e;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
export {
|
|
145
|
-
p as GoogleProvider
|
|
146
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});exports.SchemaType=void 0;(function(t){t.STRING="string",t.NUMBER="number",t.INTEGER="integer",t.BOOLEAN="boolean",t.ARRAY="array",t.OBJECT="object"})(exports.SchemaType||(exports.SchemaType={}));exports.ExecutableCodeLanguage=void 0;(function(t){t.LANGUAGE_UNSPECIFIED="language_unspecified",t.PYTHON="python"})(exports.ExecutableCodeLanguage||(exports.ExecutableCodeLanguage={}));exports.Outcome=void 0;(function(t){t.OUTCOME_UNSPECIFIED="outcome_unspecified",t.OUTCOME_OK="outcome_ok",t.OUTCOME_FAILED="outcome_failed",t.OUTCOME_DEADLINE_EXCEEDED="outcome_deadline_exceeded"})(exports.Outcome||(exports.Outcome={}));const S=["user","model","function","system"];exports.HarmCategory=void 0;(function(t){t.HARM_CATEGORY_UNSPECIFIED="HARM_CATEGORY_UNSPECIFIED",t.HARM_CATEGORY_HATE_SPEECH="HARM_CATEGORY_HATE_SPEECH",t.HARM_CATEGORY_SEXUALLY_EXPLICIT="HARM_CATEGORY_SEXUALLY_EXPLICIT",t.HARM_CATEGORY_HARASSMENT="HARM_CATEGORY_HARASSMENT",t.HARM_CATEGORY_DANGEROUS_CONTENT="HARM_CATEGORY_DANGEROUS_CONTENT",t.HARM_CATEGORY_CIVIC_INTEGRITY="HARM_CATEGORY_CIVIC_INTEGRITY"})(exports.HarmCategory||(exports.HarmCategory={}));exports.HarmBlockThreshold=void 0;(function(t){t.HARM_BLOCK_THRESHOLD_UNSPECIFIED="HARM_BLOCK_THRESHOLD_UNSPECIFIED",t.BLOCK_LOW_AND_ABOVE="BLOCK_LOW_AND_ABOVE",t.BLOCK_MEDIUM_AND_ABOVE="BLOCK_MEDIUM_AND_ABOVE",t.BLOCK_ONLY_HIGH="BLOCK_ONLY_HIGH",t.BLOCK_NONE="BLOCK_NONE"})(exports.HarmBlockThreshold||(exports.HarmBlockThreshold={}));exports.HarmProbability=void 0;(function(t){t.HARM_PROBABILITY_UNSPECIFIED="HARM_PROBABILITY_UNSPECIFIED",t.NEGLIGIBLE="NEGLIGIBLE",t.LOW="LOW",t.MEDIUM="MEDIUM",t.HIGH="HIGH"})(exports.HarmProbability||(exports.HarmProbability={}));exports.BlockReason=void 0;(function(t){t.BLOCKED_REASON_UNSPECIFIED="BLOCKED_REASON_UNSPECIFIED",t.SAFETY="SAFETY",t.OTHER="OTHER"})(exports.BlockReason||(exports.BlockReason={}));exports.FinishReason=void 0;(function(t){t.FINISH_REASON_UNSPECIFIED="FINISH_REASON_UNSPECIFIED",t.STOP="STOP",t.MAX_TOKENS="MAX_TOKENS",t.SAFETY="SAFETY",t.RECITATION="RECITATION",t.LANGUAGE="LANGUAGE",t.BLOCKLIST="BLOCKLIST",t.PROHIBITED_CONTENT="PROHIBITED_CONTENT",t.SPII="SPII",t.MALFORMED_FUNCTION_CALL="MALFORMED_FUNCTION_CALL",t.OTHER="OTHER"})(exports.FinishReason||(exports.FinishReason={}));exports.TaskType=void 0;(function(t){t.TASK_TYPE_UNSPECIFIED="TASK_TYPE_UNSPECIFIED",t.RETRIEVAL_QUERY="RETRIEVAL_QUERY",t.RETRIEVAL_DOCUMENT="RETRIEVAL_DOCUMENT",t.SEMANTIC_SIMILARITY="SEMANTIC_SIMILARITY",t.CLASSIFICATION="CLASSIFICATION",t.CLUSTERING="CLUSTERING"})(exports.TaskType||(exports.TaskType={}));exports.FunctionCallingMode=void 0;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.AUTO="AUTO",t.ANY="ANY",t.NONE="NONE"})(exports.FunctionCallingMode||(exports.FunctionCallingMode={}));exports.DynamicRetrievalMode=void 0;(function(t){t.MODE_UNSPECIFIED="MODE_UNSPECIFIED",t.MODE_DYNAMIC="MODE_DYNAMIC"})(exports.DynamicRetrievalMode||(exports.DynamicRetrievalMode={}));class u extends Error{constructor(e){super(`[GoogleGenerativeAI Error]: ${e}`)}}class C extends u{constructor(e,n){super(e),this.response=n}}class T extends u{constructor(e,n,o,s){super(e),this.status=n,this.statusText=o,this.errorDetails=s}}class g extends u{}class N extends u{}const j="https://generativelanguage.googleapis.com",k="v1beta",B="0.24.1",K="genai-js";var _;(function(t){t.GENERATE_CONTENT="generateContent",t.STREAM_GENERATE_CONTENT="streamGenerateContent",t.COUNT_TOKENS="countTokens",t.EMBED_CONTENT="embedContent",t.BATCH_EMBED_CONTENTS="batchEmbedContents"})(_||(_={}));class Y{constructor(e,n,o,s,i){this.model=e,this.task=n,this.apiKey=o,this.stream=s,this.requestOptions=i}toString(){var e,n;const o=((e=this.requestOptions)===null||e===void 0?void 0:e.apiVersion)||k;let i=`${((n=this.requestOptions)===null||n===void 0?void 0:n.baseUrl)||j}/${o}/${this.model}:${this.task}`;return this.stream&&(i+="?alt=sse"),i}}function P(t){const e=[];return t?.apiClient&&e.push(t.apiClient),e.push(`${K}/${B}`),e.join(" ")}async function q(t){var e;const n=new Headers;n.append("Content-Type","application/json"),n.append("x-goog-api-client",P(t.requestOptions)),n.append("x-goog-api-key",t.apiKey);let o=(e=t.requestOptions)===null||e===void 0?void 0:e.customHeaders;if(o){if(!(o instanceof Headers))try{o=new Headers(o)}catch(s){throw new g(`unable to convert customHeaders value ${JSON.stringify(o)} to Headers: ${s.message}`)}for(const[s,i]of o.entries()){if(s==="x-goog-api-key")throw new g(`Cannot set reserved header name ${s}`);if(s==="x-goog-api-client")throw new g(`Header name ${s} can only be set using the apiClient field`);n.append(s,i)}}return n}async function V(t,e,n,o,s,i){const a=new Y(t,e,n,o,i);return{url:a.toString(),fetchOptions:Object.assign(Object.assign({},Q(i)),{method:"POST",headers:await q(a),body:s})}}async function y(t,e,n,o,s,i={},a=fetch){const{url:r,fetchOptions:d}=await V(t,e,n,o,s,i);return J(r,d,a)}async function J(t,e,n=fetch){let o;try{o=await n(t,e)}catch(s){W(s,t)}return o.ok||await X(o,t),o}function W(t,e){let n=t;throw n.name==="AbortError"?(n=new N(`Request aborted when fetching ${e.toString()}: ${t.message}`),n.stack=t.stack):t instanceof T||t instanceof g||(n=new u(`Error fetching from ${e.toString()}: ${t.message}`),n.stack=t.stack),n}async function X(t,e){let n="",o;try{const s=await t.json();n=s.error.message,s.error.details&&(n+=` ${JSON.stringify(s.error.details)}`,o=s.error.details)}catch{}throw new T(`Error fetching from ${e.toString()}: [${t.status} ${t.statusText}] ${n}`,t.status,t.statusText,o)}function Q(t){const e={};if(t?.signal!==void 0||t?.timeout>=0){const n=new AbortController;t?.timeout>=0&&setTimeout(()=>n.abort(),t.timeout),t?.signal&&t.signal.addEventListener("abort",()=>{n.abort()}),e.signal=n.signal}return e}function w(t){return t.text=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning text from the first candidate only. Access response.candidates directly to use the other candidates.`),A(t.candidates[0]))throw new C(`${E(t)}`,t);return z(t)}else if(t.promptFeedback)throw new C(`Text not available. ${E(t)}`,t);return""},t.functionCall=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),A(t.candidates[0]))throw new C(`${E(t)}`,t);return console.warn("response.functionCall() is deprecated. Use response.functionCalls() instead."),b(t)[0]}else if(t.promptFeedback)throw new C(`Function call not available. ${E(t)}`,t)},t.functionCalls=()=>{if(t.candidates&&t.candidates.length>0){if(t.candidates.length>1&&console.warn(`This response had ${t.candidates.length} candidates. Returning function calls from the first candidate only. Access response.candidates directly to use the other candidates.`),A(t.candidates[0]))throw new C(`${E(t)}`,t);return b(t)}else if(t.promptFeedback)throw new C(`Function call not available. ${E(t)}`,t)},t}function z(t){var e,n,o,s;const i=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const a of(s=(o=t.candidates)===null||o===void 0?void 0:o[0].content)===null||s===void 0?void 0:s.parts)a.text&&i.push(a.text),a.executableCode&&i.push("\n```"+a.executableCode.language+`
|
|
2
|
-
`+a.executableCode.code+"\n```\n"),a.codeExecutionResult&&i.push("\n```\n"+a.codeExecutionResult.output+"\n```\n");return i.length>0?i.join(""):""}function b(t){var e,n,o,s;const i=[];if(!((n=(e=t.candidates)===null||e===void 0?void 0:e[0].content)===null||n===void 0)&&n.parts)for(const a of(s=(o=t.candidates)===null||o===void 0?void 0:o[0].content)===null||s===void 0?void 0:s.parts)a.functionCall&&i.push(a.functionCall);if(i.length>0)return i}const Z=[exports.FinishReason.RECITATION,exports.FinishReason.SAFETY,exports.FinishReason.LANGUAGE];function A(t){return!!t.finishReason&&Z.includes(t.finishReason)}function E(t){var e,n,o;let s="";if((!t.candidates||t.candidates.length===0)&&t.promptFeedback)s+="Response was blocked",!((e=t.promptFeedback)===null||e===void 0)&&e.blockReason&&(s+=` due to ${t.promptFeedback.blockReason}`),!((n=t.promptFeedback)===null||n===void 0)&&n.blockReasonMessage&&(s+=`: ${t.promptFeedback.blockReasonMessage}`);else if(!((o=t.candidates)===null||o===void 0)&&o[0]){const i=t.candidates[0];A(i)&&(s+=`Candidate was blocked due to ${i.finishReason}`,i.finishMessage&&(s+=`: ${i.finishMessage}`))}return s}function I(t){return this instanceof I?(this.v=t,this):new I(t)}function tt(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=n.apply(t,e||[]),s,i=[];return s={},a("next"),a("throw"),a("return"),s[Symbol.asyncIterator]=function(){return this},s;function a(l){o[l]&&(s[l]=function(c){return new Promise(function(f,O){i.push([l,c,f,O])>1||r(l,c)})})}function r(l,c){try{d(o[l](c))}catch(f){R(i[0][3],f)}}function d(l){l.value instanceof I?Promise.resolve(l.value.v).then(h,v):R(i[0][2],l)}function h(l){r("next",l)}function v(l){r("throw",l)}function R(l,c){l(c),i.shift(),i.length&&r(i[0][0],i[0][1])}}const M=/^data\: (.*)(?:\n\n|\r\r|\r\n\r\n)/;function et(t){const e=t.body.pipeThrough(new TextDecoderStream("utf8",{fatal:!0})),n=st(e),[o,s]=n.tee();return{stream:ot(o),response:nt(s)}}async function nt(t){const e=[],n=t.getReader();for(;;){const{done:o,value:s}=await n.read();if(o)return w(it(e));e.push(s)}}function ot(t){return tt(this,arguments,function*(){const n=t.getReader();for(;;){const{value:o,done:s}=yield I(n.read());if(s)break;yield yield I(w(o))}})}function st(t){const e=t.getReader();return new ReadableStream({start(o){let s="";return i();function i(){return e.read().then(({value:a,done:r})=>{if(r){if(s.trim()){o.error(new u("Failed to parse stream"));return}o.close();return}s+=a;let d=s.match(M),h;for(;d;){try{h=JSON.parse(d[1])}catch{o.error(new u(`Error parsing JSON response: "${d[1]}"`));return}o.enqueue(h),s=s.substring(d[0].length),d=s.match(M)}return i()}).catch(a=>{let r=a;throw r.stack=a.stack,r.name==="AbortError"?r=new N("Request aborted when reading from the stream"):r=new u("Error reading from the stream"),r})}}})}function it(t){const e=t[t.length-1],n={promptFeedback:e?.promptFeedback};for(const o of t){if(o.candidates){let s=0;for(const i of o.candidates)if(n.candidates||(n.candidates=[]),n.candidates[s]||(n.candidates[s]={index:s}),n.candidates[s].citationMetadata=i.citationMetadata,n.candidates[s].groundingMetadata=i.groundingMetadata,n.candidates[s].finishReason=i.finishReason,n.candidates[s].finishMessage=i.finishMessage,n.candidates[s].safetyRatings=i.safetyRatings,i.content&&i.content.parts){n.candidates[s].content||(n.candidates[s].content={role:i.content.role||"user",parts:[]});const a={};for(const r of i.content.parts)r.text&&(a.text=r.text),r.functionCall&&(a.functionCall=r.functionCall),r.executableCode&&(a.executableCode=r.executableCode),r.codeExecutionResult&&(a.codeExecutionResult=r.codeExecutionResult),Object.keys(a).length===0&&(a.text=""),n.candidates[s].content.parts.push(a)}s++}o.usageMetadata&&(n.usageMetadata=o.usageMetadata)}return n}async function F(t,e,n,o){const s=await y(e,_.STREAM_GENERATE_CONTENT,t,!0,JSON.stringify(n),o);return et(s)}async function H(t,e,n,o){const i=await(await y(e,_.GENERATE_CONTENT,t,!1,JSON.stringify(n),o)).json();return{response:w(i)}}function U(t){if(t!=null){if(typeof t=="string")return{role:"system",parts:[{text:t}]};if(t.text)return{role:"system",parts:[t]};if(t.parts)return t.role?t:{role:"system",parts:t.parts}}}function p(t){let e=[];if(typeof t=="string")e=[{text:t}];else for(const n of t)typeof n=="string"?e.push({text:n}):e.push(n);return at(e)}function at(t){const e={role:"user",parts:[]},n={role:"function",parts:[]};let o=!1,s=!1;for(const i of t)"functionResponse"in i?(n.parts.push(i),s=!0):(e.parts.push(i),o=!0);if(o&&s)throw new u("Within a single message, FunctionResponse cannot be mixed with other type of part in the request for sending chat message.");if(!o&&!s)throw new u("No content is provided for sending chat message.");return o?e:n}function rt(t,e){var n;let o={model:e?.model,generationConfig:e?.generationConfig,safetySettings:e?.safetySettings,tools:e?.tools,toolConfig:e?.toolConfig,systemInstruction:e?.systemInstruction,cachedContent:(n=e?.cachedContent)===null||n===void 0?void 0:n.name,contents:[]};const s=t.generateContentRequest!=null;if(t.contents){if(s)throw new g("CountTokensRequest must have one of contents or generateContentRequest, not both.");o.contents=t.contents}else if(s)o=Object.assign(Object.assign({},o),t.generateContentRequest);else{const i=p(t);o.contents=[i]}return{generateContentRequest:o}}function G(t){let e;return t.contents?e=t:e={contents:[p(t)]},t.systemInstruction&&(e.systemInstruction=U(t.systemInstruction)),e}function ct(t){return typeof t=="string"||Array.isArray(t)?{content:p(t)}:t}const L=["text","inlineData","functionCall","functionResponse","executableCode","codeExecutionResult"],dt={user:["text","inlineData"],function:["functionResponse"],model:["text","functionCall","executableCode","codeExecutionResult"],system:["text"]};function lt(t){let e=!1;for(const n of t){const{role:o,parts:s}=n;if(!e&&o!=="user")throw new u(`First content should be with role 'user', got ${o}`);if(!S.includes(o))throw new u(`Each item should include role field. Got ${o} but valid roles are: ${JSON.stringify(S)}`);if(!Array.isArray(s))throw new u("Content should have 'parts' property with an array of Parts");if(s.length===0)throw new u("Each Content should have at least one part");const i={text:0,inlineData:0,functionCall:0,functionResponse:0,fileData:0,executableCode:0,codeExecutionResult:0};for(const r of s)for(const d of L)d in r&&(i[d]+=1);const a=dt[o];for(const r of L)if(!a.includes(r)&&i[r]>0)throw new u(`Content with role '${o}' can't contain '${r}' part`);e=!0}}function D(t){var e;if(t.candidates===void 0||t.candidates.length===0)return!1;const n=(e=t.candidates[0])===null||e===void 0?void 0:e.content;if(n===void 0||n.parts===void 0||n.parts.length===0)return!1;for(const o of n.parts)if(o===void 0||Object.keys(o).length===0||o.text!==void 0&&o.text==="")return!1;return!0}const x="SILENT_ERROR";class ${constructor(e,n,o,s={}){this.model=n,this.params=o,this._requestOptions=s,this._history=[],this._sendPromise=Promise.resolve(),this._apiKey=e,o?.history&&(lt(o.history),this._history=o.history)}async getHistory(){return await this._sendPromise,this._history}async sendMessage(e,n={}){var o,s,i,a,r,d;await this._sendPromise;const h=p(e),v={safetySettings:(o=this.params)===null||o===void 0?void 0:o.safetySettings,generationConfig:(s=this.params)===null||s===void 0?void 0:s.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(r=this.params)===null||r===void 0?void 0:r.systemInstruction,cachedContent:(d=this.params)===null||d===void 0?void 0:d.cachedContent,contents:[...this._history,h]},R=Object.assign(Object.assign({},this._requestOptions),n);let l;return this._sendPromise=this._sendPromise.then(()=>H(this._apiKey,this.model,v,R)).then(c=>{var f;if(D(c.response)){this._history.push(h);const O=Object.assign({parts:[],role:"model"},(f=c.response.candidates)===null||f===void 0?void 0:f[0].content);this._history.push(O)}else{const O=E(c.response);O&&console.warn(`sendMessage() was unsuccessful. ${O}. Inspect response object for details.`)}l=c}).catch(c=>{throw this._sendPromise=Promise.resolve(),c}),await this._sendPromise,l}async sendMessageStream(e,n={}){var o,s,i,a,r,d;await this._sendPromise;const h=p(e),v={safetySettings:(o=this.params)===null||o===void 0?void 0:o.safetySettings,generationConfig:(s=this.params)===null||s===void 0?void 0:s.generationConfig,tools:(i=this.params)===null||i===void 0?void 0:i.tools,toolConfig:(a=this.params)===null||a===void 0?void 0:a.toolConfig,systemInstruction:(r=this.params)===null||r===void 0?void 0:r.systemInstruction,cachedContent:(d=this.params)===null||d===void 0?void 0:d.cachedContent,contents:[...this._history,h]},R=Object.assign(Object.assign({},this._requestOptions),n),l=F(this._apiKey,this.model,v,R);return this._sendPromise=this._sendPromise.then(()=>l).catch(c=>{throw new Error(x)}).then(c=>c.response).then(c=>{if(D(c)){this._history.push(h);const f=Object.assign({},c.candidates[0].content);f.role||(f.role="model"),this._history.push(f)}else{const f=E(c);f&&console.warn(`sendMessageStream() was unsuccessful. ${f}. Inspect response object for details.`)}}).catch(c=>{c.message!==x&&console.error(c)}),l}}async function ut(t,e,n,o){return(await y(e,_.COUNT_TOKENS,t,!1,JSON.stringify(n),o)).json()}async function ft(t,e,n,o){return(await y(e,_.EMBED_CONTENT,t,!1,JSON.stringify(n),o)).json()}async function ht(t,e,n,o){const s=n.requests.map(a=>Object.assign(Object.assign({},a),{model:e}));return(await y(e,_.BATCH_EMBED_CONTENTS,t,!1,JSON.stringify({requests:s}),o)).json()}class m{constructor(e,n,o={}){this.apiKey=e,this._requestOptions=o,n.model.includes("/")?this.model=n.model:this.model=`models/${n.model}`,this.generationConfig=n.generationConfig||{},this.safetySettings=n.safetySettings||[],this.tools=n.tools,this.toolConfig=n.toolConfig,this.systemInstruction=U(n.systemInstruction),this.cachedContent=n.cachedContent}async generateContent(e,n={}){var o;const s=G(e),i=Object.assign(Object.assign({},this._requestOptions),n);return H(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(o=this.cachedContent)===null||o===void 0?void 0:o.name},s),i)}async generateContentStream(e,n={}){var o;const s=G(e),i=Object.assign(Object.assign({},this._requestOptions),n);return F(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(o=this.cachedContent)===null||o===void 0?void 0:o.name},s),i)}startChat(e){var n;return new $(this.apiKey,this.model,Object.assign({generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:(n=this.cachedContent)===null||n===void 0?void 0:n.name},e),this._requestOptions)}async countTokens(e,n={}){const o=rt(e,{model:this.model,generationConfig:this.generationConfig,safetySettings:this.safetySettings,tools:this.tools,toolConfig:this.toolConfig,systemInstruction:this.systemInstruction,cachedContent:this.cachedContent}),s=Object.assign(Object.assign({},this._requestOptions),n);return ut(this.apiKey,this.model,o,s)}async embedContent(e,n={}){const o=ct(e),s=Object.assign(Object.assign({},this._requestOptions),n);return ft(this.apiKey,this.model,o,s)}async batchEmbedContents(e,n={}){const o=Object.assign(Object.assign({},this._requestOptions),n);return ht(this.apiKey,this.model,e,o)}}class gt{constructor(e){this.apiKey=e}getGenerativeModel(e,n){if(!e.model)throw new u("Must provide a model name. Example: genai.getGenerativeModel({ model: 'my-model-name' })");return new m(this.apiKey,e,n)}getGenerativeModelFromCachedContent(e,n,o){if(!e.name)throw new g("Cached content must contain a `name` field.");if(!e.model)throw new g("Cached content must contain a `model` field.");const s=["model","systemInstruction"];for(const a of s)if(n?.[a]&&e[a]&&n?.[a]!==e[a]){if(a==="model"){const r=n.model.startsWith("models/")?n.model.replace("models/",""):n.model,d=e.model.startsWith("models/")?e.model.replace("models/",""):e.model;if(r===d)continue}throw new g(`Different value for "${a}" specified in modelParams (${n[a]}) and cachedContent (${e[a]})`)}const i=Object.assign(Object.assign({},n),{model:e.model,tools:e.tools,toolConfig:e.toolConfig,systemInstruction:e.systemInstruction,cachedContent:e});return new m(this.apiKey,i,o)}}exports.ChatSession=$;exports.GenerativeModel=m;exports.GoogleGenerativeAI=gt;exports.GoogleGenerativeAIAbortError=N;exports.GoogleGenerativeAIError=u;exports.GoogleGenerativeAIFetchError=T;exports.GoogleGenerativeAIRequestInputError=g;exports.GoogleGenerativeAIResponseError=C;exports.POSSIBLE_ROLES=S;
|