ruflo 3.5.1 → 3.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rvf.manifest.json +295 -0
- package/package.json +16 -2
- package/src/chat-ui/Dockerfile +25 -0
- package/src/chat-ui/patch-mcp-url-safety.sh +28 -0
- package/src/chat-ui/static/chatui/icon-144x144.png +0 -0
- package/src/chat-ui/static/chatui/omni-welcome.gif +0 -0
- package/src/config/config.example.json +76 -0
- package/src/mcp-bridge/Dockerfile +45 -0
- package/src/mcp-bridge/index.js +1668 -0
- package/src/mcp-bridge/mcp-stdio-kernel.js +159 -0
- package/src/mcp-bridge/package.json +17 -0
- package/src/mcp-bridge/test-harness.js +470 -0
- package/src/nginx/Dockerfile +10 -0
- package/src/nginx/nginx.conf +67 -0
- package/src/nginx/static/favicon-dark.svg +4 -0
- package/src/nginx/static/favicon.svg +4 -0
- package/src/nginx/static/icon.svg +5 -0
- package/src/nginx/static/logo.svg +9 -0
- package/src/nginx/static/manifest.json +22 -0
- package/src/nginx/static/welcome.js +184 -0
- package/src/ruvocal/.claude/skills/add-model-descriptions/SKILL.md +73 -0
- package/src/ruvocal/.devcontainer/Dockerfile +9 -0
- package/src/ruvocal/.devcontainer/devcontainer.json +36 -0
- package/src/ruvocal/.dockerignore +13 -0
- package/src/ruvocal/.env +194 -0
- package/src/ruvocal/.env.ci +1 -0
- package/src/ruvocal/.eslintignore +13 -0
- package/src/ruvocal/.eslintrc.cjs +45 -0
- package/src/ruvocal/.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md +43 -0
- package/src/ruvocal/.github/ISSUE_TEMPLATE/config-support.md +9 -0
- package/src/ruvocal/.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md +17 -0
- package/src/ruvocal/.github/ISSUE_TEMPLATE/huggingchat.md +11 -0
- package/src/ruvocal/.github/release.yml +16 -0
- package/src/ruvocal/.github/workflows/build-docs.yml +18 -0
- package/src/ruvocal/.github/workflows/build-image.yml +142 -0
- package/src/ruvocal/.github/workflows/build-pr-docs.yml +20 -0
- package/src/ruvocal/.github/workflows/deploy-dev.yml +63 -0
- package/src/ruvocal/.github/workflows/deploy-prod.yml +78 -0
- package/src/ruvocal/.github/workflows/lint-and-test.yml +84 -0
- package/src/ruvocal/.github/workflows/slugify.yaml +72 -0
- package/src/ruvocal/.github/workflows/trufflehog.yml +17 -0
- package/src/ruvocal/.github/workflows/upload-pr-documentation.yml +16 -0
- package/src/ruvocal/.husky/lint-stage-config.js +4 -0
- package/src/ruvocal/.husky/pre-commit +2 -0
- package/src/ruvocal/.prettierignore +14 -0
- package/src/ruvocal/.prettierrc +7 -0
- package/src/ruvocal/.vscode/launch.json +11 -0
- package/src/ruvocal/.vscode/settings.json +14 -0
- package/src/ruvocal/CLAUDE.md +126 -0
- package/src/ruvocal/Dockerfile +93 -0
- package/src/ruvocal/LICENSE +203 -0
- package/src/ruvocal/PRIVACY.md +41 -0
- package/src/ruvocal/README.md +190 -0
- package/src/ruvocal/chart/Chart.yaml +5 -0
- package/src/ruvocal/chart/env/dev.yaml +260 -0
- package/src/ruvocal/chart/env/prod.yaml +273 -0
- package/src/ruvocal/chart/templates/_helpers.tpl +22 -0
- package/src/ruvocal/chart/templates/config.yaml +10 -0
- package/src/ruvocal/chart/templates/deployment.yaml +81 -0
- package/src/ruvocal/chart/templates/hpa.yaml +45 -0
- package/src/ruvocal/chart/templates/infisical.yaml +24 -0
- package/src/ruvocal/chart/templates/ingress-internal.yaml +32 -0
- package/src/ruvocal/chart/templates/ingress.yaml +32 -0
- package/src/ruvocal/chart/templates/network-policy.yaml +36 -0
- package/src/ruvocal/chart/templates/service-account.yaml +13 -0
- package/src/ruvocal/chart/templates/service-monitor.yaml +17 -0
- package/src/ruvocal/chart/templates/service.yaml +21 -0
- package/src/ruvocal/chart/values.yaml +73 -0
- package/src/ruvocal/docker-compose.yml +21 -0
- package/src/ruvocal/docs/adr/ADR-029-HUGGINGFACE-CHAT-UI-CLOUD-RUN.md +1236 -0
- package/src/ruvocal/docs/adr/ADR-033-RUVECTOR-RUFLO-MCP-INTEGRATION.md +111 -0
- package/src/ruvocal/docs/adr/ADR-034-OPTIONAL-MCP-BACKENDS.md +117 -0
- package/src/ruvocal/docs/adr/ADR-035-MCP-TOOL-GROUPS.md +186 -0
- package/src/ruvocal/docs/adr/ADR-037-AUTOPILOT-CHAT-MODE.md +1500 -0
- package/src/ruvocal/docs/adr/ADR-038-RUVOCAL-FORK.md +286 -0
- package/src/ruvocal/docs/source/_toctree.yml +30 -0
- package/src/ruvocal/docs/source/configuration/common-issues.md +38 -0
- package/src/ruvocal/docs/source/configuration/llm-router.md +105 -0
- package/src/ruvocal/docs/source/configuration/mcp-tools.md +84 -0
- package/src/ruvocal/docs/source/configuration/metrics.md +9 -0
- package/src/ruvocal/docs/source/configuration/open-id.md +57 -0
- package/src/ruvocal/docs/source/configuration/overview.md +89 -0
- package/src/ruvocal/docs/source/configuration/theming.md +20 -0
- package/src/ruvocal/docs/source/developing/architecture.md +48 -0
- package/src/ruvocal/docs/source/index.md +53 -0
- package/src/ruvocal/docs/source/installation/docker.md +43 -0
- package/src/ruvocal/docs/source/installation/helm.md +43 -0
- package/src/ruvocal/docs/source/installation/local.md +62 -0
- package/src/ruvocal/entrypoint.sh +19 -0
- package/src/ruvocal/mcp-bridge/.claude-flow/agents/store.json +27 -0
- package/src/ruvocal/mcp-bridge/.claude-flow/daemon-state.json +130 -0
- package/src/ruvocal/mcp-bridge/.claude-flow/daemon.log +0 -0
- package/src/ruvocal/mcp-bridge/.claude-flow/daemon.pid +1 -0
- package/src/ruvocal/mcp-bridge/.claude-flow/tasks/store.json +21 -0
- package/src/ruvocal/mcp-bridge/.swarm/hnsw.index +0 -0
- package/src/ruvocal/mcp-bridge/.swarm/hnsw.metadata.json +1 -0
- package/src/ruvocal/mcp-bridge/.swarm/memory.db +0 -0
- package/src/ruvocal/mcp-bridge/.swarm/model-router-state.json +14 -0
- package/src/ruvocal/mcp-bridge/.swarm/schema.sql +305 -0
- package/src/ruvocal/mcp-bridge/Dockerfile +45 -0
- package/src/ruvocal/mcp-bridge/cloudbuild.yaml +49 -0
- package/src/ruvocal/mcp-bridge/index.js +1864 -0
- package/src/ruvocal/mcp-bridge/mcp-stdio-kernel.js +159 -0
- package/src/ruvocal/mcp-bridge/package-lock.json +762 -0
- package/src/ruvocal/mcp-bridge/package.json +17 -0
- package/src/ruvocal/mcp-bridge/test-harness.js +470 -0
- package/src/ruvocal/models/add-your-models-here.txt +1 -0
- package/src/ruvocal/package-lock.json +11741 -0
- package/src/ruvocal/package.json +121 -0
- package/src/ruvocal/postcss.config.js +6 -0
- package/src/ruvocal/rvf.manifest.json +204 -0
- package/src/ruvocal/scripts/config.ts +64 -0
- package/src/ruvocal/scripts/generate-welcome.mjs +181 -0
- package/src/ruvocal/scripts/populate.ts +288 -0
- package/src/ruvocal/scripts/samples.txt +194 -0
- package/src/ruvocal/scripts/setups/vitest-setup-client.ts +0 -0
- package/src/ruvocal/scripts/setups/vitest-setup-server.ts +44 -0
- package/src/ruvocal/scripts/updateLocalEnv.ts +48 -0
- package/src/ruvocal/src/ambient.d.ts +7 -0
- package/src/ruvocal/src/app.d.ts +29 -0
- package/src/ruvocal/src/app.html +53 -0
- package/src/ruvocal/src/hooks.server.ts +32 -0
- package/src/ruvocal/src/hooks.ts +6 -0
- package/src/ruvocal/src/lib/APIClient.ts +148 -0
- package/src/ruvocal/src/lib/actions/clickOutside.ts +18 -0
- package/src/ruvocal/src/lib/actions/snapScrollToBottom.ts +346 -0
- package/src/ruvocal/src/lib/buildPrompt.ts +33 -0
- package/src/ruvocal/src/lib/components/AnnouncementBanner.svelte +20 -0
- package/src/ruvocal/src/lib/components/BackgroundGenerationPoller.svelte +168 -0
- package/src/ruvocal/src/lib/components/CodeBlock.svelte +73 -0
- package/src/ruvocal/src/lib/components/CopyToClipBoardBtn.svelte +92 -0
- package/src/ruvocal/src/lib/components/DeleteConversationModal.svelte +75 -0
- package/src/ruvocal/src/lib/components/EditConversationModal.svelte +100 -0
- package/src/ruvocal/src/lib/components/ExpandNavigation.svelte +22 -0
- package/src/ruvocal/src/lib/components/HoverTooltip.svelte +44 -0
- package/src/ruvocal/src/lib/components/HtmlPreviewModal.svelte +143 -0
- package/src/ruvocal/src/lib/components/InfiniteScroll.svelte +50 -0
- package/src/ruvocal/src/lib/components/MobileNav.svelte +300 -0
- package/src/ruvocal/src/lib/components/Modal.svelte +115 -0
- package/src/ruvocal/src/lib/components/ModelCardMetadata.svelte +71 -0
- package/src/ruvocal/src/lib/components/NavConversationItem.svelte +151 -0
- package/src/ruvocal/src/lib/components/NavMenu.svelte +295 -0
- package/src/ruvocal/src/lib/components/Pagination.svelte +97 -0
- package/src/ruvocal/src/lib/components/PaginationArrow.svelte +27 -0
- package/src/ruvocal/src/lib/components/Portal.svelte +24 -0
- package/src/ruvocal/src/lib/components/RetryBtn.svelte +18 -0
- package/src/ruvocal/src/lib/components/RuFloUniverse.svelte +185 -0
- package/src/ruvocal/src/lib/components/ScrollToBottomBtn.svelte +47 -0
- package/src/ruvocal/src/lib/components/ScrollToPreviousBtn.svelte +77 -0
- package/src/ruvocal/src/lib/components/ShareConversationModal.svelte +182 -0
- package/src/ruvocal/src/lib/components/StopGeneratingBtn.svelte +69 -0
- package/src/ruvocal/src/lib/components/SubscribeModal.svelte +87 -0
- package/src/ruvocal/src/lib/components/Switch.svelte +36 -0
- package/src/ruvocal/src/lib/components/SystemPromptModal.svelte +44 -0
- package/src/ruvocal/src/lib/components/Toast.svelte +27 -0
- package/src/ruvocal/src/lib/components/Tooltip.svelte +30 -0
- package/src/ruvocal/src/lib/components/WelcomeModal.svelte +46 -0
- package/src/ruvocal/src/lib/components/chat/Alternatives.svelte +77 -0
- package/src/ruvocal/src/lib/components/chat/BlockWrapper.svelte +72 -0
- package/src/ruvocal/src/lib/components/chat/ChatInput.svelte +490 -0
- package/src/ruvocal/src/lib/components/chat/ChatIntroduction.svelte +123 -0
- package/src/ruvocal/src/lib/components/chat/ChatMessage.svelte +548 -0
- package/src/ruvocal/src/lib/components/chat/ChatWindow.svelte +939 -0
- package/src/ruvocal/src/lib/components/chat/FileDropzone.svelte +92 -0
- package/src/ruvocal/src/lib/components/chat/ImageLightbox.svelte +66 -0
- package/src/ruvocal/src/lib/components/chat/MarkdownBlock.svelte +23 -0
- package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte +69 -0
- package/src/ruvocal/src/lib/components/chat/MarkdownRenderer.svelte.test.ts +58 -0
- package/src/ruvocal/src/lib/components/chat/MessageAvatar.svelte +103 -0
- package/src/ruvocal/src/lib/components/chat/ModelSwitch.svelte +64 -0
- package/src/ruvocal/src/lib/components/chat/OpenReasoningResults.svelte +81 -0
- package/src/ruvocal/src/lib/components/chat/TaskGroup.svelte +88 -0
- package/src/ruvocal/src/lib/components/chat/ToolUpdate.svelte +273 -0
- package/src/ruvocal/src/lib/components/chat/UploadedFile.svelte +253 -0
- package/src/ruvocal/src/lib/components/chat/UrlFetchModal.svelte +203 -0
- package/src/ruvocal/src/lib/components/chat/VoiceRecorder.svelte +214 -0
- package/src/ruvocal/src/lib/components/icons/IconBurger.svelte +20 -0
- package/src/ruvocal/src/lib/components/icons/IconCheap.svelte +20 -0
- package/src/ruvocal/src/lib/components/icons/IconChevron.svelte +24 -0
- package/src/ruvocal/src/lib/components/icons/IconDazzled.svelte +40 -0
- package/src/ruvocal/src/lib/components/icons/IconFast.svelte +20 -0
- package/src/ruvocal/src/lib/components/icons/IconLoading.svelte +22 -0
- package/src/ruvocal/src/lib/components/icons/IconMCP.svelte +28 -0
- package/src/ruvocal/src/lib/components/icons/IconMoon.svelte +21 -0
- package/src/ruvocal/src/lib/components/icons/IconNew.svelte +20 -0
- package/src/ruvocal/src/lib/components/icons/IconOmni.svelte +90 -0
- package/src/ruvocal/src/lib/components/icons/IconPaperclip.svelte +24 -0
- package/src/ruvocal/src/lib/components/icons/IconPro.svelte +37 -0
- package/src/ruvocal/src/lib/components/icons/IconShare.svelte +21 -0
- package/src/ruvocal/src/lib/components/icons/IconSun.svelte +93 -0
- package/src/ruvocal/src/lib/components/icons/Logo.svelte +68 -0
- package/src/ruvocal/src/lib/components/icons/LogoHuggingFaceBorderless.svelte +54 -0
- package/src/ruvocal/src/lib/components/mcp/AddServerForm.svelte +250 -0
- package/src/ruvocal/src/lib/components/mcp/MCPServerManager.svelte +185 -0
- package/src/ruvocal/src/lib/components/mcp/ServerCard.svelte +203 -0
- package/src/ruvocal/src/lib/components/players/AudioPlayer.svelte +82 -0
- package/src/ruvocal/src/lib/components/voice/AudioWaveform.svelte +96 -0
- package/src/ruvocal/src/lib/constants/mcpExamples.ts +135 -0
- package/src/ruvocal/src/lib/constants/mime.ts +11 -0
- package/src/ruvocal/src/lib/constants/pagination.ts +1 -0
- package/src/ruvocal/src/lib/constants/publicSepToken.ts +1 -0
- package/src/ruvocal/src/lib/constants/routerExamples.ts +209 -0
- package/src/ruvocal/src/lib/createShareLink.ts +27 -0
- package/src/ruvocal/src/lib/jobs/refresh-conversation-stats.ts +297 -0
- package/src/ruvocal/src/lib/migrations/lock.ts +56 -0
- package/src/ruvocal/src/lib/migrations/migrations.spec.ts +74 -0
- package/src/ruvocal/src/lib/migrations/migrations.ts +109 -0
- package/src/ruvocal/src/lib/migrations/routines/01-update-search-assistants.ts +50 -0
- package/src/ruvocal/src/lib/migrations/routines/02-update-assistants-models.ts +48 -0
- package/src/ruvocal/src/lib/migrations/routines/04-update-message-updates.ts +151 -0
- package/src/ruvocal/src/lib/migrations/routines/05-update-message-files.ts +56 -0
- package/src/ruvocal/src/lib/migrations/routines/06-trim-message-updates.ts +56 -0
- package/src/ruvocal/src/lib/migrations/routines/08-update-featured-to-review.ts +32 -0
- package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.spec.ts +214 -0
- package/src/ruvocal/src/lib/migrations/routines/09-delete-empty-conversations.ts +88 -0
- package/src/ruvocal/src/lib/migrations/routines/10-update-reports-assistantid.ts +29 -0
- package/src/ruvocal/src/lib/migrations/routines/index.ts +15 -0
- package/src/ruvocal/src/lib/server/__tests__/conversation-stop-generating.spec.ts +103 -0
- package/src/ruvocal/src/lib/server/abortRegistry.ts +57 -0
- package/src/ruvocal/src/lib/server/abortedGenerations.ts +43 -0
- package/src/ruvocal/src/lib/server/adminToken.ts +62 -0
- package/src/ruvocal/src/lib/server/api/__tests__/conversations-id.spec.ts +296 -0
- package/src/ruvocal/src/lib/server/api/__tests__/conversations-message.spec.ts +216 -0
- package/src/ruvocal/src/lib/server/api/__tests__/conversations.spec.ts +235 -0
- package/src/ruvocal/src/lib/server/api/__tests__/misc.spec.ts +72 -0
- package/src/ruvocal/src/lib/server/api/__tests__/testHelpers.ts +86 -0
- package/src/ruvocal/src/lib/server/api/__tests__/user-reports.spec.ts +78 -0
- package/src/ruvocal/src/lib/server/api/__tests__/user.spec.ts +239 -0
- package/src/ruvocal/src/lib/server/api/types.ts +37 -0
- package/src/ruvocal/src/lib/server/api/utils/requireAuth.ts +22 -0
- package/src/ruvocal/src/lib/server/api/utils/resolveConversation.ts +69 -0
- package/src/ruvocal/src/lib/server/api/utils/resolveModel.ts +27 -0
- package/src/ruvocal/src/lib/server/api/utils/superjsonResponse.ts +15 -0
- package/src/ruvocal/src/lib/server/apiToken.ts +11 -0
- package/src/ruvocal/src/lib/server/auth.ts +554 -0
- package/src/ruvocal/src/lib/server/config.ts +187 -0
- package/src/ruvocal/src/lib/server/conversation.ts +83 -0
- package/src/ruvocal/src/lib/server/database/__tests__/rvf.spec.ts +709 -0
- package/src/ruvocal/src/lib/server/database/postgres.ts +700 -0
- package/src/ruvocal/src/lib/server/database/rvf.ts +1078 -0
- package/src/ruvocal/src/lib/server/database.ts +145 -0
- package/src/ruvocal/src/lib/server/endpoints/document.ts +68 -0
- package/src/ruvocal/src/lib/server/endpoints/endpoints.ts +43 -0
- package/src/ruvocal/src/lib/server/endpoints/images.ts +211 -0
- package/src/ruvocal/src/lib/server/endpoints/openai/endpointOai.ts +266 -0
- package/src/ruvocal/src/lib/server/endpoints/openai/openAIChatToTextGenerationStream.ts +212 -0
- package/src/ruvocal/src/lib/server/endpoints/openai/openAICompletionToTextGenerationStream.ts +32 -0
- package/src/ruvocal/src/lib/server/endpoints/preprocessMessages.ts +61 -0
- package/src/ruvocal/src/lib/server/exitHandler.ts +59 -0
- package/src/ruvocal/src/lib/server/files/downloadFile.ts +34 -0
- package/src/ruvocal/src/lib/server/files/uploadFile.ts +29 -0
- package/src/ruvocal/src/lib/server/findRepoRoot.ts +13 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Black.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Bold.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-ExtraBold.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-ExtraLight.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Light.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Medium.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Regular.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-SemiBold.ttf +0 -0
- package/src/ruvocal/src/lib/server/fonts/Inter-Thin.ttf +0 -0
- package/src/ruvocal/src/lib/server/generateFromDefaultEndpoint.ts +46 -0
- package/src/ruvocal/src/lib/server/hooks/error.ts +37 -0
- package/src/ruvocal/src/lib/server/hooks/fetch.ts +22 -0
- package/src/ruvocal/src/lib/server/hooks/handle.ts +250 -0
- package/src/ruvocal/src/lib/server/hooks/init.ts +51 -0
- package/src/ruvocal/src/lib/server/isURLLocal.spec.ts +31 -0
- package/src/ruvocal/src/lib/server/isURLLocal.ts +74 -0
- package/src/ruvocal/src/lib/server/logger.ts +42 -0
- package/src/ruvocal/src/lib/server/mcp/clientPool.ts +70 -0
- package/src/ruvocal/src/lib/server/mcp/hf.ts +32 -0
- package/src/ruvocal/src/lib/server/mcp/httpClient.ts +122 -0
- package/src/ruvocal/src/lib/server/mcp/registry.ts +76 -0
- package/src/ruvocal/src/lib/server/mcp/tools.ts +196 -0
- package/src/ruvocal/src/lib/server/metrics.ts +255 -0
- package/src/ruvocal/src/lib/server/models.ts +518 -0
- package/src/ruvocal/src/lib/server/requestContext.ts +55 -0
- package/src/ruvocal/src/lib/server/router/arch.ts +230 -0
- package/src/ruvocal/src/lib/server/router/endpoint.ts +316 -0
- package/src/ruvocal/src/lib/server/router/multimodal.ts +28 -0
- package/src/ruvocal/src/lib/server/router/policy.ts +49 -0
- package/src/ruvocal/src/lib/server/router/toolsRoute.ts +51 -0
- package/src/ruvocal/src/lib/server/router/types.ts +21 -0
- package/src/ruvocal/src/lib/server/sendSlack.ts +23 -0
- package/src/ruvocal/src/lib/server/textGeneration/generate.ts +258 -0
- package/src/ruvocal/src/lib/server/textGeneration/index.ts +95 -0
- package/src/ruvocal/src/lib/server/textGeneration/mcp/fileRefs.ts +155 -0
- package/src/ruvocal/src/lib/server/textGeneration/mcp/routerResolution.ts +108 -0
- package/src/ruvocal/src/lib/server/textGeneration/mcp/runMcpFlow.ts +822 -0
- package/src/ruvocal/src/lib/server/textGeneration/mcp/toolInvocation.ts +349 -0
- package/src/ruvocal/src/lib/server/textGeneration/reasoning.ts +23 -0
- package/src/ruvocal/src/lib/server/textGeneration/title.ts +83 -0
- package/src/ruvocal/src/lib/server/textGeneration/types.ts +26 -0
- package/src/ruvocal/src/lib/server/textGeneration/utils/prepareFiles.ts +88 -0
- package/src/ruvocal/src/lib/server/textGeneration/utils/routing.ts +21 -0
- package/src/ruvocal/src/lib/server/textGeneration/utils/toolPrompt.ts +49 -0
- package/src/ruvocal/src/lib/server/urlSafety.ts +72 -0
- package/src/ruvocal/src/lib/server/usageLimits.ts +30 -0
- package/src/ruvocal/src/lib/stores/autopilotStore.svelte.ts +175 -0
- package/src/ruvocal/src/lib/stores/backgroundGenerations.svelte.ts +32 -0
- package/src/ruvocal/src/lib/stores/backgroundGenerations.ts +1 -0
- package/src/ruvocal/src/lib/stores/errors.ts +9 -0
- package/src/ruvocal/src/lib/stores/isAborted.ts +3 -0
- package/src/ruvocal/src/lib/stores/isPro.ts +4 -0
- package/src/ruvocal/src/lib/stores/loading.ts +3 -0
- package/src/ruvocal/src/lib/stores/mcpServers.ts +345 -0
- package/src/ruvocal/src/lib/stores/pendingChatInput.ts +3 -0
- package/src/ruvocal/src/lib/stores/pendingMessage.ts +9 -0
- package/src/ruvocal/src/lib/stores/settings.ts +182 -0
- package/src/ruvocal/src/lib/stores/shareModal.ts +13 -0
- package/src/ruvocal/src/lib/stores/titleUpdate.ts +8 -0
- package/src/ruvocal/src/lib/switchTheme.ts +124 -0
- package/src/ruvocal/src/lib/types/AbortedGeneration.ts +8 -0
- package/src/ruvocal/src/lib/types/Assistant.ts +31 -0
- package/src/ruvocal/src/lib/types/AssistantStats.ts +11 -0
- package/src/ruvocal/src/lib/types/ConfigKey.ts +4 -0
- package/src/ruvocal/src/lib/types/ConvSidebar.ts +9 -0
- package/src/ruvocal/src/lib/types/Conversation.ts +27 -0
- package/src/ruvocal/src/lib/types/ConversationStats.ts +13 -0
- package/src/ruvocal/src/lib/types/Message.ts +41 -0
- package/src/ruvocal/src/lib/types/MessageEvent.ts +10 -0
- package/src/ruvocal/src/lib/types/MessageUpdate.ts +139 -0
- package/src/ruvocal/src/lib/types/MigrationResult.ts +7 -0
- package/src/ruvocal/src/lib/types/Model.ts +23 -0
- package/src/ruvocal/src/lib/types/Report.ts +12 -0
- package/src/ruvocal/src/lib/types/Review.ts +6 -0
- package/src/ruvocal/src/lib/types/Semaphore.ts +19 -0
- package/src/ruvocal/src/lib/types/Session.ts +22 -0
- package/src/ruvocal/src/lib/types/Settings.ts +86 -0
- package/src/ruvocal/src/lib/types/SharedConversation.ts +9 -0
- package/src/ruvocal/src/lib/types/Template.ts +6 -0
- package/src/ruvocal/src/lib/types/Timestamps.ts +4 -0
- package/src/ruvocal/src/lib/types/TokenCache.ts +6 -0
- package/src/ruvocal/src/lib/types/Tool.ts +74 -0
- package/src/ruvocal/src/lib/types/UrlDependency.ts +5 -0
- package/src/ruvocal/src/lib/types/User.ts +14 -0
- package/src/ruvocal/src/lib/utils/PublicConfig.svelte.ts +75 -0
- package/src/ruvocal/src/lib/utils/auth.ts +17 -0
- package/src/ruvocal/src/lib/utils/chunk.ts +33 -0
- package/src/ruvocal/src/lib/utils/cookiesAreEnabled.ts +13 -0
- package/src/ruvocal/src/lib/utils/debounce.ts +17 -0
- package/src/ruvocal/src/lib/utils/deepestChild.ts +6 -0
- package/src/ruvocal/src/lib/utils/favicon.ts +21 -0
- package/src/ruvocal/src/lib/utils/fetchJSON.ts +23 -0
- package/src/ruvocal/src/lib/utils/file2base64.ts +14 -0
- package/src/ruvocal/src/lib/utils/formatUserCount.ts +37 -0
- package/src/ruvocal/src/lib/utils/generationState.spec.ts +75 -0
- package/src/ruvocal/src/lib/utils/generationState.ts +26 -0
- package/src/ruvocal/src/lib/utils/getHref.ts +41 -0
- package/src/ruvocal/src/lib/utils/getReturnFromGenerator.ts +7 -0
- package/src/ruvocal/src/lib/utils/haptics.ts +64 -0
- package/src/ruvocal/src/lib/utils/hashConv.ts +12 -0
- package/src/ruvocal/src/lib/utils/hf.ts +17 -0
- package/src/ruvocal/src/lib/utils/isDesktop.ts +7 -0
- package/src/ruvocal/src/lib/utils/isUrl.ts +8 -0
- package/src/ruvocal/src/lib/utils/isVirtualKeyboard.ts +16 -0
- package/src/ruvocal/src/lib/utils/loadAttachmentsFromUrls.ts +115 -0
- package/src/ruvocal/src/lib/utils/marked.spec.ts +96 -0
- package/src/ruvocal/src/lib/utils/marked.ts +531 -0
- package/src/ruvocal/src/lib/utils/mcpValidation.ts +147 -0
- package/src/ruvocal/src/lib/utils/mergeAsyncGenerators.ts +38 -0
- package/src/ruvocal/src/lib/utils/messageUpdates.spec.ts +262 -0
- package/src/ruvocal/src/lib/utils/messageUpdates.ts +324 -0
- package/src/ruvocal/src/lib/utils/mime.ts +56 -0
- package/src/ruvocal/src/lib/utils/models.ts +14 -0
- package/src/ruvocal/src/lib/utils/parseBlocks.ts +120 -0
- package/src/ruvocal/src/lib/utils/parseIncompleteMarkdown.ts +644 -0
- package/src/ruvocal/src/lib/utils/parseStringToList.ts +10 -0
- package/src/ruvocal/src/lib/utils/randomUuid.ts +14 -0
- package/src/ruvocal/src/lib/utils/searchTokens.ts +33 -0
- package/src/ruvocal/src/lib/utils/sha256.ts +7 -0
- package/src/ruvocal/src/lib/utils/stringifyError.ts +12 -0
- package/src/ruvocal/src/lib/utils/sum.ts +3 -0
- package/src/ruvocal/src/lib/utils/template.spec.ts +59 -0
- package/src/ruvocal/src/lib/utils/template.ts +53 -0
- package/src/ruvocal/src/lib/utils/timeout.ts +9 -0
- package/src/ruvocal/src/lib/utils/toolProgress.spec.ts +46 -0
- package/src/ruvocal/src/lib/utils/toolProgress.ts +11 -0
- package/src/ruvocal/src/lib/utils/tree/addChildren.spec.ts +102 -0
- package/src/ruvocal/src/lib/utils/tree/addChildren.ts +48 -0
- package/src/ruvocal/src/lib/utils/tree/addSibling.spec.ts +81 -0
- package/src/ruvocal/src/lib/utils/tree/addSibling.ts +41 -0
- package/src/ruvocal/src/lib/utils/tree/buildSubtree.spec.ts +110 -0
- package/src/ruvocal/src/lib/utils/tree/buildSubtree.ts +24 -0
- package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.spec.ts +31 -0
- package/src/ruvocal/src/lib/utils/tree/convertLegacyConversation.ts +36 -0
- package/src/ruvocal/src/lib/utils/tree/isMessageId.spec.ts +15 -0
- package/src/ruvocal/src/lib/utils/tree/isMessageId.ts +5 -0
- package/src/ruvocal/src/lib/utils/tree/tree.d.ts +14 -0
- package/src/ruvocal/src/lib/utils/tree/treeHelpers.spec.ts +167 -0
- package/src/ruvocal/src/lib/utils/updates.ts +39 -0
- package/src/ruvocal/src/lib/utils/urlParams.ts +13 -0
- package/src/ruvocal/src/lib/workers/autopilotWorker.ts +221 -0
- package/src/ruvocal/src/lib/workers/detailFetchWorker.ts +100 -0
- package/src/ruvocal/src/lib/workers/markdownWorker.ts +61 -0
- package/src/ruvocal/src/routes/+error.svelte +20 -0
- package/src/ruvocal/src/routes/+layout.svelte +324 -0
- package/src/ruvocal/src/routes/+layout.ts +91 -0
- package/src/ruvocal/src/routes/+page.svelte +168 -0
- package/src/ruvocal/src/routes/.well-known/oauth-cimd/+server.ts +37 -0
- package/src/ruvocal/src/routes/__debug/openai/+server.ts +21 -0
- package/src/ruvocal/src/routes/admin/export/+server.ts +159 -0
- package/src/ruvocal/src/routes/admin/stats/compute/+server.ts +16 -0
- package/src/ruvocal/src/routes/api/conversation/[id]/+server.ts +40 -0
- package/src/ruvocal/src/routes/api/conversation/[id]/message/[messageId]/+server.ts +42 -0
- package/src/ruvocal/src/routes/api/conversations/+server.ts +48 -0
- package/src/ruvocal/src/routes/api/fetch-url/+server.ts +147 -0
- package/src/ruvocal/src/routes/api/mcp/health/+server.ts +292 -0
- package/src/ruvocal/src/routes/api/mcp/servers/+server.ts +32 -0
- package/src/ruvocal/src/routes/api/models/+server.ts +25 -0
- package/src/ruvocal/src/routes/api/transcribe/+server.ts +104 -0
- package/src/ruvocal/src/routes/api/user/+server.ts +15 -0
- package/src/ruvocal/src/routes/api/user/validate-token/+server.ts +20 -0
- package/src/ruvocal/src/routes/api/v2/conversations/+server.ts +48 -0
- package/src/ruvocal/src/routes/api/v2/conversations/[id]/+server.ts +94 -0
- package/src/ruvocal/src/routes/api/v2/conversations/[id]/message/[messageId]/+server.ts +43 -0
- package/src/ruvocal/src/routes/api/v2/conversations/import-share/+server.ts +23 -0
- package/src/ruvocal/src/routes/api/v2/debug/config/+server.ts +16 -0
- package/src/ruvocal/src/routes/api/v2/debug/refresh/+server.ts +30 -0
- package/src/ruvocal/src/routes/api/v2/export/+server.ts +196 -0
- package/src/ruvocal/src/routes/api/v2/feature-flags/+server.ts +14 -0
- package/src/ruvocal/src/routes/api/v2/models/+server.ts +38 -0
- package/src/ruvocal/src/routes/api/v2/models/[namespace]/+server.ts +8 -0
- package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/+server.ts +8 -0
- package/src/ruvocal/src/routes/api/v2/models/[namespace]/[model]/subscribe/+server.ts +28 -0
- package/src/ruvocal/src/routes/api/v2/models/[namespace]/subscribe/+server.ts +28 -0
- package/src/ruvocal/src/routes/api/v2/models/old/+server.ts +7 -0
- package/src/ruvocal/src/routes/api/v2/models/refresh/+server.ts +33 -0
- package/src/ruvocal/src/routes/api/v2/public-config/+server.ts +7 -0
- package/src/ruvocal/src/routes/api/v2/user/+server.ts +17 -0
- package/src/ruvocal/src/routes/api/v2/user/billing-orgs/+server.ts +73 -0
- package/src/ruvocal/src/routes/api/v2/user/reports/+server.ts +17 -0
- package/src/ruvocal/src/routes/api/v2/user/settings/+server.ts +103 -0
- package/src/ruvocal/src/routes/conversation/+server.ts +115 -0
- package/src/ruvocal/src/routes/conversation/[id]/+page.svelte +582 -0
- package/src/ruvocal/src/routes/conversation/[id]/+page.ts +60 -0
- package/src/ruvocal/src/routes/conversation/[id]/+server.ts +736 -0
- package/src/ruvocal/src/routes/conversation/[id]/message/[messageId]/prompt/+server.ts +66 -0
- package/src/ruvocal/src/routes/conversation/[id]/output/[sha256]/+server.ts +58 -0
- package/src/ruvocal/src/routes/conversation/[id]/share/+server.ts +69 -0
- package/src/ruvocal/src/routes/conversation/[id]/stop-generating/+server.ts +35 -0
- package/src/ruvocal/src/routes/healthcheck/+server.ts +3 -0
- package/src/ruvocal/src/routes/login/+server.ts +5 -0
- package/src/ruvocal/src/routes/login/callback/+server.ts +103 -0
- package/src/ruvocal/src/routes/login/callback/updateUser.spec.ts +157 -0
- package/src/ruvocal/src/routes/login/callback/updateUser.ts +215 -0
- package/src/ruvocal/src/routes/logout/+server.ts +18 -0
- package/src/ruvocal/src/routes/metrics/+server.ts +18 -0
- package/src/ruvocal/src/routes/models/+page.svelte +233 -0
- package/src/ruvocal/src/routes/models/[...model]/+page.svelte +161 -0
- package/src/ruvocal/src/routes/models/[...model]/+page.ts +14 -0
- package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/+server.ts +64 -0
- package/src/ruvocal/src/routes/models/[...model]/thumbnail.png/ModelThumbnail.svelte +28 -0
- package/src/ruvocal/src/routes/privacy/+page.svelte +11 -0
- package/src/ruvocal/src/routes/r/[id]/+page.ts +34 -0
- package/src/ruvocal/src/routes/settings/(nav)/+layout.svelte +282 -0
- package/src/ruvocal/src/routes/settings/(nav)/+layout.ts +1 -0
- package/src/ruvocal/src/routes/settings/(nav)/+page.svelte +0 -0
- package/src/ruvocal/src/routes/settings/(nav)/+server.ts +53 -0
- package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.svelte +464 -0
- package/src/ruvocal/src/routes/settings/(nav)/[...model]/+page.ts +14 -0
- package/src/ruvocal/src/routes/settings/(nav)/application/+page.svelte +362 -0
- package/src/ruvocal/src/routes/settings/+layout.svelte +40 -0
- package/src/ruvocal/src/styles/highlight-js.css +195 -0
- package/src/ruvocal/src/styles/main.css +144 -0
- package/src/ruvocal/static/chatui/apple-touch-icon.png +0 -0
- package/src/ruvocal/static/chatui/favicon-dark.svg +3 -0
- package/src/ruvocal/static/chatui/favicon-dev.svg +3 -0
- package/src/ruvocal/static/chatui/favicon.ico +0 -0
- package/src/ruvocal/static/chatui/favicon.svg +3 -0
- package/src/ruvocal/static/chatui/icon-128x128.png +0 -0
- package/src/ruvocal/static/chatui/icon-144x144.png +0 -0
- package/src/ruvocal/static/chatui/icon-192x192.png +0 -0
- package/src/ruvocal/static/chatui/icon-256x256.png +0 -0
- package/src/ruvocal/static/chatui/icon-36x36.png +0 -0
- package/src/ruvocal/static/chatui/icon-48x48.png +0 -0
- package/src/ruvocal/static/chatui/icon-512x512.png +0 -0
- package/src/ruvocal/static/chatui/icon-72x72.png +0 -0
- package/src/ruvocal/static/chatui/icon-96x96.png +0 -0
- package/src/ruvocal/static/chatui/icon.svg +3 -0
- package/src/ruvocal/static/chatui/logo.svg +7 -0
- package/src/ruvocal/static/chatui/manifest.json +54 -0
- package/src/ruvocal/static/chatui/omni-welcome.gif +0 -0
- package/src/ruvocal/static/chatui/omni-welcome.png +0 -0
- package/src/ruvocal/static/chatui/welcome.js +184 -0
- package/src/ruvocal/static/chatui/welcome.svg +1 -0
- package/src/ruvocal/static/huggingchat/apple-touch-icon.png +0 -0
- package/src/ruvocal/static/huggingchat/assistants-thumbnail.png +0 -0
- package/src/ruvocal/static/huggingchat/castle-example.jpg +0 -0
- package/src/ruvocal/static/huggingchat/favicon-dark.svg +4 -0
- package/src/ruvocal/static/huggingchat/favicon-dev.svg +4 -0
- package/src/ruvocal/static/huggingchat/favicon.ico +0 -0
- package/src/ruvocal/static/huggingchat/favicon.svg +4 -0
- package/src/ruvocal/static/huggingchat/fulltext-logo.svg +2 -0
- package/src/ruvocal/static/huggingchat/icon-128x128.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-144x144.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-192x192.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-256x256.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-36x36.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-48x48.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-512x512.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-72x72.png +0 -0
- package/src/ruvocal/static/huggingchat/icon-96x96.png +0 -0
- package/src/ruvocal/static/huggingchat/icon.svg +4 -0
- package/src/ruvocal/static/huggingchat/logo.svg +4 -0
- package/src/ruvocal/static/huggingchat/manifest.json +54 -0
- package/src/ruvocal/static/huggingchat/omni-welcome.gif +0 -0
- package/src/ruvocal/static/huggingchat/routes.chat.json +226 -0
- package/src/ruvocal/static/huggingchat/thumbnail.png +0 -0
- package/src/ruvocal/static/huggingchat/tools-thumbnail.png +0 -0
- package/src/ruvocal/static/robots.txt +10 -0
- package/src/ruvocal/stub/@reflink/reflink/index.js +0 -0
- package/src/ruvocal/stub/@reflink/reflink/package.json +5 -0
- package/src/ruvocal/svelte.config.js +53 -0
- package/src/ruvocal/tailwind.config.cjs +30 -0
- package/src/ruvocal/tsconfig.json +19 -0
- package/src/ruvocal/vite.config.ts +87 -0
- package/src/scripts/deploy.sh +116 -0
- package/src/scripts/generate-config.js +245 -0
- package/src/scripts/generate-welcome.js +187 -0
- package/src/scripts/package-rvf.sh +116 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { MessageToolUpdateType, type MessageToolUpdate } from "$lib/types/MessageUpdate";
|
|
3
|
+
import {
|
|
4
|
+
isMessageToolCallUpdate,
|
|
5
|
+
isMessageToolErrorUpdate,
|
|
6
|
+
isMessageToolProgressUpdate,
|
|
7
|
+
isMessageToolResultUpdate,
|
|
8
|
+
} from "$lib/utils/messageUpdates";
|
|
9
|
+
import { formatToolProgressLabel } from "$lib/utils/toolProgress";
|
|
10
|
+
import LucideHammer from "~icons/lucide/hammer";
|
|
11
|
+
import LucideCheck from "~icons/lucide/check";
|
|
12
|
+
import { ToolResultStatus, type ToolFront } from "$lib/types/Tool";
|
|
13
|
+
import { page } from "$app/state";
|
|
14
|
+
import CarbonChevronRight from "~icons/carbon/chevron-right";
|
|
15
|
+
import BlockWrapper from "./BlockWrapper.svelte";
|
|
16
|
+
|
|
17
|
+
interface Props {
|
|
18
|
+
tool: MessageToolUpdate[];
|
|
19
|
+
loading?: boolean;
|
|
20
|
+
hasNext?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
let { tool, loading = false, hasNext = false }: Props = $props();
|
|
24
|
+
|
|
25
|
+
let isOpen = $state(false);
|
|
26
|
+
|
|
27
|
+
let toolFnName = $derived(tool.find(isMessageToolCallUpdate)?.call.name);
|
|
28
|
+
let toolError = $derived(tool.some(isMessageToolErrorUpdate));
|
|
29
|
+
let toolDone = $derived(tool.some(isMessageToolResultUpdate));
|
|
30
|
+
let isExecuting = $derived(!toolDone && !toolError && loading);
|
|
31
|
+
let toolSuccess = $derived(toolDone && !toolError);
|
|
32
|
+
let toolProgress = $derived.by(() => {
|
|
33
|
+
for (let i = tool.length - 1; i >= 0; i -= 1) {
|
|
34
|
+
const update = tool[i];
|
|
35
|
+
if (isMessageToolProgressUpdate(update)) return update;
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
});
|
|
39
|
+
let progressLabel = $derived.by(() => formatToolProgressLabel(toolProgress));
|
|
40
|
+
|
|
41
|
+
const availableTools: ToolFront[] = $derived.by(
|
|
42
|
+
() => (page.data as { tools?: ToolFront[] } | undefined)?.tools ?? []
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
type ToolOutput = Record<string, unknown>;
|
|
46
|
+
type McpImageContent = {
|
|
47
|
+
type: "image";
|
|
48
|
+
data: string;
|
|
49
|
+
mimeType: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const formatValue = (value: unknown): string => {
|
|
53
|
+
if (value == null) return "";
|
|
54
|
+
if (typeof value === "object") {
|
|
55
|
+
try {
|
|
56
|
+
return JSON.stringify(value, null, 2);
|
|
57
|
+
} catch {
|
|
58
|
+
return String(value);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return String(value);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const getOutputText = (output: ToolOutput): string | undefined => {
|
|
65
|
+
const maybeText = output["text"];
|
|
66
|
+
if (typeof maybeText !== "string") return undefined;
|
|
67
|
+
return maybeText;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const isImageBlock = (value: unknown): value is McpImageContent => {
|
|
71
|
+
if (typeof value !== "object" || value === null) return false;
|
|
72
|
+
const obj = value as Record<string, unknown>;
|
|
73
|
+
return (
|
|
74
|
+
obj["type"] === "image" &&
|
|
75
|
+
typeof obj["data"] === "string" &&
|
|
76
|
+
typeof obj["mimeType"] === "string"
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getImageBlocks = (output: ToolOutput): McpImageContent[] => {
|
|
81
|
+
const blocks = output["content"];
|
|
82
|
+
if (!Array.isArray(blocks)) return [];
|
|
83
|
+
return blocks.filter(isImageBlock);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const getMetadataEntries = (output: ToolOutput): Array<[string, unknown]> => {
|
|
87
|
+
return Object.entries(output).filter(
|
|
88
|
+
([key, value]) => value != null && key !== "content" && key !== "text"
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
interface ParsedToolOutput {
|
|
93
|
+
text?: string;
|
|
94
|
+
images: McpImageContent[];
|
|
95
|
+
metadata: Array<[string, unknown]>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const parseToolOutputs = (outputs: ToolOutput[]): ParsedToolOutput[] =>
|
|
99
|
+
outputs.map((output) => ({
|
|
100
|
+
text: getOutputText(output),
|
|
101
|
+
images: getImageBlocks(output),
|
|
102
|
+
metadata: getMetadataEntries(output),
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
// Icon styling based on state
|
|
106
|
+
let iconBg = $derived(
|
|
107
|
+
toolError ? "bg-red-100 dark:bg-red-900/40" : "bg-purple-100 dark:bg-purple-900/40"
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
let iconRing = $derived(
|
|
111
|
+
toolError ? "ring-red-200 dark:ring-red-500/30" : "ring-purple-200 dark:ring-purple-500/30"
|
|
112
|
+
);
|
|
113
|
+
</script>
|
|
114
|
+
|
|
115
|
+
{#snippet icon()}
|
|
116
|
+
{#if toolSuccess}
|
|
117
|
+
<LucideCheck class="size-3.5 text-purple-600 dark:text-purple-400" />
|
|
118
|
+
{:else}
|
|
119
|
+
<LucideHammer
|
|
120
|
+
class="size-3.5 {toolError
|
|
121
|
+
? 'text-red-500 dark:text-red-400'
|
|
122
|
+
: 'text-purple-600 dark:text-purple-400'}"
|
|
123
|
+
/>
|
|
124
|
+
{/if}
|
|
125
|
+
{/snippet}
|
|
126
|
+
|
|
127
|
+
{#if toolFnName}
|
|
128
|
+
<BlockWrapper {icon} {iconBg} {iconRing} {hasNext} loading={isExecuting}>
|
|
129
|
+
<!-- Header row -->
|
|
130
|
+
<div class="flex w-full select-none items-center gap-2">
|
|
131
|
+
<button
|
|
132
|
+
type="button"
|
|
133
|
+
class="flex flex-1 cursor-pointer flex-col items-start gap-1 text-left"
|
|
134
|
+
onclick={() => (isOpen = !isOpen)}
|
|
135
|
+
>
|
|
136
|
+
<span
|
|
137
|
+
class="text-sm font-medium {isExecuting
|
|
138
|
+
? 'text-purple-700 dark:text-purple-300'
|
|
139
|
+
: toolError
|
|
140
|
+
? 'text-red-600 dark:text-red-400'
|
|
141
|
+
: 'text-gray-700 dark:text-gray-300'}"
|
|
142
|
+
>
|
|
143
|
+
{toolError ? "Error calling" : toolDone ? "Called" : "Calling"} tool
|
|
144
|
+
<code
|
|
145
|
+
class="rounded bg-gray-100 px-1.5 py-0.5 font-mono text-xs text-gray-500 opacity-90 dark:bg-gray-800 dark:text-gray-400"
|
|
146
|
+
>
|
|
147
|
+
{availableTools.find((entry) => entry.name === toolFnName)?.displayName ?? toolFnName}
|
|
148
|
+
</code>
|
|
149
|
+
</span>
|
|
150
|
+
{#if isExecuting && toolProgress}
|
|
151
|
+
<span class="text-xs text-gray-500 dark:text-gray-400">{progressLabel}</span>
|
|
152
|
+
{/if}
|
|
153
|
+
</button>
|
|
154
|
+
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
class="cursor-pointer"
|
|
158
|
+
onclick={() => (isOpen = !isOpen)}
|
|
159
|
+
aria-label={isOpen ? "Collapse" : "Expand"}
|
|
160
|
+
>
|
|
161
|
+
<CarbonChevronRight
|
|
162
|
+
class="size-4 text-gray-400 transition-transform duration-200 {isOpen ? 'rotate-90' : ''}"
|
|
163
|
+
/>
|
|
164
|
+
</button>
|
|
165
|
+
</div>
|
|
166
|
+
|
|
167
|
+
<!-- Expandable content -->
|
|
168
|
+
{#if isOpen}
|
|
169
|
+
<div class="mt-2 space-y-3">
|
|
170
|
+
{#each tool as update, i (`${update.subtype}-${i}`)}
|
|
171
|
+
{#if update.subtype === MessageToolUpdateType.Call}
|
|
172
|
+
<div class="space-y-1">
|
|
173
|
+
<div
|
|
174
|
+
class="text-[10px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500"
|
|
175
|
+
>
|
|
176
|
+
Input
|
|
177
|
+
</div>
|
|
178
|
+
<div
|
|
179
|
+
class="rounded-md border border-gray-100 bg-white p-2 text-gray-500 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-400"
|
|
180
|
+
>
|
|
181
|
+
<pre class="whitespace-pre-wrap break-all font-mono text-xs">{formatValue(
|
|
182
|
+
update.call.parameters
|
|
183
|
+
)}</pre>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
{:else if update.subtype === MessageToolUpdateType.Error}
|
|
187
|
+
<div class="space-y-1">
|
|
188
|
+
<div
|
|
189
|
+
class="text-[10px] font-semibold uppercase tracking-wider text-red-500 dark:text-red-400"
|
|
190
|
+
>
|
|
191
|
+
Error
|
|
192
|
+
</div>
|
|
193
|
+
<div
|
|
194
|
+
class="rounded-md border border-red-200 bg-red-50 p-2 text-red-600 dark:border-red-500/30 dark:bg-red-900/20 dark:text-red-400"
|
|
195
|
+
>
|
|
196
|
+
<pre class="whitespace-pre-wrap break-all font-mono text-xs">{update.message}</pre>
|
|
197
|
+
</div>
|
|
198
|
+
</div>
|
|
199
|
+
{:else if isMessageToolResultUpdate(update) && update.result.status === ToolResultStatus.Success && update.result.display}
|
|
200
|
+
<div class="space-y-1">
|
|
201
|
+
<div class="flex items-center gap-2">
|
|
202
|
+
<div
|
|
203
|
+
class="text-[10px] font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500"
|
|
204
|
+
>
|
|
205
|
+
Output
|
|
206
|
+
</div>
|
|
207
|
+
<svg
|
|
208
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
209
|
+
width="12"
|
|
210
|
+
height="12"
|
|
211
|
+
viewBox="0 0 24 24"
|
|
212
|
+
fill="none"
|
|
213
|
+
stroke="currentColor"
|
|
214
|
+
stroke-width="2"
|
|
215
|
+
stroke-linecap="round"
|
|
216
|
+
stroke-linejoin="round"
|
|
217
|
+
class="text-emerald-500"
|
|
218
|
+
>
|
|
219
|
+
<circle cx="12" cy="12" r="10"></circle>
|
|
220
|
+
<path d="m9 12 2 2 4-4"></path>
|
|
221
|
+
</svg>
|
|
222
|
+
</div>
|
|
223
|
+
<div
|
|
224
|
+
class="scrollbar-custom rounded-md border border-gray-100 bg-white p-2 text-gray-500 dark:border-gray-700 dark:bg-gray-800/50 dark:text-gray-400"
|
|
225
|
+
>
|
|
226
|
+
{#each parseToolOutputs(update.result.outputs) as parsedOutput}
|
|
227
|
+
<div class="space-y-2">
|
|
228
|
+
{#if parsedOutput.text}
|
|
229
|
+
<pre
|
|
230
|
+
class="scrollbar-custom max-h-60 overflow-y-auto whitespace-pre-wrap break-all font-mono text-xs">{parsedOutput.text}</pre>
|
|
231
|
+
{/if}
|
|
232
|
+
|
|
233
|
+
{#if parsedOutput.images.length > 0}
|
|
234
|
+
<div class="flex flex-wrap gap-2">
|
|
235
|
+
{#each parsedOutput.images as image, imageIndex}
|
|
236
|
+
<img
|
|
237
|
+
alt={`Tool result image ${imageIndex + 1}`}
|
|
238
|
+
class="max-h-60 cursor-pointer rounded border border-gray-200 dark:border-gray-700"
|
|
239
|
+
src={`data:${image.mimeType};base64,${image.data}`}
|
|
240
|
+
/>
|
|
241
|
+
{/each}
|
|
242
|
+
</div>
|
|
243
|
+
{/if}
|
|
244
|
+
|
|
245
|
+
{#if parsedOutput.metadata.length > 0}
|
|
246
|
+
<pre class="whitespace-pre-wrap break-all font-mono text-xs">{formatValue(
|
|
247
|
+
Object.fromEntries(parsedOutput.metadata)
|
|
248
|
+
)}</pre>
|
|
249
|
+
{/if}
|
|
250
|
+
</div>
|
|
251
|
+
{/each}
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|
|
254
|
+
{:else if isMessageToolResultUpdate(update) && update.result.status === ToolResultStatus.Error && update.result.display}
|
|
255
|
+
<div class="space-y-1">
|
|
256
|
+
<div
|
|
257
|
+
class="text-[10px] font-semibold uppercase tracking-wider text-red-500 dark:text-red-400"
|
|
258
|
+
>
|
|
259
|
+
Error
|
|
260
|
+
</div>
|
|
261
|
+
<div
|
|
262
|
+
class="rounded-md border border-red-200 bg-red-50 p-2 text-red-600 dark:border-red-500/30 dark:bg-red-900/20 dark:text-red-400"
|
|
263
|
+
>
|
|
264
|
+
<pre class="whitespace-pre-wrap break-all font-mono text-xs">{update.result
|
|
265
|
+
.message}</pre>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
{/if}
|
|
269
|
+
{/each}
|
|
270
|
+
</div>
|
|
271
|
+
{/if}
|
|
272
|
+
</BlockWrapper>
|
|
273
|
+
{/if}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { page } from "$app/state";
|
|
3
|
+
import type { MessageFile } from "$lib/types/Message";
|
|
4
|
+
import CarbonClose from "~icons/carbon/close";
|
|
5
|
+
import CarbonDocumentBlank from "~icons/carbon/document-blank";
|
|
6
|
+
import CarbonDownload from "~icons/carbon/download";
|
|
7
|
+
import CarbonDocument from "~icons/carbon/document";
|
|
8
|
+
import Modal from "../Modal.svelte";
|
|
9
|
+
import AudioPlayer from "../players/AudioPlayer.svelte";
|
|
10
|
+
import EosIconsLoading from "~icons/eos-icons/loading";
|
|
11
|
+
import { base } from "$app/paths";
|
|
12
|
+
import { TEXT_MIME_ALLOWLIST } from "$lib/constants/mime";
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
file: MessageFile;
|
|
16
|
+
canClose?: boolean;
|
|
17
|
+
onclose?: () => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let { file, canClose = true, onclose }: Props = $props();
|
|
21
|
+
|
|
22
|
+
let showModal = $state(false);
|
|
23
|
+
|
|
24
|
+
// Capture URL once at component creation to prevent reactive updates during navigation
|
|
25
|
+
let urlNotTrailing = page.url.pathname.replace(/\/$/, "");
|
|
26
|
+
|
|
27
|
+
function truncateMiddle(text: string, maxLength: number): string {
|
|
28
|
+
if (text.length <= maxLength) {
|
|
29
|
+
return text;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const halfLength = Math.floor((maxLength - 1) / 2);
|
|
33
|
+
const start = text.substring(0, halfLength);
|
|
34
|
+
const end = text.substring(text.length - halfLength);
|
|
35
|
+
|
|
36
|
+
return `${start}…${end}`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const isImage = (mime: string) =>
|
|
40
|
+
mime.startsWith("image/") || mime === "webp" || mime === "jpeg" || mime === "png";
|
|
41
|
+
|
|
42
|
+
const isAudio = (mime: string) =>
|
|
43
|
+
mime.startsWith("audio/") || mime === "mp3" || mime === "wav" || mime === "x-wav";
|
|
44
|
+
const isVideo = (mime: string) =>
|
|
45
|
+
mime.startsWith("video/") || mime === "mp4" || mime === "x-mpeg";
|
|
46
|
+
|
|
47
|
+
function matchesAllowed(contentType: string, allowed: readonly string[]): boolean {
|
|
48
|
+
const ct = contentType.split(";")[0]?.trim().toLowerCase();
|
|
49
|
+
if (!ct) return false;
|
|
50
|
+
const [ctType, ctSubtype] = ct.split("/");
|
|
51
|
+
for (const a of allowed) {
|
|
52
|
+
const [aType, aSubtype] = a.toLowerCase().split("/");
|
|
53
|
+
const typeOk = aType === "*" || aType === ctType;
|
|
54
|
+
const subOk = aSubtype === "*" || aSubtype === ctSubtype;
|
|
55
|
+
if (typeOk && subOk) return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const isPlainText = (mime: string) =>
|
|
61
|
+
mime === "application/vnd.chatui.clipboard" || matchesAllowed(mime, TEXT_MIME_ALLOWLIST);
|
|
62
|
+
|
|
63
|
+
let isClickable = $derived(isImage(file.mime) || isPlainText(file.mime));
|
|
64
|
+
</script>
|
|
65
|
+
|
|
66
|
+
{#if showModal && isClickable}
|
|
67
|
+
<!-- show the image file full screen, click outside to exit -->
|
|
68
|
+
<Modal width="xl:max-w-[75dvw]" onclose={() => (showModal = false)}>
|
|
69
|
+
{#if isImage(file.mime)}
|
|
70
|
+
{#if file.type === "hash"}
|
|
71
|
+
<img
|
|
72
|
+
src={urlNotTrailing + "/output/" + file.value}
|
|
73
|
+
alt="input from user"
|
|
74
|
+
class="aspect-auto"
|
|
75
|
+
/>
|
|
76
|
+
{:else}
|
|
77
|
+
<!-- handle the case where this is a base64 encoded image -->
|
|
78
|
+
<img
|
|
79
|
+
src={`data:${file.mime};base64,${file.value}`}
|
|
80
|
+
alt="input from user"
|
|
81
|
+
class="aspect-auto"
|
|
82
|
+
/>
|
|
83
|
+
{/if}
|
|
84
|
+
{:else if isPlainText(file.mime)}
|
|
85
|
+
<div class="relative flex h-full w-full flex-col gap-2 p-4">
|
|
86
|
+
<div class="flex items-center gap-1">
|
|
87
|
+
<CarbonDocument />
|
|
88
|
+
<h3 class="text-lg font-semibold">{file.name}</h3>
|
|
89
|
+
</div>
|
|
90
|
+
{#if file.mime === "application/vnd.chatui.clipboard"}
|
|
91
|
+
<p class="text-sm text-gray-500">
|
|
92
|
+
If you prefer to inject clipboard content directly in the chat, you can disable this
|
|
93
|
+
feature in the
|
|
94
|
+
<a href={`${base}/settings`} class="underline">settings page</a>.
|
|
95
|
+
</p>
|
|
96
|
+
{/if}
|
|
97
|
+
<button
|
|
98
|
+
class="absolute right-4 top-4 text-xl text-gray-500 hover:text-gray-800 dark:text-gray-400 dark:hover:text-white"
|
|
99
|
+
onclick={() => (showModal = false)}
|
|
100
|
+
>
|
|
101
|
+
<CarbonClose class="text-xl" />
|
|
102
|
+
</button>
|
|
103
|
+
{#if file.type === "hash"}
|
|
104
|
+
{#await fetch(urlNotTrailing + "/output/" + file.value).then((res) => res.text())}
|
|
105
|
+
<div class="flex h-full w-full items-center justify-center">
|
|
106
|
+
<EosIconsLoading class="text-xl" />
|
|
107
|
+
</div>
|
|
108
|
+
{:then result}
|
|
109
|
+
<pre
|
|
110
|
+
class="w-full whitespace-pre-wrap break-words pt-0 text-xs"
|
|
111
|
+
class:font-sans={file.mime === "text/plain" ||
|
|
112
|
+
file.mime === "application/vnd.chatui.clipboard"}
|
|
113
|
+
class:font-mono={file.mime !== "text/plain" &&
|
|
114
|
+
file.mime !== "application/vnd.chatui.clipboard"}>{result}</pre>
|
|
115
|
+
{/await}
|
|
116
|
+
{:else}
|
|
117
|
+
<pre
|
|
118
|
+
class="w-full whitespace-pre-wrap break-words pt-0 text-xs"
|
|
119
|
+
class:font-sans={file.mime === "text/plain" ||
|
|
120
|
+
file.mime === "application/vnd.chatui.clipboard"}
|
|
121
|
+
class:font-mono={file.mime !== "text/plain" &&
|
|
122
|
+
file.mime !== "application/vnd.chatui.clipboard"}>{atob(file.value)}</pre>
|
|
123
|
+
{/if}
|
|
124
|
+
</div>
|
|
125
|
+
{/if}
|
|
126
|
+
</Modal>
|
|
127
|
+
{/if}
|
|
128
|
+
|
|
129
|
+
<div
|
|
130
|
+
onclick={() => isClickable && (showModal = true)}
|
|
131
|
+
onkeydown={(e) => {
|
|
132
|
+
if (!isClickable) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
136
|
+
showModal = true;
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
139
|
+
class:clickable={isClickable}
|
|
140
|
+
role="button"
|
|
141
|
+
tabindex="0"
|
|
142
|
+
>
|
|
143
|
+
<div class="group relative flex items-center rounded-xl shadow-sm">
|
|
144
|
+
{#if isImage(file.mime)}
|
|
145
|
+
<div class="h-36 overflow-hidden rounded-xl">
|
|
146
|
+
<img
|
|
147
|
+
src={file.type === "base64"
|
|
148
|
+
? `data:${file.mime};base64,${file.value}`
|
|
149
|
+
: urlNotTrailing + "/output/" + file.value}
|
|
150
|
+
alt={file.name}
|
|
151
|
+
class="h-36 bg-gray-200 object-cover dark:bg-gray-800"
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
{:else if isAudio(file.mime)}
|
|
155
|
+
<AudioPlayer
|
|
156
|
+
src={file.type === "base64"
|
|
157
|
+
? `data:${file.mime};base64,${file.value}`
|
|
158
|
+
: urlNotTrailing + "/output/" + file.value}
|
|
159
|
+
name={truncateMiddle(file.name, 28)}
|
|
160
|
+
/>
|
|
161
|
+
{:else if isVideo(file.mime)}
|
|
162
|
+
<div
|
|
163
|
+
class="border-1 w-72 overflow-clip rounded-xl border-gray-200 bg-white dark:border-gray-800 dark:bg-gray-900"
|
|
164
|
+
>
|
|
165
|
+
<!-- svelte-ignore a11y_media_has_caption -->
|
|
166
|
+
<video
|
|
167
|
+
src={file.type === "base64"
|
|
168
|
+
? `data:${file.mime};base64,${file.value}`
|
|
169
|
+
: urlNotTrailing + "/output/" + file.value}
|
|
170
|
+
controls
|
|
171
|
+
></video>
|
|
172
|
+
</div>
|
|
173
|
+
{:else if isPlainText(file.mime)}
|
|
174
|
+
<div
|
|
175
|
+
class="flex h-14 w-64 items-center gap-2 overflow-hidden rounded-xl border border-gray-200 bg-white p-2 dark:border-gray-800 dark:bg-gray-900 2xl:w-72"
|
|
176
|
+
class:file-hoverable={isClickable}
|
|
177
|
+
>
|
|
178
|
+
<div
|
|
179
|
+
class="grid size-10 flex-none place-items-center rounded-lg bg-gray-100 dark:bg-gray-800"
|
|
180
|
+
>
|
|
181
|
+
<CarbonDocument class="text-base text-gray-700 dark:text-gray-300" />
|
|
182
|
+
</div>
|
|
183
|
+
<dl class="flex flex-col items-start truncate leading-tight">
|
|
184
|
+
<dd class="text-sm">
|
|
185
|
+
{truncateMiddle(file.name, 28)}
|
|
186
|
+
</dd>
|
|
187
|
+
{#if file.mime === "application/vnd.chatui.clipboard"}
|
|
188
|
+
<dt class="text-xs text-gray-400">Clipboard source</dt>
|
|
189
|
+
{:else}
|
|
190
|
+
<dt class="text-xs text-gray-400">{file.mime}</dt>
|
|
191
|
+
{/if}
|
|
192
|
+
</dl>
|
|
193
|
+
</div>
|
|
194
|
+
{:else if file.mime === "application/octet-stream"}
|
|
195
|
+
<div
|
|
196
|
+
class="flex h-14 w-72 items-center gap-2 overflow-hidden rounded-xl border border-gray-200 bg-white p-2 dark:border-gray-800 dark:bg-gray-900"
|
|
197
|
+
class:file-hoverable={isClickable}
|
|
198
|
+
>
|
|
199
|
+
<div
|
|
200
|
+
class="grid size-10 flex-none place-items-center rounded-lg bg-gray-100 dark:bg-gray-800"
|
|
201
|
+
>
|
|
202
|
+
<CarbonDocumentBlank class="text-base text-gray-700 dark:text-gray-300" />
|
|
203
|
+
</div>
|
|
204
|
+
<dl class="flex flex-grow flex-col truncate leading-tight">
|
|
205
|
+
<dd class="text-sm">
|
|
206
|
+
{truncateMiddle(file.name, 28)}
|
|
207
|
+
</dd>
|
|
208
|
+
<dt class="text-xs text-gray-400">File type could not be determined</dt>
|
|
209
|
+
</dl>
|
|
210
|
+
<a
|
|
211
|
+
href={file.type === "base64"
|
|
212
|
+
? `data:application/octet-stream;base64,${file.value}`
|
|
213
|
+
: urlNotTrailing + "/output/" + file.value}
|
|
214
|
+
download={file.name}
|
|
215
|
+
class="ml-auto flex-none"
|
|
216
|
+
>
|
|
217
|
+
<CarbonDownload class="text-base text-gray-700 dark:text-gray-300" />
|
|
218
|
+
</a>
|
|
219
|
+
</div>
|
|
220
|
+
{:else}
|
|
221
|
+
<div
|
|
222
|
+
class="flex h-14 w-72 items-center gap-2 overflow-hidden rounded-xl border border-gray-200 bg-white p-2 dark:border-gray-800 dark:bg-gray-900"
|
|
223
|
+
class:file-hoverable={isClickable}
|
|
224
|
+
>
|
|
225
|
+
<div
|
|
226
|
+
class="grid size-10 flex-none place-items-center rounded-lg bg-gray-100 dark:bg-gray-800"
|
|
227
|
+
>
|
|
228
|
+
<CarbonDocumentBlank class="text-base text-gray-700 dark:text-gray-300" />
|
|
229
|
+
</div>
|
|
230
|
+
<dl class="flex flex-col items-start truncate leading-tight">
|
|
231
|
+
<dd class="text-sm">
|
|
232
|
+
{truncateMiddle(file.name, 28)}
|
|
233
|
+
</dd>
|
|
234
|
+
<dt class="text-xs text-gray-400">{file.mime}</dt>
|
|
235
|
+
</dl>
|
|
236
|
+
</div>
|
|
237
|
+
{/if}
|
|
238
|
+
<!-- add a button on top that removes the image -->
|
|
239
|
+
{#if canClose}
|
|
240
|
+
<button
|
|
241
|
+
class="absolute -right-2 -top-2 z-10 grid size-6 place-items-center rounded-full border bg-black group-hover:visible dark:border-gray-700"
|
|
242
|
+
class:invisible={navigator.maxTouchPoints === 0}
|
|
243
|
+
onclick={(e) => {
|
|
244
|
+
e.preventDefault();
|
|
245
|
+
e.stopPropagation();
|
|
246
|
+
onclose?.();
|
|
247
|
+
}}
|
|
248
|
+
>
|
|
249
|
+
<CarbonClose class=" text-xs text-white" />
|
|
250
|
+
</button>
|
|
251
|
+
{/if}
|
|
252
|
+
</div>
|
|
253
|
+
</div>
|