wadi 1.0.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 (294) hide show
  1. package/.agent/workflows/auto_sync.md +19 -0
  2. package/.agent/workflows/kivo_pipeline.md +27 -0
  3. package/.devcontainer/devcontainer.json +27 -0
  4. package/.github/workflows/kivo-cicd.yml +45 -0
  5. package/.github/workflows/monorepo-ci.yml +51 -0
  6. package/.github/workflows/wadi-ci.yml +38 -0
  7. package/.husky/pre-commit +2 -0
  8. package/.prettierignore +12 -0
  9. package/.prettierrc +9 -0
  10. package/.vscode/settings.json +19 -0
  11. package/CHANGELOG.md +56 -0
  12. package/CODE_OF_CONDUCT.md +43 -0
  13. package/CONTRIBUTING.md +42 -0
  14. package/DEPLOY_GUIDE.md +143 -0
  15. package/GO_LIVE_CHECKLIST.md +41 -0
  16. package/GO_LIVE_COMPLETE_REPORT.md +58 -0
  17. package/GO_LIVE_VALIDATION.md +39 -0
  18. package/LEGAL.md +38 -0
  19. package/MANIFESTO.md +40 -0
  20. package/MANUAL.md +82 -0
  21. package/OPS_PLAN.md +90 -0
  22. package/README.md +126 -0
  23. package/RELEASE_NOTES.md +51 -0
  24. package/ROADMAP.md +51 -0
  25. package/api_listado.txt +2197 -0
  26. package/apps/api/WADI_PROTOCOL.md +52 -0
  27. package/apps/api/debug-brain.js +11 -0
  28. package/apps/api/package.json +21 -0
  29. package/apps/api/src/core/analisis.js +17 -0
  30. package/apps/api/src/core/errors.js +31 -0
  31. package/apps/api/src/core/logger.js +32 -0
  32. package/apps/api/src/core/prompt-kivo.js +62 -0
  33. package/apps/api/src/index.js +212 -0
  34. package/apps/api/src/layers/human_pattern/composeResponse.js +35 -0
  35. package/apps/api/src/layers/human_pattern/detectPattern.js +39 -0
  36. package/apps/api/src/layers/human_pattern/heuristics.js +28 -0
  37. package/apps/api/src/layers/human_pattern/index.js +28 -0
  38. package/apps/api/src/layers/human_pattern/socialMemory.js +35 -0
  39. package/apps/api/src/middleware/errorHandler.js +24 -0
  40. package/apps/api/src/middleware/rateLimiter.js +38 -0
  41. package/apps/api/src/middleware/requestLogger.js +31 -0
  42. package/apps/api/src/middleware/upload.js +21 -0
  43. package/apps/api/src/middleware/validation.js +70 -0
  44. package/apps/api/src/modules/data.js +25 -0
  45. package/apps/api/src/modules/marketing.js +54 -0
  46. package/apps/api/src/modules/projects.js +40 -0
  47. package/apps/api/src/openai.js +16 -0
  48. package/apps/api/src/preferences/index.js +20 -0
  49. package/apps/api/src/register_user.js +22 -0
  50. package/apps/api/src/routes/kivo.js +58 -0
  51. package/apps/api/src/routes/monitoring.js +55 -0
  52. package/apps/api/src/routes.js +656 -0
  53. package/apps/api/src/supabase.js +17 -0
  54. package/apps/api/src/tools/index.js +57 -0
  55. package/apps/api/src/wadi-brain.js +171 -0
  56. package/apps/api/supabase/migrations/20251218_audit_logs.sql +27 -0
  57. package/apps/api/supabase/migrations/v2-chat-persistence.sql +83 -0
  58. package/apps/api/supabase/migrations/v3-cascade-delete.sql +11 -0
  59. package/apps/api/supabase/migrations/v3-security-fix.sql +90 -0
  60. package/apps/api/supabase/migrations/v3-storage.sql +36 -0
  61. package/apps/api/supabase/migrations/v4-gamification.sql +83 -0
  62. package/apps/api/supabase/migrations/v5-smoke-index.sql +6 -0
  63. package/apps/api/supabase/migrations/v6-schema-integrity-fix.sql +98 -0
  64. package/apps/api/supabase/migrations/v7-performance-indexes.sql +5 -0
  65. package/apps/api/supabase/migrations/v7-security-hardening.sql +132 -0
  66. package/apps/api/supabase/migrations/v8-security-hardening.sql +79 -0
  67. package/apps/api/test_human_pattern.js +30 -0
  68. package/apps/api/test_human_pattern_vague.js +30 -0
  69. package/apps/api/test_output.txt +76 -0
  70. package/apps/api/test_vague.js +30 -0
  71. package/apps/api/test_vague_block.js +30 -0
  72. package/apps/api/test_wadi.js +31 -0
  73. package/apps/api/tsconfig.json +13 -0
  74. package/apps/frontend/.env.local +3 -0
  75. package/apps/frontend/README.md +73 -0
  76. package/apps/frontend/eslint.config.js +27 -0
  77. package/apps/frontend/index.html +49 -0
  78. package/apps/frontend/package.json +41 -0
  79. package/apps/frontend/postcss.config.cjs +6 -0
  80. package/apps/frontend/public/cursors/wadi-neutral.svg +1 -0
  81. package/apps/frontend/public/cursors/wadi-select.svg +1 -0
  82. package/apps/frontend/public/icon-192.svg +1 -0
  83. package/apps/frontend/public/icon-512.svg +1 -0
  84. package/apps/frontend/public/manifest.webmanifest +23 -0
  85. package/apps/frontend/public/sw.js +57 -0
  86. package/apps/frontend/public/vite.svg +1 -0
  87. package/apps/frontend/public/wadi.svg +5 -0
  88. package/apps/frontend/src/assets/react.svg +1 -0
  89. package/apps/frontend/src/components/AuthLoader.tsx +50 -0
  90. package/apps/frontend/src/components/ChatInput.tsx +272 -0
  91. package/apps/frontend/src/components/ChatInterface.tsx +202 -0
  92. package/apps/frontend/src/components/ErrorBoundary.tsx +52 -0
  93. package/apps/frontend/src/components/InputArea.tsx +201 -0
  94. package/apps/frontend/src/components/Layout.tsx +73 -0
  95. package/apps/frontend/src/components/MessageBubble.tsx +66 -0
  96. package/apps/frontend/src/components/OnboardingModal.tsx +108 -0
  97. package/apps/frontend/src/components/SettingsModal.tsx +187 -0
  98. package/apps/frontend/src/components/Sidebar.tsx +171 -0
  99. package/apps/frontend/src/components/WadiOnboarding.tsx +71 -0
  100. package/apps/frontend/src/components/auditor/AuditReport.tsx +166 -0
  101. package/apps/frontend/src/components/auditor/AuditorHeader.tsx +34 -0
  102. package/apps/frontend/src/components/auditor/ContextPanel.tsx +138 -0
  103. package/apps/frontend/src/components/auditor/DataDeconstructor.tsx +85 -0
  104. package/apps/frontend/src/components/auditor/DecisionWall.tsx +65 -0
  105. package/apps/frontend/src/components/auditor/Dropzone.tsx +137 -0
  106. package/apps/frontend/src/components/common/Button.tsx +97 -0
  107. package/apps/frontend/src/components/common/Card.tsx +43 -0
  108. package/apps/frontend/src/components/common/Input.tsx +73 -0
  109. package/apps/frontend/src/components/common/Modal.tsx +53 -0
  110. package/apps/frontend/src/components/ui/Button.tsx +68 -0
  111. package/apps/frontend/src/components/ui/Card.tsx +86 -0
  112. package/apps/frontend/src/components/ui/Input.tsx +28 -0
  113. package/apps/frontend/src/components/ui/LogItem.tsx +64 -0
  114. package/apps/frontend/src/components/ui/MondayButton.tsx +40 -0
  115. package/apps/frontend/src/components/ui/MondayCard.tsx +24 -0
  116. package/apps/frontend/src/components/ui/Scouter.tsx +208 -0
  117. package/apps/frontend/src/components/ui/TerminalInput.tsx +202 -0
  118. package/apps/frontend/src/components/ui/Tooltip.tsx +67 -0
  119. package/apps/frontend/src/config/chatShortcuts.ts +20 -0
  120. package/apps/frontend/src/config/supabase.ts +6 -0
  121. package/apps/frontend/src/final_status.txt +3 -0
  122. package/apps/frontend/src/hooks/useScouter.ts +28 -0
  123. package/apps/frontend/src/hooks/useStoreHydration.ts +24 -0
  124. package/apps/frontend/src/improvement_status.txt +5 -0
  125. package/apps/frontend/src/index.css +88 -0
  126. package/apps/frontend/src/main.tsx +62 -0
  127. package/apps/frontend/src/monday_status.txt +7 -0
  128. package/apps/frontend/src/pages/ChatPage.tsx +201 -0
  129. package/apps/frontend/src/pages/DashboardPage.tsx +375 -0
  130. package/apps/frontend/src/pages/IntroWadi.tsx +114 -0
  131. package/apps/frontend/src/pages/LandingPage.tsx +103 -0
  132. package/apps/frontend/src/pages/Login.tsx +190 -0
  133. package/apps/frontend/src/pages/PrivacyPage.tsx +213 -0
  134. package/apps/frontend/src/pages/ProjectDetail.tsx +80 -0
  135. package/apps/frontend/src/pages/Projects.tsx +247 -0
  136. package/apps/frontend/src/pages/TermsPage.tsx +202 -0
  137. package/apps/frontend/src/router.tsx +83 -0
  138. package/apps/frontend/src/store/authStore.ts +152 -0
  139. package/apps/frontend/src/store/chatStore.ts +837 -0
  140. package/apps/frontend/src/store/documentStore.ts +89 -0
  141. package/apps/frontend/src/store/projectsStore.ts +111 -0
  142. package/apps/frontend/src/store/runsStore.ts +98 -0
  143. package/apps/frontend/src/utils/api.ts +34 -0
  144. package/apps/frontend/src/vite-env.d.ts +7 -0
  145. package/apps/frontend/tailwind.config.cjs +32 -0
  146. package/apps/frontend/tsconfig.app.json +27 -0
  147. package/apps/frontend/tsconfig.json +7 -0
  148. package/apps/frontend/tsconfig.node.json +26 -0
  149. package/apps/frontend/vite.config.ts +25 -0
  150. package/apps/kivo/.firebase/hosting.d3d3.cache +11 -0
  151. package/apps/kivo/.firebaserc +5 -0
  152. package/apps/kivo/BRANDING_GUIDE.md +71 -0
  153. package/apps/kivo/DEPLOYMENT_READY.md +46 -0
  154. package/apps/kivo/DEPLOY_URL.md +12 -0
  155. package/apps/kivo/IMPLEMENTATION_REPORT.md +35 -0
  156. package/apps/kivo/IMPLEMENTATION_REPORT_FINAL.md +49 -0
  157. package/apps/kivo/PLAN_MOBILE_2.0.md +44 -0
  158. package/apps/kivo/PWA_VERIFICATION_GUIDE.md +77 -0
  159. package/apps/kivo/README.md +28 -0
  160. package/apps/kivo/REBUILD_REPORT.md +34 -0
  161. package/apps/kivo/UPGRADE_REPORT.md +35 -0
  162. package/apps/kivo/android/app/build.gradle +54 -0
  163. package/apps/kivo/android/app/capacitor.build.gradle +19 -0
  164. package/apps/kivo/android/app/proguard-rules.pro +21 -0
  165. package/apps/kivo/android/app/src/androidTest/java/com/getcapacitor/myapp/ExampleInstrumentedTest.java +26 -0
  166. package/apps/kivo/android/app/src/main/AndroidManifest.xml +35 -0
  167. package/apps/kivo/android/app/src/main/java/com/kivo/app/MainActivity.java +5 -0
  168. package/apps/kivo/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
  169. package/apps/kivo/android/app/src/main/res/drawable/splash.png +0 -0
  170. package/apps/kivo/android/app/src/main/res/drawable-land-hdpi/splash.png +0 -0
  171. package/apps/kivo/android/app/src/main/res/drawable-land-ldpi/splash.png +0 -0
  172. package/apps/kivo/android/app/src/main/res/drawable-land-mdpi/splash.png +0 -0
  173. package/apps/kivo/android/app/src/main/res/drawable-land-night-hdpi/splash.png +0 -0
  174. package/apps/kivo/android/app/src/main/res/drawable-land-night-ldpi/splash.png +0 -0
  175. package/apps/kivo/android/app/src/main/res/drawable-land-night-mdpi/splash.png +0 -0
  176. package/apps/kivo/android/app/src/main/res/drawable-land-night-xhdpi/splash.png +0 -0
  177. package/apps/kivo/android/app/src/main/res/drawable-land-night-xxhdpi/splash.png +0 -0
  178. package/apps/kivo/android/app/src/main/res/drawable-land-night-xxxhdpi/splash.png +0 -0
  179. package/apps/kivo/android/app/src/main/res/drawable-land-xhdpi/splash.png +0 -0
  180. package/apps/kivo/android/app/src/main/res/drawable-land-xxhdpi/splash.png +0 -0
  181. package/apps/kivo/android/app/src/main/res/drawable-land-xxxhdpi/splash.png +0 -0
  182. package/apps/kivo/android/app/src/main/res/drawable-night/splash.png +0 -0
  183. package/apps/kivo/android/app/src/main/res/drawable-port-hdpi/splash.png +0 -0
  184. package/apps/kivo/android/app/src/main/res/drawable-port-ldpi/splash.png +0 -0
  185. package/apps/kivo/android/app/src/main/res/drawable-port-mdpi/splash.png +0 -0
  186. package/apps/kivo/android/app/src/main/res/drawable-port-night-hdpi/splash.png +0 -0
  187. package/apps/kivo/android/app/src/main/res/drawable-port-night-ldpi/splash.png +0 -0
  188. package/apps/kivo/android/app/src/main/res/drawable-port-night-mdpi/splash.png +0 -0
  189. package/apps/kivo/android/app/src/main/res/drawable-port-night-xhdpi/splash.png +0 -0
  190. package/apps/kivo/android/app/src/main/res/drawable-port-night-xxhdpi/splash.png +0 -0
  191. package/apps/kivo/android/app/src/main/res/drawable-port-night-xxxhdpi/splash.png +0 -0
  192. package/apps/kivo/android/app/src/main/res/drawable-port-xhdpi/splash.png +0 -0
  193. package/apps/kivo/android/app/src/main/res/drawable-port-xxhdpi/splash.png +0 -0
  194. package/apps/kivo/android/app/src/main/res/drawable-port-xxxhdpi/splash.png +0 -0
  195. package/apps/kivo/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  196. package/apps/kivo/android/app/src/main/res/layout/activity_main.xml +12 -0
  197. package/apps/kivo/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +9 -0
  198. package/apps/kivo/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +9 -0
  199. package/apps/kivo/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  200. package/apps/kivo/android/app/src/main/res/mipmap-hdpi/ic_launcher_background.png +0 -0
  201. package/apps/kivo/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png +0 -0
  202. package/apps/kivo/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  203. package/apps/kivo/android/app/src/main/res/mipmap-ldpi/ic_launcher.png +0 -0
  204. package/apps/kivo/android/app/src/main/res/mipmap-ldpi/ic_launcher_background.png +0 -0
  205. package/apps/kivo/android/app/src/main/res/mipmap-ldpi/ic_launcher_foreground.png +0 -0
  206. package/apps/kivo/android/app/src/main/res/mipmap-ldpi/ic_launcher_round.png +0 -0
  207. package/apps/kivo/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  208. package/apps/kivo/android/app/src/main/res/mipmap-mdpi/ic_launcher_background.png +0 -0
  209. package/apps/kivo/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png +0 -0
  210. package/apps/kivo/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  211. package/apps/kivo/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  212. package/apps/kivo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_background.png +0 -0
  213. package/apps/kivo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png +0 -0
  214. package/apps/kivo/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  215. package/apps/kivo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  216. package/apps/kivo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_background.png +0 -0
  217. package/apps/kivo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png +0 -0
  218. package/apps/kivo/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  219. package/apps/kivo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  220. package/apps/kivo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_background.png +0 -0
  221. package/apps/kivo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png +0 -0
  222. package/apps/kivo/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  223. package/apps/kivo/android/app/src/main/res/values/ic_launcher_background.xml +4 -0
  224. package/apps/kivo/android/app/src/main/res/values/strings.xml +7 -0
  225. package/apps/kivo/android/app/src/main/res/values/styles.xml +22 -0
  226. package/apps/kivo/android/app/src/main/res/xml/file_paths.xml +5 -0
  227. package/apps/kivo/android/app/src/test/java/com/getcapacitor/myapp/ExampleUnitTest.java +18 -0
  228. package/apps/kivo/android/build.gradle +29 -0
  229. package/apps/kivo/android/capacitor.settings.gradle +3 -0
  230. package/apps/kivo/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  231. package/apps/kivo/android/gradle/wrapper/gradle-wrapper.properties +7 -0
  232. package/apps/kivo/android/gradle.properties +22 -0
  233. package/apps/kivo/android/gradlew +252 -0
  234. package/apps/kivo/android/gradlew.bat +94 -0
  235. package/apps/kivo/android/settings.gradle +5 -0
  236. package/apps/kivo/android/variables.gradle +16 -0
  237. package/apps/kivo/assets/icon.png +0 -0
  238. package/apps/kivo/assets/splash.png +0 -0
  239. package/apps/kivo/capacitor.config.json +16 -0
  240. package/apps/kivo/firebase.json +6 -0
  241. package/apps/kivo/jest.config.js +4 -0
  242. package/apps/kivo/package.json +26 -0
  243. package/apps/kivo/tests_disabled/logic.test.js +34 -0
  244. package/apps/kivo/www/assets/icon-192.png +0 -0
  245. package/apps/kivo/www/assets/icon-512.png +0 -0
  246. package/apps/kivo/www/assets/kivo-icon.png +0 -0
  247. package/apps/kivo/www/assets/pop.mp3 +0 -0
  248. package/apps/kivo/www/favicon.ico +0 -0
  249. package/apps/kivo/www/firebase-config.js +75 -0
  250. package/apps/kivo/www/index.html +38 -0
  251. package/apps/kivo/www/manifest.json +29 -0
  252. package/apps/kivo/www/script.js +72 -0
  253. package/apps/kivo/www/style.css +82 -0
  254. package/apps/kivo/www/sw.js +46 -0
  255. package/apps/kivo-brain-api/.env.example +2 -0
  256. package/apps/kivo-brain-api/KIVO_BACKEND_SETUP.md +27 -0
  257. package/apps/kivo-brain-api/controllers/kivoController.js +31 -0
  258. package/apps/kivo-brain-api/index.js +24 -0
  259. package/apps/kivo-brain-api/package.json +17 -0
  260. package/apps/kivo-brain-api/routes/message.js +8 -0
  261. package/apps/kivo-brain-api/services/openaiService.js +64 -0
  262. package/apps/tests/wadi-tests.js +155 -0
  263. package/apps/wadi-brain/docs/README_REMOVE_OPTIONS.md +26 -0
  264. package/cli/commands/deploy.js +10 -0
  265. package/cli/commands/docs.js +16 -0
  266. package/cli/commands/explain.js +29 -0
  267. package/cli/commands/lint.js +14 -0
  268. package/cli/index.js +26 -0
  269. package/cli/package.json +12 -0
  270. package/docs/CNAME +1 -0
  271. package/docs/README.md +38 -0
  272. package/docs/USO.md +30 -0
  273. package/docs/index.html +46 -0
  274. package/eslint.config.js +101 -0
  275. package/final_validation.json +27 -0
  276. package/frontend_listado.txt +33387 -0
  277. package/listado.txt +12591 -0
  278. package/package.json +46 -0
  279. package/packages/logger/index.js +43 -0
  280. package/packages/logger/package.json +19 -0
  281. package/packages/logger/test-logger.js +7 -0
  282. package/packages_listado.txt +801 -0
  283. package/pnpm-workspace.yaml +6 -0
  284. package/reseteador_existencial.ps1 +40 -0
  285. package/scripts/bump-version.js +26 -0
  286. package/scripts/env.ps1 +13 -0
  287. package/scripts/setup_android.ps1 +25 -0
  288. package/scripts/setup_virtual_env.ps1 +77 -0
  289. package/scripts/smoke-test.js +84 -0
  290. package/scripts/trigger_render_deploy.ps1 +3 -0
  291. package/scripts/validate-release.js +34 -0
  292. package/temp_check.js +57 -0
  293. package/tsconfig.json +5 -0
  294. package/validation_report.json +27 -0
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "MONDAY OS",
3
+ "short_name": "MONDAY",
4
+ "description": "Sistema Operativo Forense - Nivel Táctico. Sin distracciones.",
5
+ "start_url": "/",
6
+ "display": "standalone",
7
+ "background_color": "#050816",
8
+ "theme_color": "#8B5CF6",
9
+ "icons": [
10
+ {
11
+ "src": "/icon-192.svg",
12
+ "sizes": "192x192",
13
+ "type": "image/svg+xml",
14
+ "purpose": "any maskable"
15
+ },
16
+ {
17
+ "src": "/icon-512.svg",
18
+ "sizes": "512x512",
19
+ "type": "image/svg+xml",
20
+ "purpose": "any maskable"
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,57 @@
1
+ const CACHE_NAME = "monday-os-cache-v1";
2
+ const ASSETS_TO_CACHE = [
3
+ "/",
4
+ "/index.html",
5
+ "/manifest.webmanifest",
6
+ "/icon-192.svg",
7
+ "/icon-512.svg",
8
+ ];
9
+
10
+ // Install Event: Pre-cache core assets
11
+ self.addEventListener("install", (event) => {
12
+ event.waitUntil(
13
+ caches.open(CACHE_NAME).then((cache) => {
14
+ return cache.addAll(ASSETS_TO_CACHE);
15
+ })
16
+ );
17
+ self.skipWaiting();
18
+ });
19
+
20
+ // Activate Event: Cleanup old caches
21
+ self.addEventListener("activate", (event) => {
22
+ event.waitUntil(
23
+ caches.keys().then((cacheNames) => {
24
+ return Promise.all(
25
+ cacheNames.map((cache) => {
26
+ if (cache !== CACHE_NAME) {
27
+ return caches.delete(cache);
28
+ }
29
+ })
30
+ );
31
+ })
32
+ );
33
+ self.clients.claim();
34
+ });
35
+
36
+ // Fetch Event: Network First, Fallback to Cache
37
+ self.addEventListener("fetch", (event) => {
38
+ // Only handle GET requests
39
+ if (event.request.method !== "GET") return;
40
+ // Ignore API calls (let them fail or be handled by app)
41
+ if (event.request.url.includes("/api/")) return;
42
+
43
+ event.respondWith(
44
+ fetch(event.request)
45
+ .then((response) => {
46
+ // Clone response to cache it
47
+ const responseClone = response.clone();
48
+ caches.open(CACHE_NAME).then((cache) => {
49
+ cache.put(event.request, responseClone);
50
+ });
51
+ return response;
52
+ })
53
+ .catch(() => {
54
+ return caches.match(event.request);
55
+ })
56
+ );
57
+ });
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -0,0 +1,5 @@
1
+ <svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <rect width="256" height="256" rx="64" fill="#0F111A"/>
3
+ <path d="M64 88L96 184L128 120L160 184L192 88" stroke="#8B5CF6" stroke-width="24" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <circle cx="200" cy="56" r="16" fill="#38BDF8" fill-opacity="0.8"/>
5
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1,50 @@
1
+ import { useEffect, useState } from "react";
2
+ import { supabase } from "../config/supabase";
3
+ import { useAuthStore } from "../store/authStore";
4
+
5
+ export const AuthLoader = ({ children }: { children: React.ReactNode }) => {
6
+ const [ready, setReady] = useState(false);
7
+ const { setUser, loginAsGuest } = useAuthStore();
8
+
9
+ useEffect(() => {
10
+ // 1. Initial Check
11
+ supabase.auth.getSession().then(({ data: { session } }) => {
12
+ setUser(session?.user || null);
13
+
14
+ if (!session) {
15
+ // If no user, login as guest automatically
16
+ loginAsGuest().then(() => setReady(true));
17
+ } else {
18
+ setReady(true);
19
+ }
20
+ });
21
+
22
+ // 2. Listen for changes
23
+ const {
24
+ data: { subscription },
25
+ } = supabase.auth.onAuthStateChange((_event, session) => {
26
+ setUser(session?.user || null);
27
+ });
28
+
29
+ return () => subscription.unsubscribe();
30
+ }, [setUser, loginAsGuest]);
31
+
32
+ if (!ready) {
33
+ return (
34
+ <div
35
+ style={{
36
+ height: "100vh",
37
+ display: "flex",
38
+ alignItems: "center",
39
+ justifyContent: "center",
40
+ backgroundColor: "var(--bg-app)",
41
+ color: "var(--text-primary)",
42
+ }}
43
+ >
44
+ Preparando tu espacio de conversación...
45
+ </div>
46
+ );
47
+ }
48
+
49
+ return <>{children}</>;
50
+ };
@@ -0,0 +1,272 @@
1
+ import { useState, useEffect, useRef } from "react";
2
+ import { Button } from "./common/Button";
3
+ import { useChatStore, type Attachment } from "../store/chatStore";
4
+
5
+ interface ChatInputProps {
6
+ onSendMessage: (text: string, attachments: Attachment[]) => Promise<void>;
7
+ isLoading: boolean;
8
+ placeholder?: string;
9
+ }
10
+
11
+ export function ChatInput({
12
+ onSendMessage,
13
+ isLoading,
14
+ placeholder = "¿En qué te ayudo?",
15
+ }: ChatInputProps) {
16
+ const { uploadFile, isUploading } = useChatStore();
17
+
18
+ // Local state for input
19
+ const [input, setInput] = useState(() => {
20
+ try {
21
+ if (typeof window !== "undefined") {
22
+ return localStorage.getItem("wadi_chat_draft") || "";
23
+ }
24
+ } catch {
25
+ /* ignore */
26
+ }
27
+ return "";
28
+ });
29
+
30
+ const [attachments, setAttachments] = useState<Attachment[]>([]);
31
+ const fileInputRef = useRef<HTMLInputElement>(null);
32
+ const textareaRef = useRef<HTMLTextAreaElement>(null);
33
+
34
+ // Draft persistence
35
+ useEffect(() => {
36
+ const timer = setTimeout(() => {
37
+ localStorage.setItem("wadi_chat_draft", input);
38
+ }, 300);
39
+ return () => clearTimeout(timer);
40
+ }, [input]);
41
+
42
+ const handleFileUpload = async (e: React.ChangeEvent<HTMLInputElement>) => {
43
+ const file = e.target.files?.[0];
44
+ if (!file) return;
45
+
46
+ try {
47
+ const attachment = await uploadFile(file);
48
+ if (attachment) {
49
+ setAttachments((prev) => [...prev, attachment]);
50
+ }
51
+ } catch (err) {
52
+ console.error("Upload failed", err);
53
+ } finally {
54
+ // Reset input so same file can be selected again if needed
55
+ if (fileInputRef.current) fileInputRef.current.value = "";
56
+ }
57
+ };
58
+
59
+ const handleSend = async () => {
60
+ if ((!input.trim() && attachments.length === 0) || isLoading || isUploading)
61
+ return;
62
+
63
+ const text = input.trim();
64
+
65
+ setInput("");
66
+ setAttachments([]);
67
+ localStorage.removeItem("wadi_chat_draft");
68
+
69
+ // Reset height
70
+ if (textareaRef.current) {
71
+ textareaRef.current.style.height = "auto";
72
+ }
73
+
74
+ await onSendMessage(text, attachments);
75
+
76
+ // Keep focus after sending
77
+ setTimeout(() => {
78
+ textareaRef.current?.focus();
79
+ }, 0);
80
+ };
81
+
82
+ const onFormSubmit = (e: React.FormEvent) => {
83
+ e.preventDefault();
84
+ e.stopPropagation();
85
+ handleSend();
86
+ };
87
+
88
+ const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
89
+ if (e.key === "Enter" && !e.shiftKey) {
90
+ e.preventDefault();
91
+ e.stopPropagation();
92
+ handleSend();
93
+ }
94
+ };
95
+
96
+ const handleInput = (e: React.FormEvent<HTMLTextAreaElement>) => {
97
+ const target = e.target as HTMLTextAreaElement;
98
+ target.style.height = "auto";
99
+ target.style.height = `${Math.min(target.scrollHeight, 200)}px`;
100
+ };
101
+
102
+ return (
103
+ <form
104
+ onSubmit={onFormSubmit}
105
+ style={{
106
+ display: "flex",
107
+ flexDirection: "column",
108
+ gap: "0.5rem",
109
+ maxWidth: "900px",
110
+ margin: "0 auto",
111
+ position: "relative",
112
+ }}
113
+ >
114
+ {/* Attachments Preview */}
115
+ {attachments.length > 0 && (
116
+ <div className="flex gap-2 overflow-x-auto py-2 px-4 bg-[var(--color-bg)] rounded-lg border border-[var(--color-border)] mb-2">
117
+ {attachments.map((att, index) => {
118
+ const isImage = /\.(jpg|jpeg|png|gif|webp)$/i.test(att.name);
119
+ return (
120
+ <div key={index} className="relative group shrink-0">
121
+ {isImage ? (
122
+ <img
123
+ src={att.url}
124
+ alt="adjunto"
125
+ className="h-16 w-16 object-cover rounded-md border border-[var(--color-border)]"
126
+ />
127
+ ) : (
128
+ <div className="h-16 w-16 flex flex-col items-center justify-center bg-[var(--color-surface)] rounded-md border text-[10px] text-center p-1 overflow-hidden break-all gap-1">
129
+ <span>📄</span>
130
+ <span className="line-clamp-2">{att.name}</span>
131
+ </div>
132
+ )}
133
+ <button
134
+ type="button"
135
+ onClick={() =>
136
+ setAttachments((prev) =>
137
+ prev.filter((a) => a.url !== att.url)
138
+ )
139
+ }
140
+ className="absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs opacity-0 group-hover:opacity-100 transition-opacity"
141
+ >
142
+ ×
143
+ </button>
144
+ </div>
145
+ );
146
+ })}
147
+ </div>
148
+ )}
149
+
150
+ <div style={{ display: "flex", gap: "0.5rem", alignItems: "flex-end" }}>
151
+ {/* File Input (Hidden) */}
152
+ <input
153
+ type="file"
154
+ ref={fileInputRef}
155
+ className="hidden"
156
+ onChange={handleFileUpload}
157
+ accept="image/*,.txt,.md,.pdf,.csv" // Accepted types
158
+ />
159
+
160
+ {/* Clip Button */}
161
+ <Button
162
+ type="button"
163
+ onClick={() => fileInputRef.current?.click()}
164
+ disabled={isLoading || isUploading}
165
+ style={{
166
+ height: "50px",
167
+ width: "50px",
168
+ borderRadius: "50%",
169
+ background: "var(--color-surface)",
170
+ color: "var(--color-text-main)",
171
+ display: "flex",
172
+ alignItems: "center",
173
+ justifyContent: "center",
174
+ flexShrink: 0,
175
+ border: "1px solid var(--color-border)",
176
+ fontSize: "1.2rem",
177
+ cursor: "pointer",
178
+ }}
179
+ >
180
+ {isUploading ? "⏳" : "📎"}
181
+ </Button>
182
+
183
+ <div style={{ flex: 1, position: "relative" }}>
184
+ <textarea
185
+ id="chat-input"
186
+ name="chat-input"
187
+ ref={textareaRef}
188
+ value={input}
189
+ onChange={(e) => setInput(e.target.value)}
190
+ onKeyDown={onKeyDown}
191
+ onInput={handleInput}
192
+ placeholder={placeholder}
193
+ disabled={isLoading || isUploading}
194
+ autoComplete="off"
195
+ rows={1}
196
+ style={{
197
+ width: "100%",
198
+ padding: "1rem 1.25rem",
199
+ borderRadius: "1.5rem",
200
+ border: "2px solid var(--color-border)",
201
+ backgroundColor: "var(--color-surface)",
202
+ color: "var(--color-text-main)",
203
+ resize: "none",
204
+ minHeight: "50px",
205
+ maxHeight: "200px",
206
+ fontSize: "16px",
207
+ outline: "none",
208
+ boxShadow: "0 4px 12px rgba(0,0,0,0.02)",
209
+ transition: "border-color 0.2s, box-shadow 0.2s",
210
+ }}
211
+ onFocus={(e) => {
212
+ e.target.style.borderColor = "var(--color-primary)";
213
+ e.target.style.boxShadow = "0 0 0 3px rgba(139, 92, 246, 0.1)";
214
+ }}
215
+ onBlur={(e) => {
216
+ e.target.style.borderColor = "var(--color-border)";
217
+ e.target.style.boxShadow = "none";
218
+ }}
219
+ enterKeyHint="send"
220
+ />
221
+ </div>
222
+ <Button
223
+ type="submit"
224
+ disabled={
225
+ isLoading ||
226
+ isUploading ||
227
+ (!input.trim() && attachments.length === 0)
228
+ }
229
+ aria-label="Enviar mensaje"
230
+ style={{
231
+ height: "50px",
232
+ width: "50px",
233
+ borderRadius: "50%",
234
+ background: "var(--color-primary)",
235
+ color: "#FFF",
236
+ display: "flex",
237
+ alignItems: "center",
238
+ justifyContent: "center",
239
+ flexShrink: 0,
240
+ boxShadow: "0 4px 15px rgba(139, 92, 246, 0.3)",
241
+ border: "2px solid #fff",
242
+ fontSize: "1.2rem",
243
+ transition: "transform 0.1s, opacity 0.2s",
244
+ opacity:
245
+ isLoading ||
246
+ isUploading ||
247
+ (!input.trim() && attachments.length === 0)
248
+ ? 0.5
249
+ : 1,
250
+ cursor:
251
+ isLoading ||
252
+ isUploading ||
253
+ (!input.trim() && attachments.length === 0)
254
+ ? "not-allowed"
255
+ : "pointer",
256
+ }}
257
+ onMouseEnter={(e) => {
258
+ if (
259
+ !isLoading &&
260
+ !isUploading &&
261
+ (input.trim() || attachments.length > 0)
262
+ )
263
+ e.currentTarget.style.transform = "scale(1.05)";
264
+ }}
265
+ onMouseLeave={(e) => (e.currentTarget.style.transform = "scale(1)")}
266
+ >
267
+
268
+ </Button>
269
+ </div>
270
+ </form>
271
+ );
272
+ }
@@ -0,0 +1,202 @@
1
+ import { useRef, useEffect } from "react";
2
+ import { MessageBubble } from "./MessageBubble";
3
+ import { InputArea } from "./InputArea";
4
+
5
+ export interface ChatMessage {
6
+ id: string;
7
+ role: "user" | "assistant";
8
+ content: string;
9
+ timestamp?: string;
10
+ }
11
+
12
+ interface ChatInterfaceProps {
13
+ title?: string;
14
+ status?: string;
15
+ messages: ChatMessage[];
16
+ onSendMessage: (text: string) => void;
17
+ isThinking?: boolean;
18
+ suggestions?: string[];
19
+ }
20
+
21
+ export function ChatInterface({
22
+ title,
23
+ status,
24
+ messages,
25
+ onSendMessage,
26
+ isThinking,
27
+ suggestions,
28
+ }: ChatInterfaceProps) {
29
+ const bottomRef = useRef<HTMLDivElement>(null);
30
+
31
+ useEffect(() => {
32
+ bottomRef.current?.scrollIntoView({ behavior: "smooth" });
33
+ }, [messages, isThinking]);
34
+
35
+ return (
36
+ <div
37
+ style={{
38
+ display: "flex",
39
+ flexDirection: "column",
40
+ height: "100%",
41
+ width: "100%",
42
+ maxWidth: "900px",
43
+ margin: "0 auto",
44
+ }}
45
+ >
46
+ {/* Header */}
47
+ <header
48
+ style={{
49
+ padding: "1rem",
50
+ borderBottom: "1px solid var(--color-border)",
51
+ display: "flex",
52
+ justifyContent: "space-between",
53
+ alignItems: "center",
54
+ backgroundColor: "var(--color-surface)", // Sticky header if needed
55
+ zIndex: 5,
56
+ }}
57
+ >
58
+ <div>
59
+ <h2
60
+ style={{
61
+ fontSize: "var(--text-lg)",
62
+ color: "var(--color-text-main)",
63
+ }}
64
+ >
65
+ {title || "New Conversation"}
66
+ </h2>
67
+ <div
68
+ style={{
69
+ display: "flex",
70
+ alignItems: "center",
71
+ gap: "0.5rem",
72
+ }}
73
+ >
74
+ <span
75
+ style={{
76
+ width: 8,
77
+ height: 8,
78
+ borderRadius: "50%",
79
+ backgroundColor: "var(--color-success)",
80
+ boxShadow: "0 0 5px var(--color-success)",
81
+ }}
82
+ />
83
+ <small
84
+ style={{
85
+ color: "var(--color-text-soft)",
86
+ fontSize: "var(--text-xs)",
87
+ }}
88
+ >
89
+ {status || "Online"}
90
+ </small>
91
+ {isThinking && (
92
+ <span
93
+ style={{
94
+ fontSize: "var(--text-xs)",
95
+ color: "var(--color-primary)",
96
+ fontStyle: "italic",
97
+ animation: "pulse 1.5s infinite",
98
+ marginLeft: "0.5rem",
99
+ }}
100
+ >
101
+ WADI está pensando...
102
+ </span>
103
+ )}
104
+ </div>
105
+ </div>
106
+ </header>
107
+
108
+ {/* Message List */}
109
+ <div
110
+ style={{
111
+ flex: 1,
112
+ overflowY: "auto",
113
+ padding: "1.5rem",
114
+ display: "flex",
115
+ flexDirection: "column",
116
+ gap: "1rem", // Gap between messages
117
+ }}
118
+ >
119
+ {messages.length === 0 && (
120
+ <div
121
+ style={{
122
+ flex: 1,
123
+ display: "flex",
124
+ flexDirection: "column",
125
+ alignItems: "center",
126
+ justifyContent: "center",
127
+ textAlign: "center",
128
+ gap: "1rem",
129
+ opacity: 0.8,
130
+ }}
131
+ >
132
+ <div
133
+ style={{
134
+ fontSize: "4rem",
135
+ background: "var(--grad-main)",
136
+ WebkitBackgroundClip: "text",
137
+ WebkitTextFillColor: "transparent",
138
+ filter: "drop-shadow(0 0 10px rgba(139, 92, 246, 0.3))",
139
+ }}
140
+ >
141
+ 🚀
142
+ </div>
143
+ <h3
144
+ style={{
145
+ fontSize: "var(--text-2xl)",
146
+ color: "var(--color-text-main)",
147
+ }}
148
+ >
149
+ Iniciá tu primera conversación
150
+ </h3>
151
+ <p style={{ color: "var(--color-text-soft)" }}>
152
+ Escribí tu pregunta, idea o problema abajo para empezar.
153
+ </p>
154
+ </div>
155
+ )}
156
+
157
+ {messages.map((msg) => (
158
+ <MessageBubble
159
+ key={msg.id}
160
+ role={msg.role}
161
+ content={msg.content}
162
+ timestamp={msg.timestamp}
163
+ />
164
+ ))}
165
+
166
+ {isThinking && (
167
+ <div
168
+ style={{
169
+ padding: "1rem",
170
+ display: "flex",
171
+ alignItems: "center",
172
+ gap: "0.5rem",
173
+ opacity: 0.8,
174
+ color: "var(--color-text-soft)",
175
+ fontSize: "var(--text-sm)",
176
+ }}
177
+ >
178
+ <div
179
+ style={{
180
+ width: "8px",
181
+ height: "8px",
182
+ borderRadius: "50%",
183
+ background: "var(--color-primary)",
184
+ animation: "pulse 1s infinite",
185
+ }}
186
+ />
187
+ <span>Ordenando tus ideas...</span>
188
+ </div>
189
+ )}
190
+
191
+ <div ref={bottomRef} />
192
+ </div>
193
+
194
+ {/* Input */}
195
+ <InputArea
196
+ onSend={onSendMessage}
197
+ disabled={isThinking}
198
+ suggestions={suggestions}
199
+ />
200
+ </div>
201
+ );
202
+ }