ruflo 3.7.0-alpha.11 → 3.7.0-alpha.13

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 (498) hide show
  1. package/README.md +393 -393
  2. package/bin/ruflo.js +57 -57
  3. package/package.json +1 -1
  4. package/src/chat-ui/Dockerfile +25 -25
  5. package/src/chat-ui/patch-mcp-url-safety.sh +28 -28
  6. package/src/config/config.example.json +76 -76
  7. package/src/mcp-bridge/Dockerfile +45 -45
  8. package/src/mcp-bridge/index.js +1668 -1668
  9. package/src/mcp-bridge/mcp-stdio-kernel.js +159 -159
  10. package/src/mcp-bridge/package.json +17 -17
  11. package/src/mcp-bridge/test-harness.js +470 -470
  12. package/src/nginx/Dockerfile +10 -10
  13. package/src/nginx/nginx.conf +67 -67
  14. package/src/nginx/static/favicon-dark.svg +4 -4
  15. package/src/nginx/static/favicon.svg +4 -4
  16. package/src/nginx/static/icon.svg +5 -5
  17. package/src/nginx/static/logo.svg +9 -9
  18. package/src/nginx/static/manifest.json +22 -22
  19. package/src/nginx/static/welcome.js +184 -184
  20. package/src/ruvocal/.claude/skills/add-model-descriptions/SKILL.md +73 -73
  21. package/src/ruvocal/.claude-flow/daemon-state.json +135 -0
  22. package/src/ruvocal/.claude-flow/data/pending-insights.jsonl +0 -0
  23. package/src/ruvocal/.claude-flow/data/ranked-context.json +5 -0
  24. package/src/ruvocal/.claude-flow/logs/daemon.log +31 -0
  25. package/src/ruvocal/.claude-flow/logs/headless/audit_1777949411822_juxau0_prompt.log +989 -0
  26. package/src/ruvocal/.claude-flow/logs/headless/audit_1777949411822_juxau0_result.log +67 -0
  27. package/src/ruvocal/.claude-flow/logs/headless/audit_1777950042278_jvj5xq_prompt.log +989 -0
  28. package/src/ruvocal/.claude-flow/logs/headless/audit_1777950042278_jvj5xq_result.log +93 -0
  29. package/src/ruvocal/.claude-flow/logs/headless/optimize_1777949531823_yt5yc2_prompt.log +1498 -0
  30. package/src/ruvocal/.claude-flow/logs/headless/optimize_1777949531823_yt5yc2_result.log +93 -0
  31. package/src/ruvocal/.claude-flow/logs/headless/testgaps_1777949771821_elw1j4_prompt.log +1498 -0
  32. package/src/ruvocal/.claude-flow/logs/headless/testgaps_1777949771821_elw1j4_result.log +100 -0
  33. package/src/ruvocal/.claude-flow/metrics/codebase-map.json +11 -0
  34. package/src/ruvocal/.claude-flow/metrics/consolidation.json +6 -0
  35. package/src/ruvocal/.claude-flow/neural/stats.json +6 -0
  36. package/src/ruvocal/.claude-flow/sessions/current.json +13 -0
  37. package/src/ruvocal/.devcontainer/Dockerfile +9 -9
  38. package/src/ruvocal/.devcontainer/devcontainer.json +36 -36
  39. package/src/ruvocal/.dockerignore +16 -16
  40. package/src/ruvocal/.eslintignore +13 -13
  41. package/src/ruvocal/.eslintrc.cjs +45 -45
  42. package/src/ruvocal/.gcloudignore +18 -18
  43. package/src/ruvocal/.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md +43 -43
  44. package/src/ruvocal/.github/ISSUE_TEMPLATE/config-support.md +9 -9
  45. package/src/ruvocal/.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md +17 -17
  46. package/src/ruvocal/.github/ISSUE_TEMPLATE/huggingchat.md +11 -11
  47. package/src/ruvocal/.github/release.yml +16 -16
  48. package/src/ruvocal/.github/workflows/build-docs.yml +18 -18
  49. package/src/ruvocal/.github/workflows/build-image.yml +142 -142
  50. package/src/ruvocal/.github/workflows/build-pr-docs.yml +20 -20
  51. package/src/ruvocal/.github/workflows/deploy-dev.yml +63 -63
  52. package/src/ruvocal/.github/workflows/deploy-prod.yml +78 -78
  53. package/src/ruvocal/.github/workflows/lint-and-test.yml +84 -84
  54. package/src/ruvocal/.github/workflows/slugify.yaml +72 -72
  55. package/src/ruvocal/.github/workflows/trufflehog.yml +17 -17
  56. package/src/ruvocal/.github/workflows/upload-pr-documentation.yml +16 -16
  57. package/src/ruvocal/.husky/lint-stage-config.js +4 -4
  58. package/src/ruvocal/.husky/pre-commit +2 -2
  59. package/src/ruvocal/.prettierignore +14 -14
  60. package/src/ruvocal/.prettierrc +7 -7
  61. package/src/ruvocal/.swarm/attestation.db +0 -0
  62. package/src/ruvocal/.swarm/hnsw.index +0 -0
  63. package/src/ruvocal/.swarm/hnsw.metadata.json +1 -0
  64. package/src/ruvocal/.swarm/memory.db +0 -0
  65. package/src/ruvocal/.swarm/schema.sql +305 -0
  66. package/src/ruvocal/CLAUDE.md +126 -126
  67. package/src/ruvocal/Dockerfile +96 -96
  68. package/src/ruvocal/LICENSE +202 -202
  69. package/src/ruvocal/PRIVACY.md +41 -41
  70. package/src/ruvocal/README.md +164 -164
  71. package/src/ruvocal/chart/Chart.yaml +5 -5
  72. package/src/ruvocal/chart/env/dev.yaml +260 -260
  73. package/src/ruvocal/chart/env/prod.yaml +273 -273
  74. package/src/ruvocal/chart/templates/_helpers.tpl +22 -22
  75. package/src/ruvocal/chart/templates/config.yaml +10 -10
  76. package/src/ruvocal/chart/templates/deployment.yaml +81 -81
  77. package/src/ruvocal/chart/templates/hpa.yaml +45 -45
  78. package/src/ruvocal/chart/templates/infisical.yaml +24 -24
  79. package/src/ruvocal/chart/templates/ingress-internal.yaml +32 -32
  80. package/src/ruvocal/chart/templates/ingress.yaml +32 -32
  81. package/src/ruvocal/chart/templates/network-policy.yaml +36 -36
  82. package/src/ruvocal/chart/templates/service-account.yaml +13 -13
  83. package/src/ruvocal/chart/templates/service-monitor.yaml +17 -17
  84. package/src/ruvocal/chart/templates/service.yaml +21 -21
  85. package/src/ruvocal/chart/values.yaml +73 -73
  86. package/src/ruvocal/cloudbuild.yaml +68 -68
  87. package/src/ruvocal/config/branding.env.example +19 -19
  88. package/src/ruvocal/docker-compose.yml +21 -21
  89. package/src/ruvocal/docs/adr/ADR-029-HUGGINGFACE-CHAT-UI-CLOUD-RUN.md +1236 -1236
  90. package/src/ruvocal/docs/adr/ADR-033-RUVECTOR-RUFLO-MCP-INTEGRATION.md +111 -111
  91. package/src/ruvocal/docs/adr/ADR-034-OPTIONAL-MCP-BACKENDS.md +117 -117
  92. package/src/ruvocal/docs/adr/ADR-035-MCP-TOOL-GROUPS.md +186 -186
  93. package/src/ruvocal/docs/adr/ADR-037-AUTOPILOT-CHAT-MODE.md +1500 -1500
  94. package/src/ruvocal/docs/adr/ADR-038-RUVOCAL-FORK.md +286 -286
  95. package/src/ruvocal/docs/source/_toctree.yml +30 -30
  96. package/src/ruvocal/docs/source/configuration/common-issues.md +38 -38
  97. package/src/ruvocal/docs/source/configuration/llm-router.md +105 -105
  98. package/src/ruvocal/docs/source/configuration/mcp-tools.md +84 -84
  99. package/src/ruvocal/docs/source/configuration/metrics.md +9 -9
  100. package/src/ruvocal/docs/source/configuration/open-id.md +57 -57
  101. package/src/ruvocal/docs/source/configuration/overview.md +89 -89
  102. package/src/ruvocal/docs/source/configuration/theming.md +20 -20
  103. package/src/ruvocal/docs/source/developing/architecture.md +48 -48
  104. package/src/ruvocal/docs/source/index.md +53 -53
  105. package/src/ruvocal/docs/source/installation/docker.md +43 -43
  106. package/src/ruvocal/docs/source/installation/helm.md +43 -43
  107. package/src/ruvocal/docs/source/installation/local.md +62 -62
  108. package/src/ruvocal/entrypoint.sh +18 -18
  109. package/src/ruvocal/mcp-bridge/Dockerfile +45 -45
  110. package/src/ruvocal/mcp-bridge/cloudbuild.yaml +49 -49
  111. package/src/ruvocal/mcp-bridge/index.js +1878 -1878
  112. package/src/ruvocal/mcp-bridge/mcp-stdio-kernel.js +159 -159
  113. package/src/ruvocal/mcp-bridge/package-lock.json +762 -762
  114. package/src/ruvocal/mcp-bridge/package.json +17 -17
  115. package/src/ruvocal/mcp-bridge/test-harness.js +470 -470
  116. package/src/ruvocal/package-lock.json +11741 -11741
  117. package/src/ruvocal/package.json +121 -121
  118. package/src/ruvocal/postcss.config.js +6 -6
  119. package/src/ruvocal/rvf.manifest.json +204 -204
  120. package/src/ruvocal/scripts/config.ts +64 -64
  121. package/src/ruvocal/scripts/generate-welcome.mjs +181 -181
  122. package/src/ruvocal/scripts/populate.ts +288 -288
  123. package/src/ruvocal/scripts/samples.txt +194 -194
  124. package/src/ruvocal/scripts/setups/vitest-setup-server.ts +44 -44
  125. package/src/ruvocal/scripts/updateLocalEnv.ts +48 -48
  126. package/src/ruvocal/src/ambient.d.ts +7 -7
  127. package/src/ruvocal/src/app.d.ts +29 -29
  128. package/src/ruvocal/src/app.html +53 -53
  129. package/src/ruvocal/src/hooks.server.ts +32 -32
  130. package/src/ruvocal/src/hooks.ts +6 -6
  131. package/src/ruvocal/src/lib/APIClient.ts +148 -148
  132. package/src/ruvocal/src/lib/actions/clickOutside.ts +18 -18
  133. package/src/ruvocal/src/lib/actions/snapScrollToBottom.ts +346 -346
  134. package/src/ruvocal/src/lib/buildPrompt.ts +33 -33
  135. package/src/ruvocal/src/lib/components/AnnouncementBanner.svelte +20 -20
  136. package/src/ruvocal/src/lib/components/BackgroundGenerationPoller.svelte +168 -168
  137. package/src/ruvocal/src/lib/components/CodeBlock.svelte +73 -73
  138. package/src/ruvocal/src/lib/components/CopyToClipBoardBtn.svelte +92 -92
  139. package/src/ruvocal/src/lib/components/DeleteConversationModal.svelte +75 -75
  140. package/src/ruvocal/src/lib/components/EditConversationModal.svelte +100 -100
  141. package/src/ruvocal/src/lib/components/ExpandNavigation.svelte +22 -22
  142. package/src/ruvocal/src/lib/components/FoundationBackground.svelte +242 -242
  143. package/src/ruvocal/src/lib/components/HoverTooltip.svelte +44 -44
  144. package/src/ruvocal/src/lib/components/HtmlPreviewModal.svelte +143 -143
  145. package/src/ruvocal/src/lib/components/InfiniteScroll.svelte +50 -50
  146. package/src/ruvocal/src/lib/components/MobileNav.svelte +300 -300
  147. package/src/ruvocal/src/lib/components/Modal.svelte +115 -115
  148. package/src/ruvocal/src/lib/components/ModelCardMetadata.svelte +71 -71
  149. package/src/ruvocal/src/lib/components/NavConversationItem.svelte +151 -151
  150. package/src/ruvocal/src/lib/components/NavMenu.svelte +313 -313
  151. package/src/ruvocal/src/lib/components/Pagination.svelte +97 -97
  152. package/src/ruvocal/src/lib/components/PaginationArrow.svelte +27 -27
  153. package/src/ruvocal/src/lib/components/Portal.svelte +24 -24
  154. package/src/ruvocal/src/lib/components/RetryBtn.svelte +18 -18
  155. package/src/ruvocal/src/lib/components/RuFloUniverse.svelte +185 -185
  156. package/src/ruvocal/src/lib/components/RufloHelpModal.svelte +411 -411
  157. package/src/ruvocal/src/lib/components/ScrollToBottomBtn.svelte +47 -47
  158. package/src/ruvocal/src/lib/components/ScrollToPreviousBtn.svelte +77 -77
  159. package/src/ruvocal/src/lib/components/ShareConversationModal.svelte +182 -182
  160. package/src/ruvocal/src/lib/components/StopGeneratingBtn.svelte +69 -69
  161. package/src/ruvocal/src/lib/components/SubscribeModal.svelte +87 -87
  162. package/src/ruvocal/src/lib/components/Switch.svelte +36 -36
  163. package/src/ruvocal/src/lib/components/SystemPromptModal.svelte +44 -44
  164. package/src/ruvocal/src/lib/components/Toast.svelte +27 -27
  165. package/src/ruvocal/src/lib/components/Tooltip.svelte +30 -30
  166. package/src/ruvocal/src/lib/components/WelcomeModal.svelte +46 -46
  167. package/src/ruvocal/src/lib/components/chat/Alternatives.svelte +77 -77
  168. package/src/ruvocal/src/lib/components/chat/BlockWrapper.svelte +72 -72
  169. package/src/ruvocal/src/lib/components/chat/ChatInput.svelte +490 -490
  170. package/src/ruvocal/src/lib/components/chat/ChatIntroduction.svelte +123 -123
  171. package/src/ruvocal/src/lib/components/chat/ChatMessage.svelte +548 -548
  172. package/src/ruvocal/src/lib/components/chat/ChatWindow.svelte +1057 -1057
  173. package/src/ruvocal/src/lib/components/chat/FileDropzone.svelte +92 -92
  174. package/src/ruvocal/src/lib/components/chat/ImageLightbox.svelte +66 -66
  175. package/src/ruvocal/src/lib/components/chat/MarkdownBlock.svelte +23 -23
  176. package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte +69 -69
  177. package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte.test.ts +58 -58
  178. package/src/ruvocal/src/lib/components/chat/MessageAvatar.svelte +103 -103
  179. package/src/ruvocal/src/lib/components/chat/ModelSwitch.svelte +64 -64
  180. package/src/ruvocal/src/lib/components/chat/OpenReasoningResults.svelte +81 -81
  181. package/src/ruvocal/src/lib/components/chat/TaskGroup.svelte +88 -88
  182. package/src/ruvocal/src/lib/components/chat/ToolUpdate.svelte +273 -273
  183. package/src/ruvocal/src/lib/components/chat/UploadedFile.svelte +253 -253
  184. package/src/ruvocal/src/lib/components/chat/UrlFetchModal.svelte +203 -203
  185. package/src/ruvocal/src/lib/components/chat/VoiceRecorder.svelte +214 -214
  186. package/src/ruvocal/src/lib/components/icons/IconBurger.svelte +20 -20
  187. package/src/ruvocal/src/lib/components/icons/IconCheap.svelte +20 -20
  188. package/src/ruvocal/src/lib/components/icons/IconChevron.svelte +24 -24
  189. package/src/ruvocal/src/lib/components/icons/IconDazzled.svelte +40 -40
  190. package/src/ruvocal/src/lib/components/icons/IconFast.svelte +20 -20
  191. package/src/ruvocal/src/lib/components/icons/IconLoading.svelte +22 -22
  192. package/src/ruvocal/src/lib/components/icons/IconMCP.svelte +28 -28
  193. package/src/ruvocal/src/lib/components/icons/IconMoon.svelte +21 -21
  194. package/src/ruvocal/src/lib/components/icons/IconNew.svelte +20 -20
  195. package/src/ruvocal/src/lib/components/icons/IconOmni.svelte +90 -90
  196. package/src/ruvocal/src/lib/components/icons/IconPaperclip.svelte +24 -24
  197. package/src/ruvocal/src/lib/components/icons/IconPro.svelte +37 -37
  198. package/src/ruvocal/src/lib/components/icons/IconShare.svelte +21 -21
  199. package/src/ruvocal/src/lib/components/icons/IconSun.svelte +93 -93
  200. package/src/ruvocal/src/lib/components/icons/Logo.svelte +68 -68
  201. package/src/ruvocal/src/lib/components/icons/LogoHuggingFaceBorderless.svelte +54 -54
  202. package/src/ruvocal/src/lib/components/mcp/AddServerForm.svelte +250 -250
  203. package/src/ruvocal/src/lib/components/mcp/MCPServerManager.svelte +185 -185
  204. package/src/ruvocal/src/lib/components/mcp/ServerCard.svelte +203 -203
  205. package/src/ruvocal/src/lib/components/players/AudioPlayer.svelte +82 -82
  206. package/src/ruvocal/src/lib/components/voice/AudioWaveform.svelte +96 -96
  207. package/src/ruvocal/src/lib/components/wasm/GalleryPanel.svelte +357 -357
  208. package/src/ruvocal/src/lib/constants/mcpExamples.ts +114 -114
  209. package/src/ruvocal/src/lib/constants/mime.ts +11 -11
  210. package/src/ruvocal/src/lib/constants/pagination.ts +1 -1
  211. package/src/ruvocal/src/lib/constants/publicSepToken.ts +1 -1
  212. package/src/ruvocal/src/lib/constants/routerExamples.ts +133 -133
  213. package/src/ruvocal/src/lib/constants/rvagentPresets.ts +206 -206
  214. package/src/ruvocal/src/lib/createShareLink.ts +27 -27
  215. package/src/ruvocal/src/lib/jobs/refresh-conversation-stats.ts +297 -297
  216. package/src/ruvocal/src/lib/migrations/lock.ts +56 -56
  217. package/src/ruvocal/src/lib/migrations/migrations.spec.ts +74 -74
  218. package/src/ruvocal/src/lib/migrations/migrations.ts +109 -109
  219. package/src/ruvocal/src/lib/migrations/routines/01-update-search-assistants.ts +50 -50
  220. package/src/ruvocal/src/lib/migrations/routines/02-update-assistants-models.ts +48 -48
  221. package/src/ruvocal/src/lib/migrations/routines/04-update-message-updates.ts +151 -151
  222. package/src/ruvocal/src/lib/migrations/routines/05-update-message-files.ts +56 -56
  223. package/src/ruvocal/src/lib/migrations/routines/06-trim-message-updates.ts +56 -56
  224. package/src/ruvocal/src/lib/migrations/routines/08-update-featured-to-review.ts +32 -32
  225. package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.spec.ts +214 -214
  226. package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.ts +88 -88
  227. package/src/ruvocal/src/lib/migrations/routines/10-update-reports-assistantid.ts +29 -29
  228. package/src/ruvocal/src/lib/migrations/routines/index.ts +15 -15
  229. package/src/ruvocal/src/lib/server/__tests__/conversation-stop-generating.spec.ts +103 -103
  230. package/src/ruvocal/src/lib/server/abortRegistry.ts +57 -57
  231. package/src/ruvocal/src/lib/server/abortedGenerations.ts +43 -43
  232. package/src/ruvocal/src/lib/server/adminToken.ts +62 -62
  233. package/src/ruvocal/src/lib/server/api/__tests__/conversations-id.spec.ts +296 -296
  234. package/src/ruvocal/src/lib/server/api/__tests__/conversations-message.spec.ts +216 -216
  235. package/src/ruvocal/src/lib/server/api/__tests__/conversations.spec.ts +235 -235
  236. package/src/ruvocal/src/lib/server/api/__tests__/misc.spec.ts +72 -72
  237. package/src/ruvocal/src/lib/server/api/__tests__/testHelpers.ts +86 -86
  238. package/src/ruvocal/src/lib/server/api/__tests__/user-reports.spec.ts +78 -78
  239. package/src/ruvocal/src/lib/server/api/__tests__/user.spec.ts +239 -239
  240. package/src/ruvocal/src/lib/server/api/types.ts +37 -37
  241. package/src/ruvocal/src/lib/server/api/utils/requireAuth.ts +22 -22
  242. package/src/ruvocal/src/lib/server/api/utils/resolveConversation.ts +69 -69
  243. package/src/ruvocal/src/lib/server/api/utils/resolveModel.ts +27 -27
  244. package/src/ruvocal/src/lib/server/api/utils/superjsonResponse.ts +15 -15
  245. package/src/ruvocal/src/lib/server/apiToken.ts +11 -11
  246. package/src/ruvocal/src/lib/server/auth.ts +554 -554
  247. package/src/ruvocal/src/lib/server/config.ts +187 -187
  248. package/src/ruvocal/src/lib/server/conversation.ts +83 -83
  249. package/src/ruvocal/src/lib/server/database/__tests__/rvf.spec.ts +709 -709
  250. package/src/ruvocal/src/lib/server/database/postgres.ts +700 -700
  251. package/src/ruvocal/src/lib/server/database/rvf.ts +1078 -1078
  252. package/src/ruvocal/src/lib/server/database.ts +145 -145
  253. package/src/ruvocal/src/lib/server/endpoints/document.ts +68 -68
  254. package/src/ruvocal/src/lib/server/endpoints/endpoints.ts +43 -43
  255. package/src/ruvocal/src/lib/server/endpoints/images.ts +211 -211
  256. package/src/ruvocal/src/lib/server/endpoints/openai/endpointOai.ts +266 -266
  257. package/src/ruvocal/src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.ts +212 -212
  258. package/src/ruvocal/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts +32 -32
  259. package/src/ruvocal/src/lib/server/endpoints/preprocessMessages.ts +61 -61
  260. package/src/ruvocal/src/lib/server/exitHandler.ts +59 -59
  261. package/src/ruvocal/src/lib/server/files/downloadFile.ts +34 -34
  262. package/src/ruvocal/src/lib/server/files/uploadFile.ts +29 -29
  263. package/src/ruvocal/src/lib/server/findRepoRoot.ts +13 -13
  264. package/src/ruvocal/src/lib/server/generateFromDefaultEndpoint.ts +46 -46
  265. package/src/ruvocal/src/lib/server/hooks/error.ts +37 -37
  266. package/src/ruvocal/src/lib/server/hooks/fetch.ts +22 -22
  267. package/src/ruvocal/src/lib/server/hooks/handle.ts +250 -250
  268. package/src/ruvocal/src/lib/server/hooks/init.ts +51 -51
  269. package/src/ruvocal/src/lib/server/isURLLocal.spec.ts +31 -31
  270. package/src/ruvocal/src/lib/server/isURLLocal.ts +74 -74
  271. package/src/ruvocal/src/lib/server/logger.ts +42 -42
  272. package/src/ruvocal/src/lib/server/mcp/clientPool.spec.ts +175 -175
  273. package/src/ruvocal/src/lib/server/mcp/hf.ts +32 -32
  274. package/src/ruvocal/src/lib/server/mcp/httpClient.ts +122 -122
  275. package/src/ruvocal/src/lib/server/mcp/registry.ts +76 -76
  276. package/src/ruvocal/src/lib/server/mcp/tools.ts +196 -196
  277. package/src/ruvocal/src/lib/server/metrics.ts +255 -255
  278. package/src/ruvocal/src/lib/server/models.ts +518 -518
  279. package/src/ruvocal/src/lib/server/requestContext.ts +55 -55
  280. package/src/ruvocal/src/lib/server/router/arch.ts +230 -230
  281. package/src/ruvocal/src/lib/server/router/endpoint.ts +316 -316
  282. package/src/ruvocal/src/lib/server/router/multimodal.ts +28 -28
  283. package/src/ruvocal/src/lib/server/router/policy.ts +49 -49
  284. package/src/ruvocal/src/lib/server/router/toolsRoute.ts +51 -51
  285. package/src/ruvocal/src/lib/server/router/types.ts +21 -21
  286. package/src/ruvocal/src/lib/server/sendSlack.ts +23 -23
  287. package/src/ruvocal/src/lib/server/textGeneration/generate.ts +258 -258
  288. package/src/ruvocal/src/lib/server/textGeneration/index.ts +96 -96
  289. package/src/ruvocal/src/lib/server/textGeneration/mcp/fileRefs.ts +155 -155
  290. package/src/ruvocal/src/lib/server/textGeneration/mcp/routerResolution.ts +108 -108
  291. package/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts +831 -831
  292. package/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts +349 -349
  293. package/src/ruvocal/src/lib/server/textGeneration/mcp/wasmTools.test.ts +633 -633
  294. package/src/ruvocal/src/lib/server/textGeneration/reasoning.ts +23 -23
  295. package/src/ruvocal/src/lib/server/textGeneration/title.ts +83 -83
  296. package/src/ruvocal/src/lib/server/textGeneration/types.ts +28 -28
  297. package/src/ruvocal/src/lib/server/textGeneration/utils/prepareFiles.ts +88 -88
  298. package/src/ruvocal/src/lib/server/textGeneration/utils/routing.ts +21 -21
  299. package/src/ruvocal/src/lib/server/textGeneration/utils/toolPrompt.ts +49 -49
  300. package/src/ruvocal/src/lib/server/urlSafety.ts +77 -77
  301. package/src/ruvocal/src/lib/server/usageLimits.ts +30 -30
  302. package/src/ruvocal/src/lib/stores/autopilotStore.svelte.ts +175 -175
  303. package/src/ruvocal/src/lib/stores/backgroundGenerations.svelte.ts +32 -32
  304. package/src/ruvocal/src/lib/stores/backgroundGenerations.ts +1 -1
  305. package/src/ruvocal/src/lib/stores/errors.ts +9 -9
  306. package/src/ruvocal/src/lib/stores/isAborted.ts +3 -3
  307. package/src/ruvocal/src/lib/stores/isPro.ts +4 -4
  308. package/src/ruvocal/src/lib/stores/loading.ts +3 -3
  309. package/src/ruvocal/src/lib/stores/mcpServers.ts +534 -534
  310. package/src/ruvocal/src/lib/stores/pendingChatInput.ts +3 -3
  311. package/src/ruvocal/src/lib/stores/pendingMessage.ts +9 -9
  312. package/src/ruvocal/src/lib/stores/settings.ts +182 -182
  313. package/src/ruvocal/src/lib/stores/shareModal.ts +13 -13
  314. package/src/ruvocal/src/lib/stores/titleUpdate.ts +8 -8
  315. package/src/ruvocal/src/lib/stores/wasmMcp.ts +472 -472
  316. package/src/ruvocal/src/lib/switchTheme.ts +124 -124
  317. package/src/ruvocal/src/lib/types/AbortedGeneration.ts +8 -8
  318. package/src/ruvocal/src/lib/types/Assistant.ts +31 -31
  319. package/src/ruvocal/src/lib/types/AssistantStats.ts +11 -11
  320. package/src/ruvocal/src/lib/types/ConfigKey.ts +4 -4
  321. package/src/ruvocal/src/lib/types/ConvSidebar.ts +9 -9
  322. package/src/ruvocal/src/lib/types/Conversation.ts +27 -27
  323. package/src/ruvocal/src/lib/types/ConversationStats.ts +13 -13
  324. package/src/ruvocal/src/lib/types/Message.ts +41 -41
  325. package/src/ruvocal/src/lib/types/MessageEvent.ts +10 -10
  326. package/src/ruvocal/src/lib/types/MessageUpdate.ts +139 -139
  327. package/src/ruvocal/src/lib/types/MigrationResult.ts +7 -7
  328. package/src/ruvocal/src/lib/types/Model.ts +23 -23
  329. package/src/ruvocal/src/lib/types/Report.ts +12 -12
  330. package/src/ruvocal/src/lib/types/Review.ts +6 -6
  331. package/src/ruvocal/src/lib/types/Semaphore.ts +19 -19
  332. package/src/ruvocal/src/lib/types/Session.ts +22 -22
  333. package/src/ruvocal/src/lib/types/Settings.ts +93 -93
  334. package/src/ruvocal/src/lib/types/SharedConversation.ts +9 -9
  335. package/src/ruvocal/src/lib/types/Template.ts +6 -6
  336. package/src/ruvocal/src/lib/types/Timestamps.ts +4 -4
  337. package/src/ruvocal/src/lib/types/TokenCache.ts +6 -6
  338. package/src/ruvocal/src/lib/types/Tool.ts +77 -77
  339. package/src/ruvocal/src/lib/types/UrlDependency.ts +5 -5
  340. package/src/ruvocal/src/lib/types/User.ts +14 -14
  341. package/src/ruvocal/src/lib/utils/PublicConfig.svelte.ts +75 -75
  342. package/src/ruvocal/src/lib/utils/auth.ts +17 -17
  343. package/src/ruvocal/src/lib/utils/chunk.ts +33 -33
  344. package/src/ruvocal/src/lib/utils/cookiesAreEnabled.ts +13 -13
  345. package/src/ruvocal/src/lib/utils/debounce.ts +17 -17
  346. package/src/ruvocal/src/lib/utils/deepestChild.ts +6 -6
  347. package/src/ruvocal/src/lib/utils/favicon.ts +21 -21
  348. package/src/ruvocal/src/lib/utils/fetchJSON.ts +23 -23
  349. package/src/ruvocal/src/lib/utils/file2base64.ts +14 -14
  350. package/src/ruvocal/src/lib/utils/formatUserCount.ts +37 -37
  351. package/src/ruvocal/src/lib/utils/generationState.spec.ts +75 -75
  352. package/src/ruvocal/src/lib/utils/generationState.ts +26 -26
  353. package/src/ruvocal/src/lib/utils/getHref.ts +41 -41
  354. package/src/ruvocal/src/lib/utils/getReturnFromGenerator.ts +7 -7
  355. package/src/ruvocal/src/lib/utils/haptics.ts +64 -64
  356. package/src/ruvocal/src/lib/utils/hashConv.ts +12 -12
  357. package/src/ruvocal/src/lib/utils/hf.ts +17 -17
  358. package/src/ruvocal/src/lib/utils/isDesktop.ts +7 -7
  359. package/src/ruvocal/src/lib/utils/isUrl.ts +8 -8
  360. package/src/ruvocal/src/lib/utils/isVirtualKeyboard.ts +16 -16
  361. package/src/ruvocal/src/lib/utils/loadAttachmentsFromUrls.ts +115 -115
  362. package/src/ruvocal/src/lib/utils/marked.spec.ts +96 -96
  363. package/src/ruvocal/src/lib/utils/marked.ts +531 -531
  364. package/src/ruvocal/src/lib/utils/mcpValidation.ts +147 -147
  365. package/src/ruvocal/src/lib/utils/mergeAsyncGenerators.ts +38 -38
  366. package/src/ruvocal/src/lib/utils/messageUpdates.spec.ts +262 -262
  367. package/src/ruvocal/src/lib/utils/messageUpdates.ts +324 -324
  368. package/src/ruvocal/src/lib/utils/mime.ts +56 -56
  369. package/src/ruvocal/src/lib/utils/models.ts +14 -14
  370. package/src/ruvocal/src/lib/utils/parseBlocks.ts +120 -120
  371. package/src/ruvocal/src/lib/utils/parseIncompleteMarkdown.ts +644 -644
  372. package/src/ruvocal/src/lib/utils/parseStringToList.ts +10 -10
  373. package/src/ruvocal/src/lib/utils/randomUuid.ts +14 -14
  374. package/src/ruvocal/src/lib/utils/searchTokens.ts +33 -33
  375. package/src/ruvocal/src/lib/utils/sha256.ts +7 -7
  376. package/src/ruvocal/src/lib/utils/stringifyError.ts +12 -12
  377. package/src/ruvocal/src/lib/utils/sum.ts +3 -3
  378. package/src/ruvocal/src/lib/utils/template.spec.ts +59 -59
  379. package/src/ruvocal/src/lib/utils/template.ts +53 -53
  380. package/src/ruvocal/src/lib/utils/timeout.ts +9 -9
  381. package/src/ruvocal/src/lib/utils/toolProgress.spec.ts +46 -46
  382. package/src/ruvocal/src/lib/utils/toolProgress.ts +11 -11
  383. package/src/ruvocal/src/lib/utils/tree/addChildren.spec.ts +102 -102
  384. package/src/ruvocal/src/lib/utils/tree/addChildren.ts +48 -48
  385. package/src/ruvocal/src/lib/utils/tree/addSibling.spec.ts +81 -81
  386. package/src/ruvocal/src/lib/utils/tree/addSibling.ts +41 -41
  387. package/src/ruvocal/src/lib/utils/tree/buildSubtree.spec.ts +110 -110
  388. package/src/ruvocal/src/lib/utils/tree/buildSubtree.ts +24 -24
  389. package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.spec.ts +31 -31
  390. package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.ts +36 -36
  391. package/src/ruvocal/src/lib/utils/tree/isMessageId.spec.ts +15 -15
  392. package/src/ruvocal/src/lib/utils/tree/isMessageId.ts +5 -5
  393. package/src/ruvocal/src/lib/utils/tree/tree.d.ts +14 -14
  394. package/src/ruvocal/src/lib/utils/tree/treeHelpers.spec.ts +167 -167
  395. package/src/ruvocal/src/lib/utils/updates.ts +39 -39
  396. package/src/ruvocal/src/lib/utils/urlParams.ts +13 -13
  397. package/src/ruvocal/src/lib/wasm/idb.ts +438 -438
  398. package/src/ruvocal/src/lib/wasm/index.ts +1213 -1213
  399. package/src/ruvocal/src/lib/wasm/tests/wasm-capabilities.test.ts +565 -565
  400. package/src/ruvocal/src/lib/wasm/wasm.worker.ts +332 -332
  401. package/src/ruvocal/src/lib/wasm/workerClient.ts +166 -166
  402. package/src/ruvocal/src/lib/workers/autopilotWorker.ts +221 -221
  403. package/src/ruvocal/src/lib/workers/detailFetchWorker.ts +100 -100
  404. package/src/ruvocal/src/lib/workers/markdownWorker.ts +61 -61
  405. package/src/ruvocal/src/routes/+error.svelte +20 -20
  406. package/src/ruvocal/src/routes/+layout.svelte +324 -324
  407. package/src/ruvocal/src/routes/+layout.ts +91 -91
  408. package/src/ruvocal/src/routes/+page.svelte +168 -168
  409. package/src/ruvocal/src/routes/.well-known/oauth-cimd/+server.ts +37 -37
  410. package/src/ruvocal/src/routes/__debug/openai/+server.ts +21 -21
  411. package/src/ruvocal/src/routes/admin/export/+server.ts +159 -159
  412. package/src/ruvocal/src/routes/admin/stats/compute/+server.ts +16 -16
  413. package/src/ruvocal/src/routes/api/conversation/[id]/+server.ts +40 -40
  414. package/src/ruvocal/src/routes/api/conversation/[id]/message/[messageId]/+server.ts +42 -42
  415. package/src/ruvocal/src/routes/api/conversations/+server.ts +48 -48
  416. package/src/ruvocal/src/routes/api/fetch-url/+server.ts +147 -147
  417. package/src/ruvocal/src/routes/api/mcp/health/+server.ts +292 -292
  418. package/src/ruvocal/src/routes/api/mcp/servers/+server.ts +32 -32
  419. package/src/ruvocal/src/routes/api/models/+server.ts +25 -25
  420. package/src/ruvocal/src/routes/api/transcribe/+server.ts +104 -104
  421. package/src/ruvocal/src/routes/api/user/+server.ts +15 -15
  422. package/src/ruvocal/src/routes/api/user/validate-token/+server.ts +20 -20
  423. package/src/ruvocal/src/routes/api/v2/conversations/+server.ts +48 -48
  424. package/src/ruvocal/src/routes/api/v2/conversations/[id]/+server.ts +94 -94
  425. package/src/ruvocal/src/routes/api/v2/conversations/[id]/message/[messageId]/+server.ts +43 -43
  426. package/src/ruvocal/src/routes/api/v2/conversations/import-share/+server.ts +23 -23
  427. package/src/ruvocal/src/routes/api/v2/debug/config/+server.ts +16 -16
  428. package/src/ruvocal/src/routes/api/v2/debug/refresh/+server.ts +30 -30
  429. package/src/ruvocal/src/routes/api/v2/export/+server.ts +196 -196
  430. package/src/ruvocal/src/routes/api/v2/feature-flags/+server.ts +14 -14
  431. package/src/ruvocal/src/routes/api/v2/models/+server.ts +38 -38
  432. package/src/ruvocal/src/routes/api/v2/models/[namespace]/+server.ts +8 -8
  433. package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/+server.ts +8 -8
  434. package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/subscribe/+server.ts +28 -28
  435. package/src/ruvocal/src/routes/api/v2/models/[namespace]/subscribe/+server.ts +28 -28
  436. package/src/ruvocal/src/routes/api/v2/models/old/+server.ts +7 -7
  437. package/src/ruvocal/src/routes/api/v2/models/refresh/+server.ts +33 -33
  438. package/src/ruvocal/src/routes/api/v2/public-config/+server.ts +7 -7
  439. package/src/ruvocal/src/routes/api/v2/user/+server.ts +17 -17
  440. package/src/ruvocal/src/routes/api/v2/user/billing-orgs/+server.ts +73 -73
  441. package/src/ruvocal/src/routes/api/v2/user/reports/+server.ts +17 -17
  442. package/src/ruvocal/src/routes/api/v2/user/settings/+server.ts +110 -110
  443. package/src/ruvocal/src/routes/conversation/+server.ts +115 -115
  444. package/src/ruvocal/src/routes/conversation/[id]/+page.svelte +586 -586
  445. package/src/ruvocal/src/routes/conversation/[id]/+page.ts +60 -60
  446. package/src/ruvocal/src/routes/conversation/[id]/+server.ts +740 -740
  447. package/src/ruvocal/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts +66 -66
  448. package/src/ruvocal/src/routes/conversation/[id]/share/+server.ts +69 -69
  449. package/src/ruvocal/src/routes/conversation/[id]/stop-generating/+server.ts +35 -35
  450. package/src/ruvocal/src/routes/healthcheck/+server.ts +3 -3
  451. package/src/ruvocal/src/routes/login/+server.ts +5 -5
  452. package/src/ruvocal/src/routes/login/callback/+server.ts +103 -103
  453. package/src/ruvocal/src/routes/login/callback/updateUser.spec.ts +157 -157
  454. package/src/ruvocal/src/routes/login/callback/updateUser.ts +215 -215
  455. package/src/ruvocal/src/routes/logout/+server.ts +18 -18
  456. package/src/ruvocal/src/routes/metrics/+server.ts +18 -18
  457. package/src/ruvocal/src/routes/models/+page.svelte +233 -233
  458. package/src/ruvocal/src/routes/models/[...model]/+page.svelte +161 -161
  459. package/src/ruvocal/src/routes/models/[...model]/+page.ts +14 -14
  460. package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/+server.ts +64 -64
  461. package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/ModelThumbnail.svelte +28 -28
  462. package/src/ruvocal/src/routes/privacy/+page.svelte +11 -11
  463. package/src/ruvocal/src/routes/r/[id]/+page.ts +34 -34
  464. package/src/ruvocal/src/routes/settings/(nav)/+layout.svelte +282 -282
  465. package/src/ruvocal/src/routes/settings/(nav)/+layout.ts +1 -1
  466. package/src/ruvocal/src/routes/settings/(nav)/+server.ts +59 -59
  467. package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.svelte +464 -464
  468. package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.ts +14 -14
  469. package/src/ruvocal/src/routes/settings/(nav)/application/+page.svelte +362 -362
  470. package/src/ruvocal/src/routes/settings/+layout.svelte +40 -40
  471. package/src/ruvocal/src/styles/highlight-js.css +195 -195
  472. package/src/ruvocal/src/styles/main.css +144 -144
  473. package/src/ruvocal/static/chatui/favicon-dark.svg +3 -3
  474. package/src/ruvocal/static/chatui/favicon-dev.svg +3 -3
  475. package/src/ruvocal/static/chatui/favicon.svg +3 -3
  476. package/src/ruvocal/static/chatui/icon.svg +3 -3
  477. package/src/ruvocal/static/chatui/logo.svg +7 -7
  478. package/src/ruvocal/static/chatui/manifest.json +54 -54
  479. package/src/ruvocal/static/chatui/welcome.js +184 -184
  480. package/src/ruvocal/static/huggingchat/favicon-dark.svg +4 -4
  481. package/src/ruvocal/static/huggingchat/favicon-dev.svg +4 -4
  482. package/src/ruvocal/static/huggingchat/favicon.svg +4 -4
  483. package/src/ruvocal/static/huggingchat/fulltext-logo.svg +1 -1
  484. package/src/ruvocal/static/huggingchat/icon.svg +4 -4
  485. package/src/ruvocal/static/huggingchat/logo.svg +4 -4
  486. package/src/ruvocal/static/huggingchat/manifest.json +54 -54
  487. package/src/ruvocal/static/huggingchat/routes.chat.json +226 -226
  488. package/src/ruvocal/static/robots.txt +10 -10
  489. package/src/ruvocal/static/wasm/rvagent_wasm.js +1539 -1539
  490. package/src/ruvocal/stub/@reflink/reflink/package.json +5 -5
  491. package/src/ruvocal/svelte.config.js +53 -53
  492. package/src/ruvocal/tailwind.config.cjs +30 -30
  493. package/src/ruvocal/tsconfig.json +19 -19
  494. package/src/ruvocal/vite.config.ts +87 -87
  495. package/src/scripts/deploy.sh +116 -116
  496. package/src/scripts/generate-config.js +245 -245
  497. package/src/scripts/generate-welcome.js +187 -187
  498. package/src/scripts/package-rvf.sh +116 -116
