@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.
Files changed (241) hide show
  1. package/README.md +85 -37
  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.cjs +2 -2
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. 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
  13. 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
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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
  19. 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
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. 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
  31. 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
  32. 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
  33. 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
  34. 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
  35. 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
  36. 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
  37. 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
  38. 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
  39. 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
  40. 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
  41. 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
  42. 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
  43. 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
  44. 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
  45. 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
  46. 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
  47. 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
  48. package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.cjs +610 -0
  49. package/dist/packages/better-stack/src/plugins/ai-chat/api/plugin.mjs +608 -0
  50. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.cjs +221 -0
  51. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-input.mjs +219 -0
  52. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.cjs +315 -0
  53. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-interface.mjs +313 -0
  54. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.cjs +122 -0
  55. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-layout.mjs +120 -0
  56. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.cjs +397 -0
  57. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-message.mjs +391 -0
  58. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.cjs +227 -0
  59. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/chat-sidebar.mjs +225 -0
  60. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.cjs +31 -0
  61. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.mjs +29 -0
  62. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.cjs +11 -0
  63. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/loading/index.mjs +8 -0
  64. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.cjs +18 -0
  65. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/404-page.mjs +16 -0
  66. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.cjs +39 -0
  67. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.cjs +22 -0
  68. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.internal.mjs +20 -0
  69. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/pages/chat-page.mjs +37 -0
  70. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.cjs +18 -0
  71. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/default-error.mjs +16 -0
  72. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.cjs +26 -0
  73. package/dist/packages/better-stack/src/plugins/ai-chat/client/components/shared/error-placeholder.mjs +24 -0
  74. package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.cjs +199 -0
  75. package/dist/packages/better-stack/src/plugins/ai-chat/client/hooks/chat-hooks.mjs +191 -0
  76. package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.cjs +63 -0
  77. package/dist/packages/better-stack/src/plugins/ai-chat/client/localization/index.mjs +61 -0
  78. package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.cjs +14 -0
  79. package/dist/packages/better-stack/src/plugins/ai-chat/client/overrides.mjs +11 -0
  80. package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.cjs +241 -0
  81. package/dist/packages/better-stack/src/plugins/ai-chat/client/plugin.mjs +239 -0
  82. package/dist/packages/better-stack/src/plugins/ai-chat/db.cjs +65 -0
  83. package/dist/packages/better-stack/src/plugins/ai-chat/db.mjs +63 -0
  84. package/dist/packages/better-stack/src/plugins/ai-chat/schemas.cjs +42 -0
  85. package/dist/packages/better-stack/src/plugins/ai-chat/schemas.mjs +38 -0
  86. package/dist/packages/better-stack/src/plugins/blog/api/plugin.cjs +8 -2
  87. package/dist/packages/better-stack/src/plugins/blog/api/plugin.mjs +8 -2
  88. package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.cjs +1 -1
  89. package/dist/packages/better-stack/src/plugins/blog/client/components/pages/post-page.internal.mjs +1 -1
  90. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.cjs +12 -309
  91. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/markdown-content.mjs +13 -303
  92. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/on-this-page.cjs +1 -1
  93. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/on-this-page.mjs +1 -1
  94. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.cjs +2 -2
  95. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/page-wrapper.mjs +2 -2
  96. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.cjs +2 -2
  97. package/dist/packages/better-stack/src/plugins/blog/client/components/shared/recent-posts-carousel.mjs +2 -2
  98. package/dist/packages/ui/src/components/alert-dialog.cjs +1 -1
  99. package/dist/packages/ui/src/components/alert-dialog.mjs +1 -1
  100. package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.cjs → ui/src/components/better-stack-attribution.cjs} +3 -3
  101. package/dist/packages/{better-stack/src/plugins/blog/client/components/shared/better-blog-attribution.mjs → ui/src/components/better-stack-attribution.mjs} +3 -3
  102. package/dist/packages/ui/src/components/dialog.cjs +14 -0
  103. package/dist/packages/ui/src/components/dialog.mjs +14 -1
  104. package/dist/packages/ui/src/components/dropdown-menu.cjs +67 -0
  105. package/dist/packages/ui/src/components/dropdown-menu.mjs +62 -0
  106. package/dist/packages/ui/src/components/markdown-content.cjs +306 -0
  107. package/dist/packages/ui/src/components/markdown-content.mjs +297 -0
  108. package/dist/packages/ui/src/components/scroll-area.cjs +63 -0
  109. package/dist/packages/ui/src/components/scroll-area.mjs +60 -0
  110. package/dist/packages/ui/src/components/select.cjs +1 -1
  111. package/dist/packages/ui/src/components/select.mjs +1 -1
  112. package/dist/packages/ui/src/components/sheet.cjs +87 -0
  113. package/dist/packages/ui/src/components/sheet.mjs +69 -0
  114. package/dist/plugins/ai-chat/api/index.cjs +9 -0
  115. package/dist/plugins/ai-chat/api/index.d.cts +9 -0
  116. package/dist/plugins/ai-chat/api/index.d.mts +9 -0
  117. package/dist/plugins/ai-chat/api/index.d.ts +9 -0
  118. package/dist/plugins/ai-chat/api/index.mjs +2 -0
  119. package/dist/plugins/ai-chat/client/components/index.cjs +27 -0
  120. package/dist/plugins/ai-chat/client/components/index.d.cts +30 -0
  121. package/dist/plugins/ai-chat/client/components/index.d.mts +30 -0
  122. package/dist/plugins/ai-chat/client/components/index.d.ts +30 -0
  123. package/dist/plugins/ai-chat/client/components/index.mjs +11 -0
  124. package/dist/plugins/ai-chat/client/hooks/index.cjs +13 -0
  125. package/dist/plugins/ai-chat/client/hooks/index.d.cts +98 -0
  126. package/dist/plugins/ai-chat/client/hooks/index.d.mts +98 -0
  127. package/dist/plugins/ai-chat/client/hooks/index.d.ts +98 -0
  128. package/dist/plugins/ai-chat/client/hooks/index.mjs +1 -0
  129. package/dist/plugins/ai-chat/client/index.cjs +19 -0
  130. package/dist/plugins/ai-chat/client/index.d.cts +327 -0
  131. package/dist/plugins/ai-chat/client/index.d.mts +327 -0
  132. package/dist/plugins/ai-chat/client/index.d.ts +327 -0
  133. package/dist/plugins/ai-chat/client/index.mjs +7 -0
  134. package/dist/plugins/ai-chat/client.css +6 -0
  135. package/dist/plugins/ai-chat/query-keys.cjs +60 -0
  136. package/dist/plugins/ai-chat/query-keys.d.cts +478 -0
  137. package/dist/plugins/ai-chat/query-keys.d.mts +478 -0
  138. package/dist/plugins/ai-chat/query-keys.d.ts +478 -0
  139. package/dist/plugins/ai-chat/query-keys.mjs +58 -0
  140. package/dist/plugins/ai-chat/style.css +19 -0
  141. package/dist/plugins/blog/api/index.d.cts +1 -1
  142. package/dist/plugins/blog/api/index.d.mts +1 -1
  143. package/dist/plugins/blog/api/index.d.ts +1 -1
  144. package/dist/plugins/blog/client/components/shared/markdown-content-styles.css +85 -62
  145. package/dist/plugins/blog/client/hooks/index.d.cts +2 -2
  146. package/dist/plugins/blog/client/hooks/index.d.mts +2 -2
  147. package/dist/plugins/blog/client/hooks/index.d.ts +2 -2
  148. package/dist/plugins/blog/client/index.d.cts +1 -1
  149. package/dist/plugins/blog/client/index.d.mts +1 -1
  150. package/dist/plugins/blog/client/index.d.ts +1 -1
  151. package/dist/plugins/blog/query-keys.d.cts +2 -2
  152. package/dist/plugins/blog/query-keys.d.mts +2 -2
  153. package/dist/plugins/blog/query-keys.d.ts +2 -2
  154. package/dist/shared/stack.Be1QIHEn.d.cts +23 -0
  155. package/dist/shared/stack.Be1QIHEn.d.mts +23 -0
  156. package/dist/shared/stack.Be1QIHEn.d.ts +23 -0
  157. package/dist/shared/stack.DorMi9CZ.d.cts +80 -0
  158. package/dist/shared/stack.DorMi9CZ.d.mts +80 -0
  159. package/dist/shared/stack.DorMi9CZ.d.ts +80 -0
  160. package/package.json +61 -3
  161. package/src/plugins/ai-chat/api/index.ts +2 -0
  162. package/src/plugins/ai-chat/api/plugin.ts +1083 -0
  163. package/src/plugins/ai-chat/client/components/chat-input.tsx +295 -0
  164. package/src/plugins/ai-chat/client/components/chat-interface.tsx +455 -0
  165. package/src/plugins/ai-chat/client/components/chat-layout.tsx +160 -0
  166. package/src/plugins/ai-chat/client/components/chat-message.tsx +505 -0
  167. package/src/plugins/ai-chat/client/components/chat-sidebar.tsx +296 -0
  168. package/src/plugins/ai-chat/client/components/index.ts +16 -0
  169. package/src/plugins/ai-chat/client/components/loading/chat-page-skeleton.tsx +57 -0
  170. package/src/plugins/ai-chat/client/components/loading/index.tsx +11 -0
  171. package/src/plugins/ai-chat/client/components/pages/404-page.tsx +27 -0
  172. package/src/plugins/ai-chat/client/components/pages/chat-page.internal.tsx +31 -0
  173. package/src/plugins/ai-chat/client/components/pages/chat-page.tsx +46 -0
  174. package/src/plugins/ai-chat/client/components/shared/default-error.tsx +28 -0
  175. package/src/plugins/ai-chat/client/components/shared/error-placeholder.tsx +22 -0
  176. package/src/plugins/ai-chat/client/hooks/chat-hooks.tsx +349 -0
  177. package/src/plugins/ai-chat/client/hooks/index.tsx +1 -0
  178. package/src/plugins/ai-chat/client/index.ts +14 -0
  179. package/src/plugins/ai-chat/client/localization/index.ts +156 -0
  180. package/src/plugins/ai-chat/client/overrides.ts +170 -0
  181. package/src/plugins/ai-chat/client/plugin.tsx +449 -0
  182. package/src/plugins/ai-chat/client.css +6 -0
  183. package/src/plugins/ai-chat/db.ts +65 -0
  184. package/src/plugins/ai-chat/query-keys.ts +87 -0
  185. package/src/plugins/ai-chat/schemas.ts +40 -0
  186. package/src/plugins/ai-chat/style.css +19 -0
  187. package/src/plugins/ai-chat/types.ts +29 -0
  188. package/src/plugins/blog/api/plugin.ts +10 -4
  189. package/src/plugins/blog/client/components/pages/post-page.internal.tsx +1 -1
  190. package/src/plugins/blog/client/components/shared/markdown-content-styles.css +85 -62
  191. package/src/plugins/blog/client/components/shared/markdown-content.tsx +19 -427
  192. package/src/plugins/blog/client/components/shared/on-this-page.tsx +1 -1
  193. package/src/plugins/blog/client/components/shared/page-wrapper.tsx +2 -2
  194. package/src/plugins/blog/client/components/shared/recent-posts-carousel.tsx +2 -2
  195. 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
  196. package/src/plugins/blog/client/components/shared/better-blog-attribution.tsx +0 -19
  197. 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
  198. 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
  199. 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
  200. 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
  201. 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
  202. 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
  203. 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
  204. 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
  205. 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
  206. 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
  207. 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
  208. 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
  209. 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
  210. 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
  211. 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
  212. 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
  213. 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
  214. 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
  215. 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
  216. 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
  217. 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
  218. 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
  219. 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
  220. 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
  221. 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
  222. 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
  223. 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
  224. 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
  225. 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
  226. 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
  227. 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
  228. 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
  229. 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
  230. 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
  231. 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
  232. 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
  233. 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
  234. 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
  235. 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
  236. 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
  237. 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
  238. 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
  239. package/dist/shared/{stack.DLhzx1-D.d.ts → stack.CcI4sYJP.d.cts} +1 -1
  240. package/dist/shared/{stack.DLhzx1-D.d.cts → stack.CcI4sYJP.d.mts} +1 -1
  241. package/dist/shared/{stack.DLhzx1-D.d.mts → stack.CcI4sYJP.d.ts} +1 -1
