@btst/stack 1.3.1 → 1.4.1
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/README.md +85 -37
- package/dist/node_modules/.pnpm/@radix-ui_react-accordion@1.2.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_947719a27ff11ec6f09710dd9e85efc5/node_modules/@radix-ui/react-accordion/dist/index.cjs +321 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-accordion@1.2.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_947719a27ff11ec6f09710dd9e85efc5/node_modules/@radix-ui/react-accordion/dist/index.mjs +306 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.2_@types_react@19.2.2__@types_ec789942cd38340bd7362c09e7d34384 → @radix-ui_react-alert-dialog@1.1.15_@types_react-dom@19.2.3_@types_react@19.2.6__@types_4f58c757aa677e233cf96d60fda2f1da}/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@1_9e04309f365863673e44407648bb0cb6 → @radix-ui_react-arrow@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_35df44f6d87656c1401686c91d770dbb}/node_modules/@radix-ui/react-arrow/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-collapsible@1.1.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types__d025a77f62ee83ca6bd8b0ea1f9de738/node_modules/@radix-ui/react-collapsible/dist/index.cjs +168 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-collapsible@1.1.12_@types_react-dom@19.2.3_@types_react@19.2.6__@types__d025a77f62ee83ca6bd8b0ea1f9de738/node_modules/@radix-ui/react-collapsible/dist/index.mjs +146 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-collection@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_re_6d7c277722b3619c9ee7e64e9a822c45 → @radix-ui_react-collection@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_re_59aa5e150e70a3e7bfb1567148b021b5}/node_modules/@radix-ui/react-collection/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +4 -4
- package/dist/node_modules/.pnpm/{@radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.2_@types_react@19.2.2__@_ca5522e5d45d4722cb9eb5ce53defa61 → @radix-ui_react-dismissable-layer@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@_9ee1db7daf927866cf505b31d40047ad}/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs +4 -4
- package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.cjs +282 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-dropdown-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@type_a50051c7210b6fbd5be09388bda08578/node_modules/@radix-ui/react-dropdown-menu/dist/index.mjs +247 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +3 -3
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.2_@types_react@19.2.2__@types_r_93de389b3f622f9f764acc8e59ec80c0 → @radix-ui_react-focus-scope@1.1.7_@types_react-dom@19.2.3_@types_react@19.2.6__@types_r_0a31b7f987af9482d13505312e1a1be9}/node_modules/@radix-ui/react-focus-scope/dist/index.mjs +3 -3
- package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-id@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-id@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-id/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.cjs +845 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-menu@2.1.16_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@1_82ed1fcd848b6984d9291a784d477cf4/node_modules/@radix-ui/react-menu/dist/index.mjs +799 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.cjs +7 -7
- package/dist/node_modules/.pnpm/{@radix-ui_react-popper@1.2.8_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_d6285b8269ea5d6b59b300f5be279a0c → @radix-ui_react-popper@1.2.8_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_7ac2caae1e39f9ba93d5015614525161}/node_modules/@radix-ui/react-popper/dist/index.mjs +7 -7
- package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{@radix-ui_react-portal@1.1.9_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_478b3d5dd4afab1a3dcce7ed1748cb95 → @radix-ui_react-portal@1.1.9_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_1bb4e0f97f86496802d28a2e74e2a8b9}/node_modules/@radix-ui/react-portal/dist/index.mjs +2 -2
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.cjs +147 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-presence@1.1.5_@types_react-dom@19.2.3_@types_react@19.2.6__@types_reac_90f8e5c12233caef3399d5fd66452a13/node_modules/@radix-ui/react-presence/dist/index.mjs +131 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.cjs +244 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-roving-focus@1.1.11_@types_react-dom@19.2.3_@types_react@19.2.6__@types_fe1151d1f393bbc1072b24a86dff3a23/node_modules/@radix-ui/react-roving-focus/dist/index.mjs +224 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.cjs +742 -0
- package/dist/node_modules/.pnpm/@radix-ui_react-scroll-area@1.2.10_@types_react-dom@19.2.3_@types_react@19.2.6__@types__e3f7735e9b444a10b3bbfd9fe97d44d0/node_modules/@radix-ui/react-scroll-area/dist/index.mjs +719 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.cjs +17 -17
- package/dist/node_modules/.pnpm/{@radix-ui_react-select@2.2.6_@types_react-dom@19.2.2_@types_react@19.2.2__@types_react@_802c3d414c85063bee785fcc98a39c07 → @radix-ui_react-select@2.2.6_@types_react-dom@19.2.3_@types_react@19.2.6__@types_react@_38dc681bb1f2bcfeb5249d8ca2bc01f5}/node_modules/@radix-ui/react-select/dist/index.mjs +17 -17
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-controllable-state@1.2.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-controllable-state/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-escape-keydown@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-escape-keydown/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-size@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-size@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-size/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{@radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.2_@types_react@19.2.2__@typ_a84e98a44624c31e835a98d4b8b0c30d → @radix-ui_react-visually-hidden@1.2.3_@types_react-dom@19.2.3_@types_react@19.2.6__@typ_f453379bbd5a4932ec515167f81be42a}/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.cjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/component.mjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/SideEffect.mjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.cjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/UI.mjs +2 -2
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.cjs +1 -1
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/medium.mjs +1 -1
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +9 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/sidecar.mjs +1 -1
- package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.cjs +610 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.mjs +608 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.cjs +221 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.mjs +219 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.cjs +341 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs +339 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.cjs +135 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs +133 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.cjs +429 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs +423 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +227 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +225 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.cjs +31 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.mjs +29 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.cjs +11 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.mjs +8 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.cjs +18 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.mjs +16 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.cjs +39 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.cjs +22 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.mjs +20 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.mjs +37 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.cjs +18 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.mjs +16 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.cjs +26 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.mjs +24 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/tool-call-display.cjs +123 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/tool-call-display.mjs +121 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.cjs +199 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.mjs +191 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.cjs +63 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.mjs +61 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.cjs +14 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.mjs +11 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.cjs +241 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.mjs +239 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/db.cjs +65 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/db.mjs +63 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/schemas.cjs +42 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/schemas.mjs +38 -0
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.cjs +12 -309
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.mjs +13 -303
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.cjs +2 -2
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.mjs +2 -2
- package/dist/packages/ui/src/components/accordion.cjs +67 -0
- package/dist/packages/ui/src/components/accordion.mjs +62 -0
- package/dist/packages/ui/src/components/alert-dialog.cjs +1 -1
- package/dist/packages/ui/src/components/alert-dialog.mjs +1 -1
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.cjs → ui/src/components/better-stack-attribution.cjs} +3 -3
- package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.mjs → ui/src/components/better-stack-attribution.mjs} +3 -3
- package/dist/packages/ui/src/components/dialog.cjs +14 -0
- package/dist/packages/ui/src/components/dialog.mjs +14 -1
- package/dist/packages/ui/src/components/dropdown-menu.cjs +67 -0
- package/dist/packages/ui/src/components/dropdown-menu.mjs +62 -0
- package/dist/packages/ui/src/components/markdown-content.cjs +306 -0
- package/dist/packages/ui/src/components/markdown-content.mjs +297 -0
- package/dist/packages/ui/src/components/scroll-area.cjs +63 -0
- package/dist/packages/ui/src/components/scroll-area.mjs +60 -0
- package/dist/packages/ui/src/components/select.cjs +1 -1
- package/dist/packages/ui/src/components/select.mjs +1 -1
- package/dist/packages/ui/src/components/sheet.cjs +87 -0
- package/dist/packages/ui/src/components/sheet.mjs +69 -0
- package/dist/plugins/ai-chat/api/index.cjs +9 -0
- package/dist/plugins/ai-chat/api/index.d.cts +9 -0
- package/dist/plugins/ai-chat/api/index.d.mts +9 -0
- package/dist/plugins/ai-chat/api/index.d.ts +9 -0
- package/dist/plugins/ai-chat/api/index.mjs +2 -0
- package/dist/plugins/ai-chat/client/components/index.cjs +29 -0
- package/dist/plugins/ai-chat/client/components/index.d.cts +30 -0
- package/dist/plugins/ai-chat/client/components/index.d.mts +30 -0
- package/dist/plugins/ai-chat/client/components/index.d.ts +30 -0
- package/dist/plugins/ai-chat/client/components/index.mjs +12 -0
- package/dist/plugins/ai-chat/client/hooks/index.cjs +13 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.cts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.mts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.d.ts +98 -0
- package/dist/plugins/ai-chat/client/hooks/index.mjs +1 -0
- package/dist/plugins/ai-chat/client/index.cjs +21 -0
- package/dist/plugins/ai-chat/client/index.d.cts +156 -0
- package/dist/plugins/ai-chat/client/index.d.mts +156 -0
- package/dist/plugins/ai-chat/client/index.d.ts +156 -0
- package/dist/plugins/ai-chat/client/index.mjs +8 -0
- package/dist/plugins/ai-chat/client.css +6 -0
- package/dist/plugins/ai-chat/query-keys.cjs +60 -0
- package/dist/plugins/ai-chat/query-keys.d.cts +478 -0
- package/dist/plugins/ai-chat/query-keys.d.mts +478 -0
- package/dist/plugins/ai-chat/query-keys.d.ts +478 -0
- package/dist/plugins/ai-chat/query-keys.mjs +58 -0
- package/dist/plugins/ai-chat/style.css +19 -0
- package/dist/plugins/blog/api/index.d.cts +1 -1
- package/dist/plugins/blog/api/index.d.mts +1 -1
- package/dist/plugins/blog/api/index.d.ts +1 -1
- package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +91 -62
- package/dist/plugins/blog/client/hooks/index.d.cts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.mts +4 -4
- package/dist/plugins/blog/client/hooks/index.d.ts +4 -4
- package/dist/plugins/blog/client/index.d.cts +1 -1
- package/dist/plugins/blog/client/index.d.mts +1 -1
- package/dist/plugins/blog/client/index.d.ts +1 -1
- package/dist/plugins/blog/query-keys.d.cts +7 -7
- package/dist/plugins/blog/query-keys.d.mts +7 -7
- package/dist/plugins/blog/query-keys.d.ts +7 -7
- package/dist/shared/stack.Be1QIHEn.d.cts +23 -0
- package/dist/shared/stack.Be1QIHEn.d.mts +23 -0
- package/dist/shared/stack.Be1QIHEn.d.ts +23 -0
- package/dist/shared/stack.DaOcgmrM.d.cts +323 -0
- package/dist/shared/stack.DaOcgmrM.d.mts +323 -0
- package/dist/shared/stack.DaOcgmrM.d.ts +323 -0
- package/package.json +59 -1
- package/src/plugins/ai-chat/api/index.ts +2 -0
- package/src/plugins/ai-chat/api/plugin.ts +1083 -0
- package/src/plugins/ai-chat/client/components/chat-input.tsx +295 -0
- package/src/plugins/ai-chat/client/components/chat-interface.tsx +494 -0
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +175 -0
- package/src/plugins/ai-chat/client/components/chat-message.tsx +561 -0
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +296 -0
- package/src/plugins/ai-chat/client/components/index.ts +18 -0
- package/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.tsx +57 -0
- package/src/plugins/ai-chat/client/components/loading/index.tsx +11 -0
- package/src/plugins/ai-chat/client/components/pages/404-page.tsx +27 -0
- package/src/plugins/ai-chat/client/components/pages/chat-page.internal.tsx +31 -0
- package/src/plugins/ai-chat/client/components/pages/chat-page.tsx +46 -0
- package/src/plugins/ai-chat/client/components/shared/default-error.tsx +28 -0
- package/src/plugins/ai-chat/client/components/shared/error-placeholder.tsx +22 -0
- package/src/plugins/ai-chat/client/components/tool-call-display.tsx +197 -0
- package/src/plugins/ai-chat/client/hooks/chat-hooks.tsx +349 -0
- package/src/plugins/ai-chat/client/hooks/index.tsx +1 -0
- package/src/plugins/ai-chat/client/index.ts +25 -0
- package/src/plugins/ai-chat/client/localization/index.ts +156 -0
- package/src/plugins/ai-chat/client/overrides.ts +241 -0
- package/src/plugins/ai-chat/client/plugin.tsx +449 -0
- package/src/plugins/ai-chat/client.css +6 -0
- package/src/plugins/ai-chat/db.ts +65 -0
- package/src/plugins/ai-chat/query-keys.ts +87 -0
- package/src/plugins/ai-chat/schemas.ts +40 -0
- package/src/plugins/ai-chat/style.css +19 -0
- package/src/plugins/ai-chat/types.ts +29 -0
- package/src/plugins/blog/client/components/shared/markdown-content-styles.css +91 -62
- package/src/plugins/blog/client/components/shared/markdown-content.tsx +19 -427
- package/src/plugins/blog/client/components/shared/page-wrapper.tsx +2 -2
- package/dist/node_modules/.pnpm/react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0/node_modules/react-remove-scroll/dist/es2015/sidecar.cjs +0 -9
- package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +0 -19
- package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-compose-refs@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-compose-refs@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-compose-refs/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-context@1.1.2_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-context@1.1.2_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-context/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-direction@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-direction@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-direction/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-focus-guards@1.1.3_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-focus-guards@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-focus-guards/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.2_@types_react@19.2.2__@types_rea_bdc15f10281778271ffcbe8dd3cd491e → @radix-ui_react-primitive@2.1.3_@types_react-dom@19.2.3_@types_react@19.2.6__@types_rea_a92a69cb1cb39305138539e4fa72f596}/node_modules/@radix-ui/react-primitive/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-callback-ref@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-callback-ref/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-layout-effect@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-layout-effect/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.cjs +0 -0
- package/dist/node_modules/.pnpm/{@radix-ui_react-use-previous@1.1.1_@types_react@19.2.2_react@19.2.0 → @radix-ui_react-use-previous@1.1.1_@types_react@19.2.6_react@19.2.0}/node_modules/@radix-ui/react-use-previous/dist/index.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/constants.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll-bar@2.3.8_@types_react@19.2.2_react@19.2.0 → react-remove-scroll-bar@2.3.8_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll-bar/dist/es2015/utils.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/Combination.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-remove-scroll@2.7.1_@types_react@19.2.2_react@19.2.0 → react-remove-scroll@2.7.1_@types_react@19.2.6_react@19.2.0}/node_modules/react-remove-scroll/dist/es2015/handleScroll.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/component.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/hook.mjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.cjs +0 -0
- package/dist/node_modules/.pnpm/{react-style-singleton@2.2.3_@types_react@19.2.2_react@19.2.0 → react-style-singleton@2.2.3_@types_react@19.2.6_react@19.2.0}/node_modules/react-style-singleton/dist/es2015/singleton.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/assignRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useMergeRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-callback-ref@1.3.3_@types_react@19.2.2_react@19.2.0 → use-callback-ref@1.3.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-callback-ref/dist/es2015/useRef.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/exports.mjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.cjs +0 -0
- package/dist/node_modules/.pnpm/{use-sidecar@1.1.3_@types_react@19.2.2_react@19.2.0 → use-sidecar@1.1.3_@types_react@19.2.6_react@19.2.0}/node_modules/use-sidecar/dist/es2015/medium.mjs +0 -0
- package/dist/shared/{stack.CbuN2zVV.d.ts → stack.CcI4sYJP.d.cts} +3 -3
- package/dist/shared/{stack.CbuN2zVV.d.cts → stack.CcI4sYJP.d.mts} +3 -3
- package/dist/shared/{stack.CbuN2zVV.d.mts → stack.CcI4sYJP.d.ts} +3 -3
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import * as _btst_stack_plugins_api from '@btst/stack/plugins/api';
|
|
2
|
+
import * as zod_v4_core from 'zod/v4/core';
|
|
3
|
+
import * as zod from 'zod';
|
|
4
|
+
import * as better_call from 'better-call';
|
|
5
|
+
import { LanguageModel, Tool } from 'ai';
|
|
6
|
+
import { M as Message, C as Conversation, S as SerializedConversation, a as SerializedMessage } from '../../shared/stack.Be1QIHEn.mjs';
|
|
7
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
8
|
+
import { createApiClient } from '@btst/stack/plugins/client';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Context passed to AI Chat API hooks
|
|
12
|
+
*/
|
|
13
|
+
interface ChatApiContext<TBody = any, TParams = any, TQuery = any> {
|
|
14
|
+
body?: TBody;
|
|
15
|
+
params?: TParams;
|
|
16
|
+
query?: TQuery;
|
|
17
|
+
request?: Request;
|
|
18
|
+
headers?: Headers;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Configuration hooks for AI Chat backend plugin
|
|
23
|
+
* All hooks are optional and allow consumers to customize behavior
|
|
24
|
+
*/
|
|
25
|
+
interface AiChatBackendHooks {
|
|
26
|
+
/**
|
|
27
|
+
* Called before processing a chat message. Return false to deny access.
|
|
28
|
+
* @param messages - Array of messages being sent
|
|
29
|
+
* @param context - Request context with headers, etc.
|
|
30
|
+
*/
|
|
31
|
+
onBeforeChat?: (messages: Array<{
|
|
32
|
+
role: string;
|
|
33
|
+
content: string;
|
|
34
|
+
}>, context: ChatApiContext) => Promise<boolean> | boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Called before listing conversations. Return false to deny access.
|
|
37
|
+
* @param context - Request context with headers, etc.
|
|
38
|
+
*/
|
|
39
|
+
onBeforeListConversations?: (context: ChatApiContext) => Promise<boolean> | boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Called before getting a single conversation. Return false to deny access.
|
|
42
|
+
* @param conversationId - ID of the conversation being accessed
|
|
43
|
+
* @param context - Request context with headers, etc.
|
|
44
|
+
*/
|
|
45
|
+
onBeforeGetConversation?: (conversationId: string, context: ChatApiContext) => Promise<boolean> | boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Called before creating a conversation. Return false to deny access.
|
|
48
|
+
* @param data - Conversation data being created
|
|
49
|
+
* @param context - Request context with headers, etc.
|
|
50
|
+
*/
|
|
51
|
+
onBeforeCreateConversation?: (data: {
|
|
52
|
+
id?: string;
|
|
53
|
+
title?: string;
|
|
54
|
+
}, context: ChatApiContext) => Promise<boolean> | boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Called before updating a conversation. Return false to deny access.
|
|
57
|
+
* @param conversationId - ID of the conversation being updated
|
|
58
|
+
* @param data - Updated conversation data
|
|
59
|
+
* @param context - Request context with headers, etc.
|
|
60
|
+
*/
|
|
61
|
+
onBeforeUpdateConversation?: (conversationId: string, data: {
|
|
62
|
+
title?: string;
|
|
63
|
+
}, context: ChatApiContext) => Promise<boolean> | boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Called before deleting a conversation. Return false to deny access.
|
|
66
|
+
* @param conversationId - ID of the conversation being deleted
|
|
67
|
+
* @param context - Request context with headers, etc.
|
|
68
|
+
*/
|
|
69
|
+
onBeforeDeleteConversation?: (conversationId: string, context: ChatApiContext) => Promise<boolean> | boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Called after a chat message is processed successfully
|
|
72
|
+
* @param conversationId - ID of the conversation
|
|
73
|
+
* @param messages - Array of messages in the conversation
|
|
74
|
+
* @param context - Request context
|
|
75
|
+
*/
|
|
76
|
+
onAfterChat?: (conversationId: string, messages: Message[], context: ChatApiContext) => Promise<void> | void;
|
|
77
|
+
/**
|
|
78
|
+
* Called after conversations are read successfully
|
|
79
|
+
* @param conversations - Array of conversations that were read
|
|
80
|
+
* @param context - Request context
|
|
81
|
+
*/
|
|
82
|
+
onConversationsRead?: (conversations: Conversation[], context: ChatApiContext) => Promise<void> | void;
|
|
83
|
+
/**
|
|
84
|
+
* Called after a single conversation is read successfully
|
|
85
|
+
* @param conversation - The conversation with messages
|
|
86
|
+
* @param context - Request context
|
|
87
|
+
*/
|
|
88
|
+
onConversationRead?: (conversation: Conversation & {
|
|
89
|
+
messages: Message[];
|
|
90
|
+
}, context: ChatApiContext) => Promise<void> | void;
|
|
91
|
+
/**
|
|
92
|
+
* Called after a conversation is created successfully
|
|
93
|
+
* @param conversation - The created conversation
|
|
94
|
+
* @param context - Request context
|
|
95
|
+
*/
|
|
96
|
+
onConversationCreated?: (conversation: Conversation, context: ChatApiContext) => Promise<void> | void;
|
|
97
|
+
/**
|
|
98
|
+
* Called after a conversation is updated successfully
|
|
99
|
+
* @param conversation - The updated conversation
|
|
100
|
+
* @param context - Request context
|
|
101
|
+
*/
|
|
102
|
+
onConversationUpdated?: (conversation: Conversation, context: ChatApiContext) => Promise<void> | void;
|
|
103
|
+
/**
|
|
104
|
+
* Called after a conversation is deleted successfully
|
|
105
|
+
* @param conversationId - ID of the deleted conversation
|
|
106
|
+
* @param context - Request context
|
|
107
|
+
*/
|
|
108
|
+
onConversationDeleted?: (conversationId: string, context: ChatApiContext) => Promise<void> | void;
|
|
109
|
+
/**
|
|
110
|
+
* Called when a chat operation fails
|
|
111
|
+
* @param error - The error that occurred
|
|
112
|
+
* @param context - Request context
|
|
113
|
+
*/
|
|
114
|
+
onChatError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
115
|
+
/**
|
|
116
|
+
* Called when listing conversations fails
|
|
117
|
+
* @param error - The error that occurred
|
|
118
|
+
* @param context - Request context
|
|
119
|
+
*/
|
|
120
|
+
onListConversationsError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
121
|
+
/**
|
|
122
|
+
* Called when getting a conversation fails
|
|
123
|
+
* @param error - The error that occurred
|
|
124
|
+
* @param context - Request context
|
|
125
|
+
*/
|
|
126
|
+
onGetConversationError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
127
|
+
/**
|
|
128
|
+
* Called when creating a conversation fails
|
|
129
|
+
* @param error - The error that occurred
|
|
130
|
+
* @param context - Request context
|
|
131
|
+
*/
|
|
132
|
+
onCreateConversationError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
133
|
+
/**
|
|
134
|
+
* Called when updating a conversation fails
|
|
135
|
+
* @param error - The error that occurred
|
|
136
|
+
* @param context - Request context
|
|
137
|
+
*/
|
|
138
|
+
onUpdateConversationError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
139
|
+
/**
|
|
140
|
+
* Called when deleting a conversation fails
|
|
141
|
+
* @param error - The error that occurred
|
|
142
|
+
* @param context - Request context
|
|
143
|
+
*/
|
|
144
|
+
onDeleteConversationError?: (error: Error, context: ChatApiContext) => Promise<void> | void;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Plugin mode for AI Chat
|
|
148
|
+
* - 'authenticated': Conversations persisted with userId (default)
|
|
149
|
+
* - 'public': Stateless chat, no persistence (ideal for public chatbots)
|
|
150
|
+
*/
|
|
151
|
+
type AiChatMode = "authenticated" | "public";
|
|
152
|
+
/**
|
|
153
|
+
* Configuration for AI Chat backend plugin
|
|
154
|
+
*/
|
|
155
|
+
interface AiChatBackendConfig {
|
|
156
|
+
/**
|
|
157
|
+
* The language model to use for chat completions.
|
|
158
|
+
* Supports any model from AI SDK providers (OpenAI, Anthropic, Google, etc.)
|
|
159
|
+
*/
|
|
160
|
+
model: LanguageModel;
|
|
161
|
+
/**
|
|
162
|
+
* Plugin mode:
|
|
163
|
+
* - 'authenticated': Conversations persisted with userId (requires getUserId)
|
|
164
|
+
* - 'public': Stateless chat, no persistence (ideal for public chatbots)
|
|
165
|
+
* @default 'authenticated'
|
|
166
|
+
*/
|
|
167
|
+
mode?: AiChatMode;
|
|
168
|
+
/**
|
|
169
|
+
* Extract userId from request context (authenticated mode only).
|
|
170
|
+
* Return null/undefined to deny access in authenticated mode.
|
|
171
|
+
* This function is called for all conversation operations.
|
|
172
|
+
* @example (ctx) => ctx.headers?.get('x-user-id')
|
|
173
|
+
*/
|
|
174
|
+
getUserId?: (context: ChatApiContext) => string | null | undefined | Promise<string | null | undefined>;
|
|
175
|
+
/**
|
|
176
|
+
* Optional system prompt to prepend to all conversations
|
|
177
|
+
*/
|
|
178
|
+
systemPrompt?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Optional tools to make available to the model.
|
|
181
|
+
* Uses AI SDK v5 tool format.
|
|
182
|
+
* @see https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling
|
|
183
|
+
*/
|
|
184
|
+
tools?: Record<string, Tool>;
|
|
185
|
+
/**
|
|
186
|
+
* Optional hooks for customizing plugin behavior
|
|
187
|
+
*/
|
|
188
|
+
hooks?: AiChatBackendHooks;
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* AI Chat backend plugin
|
|
192
|
+
* Provides API endpoints for AI-powered chat with conversation history
|
|
193
|
+
* Uses AI SDK v5 for model interactions
|
|
194
|
+
*
|
|
195
|
+
* @param config - Configuration including model, tools, and optional hooks
|
|
196
|
+
*/
|
|
197
|
+
declare const aiChatBackendPlugin: (config: AiChatBackendConfig) => _btst_stack_plugins_api.BackendPlugin<{
|
|
198
|
+
chat: {
|
|
199
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
200
|
+
body: {
|
|
201
|
+
messages: ({
|
|
202
|
+
role: "system" | "user" | "assistant" | "data";
|
|
203
|
+
content: string;
|
|
204
|
+
id?: string | undefined;
|
|
205
|
+
} | {
|
|
206
|
+
role: "system" | "user" | "assistant" | "data";
|
|
207
|
+
parts: {
|
|
208
|
+
[x: string]: unknown;
|
|
209
|
+
type: string;
|
|
210
|
+
text?: string | undefined;
|
|
211
|
+
}[];
|
|
212
|
+
id?: string | undefined;
|
|
213
|
+
metadata?: any;
|
|
214
|
+
})[];
|
|
215
|
+
conversationId?: string | undefined;
|
|
216
|
+
model?: string | undefined;
|
|
217
|
+
};
|
|
218
|
+
} & {
|
|
219
|
+
method?: "POST" | undefined;
|
|
220
|
+
} & {
|
|
221
|
+
query?: Record<string, any> | undefined;
|
|
222
|
+
} & {
|
|
223
|
+
params?: Record<string, any>;
|
|
224
|
+
} & {
|
|
225
|
+
request?: Request;
|
|
226
|
+
} & {
|
|
227
|
+
headers?: HeadersInit;
|
|
228
|
+
} & {
|
|
229
|
+
asResponse?: boolean;
|
|
230
|
+
returnHeaders?: boolean;
|
|
231
|
+
use?: better_call.Middleware[];
|
|
232
|
+
path?: string;
|
|
233
|
+
} & {
|
|
234
|
+
asResponse?: AsResponse | undefined;
|
|
235
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
236
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
237
|
+
headers: Headers;
|
|
238
|
+
response: Response;
|
|
239
|
+
} : Response>;
|
|
240
|
+
options: {
|
|
241
|
+
method: "POST";
|
|
242
|
+
body: zod.ZodObject<{
|
|
243
|
+
messages: zod.ZodArray<zod.ZodUnion<readonly [zod.ZodObject<{
|
|
244
|
+
role: zod.ZodEnum<{
|
|
245
|
+
system: "system";
|
|
246
|
+
user: "user";
|
|
247
|
+
assistant: "assistant";
|
|
248
|
+
data: "data";
|
|
249
|
+
}>;
|
|
250
|
+
content: zod.ZodString;
|
|
251
|
+
id: zod.ZodOptional<zod.ZodString>;
|
|
252
|
+
}, zod_v4_core.$strip>, zod.ZodObject<{
|
|
253
|
+
role: zod.ZodEnum<{
|
|
254
|
+
system: "system";
|
|
255
|
+
user: "user";
|
|
256
|
+
assistant: "assistant";
|
|
257
|
+
data: "data";
|
|
258
|
+
}>;
|
|
259
|
+
parts: zod.ZodArray<zod.ZodObject<{
|
|
260
|
+
type: zod.ZodString;
|
|
261
|
+
text: zod.ZodOptional<zod.ZodString>;
|
|
262
|
+
}, zod_v4_core.$loose>>;
|
|
263
|
+
id: zod.ZodOptional<zod.ZodString>;
|
|
264
|
+
metadata: zod.ZodOptional<zod.ZodAny>;
|
|
265
|
+
}, zod_v4_core.$strip>]>>;
|
|
266
|
+
conversationId: zod.ZodOptional<zod.ZodString>;
|
|
267
|
+
model: zod.ZodOptional<zod.ZodString>;
|
|
268
|
+
}, zod_v4_core.$strip>;
|
|
269
|
+
};
|
|
270
|
+
path: "/chat";
|
|
271
|
+
};
|
|
272
|
+
createConversation: {
|
|
273
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
274
|
+
body: {
|
|
275
|
+
id?: string | undefined;
|
|
276
|
+
title?: string | undefined;
|
|
277
|
+
};
|
|
278
|
+
} & {
|
|
279
|
+
method?: "POST" | undefined;
|
|
280
|
+
} & {
|
|
281
|
+
query?: Record<string, any> | undefined;
|
|
282
|
+
} & {
|
|
283
|
+
params?: Record<string, any>;
|
|
284
|
+
} & {
|
|
285
|
+
request?: Request;
|
|
286
|
+
} & {
|
|
287
|
+
headers?: HeadersInit;
|
|
288
|
+
} & {
|
|
289
|
+
asResponse?: boolean;
|
|
290
|
+
returnHeaders?: boolean;
|
|
291
|
+
use?: better_call.Middleware[];
|
|
292
|
+
path?: string;
|
|
293
|
+
} & {
|
|
294
|
+
asResponse?: AsResponse | undefined;
|
|
295
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
296
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
297
|
+
headers: Headers;
|
|
298
|
+
response: Conversation;
|
|
299
|
+
} : Conversation>;
|
|
300
|
+
options: {
|
|
301
|
+
method: "POST";
|
|
302
|
+
body: zod.ZodObject<{
|
|
303
|
+
id: zod.ZodOptional<zod.ZodString>;
|
|
304
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
305
|
+
}, zod_v4_core.$strip>;
|
|
306
|
+
};
|
|
307
|
+
path: "/chat/conversations";
|
|
308
|
+
};
|
|
309
|
+
listConversations: {
|
|
310
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
311
|
+
body?: undefined;
|
|
312
|
+
} & {
|
|
313
|
+
method?: "GET" | undefined;
|
|
314
|
+
} & {
|
|
315
|
+
query?: Record<string, any> | undefined;
|
|
316
|
+
} & {
|
|
317
|
+
params?: Record<string, any>;
|
|
318
|
+
} & {
|
|
319
|
+
request?: Request;
|
|
320
|
+
} & {
|
|
321
|
+
headers?: HeadersInit;
|
|
322
|
+
} & {
|
|
323
|
+
asResponse?: boolean;
|
|
324
|
+
returnHeaders?: boolean;
|
|
325
|
+
use?: better_call.Middleware[];
|
|
326
|
+
path?: string;
|
|
327
|
+
} & {
|
|
328
|
+
asResponse?: AsResponse | undefined;
|
|
329
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
330
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
331
|
+
headers: Headers;
|
|
332
|
+
response: Conversation[];
|
|
333
|
+
} : Conversation[]>;
|
|
334
|
+
options: {
|
|
335
|
+
method: "GET";
|
|
336
|
+
};
|
|
337
|
+
path: "/chat/conversations";
|
|
338
|
+
};
|
|
339
|
+
getConversation: {
|
|
340
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
341
|
+
body?: undefined;
|
|
342
|
+
} & {
|
|
343
|
+
method?: "GET" | undefined;
|
|
344
|
+
} & {
|
|
345
|
+
query?: Record<string, any> | undefined;
|
|
346
|
+
} & {
|
|
347
|
+
params: {
|
|
348
|
+
id: string;
|
|
349
|
+
};
|
|
350
|
+
} & {
|
|
351
|
+
request?: Request;
|
|
352
|
+
} & {
|
|
353
|
+
headers?: HeadersInit;
|
|
354
|
+
} & {
|
|
355
|
+
asResponse?: boolean;
|
|
356
|
+
returnHeaders?: boolean;
|
|
357
|
+
use?: better_call.Middleware[];
|
|
358
|
+
path?: string;
|
|
359
|
+
} & {
|
|
360
|
+
asResponse?: AsResponse | undefined;
|
|
361
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
362
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
363
|
+
headers: Headers;
|
|
364
|
+
response: Conversation & {
|
|
365
|
+
messages: Message[];
|
|
366
|
+
};
|
|
367
|
+
} : Conversation & {
|
|
368
|
+
messages: Message[];
|
|
369
|
+
}>;
|
|
370
|
+
options: {
|
|
371
|
+
method: "GET";
|
|
372
|
+
};
|
|
373
|
+
path: "/chat/conversations/:id";
|
|
374
|
+
};
|
|
375
|
+
updateConversation: {
|
|
376
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
377
|
+
body: {
|
|
378
|
+
title?: string | undefined;
|
|
379
|
+
};
|
|
380
|
+
} & {
|
|
381
|
+
method?: "PUT" | undefined;
|
|
382
|
+
} & {
|
|
383
|
+
query?: Record<string, any> | undefined;
|
|
384
|
+
} & {
|
|
385
|
+
params: {
|
|
386
|
+
id: string;
|
|
387
|
+
};
|
|
388
|
+
} & {
|
|
389
|
+
request?: Request;
|
|
390
|
+
} & {
|
|
391
|
+
headers?: HeadersInit;
|
|
392
|
+
} & {
|
|
393
|
+
asResponse?: boolean;
|
|
394
|
+
returnHeaders?: boolean;
|
|
395
|
+
use?: better_call.Middleware[];
|
|
396
|
+
path?: string;
|
|
397
|
+
} & {
|
|
398
|
+
asResponse?: AsResponse | undefined;
|
|
399
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
400
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
401
|
+
headers: Headers;
|
|
402
|
+
response: Conversation;
|
|
403
|
+
} : Conversation>;
|
|
404
|
+
options: {
|
|
405
|
+
method: "PUT";
|
|
406
|
+
body: zod.ZodObject<{
|
|
407
|
+
title: zod.ZodOptional<zod.ZodString>;
|
|
408
|
+
}, zod_v4_core.$strip>;
|
|
409
|
+
};
|
|
410
|
+
path: "/chat/conversations/:id";
|
|
411
|
+
};
|
|
412
|
+
deleteConversation: {
|
|
413
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
414
|
+
body?: undefined;
|
|
415
|
+
} & {
|
|
416
|
+
method?: "DELETE" | undefined;
|
|
417
|
+
} & {
|
|
418
|
+
query?: Record<string, any> | undefined;
|
|
419
|
+
} & {
|
|
420
|
+
params: {
|
|
421
|
+
id: string;
|
|
422
|
+
};
|
|
423
|
+
} & {
|
|
424
|
+
request?: Request;
|
|
425
|
+
} & {
|
|
426
|
+
headers?: HeadersInit;
|
|
427
|
+
} & {
|
|
428
|
+
asResponse?: boolean;
|
|
429
|
+
returnHeaders?: boolean;
|
|
430
|
+
use?: better_call.Middleware[];
|
|
431
|
+
path?: string;
|
|
432
|
+
} & {
|
|
433
|
+
asResponse?: AsResponse | undefined;
|
|
434
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
435
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
436
|
+
headers: Headers;
|
|
437
|
+
response: {
|
|
438
|
+
success: boolean;
|
|
439
|
+
};
|
|
440
|
+
} : {
|
|
441
|
+
success: boolean;
|
|
442
|
+
}>;
|
|
443
|
+
options: {
|
|
444
|
+
method: "DELETE";
|
|
445
|
+
};
|
|
446
|
+
path: "/chat/conversations/:id";
|
|
447
|
+
};
|
|
448
|
+
}>;
|
|
449
|
+
type AiChatApiRouter = ReturnType<ReturnType<typeof aiChatBackendPlugin>["routes"]>;
|
|
450
|
+
|
|
451
|
+
type ConversationWithMessages = SerializedConversation & {
|
|
452
|
+
messages: SerializedMessage[];
|
|
453
|
+
};
|
|
454
|
+
declare function createAiChatQueryKeys(client: ReturnType<typeof createApiClient<AiChatApiRouter>>, headers?: HeadersInit): {
|
|
455
|
+
conversations: {
|
|
456
|
+
_def: readonly ["conversations"];
|
|
457
|
+
} & {
|
|
458
|
+
list: (() => Omit<{
|
|
459
|
+
queryKey: readonly ["conversations", "list", string];
|
|
460
|
+
queryFn: _tanstack_react_query.QueryFunction<SerializedConversation[], readonly ["conversations", "list", string]>;
|
|
461
|
+
} & {
|
|
462
|
+
_def: readonly ["conversations", "list"];
|
|
463
|
+
}, "_def">) & {
|
|
464
|
+
_def: readonly ["conversations", "list"];
|
|
465
|
+
};
|
|
466
|
+
detail: ((id: string) => Omit<{
|
|
467
|
+
queryKey: readonly ["conversations", "detail", string];
|
|
468
|
+
queryFn: _tanstack_react_query.QueryFunction<ConversationWithMessages | null, readonly ["conversations", "detail", string]>;
|
|
469
|
+
} & {
|
|
470
|
+
_def: readonly ["conversations", "detail"];
|
|
471
|
+
}, "_def">) & {
|
|
472
|
+
_def: readonly ["conversations", "detail"];
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
export { aiChatBackendPlugin as c, createAiChatQueryKeys };
|
|
478
|
+
export type { AiChatBackendHooks as A, ChatApiContext as C, ConversationWithMessages, AiChatMode as a, AiChatBackendConfig as b, AiChatApiRouter as d };
|