@@ -0,0 +1,989 @@
1
+ [2026-05-05T02:50:11.866Z] PROMPT
2
+ ============================================================
3
+ Analyze this codebase for security vulnerabilities:
4
+ - Check for hardcoded secrets (API keys, passwords)
5
+ - Identify SQL injection risks
6
+ - Find XSS vulnerabilities
7
+ - Check for insecure dependencies
8
+ - Identify authentication/authorization issues
9
+
10
+ Provide a JSON report with:
11
+ {
12
+ "vulnerabilities": [{ "severity": "high|medium|low", "file": "...", "line": N, "description": "..." }],
13
+ "riskScore": 0-100,
14
+ "recommendations": ["..."]
15
+ }
16
+
17
+ ## Codebase Context
18
+
19
+ --- .husky/lint-stage-config.js ---
20
+ export default {
21
+ "*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"],
22
+ "*.json": ["prettier --write"],
23
+ };
24
+
25
+
26
+ --- .svelte-kit/adapter-node/_app/immutable/workers/markdownWorker-C-YfesBE.js (truncated) ---
27
+ (function(){"use strict";class Je{constructor(e,t,a){this.lexer=void 0,this.start=void 0,this.end=void 0,this.lexer=e,this.start=t,this.end=a}static range(e,t){return t?!e||!e.loc||!t.loc||e.loc.lexer!==t.loc.lexer?null:new Je(e.loc.lexer,e.loc.start,t.loc.end):e&&e.loc}}class it{constructor(e,t){this.text=void 0,this.loc=void 0,this.noexpand=void 0,this.treatAsRelax=void 0,this.text=e,this.loc=t}range(e,t){return new it(t,Je.range(this,e))}}class R{constructor(e,t){this.name=void 0,this.position=void 0,this.length=void 0,this.rawMessage=void 0;var a="KaTeX parse error: "+e,n,i,u=t&&t.loc;if(u&&u.start<=u.end){var o=u.lexer.input;n=u.start,i=u.end,n===o.length?a+=" at end of input: ":a+=" at position "+(n+1)+": ";var c=o.slice(n,i).replace(/[^]/g,"$&̲"),h;n>15?h="…"+o.slice(n-15,n):h=o.slice(0,n);var m;i+15<o.length?m=o.slice(i,i+15)+"…":m=o.slice(i),a+=h+c+m}var p=new Error(a);return p.name="ParseError",p.__proto__=R.prototype,p.position=n,n!=null&&i!=null&&(p.length=i-n),p.rawMessage=e,p}}R.prototype.__proto__=Error.prototype;var Iu=function(e,t){return e.indexOf(t)!==-1},Ou=function(e,t){return e===void 0?t:e},Ru=/([A-Z])/g,zu=function(e){return e.replace(Ru,"-$1").toLowerCase()},Cu={"&":"&amp;",">":"&gt;","<":"&lt;",'"':"&quot;","'":"&#x27;"},Du=/[&><"']/g;function Bu(r){return String(r).replace(Du,e=>Cu[e])}var $a=function r(e){return e.type==="ordgroup"||e.type==="color"?e.body.length===1?r(e.body[0]):e:e.type==="font"?r(e.body):e},Lu=function(e){var t=$a(e);return t.type==="mathord"||t.type==="textord"||t.type==="atom"},qu=function(e){if(!e)throw new Error("Expected non-null, but got "+String(e));return e},$u=function(e){var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==":"||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():"_relative"},Z={contains:Iu,deflt:Ou,escape:Bu,hyphenate:zu,getBaseElem:$a,isCharacterBox:Lu,protocolFromUrl:$u},z0={displayMode:{type:"boolean",description:"Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.",cli:"-d, --display-mode"},output:{type:{enum:["htmlAndMathml","html","mathml"]},description:"Determines the markup language of the output.",cli:"-F, --format <type>"},leqno:{type:"boolean",description:"Render display math in leqno style (left-justified tags)."},fleqn:{type:"boolean",description:"Render display math flush left."},throwOnError:{type:"boolean",default:!0,cli:"-t, --no-throw-on-error",cliDescription:"Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error."},errorColor:{type:"string",default:"#cc0000",cli:"-c, --error-color <color>",cliDescription:"A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.",cliProcessor:r=>"#"+r},macros:{type:"object",cli:"-m, --macro <def>",cliDescription:"Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).",cliDefault:[],cliProcessor:(r,e)=>(e.push(r),e)},minRuleThickness:{type:"number",description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:r=>Math.max(0,r),cli:"--min-rule-thickness <size>",cliProcessor:parseFloat},colorIsTextColor:{type:"boolean",description:"Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.",cli:"-b, --color-is-text-color"},strict:{type:[{enum:["warn","ignore","error"]},"boolean","function"],description:"Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.",cli:"-S, --strict",cliDefault:!1},trust:{type:["boolean","function"],description:"Trust the input, enabling all HTML features such as \\url.",cli:"-T, --trust"},maxSize:{type:"number",default:1/0,description:"If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large",processor:r=>Math.max(0,r),cli:"-s, --max-size <n>",cliProcessor:parseInt},maxExpand:{type:"number",default:1e3,description:"Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.",processor:r=>Math.max(0,r),cli:"-e, --max-expand <n>",cliProcessor:r=>r==="Infinity"?1/0:parseInt(r)},globalGroup:{type:"boolean",cli:!1}};function Pu(r){if(r.default)return r.default;var e=r.type,t=Array.isArray(e)?e[0]:e;if(typeof t!="string")return t.enum[0];switch(t){case"boolean":return!1;case"string":return"";case"number":return 0;case"object":return{}}}class kr{constructor(e){this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.
28
+
29
+ --- .svelte-kit/adapter-node/chunks/APIClient.js ---
30
+ import { b as base } from "./server.js";
31
+ import "./url.js";
32
+ import "@sveltejs/kit/internal/server";
33
+ import "./root.js";
34
+ import superjson from "superjson";
35
+ import ObjectId from "bson-objectid";
36
+ superjson.registerCustom(
37
+ {
38
+ isApplicable: (value) => {
39
+ if (typeof value !== "string" && ObjectId.isValid(value)) {
40
+ const str = value.toString();
41
+ return /^[0-9a-fA-F]{24}$/.test(str);
42
+ }
43
+ return false;
44
+ },
45
+ serialize: (value) => value.toString(),
46
+ deserialize: (value) => new ObjectId(value)
47
+ },
48
+ "ObjectId"
49
+ );
50
+ async function apiCall(fetcher, url, method, body, query) {
51
+ const u = new URL(url);
52
+ if (query) {
53
+ for (const [k, v] of Object.entries(query)) {
54
+ if (v !== void 0 && v !== null) {
55
+ u.searchParams.set(k, String(v));
56
+ }
57
+ }
58
+ }
59
+ const init = { method };
60
+ if (body !== void 0 && body !== null) {
61
+ init.headers = { "Content-Type": "application/json" };
62
+ init.body = JSON.stringify(body);
63
+ }
64
+ const res = await fetcher(u.toString(), init);
65
+ if (!res.ok) {
66
+ let errorBody;
67
+ try {
68
+ errorBody = await res.json();
69
+ } catch {
70
+ errorBody = await res.text().catch(() => res.statusText);
71
+ }
72
+ return { data: null, error: errorBody, status: res.status };
73
+ }
74
+ const text = await res.text();
75
+ if (!text) {
76
+ return { data: null, error: null, status: res.status };
77
+ }
78
+ return { data: text, error: null, status: res.status };
79
+ }
80
+ function endpoint(fetcher, baseUrl) {
81
+ return {
82
+ get(opts) {
83
+ return apiCall(fetcher, baseUrl, "GET", void 0, opts?.query);
84
+ },
85
+ post(body) {
86
+ return apiCall(fetcher, baseUrl, "POST", body);
87
+ },
88
+ patch(body) {
89
+ return apiCall(fetcher, baseUrl, "PATCH", body);
90
+ },
91
+ delete() {
92
+ return apiCall(fetcher, baseUrl, "DELETE");
93
+ }
94
+ };
95
+ }
96
+ function useAPIClient({
97
+ fetch: customFetch,
98
+ origin
99
+ } = {}) {
100
+ const fetcher = customFetch ?? globalThis.fetch;
101
+ const baseUrl = `${origin ?? `http://localhost:5173`}${base}/api/v2`;
102
+ return {
103
+ conversations: Object.assign(
104
+ // client.conversations({ id: "..." }) — returns endpoint for /conversations/:id
105
+ (params) => ({
106
+ ...endpoint(fetcher, `${baseUrl}/conversations/${params.id}`),
107
+ message: (msgParams) => endpoint(fetcher, `${baseUrl}/conversations/${params.id}/message/${msgParams.messageId}`)
108
+ }),
109
+ // client.conversations.get(), .delete()
110
+ {
111
+ ...endpoint(fetcher, `${baseUrl}/conversations`),
112
+ "import-share": endpoint(fetcher, `${baseUrl}/conversations/import-share`)
113
+ }
114
+ ),
115
+ user: {
116
+ ...endpoint(fetcher, `${baseUrl}/user`),
117
+ settings: endpoint(fetcher, `${baseUrl}/user/settings`),
118
+ reports: endpoint(fetcher, `${baseUrl}/user/reports`),
119
+ "billing-orgs": endpoint(fetcher, `${baseUrl}/user/billing-orgs`)
120
+ },
121
+ models: {
122
+ ...endpoint(fetcher, `${baseUrl}/models`),
123
+ old: endpoint(fetcher, `${baseUrl}/models/old`),
124
+ refresh: endpoint(fetcher, `${baseUrl}/models/refresh`)
125
+ },
126
+ "public-config": endpoint(fetcher, `${baseUrl}/public-config`),
127
+ "feature-flags": endpoint(fetcher, `${baseUrl}/feature-flags`),
128
+ debug: {
129
+ config: endpoint(fetcher, `${baseUrl}/debug/config`),
130
+ refresh: endpoint(fetcher, `${baseUrl}/debug/refresh`)
131
+ },
132
+ export: endpoint(fetcher, `${baseUrl}/export`)
133
+ };
134
+ }
135
+ function handleResponse(response) {
136
+ if (response.error) {
137
+ throw new Error(JSON.stringify(response.error));
138
+ }
139
+ if (response.data === null) {
140
+ return null;
141
+ }
142
+ return superjson.parse(
143
+ typeof response.data === "string" ? response.data : JSON.stringify(response.data)
144
+ );
145
+ }
146
+ export {
147
+ handleResponse as h,
148
+ useAPIClient as u
149
+ };
150
+
151
+
152
+ --- .svelte-kit/adapter-node/chunks/IconCheap.js ---
153
+ import { i as attr_class, p as clsx } from "./root.js";
154
+ function IconFast($$renderer, $$props) {
155
+ let { classNames = "" } = $$props;
156
+ $$renderer.push(`<svg${attr_class(clsx(classNames))} width="1em" height="1em" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 2a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0 .8A3.2 3.2 0 0 1 9.2 6c0 .96-.4 1.8-1.08 2.4-.56-.52-1.32-.8-2.12-.8s-1.52.28-2.12.8A3.15 3.15 0 0 1 2.8 6 3.2 3.2 0 0 1 6 2.8Zm-.8.8a.4.4 0 1 0 0 .8.4.4 0 0 0 0-.8Zm1.6 0a.4.4 0 1 0 0 .8.4.4 0 0 0 0-.8Zm1.236 1.176c-.052 0-.1.012-.156.024l-1.28.528-.108.044a.807.807 0 0 0-1.053.059.796.796 0 0 0-.008 1.13.796.796 0 0 0 .869.179.81.81 0 0 0 .5-.628l.092-.04 1.288-.52.008-.004a.4.4 0 0 0-.152-.772ZM4 4.8a.4.4 0 1 0 0 .8.4.4 0 0 0 0-.8Z" fill="currentColor"></path></svg>`);
157
+ }
158
+ function IconCheap($$renderer, $$props) {
159
+ let { classNames = "" } = $$props;
160
+ $$renderer.push(`<svg${attr_class(clsx(classNames))} width="1em" height="1em" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 7.778a.856.856 0 0 1-.628-.261.858.858 0 0 1-.26-.628c-.001-.245.086-.454.26-.628A.861.861 0 0 1 6 6c.244 0 .453.087.628.261a.852.852 0 0 1 .26.628.867.867 0 0 1-.26.628.844.844 0 0 1-.628.26Zm-2.056-4h4.112l.566-1.134a.423.423 0 0 0-.017-.433A.42.42 0 0 0 8.222 2H3.778c-.17 0-.298.07-.383.211a.424.424 0 0 0-.017.433l.566 1.134ZM4.4 10h3.2c.667 0 1.233-.231 1.7-.694.467-.463.7-1.032.7-1.706 0-.281-.048-.556-.144-.822a2.404 2.404 0 0 0-.412-.722L8.29 4.666H3.71l-1.155 1.39a2.404 2.404 0 0 0-.412.722C2.048 7.044 2 7.318 2 7.6c0 .674.232 1.243.695 1.706.463.463 1.031.694 1.705.694Z" fill="currentColor"></path></svg>`);
161
+ }
162
+ export {
163
+ IconFast as I,
164
+ IconCheap as a
165
+ };
166
+
167
+
168
+ --- .svelte-kit/adapter-node/chunks/IconOmni.js (truncated) ---
169
+ import { i as attr_class, j as stringify } from "./root.js";
170
+ function IconOmni($$renderer, $$props) {
171
+ let { classNames = "" } = $$props;
172
+ $$renderer.push(`<svg${attr_class(`${stringify(classNames)} hidden dark:inline`)} width="1em" height="1em" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.97736 12.1813C6.25011 12.516 6.57428 12.8946 6.98029 13.2741C5.89251 13.8066 4.44063 14.1305 2.34747 14.1306V12.7272C4.02144 12.7272 5.15855 12.5026 5.97736 12.1813ZM10.0789 6.00458C10.3483 6.3067 10.6247 6.56949 10.9725 6.79364C11.5911 7.19216 12.4914 7.49774 14.0526 7.49774V8.90204C12.4915 8.90204 11.5911 9.20765 10.9725 9.60614C10.6249 9.83013 10.3481 10.0924 10.0789 10.3942C9.78258 10.1597 9.52333 9.87047 9.21271 9.48798C9.18183 9.44996 9.14961 9.40984 9.11603 9.36786C9.42491 9.03403 9.77986 8.70638 10.2127 8.42743C10.3378 8.34683 10.4686 8.27118 10.6053 8.19989C10.4686 8.12858 10.3378 8.05297 10.2127 7.97235C9.77958 7.69322 9.42506 7.365 9.11603 7.03094C9.1494 6.98922 9.18201 6.9496 9.21271 6.9118C9.52349 6.52912 9.78237 6.2392 10.0789 6.00458ZM2.34747 2.26923C4.44032 2.26927 5.89256 2.59232 6.98029 3.12469C6.57429 3.50414 6.25012 3.8828 5.97736 4.21747C5.15858 3.89631 4.02115 3.67356 2.34747 3.67352V2.26923Z" fill="url(#paint0_linear_3699_582)"></path><path d="M14.052 3.67331C12.0512 3.67337 10.8161 3.98917 9.97647 4.41441C9.14382 4.83623 8.63688 5.39533 8.12318 6.02791C7.62178 6.64535 7.06413 7.40735 6.18741 7.97235C6.06225 8.053 5.93137 8.12889 5.79462 8.20022C5.93144 8.27158 6.06219 8.34739 6.18741 8.42808C7.06422 8.99314 7.62174 9.75505 8.12318 10.3725C8.6369 11.0051 9.14374 11.5642 9.97647 11.986C10.8161 12.4113 12.0512 12.7271 14.052 12.7271V14.1312C11.9098 14.1311 10.4387 13.7932 9.34279 13.2382C8.24007 12.6797 7.58149 11.9313 7.03377 11.2569C6.47365 10.5671 6.07238 10.0218 5.42786 9.60647C4.80925 9.20786 3.90875 8.90226 2.34735 8.90226V7.49818C3.90859 7.49818 4.80926 7.19251 5.42786 6.79397C6.07232 6.37865 6.47373 5.83323 7.03377 5.14358C7.58147 4.46911 8.24014 3.72078 9.34279 3.16224C10.4387 2.60722 11.9098 2.26929 14.052 2.26923V3.67331Z" fill="url(#paint1_linear_3699_582)"></path><defs><linearGradient id="paint0_linear_3699_582" x1="10.2846" y1="8.06294" x2="-0.714687" y2="8.06294" gradientUnits="userSpaceOnUse"><stop stop-color="white"></stop><stop offset="1" stop-color="white" stop-opacity="0"></stop></linearGradient><linearGradient id="paint1_linear_3699_582" x1="1.34749" y1="8.06326" x2="14.273" y2="8.06326" gradientUnits="userSpaceOnUse"><stop stop-color="white" stop-opacity="0"></stop><stop offset="1" stop-color="white"></stop></linearGradient></defs></svg><svg${attr_class(`${stringify(classNames)} inline dark:hidden`)} width="1em" height="1em" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.97723 12.3813C6.24999 12.716 6.57417 13.0946 6.98016 13.4741C5.89247 14.0066 4.44119 14.3305 2.34833 14.3306V12.9272C4.02198 12.9272 5.1585 12.7025 5.97723 12.3813ZM10.0788 6.20459C10.3481 6.50673 10.6245 6.76948 10.9724 6.99365C11.5909 7.39219 12.4912 7.69774 14.0524 7.69775V9.10205C12.4913 9.10207 11.5909 9.40765 10.9724 9.80615C10.6248 10.0302 10.348 10.2924 10.0788 10.5942C9.78249 10.3597 9.52319 10.0704 9.21259 9.68799C9.18171 9.64997 9.14949 9.60986 9.11591 9.56787C9.42481 9.23402 9.77972 8.9064 10.2126 8.62744C10.3377 8.54682 10.4685 8.47121 10.6052 8.3999C10.4685 8.32859 10.3377 8.25299 10.2126 8.17236C9.77943 7.89322 9.42495 7.56504 9.11591 7.23096C9.1493 7.18921 9.18187 7.14963 9.21259 7.11182C9.52337 6.72913 9.78226 6.43921 10.0788 6.20459ZM2.34833 2.46924C4.44088 2.46933 5.89252 2.7924 6.98016 3.32471C6.57418 3.70415 6.25 4.08282 5.97723 4.41748C5.15853 4.09637 4.0217 3.87361 2.34833 3.87354V2.46924Z" fill="url(#paint0_linear_3699_575)"></path><path d="M14.052 3.87332C12.0512 3.87338 10.8161 4.18918 9.97647 4.61442C9.14382 5.03624 8.63688 5.59534 8.12318 6.22792C7.62178 6.84536 7.06413 7.60736 6.18741 8.17236C6.06225 8.25301 5.93137 8.3289 5.79462 8.40023C5.93144 8.47159 6.06219 8.5474 6.18741 8.62809C7.06422 9.19316 7.62174 9.95506 8.12318 10.5725C8.6369 11.2051 9.14374 11.7642 9.97647 12.186C10.8161 12.6113 12.0512 12.9271 14.052 12.9271V14.3312C11.9098 14.3312 10.4387 13.9932 9.34279 13.4382C8.24007 12.8797 7.58149 12.1313 7.03377 11.4569C6.47365 10.7671 6.07238 10.2218 5.42786 9.80648C4.80925 9.40788 3.90875 9.10227 2.34735 9.10227V7.69819C3.90859 7.69819 4.80926 7.39252 5.42786 6.99398C6.07232 6.57866 6.47373 6.03324 7.03377 5.34359C7.58147 4.66913 8.24014 3.92079 9.34279 3.36225C10.4387 2.80724 11.9098 2.4693 14.052 2.46924V3.87332Z" fill="url(#paint1_linear_3699_575)"></path><defs><linearGradient id="paint0_linear_3699_575" x1="10.2848" y1="8.26295" x2="-0.713577" y2="8.26295" gradientUnits="userSpaceOnUse"><stop></stop><stop offset="1" stop-opacity="0"></stop></linearGradient><linearGradient id="paint1_linear_3699_575" x1="1.34749" y1="8.26327" x2="14.273" y2="8.26327" gradientUnits="userSpaceOnUse"><stop stop-opacity="0"></st
173
+
174
+ --- .svelte-kit/adapter-node/chunks/IconPro.js ---
175
+ import { w as writable } from "./index.js";
176
+ import { i as attr_class, h as attr, j as stringify } from "./root.js";
177
+ const isPro = writable(null);
178
+ function IconPro($$renderer, $$props) {
179
+ $$renderer.component(($$renderer2) => {
180
+ let { classNames = "" } = $$props;
181
+ const gradientId = `gradient-${Math.random().toString(36).slice(2, 9)}`;
182
+ $$renderer2.push(`<svg${attr_class(`text-gray-500 ${stringify(classNames)}`)} xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" width="1em" height="1em" viewBox="0 0 12 12"><defs><linearGradient${attr("id", gradientId)} x1="3.371" y1="3.43" x2="8.141" y2="8.9" gradientUnits="userSpaceOnUse"><stop stop-color="#FF0789"></stop><stop offset=".63" stop-color="#21DE75"></stop><stop offset="1" stop-color="#FF8D00"></stop></linearGradient></defs><path d="M6.481 1.26c0 1.55.67 2.58 1.5 3.24.86.68 1.9 1 2.58 1.07v.86a5.3 5.3 0 0 0-2.57 1.07 3.95 3.95 0 0 0-1.51 3.24h-.96c0-1.55-.67-2.58-1.5-3.24a5.3 5.3 0 0 0-2.58-1.07v-.86a5.3 5.3 0 0 0 2.57-1.07 3.95 3.95 0 0 0 1.51-3.24h.96Z"${attr("fill", `url(#${stringify(gradientId)})`)}></path></svg>`);
183
+ });
184
+ }
185
+ export {
186
+ IconPro as I,
187
+ isPro as i
188
+ };
189
+
190
+
191
+ --- .svelte-kit/adapter-node/chunks/MessageUpdate.js ---
192
+ var MessageUpdateType = /* @__PURE__ */ ((MessageUpdateType2) => {
193
+ MessageUpdateType2["Status"] = "status";
194
+ MessageUpdateType2["Title"] = "title";
195
+ MessageUpdateType2["Tool"] = "tool";
196
+ MessageUpdateType2["Stream"] = "stream";
197
+ MessageUpdateType2["File"] = "file";
198
+ MessageUpdateType2["FinalAnswer"] = "finalAnswer";
199
+ MessageUpdateType2["Reasoning"] = "reasoning";
200
+ MessageUpdateType2["RouterMetadata"] = "routerMetadata";
201
+ MessageUpdateType2["AutopilotStep"] = "autopilotStep";
202
+ return MessageUpdateType2;
203
+ })(MessageUpdateType || {});
204
+ var MessageUpdateStatus = /* @__PURE__ */ ((MessageUpdateStatus2) => {
205
+ MessageUpdateStatus2["Started"] = "started";
206
+ MessageUpdateStatus2["Error"] = "error";
207
+ MessageUpdateStatus2["Finished"] = "finished";
208
+ MessageUpdateStatus2["KeepAlive"] = "keepAlive";
209
+ return MessageUpdateStatus2;
210
+ })(MessageUpdateStatus || {});
211
+ var MessageToolUpdateType = /* @__PURE__ */ ((MessageToolUpdateType2) => {
212
+ MessageToolUpdateType2["Call"] = "call";
213
+ MessageToolUpdateType2["Result"] = "result";
214
+ MessageToolUpdateType2["Error"] = "error";
215
+ MessageToolUpdateType2["ETA"] = "eta";
216
+ MessageToolUpdateType2["Progress"] = "progress";
217
+ return MessageToolUpdateType2;
218
+ })(MessageToolUpdateType || {});
219
+ var MessageReasoningUpdateType = /* @__PURE__ */ ((MessageReasoningUpdateType2) => {
220
+ MessageReasoningUpdateType2["Stream"] = "stream";
221
+ MessageReasoningUpdateType2["Status"] = "status";
222
+ return MessageReasoningUpdateType2;
223
+ })(MessageReasoningUpdateType || {});
224
+ export {
225
+ MessageUpdateType as M,
226
+ MessageToolUpdateType as a,
227
+ MessageReasoningUpdateType as b,
228
+ MessageUpdateStatus as c
229
+ };
230
+
231
+
232
+ --- .svelte-kit/adapter-node/chunks/Modal.js ---
233
+ import { i as attr_class, p as clsx } from "./root.js";
234
+ import { o as onDestroy } from "./index-server.js";
235
+ import "clsx";
236
+ import { C as Close } from "./close.js";
237
+ function Portal($$renderer, $$props) {
238
+ $$renderer.component(($$renderer2) => {
239
+ let { children } = $$props;
240
+ onDestroy(() => {
241
+ });
242
+ $$renderer2.push(`<div class="contents" hidden="">`);
243
+ children?.($$renderer2);
244
+ $$renderer2.push(`<!----></div>`);
245
+ });
246
+ }
247
+ function Modal($$renderer, $$props) {
248
+ $$renderer.component(($$renderer2) => {
249
+ let {
250
+ width = "max-w-sm",
251
+ children,
252
+ closeButton = false,
253
+ disableFly = false,
254
+ closeOnBackdrop = true,
255
+ onclose
256
+ } = $$props;
257
+ onDestroy(() => {
258
+ return;
259
+ });
260
+ Portal($$renderer2, {
261
+ children: ($$renderer3) => {
262
+ $$renderer3.push(`<div role="presentation" tabindex="-1" class="fixed inset-0 z-40 flex items-center justify-center bg-black/80 backdrop-blur-sm dark:bg-black/50">`);
263
+ if (disableFly) {
264
+ $$renderer3.push("<!--[-->");
265
+ $$renderer3.push(`<div role="dialog" tabindex="-1"${attr_class(clsx([
266
+ "scrollbar-custom relative mx-auto max-h-[95dvh] max-w-[90dvw] overflow-y-auto overflow-x-hidden rounded-2xl bg-white shadow-2xl outline-none dark:bg-gray-800 dark:text-gray-200",
267
+ width
268
+ ]))}>`);
269
+ if (closeButton) {
270
+ $$renderer3.push("<!--[-->");
271
+ $$renderer3.push(`<button class="absolute right-4 top-4 z-50">`);
272
+ Close($$renderer3, { class: "size-6 text-gray-700 dark:text-gray-300" });
273
+ $$renderer3.push(`<!----></button>`);
274
+ } else {
275
+ $$renderer3.push("<!--[!-->");
276
+ }
277
+ $$renderer3.push(`<!--]--> `);
278
+ children?.($$renderer3);
279
+ $$renderer3.push(`<!----></div>`);
280
+ } else {
281
+ $$renderer3.push("<!--[!-->");
282
+ $$renderer3.push(`<div role="dialog" tabindex="-1"${attr_class(clsx([
283
+ "scrollbar-custom relative mx-auto max-h-[95dvh] max-w-[90dvw] overflow-y-auto overflow-x-hidden rounded-2xl bg-white shadow-2xl outline-none dark:bg-gray-800 dark:text-gray-200",
284
+ width
285
+ ]))}>`);
286
+ if (closeButton) {
287
+ $$renderer3.push("<!--[-->");
288
+ $$renderer3.push(`<button class="absolute right-4 top-4 z-50">`);
289
+ Close($$renderer3, { class: "size-6 text-gray-700 dark:text-gray-300" });
290
+ $$renderer3.push(`<!----></button>`);
291
+ } else {
292
+ $$renderer3.push("<!--[!-->");
293
+ }
294
+ $$renderer3.push(`<!--]--> `);
295
+ children?.($$renderer3);
296
+ $$renderer3.push(`<!----></div>`);
297
+ }
298
+ $$renderer3.push(`<!--]--></div>`);
299
+ }
300
+ });
301
+ });
302
+ }
303
+ export {
304
+ Modal as M
305
+ };
306
+
307
+
308
+ --- .svelte-kit/adapter-node/chunks/PublicConfig.svelte.js ---
309
+ import "clsx";
310
+ import { E as getContext } from "./root.js";
311
+ import "./client2.js";
312
+ import { b as base } from "./server.js";
313
+ import "./url.js";
314
+ import "@sveltejs/kit/internal/server";
315
+ class PublicConfigManager {
316
+ #configStore = {};
317
+ constructor(initialConfig) {
318
+ this.init = this.init.bind(this);
319
+ this.getPublicConfig = this.getPublicConfig.bind(this);
320
+ if (initialConfig) {
321
+ this.init(initialConfig);
322
+ }
323
+ }
324
+ init(publicConfig) {
325
+ this.#configStore = publicConfig;
326
+ }
327
+ get(key) {
328
+ return this.#configStore[key];
329
+ }
330
+ getPublicConfig() {
331
+ return this.#configStore;
332
+ }
333
+ get isHuggingChat() {
334
+ return this.#configStore.PUBLIC_APP_ASSETS === "huggingchat";
335
+ }
336
+ get assetPath() {
337
+ const origin = this.#configStore.PUBLIC_ORIGIN || "";
338
+ return origin + base + "/" + (this.#configStore.PUBLIC_APP_ASSETS || "chatui");
339
+ }
340
+ }
341
+ function getConfigManager(initialConfig) {
342
+ const publicConfigManager = new PublicConfigManager(initialConfig);
343
+ const publicConfig = new Proxy(publicConfigManager, {
344
+ get(target, prop) {
345
+ if (prop in target) {
346
+ return Reflect.get(target, prop);
347
+ }
348
+ if (typeof prop === "string") {
349
+ return target.get(prop);
350
+ }
351
+ return void 0;
352
+ },
353
+ set(target, prop, value, receiver) {
354
+ if (prop in target) {
355
+ return Reflect.set(target, prop, value, receiver);
356
+ }
357
+ return false;
358
+ }
359
+ });
360
+ return publicConfig;
361
+ }
362
+ const publicConfigTransporter = {
363
+ encode: (value) => value instanceof PublicConfigManager ? JSON.stringify(value.getPublicConfig()) : false,
364
+ decode: (value) => getConfigManager(JSON.parse(value))
365
+ };
366
+ const usePublicConfig = () => getContext("publicConfig");
367
+ export {
368
+ getConfigManager as g,
369
+ publicConfigTransporter as p,
370
+ usePublicConfig as u
371
+ };
372
+
373
+
374
+ --- .svelte-kit/adapter-node/chunks/Settings.js ---
375
+ import { d as defaultModel } from "./models.js";
376
+ const DEFAULT_SETTINGS = {
377
+ shareConversationsWithModelAuthors: true,
378
+ activeModel: defaultModel.id,
379
+ customPrompts: {},
380
+ multimodalOverrides: {},
381
+ toolsOverrides: {},
382
+ hidePromptExamples: {},
383
+ providerOverrides: {},
384
+ streamingMode: "smooth",
385
+ directPaste: false,
386
+ hapticsEnabled: true,
387
+ autopilotEnabled: true,
388
+ autopilotMaxSteps: 10
389
+ };
390
+ export {
391
+ DEFAULT_SETTINGS as D
392
+ };
393
+
394
+
395
+ --- .svelte-kit/adapter-node/chunks/Switch.js ---
396
+ import { h as attr, o as bind_props } from "./root.js";
397
+ function Switch($$renderer, $$props) {
398
+ $$renderer.component(($$renderer2) => {
399
+ let { checked = void 0, name } = $$props;
400
+ $$renderer2.push(`<input${attr("checked", checked, true)} type="checkbox"${attr("name", name)} class="peer pointer-events-none absolute opacity-0"/> <div${attr("aria-checked", checked)} aria-roledescription="switch" aria-label="switch" role="switch" tabindex="0" class="relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full bg-gray-300 p-1 shadow-inner ring-gray-400 peer-checked:bg-blue-600 hover:bg-gray-400 peer-checked:hover:bg-blue-600 focus-visible:ring focus-visible:ring-offset-1 dark:bg-gray-600 dark:ring-gray-700 dark:hover:bg-gray-500 dark:peer-checked:hover:bg-blue-600 peer-checked:[&amp;>div]:translate-x-3.5"><div class="h-3.5 w-3.5 rounded-full bg-white shadow-sm transition-transform"></div></div>`);
401
+ bind_props($$props, { checked });
402
+ });
403
+ }
404
+ export {
405
+ Switch as S
406
+ };
407
+
408
+
409
+ --- .svelte-kit/adapter-node/chunks/UrlDependency.js ---
410
+ var UrlDependency = /* @__PURE__ */ ((UrlDependency2) => {
411
+ UrlDependency2["ConversationList"] = "conversation:list";
412
+ UrlDependency2["Conversation"] = "conversation:id";
413
+ return UrlDependency2;
414
+ })(UrlDependency || {});
415
+ export {
416
+ UrlDependency as U
417
+ };
418
+
419
+
420
+ --- .svelte-kit/adapter-node/chunks/abortRegistry.js ---
421
+ import { l as logger } from "./logger.js";
422
+ class AbortRegistry {
423
+ constructor() {
424
+ this.controllers = /* @__PURE__ */ new Map();
425
+ }
426
+ static getInstance() {
427
+ if (!AbortRegistry.instance) {
428
+ AbortRegistry.instance = new AbortRegistry();
429
+ }
430
+ return AbortRegistry.instance;
431
+ }
432
+ register(conversationId, controller) {
433
+ const key = conversationId.toString();
434
+ let set = this.controllers.get(key);
435
+ if (!set) {
436
+ set = /* @__PURE__ */ new Set();
437
+ this.controllers.set(key, set);
438
+ }
439
+ set.add(controller);
440
+ controller.signal.addEventListener(
441
+ "abort",
442
+ () => {
443
+ this.unregister(key, controller);
444
+ },
445
+ { once: true }
446
+ );
447
+ }
448
+ abort(conversationId) {
449
+ const set = this.controllers.get(conversationId);
450
+ if (!set?.size) return;
451
+ logger.debug({ conversationId }, "Aborting active generation via AbortRegistry");
452
+ for (const controller of set) {
453
+ if (!controller.signal.aborted) {
454
+ controller.abort();
455
+ }
456
+ }
457
+ this.controllers.delete(conversationId);
458
+ }
459
+ unregister(conversationId, controller) {
460
+ const set = this.controllers.get(conversationId);
461
+ if (!set) return;
462
+ set.delete(controller);
463
+ if (set.size === 0) {
464
+ this.controllers.delete(conversationId);
465
+ }
466
+ }
467
+ }
468
+ export {
469
+ AbortRegistry as A
470
+ };
471
+
472
+
473
+ --- .svelte-kit/adapter-node/chunks/addSibling.js ---
474
+ import { v4 } from "uuid";
475
+ function addChildren(conv, message, parentId) {
476
+ if (conv.messages.length === 0) {
477
+ const messageId2 = v4();
478
+ conv.rootMessageId = messageId2;
479
+ conv.messages.push({
480
+ ...message,
481
+ ancestors: [],
482
+ id: messageId2
483
+ });
484
+ return messageId2;
485
+ }
486
+ if (!parentId) {
487
+ throw new Error("You need to specify a parentId if this is not the first message");
488
+ }
489
+ const messageId = v4();
490
+ if (!conv.rootMessageId) {
491
+ if (!!parentId && parentId !== conv.messages[conv.messages.length - 1].id) {
492
+ throw new Error("This is a legacy conversation, you can only append to the last message");
493
+ }
494
+ conv.messages.push({ ...message, id: messageId });
495
+ return messageId;
496
+ }
497
+ const ancestors = [...conv.messages.find((m) => m.id === parentId)?.ancestors ?? [], parentId];
498
+ conv.messages.push({
499
+ ...message,
500
+ ancestors,
501
+ id: messageId,
502
+ children: []
503
+ });
504
+ const parent = conv.messages.find((m) => m.id === parentId);
505
+ if (parent) {
506
+ if (parent.children) {
507
+ parent.children.push(messageId);
508
+ } else parent.children = [messageId];
509
+ }
510
+ return messageId;
511
+ }
512
+ function addSibling(conv, message, siblingId) {
513
+ if (conv.messages.length === 0) {
514
+ throw new Error("Cannot add a sibling to an empty conversation");
515
+ }
516
+ if (!conv.rootMessageId) {
517
+ throw new Error("Cannot add a sibling to a legacy conversation");
518
+ }
519
+ const sibling = conv.messages.find((m) => m.id === siblingId);
520
+ if (!sibling) {
521
+ throw new Error("The sibling message doesn't exist");
522
+ }
523
+ if (!sibling.ancestors || sibling.ancestors?.length === 0) {
524
+ throw new Error("The sibling message is the root message, therefore we can't add a sibling");
525
+ }
526
+ const messageId = v4();
527
+ conv.messages.push({
528
+ ...message,
529
+ id: messageId,
530
+ ancestors: sibling.ancestors,
531
+ children: []
532
+ });
533
+ const nearestAncestorId = sibling.ancestors[sibling.ancestors.length - 1];
534
+ const nearestAncestor = conv.messages.find((m) => m.id === nearestAncestorId);
535
+ if (nearestAncestor) {
536
+ if (nearestAncestor.children) {
537
+ nearestAncestor.children.push(messageId);
538
+ } else nearestAncestor.children = [messageId];
539
+ }
540
+ return messageId;
541
+ }
542
+ export {
543
+ addSibling as a,
544
+ addChildren as b
545
+ };
546
+
547
+
548
+ --- .svelte-kit/adapter-node/chunks/adminToken.js ---
549
+ import { c as config } from "./config.js";
550
+ import { l as logger } from "./logger.js";
551
+ import { v4 } from "uuid";
552
+ class AdminTokenManager {
553
+ constructor() {
554
+ this.token = config.ADMIN_TOKEN || v4();
555
+ this.adminSessions = [];
556
+ }
557
+ get enabled() {
558
+ return config.ADMIN_CLI_LOGIN === "true";
559
+ }
560
+ isAdmin(sessionId) {
561
+ if (!this.enabled) return false;
562
+ return this.adminSessions.includes(sessionId);
563
+ }
564
+ checkToken(token, sessionId) {
565
+ if (!this.enabled) return false;
566
+ if (token === this.token) {
567
+ logger.info(`[ADMIN] Token validated`);
568
+ this.adminSessions.push(sessionId);
569
+ this.token = config.ADMIN_TOKEN || v4();
570
+ return true;
571
+ }
572
+ return false;
573
+ }
574
+ removeSession(sessionId) {
575
+ this.adminSessions = this.adminSessions.filter((id) => id !== sessionId);
576
+ }
577
+ displayToken() {
578
+ if (!this.enabled || config.ADMIN_TOKEN) return;
579
+ let port = process.env.PORT ? parseInt(process.env.PORT) : process.argv.includes("--port") ? parseInt(process.argv[process.argv.indexOf("--port") + 1]) : void 0;
580
+ if (!port) {
581
+ const mode = process.argv.find((arg) => arg === "preview" || arg === "dev");
582
+ if (mode === "preview") {
583
+ port = 4173;
584
+ } else if (mode === "dev") {
585
+ port = 5173;
586
+ } else {
587
+ port = 3e3;
588
+ }
589
+ }
590
+ const url = (config.PUBLIC_ORIGIN || `http://localhost:${port}`) + "?token=";
591
+ logger.info(`[ADMIN] You can login with ${url + this.token}`);
592
+ }
593
+ }
594
+ const adminTokenManager = new AdminTokenManager();
595
+ export {
596
+ adminTokenManager as a
597
+ };
598
+
599
+
600
+ --- .svelte-kit/adapter-node/chunks/apiToken.js ---
601
+ import { c as config } from "./config.js";
602
+ function getApiToken(locals) {
603
+ if (config.USE_USER_TOKEN === "true") {
604
+ if (!locals?.token) {
605
+ throw new Error("User token not found");
606
+ }
607
+ return locals.token;
608
+ }
609
+ return config.OPENAI_API_KEY || config.HF_TOKEN;
610
+ }
611
+ export {
612
+ getApiToken as g
613
+ };
614
+
615
+
616
+ --- .svelte-kit/adapter-node/chunks/arrow-up-right.js ---
617
+ import { f as sanitize_props, g as attributes } from "./root.js";
618
+ import { h as html } from "./html.js";
619
+ function Arrow_up_right($$renderer, $$props) {
620
+ const $$sanitized_props = sanitize_props($$props);
621
+ $$renderer.push(`<svg${attributes(
622
+ {
623
+ viewBox: "0 0 32 32",
624
+ width: "1.2em",
625
+ height: "1.2em",
626
+ ...$$sanitized_props
627
+ },
628
+ void 0,
629
+ void 0,
630
+ void 0,
631
+ 3
632
+ )}>${html(`<path fill="currentColor" d="M10 6v2h12.59L6 24.59L7.41 26L24 9.41V22h2V6z"/>`)}</svg>`);
633
+ }
634
+ export {
635
+ Arrow_up_right as A
636
+ };
637
+
638
+
639
+ --- .svelte-kit/adapter-node/chunks/auth.js (truncated) ---
640
+ import { generators, Issuer, custom } from "openid-client";
641
+ import { addHours, subMinutes, addWeeks, differenceInMinutes } from "date-fns";
642
+ import { c as config, S as Semaphores } from "./config.js";
643
+ import { z } from "zod";
644
+ import { redirect } from "@sveltejs/kit";
645
+ import { collections } from "./database.js";
646
+ import JSON5 from "json5";
647
+ import { l as logger } from "./logger.js";
648
+ import { ObjectId } from "mongodb";
649
+ import { a as adminTokenManager } from "./adminToken.js";
650
+ import { b as base } from "./server.js";
651
+ import "./url.js";
652
+ import "@sveltejs/kit/internal/server";
653
+ import "./root.js";
654
+ import { a as acquireLock, r as releaseLock, i as isDBLocked } from "./lock.js";
655
+ async function sha256(input) {
656
+ const utf8 = new TextEncoder().encode(input);
657
+ const hashBuffer = await crypto.subtle.digest("SHA-256", utf8);
658
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
659
+ const hashHex = hashArray.map((bytes) => bytes.toString(16).padStart(2, "0")).join("");
660
+ return hashHex;
661
+ }
662
+ const stringWithDefault = (value) => z.string().default(value).transform((el) => el ? el : value);
663
+ const OIDConfig = z.object({
664
+ CLIENT_ID: stringWithDefault(config.OPENID_CLIENT_ID),
665
+ CLIENT_SECRET: stringWithDefault(config.OPENID_CLIENT_SECRET),
666
+ PROVIDER_URL: stringWithDefault(config.OPENID_PROVIDER_URL),
667
+ SCOPES: stringWithDefault(config.OPENID_SCOPES),
668
+ NAME_CLAIM: stringWithDefault(config.OPENID_NAME_CLAIM).refine(
669
+ (el) => !["preferred_username", "email", "picture", "sub"].includes(el),
670
+ { message: "nameClaim cannot be one of the restricted keys." }
671
+ ),
672
+ TOLERANCE: stringWithDefault(config.OPENID_TOLERANCE),
673
+ RESOURCE: stringWithDefault(config.OPENID_RESOURCE),
674
+ ID_TOKEN_SIGNED_RESPONSE_ALG: z.string().optional()
675
+ }).parse(JSON5.parse(config.OPENID_CONFIG || "{}"));
676
+ const loginEnabled = !!OIDConfig.CLIENT_ID;
677
+ const sameSite = z.enum(["lax", "none", "strict"]).default(config.ALLOW_INSECURE_COOKIES === "true" ? "lax" : "none").parse(config.COOKIE_SAMESITE === "" ? void 0 : config.COOKIE_SAMESITE);
678
+ const secure = z.boolean().default(!(config.ALLOW_INSECURE_COOKIES === "true")).parse(config.COOKIE_SECURE === "" ? void 0 : config.COOKIE_SECURE === "true");
679
+ function sanitizeReturnPath(path) {
680
+ if (!path) {
681
+ return void 0;
682
+ }
683
+ if (path.startsWith("//")) {
684
+ return void 0;
685
+ }
686
+ if (!path.startsWith("/")) {
687
+ return void 0;
688
+ }
689
+ return path;
690
+ }
691
+ function refreshSessionCookie(cookies, sessionId) {
692
+ cookies.set(config.COOKIE_NAME, sessionId, {
693
+ path: "/",
694
+ // So that it works inside the space's iframe
695
+ sameSite,
696
+ secure,
697
+ httpOnly: true,
698
+ expires: addWeeks(/* @__PURE__ */ new Date(), 2)
699
+ });
700
+ }
701
+ async function findUser(sessionId, coupledCookieHash, url) {
702
+ const session = await collections.sessions.findOne({ sessionId });
703
+ if (!session) {
704
+ return { user: null, invalidateSession: false };
705
+ }
706
+ if (coupledCookieHash && session.coupledCookieHash !== coupledCookieHash) {
707
+ return { user: null, invalidateSession: true };
708
+ }
709
+ if (session.oauth?.token && session.oauth.refreshToken) {
710
+ if (differenceInMinutes(session.oauth.token.expiresAt, /* @__PURE__ */ new Date()) < 5) {
711
+ const lockKey = `${Semaphores.OAUTH_TOKEN_REFRESH}:${sessionId}`;
712
+ const lockId = await acquireLock(lockKey);
713
+ if (lockId) {
714
+ try {
715
+ const newTokenSet = await refreshOAuthToken(
716
+ { redirectURI: `${config.PUBLIC_ORIGIN}${base}/login/callback` },
717
+ session.oauth.refreshToken,
718
+ url
719
+ );
720
+ if (!newTokenSet || !newTokenSet.access_token) {
721
+ return { user: null, invalidateSession: true };
722
+ }
723
+ const updatedOAuth = tokenSetToSessionOauth(newTokenSet);
724
+ if (!updatedOAuth) {
725
+ return { user: null, invalidateSession: true };
726
+ }
727
+ await collections.sessions.updateOne(
728
+ { sessionId },
729
+ {
730
+ $set: {
731
+ oauth: updatedOAuth,
732
+ updatedAt: /* @__PURE__ */ new Date()
733
+ }
734
+ }
735
+ );
736
+ session.oauth = updatedOAuth;
737
+ } catch (err) {
738
+ logger.error(err, "Error during token refresh:");
739
+ return { user: null, invalidateSession: true };
740
+ } finally {
741
+ await releaseLock(lockKey, lockId);
742
+ }
743
+ } else if (/* @__PURE__ */ new Date() > session.oauth.token.expiresAt) {
744
+ let attempts = 0;
745
+ do {
746
+ await new Promise((resolve) => setTimeout(resolve, 200));
747
+ attempts++;
748
+ if (attempts > 20) {
749
+ return { user: null, invalidateSession: true };
750
+ }
751
+ } while (await isDBLocked(lockKey));
752
+ const updatedSession = await collections.sessions.findOne({ sessionId });
753
+ if (!updatedSession || updatedSession.oauth?.token === session.oauth.token) {
754
+ return { user: null, invalidateSession: true };
755
+ }
756
+ session.oauth = updatedSession.oauth;
757
+ }
758
+ }
759
+ }
760
+ return {
761
+ user: await collectio
762
+
763
+ --- .svelte-kit/adapter-node/chunks/buildSubtree.js ---
764
+ function isMessageId(id) {
765
+ return id.split("-").length === 5;
766
+ }
767
+ function buildSubtree(conv, id) {
768
+ if (!conv.rootMessageId) {
769
+ if (conv.messages.length === 0) return [];
770
+ const index = conv.messages.findIndex((m) => m.id === id);
771
+ if (index === -1) throw new Error("Message not found");
772
+ return conv.messages.slice(0, index + 1);
773
+ } else {
774
+ const message = conv.messages.find((m) => m.id === id);
775
+ if (!message) throw new Error("Message not found");
776
+ return [
777
+ ...message.ancestors?.map((ancestorId) => {
778
+ const ancestor = conv.messages.find((m) => m.id === ancestorId);
779
+ if (!ancestor) throw new Error("Ancestor not found");
780
+ return ancestor;
781
+ }) ?? [],
782
+ message
783
+ ];
784
+ }
785
+ }
786
+ export {
787
+ buildSubtree as b,
788
+ isMessageId as i
789
+ };
790
+
791
+
792
+ --- .svelte-kit/adapter-node/chunks/chevron-down.js (truncated) ---
793
+ import { I as ATTACHMENT_KEY, l as derived, J as hasContext, E as getContext, z as setContext, K as run, L as getAllContexts, M as on, G as spread_props, f as sanitize_props, g as attributes, i as attr_class, e as escape_html, j as stringify, p as clsx$1 } from "./root.js";
794
+ import { t as tick, m as mount, u as unmount, o as onDestroy } from "./index-server.js";
795
+ import { clsx } from "clsx";
796
+ import { computePosition, offset, shift, flip, size, arrow, hide, limitShift } from "@floating-ui/dom";
797
+ import parse from "style-to-object";
798
+ import { isTabbable, tabbable, isFocusable, focusable } from "tabbable";
799
+ import { h as html } from "./html.js";
800
+ function createAttachmentKey() {
801
+ return Symbol(ATTACHMENT_KEY);
802
+ }
803
+ const SvelteMap = globalThis.Map;
804
+ function createSubscriber(_) {
805
+ return () => {
806
+ };
807
+ }
808
+ function isFunction$1(value) {
809
+ return typeof value === "function";
810
+ }
811
+ function isObject(value) {
812
+ return value !== null && typeof value === "object";
813
+ }
814
+ const CLASS_VALUE_PRIMITIVE_TYPES = ["string", "number", "bigint", "boolean"];
815
+ function isClassValue(value) {
816
+ if (value === null || value === void 0)
817
+ return true;
818
+ if (CLASS_VALUE_PRIMITIVE_TYPES.includes(typeof value))
819
+ return true;
820
+ if (Array.isArray(value))
821
+ return value.every((item) => isClassValue(item));
822
+ if (typeof value === "object") {
823
+ if (Object.getPrototypeOf(value) !== Object.prototype)
824
+ return false;
825
+ return true;
826
+ }
827
+ return false;
828
+ }
829
+ const BoxSymbol = Symbol("box");
830
+ const isWritableSymbol = Symbol("is-writable");
831
+ function boxWith(getter, setter) {
832
+ const derived$1 = derived(getter);
833
+ if (setter) {
834
+ return {
835
+ [BoxSymbol]: true,
836
+ [isWritableSymbol]: true,
837
+ get current() {
838
+ return derived$1();
839
+ },
840
+ set current(v) {
841
+ setter(v);
842
+ }
843
+ };
844
+ }
845
+ return {
846
+ [BoxSymbol]: true,
847
+ get current() {
848
+ return getter();
849
+ }
850
+ };
851
+ }
852
+ function isBox(value) {
853
+ return isObject(value) && BoxSymbol in value;
854
+ }
855
+ function isWritableBox(value) {
856
+ return isBox(value) && isWritableSymbol in value;
857
+ }
858
+ function boxFrom(value) {
859
+ if (isBox(value)) return value;
860
+ if (isFunction$1(value)) return boxWith(value);
861
+ return simpleBox(value);
862
+ }
863
+ function boxFlatten(boxes) {
864
+ return Object.entries(boxes).reduce(
865
+ (acc, [key, b]) => {
866
+ if (!isBox(b)) {
867
+ return Object.assign(acc, { [key]: b });
868
+ }
869
+ if (isWritableBox(b)) {
870
+ Object.defineProperty(acc, key, {
871
+ get() {
872
+ return b.current;
873
+ },
874
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
875
+ set(v) {
876
+ b.current = v;
877
+ }
878
+ });
879
+ } else {
880
+ Object.defineProperty(acc, key, {
881
+ get() {
882
+ return b.current;
883
+ }
884
+ });
885
+ }
886
+ return acc;
887
+ },
888
+ {}
889
+ );
890
+ }
891
+ function toReadonlyBox(b) {
892
+ if (!isWritableBox(b)) return b;
893
+ return {
894
+ [BoxSymbol]: true,
895
+ get current() {
896
+ return b.current;
897
+ }
898
+ };
899
+ }
900
+ function simpleBox(initialValue) {
901
+ let current = initialValue;
902
+ return {
903
+ [BoxSymbol]: true,
904
+ [isWritableSymbol]: true,
905
+ get current() {
906
+ return current;
907
+ },
908
+ set current(v) {
909
+ current = v;
910
+ }
911
+ };
912
+ }
913
+ function box(initialValue) {
914
+ let current = initialValue;
915
+ return {
916
+ [BoxSymbol]: true,
917
+ [isWritableSymbol]: true,
918
+ get current() {
919
+ return current;
920
+ },
921
+ set current(v) {
922
+ current = v;
923
+ }
924
+ };
925
+ }
926
+ box.from = boxFrom;
927
+ box.with = boxWith;
928
+ box.flatten = boxFlatten;
929
+ box.readonly = toReadonlyBox;
930
+ box.isBox = isBox;
931
+ box.isWritableBox = isWritableBox;
932
+ function composeHandlers(...handlers) {
933
+ return function(e) {
934
+ for (const handler of handlers) {
935
+ if (!handler)
936
+ continue;
937
+ if (e.defaultPrevented)
938
+ return;
939
+ if (typeof handler === "function") {
940
+ handler.call(this, e);
941
+ } else {
942
+ handler.current?.call(this, e);
943
+ }
944
+ }
945
+ };
946
+ }
947
+ const NUMBER_CHAR_RE = /\d/;
948
+ const STR_SPLITTERS = ["-", "_", "/", "."];
949
+ function isUppercase(char = "") {
950
+ if (NUMBER_CHAR_RE.test(char))
951
+ return void 0;
952
+ return char !== char.toLowerCase();
953
+ }
954
+ function splitByCase(str) {
955
+ const parts = [];
956
+ let buff = "";
957
+ let previousUpper;
958
+ let previousSplitter;
959
+ for (const char of str) {
960
+ const isSplitter = STR_SPLITTERS.includes(char);
961
+ if (isSplitter === true) {
962
+ parts.push(buff);
963
+ buff = "";
964
+ previousUpper = void 0;
965
+ continue;
966
+ }
967
+ const isUpper = isUppercase(char);
968
+ if (previousSplitter === false) {
969
+ if (previousUpper === false && isUpper === true) {
970
+ parts.push(buff);
971
+ buff = char;
972
+ previousUpper = isUpper;
973
+ continue;
974
+ }
975
+ if (previousUpper === true && isUpper === false && buff.length > 1) {
976
+ const lastChar = buff.at(-1);
977
+ parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
978
+ buff = lastChar + char;
979
+ previousUpper = isUpper;
980
+ continue;
981
+ }
982
+ }
983
+ buff += char;
984
+ previousUpper = isUpper;
985
+ previousSplitte
986
+
987
+ ## Instructions
988
+
989
+ Analyze the above codebase context and provide your response following the format specified in the task.