@@ -0,0 +1,296 @@
1
+ "use client";
2
+
3
+ import { useState } from "react";
4
+ import { Button } from "@workspace/ui/components/button";
5
+ import { Input } from "@workspace/ui/components/input";
6
+ import { ScrollArea } from "@workspace/ui/components/scroll-area";
7
+ import {
8
+ DropdownMenu,
9
+ DropdownMenuContent,
10
+ DropdownMenuItem,
11
+ DropdownMenuTrigger,
12
+ } from "@workspace/ui/components/dropdown-menu";
13
+ import {
14
+ AlertDialog,
15
+ AlertDialogAction,
16
+ AlertDialogCancel,
17
+ AlertDialogContent,
18
+ AlertDialogDescription,
19
+ AlertDialogFooter,
20
+ AlertDialogHeader,
21
+ AlertDialogTitle,
22
+ } from "@workspace/ui/components/alert-dialog";
23
+ import {
24
+ Dialog,
25
+ DialogContent,
26
+ DialogFooter,
27
+ DialogHeader,
28
+ DialogTitle,
29
+ } from "@workspace/ui/components/dialog";
30
+ import {
31
+ MessageSquarePlus,
32
+ MoreHorizontal,
33
+ Pencil,
34
+ Trash2,
35
+ MessageSquare,
36
+ } from "lucide-react";
37
+ import { cn } from "@workspace/ui/lib/utils";
38
+ import { usePluginOverrides, useBasePath } from "@btst/stack/context";
39
+ import type { AiChatPluginOverrides } from "../overrides";
40
+ import type { SerializedConversation } from "../../types";
41
+ import {
42
+ useConversations,
43
+ useRenameConversation,
44
+ useDeleteConversation,
45
+ } from "../hooks/chat-hooks";
46
+ import { AI_CHAT_LOCALIZATION } from "../localization";
47
+
48
+ interface ChatSidebarProps {
49
+ currentConversationId?: string;
50
+ onNewChat?: () => void;
51
+ className?: string;
52
+ }
53
+
54
+ export function ChatSidebar({
55
+ currentConversationId,
56
+ onNewChat,
57
+ className,
58
+ }: ChatSidebarProps) {
59
+ const { navigate, localization: customLocalization } = usePluginOverrides<
60
+ AiChatPluginOverrides,
61
+ Partial<AiChatPluginOverrides>
62
+ >("ai-chat", {});
63
+ const basePath = useBasePath();
64
+
65
+ const localization = { ...AI_CHAT_LOCALIZATION, ...customLocalization };
66
+
67
+ const { conversations, isLoading } = useConversations();
68
+ const renameMutation = useRenameConversation();
69
+ const deleteMutation = useDeleteConversation();
70
+
71
+ const [renameDialogOpen, setRenameDialogOpen] = useState(false);
72
+ const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
73
+ const [selectedConversation, setSelectedConversation] =
74
+ useState<SerializedConversation | null>(null);
75
+ const [newTitle, setNewTitle] = useState("");
76
+
77
+ const handleNewChat = () => {
78
+ // Always use overrides navigation when available, so consumers control routing.
79
+ // Also run onNewChat to support "reset chat" behavior when already on /chat.
80
+ if (navigate) {
81
+ navigate(`${basePath}/chat`);
82
+ }
83
+ if (onNewChat) {
84
+ onNewChat();
85
+ }
86
+ };
87
+
88
+ const handleConversationClick = (conversation: SerializedConversation) => {
89
+ if (navigate) {
90
+ navigate(`${basePath}/chat/${conversation.id}`);
91
+ }
92
+ };
93
+
94
+ const handleRenameClick = (conversation: SerializedConversation) => {
95
+ setSelectedConversation(conversation);
96
+ setNewTitle(conversation.title);
97
+ setRenameDialogOpen(true);
98
+ };
99
+
100
+ const handleDeleteClick = (conversation: SerializedConversation) => {
101
+ setSelectedConversation(conversation);
102
+ setDeleteDialogOpen(true);
103
+ };
104
+
105
+ const handleRenameConfirm = async () => {
106
+ if (selectedConversation && newTitle.trim()) {
107
+ await renameMutation.mutateAsync({
108
+ id: selectedConversation.id,
109
+ title: newTitle.trim(),
110
+ });
111
+ setRenameDialogOpen(false);
112
+ setSelectedConversation(null);
113
+ setNewTitle("");
114
+ }
115
+ };
116
+
117
+ const handleDeleteConfirm = async () => {
118
+ if (selectedConversation) {
119
+ await deleteMutation.mutateAsync({ id: selectedConversation.id });
120
+ setDeleteDialogOpen(false);
121
+ setSelectedConversation(null);
122
+ // Navigate away if deleted current conversation
123
+ if (selectedConversation.id === currentConversationId && navigate) {
124
+ navigate(`${basePath}/chat`);
125
+ }
126
+ }
127
+ };
128
+
129
+ const formatDate = (dateString: string) => {
130
+ const date = new Date(dateString);
131
+ const now = new Date();
132
+ const diffMs = now.getTime() - date.getTime();
133
+ const diffMins = Math.floor(diffMs / 60000);
134
+ const diffHours = Math.floor(diffMs / 3600000);
135
+ const diffDays = Math.floor(diffMs / 86400000);
136
+
137
+ if (diffMins < 1) return localization.TIME_JUST_NOW;
138
+ if (diffMins < 60)
139
+ return localization.TIME_MINUTES_AGO.replace("{count}", String(diffMins));
140
+ if (diffHours < 24)
141
+ return localization.TIME_HOURS_AGO.replace("{count}", String(diffHours));
142
+ if (diffDays === 1) return localization.TIME_YESTERDAY;
143
+ if (diffDays < 7)
144
+ return localization.TIME_DAYS_AGO.replace("{count}", String(diffDays));
145
+ return date.toLocaleDateString();
146
+ };
147
+
148
+ return (
149
+ <div className={cn("flex flex-col h-full bg-muted/30 border-r", className)}>
150
+ {/* Header */}
151
+ <div className="p-4 border-b">
152
+ <Button
153
+ onClick={handleNewChat}
154
+ className="w-full justify-start gap-2"
155
+ variant="outline"
156
+ >
157
+ <MessageSquarePlus className="h-4 w-4" />
158
+ {localization.SIDEBAR_NEW_CHAT}
159
+ </Button>
160
+ </div>
161
+
162
+ {/* Conversations List */}
163
+ <ScrollArea className="flex-1">
164
+ <div className="p-2">
165
+ {isLoading ? (
166
+ <div className="p-4 text-center text-sm text-muted-foreground">
167
+ {localization.CHAT_LOADING}
168
+ </div>
169
+ ) : conversations.length === 0 ? (
170
+ <div className="p-4 text-center text-sm text-muted-foreground">
171
+ {localization.SIDEBAR_NO_CONVERSATIONS}
172
+ </div>
173
+ ) : (
174
+ <div className="space-y-1">
175
+ {conversations.map((conversation) => (
176
+ <div
177
+ key={conversation.id}
178
+ className={cn(
179
+ "group flex items-center gap-2 rounded-lg px-3 py-2 hover:bg-accent cursor-pointer transition-colors overflow-hidden",
180
+ currentConversationId === conversation.id && "bg-accent",
181
+ )}
182
+ >
183
+ <button
184
+ type="button"
185
+ className="flex-1 flex items-center gap-2 text-left min-w-0 overflow-hidden"
186
+ onClick={() => handleConversationClick(conversation)}
187
+ >
188
+ <MessageSquare className="h-4 w-4 shrink-0 text-muted-foreground" />
189
+ <div className="flex-1 min-w-0 overflow-hidden">
190
+ <p className="text-sm font-medium truncate">
191
+ {conversation.title}
192
+ </p>
193
+ <p className="text-xs text-muted-foreground truncate">
194
+ {formatDate(conversation.updatedAt)}
195
+ </p>
196
+ </div>
197
+ </button>
198
+ <DropdownMenu>
199
+ <DropdownMenuTrigger asChild>
200
+ <Button
201
+ variant="ghost"
202
+ size="icon"
203
+ className="h-8 w-8 opacity-0 group-hover:opacity-100 transition-opacity"
204
+ >
205
+ <MoreHorizontal className="h-4 w-4" />
206
+ </Button>
207
+ </DropdownMenuTrigger>
208
+ <DropdownMenuContent align="end">
209
+ <DropdownMenuItem
210
+ onClick={(e) => {
211
+ e.stopPropagation();
212
+ handleRenameClick(conversation);
213
+ }}
214
+ >
215
+ <Pencil className="h-4 w-4 mr-2" />
216
+ {localization.CONVERSATION_RENAME}
217
+ </DropdownMenuItem>
218
+ <DropdownMenuItem
219
+ onClick={(e) => {
220
+ e.stopPropagation();
221
+ handleDeleteClick(conversation);
222
+ }}
223
+ className="text-destructive focus:text-destructive"
224
+ >
225
+ <Trash2 className="h-4 w-4 mr-2" />
226
+ {localization.CONVERSATION_DELETE}
227
+ </DropdownMenuItem>
228
+ </DropdownMenuContent>
229
+ </DropdownMenu>
230
+ </div>
231
+ ))}
232
+ </div>
233
+ )}
234
+ </div>
235
+ </ScrollArea>
236
+
237
+ {/* Rename Dialog */}
238
+ <Dialog open={renameDialogOpen} onOpenChange={setRenameDialogOpen}>
239
+ <DialogContent>
240
+ <DialogHeader>
241
+ <DialogTitle>{localization.CONVERSATION_RENAME}</DialogTitle>
242
+ </DialogHeader>
243
+ <Input
244
+ value={newTitle}
245
+ onChange={(e) => setNewTitle(e.target.value)}
246
+ placeholder={localization.CONVERSATION_RENAME_PLACEHOLDER}
247
+ onKeyDown={(e) => {
248
+ if (e.key === "Enter") {
249
+ void handleRenameConfirm();
250
+ }
251
+ }}
252
+ />
253
+ <DialogFooter>
254
+ <Button
255
+ variant="outline"
256
+ onClick={() => setRenameDialogOpen(false)}
257
+ >
258
+ {localization.CONVERSATION_RENAME_CANCEL}
259
+ </Button>
260
+ <Button
261
+ onClick={handleRenameConfirm}
262
+ disabled={!newTitle.trim() || renameMutation.isPending}
263
+ >
264
+ {localization.CONVERSATION_RENAME_SAVE}
265
+ </Button>
266
+ </DialogFooter>
267
+ </DialogContent>
268
+ </Dialog>
269
+
270
+ {/* Delete Confirmation Dialog */}
271
+ <AlertDialog open={deleteDialogOpen} onOpenChange={setDeleteDialogOpen}>
272
+ <AlertDialogContent>
273
+ <AlertDialogHeader>
274
+ <AlertDialogTitle>
275
+ {localization.CONVERSATION_DELETE_CONFIRM_TITLE}
276
+ </AlertDialogTitle>
277
+ <AlertDialogDescription>
278
+ {localization.CONVERSATION_DELETE_CONFIRM_DESCRIPTION}
279
+ </AlertDialogDescription>
280
+ </AlertDialogHeader>
281
+ <AlertDialogFooter>
282
+ <AlertDialogCancel>
283
+ {localization.CONVERSATION_DELETE_CANCEL}
284
+ </AlertDialogCancel>
285
+ <AlertDialogAction
286
+ onClick={handleDeleteConfirm}
287
+ className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
288
+ >
289
+ {localization.CONVERSATION_DELETE_CONFIRM_BUTTON}
290
+ </AlertDialogAction>
291
+ </AlertDialogFooter>
292
+ </AlertDialogContent>
293
+ </AlertDialog>
294
+ </div>
295
+ );
296
+ }
@@ -0,0 +1,16 @@
1
+ export { ChatInterface } from "./chat-interface";
2
+ export { ChatLayout } from "./chat-layout";
3
+ export { ChatSidebar } from "./chat-sidebar";
4
+ export { ChatMessage } from "./chat-message";
5
+ export { ChatInput } from "./chat-input";
6
+
7
+ // Page components
8
+ export { ChatPageComponent } from "./pages/chat-page";
9
+
10
+ // Loading components
11
+ export { ChatLoading, ChatPageSkeleton } from "./loading";
12
+
13
+ // Shared components
14
+ export { DefaultError } from "./shared/default-error";
15
+ export { ErrorPlaceholder } from "./shared/error-placeholder";
16
+ export { NotFoundPage } from "./pages/404-page";
@@ -0,0 +1,57 @@
1
+ "use client";
2
+
3
+ import { Skeleton } from "@workspace/ui/components/skeleton";
4
+
5
+ /**
6
+ * Skeleton loading state for the chat page
7
+ */
8
+ export function ChatPageSkeleton() {
9
+ return (
10
+ <div className="flex h-[calc(100vh-4rem)] w-full overflow-hidden">
11
+ {/* Sidebar skeleton */}
12
+ <div className="hidden md:flex w-72 flex-col border-r bg-muted/30">
13
+ <div className="p-4 border-b">
14
+ <Skeleton className="h-10 w-full" />
15
+ </div>
16
+ <div className="flex-1 p-2 space-y-2">
17
+ {Array.from({ length: 5 }).map((_, i) => (
18
+ <div key={i} className="flex items-center gap-2 p-3">
19
+ <Skeleton className="h-4 w-4 shrink-0" />
20
+ <div className="flex-1 space-y-1.5">
21
+ <Skeleton className="h-4 w-full" />
22
+ <Skeleton className="h-3 w-20" />
23
+ </div>
24
+ </div>
25
+ ))}
26
+ </div>
27
+ </div>
28
+
29
+ {/* Main chat area skeleton */}
30
+ <div className="flex-1 flex flex-col min-w-0">
31
+ {/* Header */}
32
+ <div className="flex items-center gap-2 p-2 border-b">
33
+ <Skeleton className="h-9 w-9 md:hidden" />
34
+ <Skeleton className="h-9 w-9 hidden md:block" />
35
+ <div className="flex-1" />
36
+ </div>
37
+
38
+ {/* Messages area */}
39
+ <div className="flex-1 p-4 space-y-4">
40
+ <div className="max-w-3xl mx-auto w-full space-y-4">
41
+ {/* Empty state placeholder */}
42
+ <div className="flex flex-col items-center justify-center h-full min-h-[300px]">
43
+ <Skeleton className="h-4 w-48" />
44
+ </div>
45
+ </div>
46
+ </div>
47
+
48
+ {/* Input area */}
49
+ <div className="border-t p-4">
50
+ <div className="max-w-3xl mx-auto">
51
+ <Skeleton className="h-12 w-full rounded-lg" />
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </div>
56
+ );
57
+ }
@@ -0,0 +1,11 @@
1
+ import { ChatPageSkeleton } from "./chat-page-skeleton";
2
+
3
+ export function ChatLoading() {
4
+ return (
5
+ <div data-testid="chat-skeleton">
6
+ <ChatPageSkeleton />
7
+ </div>
8
+ );
9
+ }
10
+
11
+ export { ChatPageSkeleton };
@@ -0,0 +1,27 @@
1
+ "use client";
2
+
3
+ import { usePluginOverrides } from "@btst/stack/context";
4
+ import { ErrorPlaceholder } from "../shared/error-placeholder";
5
+ import { AI_CHAT_LOCALIZATION } from "../../localization";
6
+ import type { AiChatPluginOverrides } from "../../overrides";
7
+
8
+ export function NotFoundPage({ message }: { message?: string }) {
9
+ const { localization } = usePluginOverrides<
10
+ AiChatPluginOverrides,
11
+ Partial<AiChatPluginOverrides>
12
+ >("ai-chat", {
13
+ localization: AI_CHAT_LOCALIZATION,
14
+ });
15
+ const title =
16
+ localization?.CHAT_PAGE_NOT_FOUND_TITLE ??
17
+ AI_CHAT_LOCALIZATION.CHAT_PAGE_NOT_FOUND_TITLE;
18
+ const desc =
19
+ message ||
20
+ (localization?.CHAT_PAGE_NOT_FOUND_DESCRIPTION ??
21
+ AI_CHAT_LOCALIZATION.CHAT_PAGE_NOT_FOUND_DESCRIPTION);
22
+ return (
23
+ <div data-testid="404-page" className="flex flex-col h-[calc(100vh-4rem)]">
24
+ <ErrorPlaceholder title={title} message={desc} />
25
+ </div>
26
+ );
27
+ }
@@ -0,0 +1,31 @@
1
+ "use client";
2
+
3
+ import { ChatLayout } from "../chat-layout";
4
+ import { usePluginOverrides } from "@btst/stack/context";
5
+ import type { AiChatPluginOverrides } from "../../overrides";
6
+
7
+ export interface ChatPageProps {
8
+ conversationId?: string;
9
+ }
10
+
11
+ /**
12
+ * Internal chat page component - loaded lazily by ChatPageComponent
13
+ */
14
+ export function ChatPage({ conversationId }: ChatPageProps) {
15
+ const { apiBaseURL, apiBasePath, mode } = usePluginOverrides<
16
+ AiChatPluginOverrides,
17
+ Partial<AiChatPluginOverrides>
18
+ >("ai-chat", {});
19
+
20
+ // In public mode, don't show sidebar
21
+ const showSidebar = mode !== "public";
22
+
23
+ return (
24
+ <ChatLayout
25
+ apiBaseURL={apiBaseURL ?? ""}
26
+ apiBasePath={apiBasePath ?? ""}
27
+ conversationId={conversationId}
28
+ showSidebar={showSidebar}
29
+ />
30
+ );
31
+ }
@@ -0,0 +1,46 @@
1
+ "use client";
2
+
3
+ import { lazy } from "react";
4
+ import { usePluginOverrides } from "@btst/stack/context";
5
+ import type { AiChatPluginOverrides } from "../../overrides";
6
+ import { ComposedRoute } from "@btst/stack/client/components";
7
+ import { DefaultError } from "../shared/default-error";
8
+ import { ChatLoading } from "../loading";
9
+ import { NotFoundPage } from "./404-page";
10
+
11
+ // Lazy load the internal component with actual page content
12
+ const ChatPage = lazy(() =>
13
+ import("./chat-page.internal").then((m) => ({ default: m.ChatPage })),
14
+ );
15
+
16
+ export interface ChatPageComponentProps {
17
+ conversationId?: string;
18
+ }
19
+
20
+ // Exported wrapped component with error and loading boundaries
21
+ export function ChatPageComponent({ conversationId }: ChatPageComponentProps) {
22
+ const { onRouteError } = usePluginOverrides<
23
+ AiChatPluginOverrides,
24
+ Partial<AiChatPluginOverrides>
25
+ >("ai-chat", {});
26
+
27
+ return (
28
+ <ComposedRoute
29
+ path={conversationId ? `/chat/${conversationId}` : "/chat"}
30
+ PageComponent={ChatPage}
31
+ ErrorComponent={DefaultError}
32
+ LoadingComponent={ChatLoading}
33
+ NotFoundComponent={NotFoundPage}
34
+ props={{ conversationId }}
35
+ onError={(error) => {
36
+ if (onRouteError) {
37
+ onRouteError(conversationId ? "chatConversation" : "chat", error, {
38
+ path: conversationId ? `/chat/${conversationId}` : "/chat",
39
+ isSSR: typeof window === "undefined",
40
+ params: conversationId ? { id: conversationId } : undefined,
41
+ });
42
+ }
43
+ }}
44
+ />
45
+ );
46
+ }
@@ -0,0 +1,28 @@
1
+ "use client";
2
+
3
+ import type { FallbackProps } from "react-error-boundary";
4
+ import { ErrorPlaceholder } from "./error-placeholder";
5
+ import { usePluginOverrides } from "@btst/stack/context";
6
+ import { AI_CHAT_LOCALIZATION } from "../../localization";
7
+ import type { AiChatPluginOverrides } from "../../overrides";
8
+
9
+ // Default error component for AI chat plugin routes
10
+ export function DefaultError({ error }: FallbackProps) {
11
+ const { localization } = usePluginOverrides<
12
+ AiChatPluginOverrides,
13
+ Partial<AiChatPluginOverrides>
14
+ >("ai-chat", {
15
+ localization: AI_CHAT_LOCALIZATION,
16
+ });
17
+ const title =
18
+ localization?.CHAT_GENERIC_ERROR_TITLE ??
19
+ AI_CHAT_LOCALIZATION.CHAT_GENERIC_ERROR_TITLE;
20
+ const message =
21
+ process.env.NODE_ENV === "production"
22
+ ? (localization?.CHAT_GENERIC_ERROR_MESSAGE ??
23
+ AI_CHAT_LOCALIZATION.CHAT_GENERIC_ERROR_MESSAGE)
24
+ : (error?.message ??
25
+ localization?.CHAT_GENERIC_ERROR_MESSAGE ??
26
+ AI_CHAT_LOCALIZATION.CHAT_GENERIC_ERROR_MESSAGE);
27
+ return <ErrorPlaceholder title={title} message={message} />;
28
+ }
@@ -0,0 +1,22 @@
1
+ import { CloudAlert } from "lucide-react";
2
+
3
+ export function ErrorPlaceholder({
4
+ title,
5
+ message,
6
+ }: {
7
+ title: string;
8
+ message: string;
9
+ }) {
10
+ return (
11
+ <div
12
+ className="flex min-h-[400px] flex-col items-center justify-center gap-6 p-8"
13
+ data-testid="error-placeholder"
14
+ >
15
+ <CloudAlert className="size-16 text-muted-foreground" />
16
+ <div className="text-center space-y-2">
17
+ <h2 className="text-xl font-semibold">{title}</h2>
18
+ <p className="text-muted-foreground max-w-md">{message}</p>
19
+ </div>
20
+ </div>
21
+ );
22
+ }