@btst/stack 1.3.0 → 1.4.0
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-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-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 +315 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs +313 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.cjs +122 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs +120 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.cjs +397 -0
- package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs +391 -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/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/api/plugin.cjs +8 -2
- package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +8 -2
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +1 -1
- package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +1 -1
- 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/on-this-page.cjs +1 -1
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/on-this-page.mjs +1 -1
- 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/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.cjs +2 -2
- package/dist/packages/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.mjs +2 -2
- 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 +27 -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 +11 -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 +19 -0
- package/dist/plugins/ai-chat/client/index.d.cts +327 -0
- package/dist/plugins/ai-chat/client/index.d.mts +327 -0
- package/dist/plugins/ai-chat/client/index.d.ts +327 -0
- package/dist/plugins/ai-chat/client/index.mjs +7 -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 +85 -62
- package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
- package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
- 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 +2 -2
- package/dist/plugins/blog/query-keys.d.mts +2 -2
- package/dist/plugins/blog/query-keys.d.ts +2 -2
- 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.DorMi9CZ.d.cts +80 -0
- package/dist/shared/stack.DorMi9CZ.d.mts +80 -0
- package/dist/shared/stack.DorMi9CZ.d.ts +80 -0
- package/package.json +61 -3
- 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 +455 -0
- package/src/plugins/ai-chat/client/components/chat-layout.tsx +160 -0
- package/src/plugins/ai-chat/client/components/chat-message.tsx +505 -0
- package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +296 -0
- package/src/plugins/ai-chat/client/components/index.ts +16 -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/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 +14 -0
- package/src/plugins/ai-chat/client/localization/index.ts +156 -0
- package/src/plugins/ai-chat/client/overrides.ts +170 -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/api/plugin.ts +10 -4
- package/src/plugins/blog/client/components/pages/post-page.internal.tsx +1 -1
- package/src/plugins/blog/client/components/shared/markdown-content-styles.css +85 -62
- package/src/plugins/blog/client/components/shared/markdown-content.tsx +19 -427
- package/src/plugins/blog/client/components/shared/on-this-page.tsx +1 -1
- package/src/plugins/blog/client/components/shared/page-wrapper.tsx +2 -2
- package/src/plugins/blog/client/components/shared/recent-posts-carousel.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.DLhzx1-D.d.ts → stack.CcI4sYJP.d.cts} +1 -1
- package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.mts} +1 -1
- package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.ts} +1 -1
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ComponentType } from 'react';
|
|
4
|
+
import * as _btst_yar from '@btst/yar';
|
|
5
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
+
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.mjs';
|
|
7
|
+
export { d as ChatInput, C as ChatInterface, a as ChatLayout, c as ChatMessage, b as ChatSidebar } from '../../../shared/stack.DorMi9CZ.mjs';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import 'ai';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* AI Chat plugin localization strings
|
|
13
|
+
*/
|
|
14
|
+
interface AiChatLocalization {
|
|
15
|
+
CHAT_PLACEHOLDER: string;
|
|
16
|
+
CHAT_SEND_BUTTON: string;
|
|
17
|
+
CHAT_EMPTY_STATE: string;
|
|
18
|
+
CHAT_LOADING: string;
|
|
19
|
+
CHAT_ERROR: string;
|
|
20
|
+
CHAT_RETRY: string;
|
|
21
|
+
CHAT_GENERIC_ERROR_TITLE: string;
|
|
22
|
+
CHAT_GENERIC_ERROR_MESSAGE: string;
|
|
23
|
+
CHAT_PAGE_NOT_FOUND_TITLE: string;
|
|
24
|
+
CHAT_PAGE_NOT_FOUND_DESCRIPTION: string;
|
|
25
|
+
SIDEBAR_TITLE: string;
|
|
26
|
+
SIDEBAR_NEW_CHAT: string;
|
|
27
|
+
SIDEBAR_NO_CONVERSATIONS: string;
|
|
28
|
+
SIDEBAR_SEARCH_PLACEHOLDER: string;
|
|
29
|
+
CONVERSATION_RENAME: string;
|
|
30
|
+
CONVERSATION_RENAME_PLACEHOLDER: string;
|
|
31
|
+
CONVERSATION_RENAME_SAVE: string;
|
|
32
|
+
CONVERSATION_RENAME_CANCEL: string;
|
|
33
|
+
CONVERSATION_DELETE: string;
|
|
34
|
+
CONVERSATION_DELETE_CONFIRM_TITLE: string;
|
|
35
|
+
CONVERSATION_DELETE_CONFIRM_DESCRIPTION: string;
|
|
36
|
+
CONVERSATION_DELETE_CONFIRM_BUTTON: string;
|
|
37
|
+
CONVERSATION_DELETE_CANCEL: string;
|
|
38
|
+
IMAGE_UPLOAD_BUTTON: string;
|
|
39
|
+
IMAGE_UPLOAD_UPLOADING: string;
|
|
40
|
+
IMAGE_UPLOAD_ERROR_NOT_IMAGE: string;
|
|
41
|
+
IMAGE_UPLOAD_ERROR_TOO_LARGE: string;
|
|
42
|
+
IMAGE_UPLOAD_SUCCESS: string;
|
|
43
|
+
IMAGE_UPLOAD_FAILURE: string;
|
|
44
|
+
FILE_UPLOAD_BUTTON: string;
|
|
45
|
+
FILE_UPLOAD_ERROR_TOO_LARGE: string;
|
|
46
|
+
FILE_UPLOAD_SUCCESS: string;
|
|
47
|
+
FILE_UPLOAD_FAILURE: string;
|
|
48
|
+
TIME_JUST_NOW: string;
|
|
49
|
+
TIME_MINUTES_AGO: string;
|
|
50
|
+
TIME_HOURS_AGO: string;
|
|
51
|
+
TIME_YESTERDAY: string;
|
|
52
|
+
TIME_DAYS_AGO: string;
|
|
53
|
+
MESSAGE_COPY: string;
|
|
54
|
+
MESSAGE_COPIED: string;
|
|
55
|
+
MESSAGE_RETRY: string;
|
|
56
|
+
MESSAGE_EDIT: string;
|
|
57
|
+
MESSAGE_SAVE: string;
|
|
58
|
+
MESSAGE_CANCEL: string;
|
|
59
|
+
A11Y_USER_MESSAGE: string;
|
|
60
|
+
A11Y_ASSISTANT_MESSAGE: string;
|
|
61
|
+
A11Y_COPY_CODE: string;
|
|
62
|
+
A11Y_CODE_COPIED: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Plugin mode for AI Chat
|
|
67
|
+
* - 'authenticated': Conversations persisted with userId (default)
|
|
68
|
+
* - 'public': Stateless chat, no persistence (ideal for public chatbots)
|
|
69
|
+
*/
|
|
70
|
+
type AiChatMode = "authenticated" | "public";
|
|
71
|
+
/**
|
|
72
|
+
* Allowed file type categories for uploads
|
|
73
|
+
*/
|
|
74
|
+
type AllowedFileType = "image" | "text" | "pdf" | "markdown" | "csv" | "json";
|
|
75
|
+
/**
|
|
76
|
+
* Default allowed file types (images only for best AI model compatibility)
|
|
77
|
+
* Consumers can expand this by passing allowedFileTypes in overrides
|
|
78
|
+
*/
|
|
79
|
+
declare const DEFAULT_ALLOWED_FILE_TYPES: AllowedFileType[];
|
|
80
|
+
/**
|
|
81
|
+
* Context passed to lifecycle hooks
|
|
82
|
+
*/
|
|
83
|
+
interface RouteContext$1 {
|
|
84
|
+
/** Current route path */
|
|
85
|
+
path: string;
|
|
86
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
87
|
+
params?: Record<string, string>;
|
|
88
|
+
/** Whether rendering on server (true) or client (false) */
|
|
89
|
+
isSSR: boolean;
|
|
90
|
+
/** Additional context properties */
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Overridable components and functions for the AI Chat plugin
|
|
95
|
+
*
|
|
96
|
+
* External consumers can provide their own implementations of these
|
|
97
|
+
* to customize the behavior for their framework (Next.js, React Router, etc.)
|
|
98
|
+
*/
|
|
99
|
+
interface AiChatPluginOverrides {
|
|
100
|
+
/**
|
|
101
|
+
* Plugin mode - should match backend config
|
|
102
|
+
* @default 'authenticated'
|
|
103
|
+
*/
|
|
104
|
+
mode?: AiChatMode;
|
|
105
|
+
/**
|
|
106
|
+
* API base URL
|
|
107
|
+
*/
|
|
108
|
+
apiBaseURL: string;
|
|
109
|
+
/**
|
|
110
|
+
* API base path
|
|
111
|
+
*/
|
|
112
|
+
apiBasePath: string;
|
|
113
|
+
/**
|
|
114
|
+
* Navigation function for programmatic navigation
|
|
115
|
+
*/
|
|
116
|
+
navigate: (path: string) => void | Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Refresh function to invalidate server-side cache (e.g., Next.js router.refresh())
|
|
119
|
+
*/
|
|
120
|
+
refresh?: () => void | Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Link component for navigation
|
|
123
|
+
*/
|
|
124
|
+
Link?: ComponentType<React.ComponentProps<"a"> & Record<string, any>>;
|
|
125
|
+
/**
|
|
126
|
+
* Image component for displaying images
|
|
127
|
+
*/
|
|
128
|
+
Image?: ComponentType<React.ImgHTMLAttributes<HTMLImageElement> & Record<string, any>>;
|
|
129
|
+
/**
|
|
130
|
+
* Function used to upload a file and return its URL.
|
|
131
|
+
* Called for images, PDFs, text files, and other supported file types.
|
|
132
|
+
*/
|
|
133
|
+
uploadFile?: (file: File) => Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Allowed file types for upload.
|
|
136
|
+
* By default, all types are enabled: image, text, pdf, markdown, csv, json
|
|
137
|
+
* Set to empty array to disable file uploads entirely.
|
|
138
|
+
* @default ['image', 'text', 'pdf', 'markdown', 'csv', 'json']
|
|
139
|
+
*/
|
|
140
|
+
allowedFileTypes?: AllowedFileType[];
|
|
141
|
+
/**
|
|
142
|
+
* Localization object for the AI Chat plugin
|
|
143
|
+
*/
|
|
144
|
+
localization?: Partial<AiChatLocalization>;
|
|
145
|
+
/**
|
|
146
|
+
* Optional headers to pass with API requests (e.g., for SSR auth)
|
|
147
|
+
*/
|
|
148
|
+
headers?: HeadersInit;
|
|
149
|
+
/**
|
|
150
|
+
* Whether to show the attribution
|
|
151
|
+
* @default true
|
|
152
|
+
*/
|
|
153
|
+
showAttribution?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Called when a route is rendered
|
|
156
|
+
* @param routeName - Name of the route (e.g., 'chat', 'chatConversation')
|
|
157
|
+
* @param context - Route context with path, params, etc.
|
|
158
|
+
*/
|
|
159
|
+
onRouteRender?: (routeName: string, context: RouteContext$1) => void | Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Called when a route encounters an error
|
|
162
|
+
* @param routeName - Name of the route
|
|
163
|
+
* @param error - The error that occurred
|
|
164
|
+
* @param context - Route context
|
|
165
|
+
*/
|
|
166
|
+
onRouteError?: (routeName: string, error: Error, context: RouteContext$1) => void | Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Called before the chat page is rendered
|
|
169
|
+
* Return false to prevent rendering (e.g., for authorization)
|
|
170
|
+
* @param context - Route context
|
|
171
|
+
*/
|
|
172
|
+
onBeforeChatPageRendered?: (context: RouteContext$1) => boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Called before a conversation page is rendered
|
|
175
|
+
* Return false to prevent rendering (e.g., for authorization)
|
|
176
|
+
* @param id - The conversation ID
|
|
177
|
+
* @param context - Route context
|
|
178
|
+
*/
|
|
179
|
+
onBeforeConversationPageRendered?: (id: string, context: RouteContext$1) => boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Context passed to route hooks
|
|
184
|
+
*/
|
|
185
|
+
interface RouteContext {
|
|
186
|
+
/** Current route path */
|
|
187
|
+
path: string;
|
|
188
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
189
|
+
params?: Record<string, string>;
|
|
190
|
+
/** Whether rendering on server (true) or client (false) */
|
|
191
|
+
isSSR: boolean;
|
|
192
|
+
/** Additional context properties */
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Context passed to loader hooks
|
|
197
|
+
*/
|
|
198
|
+
interface LoaderContext {
|
|
199
|
+
/** Current route path */
|
|
200
|
+
path: string;
|
|
201
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
202
|
+
params?: Record<string, string>;
|
|
203
|
+
/** Whether rendering on server (true) or client (false) */
|
|
204
|
+
isSSR: boolean;
|
|
205
|
+
/** Base URL for API calls */
|
|
206
|
+
apiBaseURL: string;
|
|
207
|
+
/** Path where the API is mounted */
|
|
208
|
+
apiBasePath: string;
|
|
209
|
+
/** Optional headers for the request */
|
|
210
|
+
headers?: Headers;
|
|
211
|
+
/** Additional context properties */
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Configuration for AI Chat client plugin
|
|
216
|
+
*/
|
|
217
|
+
interface AiChatClientConfig {
|
|
218
|
+
/** Base URL for API calls (e.g., "http://localhost:3000") */
|
|
219
|
+
apiBaseURL: string;
|
|
220
|
+
/** Path where the API is mounted (e.g., "/api/data") */
|
|
221
|
+
apiBasePath: string;
|
|
222
|
+
/** Base URL of your site for SEO meta tags */
|
|
223
|
+
siteBaseURL: string;
|
|
224
|
+
/** Path where pages are mounted (e.g., "/pages") */
|
|
225
|
+
siteBasePath: string;
|
|
226
|
+
/** React Query client instance for caching */
|
|
227
|
+
queryClient: QueryClient;
|
|
228
|
+
/**
|
|
229
|
+
* Plugin mode - should match backend config
|
|
230
|
+
* - 'authenticated': Full chat with conversation history (default)
|
|
231
|
+
* - 'public': Simple widget mode, no persistence, no sidebar
|
|
232
|
+
* @default 'authenticated'
|
|
233
|
+
*/
|
|
234
|
+
mode?: AiChatMode;
|
|
235
|
+
/** Optional SEO configuration for meta tags */
|
|
236
|
+
seo?: {
|
|
237
|
+
/** Site name for Open Graph tags */
|
|
238
|
+
siteName?: string;
|
|
239
|
+
/** Default description */
|
|
240
|
+
description?: string;
|
|
241
|
+
/** Locale for Open Graph (e.g., "en_US") */
|
|
242
|
+
locale?: string;
|
|
243
|
+
/** Default image URL for social sharing */
|
|
244
|
+
defaultImage?: string;
|
|
245
|
+
};
|
|
246
|
+
/** Optional hooks for customizing behavior */
|
|
247
|
+
hooks?: AiChatClientHooks;
|
|
248
|
+
/** Optional headers for SSR (e.g., forwarding cookies) */
|
|
249
|
+
headers?: Headers;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Hooks for AI Chat client plugin
|
|
253
|
+
* All hooks are optional and allow consumers to customize behavior
|
|
254
|
+
*/
|
|
255
|
+
interface AiChatClientHooks {
|
|
256
|
+
/**
|
|
257
|
+
* Called before loading conversations list. Return false to cancel loading.
|
|
258
|
+
* @param context - Loader context with path, params, etc.
|
|
259
|
+
*/
|
|
260
|
+
beforeLoadConversations?: (context: LoaderContext) => Promise<boolean> | boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Called after conversations are loaded. Return false to cancel further processing.
|
|
263
|
+
* @param conversations - Array of loaded conversations or null
|
|
264
|
+
* @param context - Loader context
|
|
265
|
+
*/
|
|
266
|
+
afterLoadConversations?: (conversations: SerializedConversation[] | null, context: LoaderContext) => Promise<boolean> | boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Called before loading a single conversation. Return false to cancel loading.
|
|
269
|
+
* @param id - Conversation ID being loaded
|
|
270
|
+
* @param context - Loader context
|
|
271
|
+
*/
|
|
272
|
+
beforeLoadConversation?: (id: string, context: LoaderContext) => Promise<boolean> | boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Called after a conversation is loaded. Return false to cancel further processing.
|
|
275
|
+
* @param conversation - Loaded conversation or null if not found
|
|
276
|
+
* @param id - Conversation ID that was requested
|
|
277
|
+
* @param context - Loader context
|
|
278
|
+
*/
|
|
279
|
+
afterLoadConversation?: (conversation: (SerializedConversation & {
|
|
280
|
+
messages: SerializedMessage[];
|
|
281
|
+
}) | null, id: string, context: LoaderContext) => Promise<boolean> | boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Called when a loading error occurs
|
|
284
|
+
* @param error - The error that occurred
|
|
285
|
+
* @param context - Loader context
|
|
286
|
+
*/
|
|
287
|
+
onLoadError?: (error: Error, context: LoaderContext) => Promise<void> | void;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* AI Chat client plugin
|
|
291
|
+
* Provides routes, components, and React Query hooks for AI chat
|
|
292
|
+
*
|
|
293
|
+
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
294
|
+
*/
|
|
295
|
+
declare const aiChatClientPlugin: (config: AiChatClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
|
|
296
|
+
chat: {
|
|
297
|
+
(inputCtx_0?: _btst_yar.InputContext<"/chat", _btst_yar.RouteOptions> | undefined): {
|
|
298
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
299
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
300
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
301
|
+
loader?: (() => Promise<void>) | undefined;
|
|
302
|
+
meta?: (() => ({
|
|
303
|
+
title: string;
|
|
304
|
+
name?: undefined;
|
|
305
|
+
content?: undefined;
|
|
306
|
+
property?: undefined;
|
|
307
|
+
} | {
|
|
308
|
+
name: string;
|
|
309
|
+
content: string;
|
|
310
|
+
title?: undefined;
|
|
311
|
+
property?: undefined;
|
|
312
|
+
} | {
|
|
313
|
+
property: string;
|
|
314
|
+
content: string;
|
|
315
|
+
title?: undefined;
|
|
316
|
+
name?: undefined;
|
|
317
|
+
})[]) | undefined;
|
|
318
|
+
extra?: (() => any) | undefined;
|
|
319
|
+
};
|
|
320
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
321
|
+
path: "/chat";
|
|
322
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
323
|
+
};
|
|
324
|
+
}>;
|
|
325
|
+
|
|
326
|
+
export { DEFAULT_ALLOWED_FILE_TYPES, aiChatClientPlugin };
|
|
327
|
+
export type { AiChatClientConfig, AiChatClientHooks, AiChatPluginOverrides, AllowedFileType, LoaderContext, RouteContext };
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import * as _btst_stack_plugins_client from '@btst/stack/plugins/client';
|
|
2
|
+
import * as react from 'react';
|
|
3
|
+
import { ComponentType } from 'react';
|
|
4
|
+
import * as _btst_yar from '@btst/yar';
|
|
5
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
6
|
+
import { S as SerializedConversation, a as SerializedMessage } from '../../../shared/stack.Be1QIHEn.js';
|
|
7
|
+
export { d as ChatInput, C as ChatInterface, a as ChatLayout, c as ChatMessage, b as ChatSidebar } from '../../../shared/stack.DorMi9CZ.js';
|
|
8
|
+
import 'react/jsx-runtime';
|
|
9
|
+
import 'ai';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* AI Chat plugin localization strings
|
|
13
|
+
*/
|
|
14
|
+
interface AiChatLocalization {
|
|
15
|
+
CHAT_PLACEHOLDER: string;
|
|
16
|
+
CHAT_SEND_BUTTON: string;
|
|
17
|
+
CHAT_EMPTY_STATE: string;
|
|
18
|
+
CHAT_LOADING: string;
|
|
19
|
+
CHAT_ERROR: string;
|
|
20
|
+
CHAT_RETRY: string;
|
|
21
|
+
CHAT_GENERIC_ERROR_TITLE: string;
|
|
22
|
+
CHAT_GENERIC_ERROR_MESSAGE: string;
|
|
23
|
+
CHAT_PAGE_NOT_FOUND_TITLE: string;
|
|
24
|
+
CHAT_PAGE_NOT_FOUND_DESCRIPTION: string;
|
|
25
|
+
SIDEBAR_TITLE: string;
|
|
26
|
+
SIDEBAR_NEW_CHAT: string;
|
|
27
|
+
SIDEBAR_NO_CONVERSATIONS: string;
|
|
28
|
+
SIDEBAR_SEARCH_PLACEHOLDER: string;
|
|
29
|
+
CONVERSATION_RENAME: string;
|
|
30
|
+
CONVERSATION_RENAME_PLACEHOLDER: string;
|
|
31
|
+
CONVERSATION_RENAME_SAVE: string;
|
|
32
|
+
CONVERSATION_RENAME_CANCEL: string;
|
|
33
|
+
CONVERSATION_DELETE: string;
|
|
34
|
+
CONVERSATION_DELETE_CONFIRM_TITLE: string;
|
|
35
|
+
CONVERSATION_DELETE_CONFIRM_DESCRIPTION: string;
|
|
36
|
+
CONVERSATION_DELETE_CONFIRM_BUTTON: string;
|
|
37
|
+
CONVERSATION_DELETE_CANCEL: string;
|
|
38
|
+
IMAGE_UPLOAD_BUTTON: string;
|
|
39
|
+
IMAGE_UPLOAD_UPLOADING: string;
|
|
40
|
+
IMAGE_UPLOAD_ERROR_NOT_IMAGE: string;
|
|
41
|
+
IMAGE_UPLOAD_ERROR_TOO_LARGE: string;
|
|
42
|
+
IMAGE_UPLOAD_SUCCESS: string;
|
|
43
|
+
IMAGE_UPLOAD_FAILURE: string;
|
|
44
|
+
FILE_UPLOAD_BUTTON: string;
|
|
45
|
+
FILE_UPLOAD_ERROR_TOO_LARGE: string;
|
|
46
|
+
FILE_UPLOAD_SUCCESS: string;
|
|
47
|
+
FILE_UPLOAD_FAILURE: string;
|
|
48
|
+
TIME_JUST_NOW: string;
|
|
49
|
+
TIME_MINUTES_AGO: string;
|
|
50
|
+
TIME_HOURS_AGO: string;
|
|
51
|
+
TIME_YESTERDAY: string;
|
|
52
|
+
TIME_DAYS_AGO: string;
|
|
53
|
+
MESSAGE_COPY: string;
|
|
54
|
+
MESSAGE_COPIED: string;
|
|
55
|
+
MESSAGE_RETRY: string;
|
|
56
|
+
MESSAGE_EDIT: string;
|
|
57
|
+
MESSAGE_SAVE: string;
|
|
58
|
+
MESSAGE_CANCEL: string;
|
|
59
|
+
A11Y_USER_MESSAGE: string;
|
|
60
|
+
A11Y_ASSISTANT_MESSAGE: string;
|
|
61
|
+
A11Y_COPY_CODE: string;
|
|
62
|
+
A11Y_CODE_COPIED: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Plugin mode for AI Chat
|
|
67
|
+
* - 'authenticated': Conversations persisted with userId (default)
|
|
68
|
+
* - 'public': Stateless chat, no persistence (ideal for public chatbots)
|
|
69
|
+
*/
|
|
70
|
+
type AiChatMode = "authenticated" | "public";
|
|
71
|
+
/**
|
|
72
|
+
* Allowed file type categories for uploads
|
|
73
|
+
*/
|
|
74
|
+
type AllowedFileType = "image" | "text" | "pdf" | "markdown" | "csv" | "json";
|
|
75
|
+
/**
|
|
76
|
+
* Default allowed file types (images only for best AI model compatibility)
|
|
77
|
+
* Consumers can expand this by passing allowedFileTypes in overrides
|
|
78
|
+
*/
|
|
79
|
+
declare const DEFAULT_ALLOWED_FILE_TYPES: AllowedFileType[];
|
|
80
|
+
/**
|
|
81
|
+
* Context passed to lifecycle hooks
|
|
82
|
+
*/
|
|
83
|
+
interface RouteContext$1 {
|
|
84
|
+
/** Current route path */
|
|
85
|
+
path: string;
|
|
86
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
87
|
+
params?: Record<string, string>;
|
|
88
|
+
/** Whether rendering on server (true) or client (false) */
|
|
89
|
+
isSSR: boolean;
|
|
90
|
+
/** Additional context properties */
|
|
91
|
+
[key: string]: any;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Overridable components and functions for the AI Chat plugin
|
|
95
|
+
*
|
|
96
|
+
* External consumers can provide their own implementations of these
|
|
97
|
+
* to customize the behavior for their framework (Next.js, React Router, etc.)
|
|
98
|
+
*/
|
|
99
|
+
interface AiChatPluginOverrides {
|
|
100
|
+
/**
|
|
101
|
+
* Plugin mode - should match backend config
|
|
102
|
+
* @default 'authenticated'
|
|
103
|
+
*/
|
|
104
|
+
mode?: AiChatMode;
|
|
105
|
+
/**
|
|
106
|
+
* API base URL
|
|
107
|
+
*/
|
|
108
|
+
apiBaseURL: string;
|
|
109
|
+
/**
|
|
110
|
+
* API base path
|
|
111
|
+
*/
|
|
112
|
+
apiBasePath: string;
|
|
113
|
+
/**
|
|
114
|
+
* Navigation function for programmatic navigation
|
|
115
|
+
*/
|
|
116
|
+
navigate: (path: string) => void | Promise<void>;
|
|
117
|
+
/**
|
|
118
|
+
* Refresh function to invalidate server-side cache (e.g., Next.js router.refresh())
|
|
119
|
+
*/
|
|
120
|
+
refresh?: () => void | Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Link component for navigation
|
|
123
|
+
*/
|
|
124
|
+
Link?: ComponentType<React.ComponentProps<"a"> & Record<string, any>>;
|
|
125
|
+
/**
|
|
126
|
+
* Image component for displaying images
|
|
127
|
+
*/
|
|
128
|
+
Image?: ComponentType<React.ImgHTMLAttributes<HTMLImageElement> & Record<string, any>>;
|
|
129
|
+
/**
|
|
130
|
+
* Function used to upload a file and return its URL.
|
|
131
|
+
* Called for images, PDFs, text files, and other supported file types.
|
|
132
|
+
*/
|
|
133
|
+
uploadFile?: (file: File) => Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Allowed file types for upload.
|
|
136
|
+
* By default, all types are enabled: image, text, pdf, markdown, csv, json
|
|
137
|
+
* Set to empty array to disable file uploads entirely.
|
|
138
|
+
* @default ['image', 'text', 'pdf', 'markdown', 'csv', 'json']
|
|
139
|
+
*/
|
|
140
|
+
allowedFileTypes?: AllowedFileType[];
|
|
141
|
+
/**
|
|
142
|
+
* Localization object for the AI Chat plugin
|
|
143
|
+
*/
|
|
144
|
+
localization?: Partial<AiChatLocalization>;
|
|
145
|
+
/**
|
|
146
|
+
* Optional headers to pass with API requests (e.g., for SSR auth)
|
|
147
|
+
*/
|
|
148
|
+
headers?: HeadersInit;
|
|
149
|
+
/**
|
|
150
|
+
* Whether to show the attribution
|
|
151
|
+
* @default true
|
|
152
|
+
*/
|
|
153
|
+
showAttribution?: boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Called when a route is rendered
|
|
156
|
+
* @param routeName - Name of the route (e.g., 'chat', 'chatConversation')
|
|
157
|
+
* @param context - Route context with path, params, etc.
|
|
158
|
+
*/
|
|
159
|
+
onRouteRender?: (routeName: string, context: RouteContext$1) => void | Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Called when a route encounters an error
|
|
162
|
+
* @param routeName - Name of the route
|
|
163
|
+
* @param error - The error that occurred
|
|
164
|
+
* @param context - Route context
|
|
165
|
+
*/
|
|
166
|
+
onRouteError?: (routeName: string, error: Error, context: RouteContext$1) => void | Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Called before the chat page is rendered
|
|
169
|
+
* Return false to prevent rendering (e.g., for authorization)
|
|
170
|
+
* @param context - Route context
|
|
171
|
+
*/
|
|
172
|
+
onBeforeChatPageRendered?: (context: RouteContext$1) => boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Called before a conversation page is rendered
|
|
175
|
+
* Return false to prevent rendering (e.g., for authorization)
|
|
176
|
+
* @param id - The conversation ID
|
|
177
|
+
* @param context - Route context
|
|
178
|
+
*/
|
|
179
|
+
onBeforeConversationPageRendered?: (id: string, context: RouteContext$1) => boolean;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Context passed to route hooks
|
|
184
|
+
*/
|
|
185
|
+
interface RouteContext {
|
|
186
|
+
/** Current route path */
|
|
187
|
+
path: string;
|
|
188
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
189
|
+
params?: Record<string, string>;
|
|
190
|
+
/** Whether rendering on server (true) or client (false) */
|
|
191
|
+
isSSR: boolean;
|
|
192
|
+
/** Additional context properties */
|
|
193
|
+
[key: string]: any;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Context passed to loader hooks
|
|
197
|
+
*/
|
|
198
|
+
interface LoaderContext {
|
|
199
|
+
/** Current route path */
|
|
200
|
+
path: string;
|
|
201
|
+
/** Route parameters (e.g., { id: "abc123" }) */
|
|
202
|
+
params?: Record<string, string>;
|
|
203
|
+
/** Whether rendering on server (true) or client (false) */
|
|
204
|
+
isSSR: boolean;
|
|
205
|
+
/** Base URL for API calls */
|
|
206
|
+
apiBaseURL: string;
|
|
207
|
+
/** Path where the API is mounted */
|
|
208
|
+
apiBasePath: string;
|
|
209
|
+
/** Optional headers for the request */
|
|
210
|
+
headers?: Headers;
|
|
211
|
+
/** Additional context properties */
|
|
212
|
+
[key: string]: any;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Configuration for AI Chat client plugin
|
|
216
|
+
*/
|
|
217
|
+
interface AiChatClientConfig {
|
|
218
|
+
/** Base URL for API calls (e.g., "http://localhost:3000") */
|
|
219
|
+
apiBaseURL: string;
|
|
220
|
+
/** Path where the API is mounted (e.g., "/api/data") */
|
|
221
|
+
apiBasePath: string;
|
|
222
|
+
/** Base URL of your site for SEO meta tags */
|
|
223
|
+
siteBaseURL: string;
|
|
224
|
+
/** Path where pages are mounted (e.g., "/pages") */
|
|
225
|
+
siteBasePath: string;
|
|
226
|
+
/** React Query client instance for caching */
|
|
227
|
+
queryClient: QueryClient;
|
|
228
|
+
/**
|
|
229
|
+
* Plugin mode - should match backend config
|
|
230
|
+
* - 'authenticated': Full chat with conversation history (default)
|
|
231
|
+
* - 'public': Simple widget mode, no persistence, no sidebar
|
|
232
|
+
* @default 'authenticated'
|
|
233
|
+
*/
|
|
234
|
+
mode?: AiChatMode;
|
|
235
|
+
/** Optional SEO configuration for meta tags */
|
|
236
|
+
seo?: {
|
|
237
|
+
/** Site name for Open Graph tags */
|
|
238
|
+
siteName?: string;
|
|
239
|
+
/** Default description */
|
|
240
|
+
description?: string;
|
|
241
|
+
/** Locale for Open Graph (e.g., "en_US") */
|
|
242
|
+
locale?: string;
|
|
243
|
+
/** Default image URL for social sharing */
|
|
244
|
+
defaultImage?: string;
|
|
245
|
+
};
|
|
246
|
+
/** Optional hooks for customizing behavior */
|
|
247
|
+
hooks?: AiChatClientHooks;
|
|
248
|
+
/** Optional headers for SSR (e.g., forwarding cookies) */
|
|
249
|
+
headers?: Headers;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Hooks for AI Chat client plugin
|
|
253
|
+
* All hooks are optional and allow consumers to customize behavior
|
|
254
|
+
*/
|
|
255
|
+
interface AiChatClientHooks {
|
|
256
|
+
/**
|
|
257
|
+
* Called before loading conversations list. Return false to cancel loading.
|
|
258
|
+
* @param context - Loader context with path, params, etc.
|
|
259
|
+
*/
|
|
260
|
+
beforeLoadConversations?: (context: LoaderContext) => Promise<boolean> | boolean;
|
|
261
|
+
/**
|
|
262
|
+
* Called after conversations are loaded. Return false to cancel further processing.
|
|
263
|
+
* @param conversations - Array of loaded conversations or null
|
|
264
|
+
* @param context - Loader context
|
|
265
|
+
*/
|
|
266
|
+
afterLoadConversations?: (conversations: SerializedConversation[] | null, context: LoaderContext) => Promise<boolean> | boolean;
|
|
267
|
+
/**
|
|
268
|
+
* Called before loading a single conversation. Return false to cancel loading.
|
|
269
|
+
* @param id - Conversation ID being loaded
|
|
270
|
+
* @param context - Loader context
|
|
271
|
+
*/
|
|
272
|
+
beforeLoadConversation?: (id: string, context: LoaderContext) => Promise<boolean> | boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Called after a conversation is loaded. Return false to cancel further processing.
|
|
275
|
+
* @param conversation - Loaded conversation or null if not found
|
|
276
|
+
* @param id - Conversation ID that was requested
|
|
277
|
+
* @param context - Loader context
|
|
278
|
+
*/
|
|
279
|
+
afterLoadConversation?: (conversation: (SerializedConversation & {
|
|
280
|
+
messages: SerializedMessage[];
|
|
281
|
+
}) | null, id: string, context: LoaderContext) => Promise<boolean> | boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Called when a loading error occurs
|
|
284
|
+
* @param error - The error that occurred
|
|
285
|
+
* @param context - Loader context
|
|
286
|
+
*/
|
|
287
|
+
onLoadError?: (error: Error, context: LoaderContext) => Promise<void> | void;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* AI Chat client plugin
|
|
291
|
+
* Provides routes, components, and React Query hooks for AI chat
|
|
292
|
+
*
|
|
293
|
+
* @param config - Configuration including queryClient, baseURL, and optional hooks
|
|
294
|
+
*/
|
|
295
|
+
declare const aiChatClientPlugin: (config: AiChatClientConfig) => _btst_stack_plugins_client.ClientPlugin<Record<string, never>, {
|
|
296
|
+
chat: {
|
|
297
|
+
(inputCtx_0?: _btst_yar.InputContext<"/chat", _btst_yar.RouteOptions> | undefined): {
|
|
298
|
+
PageComponent?: react.ComponentType<unknown> | undefined;
|
|
299
|
+
LoadingComponent?: react.ComponentType<unknown> | undefined;
|
|
300
|
+
ErrorComponent?: react.ComponentType<unknown> | undefined;
|
|
301
|
+
loader?: (() => Promise<void>) | undefined;
|
|
302
|
+
meta?: (() => ({
|
|
303
|
+
title: string;
|
|
304
|
+
name?: undefined;
|
|
305
|
+
content?: undefined;
|
|
306
|
+
property?: undefined;
|
|
307
|
+
} | {
|
|
308
|
+
name: string;
|
|
309
|
+
content: string;
|
|
310
|
+
title?: undefined;
|
|
311
|
+
property?: undefined;
|
|
312
|
+
} | {
|
|
313
|
+
property: string;
|
|
314
|
+
content: string;
|
|
315
|
+
title?: undefined;
|
|
316
|
+
name?: undefined;
|
|
317
|
+
})[]) | undefined;
|
|
318
|
+
extra?: (() => any) | undefined;
|
|
319
|
+
};
|
|
320
|
+
options: _btst_yar.RouteOptions | undefined;
|
|
321
|
+
path: "/chat";
|
|
322
|
+
meta: _btst_yar.RouteMeta | undefined;
|
|
323
|
+
};
|
|
324
|
+
}>;
|
|
325
|
+
|
|
326
|
+
export { DEFAULT_ALLOWED_FILE_TYPES, aiChatClientPlugin };
|
|
327
|
+
export type { AiChatClientConfig, AiChatClientHooks, AiChatPluginOverrides, AllowedFileType, LoaderContext, RouteContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { aiChatClientPlugin } from '../../../packages/better-stack/src/plugins/ai-chat/client/plugin.mjs';
|
|
2
|
+
export { DEFAULT_ALLOWED_FILE_TYPES } from '../../../packages/better-stack/src/plugins/ai-chat/client/overrides.mjs';
|
|
3
|
+
export { ChatInterface } from '../../../packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs';
|
|
4
|
+
export { ChatLayout } from '../../../packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs';
|
|
5
|
+
export { ChatSidebar } from '../../../packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs';
|
|
6
|
+
export { ChatMessage } from '../../../packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs';
|
|
7
|
+
export { ChatInput } from '../../../packages/better-stack/src/plugins/ai-chat/client/components/chat-input.mjs';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* AI Chat Plugin Client Styles */
|
|
2
|
+
/* NOTE:
|
|
3
|
+
* Markdown + syntax highlighting styles are imported from code (TS/TSX),
|
|
4
|
+
* matching the blog plugin approach. This avoids brittle nested @import
|
|
5
|
+
* resolution when consumers import `@btst/stack/plugins/ai-chat/css`.
|
|
6
|
+
*/
|