LLM inference in C/C++
C++ ggml
ui: Constants refactor (#26908)
Aleksander Grygiere21152dc9636
diff --git a/tools/ui/pwa-assets-dark.config.ts b/tools/ui/pwa-assets-dark.config.tsindex 1446b47a82..4d8114ee76 100644--- a/tools/ui/pwa-assets-dark.config.ts+++ b/tools/ui/pwa-assets-dark.config.ts@@ -1,5 +1,5 @@import { writeThemeFavicons } from './scripts/favicon-colorize';-import { FAVICON_COLORS, PWA_ASSET_GENERATOR } from './src/lib/constants/pwa';+import { FAVICON_COLORS, PWA_ASSET_GENERATOR } from './src/lib/constants/pwa.constants';import { defineConfig } from '@vite-pwa/assets-generator/config';writeThemeFavicons(FAVICON_COLORS.LIGHT, FAVICON_COLORS.DARK, {diff --git a/tools/ui/pwa-assets.config.ts b/tools/ui/pwa-assets.config.tsindex 5fed0a5957..f9f8662a20 100644--- a/tools/ui/pwa-assets.config.ts+++ b/tools/ui/pwa-assets.config.ts@@ -4,7 +4,7 @@ import {PWA_ASSET_GENERATOR,PWA_GENERATOR_DEVICES,THEME_COLORS-} from './src/lib/constants/pwa';+} from './src/lib/constants/pwa.constants';import { SplashOrientation } from './src/lib/enums/splash.enums';import {combinePresetAndAppleSplashScreens,diff --git a/tools/ui/scripts/vite-plugin-build-info.ts b/tools/ui/scripts/vite-plugin-build-info.tsindex 8002386305..ec864e8d03 100644--- a/tools/ui/scripts/vite-plugin-build-info.ts+++ b/tools/ui/scripts/vite-plugin-build-info.ts@@ -1,4 +1,4 @@-import { BUILD_CONFIG } from '../src/lib/constants/pwa';+import { BUILD_CONFIG } from '../src/lib/constants/pwa.constants';import { existsSync, writeFileSync } from 'node:fs';import { resolve } from 'path';import type { Plugin } from 'vite';diff --git a/tools/ui/scripts/vite-plugin-relativize-base.ts b/tools/ui/scripts/vite-plugin-relativize-base.tsindex f8eac1d665..0e47741ae9 100644--- a/tools/ui/scripts/vite-plugin-relativize-base.ts+++ b/tools/ui/scripts/vite-plugin-relativize-base.ts@@ -1,4 +1,4 @@-import { BUILD_CONFIG } from '../src/lib/constants/pwa';+import { BUILD_CONFIG } from '../src/lib/constants/pwa.constants';import { existsSync, readFileSync, writeFileSync } from 'node:fs';import { resolve } from 'path';import type { Plugin } from 'vite';diff --git a/tools/ui/scripts/vite-plugin-splash-screen.ts b/tools/ui/scripts/vite-plugin-splash-screen.tsindex 45d931bab3..62b7a063ac 100644--- a/tools/ui/scripts/vite-plugin-splash-screen.ts+++ b/tools/ui/scripts/vite-plugin-splash-screen.ts@@ -1,5 +1,10 @@-import { NEWLINE, TAB } from '../src/lib/constants/code';-import { APPLE_DEVICES, BUILD_CONFIG, REGEX_PATTERNS, SPLASH_LINK } from '../src/lib/constants/pwa';+import {+ APPLE_DEVICES,+ BUILD_CONFIG,+ REGEX_PATTERNS,+ SPLASH_LINK+} from '../src/lib/constants/pwa.constants';+import { NEWLINE, TAB } from '../src/lib/constants/special-characters.constants';import { SplashOrientation } from '../src/lib/enums/splash.enums';import type { SplashDimensions } from '../src/lib/types';import { existsSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';diff --git a/tools/ui/src/lib/components/app/actions/ActionIconCopyToClipboard.svelte b/tools/ui/src/lib/components/app/actions/ActionIconCopyToClipboard.svelteindex 7655f18e80..2d54df89d6 100644--- a/tools/ui/src/lib/components/app/actions/ActionIconCopyToClipboard.svelte+++ b/tools/ui/src/lib/components/app/actions/ActionIconCopyToClipboard.svelte@@ -1,7 +1,7 @@<script lang="ts">import ActionIcon from './ActionIcon.svelte';import { Copy } from '@lucide/svelte';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { copyToClipboard } from '$lib/utils';export let ariaLabel: string = 'Copy to clipboard';diff --git a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsListItem/ChatAttachmentsListItemThumbnailFile.svelte b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsListItem/ChatAttachmentsListItemThumbnailFile.svelteindex da8dd3b868..abdba0e2e0 100644--- a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsListItem/ChatAttachmentsListItemThumbnailFile.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsList/ChatAttachmentsListItem/ChatAttachmentsListItemThumbnailFile.svelte@@ -1,7 +1,7 @@<script lang="ts">import { Music, Video, X } from '@lucide/svelte';import { ActionIcon } from '$lib/components/app';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { AttachmentType } from '$lib/enums';import {formatFileSize,diff --git a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewCurrentItem/ChatAttachmentsPreviewCurrentItemPdf.svelte b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewCurrentItem/ChatAttachmentsPreviewCurrentItemPdf.svelteindex 69b1724fb2..4be156edba 100644--- a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewCurrentItem/ChatAttachmentsPreviewCurrentItemPdf.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewCurrentItem/ChatAttachmentsPreviewCurrentItemPdf.svelte@@ -3,7 +3,7 @@import { SyntaxHighlightedCode } from '$lib/components/app';import * as Alert from '$lib/components/ui/alert';import { Button } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { PdfViewMode } from '$lib/enums';import type { ChatAttachmentDisplayItem } from '$lib/types';import { getLanguageFromFilename } from '$lib/utils';diff --git a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewThumbnailStrip.svelte b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewThumbnailStrip.svelteindex 994a35f201..60b72077d8 100644--- a/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewThumbnailStrip.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatAttachments/ChatAttachmentsPreview/ChatAttachmentsPreviewThumbnailStrip.svelte@@ -1,7 +1,7 @@<script lang="ts">import { FileText, Music, Video } from '@lucide/svelte';import { HorizontalScrollCarousel } from '$lib/components/app/misc';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';interface PreviewItem {id: string;diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddButton.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddButton.svelteindex 39a314c7dd..ae76dedcad 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddButton.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddButton.svelte@@ -2,8 +2,7 @@import { Plus } from '@lucide/svelte';import { Button } from '$lib/components/ui/button';import * as Tooltip from '$lib/components/ui/tooltip';- import { ATTACHMENT_TOOLTIP_TEXT } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ATTACHMENT_TOOLTIP_TEXT, ICON_CLASS_DEFAULT } from '$lib/constants';interface Props {disabled?: boolean;diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelteindex c17c796a45..99aaee7845 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddDropdown.svelte@@ -12,9 +12,9 @@import {ATTACHMENT_FILE_ITEMS,ATTACHMENT_TOOLTIP_TEXT,+ ICON_CLASS_DEFAULT,TOOLTIP_DELAY_DURATION} from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';import { useAttachmentMenu } from '$lib/hooks/use-attachment-menu.svelte';interface Props {diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddMcpServersSubmenu.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddMcpServersSubmenu.svelteindex 852bf3fb66..178345e834 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddMcpServersSubmenu.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddMcpServersSubmenu.svelte@@ -4,8 +4,7 @@import { DropdownMenuSearchable, McpLogo, McpServerIdentity } from '$lib/components/app';import * as DropdownMenu from '$lib/components/ui/dropdown-menu';import { Switch } from '$lib/components/ui/switch';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';- import { ROUTES } from '$lib/constants/routes';+ import { ICON_CLASS_DEFAULT, ROUTES } from '$lib/constants';import { HealthCheckStatus } from '$lib/enums';import { conversationsStore } from '$lib/stores/conversations.svelte';import { mcpStore } from '$lib/stores/mcp.svelte';diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddReasoningSubmenu.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddReasoningSubmenu.svelteindex 03b9f9f0a9..a3a0b3a20f 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddReasoningSubmenu.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddReasoningSubmenu.svelte@@ -2,7 +2,7 @@import { Check, Info, Lightbulb, LightbulbOff } from '@lucide/svelte';import * as DropdownMenu from '$lib/components/ui/dropdown-menu';import * as Tooltip from '$lib/components/ui/tooltip';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { useReasoningMenu } from '$lib/hooks/use-reasoning-menu.svelte';const reasoning = useReasoningMenu();diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelteindex 73f616f697..299b22209f 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddSheet.svelte@@ -14,9 +14,11 @@import * as Sheet from '$lib/components/ui/sheet';import { Switch } from '$lib/components/ui/switch';import * as Tooltip from '$lib/components/ui/tooltip';- import { TOOLTIP_DELAY_DURATION } from '$lib/constants';- import { ATTACHMENT_FILE_ITEMS } from '$lib/constants/attachment-menu';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import {+ ATTACHMENT_FILE_ITEMS,+ ICON_CLASS_DEFAULT,+ TOOLTIP_DELAY_DURATION+ } from '$lib/constants';import { HealthCheckStatus } from '$lib/enums';import { AttachmentAction } from '$lib/enums/attachment.enums';import { useAttachmentMenu } from '$lib/hooks/use-attachment-menu.svelte';diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddToolsSubmenu.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddToolsSubmenu.svelteindex 844376ea65..ac3b5712fc 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddToolsSubmenu.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionAdd/ChatFormActionAddToolsSubmenu.svelte@@ -4,8 +4,7 @@import * as Collapsible from '$lib/components/ui/collapsible';import * as DropdownMenu from '$lib/components/ui/dropdown-menu';import * as Tooltip from '$lib/components/ui/tooltip';- import { CLI_FLAGS } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { CLI_FLAGS, ICON_CLASS_DEFAULT } from '$lib/constants';import { useToolsPanel } from '$lib/hooks/use-tools-panel.svelte';import { mcpStore } from '$lib/stores/mcp.svelte';import { toolsStore } from '$lib/stores/tools.svelte';diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionRecord.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionRecord.svelteindex dbf73e8dd1..d1dd3fe46c 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionRecord.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActionRecord.svelte@@ -2,7 +2,7 @@import { Mic, Square } from '@lucide/svelte';import { Button } from '$lib/components/ui/button';import * as Tooltip from '$lib/components/ui/tooltip';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';interface Props {class?: string;diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelteindex 7207165a1f..5dcf3531ae 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormActions/ChatFormActions.svelte@@ -10,8 +10,7 @@ChatFormContextGauge} from '$lib/components/app';import { Button } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';- import { ROUTES } from '$lib/constants/routes';+ import { ICON_CLASS_DEFAULT, ROUTES } from '$lib/constants';import { FileTypeCategory, MessageRole } from '$lib/enums';import { ChatService } from '$lib/services';import {diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormContenteditable.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormContenteditable.svelteindex 35977dfc39..ec916b3f13 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormContenteditable.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormContenteditable.svelte@@ -1,5 +1,5 @@<script lang="ts">- import { TRIM_LEADING_PADDING_REGEX, TRIM_TRAILING_PADDING_REGEX } from '$lib/constants';+ import { CODE_BLOCK } from '$lib/constants';import { ColorMode } from '$lib/enums';import { isMobile } from '$lib/stores/viewport.svelte';import type { ContentToken, SourceHistoryEntry } from '$lib/utils';@@ -105,8 +105,8 @@const prefix = open[0];const language = open[1].trim().split(/\s+/)[0] ?? '';const content = segment.slice(prefix.length, -3);- const leading = content.match(TRIM_LEADING_PADDING_REGEX)?.[0] ?? '';- const trailing = content.match(TRIM_TRAILING_PADDING_REGEX)?.[0] ?? '';+ const leading = content.match(CODE_BLOCK.TRIM_LEADING_PADDING_REGEX)?.[0] ?? '';+ const trailing = content.match(CODE_BLOCK.TRIM_TRAILING_PADDING_REGEX)?.[0] ?? '';const core = content.slice(leading.length, content.length - trailing.length);// autoDetect off: re-guessing the language on every keystroke// costs ~38ms a call and flickers while typingdiff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormMentionPicker.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormMentionPicker.svelteindex c69b6a995d..86a9fb81cd 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormMentionPicker.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormPickers/ChatFormMentionPicker.svelte@@ -4,11 +4,7 @@import HighlightedMatch from '$lib/components/app/forms/HighlightedMatch.svelte';import * as Popover from '$lib/components/ui/popover';import * as Tooltip from '$lib/components/ui/tooltip';- import {- FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH,- HOME_TILDE,- SEARCH_DEBOUNCE_MS- } from '$lib/constants';+ import { FILE_GLOB_SEARCH_PICKERS, HOME_TILDE, SEARCH } from '$lib/constants';import { BuiltInTool, FileMentionEntryType, GlobSearchType, KeyboardKey } from '$lib/enums';import { useDebouncedSearch } from '$lib/hooks/use-debounced-search.svelte';import { usePickerNavigation } from '$lib/hooks/use-picker-navigation.svelte';@@ -70,7 +66,7 @@const searchDepth = $derived.by(() => {const n = Number(config().mentionSearchMaxDepth);- return Number.isInteger(n) && n > 0 ? n : FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH;+ return Number.isInteger(n) && n > 0 ? n : FILE_GLOB_SEARCH_PICKERS.DEFAULT_SEARCH_DEPTH;});const home = $derived(toolsStore.serverHome);@@ -80,7 +76,7 @@const search = useDebouncedSearch({canRun: () => isOpen && fileSearchEnabled,- debounceMs: SEARCH_DEBOUNCE_MS,+ debounceMs: SEARCH.DEBOUNCE_MS,getQuery: () => trimmedQuery,run: async (query, signal, isCurrent) => {try {diff --git a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormWorkingDirectory.svelte b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormWorkingDirectory.svelteindex fb0b31817e..27bc40b24a 100644--- a/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormWorkingDirectory.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatForm/ChatFormWorkingDirectory.svelte@@ -4,16 +4,7 @@import { FolderOpen } from '@lucide/svelte';import SearchInput from '$lib/components/app/forms/SearchInput.svelte';import * as Popover from '$lib/components/ui/popover';- import {- DEFAULT_MOBILE_BREAKPOINT,- HOME_TILDE,- MAX_RESULTS_SHOWN,- NATIVE_LIMIT,- NATIVE_MAX_DEPTH,- SEARCH_DEBOUNCE_MS,- SEARCH_LIMIT,- SEARCH_MAX_DEPTH- } from '$lib/constants';+ import { DEFAULT_MOBILE_BREAKPOINT, HOME_TILDE, SEARCH } from '$lib/constants';import { BuiltInTool, GlobSearchType, KeyboardKey } from '$lib/enums';import { useDebouncedSearch } from '$lib/hooks/use-debounced-search.svelte';import { usePickerNavigation } from '$lib/hooks/use-picker-navigation.svelte';@@ -142,7 +133,7 @@// children too, so path navigation does not require a trailing slash.const search = useDebouncedSearch({canRun: () => isOpen && fileSearchEnabled,- debounceMs: SEARCH_DEBOUNCE_MS,+ debounceMs: SEARCH.DEBOUNCE_MS,getQuery: () => query.trim(),run: async (q, signal, isCurrent) => {const trimmed = q.trim();@@ -162,8 +153,8 @@const res = await runGlobSearchWithChildren(trimmed,homeBase ?? HOME_TILDE,- SEARCH_MAX_DEPTH,- SEARCH_LIMIT,+ SEARCH.MAX_DEPTH,+ SEARCH.LIMIT,signal,{ type: GlobSearchType.DIR });@@ -179,7 +170,7 @@}searchScope = res.exactDir ?? res.args.path;- queryResults = res.entries.map((e) => e.path).slice(0, MAX_RESULTS_SHOWN);+ queryResults = res.entries.map((e) => e.path).slice(0, SEARCH.MAX_RESULTS_SHOWN);if (queryResults.length > 0) {nav.reset(0);@@ -223,8 +214,8 @@try {const res = await ToolsService.executeToolRaw(BuiltInTool.FILE_GLOB_SEARCH, {include: buildCaseInsensitiveGlob(name),- limit: NATIVE_LIMIT,- max_depth: NATIVE_MAX_DEPTH,+ limit: SEARCH.NATIVE_LIMIT,+ max_depth: SEARCH.NATIVE_MAX_DEPTH,path: homeBase ?? HOME_TILDE,type: GlobSearchType.DIR});diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelteindex 13702102c4..2cc3fb42f2 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessage.svelte@@ -7,9 +7,7 @@ChatMessageSystem,ChatMessageUser} from '$lib/components/app/chat';- import { SYSTEM_MESSAGE_PLACEHOLDER } from '$lib/constants';- import { REASONING_TAGS } from '$lib/constants/agentic';- import { ROUTES } from '$lib/constants/routes';+ import { REASONING_TAGS, ROUTES, SYSTEM_MESSAGE_PLACEHOLDER } from '$lib/constants';import { getChatActionsContext, setMessageEditContext } from '$lib/contexts';import { AgenticSectionType, AttachmentType, MessageRole } from '$lib/enums';import { DatabaseService } from '$lib/services/database.service';diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockDefault.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockDefault.svelteindex 87208e2daa..79120cb175 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockDefault.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockDefault.svelte@@ -7,13 +7,13 @@import { Loader2 } from '@lucide/svelte';import { MarkdownContent, SyntaxHighlightedCode } from '$lib/components/app';import { MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';- import { getBuiltinToolUi } from '$lib/constants/built-in-tools';import { AttachmentType, FileTypeText, MimeTypeAudio, ToolResultKind } from '$lib/enums';import type { DatabaseMessageExtra } from '$lib/types';import {type AgenticSection,classifyToolResult,formatJsonPretty,+ getBuiltinToolUi,parseToolResultWithMedia,type ToolResultLine} from '$lib/utils';diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockExecShellCommand.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockExecShellCommand.svelteindex 907a3cd12a..ef2bb74336 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockExecShellCommand.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockExecShellCommand.svelte@@ -10,8 +10,7 @@import ToolCallBlock from './ToolCallBlock.svelte';import { AlertTriangle, Check, Loader2, XCircle } from '@lucide/svelte';import { CollapsibleTerminalBlock } from '$lib/components/app';- import { SETTINGS_KEYS } from '$lib/constants';- import { TOOL_RUNTIME_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants/auto-scroll';+ import { SETTINGS_KEYS, TOOL_RUNTIME_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants';import { config } from '$lib/stores/settings.svelte';import { toolsStore } from '$lib/stores/tools.svelte';import type { DatabaseMessageExtra } from '$lib/types';diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadFile.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadFile.svelteindex c4aa28a358..a655d86a5f 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadFile.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadFile.svelte@@ -2,7 +2,7 @@import { parseReadFileMeta } from './parsers/read-file';import ToolCallBlock from './ToolCallBlock.svelte';import { SyntaxHighlightedCode } from '$lib/components/app';- import { DEFAULT_LANGUAGE, MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';+ import { CODE_BLOCK, MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';import { type AgenticSection } from '$lib/utils';interface Props {@@ -32,7 +32,7 @@{#if section.toolResult}<SyntaxHighlightedCodecode={section.toolResult}- language={readFileMeta?.language ?? DEFAULT_LANGUAGE}+ language={readFileMeta?.language ?? CODE_BLOCK.DEFAULT_LANGUAGE}maxHeight={MAX_HEIGHT_CODE_BLOCK}/>{:else}diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadMedia.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadMedia.svelteindex 424c794d0b..426fb45440 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadMedia.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockReadMedia.svelte@@ -1,7 +1,7 @@<script lang="ts">import { parseReadMediaMeta } from './parsers/read-media';import ToolCallBlock from './ToolCallBlock.svelte';- import { ATTACHMENT_SAVED_REGEX } from '$lib/constants/agentic';+ import { ATTACHMENT_SAVED_REGEX } from '$lib/constants/agentic.constants';import { AttachmentType, MimeTypeAudio } from '$lib/enums';import type { DatabaseMessageExtraAudioFile, DatabaseMessageExtraImageFile } from '$lib/types';import { type AgenticSection } from '$lib/utils';diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelteindex 2a9cc493fd..142ca84374 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ChatMessageToolCallBlockSearchResults.svelte@@ -2,7 +2,7 @@import { Globe, Loader2 } from '@lucide/svelte';import { CollapsibleContentBlock } from '$lib/components/app';import * as HoverCard from '$lib/components/ui/hover-card';- import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants';import { AgenticSectionType } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';import {diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelteindex c292544ac6..c43495b6c7 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/ToolCallBlock.svelte@@ -11,11 +11,10 @@import { Loader2, Wrench } from '@lucide/svelte';import { CollapsibleContentBlock } from '$lib/components/app';- import { getBuiltinToolUi } from '$lib/constants/built-in-tools';- import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT, ICON_CLASS_SPIN } from '$lib/constants';import { AgenticSectionType } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';- import type { AgenticSection, BuiltinToolUiEntry } from '$lib/utils';+ import { type AgenticSection, type BuiltinToolUiEntry, getBuiltinToolUi } from '$lib/utils';import type { Component, Snippet } from 'svelte';type ToolCallBlockMetaWithError = TMeta & { errorMessage?: string };diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-file.ts b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-file.tsindex cbde40df46..0b275f9732 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-file.ts+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-file.ts@@ -4,11 +4,7 @@// can render incrementally as the file path streams in.import { parseToolArgs } from './_shared';-import {- DEFAULT_LANGUAGE,- FILE_PATH_SEPARATOR_REGEX,- TEXT_LANGUAGE_PREFIX_REGEX-} from '$lib/constants';+import { CODE_BLOCK, FILE_PATH_SEPARATOR_REGEX } from '$lib/constants';import { BuiltInTool } from '$lib/enums';import { type AgenticSection, getFileTypeByExtension } from '$lib/utils';@@ -50,7 +46,9 @@ export function parseReadFileMeta(section: AgenticSection): ReadFileMeta | null}const fileType = getFileTypeByExtension(fileName);- const language = fileType ? fileType.replace(TEXT_LANGUAGE_PREFIX_REGEX, '') : DEFAULT_LANGUAGE;+ const language = fileType+ ? fileType.replace(CODE_BLOCK.TEXT_LANGUAGE_PREFIX_REGEX, '')+ : CODE_BLOCK.DEFAULT_LANGUAGE;return { fileName, language, lineRange };}diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-media.ts b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-media.tsindex ab1a4d6aa0..fbfdb33626 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-media.ts+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/read-media.ts@@ -1,4 +1,4 @@-import { FILE_PATH_SEPARATOR_REGEX, NEWLINE } from '$lib/constants/code';+import { FILE_PATH_SEPARATOR_REGEX, NEWLINE } from '$lib/constants';import {PREFIX_FILE,PREFIX_MIME,diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/write-file.ts b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/write-file.tsindex cdec283a02..df91d5cae0 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/write-file.ts+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessage/ChatMessageToolCall/parsers/write-file.ts@@ -4,11 +4,7 @@// result blob.import { parseToolArgs } from './_shared';-import {- DEFAULT_LANGUAGE,- FILE_PATH_SEPARATOR_REGEX,- TEXT_LANGUAGE_PREFIX_REGEX-} from '$lib/constants';+import { CODE_BLOCK, FILE_PATH_SEPARATOR_REGEX } from '$lib/constants';import { BuiltInTool } from '$lib/enums';import { type AgenticSection, getFileTypeByExtension, tryParseToolResultObject } from '$lib/utils';@@ -36,7 +32,8 @@ export function parseWriteFileMeta(section: AgenticSection): WriteFileMeta | nulconst fileName = rawPath.split(FILE_PATH_SEPARATOR_REGEX).pop() || rawPath;const content = typeof args.content === 'string' ? args.content : '';const language =- getFileTypeByExtension(rawPath)?.replace(TEXT_LANGUAGE_PREFIX_REGEX, '') ?? DEFAULT_LANGUAGE;+ getFileTypeByExtension(rawPath)?.replace(CODE_BLOCK.TEXT_LANGUAGE_PREFIX_REGEX, '') ??+ CODE_BLOCK.DEFAULT_LANGUAGE;const resultObj = tryParseToolResultObject(section.toolResult);const bytesWritten =resultObj && Number.isFinite(Number(resultObj.bytes)) ? Number(resultObj.bytes) : undefined;diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCard.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCard.svelteindex 3a60e674cd..0ee66829ab 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCard.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageActions/ChatMessageActionCard/ChatMessageActionCard.svelte@@ -1,5 +1,5 @@<script lang="ts">- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import type { Component, Snippet } from 'svelte';interface Props {diff --git a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelteindex ea3743e6c4..ebcc7279a9 100644--- a/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatMessages/ChatMessageReasoningBlock.svelte@@ -1,7 +1,7 @@<script lang="ts">import { Lightbulb } from '@lucide/svelte';import { CollapsibleContentBlock, MarkdownContent } from '$lib/components/app';- import { REASONING_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants/auto-scroll';+ import { REASONING_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants';import { AgenticSectionType } from '$lib/enums';import { config } from '$lib/stores/settings.svelte';import type { DatabaseMessageExtra } from '$lib/types';diff --git a/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenActionScrollDown.svelte b/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenActionScrollDown.svelteindex 15f4813a18..6fd27212d9 100644--- a/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenActionScrollDown.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenActionScrollDown.svelte@@ -1,7 +1,7 @@<script lang="ts">import { ArrowDown } from '@lucide/svelte';import ActionIcon from '$lib/components/app/actions/ActionIcon.svelte';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';let { onclick }: { onclick: (e?: MouseEvent) => void } = $props();</script>diff --git a/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenServerError.svelte b/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenServerError.svelteindex ae5d91beee..cae37d6f8a 100644--- a/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenServerError.svelte+++ b/tools/ui/src/lib/components/app/chat/ChatScreen/ChatScreenServerError.svelte@@ -1,7 +1,7 @@<script lang="ts">import { AlertTriangle, Loader2, RefreshCw } from '@lucide/svelte';import * as Alert from '$lib/components/ui/alert';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { serverError, serverLoading, serverStatus, serverStore } from '$lib/stores/server.svelte';let hasError = $derived(!!serverError());diff --git a/tools/ui/src/lib/components/app/content/CollapsibleContentBlock.svelte b/tools/ui/src/lib/components/app/content/CollapsibleContentBlock.svelteindex ec57985aca..042a83e0e2 100644--- a/tools/ui/src/lib/components/app/content/CollapsibleContentBlock.svelte+++ b/tools/ui/src/lib/components/app/content/CollapsibleContentBlock.svelte@@ -2,7 +2,7 @@import ChevronDown from '@lucide/svelte/icons/chevron-down';import * as Collapsible from '$lib/components/ui/collapsible/index.js';import { cn } from '$lib/components/ui/utils';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import type { Snippet } from 'svelte';import type { Component } from 'svelte';diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/MarkdownContent.svelte b/tools/ui/src/lib/components/app/content/MarkdownContent/MarkdownContent.svelteindex c768a04471..edfa32d48b 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/MarkdownContent.svelte+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/MarkdownContent.svelte@@ -26,7 +26,7 @@} from '$lib/components/app';import {BOOL_TRUE_STRING,- CODE_BLOCK_HEADER_CLASS,+ CODE_BLOCK_CLASS,DATA_ERROR_BOUND_ATTR,DATA_ERROR_HANDLED_ATTR,DIAGRAM_VIEW_MODE_ATTR,@@ -39,15 +39,8 @@MERMAID_SYNTAX_ATTR,MERMAID_WRAPPER_CLASS,SETTINGS_KEYS,- SVG_BLOCK_CLASS,- SVG_INLINE_SHADOW_STYLE,- SVG_LANGUAGE,- SVG_RENDERED_ATTR,- SVG_SOURCE_ATTR,- SVG_TAG_PREFIX,- SVG_WRAPPER_CLASS,- TOGGLE_SOURCE_BTN_CLASS,- XML_LANGUAGE+ SVG,+ TOGGLE_SOURCE_BTN_CLASS} from '$lib/constants';import { ColorMode, UrlProtocol } from '$lib/enums';import { FileTypeText } from '$lib/enums/files.enums';@@ -105,9 +98,9 @@if (!block) return null;- if (block.language === SVG_LANGUAGE) return block.code;+ if (block.language === SVG.LANGUAGE) return block.code;- if (block.language === XML_LANGUAGE && block.code.trimStart().startsWith(SVG_TAG_PREFIX))+ if (block.language === SVG.XML_LANGUAGE && block.code.trimStart().startsWith(SVG.TAG_PREFIX))return block.code;return null;@@ -137,7 +130,7 @@// Mount the streaming svg into its shadow host on every chunk so it renders live$effect(() => {- if (streamingSvgHost) mountSvgShadow(streamingSvgHost, liveSvgHtml, SVG_INLINE_SHADOW_STYLE);+ if (streamingSvgHost) mountSvgShadow(streamingSvgHost, liveSvgHtml, SVG.INLINE_SHADOW_STYLE);});let streamingCodeScrollContainer = $state<HTMLDivElement>();@@ -535,7 +528,7 @@event.preventDefault();event.stopPropagation();- const wrapper = toggleBtn.closest(`.${MERMAID_WRAPPER_CLASS}, .${SVG_WRAPPER_CLASS}`);+ const wrapper = toggleBtn.closest(`.${MERMAID_WRAPPER_CLASS}, .${SVG.WRAPPER_CLASS}`);if (!wrapper) return;@@ -593,16 +586,16 @@}// Check if clicking on copy or preview button in svg block- const svgCopyBtn = target.closest(`.${SVG_WRAPPER_CLASS} .copy-code-btn`);- const svgPreviewBtn = target.closest(`.${SVG_WRAPPER_CLASS} .preview-code-btn`);+ const svgCopyBtn = target.closest(`.${SVG.WRAPPER_CLASS} .copy-code-btn`);+ const svgPreviewBtn = target.closest(`.${SVG.WRAPPER_CLASS} .preview-code-btn`);if (svgCopyBtn || svgPreviewBtn) {- const wrapper = target.closest(`.${SVG_WRAPPER_CLASS}`);+ const wrapper = target.closest(`.${SVG.WRAPPER_CLASS}`);if (!wrapper) return;const preElement = wrapper.querySelector<HTMLElement>(- `pre.${SVG_BLOCK_CLASS}[${SVG_SOURCE_ATTR}]`+ `pre.${SVG.BLOCK_CLASS}[${SVG.SOURCE_ATTR}]`);if (!preElement) return;@@ -611,7 +604,7 @@event.preventDefault();event.stopPropagation();try {- await copyToClipboard(preElement.getAttribute(SVG_SOURCE_ATTR) ?? '');+ await copyToClipboard(preElement.getAttribute(SVG.SOURCE_ATTR) ?? '');} catch (error) {console.error('Failed to copy svg source:', error);}@@ -622,7 +615,7 @@if (svgPreviewBtn) {event.preventDefault();event.stopPropagation();- mermaidPreviewSvgHtml = sanitizeSvg(preElement.getAttribute(SVG_SOURCE_ATTR) ?? '');+ mermaidPreviewSvgHtml = sanitizeSvg(preElement.getAttribute(SVG.SOURCE_ATTR) ?? '');svgPreviewLive = false;mermaidPreviewOpen = true;@@ -633,14 +626,14 @@// A click on the header chrome targets the action buttons, never the// diagram. Guard so a header click can not fall through to the click to// zoom branches below, whatever the scroll position or stacking.- if (target.closest(`.${CODE_BLOCK_HEADER_CLASS}`)) return;+ if (target.closest(`.${CODE_BLOCK_CLASS.HEADER}`)) return;// Open preview when clicking the svg block itself. A final block carries its// source, a streaming block does not and is mirrored live into the dialog.- const svgEl = target.closest(`.${SVG_BLOCK_CLASS}`);+ const svgEl = target.closest(`.${SVG.BLOCK_CLASS}`);if (svgEl) {- const source = svgEl.getAttribute(SVG_SOURCE_ATTR);+ const source = svgEl.getAttribute(SVG.SOURCE_ATTR);if (source !== null) {mermaidPreviewSvgHtml = sanitizeSvg(source);@@ -739,15 +732,15 @@if (!containerRef) return;const nodes = containerRef.querySelectorAll<HTMLElement>(- `pre.${SVG_BLOCK_CLASS}:not([${SVG_RENDERED_ATTR}])`+ `pre.${SVG.BLOCK_CLASS}:not([${SVG.RENDERED_ATTR}])`);if (nodes.length === 0) return;nodes.forEach((node) => {- node.setAttribute(SVG_RENDERED_ATTR, 'true');+ node.setAttribute(SVG.RENDERED_ATTR, 'true');- const source = node.getAttribute(SVG_SOURCE_ATTR) ?? node.textContent ?? '';+ const source = node.getAttribute(SVG.SOURCE_ATTR) ?? node.textContent ?? '';const clean = sanitizeSvg(source);if (clean) {@@ -755,7 +748,7 @@const host = document.createElement('div');node.appendChild(host);- mountSvgShadow(host, clean, SVG_INLINE_SHADOW_STYLE);+ mountSvgShadow(host, clean, SVG.INLINE_SHADOW_STYLE);}});}@@ -919,7 +912,7 @@</div>{#if liveSvgHtml}<div class="svg-scroll-container">- <div class={SVG_BLOCK_CLASS}>+ <div class={SVG.BLOCK_CLASS}><div bind:this={streamingSvgHost}></div></div></div>diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/code-block-utils.ts b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/code-block-utils.tsindex cd093655ca..4eb38e49fd 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/code-block-utils.ts+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/code-block-utils.ts@@ -4,17 +4,11 @@*/import {- CODE_BLOCK_ACTIONS_CLASS,- CODE_BLOCK_HEADER_CLASS,- CODE_BLOCK_SCROLL_CONTAINER_CLASS,+ CODE_BLOCK_CLASS,CODE_ICON_SVG,- CODE_LANGUAGE_CLASS,- COPY_CODE_BTN_CLASS,COPY_ICON_SVG,DIAGRAM_SOURCE_CLASS,- PREVIEW_CODE_BTN_CLASS,PREVIEW_ICON_SVG,- RELATIVE_CLASS,TOGGLE_SOURCE_BTN_CLASS} from '$lib/constants';import type { Element, ElementContent } from 'hast';@@ -65,7 +59,7 @@ export function createButton(* Creates a copy button element.*/export function createCopyButton(id: string, idAttribute: string, title: string = 'Copy'): Element {- return createButton(COPY_CODE_BTN_CLASS, title, COPY_ICON_SVG, id, idAttribute);+ return createButton(CODE_BLOCK_CLASS.COPY_BTN, title, COPY_ICON_SVG, id, idAttribute);}/**@@ -76,7 +70,7 @@ export function createPreviewButton(idAttribute: string,title: string = 'Preview'): Element {- return createButton(PREVIEW_CODE_BTN_CLASS, title, PREVIEW_ICON_SVG, id, idAttribute);+ return createButton(CODE_BLOCK_CLASS.PREVIEW_BTN, title, PREVIEW_ICON_SVG, id, idAttribute);}/**@@ -120,7 +114,7 @@ export function createSourceView(type: 'element'}],- properties: { className: [DIAGRAM_SOURCE_CLASS, CODE_BLOCK_SCROLL_CONTAINER_CLASS] },+ properties: { className: [DIAGRAM_SOURCE_CLASS, CODE_BLOCK_CLASS.SCROLL_CONTAINER] },tagName: 'div',type: 'element'};@@ -134,7 +128,7 @@ export function createBlockHeader(id: string,idAttribute: string,actions: Element[],- languageClassName: string = CODE_LANGUAGE_CLASS+ languageClassName: string = CODE_BLOCK_CLASS.LANGUAGE): Element {return {children: [@@ -146,12 +140,12 @@ export function createBlockHeader(},{children: actions,- properties: { className: [CODE_BLOCK_ACTIONS_CLASS] },+ properties: { className: [CODE_BLOCK_CLASS.ACTIONS] },tagName: 'div',type: 'element'}],- properties: { className: [CODE_BLOCK_HEADER_CLASS] },+ properties: { className: [CODE_BLOCK_CLASS.HEADER] },tagName: 'div',type: 'element'};@@ -185,7 +179,7 @@ export function createWrapper(return {children: [header, createScrollContainer(preElement, scrollContainerClass), ...extraChildren],properties: {- className: [wrapperClass, RELATIVE_CLASS],+ className: [wrapperClass, CODE_BLOCK_CLASS.RELATIVE],...additionalAttributes} as Element['properties'],tagName: 'div',diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-code-blocks.ts b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-code-blocks.tsindex 769e535fd7..54d401c116 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-code-blocks.ts+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-code-blocks.ts@@ -17,7 +17,7 @@ import {createWrapper,generateBlockId} from './code-block-utils';-import { CODE_BLOCK_SCROLL_CONTAINER_CLASS, CODE_BLOCK_WRAPPER_CLASS } from '$lib/constants';+import { CODE_BLOCK_CLASS } from '$lib/constants';import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';import { visit } from 'unist-util-visit';@@ -78,8 +78,8 @@ export const rehypeEnhanceCodeBlocks: Plugin<[], Root> = () => {const wrapper = createWrapper(header,node,- CODE_BLOCK_WRAPPER_CLASS,- CODE_BLOCK_SCROLL_CONTAINER_CLASS+ CODE_BLOCK_CLASS.WRAPPER,+ CODE_BLOCK_CLASS.SCROLL_CONTAINER);// Replace pre with wrapper in parentdiff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-svg-blocks.ts b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-svg-blocks.tsindex 70976ad7c5..e1ec4898e3 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-svg-blocks.ts+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/enhance-svg-blocks.ts@@ -19,16 +19,7 @@ import {generateBlockId} from './code-block-utils';import type { DiagramPreData } from './pre-transform';-import {- DIAGRAM_VIEW_MODE_ATTR,- DIAGRAM_VIEW_RENDERED,- SVG_BLOCK_CLASS,- SVG_ID_ATTR,- SVG_LANGUAGE,- SVG_SCROLL_CONTAINER_CLASS,- SVG_SOURCE_ATTR,- SVG_WRAPPER_CLASS-} from '$lib/constants';+import { DIAGRAM_VIEW_MODE_ATTR, DIAGRAM_VIEW_RENDERED, SVG } from '$lib/constants';import type { Element, ElementContent, Root } from 'hast';import type { Plugin } from 'unified';import { visit } from 'unist-util-visit';@@ -48,11 +39,11 @@ export const rehypeEnhanceSvgBlocks: Plugin<[], Root> = () => {if (!Array.isArray(className)) return;- const isSvg = className.some((cls) => typeof cls === 'string' && cls === SVG_BLOCK_CLASS);+ const isSvg = className.some((cls) => typeof cls === 'string' && cls === SVG.BLOCK_CLASS);if (!isSvg) return;- const svgId = generateBlockId(SVG_LANGUAGE, 'idxSvgBlock');+ const svgId = generateBlockId(SVG.LANGUAGE, 'idxSvgBlock');// Extract the svg source (text content of the pre element)const svgSource = node.children.map((child) => {@@ -65,26 +56,26 @@ export const rehypeEnhanceSvgBlocks: Plugin<[], Root> = () => {// Store the svg source in data attribute for copy and rendernode.properties = {...node.properties,- [SVG_ID_ATTR]: svgId,- [SVG_SOURCE_ATTR]: svgSource+ [SVG.ID_ATTR]: svgId,+ [SVG.SOURCE_ATTR]: svgSource};const actions = [- createCopyButton(svgId, SVG_ID_ATTR, 'Copy svg source'),- createToggleSourceButton(svgId, SVG_ID_ATTR, 'Toggle svg source'),- createPreviewButton(svgId, SVG_ID_ATTR, 'Preview svg')+ createCopyButton(svgId, SVG.ID_ATTR, 'Copy svg source'),+ createToggleSourceButton(svgId, SVG.ID_ATTR, 'Toggle svg source'),+ createPreviewButton(svgId, SVG.ID_ATTR, 'Preview svg')];- const header = createBlockHeader(SVG_LANGUAGE, svgId, SVG_ID_ATTR, actions);+ const header = createBlockHeader(SVG.LANGUAGE, svgId, SVG.ID_ATTR, actions);const preservedCode = (node.data as DiagramPreData | undefined)?.sourceCode;- const sourceView = createSourceView(preservedCode, svgSource, SVG_LANGUAGE);+ const sourceView = createSourceView(preservedCode, svgSource, SVG.LANGUAGE);const wrapper = createWrapper(header,node,- SVG_WRAPPER_CLASS,- SVG_SCROLL_CONTAINER_CLASS,+ SVG.WRAPPER_CLASS,+ SVG.SCROLL_CONTAINER_CLASS,{[DIAGRAM_VIEW_MODE_ATTR]: DIAGRAM_VIEW_RENDERED,- [SVG_ID_ATTR]: svgId+ [SVG.ID_ATTR]: svgId},[sourceView]);diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/file-badge.ts b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/file-badge.tsindex e8bc37eca7..24a78de46f 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/file-badge.ts+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/file-badge.ts@@ -1,7 +1,7 @@/*** Rehype plugin that rewrites `file://` markdown anchors into the inline* mention chip, sharing the class string with the contenteditable- * tokenizer via `$lib/constants/mention-badge`.+ * tokenizer via `$lib/constants`.** The chip is presentational: `file://` navigation is blocked from* http(s) pages, so the anchor becomes a plain `<span>` (no link role,diff --git a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/svg-pre.ts b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/svg-pre.tsindex df2cd5cbd6..7baa95ca41 100644--- a/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/svg-pre.ts+++ b/tools/ui/src/lib/components/app/content/MarkdownContent/plugins/rehype/svg-pre.ts@@ -1,5 +1,5 @@import { createPreTransform } from './pre-transform';-import { SVG_BLOCK_CLASS, SVG_LANGUAGE, SVG_TAG_PREFIX, XML_LANGUAGE } from '$lib/constants';+import { SVG } from '$lib/constants';/*** Converts svg code blocks to <pre class="svg-block"> for client-side rendering.@@ -7,7 +7,7 @@ import { SVG_BLOCK_CLASS, SVG_LANGUAGE, SVG_TAG_PREFIX, XML_LANGUAGE } from '$li* svg inside an xml fence.*/export const rehypeSvgPre = createPreTransform(- [SVG_LANGUAGE, XML_LANGUAGE],- SVG_BLOCK_CLASS,- (text) => text.startsWith(SVG_TAG_PREFIX)+ [SVG.LANGUAGE, SVG.XML_LANGUAGE],+ SVG.BLOCK_CLASS,+ (text) => text.startsWith(SVG.TAG_PREFIX));diff --git a/tools/ui/src/lib/components/app/content/MermaidPreview.svelte b/tools/ui/src/lib/components/app/content/MermaidPreview.svelteindex 4176002119..77d20ced3f 100644--- a/tools/ui/src/lib/components/app/content/MermaidPreview.svelte+++ b/tools/ui/src/lib/components/app/content/MermaidPreview.svelte@@ -1,6 +1,6 @@<script lang="ts">import MermaidPreviewControls from './MermaidPreviewControls.svelte';- import { SVG_DIALOG_SHADOW_STYLE } from '$lib/constants';+ import { SVG } from '$lib/constants';import { mountSvgShadow } from '$lib/utils/svg-shadow';interface Props {@@ -13,7 +13,7 @@// Re-mount on every svgHtml change so a live streaming svg keeps rendering while zoomed$effect(() => {- if (svgHost) mountSvgShadow(svgHost, svgHtml, SVG_DIALOG_SHADOW_STYLE);+ if (svgHost) mountSvgShadow(svgHost, svgHtml, SVG.DIALOG_SHADOW_STYLE);});// Zoom and pan statediff --git a/tools/ui/src/lib/components/app/content/MermaidPreviewControls.svelte b/tools/ui/src/lib/components/app/content/MermaidPreviewControls.svelteindex 1dd341f5a4..938da066c2 100644--- a/tools/ui/src/lib/components/app/content/MermaidPreviewControls.svelte+++ b/tools/ui/src/lib/components/app/content/MermaidPreviewControls.svelte@@ -3,7 +3,7 @@import RotateCcwIcon from '@lucide/svelte/icons/rotate-ccw';import ZoomInIcon from '@lucide/svelte/icons/zoom-in';import ZoomOutIcon from '@lucide/svelte/icons/zoom-out';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';interface Props {scale: number;diff --git a/tools/ui/src/lib/components/app/content/SyntaxHighlightedCode.svelte b/tools/ui/src/lib/components/app/content/SyntaxHighlightedCode.svelteindex 1261de4a89..829c846034 100644--- a/tools/ui/src/lib/components/app/content/SyntaxHighlightedCode.svelte+++ b/tools/ui/src/lib/components/app/content/SyntaxHighlightedCode.svelte@@ -1,6 +1,6 @@<script lang="ts">import { browser } from '$app/environment';- import { SYNTAX_CODE_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants/auto-scroll';+ import { SYNTAX_CODE_SCROLL_AT_BOTTOM_THRESHOLD_PX } from '$lib/constants';import { ColorMode } from '$lib/enums';import { highlightCode } from '$lib/utils';import githubLightCss from 'highlight.js/styles/github.css?inline';diff --git a/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcePreview.svelte b/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcePreview.svelteindex 537dd4c50c..6931d19ac0 100644--- a/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcePreview.svelte+++ b/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcePreview.svelte@@ -3,8 +3,8 @@import { ActionIconCopyToClipboard, SyntaxHighlightedCode } from '$lib/components/app';import { Button } from '$lib/components/ui/button';import * as Dialog from '$lib/components/ui/dialog';- import { DEFAULT_RESOURCE_FILENAME } from '$lib/constants';- import { MimeTypeIncludes, MimeTypeText } from '$lib/enums';+ import { DEFAULT_RESOURCE_FILENAME, MIME_TYPE_SUBSTRINGS } from '$lib/constants';+ import { MimeTypeText } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';import type { DatabaseMessageExtraMcpResource } from '$lib/types';import {@@ -26,11 +26,13 @@const favicon = $derived(mcpStore.getServerFavicon(extra.serverName));function getLanguage(): string {- if (extra.mimeType?.includes(MimeTypeIncludes.JSON)) return MimeTypeIncludes.JSON;+ if (extra.mimeType?.includes(MIME_TYPE_SUBSTRINGS.JSON)) return MIME_TYPE_SUBSTRINGS.JSON;- if (extra.mimeType?.includes(MimeTypeIncludes.JAVASCRIPT)) return MimeTypeIncludes.JAVASCRIPT;+ if (extra.mimeType?.includes(MIME_TYPE_SUBSTRINGS.JAVASCRIPT))+ return MIME_TYPE_SUBSTRINGS.JAVASCRIPT;- if (extra.mimeType?.includes(MimeTypeIncludes.TYPESCRIPT)) return MimeTypeIncludes.TYPESCRIPT;+ if (extra.mimeType?.includes(MIME_TYPE_SUBSTRINGS.TYPESCRIPT))+ return MIME_TYPE_SUBSTRINGS.TYPESCRIPT;const name = extra.name || extra.uri || '';diff --git a/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcesBrowser.svelte b/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcesBrowser.svelteindex c208250cdd..7e1b397fc8 100644--- a/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcesBrowser.svelte+++ b/tools/ui/src/lib/components/app/dialogs/DialogMcpResourcesBrowser.svelte@@ -7,7 +7,7 @@} from '$lib/components/app';import { Button } from '$lib/components/ui/button';import * as Dialog from '$lib/components/ui/dialog';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { conversationsStore } from '$lib/stores/conversations.svelte';import { mcpStore } from '$lib/stores/mcp.svelte';import {diff --git a/tools/ui/src/lib/components/app/dialogs/DialogMcpServerAddNew.svelte b/tools/ui/src/lib/components/app/dialogs/DialogMcpServerAddNew.svelteindex 09780173a5..03d55cd0f5 100644--- a/tools/ui/src/lib/components/app/dialogs/DialogMcpServerAddNew.svelte+++ b/tools/ui/src/lib/components/app/dialogs/DialogMcpServerAddNew.svelte@@ -4,13 +4,12 @@import { Button } from '$lib/components/ui/button';import * as Dialog from '$lib/components/ui/dialog';import {- BEARER_PREFIX,BOOL_FALSE_STRING,BOOL_TRUE_STRING,DISMISSED_RECOMMENDED_MCP_SERVERS_LOCALSTORAGE_KEY,+ HEADERS,MCP_SERVER_ID_PREFIX,- RECOMMENDED_MCP_SERVERS,- REDACTED_HEADERS+ RECOMMENDED_MCP_SERVERS} from '$lib/constants';import { HealthCheckStatus } from '$lib/enums';import { conversationsStore } from '$lib/stores/conversations.svelte';@@ -61,10 +60,10 @@let bearerTokenFilled = $derived.by(() => {const pairs = parseHeadersToArray(newServerHeaders);- const bearerPrefix = BEARER_PREFIX.toLowerCase();+ const bearerPrefix = HEADERS.BEARER.toLowerCase();const bearer = pairs.find((p) =>- REDACTED_HEADERS.has(p.key.trim().toLowerCase()) &&+ HEADERS.REDACTED.has(p.key.trim().toLowerCase()) &&p.value.trim().toLowerCase().startsWith(bearerPrefix));diff --git a/tools/ui/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte b/tools/ui/src/lib/components/app/dialogs/DialogModelNotAvailable.svelteindex e77923bb34..1f0ac2fca4 100644--- a/tools/ui/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte+++ b/tools/ui/src/lib/components/app/dialogs/DialogModelNotAvailable.svelte@@ -3,8 +3,7 @@import { goto } from '$app/navigation';import { page } from '$app/state';import * as AlertDialog from '$lib/components/ui/alert-dialog';- import { URL_PARAMS } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT, URL_PARAMS } from '$lib/constants';interface Props {open: boolean;diff --git a/tools/ui/src/lib/components/app/forms/SearchInput.svelte b/tools/ui/src/lib/components/app/forms/SearchInput.svelteindex 488249b884..1ed68a075f 100644--- a/tools/ui/src/lib/components/app/forms/SearchInput.svelte+++ b/tools/ui/src/lib/components/app/forms/SearchInput.svelte@@ -1,7 +1,7 @@<script lang="ts">import { Search, X } from '@lucide/svelte';import { Input } from '$lib/components/ui/input';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';interface Props {autofocus?: boolean;diff --git a/tools/ui/src/lib/components/app/mcp/McpActiveServersAvatars.svelte b/tools/ui/src/lib/components/app/mcp/McpActiveServersAvatars.svelteindex b3f61c2a9b..63210ad723 100644--- a/tools/ui/src/lib/components/app/mcp/McpActiveServersAvatars.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpActiveServersAvatars.svelte@@ -1,8 +1,7 @@<script lang="ts">import McpLogo from './McpLogo.svelte';import * as Tooltip from '$lib/components/ui/tooltip';- import { MAX_DISPLAYED_MCP_AVATARS } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT, MAX_DISPLAYED_MCP_AVATARS } from '$lib/constants';import { HealthCheckStatus } from '$lib/enums';import { conversationsStore } from '$lib/stores/conversations.svelte';import { mcpStore } from '$lib/stores/mcp.svelte';diff --git a/tools/ui/src/lib/components/app/mcp/McpResourcePreview.svelte b/tools/ui/src/lib/components/app/mcp/McpResourcePreview.svelteindex eb533d4aeb..fb57dbfac9 100644--- a/tools/ui/src/lib/components/app/mcp/McpResourcePreview.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpResourcePreview.svelte@@ -2,7 +2,7 @@import { AlertCircle, Download, FileText, Loader2 } from '@lucide/svelte';import { ActionIconCopyToClipboard } from '$lib/components/app';import { Button } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { MimeTypeApplication, MimeTypeText } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';import type { MCPResourceContent, MCPResourceInfo } from '$lib/types';diff --git a/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserHeader.svelte b/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserHeader.svelteindex f10566ee69..fd7af18748 100644--- a/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserHeader.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserHeader.svelte@@ -2,7 +2,7 @@import { Loader2, RefreshCw } from '@lucide/svelte';import { SearchInput } from '$lib/components/app/forms';import { Button } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';interface Props {isLoading: boolean;diff --git a/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserServerItem.svelte b/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserServerItem.svelteindex 0c35559eea..7b349043b8 100644--- a/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserServerItem.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpResourcesBrowser/McpResourcesBrowserServerItem.svelte@@ -9,7 +9,7 @@import { McpServerIdentity } from '$lib/components/app/mcp';import { Checkbox } from '$lib/components/ui/checkbox';import * as Collapsible from '$lib/components/ui/collapsible';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { mcpStore } from '$lib/stores/mcp.svelte';import type { MCPResourceInfo, MCPResourceTemplateInfo, MCPServerResources } from '$lib/types';import { getDisplayName, getResourceIcon } from '$lib/utils';diff --git a/tools/ui/src/lib/components/app/mcp/McpServerCard/McpServerCard.svelte b/tools/ui/src/lib/components/app/mcp/McpServerCard/McpServerCard.svelteindex 3dc1bc7d0c..6072e38660 100644--- a/tools/ui/src/lib/components/app/mcp/McpServerCard/McpServerCard.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpServerCard/McpServerCard.svelte@@ -10,7 +10,7 @@} from '$lib/components/app/mcp';import * as Card from '$lib/components/ui/card';import { Skeleton } from '$lib/components/ui/skeleton';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { HealthCheckStatus } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';import type { HealthCheckState, MCPServerSettingsEntry } from '$lib/types';diff --git a/tools/ui/src/lib/components/app/mcp/McpServerForm.svelte b/tools/ui/src/lib/components/app/mcp/McpServerForm.svelteindex 528257e01d..5a5b01ffe3 100644--- a/tools/ui/src/lib/components/app/mcp/McpServerForm.svelte+++ b/tools/ui/src/lib/components/app/mcp/McpServerForm.svelte@@ -2,13 +2,7 @@import { KeyValuePairs } from '$lib/components/app';import { Input } from '$lib/components/ui/input';import { Switch } from '$lib/components/ui/switch';- import {- AUTHORIZATION_HEADER,- BEARER_PREFIX,- CLI_FLAGS,- MCP_SERVER_URL_PLACEHOLDER,- REDACTED_HEADERS- } from '$lib/constants';+ import { CLI_FLAGS, HEADERS, MCP_SERVER_URL_PLACEHOLDER } from '$lib/constants';import { UrlProtocol } from '$lib/enums';import { mcpStore } from '$lib/stores/mcp.svelte';import type { KeyValuePair } from '$lib/types';@@ -72,10 +66,10 @@// carry a Bearer scheme. Anything else (e.g. Basic, raw tokens) stays in the// KV section so the user can still edit those values verbatim.const matchesAuthorizationKey = (key: string): boolean =>- REDACTED_HEADERS.has(key.trim().toLowerCase());+ HEADERS.REDACTED.has(key.trim().toLowerCase());const isBearerScheme = (value: string): boolean =>- value.trim().toLowerCase().startsWith(BEARER_PREFIX.toLowerCase());+ value.trim().toLowerCase().startsWith(HEADERS.BEARER.toLowerCase());const ownedByBearerUi = (p: KeyValuePair): boolean =>matchesAuthorizationKey(p.key) && isBearerScheme(p.value);@@ -102,7 +96,7 @@if (!auth) return '';- return auth.value.trim().slice(BEARER_PREFIX.length).trim();+ return auth.value.trim().slice(HEADERS.BEARER.length).trim();});$effect(() => {@@ -125,7 +119,7 @@const trimmed = token.trim();if (trimmed) {- filtered.push({ key: AUTHORIZATION_HEADER, value: `${BEARER_PREFIX}${trimmed}` });+ filtered.push({ key: HEADERS.AUTHORIZATION, value: `${HEADERS.BEARER}${trimmed}` });}updateHeaderPairs(filtered);diff --git a/tools/ui/src/lib/components/app/misc/HorizontalScrollCarousel.svelte b/tools/ui/src/lib/components/app/misc/HorizontalScrollCarousel.svelteindex 68cd1e0450..e2edb4d025 100644--- a/tools/ui/src/lib/components/app/misc/HorizontalScrollCarousel.svelte+++ b/tools/ui/src/lib/components/app/misc/HorizontalScrollCarousel.svelte@@ -1,6 +1,6 @@<script lang="ts">import { ChevronLeft, ChevronRight } from '@lucide/svelte';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import type { Snippet } from 'svelte';interface Props {diff --git a/tools/ui/src/lib/components/app/models/ModelsSelectorOption.svelte b/tools/ui/src/lib/components/app/models/ModelsSelectorOption.svelteindex a7ce0310e2..322c03efa8 100644--- a/tools/ui/src/lib/components/app/models/ModelsSelectorOption.svelte+++ b/tools/ui/src/lib/components/app/models/ModelsSelectorOption.svelte@@ -11,7 +11,7 @@RotateCw} from '@lucide/svelte';import { ActionIcon, ModelId } from '$lib/components/app';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { ServerModelStatus } from '$lib/enums';import { modelsStore, routerModels } from '$lib/stores/models.svelte';import type { ModelOption } from '$lib/types/models';diff --git a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationActions.svelte b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationActions.svelteindex 0aa7e7aef6..dbb0291adc 100644--- a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationActions.svelte+++ b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationActions.svelte@@ -5,12 +5,12 @@import { ActionIcon, KeyboardShortcutInfo, SearchInput } from '$lib/components/app';import { Button } from '$lib/components/ui/button';import {+ ICON_CLASS_DEFAULT,ICON_STRIP_TRANSITION_DELAY_MULTIPLIER,ICON_STRIP_TRANSITION_DURATION,ROUTES,SIDEBAR_ACTIONS_ITEMS} from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';import { TooltipSide } from '$lib/enums';import { isMobile } from '$lib/stores/viewport.svelte';import type { Component } from 'svelte';diff --git a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelteindex 9a9fb8f52e..2f4b297d85 100644--- a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte+++ b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationConversationItem.svelte@@ -15,8 +15,7 @@import { TruncatedText } from '$lib/components/app';import { Checkbox } from '$lib/components/ui/checkbox';import * as Tooltip from '$lib/components/ui/tooltip';- import { FORK_TREE_DEPTH_PADDING } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { FORK_TREE_DEPTH_PADDING, ICON_CLASS_DEFAULT } from '$lib/constants';import { RouterService } from '$lib/services/router.service';import { getAllLoadingChats } from '$lib/stores/chat.svelte';import { conversationsStore } from '$lib/stores/conversations.svelte';diff --git a/tools/ui/src/lib/components/app/server/ServerErrorSplash.svelte b/tools/ui/src/lib/components/app/server/ServerErrorSplash.svelteindex ffbfd9fdb6..28bb2cfe14 100644--- a/tools/ui/src/lib/components/app/server/ServerErrorSplash.svelte+++ b/tools/ui/src/lib/components/app/server/ServerErrorSplash.svelte@@ -5,9 +5,7 @@import { Button } from '$lib/components/ui/button';import { Input } from '$lib/components/ui/input';import Label from '$lib/components/ui/label/label.svelte';- import { AUTHORIZATION_HEADER, BEARER_PREFIX, SETTINGS_KEYS } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';- import { ROUTES } from '$lib/constants/routes';+ import { HEADERS, ICON_CLASS_DEFAULT, ROUTES, SETTINGS_KEYS } from '$lib/constants';import { KeyboardKey } from '$lib/enums';import { serverLoading, serverStore } from '$lib/stores/server.svelte';import { config, settingsStore } from '$lib/stores/settings.svelte';@@ -72,8 +70,8 @@// Test the API key by making a real request to the serverconst response = await fetch(`${base}/props`, {headers: {- [AUTHORIZATION_HEADER]: `${BEARER_PREFIX}${apiKeyInput.trim()}`,- 'Content-Type': 'application/json'+ 'Content-Type': 'application/json',+ [HEADERS.AUTHORIZATION]: `${HEADERS.BEARER}${apiKeyInput.trim()}`}});diff --git a/tools/ui/src/lib/components/app/server/ServerStatus.svelte b/tools/ui/src/lib/components/app/server/ServerStatus.svelteindex fb6327ed7d..acb128d0ba 100644--- a/tools/ui/src/lib/components/app/server/ServerStatus.svelte+++ b/tools/ui/src/lib/components/app/server/ServerStatus.svelte@@ -2,7 +2,7 @@import { AlertTriangle, Server } from '@lucide/svelte';import { Badge } from '$lib/components/ui/badge';import { Button } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { singleModelName } from '$lib/stores/models.svelte';import { serverError, serverLoading, serverProps } from '$lib/stores/server.svelte';diff --git a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatFields.svelte b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatFields.svelteindex 57da065df4..7d1791e18a 100644--- a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatFields.svelte+++ b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatFields.svelte@@ -7,8 +7,7 @@import * as RadioGroup from '$lib/components/ui/radio-group';import * as Select from '$lib/components/ui/select';import { Textarea } from '$lib/components/ui/textarea';- import { SETTING_CONFIG_INFO, SETTINGS_KEYS } from '$lib/constants';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT, SETTING_CONFIG_INFO, SETTINGS_KEYS } from '$lib/constants';import { SettingsFieldType } from '$lib/enums/settings.enums';import { modelsStore, propsCacheVersion, selectedModelName } from '$lib/stores/models.svelte';import { serverStore } from '$lib/stores/server.svelte';diff --git a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatImportExportSection.svelte b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatImportExportSection.svelteindex d483840eb9..798cb704b2 100644--- a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatImportExportSection.svelte+++ b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatImportExportSection.svelte@@ -1,6 +1,6 @@<script lang="ts">import { Button, type ButtonVariant } from '$lib/components/ui/button';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import type { Component } from 'svelte';let {diff --git a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatToolsTab.svelte b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatToolsTab.svelteindex c3bf7bf5c5..c4682f174c 100644--- a/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatToolsTab.svelte+++ b/tools/ui/src/lib/components/app/settings/SettingsChat/SettingsChatToolsTab.svelte@@ -3,12 +3,12 @@import { McpServerIdentity, TruncatedText } from '$lib/components/app';import { Checkbox } from '$lib/components/ui/checkbox';import * as Collapsible from '$lib/components/ui/collapsible';- import { getBuiltinToolUi } from '$lib/constants/built-in-tools';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { ToolSource } from '$lib/enums/tools.enums';import { mcpStore } from '$lib/stores/mcp.svelte';import { permissionsStore } from '$lib/stores/permissions.svelte';import { toolsStore } from '$lib/stores/tools.svelte';+ import { getBuiltinToolUi } from '$lib/utils';import { SvelteSet } from 'svelte/reactivity';let expandedGroups = new SvelteSet<string>();diff --git a/tools/ui/src/lib/components/app/settings/SettingsChatDesktopSidebar.svelte b/tools/ui/src/lib/components/app/settings/SettingsChatDesktopSidebar.svelteindex aa197228a3..da1fe778bd 100644--- a/tools/ui/src/lib/components/app/settings/SettingsChatDesktopSidebar.svelte+++ b/tools/ui/src/lib/components/app/settings/SettingsChatDesktopSidebar.svelte@@ -1,6 +1,6 @@<script lang="ts">import { Settings } from '@lucide/svelte';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import type { SettingsSection, SettingsSectionTitle } from '$lib/types';interface Props {diff --git a/tools/ui/src/lib/components/app/settings/SettingsChatMobileHeader.svelte b/tools/ui/src/lib/components/app/settings/SettingsChatMobileHeader.svelteindex 5572d118f7..7392b04460 100644--- a/tools/ui/src/lib/components/app/settings/SettingsChatMobileHeader.svelte+++ b/tools/ui/src/lib/components/app/settings/SettingsChatMobileHeader.svelte@@ -1,6 +1,6 @@<script lang="ts">import { ChevronLeft, ChevronRight, Settings } from '@lucide/svelte';- import { ICON_CLASS_DEFAULT } from '$lib/constants/css-classes';+ import { ICON_CLASS_DEFAULT } from '$lib/constants';import { useScrollCarousel } from '$lib/hooks/use-scroll-carousel.svelte';import type { SettingsSection, SettingsSectionTitle } from '$lib/types';import { onMount, tick } from 'svelte';diff --git a/tools/ui/src/lib/components/pwa/PwaMetaTags.svelte b/tools/ui/src/lib/components/pwa/PwaMetaTags.svelteindex 8189ad0e72..584f2ee834 100644--- a/tools/ui/src/lib/components/pwa/PwaMetaTags.svelte+++ b/tools/ui/src/lib/components/pwa/PwaMetaTags.svelte@@ -1,6 +1,5 @@<script lang="ts">- import { APP_NAME } from '$lib/constants';- import { APPLE_META_TAGS, MEDIA_QUERIES, THEME_COLORS } from '$lib/constants/pwa';+ import { APP_NAME, APPLE_META_TAGS, MEDIA_QUERIES, THEME_COLORS } from '$lib/constants';let { appName = APP_NAME } = $props();</script>diff --git a/tools/ui/src/lib/constants/agentic.ts b/tools/ui/src/lib/constants/agentic.constants.tssimilarity index 77%rename from tools/ui/src/lib/constants/agentic.tsrename to tools/ui/src/lib/constants/agentic.constants.tsindex 582572a29a..e57104e8a8 100644--- a/tools/ui/src/lib/constants/agentic.ts+++ b/tools/ui/src/lib/constants/agentic.constants.ts@@ -5,22 +5,14 @@ export const ATTACHMENT_SAVED_REGEX = /\[Attachment saved: ([^\]]+)\]/;// JSON detection: trimmed content opens with an object or array literal.export const TOOL_RESULT_JSON_OPEN_REGEX = /^[[{]/;-// Markdown structural markers used by `looksLikeMarkdown`. Inline / line-level.-export const MARKDOWN_CODE_FENCE_REGEX = /^(```|~~~)/m;-export const MARKDOWN_ATX_HEADING_REGEX = /^#{1,6}\s+\S/;-export const MARKDOWN_BLOCKQUOTE_REGEX = /^>\s+\S/;-export const MARKDOWN_LIST_BULLET_REGEX = /^\s*[-*+]\s+\S/;-export const MARKDOWN_LIST_NUMBERED_REGEX = /^\s*\d+[.)]\s+\S/;-export const MARKDOWN_LINK_REGEX = /\[[^\]\n]+\]\([^)\s]+\)/;-export const MARKDOWN_BOLD_REGEX = /\*\*[^*\n]+\*\*|__[^_\n]+__/;-export const MARKDOWN_TABLE_SEPARATOR_REGEX = /^\s*\|?[\s:|-]+\|?\s*$/;-// Search-summary wire format used by file-glob and grep tools:// <matches>// ---// Total matches: N-export const SEARCH_SUMMARY_SEPARATOR = '---\n';-export const SEARCH_SUMMARY_TOTAL_REGEX = /Total matches:\s*(\d+)/;+export const SEARCH_SUMMARY = {+ SEPARATOR: '---\n',+ TOTAL_REGEX: /Total matches:\s*(\d+)/+} as const;// Separator rendered between stats in the tool-result footer (e.g. between a// result message and the byte/edit count). Plain ASCII spaces bracket a hyphendiff --git a/tools/ui/src/lib/constants/api-endpoints.ts b/tools/ui/src/lib/constants/api-endpoints.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/api-endpoints.tsrename to tools/ui/src/lib/constants/api-endpoints.constants.tsdiff --git a/tools/ui/src/lib/constants/app.ts b/tools/ui/src/lib/constants/app.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/app.tsrename to tools/ui/src/lib/constants/app.constants.tsdiff --git a/tools/ui/src/lib/constants/attachment-labels.ts b/tools/ui/src/lib/constants/attachment-labels.tsdeleted file mode 100644index be9999c0f9..0000000000--- a/tools/ui/src/lib/constants/attachment-labels.ts+++ /dev/null@@ -1,4 +0,0 @@-export const ATTACHMENT_LABEL_FILE = 'File';-export const ATTACHMENT_LABEL_PDF_FILE = 'PDF File';-export const ATTACHMENT_LABEL_MCP_PROMPT = 'MCP Prompt';-export const ATTACHMENT_LABEL_MCP_RESOURCE = 'MCP Resource';diff --git a/tools/ui/src/lib/constants/attachment-menu.ts b/tools/ui/src/lib/constants/attachment-menu.constants.tssimilarity index 75%rename from tools/ui/src/lib/constants/attachment-menu.tsrename to tools/ui/src/lib/constants/attachment-menu.constants.tsindex 1cd7f9ba5a..62e03bea6e 100644--- a/tools/ui/src/lib/constants/attachment-menu.ts+++ b/tools/ui/src/lib/constants/attachment-menu.constants.ts@@ -1,33 +1,12 @@import { FolderOpen, MessageSquare, Zap } from '@lucide/svelte';-import { FILE_TYPE_ICONS } from '$lib/constants/icons';+import { FILE_TYPE_ICONS } from '$lib/constants';import {AttachmentAction,AttachmentItemEnabledWhen,AttachmentItemVisibleWhen,AttachmentMenuItemId} from '$lib/enums';-import type { Component } from 'svelte';--export interface AttachmentMenuItem {- /** Unique identifier for the item */- id: AttachmentMenuItemId;- /** Display label */- label: string;- /** Lucide icon component */- icon: Component;- /** Extra CSS class applied to the item (e.g. for test selectors) */- class?: string;- /** Whether the item requires a specific modality to be enabled */- enabledWhen?: AttachmentItemEnabledWhen;- /** Tooltip shown when the item is disabled */- disabledTooltip?: string;- /** Callback key on the Props interface to invoke when clicked */- action: AttachmentAction;- /** Whether the item is only shown when a specific capability is present */- visibleWhen?: AttachmentItemVisibleWhen;- /** Whether this item has a tooltip even when enabled (uses dynamic text) */- hasEnabledTooltip?: boolean;-}+import type { AttachmentMenuItem } from '$lib/types';/*** File attachment menu items shown in both the desktop dropdown and mobile sheet.diff --git a/tools/ui/src/lib/constants/auto-scroll.ts b/tools/ui/src/lib/constants/auto-scroll.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/auto-scroll.tsrename to tools/ui/src/lib/constants/auto-scroll.constants.tsdiff --git a/tools/ui/src/lib/constants/binary-detection.ts b/tools/ui/src/lib/constants/binary-detection.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/binary-detection.tsrename to tools/ui/src/lib/constants/binary-detection.constants.tsdiff --git a/tools/ui/src/lib/constants/built-in-tools.ts b/tools/ui/src/lib/constants/built-in-tools.constants.tssimilarity index 82%rename from tools/ui/src/lib/constants/built-in-tools.tsrename to tools/ui/src/lib/constants/built-in-tools.constants.tsindex 5bd24ffe83..679c614592 100644--- a/tools/ui/src/lib/constants/built-in-tools.ts+++ b/tools/ui/src/lib/constants/built-in-tools.constants.ts@@ -20,13 +20,7 @@ import {Terminal} from '@lucide/svelte';import { BuiltInTool, ToolSource } from '$lib/enums';-import type { Component } from 'svelte';--export interface BuiltinToolUiEntry {- icon: Component;- label: string;- source: ToolSource.BUILTIN | ToolSource.FRONTEND;-}+import type { BuiltinToolUiEntry } from '$lib/types';export const BUILTIN_TOOL_UI: Readonly<Record<BuiltInTool, BuiltinToolUiEntry>> = {[BuiltInTool.EDIT_FILE]: { icon: FilePen, label: 'Edit file', source: ToolSource.BUILTIN },@@ -56,9 +50,3 @@ export const BUILTIN_TOOL_UI: Readonly<Record<BuiltInTool, BuiltinToolUiEntry>>},[BuiltInTool.WRITE_FILE]: { icon: FilePlus, label: 'Write file', source: ToolSource.BUILTIN }} as const;--export function getBuiltinToolUi(toolName: string | undefined): BuiltinToolUiEntry | null {- if (!toolName) return null;-- return (BUILTIN_TOOL_UI as Record<string, BuiltinToolUiEntry>)[toolName] ?? null;-}diff --git a/tools/ui/src/lib/constants/cache.constants.ts b/tools/ui/src/lib/constants/cache.constants.tsnew file mode 100644index 0000000000..b60792d995--- /dev/null+++ b/tools/ui/src/lib/constants/cache.constants.ts@@ -0,0 +1,44 @@+/**+ * Cache configuration constants+ */++/**+ * Default cache limits when no per-cache overrides are given.+ */+export const CACHE = {+ /** Default maximum number of entries in a cache */+ DEFAULT_MAX_ENTRIES: 100,+ /** Default TTL (Time-To-Live) for cache entries in milliseconds (5 minutes) */+ DEFAULT_TTL_MS: 5 * 60 * 1000+} as const;++/**+ * TTL and size for the model props cache.+ * Props don't change frequently, so we can cache them longer.+ */+export const MODEL_PROPS_CACHE = {+ /** Maximum number of model props to cache */+ MAX_ENTRIES: 50,+ /** TTL for model props cache entries in milliseconds (10 minutes) */+ TTL_MS: 10 * 60 * 1000+} as const;++/**+ * TTL and size for the MCP resource cache.+ */+export const MCP_RESOURCE_CACHE = {+ /** Maximum number of MCP resources to cache */+ MAX_ENTRIES: 50,+ /** TTL for MCP resource cache entries in milliseconds (5 minutes) */+ TTL_MS: 5 * 60 * 1000+} as const;++/**+ * Limits for pruning inactive conversation states held in memory.+ */+export const INACTIVE_CONVERSATION = {+ /** Maximum age (in ms) for inactive conversation states before cleanup (30 minutes) */+ MAX_AGE_MS: 30 * 60 * 1000,+ /** Maximum number of inactive conversation states to keep in memory */+ MAX_STATES: 10+} as const;diff --git a/tools/ui/src/lib/constants/cache.ts b/tools/ui/src/lib/constants/cache.tsdeleted file mode 100644index 07fe868341..0000000000--- a/tools/ui/src/lib/constants/cache.ts+++ /dev/null@@ -1,54 +0,0 @@-/**- * Cache configuration constants- */--/**- * Default TTL (Time-To-Live) for cache entries in milliseconds- * @default 5 minutes- */-export const DEFAULT_CACHE_TTL_MS = 5 * 60 * 1000;--/**- * Default maximum number of entries in a cache- * @default 100- */-export const DEFAULT_CACHE_MAX_ENTRIES = 100;--/**- * TTL for model props cache in milliseconds- * Props don't change frequently, so we can cache them longer- * @default 10 minutes- */-export const MODEL_PROPS_CACHE_TTL_MS = 10 * 60 * 1000;--/**- * Maximum number of model props to cache- * @default 50- */-export const MODEL_PROPS_CACHE_MAX_ENTRIES = 50;--/**- * Maximum number of MCP resources to cache- * @default 50- */-export const MCP_RESOURCE_CACHE_MAX_ENTRIES = 50;--/**- * TTL for MCP resource cache entries in milliseconds- * @default 5 minutes- */-export const MCP_RESOURCE_CACHE_TTL_MS = 5 * 60 * 1000;--/**- * Maximum number of inactive conversation states to keep in memory- * States for conversations beyond this limit will be cleaned up- * @default 10- */-export const MAX_INACTIVE_CONVERSATION_STATES = 10;--/**- * Maximum age (in ms) for inactive conversation states before cleanup- * States older than this will be removed during cleanup- * @default 30 minutes- */-export const INACTIVE_CONVERSATION_STATE_MAX_AGE_MS = 30 * 60 * 1000;diff --git a/tools/ui/src/lib/constants/chat-form.ts b/tools/ui/src/lib/constants/chat-form.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/chat-form.tsrename to tools/ui/src/lib/constants/chat-form.constants.tsdiff --git a/tools/ui/src/lib/constants/cli-flags.ts b/tools/ui/src/lib/constants/cli-flags.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/cli-flags.tsrename to tools/ui/src/lib/constants/cli-flags.constants.tsdiff --git a/tools/ui/src/lib/constants/code-block.constants.ts b/tools/ui/src/lib/constants/code-block.constants.tsnew file mode 100644index 0000000000..05db575f9e--- /dev/null+++ b/tools/ui/src/lib/constants/code-block.constants.ts@@ -0,0 +1,50 @@+// Constants for the markdown code-block renderer: language/fence handling and CSS classes.++/** Parsing and escaping helpers for the markdown code-block renderer. */+export const CODE_BLOCK = {+ AMPERSAND_REGEX: /&/g,+ /** Language fallback used when no language is specified. */+ DEFAULT_LANGUAGE: 'text',+ /** Matches opening/closing markdown code fences. */+ FENCE_PATTERN: /^```|\n```/g,+ GT_REGEX: />/g,+ /** Matches the language specifier at the start of a code fence. */+ LANG_PATTERN: /^(\w*)\n?/,+ LT_REGEX: /</g,++ // Matches the `text:` prefix that file-type identifiers use to denote a+ // plain-text language (e.g. `text:typescript`). Used by tool-call renderers+ // to recover the underlying highlight.js language.+ TEXT_LANGUAGE_PREFIX_REGEX: /^text:/,+ // Whitespace-only empty lines (between start of string and first non-empty line).+ // Used by trimCodePadding to drop leading/trailing phantom blank rows from LLM+ // payload wrappers without touching internal blank lines.+ TRIM_LEADING_PADDING_REGEX: /^(?:[ \t]*\n)+/,++ TRIM_TRAILING_PADDING_REGEX: /(?:\n[ \t]*)+$/+} as const;++// Matches either Unix or Windows path separators so `String.split(REGEX)` can+// recover the trailing file-name segment from either `/foo/bar.txt` or+// `C:\foo\bar.txt`. Used wherever a parameter accepts a user-supplied path.+export const FILE_PATH_SEPARATOR_REGEX = /[\\/]/;++// Separates a file name from its extension, e.g. the '.' in `cover.png`.+export const FILE_EXTENSION_SEPARATOR = '.';++// Matches the `text:` prefix that file-type identifiers use to denote a+// plain-text language (e.g. `text:typescript`). Used by tool-call renderers+// to recover the underlying highlight.js language.+export const TEXT_LANGUAGE_PREFIX_REGEX = /^text:/;++/** CSS classes applied by the markdown code-block renderer. */+export const CODE_BLOCK_CLASS = {+ ACTIONS: 'code-block-actions',+ COPY_BTN: 'copy-code-btn',+ HEADER: 'code-block-header',+ LANGUAGE: 'code-language',+ PREVIEW_BTN: 'preview-code-btn',+ RELATIVE: 'relative',+ SCROLL_CONTAINER: 'code-block-scroll-container',+ WRAPPER: 'code-block-wrapper'+} as const;diff --git a/tools/ui/src/lib/constants/code-blocks.ts b/tools/ui/src/lib/constants/code-blocks.tsdeleted file mode 100644index 0f7265104d..0000000000--- a/tools/ui/src/lib/constants/code-blocks.ts+++ /dev/null@@ -1,8 +0,0 @@-export const CODE_BLOCK_SCROLL_CONTAINER_CLASS = 'code-block-scroll-container';-export const CODE_BLOCK_WRAPPER_CLASS = 'code-block-wrapper';-export const CODE_BLOCK_HEADER_CLASS = 'code-block-header';-export const CODE_BLOCK_ACTIONS_CLASS = 'code-block-actions';-export const CODE_LANGUAGE_CLASS = 'code-language';-export const COPY_CODE_BTN_CLASS = 'copy-code-btn';-export const PREVIEW_CODE_BTN_CLASS = 'preview-code-btn';-export const RELATIVE_CLASS = 'relative';diff --git a/tools/ui/src/lib/constants/code.ts b/tools/ui/src/lib/constants/code.tsdeleted file mode 100644index 4b41142001..0000000000--- a/tools/ui/src/lib/constants/code.ts+++ /dev/null@@ -1,27 +0,0 @@-export const NEWLINE = '\n';-export const TAB = '\t';-export const DEFAULT_LANGUAGE = 'text';-export const LANG_PATTERN = /^(\w*)\n?/;-export const AMPERSAND_REGEX = /&/g;-export const LT_REGEX = /</g;-export const GT_REGEX = />/g;-export const FENCE_PATTERN = /^```|\n```/g;--// Whitespace-only empty lines (between start of string and first non-empty line).-// Used by trimCodePadding to drop leading/trailing phantom blank rows from LLM-// payload wrappers without touching internal blank lines.-export const TRIM_LEADING_PADDING_REGEX = /^(?:[ \t]*\n)+/;-export const TRIM_TRAILING_PADDING_REGEX = /(?:\n[ \t]*)+$/;--// Matches either Unix or Windows path separators so `String.split(REGEX)` can-// recover the trailing file-name segment from either `/foo/bar.txt` or-// `C:\foo\bar.txt`. Used wherever a parameter accepts a user-supplied path.-export const FILE_PATH_SEPARATOR_REGEX = /[\\/]/;--// Separates a file name from its extension, e.g. the '.' in `cover.png`.-export const FILE_EXTENSION_SEPARATOR = '.';--// Matches the `text:` prefix that file-type identifiers use to denote a-// plain-text language (e.g. `text:typescript`). Used by tool-call renderers-// to recover the underlying highlight.js language.-export const TEXT_LANGUAGE_PREFIX_REGEX = /^text:/;diff --git a/tools/ui/src/lib/constants/content-detection.constants.ts b/tools/ui/src/lib/constants/content-detection.constants.tsnew file mode 100644index 0000000000..c5c05819a5--- /dev/null+++ b/tools/ui/src/lib/constants/content-detection.constants.ts@@ -0,0 +1,20 @@+/**+ * String patterns for detecting content kind from MIME types and URIs.+ * Used with startsWith/includes checks, not as discriminated values.+ */++export const MIME_TYPE_PREFIXES = {+ IMAGE: 'image/',+ TEXT: 'text'+} as const;++export const MIME_TYPE_SUBSTRINGS = {+ JAVASCRIPT: 'javascript',+ JSON: 'json',+ TYPESCRIPT: 'typescript'+} as const;++export const URI_PATTERNS = {+ DATABASE_KEYWORD: 'database',+ DATABASE_SCHEME: 'db://'+} as const;diff --git a/tools/ui/src/lib/constants/context-gauge-popup.ts b/tools/ui/src/lib/constants/context-gauge-popup.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/context-gauge-popup.tsrename to tools/ui/src/lib/constants/context-gauge-popup.constants.tsdiff --git a/tools/ui/src/lib/constants/context-keys.ts b/tools/ui/src/lib/constants/context-keys.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/context-keys.tsrename to tools/ui/src/lib/constants/context-keys.constants.tsdiff --git a/tools/ui/src/lib/constants/control-actions.ts b/tools/ui/src/lib/constants/control-actions.constants.tssimilarity index 73%rename from tools/ui/src/lib/constants/control-actions.tsrename to tools/ui/src/lib/constants/control-actions.constants.tsindex 935ae9542a..c8ebf701b1 100644--- a/tools/ui/src/lib/constants/control-actions.ts+++ b/tools/ui/src/lib/constants/control-actions.constants.ts@@ -3,5 +3,3 @@export const CONTROL_ACTION = {END_REASONING: 'reasoning_end'} as const;--export type ControlAction = (typeof CONTROL_ACTION)[keyof typeof CONTROL_ACTION];diff --git a/tools/ui/src/lib/constants/conversation-import.ts b/tools/ui/src/lib/constants/conversation-import.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/conversation-import.tsrename to tools/ui/src/lib/constants/conversation-import.constants.tsdiff --git a/tools/ui/src/lib/constants/css-classes.ts b/tools/ui/src/lib/constants/css-classes.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/css-classes.tsrename to tools/ui/src/lib/constants/css-classes.constants.tsdiff --git a/tools/ui/src/lib/constants/database.ts b/tools/ui/src/lib/constants/database.constants.tssimilarity index 93%rename from tools/ui/src/lib/constants/database.tsrename to tools/ui/src/lib/constants/database.constants.tsindex 95e698f400..f2c9610393 100644--- a/tools/ui/src/lib/constants/database.ts+++ b/tools/ui/src/lib/constants/database.constants.ts@@ -5,7 +5,7 @@* naming changes.*/-import { STORAGE_APP_NAME } from './storage';+import { STORAGE_APP_NAME } from './storage.constants';/** IndexedDB database name */export const DB_NAME = STORAGE_APP_NAME;diff --git a/tools/ui/src/lib/constants/diagram-blocks.ts b/tools/ui/src/lib/constants/diagram-blocks.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/diagram-blocks.tsrename to tools/ui/src/lib/constants/diagram-blocks.constants.tsdiff --git a/tools/ui/src/lib/constants/error.ts b/tools/ui/src/lib/constants/error.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/error.tsrename to tools/ui/src/lib/constants/error.constants.tsdiff --git a/tools/ui/src/lib/constants/floating-ui-constraints.ts b/tools/ui/src/lib/constants/floating-ui-constraints.tsdeleted file mode 100644index 003fc77acb..0000000000--- a/tools/ui/src/lib/constants/floating-ui-constraints.ts+++ /dev/null@@ -1,2 +0,0 @@-export const VIEWPORT_GUTTER = 8;-export const MENU_OFFSET = 6;diff --git a/tools/ui/src/lib/constants/formatters.ts b/tools/ui/src/lib/constants/formatters.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/formatters.tsrename to tools/ui/src/lib/constants/formatters.constants.tsdiff --git a/tools/ui/src/lib/constants/headers.constants.ts b/tools/ui/src/lib/constants/headers.constants.tsnew file mode 100644index 0000000000..f40df05710--- /dev/null+++ b/tools/ui/src/lib/constants/headers.constants.ts@@ -0,0 +1,35 @@+/** HTTP header handling for API and MCP requests. */+export const HEADERS = {+ /** Canonical casing for the Authorization header (RFC 7235) */+ AUTHORIZATION: 'Authorization',+ /** Bearer scheme prefix used for Authorization headers (RFC 6750) */+ BEARER: 'Bearer ',+ /** Content-Type HTTP header name */+ CONTENT_TYPE: 'Content-Type',+ /** Partial-redaction rules for MCP headers: header name -> visible trailing chars */+ PARTIAL_REDACT: new Map<string, number>([['mcp-session-id', 5]]),++ /** Header names whose values should be redacted in diagnostic logs */+ REDACTED: new Set([+ 'authorization',+ 'api-key',+ 'cookie',+ 'mcp-session-id',+ 'proxy-authorization',+ 'set-cookie',+ 'x-auth-token',+ 'x-api-key'+ ]),++ /** Header carrying the stream-session identity (conversation id, optionally with a model suffix) */+ X_CONVERSATION_ID_HEADER: 'X-Conversation-Id',++ /** Header asking the server to encode a tool's output differently, e.g. read_file returning base64. */+ X_RESP_TYPE_HEADER: 'x-resp-type',++ /** Header carrying the working directory a tool call runs in; the model cannot override it */+ X_TOOL_CWD_HEADER: 'x-tool-cwd'+};++/** `X_RESP_TYPE_HEADER` value that makes read_file return raw bytes as base64 instead of text. */+export const RESP_TYPE_BASE64 = 'base64';diff --git a/tools/ui/src/lib/constants/icons.ts b/tools/ui/src/lib/constants/icons.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/icons.tsrename to tools/ui/src/lib/constants/icons.constants.tsdiff --git a/tools/ui/src/lib/constants/image-size.ts b/tools/ui/src/lib/constants/image-size.tsdeleted file mode 100644index 8a7f921fa0..0000000000--- a/tools/ui/src/lib/constants/image-size.ts+++ /dev/null@@ -1,3 +0,0 @@-export const MEGAPIXELS_TO_PIXELS = 1_000_000;--export const HEIC_JPEG_QUALITY = 0.85;diff --git a/tools/ui/src/lib/constants/image.constants.ts b/tools/ui/src/lib/constants/image.constants.tsnew file mode 100644index 0000000000..53a90eaa4e--- /dev/null+++ b/tools/ui/src/lib/constants/image.constants.ts@@ -0,0 +1,32 @@+/** Image handling constants */++export const IMAGE = {+ /** JPEG quality used when transcoding HEIC images. */+ HEIC_JPEG_QUALITY: 0.85,+ /** Unit conversion: pixels per megapixel. */+ MEGAPIXELS_TO_PIXELS: 1_000_000+} as const;++/**+ * JPEG and EXIF binary format constants for orientation parsing.+ */+export const EXIF = {+ /** APP1 segment marker byte, carries the EXIF payload */+ APP1_MARKER: 0xe1,+ /** "Exif" signature opening the APP1 payload, big endian uint32 */+ EXIF_SIGNATURE: 0x45786966,+ /** Size in bytes of one IFD directory entry */+ IFD_ENTRY_SIZE: 12,+ /** JPEG start of image marker */+ JPEG_SOI_MARKER: 0xffd8,+ /** EXIF tag id holding the orientation value */+ ORIENTATION_TAG: 0x0112,+ /** Bytes of file prefix to scan, the APP1 EXIF segment sits near the start */+ SCAN_BYTE_LIMIT: 128 * 1024,+ /** Start of scan marker byte, compressed data begins and no EXIF follows */+ SOS_MARKER: 0xda,+ /** TIFF byte order mark for little endian ("II") */+ TIFF_LITTLE_ENDIAN: 0x4949,+ /** TIFF magic number following the byte order mark */+ TIFF_MAGIC: 42+} as const;diff --git a/tools/ui/src/lib/constants/index.ts b/tools/ui/src/lib/constants/index.tsindex 357a33a624..17e5f4d00a 100644--- a/tools/ui/src/lib/constants/index.ts+++ b/tools/ui/src/lib/constants/index.ts@@ -1,67 +1,61 @@// Central constants export file// All constants should be imported from '$lib/constants'-export * from './agentic';-export * from './api-endpoints';-export * from './app';-export * from './attachment-labels';-export * from './database';-export * from './reasoning-effort';-export * from './reasoning-effort-tokens';-export * from './recommended-mcp-servers';-export * from './storage';-export * from './attachment-menu';-export * from './auto-scroll';-export * from './context-gauge-popup';-export * from './conversation-import';-export * from './binary-detection';-export * from './built-in-tools';-export * from './cache';-export * from './chat-form';-export * from './chat-commands';-export * from './cli-flags';-export * from './code-blocks';-export * from './icons';-export * from './code';-export * from './context-keys';-export * from './control-actions';-export * from './css-classes';-export * from './floating-ui-constraints';-export * from './formatters';-export * from './key-value-pairs';-export * from './icons';-export * from './latex-protection';-export * from './literal-html';-export * from './markdown';-export * from './mermaid-blocks';-export * from './svg-blocks';-export * from './diagram-blocks';-export * from './max-bundle-size';-export * from './mcp';-export * from './mcp-form';-export * from './mcp-resource';-export * from './mention-badge';-export * from './message-export';-export * from './path-display';-export * from './model-id';-export * from './model-loading';-export * from './sse';-export * from './precision';-export * from './processing-info';-export * from './pwa';+export * from './agentic.constants';+export * from './api-endpoints.constants';+export * from './app.constants';+export * from './database.constants';+export * from './reasoning-effort.constants';+export * from './recommended-mcp-servers.constants';+export * from './storage.constants';+export * from './icons.constants';+export * from './attachment-menu.constants';+export * from './auto-scroll.constants';+export * from './context-gauge-popup.constants';+export * from './conversation-import.constants';+export * from './binary-detection.constants';+export * from './content-detection.constants';+export * from './built-in-tools.constants';+export * from './cache.constants';+export * from './chat-form.constants';+export * from './cli-flags.constants';+export * from './code-block.constants';+export * from './context-keys.constants';+export * from './control-actions.constants';+export * from './css-classes.constants';+export * from './formatters.constants';+export * from './headers.constants';+export * from './key-value-pairs.constants';+export * from './latex-protection.constants';+export * from './literal-html.constants';+export * from './markdown.constants';+export * from './mermaid-blocks.constants';+export * from './svg-blocks.constants';+export * from './diagram-blocks.constants';+export * from './max-bundle-size.constants';+export * from './error.constants';+export * from './image.constants';+export * from './mcp.constants';+export * from './mcp-form.constants';+export * from './mcp-resource.constants';+export * from './mention-badge.constants';+export * from './message-export.constants';+export * from './path-display.constants';+export * from './model-id.constants';+export * from './model-loading.constants';+export * from './precision.constants';+export * from './pwa.constants';+export * from './routes.constants';+export * from './sandbox.constants';+export * from './settings-keys.constants';+export * from './settings-registry.constants';+export * from './special-characters.constants';+export * from './stream.constants';+export * from './supported-file-types.constants';+export * from './table-html-restorer.constants';+export * from './title-generation.constants';+export * from './ui.constants';+export * from './uri-template.constants';+export * from './url.constants';+export * from './working-directory.constants';export * from './read-media';-export * from './routes';-export * from './sandbox';-export * from './settings-keys';-export * from './settings-registry';-export * from './stream';-export * from './supported-file-types';-export * from './table-html-restorer';-export * from './title-generation';-export * from './tools';-export * from './tooltip-config';-export * from './ui';-export * from './uri-template';-export * from './url';-export * from './viewport';-export * from './working-directory';diff --git a/tools/ui/src/lib/constants/jpeg-exif.ts b/tools/ui/src/lib/constants/jpeg-exif.tsdeleted file mode 100644index 5b2591b04b..0000000000--- a/tools/ui/src/lib/constants/jpeg-exif.ts+++ /dev/null@@ -1,30 +0,0 @@-/**- * JPEG and EXIF binary format constants for orientation parsing.- */--/** Bytes of file prefix to scan, the APP1 EXIF segment sits near the start */-export const EXIF_SCAN_BYTE_LIMIT = 128 * 1024;--/** JPEG start of image marker */-export const JPEG_SOI_MARKER = 0xffd8;--/** APP1 segment marker byte, carries the EXIF payload */-export const APP1_MARKER = 0xe1;--/** Start of scan marker byte, compressed data begins and no EXIF follows */-export const SOS_MARKER = 0xda;--/** "Exif" signature opening the APP1 payload, big endian uint32 */-export const EXIF_SIGNATURE = 0x45786966;--/** TIFF byte order mark for little endian ("II") */-export const TIFF_LITTLE_ENDIAN = 0x4949;--/** TIFF magic number following the byte order mark */-export const TIFF_MAGIC = 42;--/** EXIF tag id holding the orientation value */-export const EXIF_ORIENTATION_TAG = 0x0112;--/** Size in bytes of one IFD directory entry */-export const IFD_ENTRY_SIZE = 12;diff --git a/tools/ui/src/lib/constants/key-value-pairs.ts b/tools/ui/src/lib/constants/key-value-pairs.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/key-value-pairs.tsrename to tools/ui/src/lib/constants/key-value-pairs.constants.tsdiff --git a/tools/ui/src/lib/constants/latex-protection.ts b/tools/ui/src/lib/constants/latex-protection.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/latex-protection.tsrename to tools/ui/src/lib/constants/latex-protection.constants.tsdiff --git a/tools/ui/src/lib/constants/literal-html.ts b/tools/ui/src/lib/constants/literal-html.constants.tssimilarity index 56%rename from tools/ui/src/lib/constants/literal-html.tsrename to tools/ui/src/lib/constants/literal-html.constants.tsindex ed1b0cf0d9..8efa6b5747 100644--- a/tools/ui/src/lib/constants/literal-html.ts+++ b/tools/ui/src/lib/constants/literal-html.constants.ts@@ -1,5 +1,3 @@-export const LINE_BREAK = /\r?\n/;-export const PHRASE_PARENTS = new Set(['paragraph','heading',@@ -10,6 +8,3 @@ export const PHRASE_PARENTS = new Set(['linkReference','tableCell']);--export const NBSP = '\u00a0';-export const TAB_AS_SPACES = NBSP.repeat(4);diff --git a/tools/ui/src/lib/constants/markdown.constants.ts b/tools/ui/src/lib/constants/markdown.constants.tsnew file mode 100644index 0000000000..c8289c39a1--- /dev/null+++ b/tools/ui/src/lib/constants/markdown.constants.ts@@ -0,0 +1,17 @@+export const IMAGE_NOT_ERROR_BOUND_SELECTOR = 'img:not([data-error-bound])';+export const DATA_ERROR_BOUND_ATTR = 'errorBound';+export const DATA_ERROR_HANDLED_ATTR = 'errorHandled';+export const BOOL_TRUE_STRING = 'true';+export const BOOL_FALSE_STRING = 'false';++/** Markdown structural markers used by `looksLikeMarkdown`. Inline / line-level. */+export const MARKDOWN = {+ ATX_HEADING_REGEX: /^#{1,6}\s+\S/,+ BLOCKQUOTE_REGEX: /^>\s+\S/,+ BOLD_REGEX: /\*\*[^*\n]+\*\*|__[^_\n]+__/,+ CODE_FENCE_REGEX: /^(```|~~~)/m,+ LINK_REGEX: /\[[^\]\n]+\]\([^)\s]+\)/,+ LIST_BULLET_REGEX: /^\s*[-*+]\s+\S/,+ LIST_NUMBERED_REGEX: /^\s*\d+[.)]\s+\S/,+ TABLE_SEPARATOR_REGEX: /^\s*\|?[\s:|-]+\|?\s*$/+} as const;diff --git a/tools/ui/src/lib/constants/markdown.ts b/tools/ui/src/lib/constants/markdown.tsdeleted file mode 100644index 1cace78a30..0000000000--- a/tools/ui/src/lib/constants/markdown.ts+++ /dev/null@@ -1,5 +0,0 @@-export const IMAGE_NOT_ERROR_BOUND_SELECTOR = 'img:not([data-error-bound])';-export const DATA_ERROR_BOUND_ATTR = 'errorBound';-export const DATA_ERROR_HANDLED_ATTR = 'errorHandled';-export const BOOL_TRUE_STRING = 'true';-export const BOOL_FALSE_STRING = 'false';diff --git a/tools/ui/src/lib/constants/max-bundle-size.ts b/tools/ui/src/lib/constants/max-bundle-size.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/max-bundle-size.tsrename to tools/ui/src/lib/constants/max-bundle-size.constants.tsdiff --git a/tools/ui/src/lib/constants/mcp-form.ts b/tools/ui/src/lib/constants/mcp-form.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/mcp-form.tsrename to tools/ui/src/lib/constants/mcp-form.constants.tsdiff --git a/tools/ui/src/lib/constants/mcp-resource.ts b/tools/ui/src/lib/constants/mcp-resource.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/mcp-resource.tsrename to tools/ui/src/lib/constants/mcp-resource.constants.tsdiff --git a/tools/ui/src/lib/constants/mcp.ts b/tools/ui/src/lib/constants/mcp.constants.tssimilarity index 57%rename from tools/ui/src/lib/constants/mcp.tsrename to tools/ui/src/lib/constants/mcp.constants.tsindex 854cbf9f76..11013d2cb1 100644--- a/tools/ui/src/lib/constants/mcp.ts+++ b/tools/ui/src/lib/constants/mcp.constants.ts@@ -36,11 +36,14 @@ export const DEFAULT_MCP_CONFIG = {export const MCP_SERVER_ID_PREFIX = 'LlamaUI-MCP-Server';-export const MCP_RECONNECT_INITIAL_DELAY = 1000;-export const MCP_RECONNECT_BACKOFF_MULTIPLIER = 2;-export const MCP_RECONNECT_MAX_DELAY = 30000;-/** Per-attempt timeout for a single reconnection attempt before giving up and backing off. */-export const MCP_RECONNECT_ATTEMPT_TIMEOUT_MS = 15_000;+/** Backoff policy for reconnecting to a dropped MCP server. */+export const MCP_RECONNECT = {+ /** Per-attempt timeout for a single reconnection attempt before giving up and backing off. */+ ATTEMPT_TIMEOUT_MS: 15_000,+ BACKOFF_MULTIPLIER: 2,+ INITIAL_DELAY: 1000,+ MAX_DELAY: 30000+};/** Maximum number of MCP server avatars to display in the chat form */export const MAX_DISPLAYED_MCP_AVATARS = 4;@@ -48,40 +51,20 @@ export const MAX_DISPLAYED_MCP_AVATARS = 4;/** Expected count when two theme-less icons represent a light/dark pair */export const EXPECTED_THEMED_ICON_PAIR_COUNT = 2;-/** CORS proxy URL query parameter name */-export const CORS_PROXY_URL_PARAM = 'url';--/** Header prefix for headers that should be forwarded by the CORS proxy */-export const CORS_PROXY_HEADER_PREFIX = 'x-llama-server-proxy-header-';--/** Number of trailing characters to keep visible when partially redacting mcp-session-id */-export const MCP_SESSION_ID_VISIBLE_CHARS = 5;--/** Partial-redaction rules for MCP headers: header name -> visible trailing chars */-export const MCP_PARTIAL_REDACT_HEADERS = new Map<string, number>([- ['mcp-session-id', MCP_SESSION_ID_VISIBLE_CHARS]-]);--/** Bearer scheme prefix used for Authorization headers (RFC 6750) */-export const BEARER_PREFIX = 'Bearer ';--/** Canonical casing for the Authorization header (RFC 7235) */-export const AUTHORIZATION_HEADER = 'Authorization';--/** Content-Type HTTP header name */-export const CONTENT_TYPE_HEADER = 'Content-Type';+/** CORS proxy connection settings */+export const CORS_PROXY = {+ /** Header prefix for headers that should be forwarded by the CORS proxy */+ HEADER_PREFIX: 'x-llama-server-proxy-header-',+ /** CORS proxy URL query parameter name */+ URL_PARAM: 'url'+} as const;-/** Header names whose values should be redacted in diagnostic logs */-export const REDACTED_HEADERS = new Set([- 'authorization',- 'api-key',- 'cookie',- 'mcp-session-id',- 'proxy-authorization',- 'set-cookie',- 'x-auth-token',- 'x-api-key'-]);+/** Standard SSE endpoint path indicators */+export const MCP_SSE = {+ ENDPOINT: '/sse',+ ENDPOINT_QUERY: '/sse?',+ ENDPOINT_SLASH: '/sse/'+} as const;/** Human-readable labels for MCP transport types */export const MCP_TRANSPORT_LABELS: Record<MCPTransportType, string> = {@@ -96,8 +79,3 @@ export const MCP_TRANSPORT_ICONS: Record<MCPTransportType, Component> = {[MCPTransportType.STREAMABLE_HTTP]: Globe,[MCPTransportType.WEBSOCKET]: Zap};--/** Standard SSE endpoint path indicators */-export const MCP_SSE_ENDPOINT = '/sse';-export const MCP_SSE_ENDPOINT_SLASH = '/sse/';-export const MCP_SSE_ENDPOINT_QUERY = '/sse?';diff --git a/tools/ui/src/lib/constants/mention-badge.ts b/tools/ui/src/lib/constants/mention-badge.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/mention-badge.tsrename to tools/ui/src/lib/constants/mention-badge.constants.tsdiff --git a/tools/ui/src/lib/constants/mermaid-blocks.ts b/tools/ui/src/lib/constants/mermaid-blocks.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/mermaid-blocks.tsrename to tools/ui/src/lib/constants/mermaid-blocks.constants.tsdiff --git a/tools/ui/src/lib/constants/message-export.constants.ts b/tools/ui/src/lib/constants/message-export.constants.tsnew file mode 100644index 0000000000..f6c576d792--- /dev/null+++ b/tools/ui/src/lib/constants/message-export.constants.ts@@ -0,0 +1,24 @@+// Conversation exporter / filename constants++export const EXPORT_CONV = {+ // Producer marker carried by the session record of a JSONL export+ HARNESS: 'llama.app',+ // Length of the trimmed conversation ID in the filename+ ID_TRIM_LENGTH: 8,+ // Replacements to the ISO date for use in the export filename+ ISO_DATE_TIME_SEPARATOR: 'T',++ ISO_DATE_TIME_SEPARATOR_REPLACEMENT: '_',++ ISO_TIME_SEPARATOR: ':',+ ISO_TIME_SEPARATOR_REPLACEMENT: '-',+ // Characters to keep in the ISO timestamp. 19 keeps 2026-01-01T00:00:00+ ISO_TIMESTAMP_SLICE: 19,++ MULTIPLE_UNDERSCORE_REGEX: /_+/g,+ // Maximum length of the sanitized conversation name snippet+ NAME_SUFFIX_MAX_LENGTH: 20,+ // Replacements for making the conversation title filename-friendly+ NON_ALPHANUMERIC_REGEX: /[^a-z0-9]/gi,+ NONALNUM_REPLACEMENT: '_'+} as const;diff --git a/tools/ui/src/lib/constants/message-export.ts b/tools/ui/src/lib/constants/message-export.tsdeleted file mode 100644index fc4dbe259c..0000000000--- a/tools/ui/src/lib/constants/message-export.ts+++ /dev/null@@ -1,23 +0,0 @@-// Conversation filename constants--// Length of the trimmed conversation ID in the filename-export const EXPORT_CONV_ID_TRIM_LENGTH = 8;-// Maximum length of the sanitized conversation name snippet-export const EXPORT_CONV_NAME_SUFFIX_MAX_LENGTH = 20;-// Characters to keep in the ISO timestamp. 19 keeps 2026-01-01T00:00:00-export const ISO_TIMESTAMP_SLICE_LENGTH = 19;--// Producer marker carried by the session record of a JSONL export-export const SESSION_HARNESS = 'llama.app';--// Replacements for making the conversation title filename-friendly-export const NON_ALPHANUMERIC_REGEX = /[^a-z0-9]/gi;-export const EXPORT_CONV_NONALNUM_REPLACEMENT = '_';-export const MULTIPLE_UNDERSCORE_REGEX = /_+/g;--// Replacements to the ISO date for use in the export filename-export const ISO_DATE_TIME_SEPARATOR = 'T';-export const ISO_DATE_TIME_SEPARATOR_REPLACEMENT = '_';--export const ISO_TIME_SEPARATOR = ':';-export const ISO_TIME_SEPARATOR_REPLACEMENT = '-';diff --git a/tools/ui/src/lib/constants/model-id.constants.ts b/tools/ui/src/lib/constants/model-id.constants.tsnew file mode 100644index 0000000000..081a13e0e6--- /dev/null+++ b/tools/ui/src/lib/constants/model-id.constants.ts@@ -0,0 +1,43 @@+/**+ * Parsing of `org/ModelName[-tag][:quant]` style model IDs.+ */++export const MODEL_ID = {+ /**+ * Matches an activated-parameter-count segment, e.g. `A10B`, `a2.4b`.+ * The leading `A`/`a` distinguishes it from a regular params segment.+ */+ ACTIVATED_PARAMS_RE: /^[Aa]\d+(\.\d+)?[BbMmKkTt]$/,++ /** Matches prefix for custom quantization types, e.g. `UD-Q8_K_XL`. */+ CUSTOM_QUANTIZATION_PREFIX_RE: /^UD$/i,+ /** Container format segments to exclude from tags (every model uses these). */+ IGNORED_SEGMENTS: new Set(['GGUF', 'GGML']),+ /** Sentinel value returned by `indexOf` when a substring is not found. */+ NOT_FOUND: -1,++ /** Separates `<org>` from `<model>` in a model ID, e.g. `org/ModelName`. */+ ORG_SEPARATOR: '/',++ /**+ * Matches a parameter-count segment, e.g. `7B`, `1.5b`, `120M`.+ * The optional leading `E` covers effective-parameter sizes, e.g. Gemma's+ * `E2B`/`E4B` (MatFormer models sized by resident params).+ */+ PARAMS_RE: /^[Ee]?\d+(\.\d+)?[BbMmKkTt]$/,++ /**+ * Matches a quantization/precision segment, e.g. `Q4_K_M`, `IQ4_XS`, `F16`, `BF16`, `MXFP4`.+ * Case-insensitive to handle both uppercase and lowercase inputs.+ */+ QUANTIZATION_SEGMENT_RE: /^(I?Q\d+(_[A-Z0-9]+)*|F\d+|BF\d+|MXFP\d+(_[A-Z0-9]+)*)$/i,++ /** Separates the model path from the quantization tag, e.g. `model:Q4_K_M`. */+ QUANTIZATION_SEPARATOR: ':',++ /** Separates named segments within the model path, e.g. `ModelName-7B-GGUF`. */+ SEGMENT_SEPARATOR: '-',++ /** Matches a trailing weight file extension, e.g. `model.gguf` -> `model`. */+ WEIGHT_EXTENSION_RE: /\.(gguf|ggml)$/i+};diff --git a/tools/ui/src/lib/constants/model-id.ts b/tools/ui/src/lib/constants/model-id.tsdeleted file mode 100644index 4108a21321..0000000000--- a/tools/ui/src/lib/constants/model-id.ts+++ /dev/null@@ -1,46 +0,0 @@-/** Sentinel value returned by `indexOf` when a substring is not found. */-export const MODEL_ID_NOT_FOUND = -1;--/** Separates `<org>` from `<model>` in a model ID, e.g. `org/ModelName`. */-export const MODEL_ID_ORG_SEPARATOR = '/';--/** Separates named segments within the model path, e.g. `ModelName-7B-GGUF`. */-export const MODEL_ID_SEGMENT_SEPARATOR = '-';--/** Separates the model path from the quantization tag, e.g. `model:Q4_K_M`. */-export const MODEL_ID_QUANTIZATION_SEPARATOR = ':';--/**- * Matches a quantization/precision segment, e.g. `Q4_K_M`, `IQ4_XS`, `F16`, `BF16`, `MXFP4`.- * Case-insensitive to handle both uppercase and lowercase inputs.- */-export const MODEL_QUANTIZATION_SEGMENT_RE =- /^(I?Q\d+(_[A-Z0-9]+)*|F\d+|BF\d+|MXFP\d+(_[A-Z0-9]+)*)$/i;--/**- * Matches prefix for custom quantization types, e.g. `UD-Q8_K_XL`.- */-export const MODEL_CUSTOM_QUANTIZATION_PREFIX_RE = /^UD$/i;--/**- * Matches a parameter-count segment, e.g. `7B`, `1.5b`, `120M`.- * The optional leading `E` covers effective-parameter sizes, e.g. Gemma's- * `E2B`/`E4B` (MatFormer models sized by resident params).- */-export const MODEL_PARAMS_RE = /^[Ee]?\d+(\.\d+)?[BbMmKkTt]$/;--/**- * Matches an activated-parameter-count segment, e.g. `A10B`, `a2.4b`.- * The leading `A`/`a` distinguishes it from a regular params segment.- */-export const MODEL_ACTIVATED_PARAMS_RE = /^[Aa]\d+(\.\d+)?[BbMmKkTt]$/;--/**- * Container format segments to exclude from tags (every model uses these).- */-export const MODEL_IGNORED_SEGMENTS = new Set(['GGUF', 'GGML']);--/**- * Matches a trailing weight file extension, e.g. `model.gguf` -> `model`.- */-export const MODEL_WEIGHT_EXTENSION_RE = /\.(gguf|ggml)$/i;diff --git a/tools/ui/src/lib/constants/model-loading.ts b/tools/ui/src/lib/constants/model-loading.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/model-loading.tsrename to tools/ui/src/lib/constants/model-loading.constants.tsdiff --git a/tools/ui/src/lib/constants/path-display.ts b/tools/ui/src/lib/constants/path-display.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/path-display.tsrename to tools/ui/src/lib/constants/path-display.constants.tsdiff --git a/tools/ui/src/lib/constants/precision.ts b/tools/ui/src/lib/constants/precision.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/precision.tsrename to tools/ui/src/lib/constants/precision.constants.tsdiff --git a/tools/ui/src/lib/constants/processing-info.ts b/tools/ui/src/lib/constants/processing-info.tsdeleted file mode 100644index 2c3f7dc534..0000000000--- a/tools/ui/src/lib/constants/processing-info.ts+++ /dev/null@@ -1,8 +0,0 @@-export const PROCESSING_INFO_TIMEOUT = 2000;--/**- * Statistics units labels- */-export const STATS_UNITS = {- TOKENS_PER_SECOND: 't/s'-} as const;diff --git a/tools/ui/src/lib/constants/pwa.ts b/tools/ui/src/lib/constants/pwa.constants.tssimilarity index 99%rename from tools/ui/src/lib/constants/pwa.tsrename to tools/ui/src/lib/constants/pwa.constants.tsindex 4da37c06bc..e807f4a97a 100644--- a/tools/ui/src/lib/constants/pwa.ts+++ b/tools/ui/src/lib/constants/pwa.constants.ts@@ -3,7 +3,7 @@* definitions across the codebase.*/-import { APP_NAME } from './app';+import { APP_NAME } from './app.constants';export const MEDIA_QUERIES = {DISPLAY_MODE_STANDALONE: '(display-mode: standalone)',diff --git a/tools/ui/src/lib/constants/reasoning-effort-tokens.ts b/tools/ui/src/lib/constants/reasoning-effort-tokens.tsdeleted file mode 100644index a0c244e5e9..0000000000--- a/tools/ui/src/lib/constants/reasoning-effort-tokens.ts+++ /dev/null@@ -1,12 +0,0 @@-import { ReasoningEffort } from '$lib/enums';--/**- * Reasoning effort to token budget mapping.- * Maps the ReasoningEffort enum values to concrete token counts for the server.- */-export const REASONING_EFFORT_TOKENS: Record<string, number> = {- [ReasoningEffort.HIGH]: 8192,- [ReasoningEffort.LOW]: 512,- [ReasoningEffort.MAX]: -1, // unlimited- [ReasoningEffort.MEDIUM]: 2048-};diff --git a/tools/ui/src/lib/constants/reasoning-effort.ts b/tools/ui/src/lib/constants/reasoning-effort.constants.tssimilarity index 71%rename from tools/ui/src/lib/constants/reasoning-effort.tsrename to tools/ui/src/lib/constants/reasoning-effort.constants.tsindex 4cbb7388ba..e8ec5f0e8d 100644--- a/tools/ui/src/lib/constants/reasoning-effort.ts+++ b/tools/ui/src/lib/constants/reasoning-effort.constants.ts@@ -22,3 +22,14 @@ export const REASONING_EFFORT_LEVELS: ReasoningEffortLevel[] = [{ label: 'High', value: ReasoningEffort.HIGH },{ hasInfo: true, label: 'Max', value: ReasoningEffort.MAX }];++/**+ * Reasoning effort to token budget mapping.+ * Maps the ReasoningEffort enum values to concrete token counts for the server.+ */+export const REASONING_EFFORT_TOKENS: Record<string, number> = {+ [ReasoningEffort.HIGH]: 8192,+ [ReasoningEffort.LOW]: 512,+ [ReasoningEffort.MAX]: -1, // unlimited+ [ReasoningEffort.MEDIUM]: 2048+};diff --git a/tools/ui/src/lib/constants/recommended-mcp-servers.ts b/tools/ui/src/lib/constants/recommended-mcp-servers.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/recommended-mcp-servers.tsrename to tools/ui/src/lib/constants/recommended-mcp-servers.constants.tsdiff --git a/tools/ui/src/lib/constants/routes.ts b/tools/ui/src/lib/constants/routes.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/routes.tsrename to tools/ui/src/lib/constants/routes.constants.tsdiff --git a/tools/ui/src/lib/constants/sandbox.constants.ts b/tools/ui/src/lib/constants/sandbox.constants.tsnew file mode 100644index 0000000000..9846e471a9--- /dev/null+++ b/tools/ui/src/lib/constants/sandbox.constants.ts@@ -0,0 +1,13 @@+import { BuiltInTool } from '$lib/enums';++export const SANDBOX_TOOL_NAME = BuiltInTool.RUN_JAVASCRIPT;++export const SANDBOX_TIMEOUT_MS_DEFAULT = 10000;++export const SANDBOX_TIMEOUT_MS_MAX = 30000;++export const SANDBOX_OUTPUT_MAX_CHARS = 8192;++export const SANDBOX_EMPTY_OUTPUT = '(no output)';++export const SANDBOX_TRUNCATION_NOTICE = '[output truncated]';diff --git a/tools/ui/src/lib/constants/settings-keys.ts b/tools/ui/src/lib/constants/settings-keys.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/settings-keys.tsrename to tools/ui/src/lib/constants/settings-keys.constants.tsdiff --git a/tools/ui/src/lib/constants/settings-registry.ts b/tools/ui/src/lib/constants/settings-registry.constants.tssimilarity index 97%rename from tools/ui/src/lib/constants/settings-registry.tsrename to tools/ui/src/lib/constants/settings-registry.constants.tsindex ada029a33f..e444599570 100644--- a/tools/ui/src/lib/constants/settings-registry.ts+++ b/tools/ui/src/lib/constants/settings-registry.constants.ts@@ -1,12 +1,9 @@-import { CLI_FLAGS } from './cli-flags';-import { DEFAULT_MCP_CONFIG } from './mcp';-import { ROUTES, SETTINGS_SECTION_SLUGS } from './routes';-import { SETTINGS_KEYS } from './settings-keys';-import { TITLE_GENERATION } from './title-generation';-import {- FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH,- FILE_GLOB_SEARCH_PICKERS_MAX_SEARCH_DEPTH-} from './working-directory';+import { CLI_FLAGS } from './cli-flags.constants';+import { DEFAULT_MCP_CONFIG } from './mcp.constants';+import { ROUTES, SETTINGS_SECTION_SLUGS } from './routes.constants';+import { SETTINGS_KEYS } from './settings-keys.constants';+import { TITLE_GENERATION } from './title-generation.constants';+import { FILE_GLOB_SEARCH_PICKERS } from './working-directory.constants';import {AlertTriangle,Code,@@ -14,7 +11,6 @@ import {Funnel,ListRestart,Monitor,- Monitor as MonitorIcon,Moon,PencilRuler,Sliders,@@ -53,7 +49,7 @@ const STANDALONE_SECTIONS: { title: SettingsSectionTitle; slug: string; icon: Co}];const COLOR_MODE_OPTIONS: Array<{ value: string; label: string; icon: Component }> = [- { icon: MonitorIcon, label: 'System', value: ColorMode.SYSTEM },+ { icon: Monitor, label: 'System', value: ColorMode.SYSTEM },{ icon: Sun, label: 'Light', value: ColorMode.LIGHT },{ icon: Moon, label: 'Dark', value: ColorMode.DARK }];@@ -106,14 +102,14 @@ const SETTINGS_REGISTRY: Record<string, SettingsSectionEntry> = {type: SettingsFieldType.INPUT},{- defaultValue: FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH,+ defaultValue: FILE_GLOB_SEARCH_PICKERS.DEFAULT_SEARCH_DEPTH,help: 'How many directory levels below the working directory the @-mention file search descends. Larger values surface deeply nested files but take longer on large trees.',isPositiveInteger: true,key: SETTINGS_KEYS.MENTION_SEARCH_MAX_DEPTH,label: 'Mention search depth',- max: FILE_GLOB_SEARCH_PICKERS_MAX_SEARCH_DEPTH,+ max: FILE_GLOB_SEARCH_PICKERS.MAX_SEARCH_DEPTH,min: 1,- placeholder: `${FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH}`,+ placeholder: `${FILE_GLOB_SEARCH_PICKERS.DEFAULT_SEARCH_DEPTH}`,section: SETTINGS_SECTION_SLUGS.AGENTIC,type: SettingsFieldType.INPUT}diff --git a/tools/ui/src/lib/constants/special-characters.constants.ts b/tools/ui/src/lib/constants/special-characters.constants.tsnew file mode 100644index 0000000000..aaeebca33f--- /dev/null+++ b/tools/ui/src/lib/constants/special-characters.constants.ts@@ -0,0 +1,16 @@+// Control / whitespace / formatting characters that appear literally inside rendered text.++/** Line feed. */+export const NEWLINE = '\n';++/** Horizontal tab. */+export const TAB = '\t';++/** Non-breaking space. */+export const NBSP = '\u00a0';++/** Non-breaking spaces used to render a tab stop that whitespace collapsing would otherwise squash. */+export const TAB_AS_SPACES = NBSP.repeat(4);++/** Matches a CR-terminated or bare LF line break. */+export const LINE_BREAK = /\r?\n/;diff --git a/tools/ui/src/lib/constants/storage.ts b/tools/ui/src/lib/constants/storage.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/storage.tsrename to tools/ui/src/lib/constants/storage.constants.tsdiff --git a/tools/ui/src/lib/constants/sse.ts b/tools/ui/src/lib/constants/stream.constants.tssimilarity index 53%rename from tools/ui/src/lib/constants/sse.tsrename to tools/ui/src/lib/constants/stream.constants.tsindex 0eb4b6edee..64f67243c2 100644--- a/tools/ui/src/lib/constants/sse.ts+++ b/tools/ui/src/lib/constants/stream.constants.ts@@ -1,3 +1,11 @@+// grace window after a visibilitychange before we kick a reader whose socket likely died+// while the tab was hidden. covers brief background pauses without thrashing live streams+export const STREAM_VISIBILITY_KICK_MS = 3000;++// separator joining a conversation id and its per-model stream identity+// suffix (conv::model) used by the server side replay buffer+export const CONVERSATION_ID_SEPARATOR = '::';+/*** Server-sent events wire format, shared by the chat stream and the* /models/sse status feed (text/event-stream).diff --git a/tools/ui/src/lib/constants/stream.ts b/tools/ui/src/lib/constants/stream.tsdeleted file mode 100644index 67951ee953..0000000000--- a/tools/ui/src/lib/constants/stream.ts+++ /dev/null@@ -1,3 +0,0 @@-// grace window after a visibilitychange before we kick a reader whose socket likely died-// while the tab was hidden. covers brief background pauses without thrashing live streams-export const STREAM_VISIBILITY_KICK_MS = 3000;diff --git a/tools/ui/src/lib/constants/supported-file-types.ts b/tools/ui/src/lib/constants/supported-file-types.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/supported-file-types.tsrename to tools/ui/src/lib/constants/supported-file-types.constants.tsdiff --git a/tools/ui/src/lib/constants/svg-blocks.constants.ts b/tools/ui/src/lib/constants/svg-blocks.constants.tsnew file mode 100644index 0000000000..705800c262--- /dev/null+++ b/tools/ui/src/lib/constants/svg-blocks.constants.ts@@ -0,0 +1,57 @@+/**+ * Constants for rendering svg code blocks inline.+ */+export const SVG = {+ // CSS classes applied to the inline svg block and its chrome.+ BLOCK_CLASS: 'svg-block',+ /**+ * Shadow root style for the zoom dialog svg. Lets the svg grow past its+ * intrinsic size so pan and zoom have room to work.+ */+ DIALOG_SHADOW_STYLE:+ ':host{display:inline-block}svg{min-height:min(50vh,12rem);min-width:min(80vw,20rem);max-width:none;max-height:none;height:auto;width:auto;display:block}',+ ID_ATTR: 'data-svg-id',++ /**+ * Shadow root style for an inline svg block. Mirrors the centered, padded+ * sizing the light dom used before the svg moved behind a shadow boundary.+ */+ INLINE_SHADOW_STYLE:+ ':host{display:block;width:100%;text-align:center}svg{display:block;margin:0 auto;width:auto;height:auto;max-width:100%;max-height:70vh;min-height:8rem;padding:3rem 1rem}',+ // Languages that mark a code block as svg content.+ LANGUAGE: 'svg',+ /**+ * Hard size ceiling for a single inline svg block.+ * Above this the source is left as raw text instead of being rendered.+ */+ MAX_BYTES: 256 * 1024,++ RENDERED_ATTR: 'data-svg-rendered',+ /**+ * DOMPurify config for untrusted svg coming from model output.+ *+ * foreignObject and script stay forbidden unconditionally, they are the only+ * inline svg vectors that execute arbitrary html or js. Everything else is+ * allowed for maximum rendering compatibility: href and xlink:href stay so+ * use, image, a and animateMotion work, and DOMPurify still neutralizes+ * javascript: and data: uri schemes natively. External resource refs are+ * allowed by design on a local first tool, the user browser fetches them.+ *+ * The sanitized svg is always mounted inside a shadow root (see svg-shadow),+ * so an author <style> stays scoped to that root and can not reach the page.+ */+ SANITIZE_CONFIG: {+ FORBID_TAGS: ['foreignObject', 'script'],+ USE_PROFILES: { svg: true, svgFilters: true }+ },+ SCROLL_CONTAINER_CLASS: 'svg-scroll-container',++ // data-attributes used to stash per-block svg state on the DOM node.+ SOURCE_ATTR: 'data-svg-source',++ TAG_PREFIX: '<svg',++ WRAPPER_CLASS: 'svg-block-wrapper',++ XML_LANGUAGE: 'xml'+};diff --git a/tools/ui/src/lib/constants/svg-blocks.ts b/tools/ui/src/lib/constants/svg-blocks.tsdeleted file mode 100644index 359e0692f2..0000000000--- a/tools/ui/src/lib/constants/svg-blocks.ts+++ /dev/null@@ -1,49 +0,0 @@-export const SVG_WRAPPER_CLASS = 'svg-block-wrapper';-export const SVG_SCROLL_CONTAINER_CLASS = 'svg-scroll-container';-export const SVG_BLOCK_CLASS = 'svg-block';--export const SVG_LANGUAGE = 'svg';-export const XML_LANGUAGE = 'xml';-export const SVG_TAG_PREFIX = '<svg';--export const SVG_SOURCE_ATTR = 'data-svg-source';-export const SVG_ID_ATTR = 'data-svg-id';-export const SVG_RENDERED_ATTR = 'data-svg-rendered';--/**- * Hard size ceiling for a single inline svg block.- * Above this the source is left as raw text instead of being rendered.- */-export const SVG_MAX_BYTES = 256 * 1024;--/**- * DOMPurify config for untrusted svg coming from model output.- *- * foreignObject and script stay forbidden unconditionally, they are the only- * inline svg vectors that execute arbitrary html or js. Everything else is- * allowed for maximum rendering compatibility: href and xlink:href stay so- * use, image, a and animateMotion work, and DOMPurify still neutralizes- * javascript: and data: uri schemes natively. External resource refs are- * allowed by design on a local first tool, the user browser fetches them.- *- * The sanitized svg is always mounted inside a shadow root (see svg-shadow),- * so an author <style> stays scoped to that root and can not reach the page.- */-export const SVG_SANITIZE_CONFIG = {- FORBID_TAGS: ['foreignObject', 'script'],- USE_PROFILES: { svg: true, svgFilters: true }-};--/**- * Shadow root style for an inline svg block. Mirrors the centered, padded- * sizing the light dom used before the svg moved behind a shadow boundary.- */-export const SVG_INLINE_SHADOW_STYLE =- ':host{display:block;width:100%;text-align:center}svg{display:block;margin:0 auto;width:auto;height:auto;max-width:100%;max-height:70vh;min-height:8rem;padding:3rem 1rem}';--/**- * Shadow root style for the zoom dialog svg. Lets the svg grow past its- * intrinsic size so pan and zoom have room to work.- */-export const SVG_DIALOG_SHADOW_STYLE =- ':host{display:inline-block}svg{min-height:min(50vh,12rem);min-width:min(80vw,20rem);max-width:none;max-height:none;height:auto;width:auto;display:block}';diff --git a/tools/ui/src/lib/constants/table-html-restorer.ts b/tools/ui/src/lib/constants/table-html-restorer.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/table-html-restorer.tsrename to tools/ui/src/lib/constants/table-html-restorer.constants.tsdiff --git a/tools/ui/src/lib/constants/title-generation.ts b/tools/ui/src/lib/constants/title-generation.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/title-generation.tsrename to tools/ui/src/lib/constants/title-generation.constants.tsdiff --git a/tools/ui/src/lib/constants/tools.ts b/tools/ui/src/lib/constants/tools.tsdeleted file mode 100644index a467cda2b9..0000000000--- a/tools/ui/src/lib/constants/tools.ts+++ /dev/null@@ -1,22 +0,0 @@-import { ToolSource } from '$lib/enums/tools.enums';--/** HTTP header carrying the working directory a tool call runs in. The server resolves relative paths against it; the model cannot override it. */-export const X_TOOL_CWD_HEADER = 'x-tool-cwd';--/** HTTP header asking the server to encode a tool's output differently, e.g. read_file returning base64. Not a tool parameter, so it stays out of the definition the model sees. */-export const X_RESP_TYPE_HEADER = 'x-resp-type';--/** `X_RESP_TYPE_HEADER` value that makes read_file return the raw bytes as base64 instead of text. */-export const RESP_TYPE_BASE64 = 'base64';--export const TOOL_GROUP_LABELS = {- [ToolSource.BUILTIN]: 'Built-in',- [ToolSource.CUSTOM]: 'JSON Schema',- [ToolSource.FRONTEND]: 'Browser'-} as const;--export const TOOL_SERVER_LABELS = {- [ToolSource.BUILTIN]: 'Built-in Tools',- [ToolSource.CUSTOM]: 'Custom Tools',- [ToolSource.FRONTEND]: 'Browser Tools'-} as const;diff --git a/tools/ui/src/lib/constants/tooltip-config.ts b/tools/ui/src/lib/constants/tooltip-config.tsdeleted file mode 100644index ad76ab3522..0000000000--- a/tools/ui/src/lib/constants/tooltip-config.ts+++ /dev/null@@ -1 +0,0 @@-export const TOOLTIP_DELAY_DURATION = 500;diff --git a/tools/ui/src/lib/constants/ui.ts b/tools/ui/src/lib/constants/ui.constants.tssimilarity index 57%rename from tools/ui/src/lib/constants/ui.tsrename to tools/ui/src/lib/constants/ui.constants.tsindex 9489a3f268..3374b6e008 100644--- a/tools/ui/src/lib/constants/ui.ts+++ b/tools/ui/src/lib/constants/ui.constants.ts@@ -1,11 +1,40 @@-import { ROUTES } from './routes';+import { ROUTES } from './routes.constants';import { Package, Search, Settings, SquarePen } from '@lucide/svelte';import McpLogo from '$lib/components/app/mcp/McpLogo.svelte';-import type { Component } from 'svelte';+import { ToolSource } from '$lib/enums/tools.enums';+import type { DesktopIconStripItem } from '$lib/types';export const FORK_TREE_DEPTH_PADDING = 8;export const SYSTEM_MESSAGE_PLACEHOLDER = 'System message';+export const TOOL_GROUP_LABELS = {+ [ToolSource.BUILTIN]: 'Built-in',+ [ToolSource.CUSTOM]: 'JSON Schema',+ [ToolSource.FRONTEND]: 'Browser'+} as const;++export const TOOL_SERVER_LABELS = {+ [ToolSource.BUILTIN]: 'Built-in Tools',+ [ToolSource.CUSTOM]: 'Custom Tools',+ [ToolSource.FRONTEND]: 'Browser Tools'+} as const;++export const TOOLTIP_DELAY_DURATION = 500;++export const VIEWPORT_GUTTER = 8;+export const MENU_OFFSET = 6;++export const PROCESSING_INFO_TIMEOUT = 2000;++/**+ * Statistics units labels+ */+export const STATS_UNITS = {+ TOKENS_PER_SECOND: 't/s'+} as const;++export const DEFAULT_MOBILE_BREAKPOINT = 768;+/** Icon used for the model selector and the `/model` slash command. */export const MODEL_SELECTOR_ICON = Package;@@ -15,16 +44,6 @@ export const ICON_STRIP_TRANSITION_DELAY_MULTIPLIER = 50;/** Max height for tool-result code blocks (json / source / diff / streaming code). */export const MAX_HEIGHT_CODE_BLOCK = '22rem';-export interface DesktopIconStripItem {- icon: Component;- tooltip: string;- route?: string;- activeRouteId?: string;- activeRoutePrefix?: string;- activeUrlIncludes?: string;- keys?: string[];-}-export const SIDEBAR_ACTIONS_ITEMS: DesktopIconStripItem[] = [{ icon: SquarePen, keys: ['shift', 'cmd', 'o'], route: ROUTES.NEW_CHAT, tooltip: 'New chat' },{ icon: Search, keys: ['cmd', 'k'], tooltip: 'Search' },diff --git a/tools/ui/src/lib/constants/uri-template.ts b/tools/ui/src/lib/constants/uri-template.constants.tssimilarity index 71%rename from tools/ui/src/lib/constants/uri-template.tsrename to tools/ui/src/lib/constants/uri-template.constants.tsindex 3ae25551b9..d4b680156e 100644--- a/tools/ui/src/lib/constants/uri-template.ts+++ b/tools/ui/src/lib/constants/uri-template.constants.ts@@ -8,11 +8,13 @@ export const URI_SCHEME_SEPARATOR = '://';/** Regex to match template expressions like {var}, {+var}, {#var}, {/var} */export const TEMPLATE_EXPRESSION_REGEX = /\{([+#./;?&]?)([^}]+)\}/g;-/** RFC 6570 URI template operators */-export const URI_TEMPLATE_OPERATORS = {- /** Form-style query continuation */- FORM_CONTINUATION: '&',+/** RFC 6570 URI template operators and separators. A single object covers both: an operator prefix character doubles as the separator written into the expansion (e.g. `{/a}`/`{;a}` use `/` and `;` for both), so the characters live here once. */+export const URI_TEMPLATE_SYMBOLS = {+ /** Comma separator for list expansion */+ COMMA: ',',/** Form-style query */+ FORM_CONTINUATION: '&',+ /** Form-style query prefix */FORM_QUERY: '?',/** Fragment expansion */FRAGMENT: '#',@@ -28,22 +30,6 @@ export const URI_TEMPLATE_OPERATORS = {SIMPLE: ''} as const;-/** URI template separators used in expansion */-export const URI_TEMPLATE_SEPARATORS = {- /** Comma separator for list expansion */- COMMA: ',',- /** Period separator for label expansion */- PERIOD: '.',- /** Ampersand prefix for query continuation */- QUERY_CONTINUATION: '&',- /** Question mark prefix for query string */- QUERY_PREFIX: '?',- /** Semicolon separator for path parameters */- SEMICOLON: ';',- /** Slash separator for path segments */- SLASH: '/'-} as const;-/** Maximum number of leading slashes to strip during URI normalization */export const MAX_LEADING_SLASHES_TO_STRIP = 3;diff --git a/tools/ui/src/lib/constants/url.ts b/tools/ui/src/lib/constants/url.constants.tssimilarity index 100%rename from tools/ui/src/lib/constants/url.tsrename to tools/ui/src/lib/constants/url.constants.tsdiff --git a/tools/ui/src/lib/constants/viewport.ts b/tools/ui/src/lib/constants/viewport.tsdeleted file mode 100644index 26e202cfea..0000000000--- a/tools/ui/src/lib/constants/viewport.ts+++ /dev/null@@ -1 +0,0 @@-export const DEFAULT_MOBILE_BREAKPOINT = 768;diff --git a/tools/ui/src/lib/constants/working-directory.constants.ts b/tools/ui/src/lib/constants/working-directory.constants.tsnew file mode 100644index 0000000000..cb63e92ebc--- /dev/null+++ b/tools/ui/src/lib/constants/working-directory.constants.ts@@ -0,0 +1,50 @@+/**+ * Constants for the working-directory picker's glob search.+ *+ * The picker glob-matches home-relative names client-side. Character classes+ * are built case-insensitively and the reserved glob metacharacters are+ * escaped (passed through literally) so a query never changes matching.+ */++/** Label shown for the working-directory picker / `/cwd` slash command. */+export const SET_WORKING_DIRECTORY_LABEL = 'Set working directory';++export const GLOB = {+ /** `C:`, the drive part of a Windows absolute path. */+ DRIVE_PREFIX_REGEX: /^[A-Za-z]:/,+ /** `C:` or `C:/`, the root of a Windows drive-absolute path. */+ DRIVE_ROOT_REGEX: /^[A-Za-z]:\/?/,+ /** Character that ends a glob character-class fragment. */+ RANGE_CLOSE: ']',+ /** Character that starts a glob character-class fragment. */+ RANGE_OPEN: '[',+ /** Query characters that carry glob meaning and are passed through literally. */+ SPECIAL_CHARS: '*?[]',+ /** `//host/share` or `//host/share/`, the root of a UNC path. */+ UNC_ROOT_REGEX: /^\/\/[^/]+\/[^/]+\/?/,+ /** Wildcard character in a glob pattern. */+ WILDCARD: '*',+ /** Separator Windows accepts alongside `/`, and a legal POSIX filename character. */+ WINDOWS_SEPARATOR: '\\'+} as const;++export const SEARCH = {+ // Search tuning for the picker's file_glob_search calls.+ DEBOUNCE_MS: 180,+ LIMIT: 100,+ // Home-relative globs descend deeper than path navigation, which only+ // needs the direct children of the parent.+ MAX_DEPTH: 6,+ MAX_RESULTS_SHOWN: 20,+ NATIVE_LIMIT: 20,+ // Native folder-picker resolution searches a shallow, bounded window.+ NATIVE_MAX_DEPTH: 4,+ PATH_NAV_MAX_DEPTH: 1+} as const;++export const FILE_GLOB_SEARCH_PICKERS = {+ /** Depth the pickers fall back to when the user setting is invalid. */+ DEFAULT_SEARCH_DEPTH: 10,+ /** Upper bound the mention search depth setting accepts. The server itself imposes no depth cap (0 = unlimited); this is a UI sanity bound. */+ MAX_SEARCH_DEPTH: 32+} as const;diff --git a/tools/ui/src/lib/constants/working-directory.ts b/tools/ui/src/lib/constants/working-directory.tsdeleted file mode 100644index 20d1d15760..0000000000--- a/tools/ui/src/lib/constants/working-directory.ts+++ /dev/null@@ -1,49 +0,0 @@-/**- * Constants for the working-directory picker's glob search.- *- * The picker glob-matches home-relative names client-side. Character classes- * are built case-insensitively and the reserved glob metacharacters are- * escaped (passed through literally) so a query never changes matching.- */--export const GLOB_WILDCARD = '*';--/** Label shown for the working-directory picker / `/cwd` slash command. */-export const SET_WORKING_DIRECTORY_LABEL = 'Set working directory';--/** Character that starts and ends a glob character-class fragment. */-export const GLOB_RANGE_OPEN = '[';-export const GLOB_RANGE_CLOSE = ']';--/** Query characters that carry glob meaning and are passed through literally. */-export const GLOB_SPECIAL_CHARS = '*?[]';--/** Separator Windows accepts alongside `/`, and a legal POSIX filename character. */-export const WINDOWS_SEPARATOR = '\\';--/** `C:`, the drive part of a Windows absolute path. */-export const DRIVE_PREFIX_REGEX = /^[A-Za-z]:/;--/** `C:` or `C:/`, the root of a Windows drive-absolute path. */-export const DRIVE_ROOT_REGEX = /^[A-Za-z]:\/?/;--/** `//host/share` or `//host/share/`, the root of a UNC path. */-export const UNC_ROOT_REGEX = /^\/\/[^/]+\/[^/]+\/?/;--// Search tuning for the picker's file_glob_search calls.-export const SEARCH_DEBOUNCE_MS = 180;-export const SEARCH_LIMIT = 100;-export const MAX_RESULTS_SHOWN = 20;-// Home-relative globs descend deeper than path navigation, which only-// needs the direct children of the parent.-export const SEARCH_MAX_DEPTH = 6;-export const PATH_NAV_MAX_DEPTH = 1;-// Native folder-picker resolution searches a shallow, bounded window.-export const NATIVE_MAX_DEPTH = 4;-export const NATIVE_LIMIT = 20;--/** Upper bound the mention search depth setting accepts. The server itself imposes no depth cap (0 = unlimited); this is a UI sanity bound. */-export const FILE_GLOB_SEARCH_PICKERS_MAX_SEARCH_DEPTH = 32;--/** Depth the pickers fall back to when the user setting is invalid. */-export const FILE_GLOB_SEARCH_PICKERS_DEFAULT_SEARCH_DEPTH = 10;diff --git a/tools/ui/src/lib/enums/attachment.enums.ts b/tools/ui/src/lib/enums/attachment.enums.tsindex 1c3258cb19..c6fc2b82ad 100644--- a/tools/ui/src/lib/enums/attachment.enums.ts+++ b/tools/ui/src/lib/enums/attachment.enums.ts@@ -47,6 +47,16 @@ export enum AttachmentAction {MCP_RESOURCES_CLICK = 'onMcpResourcesClick'}+/**+ * Human-readable labels used when embedding attachments in outgoing messages.+ */+export enum AttachmentLabel {+ FILE = 'File',+ PDF_FILE = 'PDF File',+ MCP_PROMPT = 'MCP Prompt',+ MCP_RESOURCE = 'MCP Resource'+}+/*** Visibility conditions for attachment menu items.*/diff --git a/tools/ui/src/lib/enums/index.ts b/tools/ui/src/lib/enums/index.tsindex ebf8b6dbe5..217ecc2fe1 100644--- a/tools/ui/src/lib/enums/index.ts+++ b/tools/ui/src/lib/enums/index.ts@@ -1,4 +1,5 @@export {+ AttachmentLabel,AttachmentType,AttachmentMenuItemId,AttachmentItemEnabledWhen,@@ -43,13 +44,13 @@ export {FileExtensionAudio,FileExtensionPdf,FileExtensionText,- MimeTypePrefix,- MimeTypeIncludes,- UriPattern,MimeTypeApplication,MimeTypeAudio,MimeTypeVideo,MimeTypeImage,+ MimeTypePrefix,+ MimeTypeIncludes,+ UriPattern,MimeTypeText,SpecialFileType} from './files.enums';diff --git a/tools/ui/src/lib/hooks/use-chat-form-pickers.svelte.ts b/tools/ui/src/lib/hooks/use-chat-form-pickers.svelte.tsindex 712189746b..986cc46c72 100644--- a/tools/ui/src/lib/hooks/use-chat-form-pickers.svelte.ts+++ b/tools/ui/src/lib/hooks/use-chat-form-pickers.svelte.ts@@ -1,6 +1,7 @@-import { getChatCommands, PROMPT_TRIGGER_PREFIX } from '$lib/constants';+import { PROMPT_TRIGGER_PREFIX } from '$lib/constants';import { ChatFormCommandAction, KeyboardKey } from '$lib/enums';import type { ChatFormCommand } from '$lib/types';+import { getChatCommands } from '$lib/utils';import {type CommandDismissSnapshot,findCommandToken,diff --git a/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts b/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.tsindex f99b273e84..ce394c383d 100644--- a/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts+++ b/tools/ui/src/lib/hooks/use-keyboard-shortcuts.svelte.ts@@ -1,5 +1,5 @@import { goto } from '$app/navigation';-import { ROUTES } from '$lib/constants/routes';+import { ROUTES } from '$lib/constants';import { KeyboardKey } from '$lib/enums';interface KeyboardShortcutsCallbacks {diff --git a/tools/ui/src/lib/hooks/use-pwa.svelte.ts b/tools/ui/src/lib/hooks/use-pwa.svelte.tsindex 1a02710677..2bad85aacd 100644--- a/tools/ui/src/lib/hooks/use-pwa.svelte.ts+++ b/tools/ui/src/lib/hooks/use-pwa.svelte.ts@@ -1,6 +1,5 @@import { browser } from '$app/environment';-import { SW_CONFIG } from '$lib/constants/pwa';-import { BUILD_VERSION_LOCALSTORAGE_KEY } from '$lib/constants/storage';+import { BUILD_VERSION_LOCALSTORAGE_KEY, SW_CONFIG } from '$lib/constants';import { versionStore } from '$lib/stores/version.svelte';import { useRegisterSW } from 'virtual:pwa-register/svelte';diff --git a/tools/ui/src/lib/hooks/use-reasoning-menu.svelte.ts b/tools/ui/src/lib/hooks/use-reasoning-menu.svelte.tsindex 6c47b160fe..399a08528d 100644--- a/tools/ui/src/lib/hooks/use-reasoning-menu.svelte.ts+++ b/tools/ui/src/lib/hooks/use-reasoning-menu.svelte.ts@@ -1,5 +1,4 @@-import { REASONING_EFFORT_LEVELS } from '$lib/constants/reasoning-effort';-import { REASONING_EFFORT_TOKENS } from '$lib/constants/reasoning-effort-tokens';+import { REASONING_EFFORT_LEVELS, REASONING_EFFORT_TOKENS } from '$lib/constants';import { ReasoningEffort } from '$lib/enums';import { chatStore } from '$lib/stores/chat.svelte';import { activeMessages, conversationsStore } from '$lib/stores/conversations.svelte';diff --git a/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts b/tools/ui/src/lib/hooks/use-settings-navigation.svelte.tsindex e326d0c8ab..efa7bcbc1e 100644--- a/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts+++ b/tools/ui/src/lib/hooks/use-settings-navigation.svelte.ts@@ -1,6 +1,6 @@import { beforeNavigate } from '$app/navigation';import { page } from '$app/state';-import { ROUTES } from '$lib/constants/routes';+import { ROUTES } from '$lib/constants';import { settingsReferrer } from '$lib/stores/settings-referrer.svelte';export interface ChatSettings {diff --git a/tools/ui/src/lib/services/chat.service.ts b/tools/ui/src/lib/services/chat.service.tsindex 540d742393..1dde2e18fe 100644--- a/tools/ui/src/lib/services/chat.service.ts+++ b/tools/ui/src/lib/services/chat.service.ts@@ -5,10 +5,8 @@ import {API_CHAT,API_SLOTS,API_STREAM,- ATTACHMENT_LABEL_MCP_PROMPT,- ATTACHMENT_LABEL_MCP_RESOURCE,- ATTACHMENT_LABEL_PDF_FILE,CONTROL_ACTION,+ HEADERS,LEGACY_AGENTIC_REGEX,REASONING_EFFORT_TOKENS,SETTINGS_KEYS,@@ -19,6 +17,7 @@ import {STREAM_VISIBILITY_KICK_MS} from '$lib/constants';import {+ AttachmentLabel,AttachmentType,ContentPartType,MessageRole,@@ -341,7 +340,7 @@ export class ChatService {// server side replay buffer and powers discoverActiveStream on tab reopen. with an explicit// model the ::model suffix keeps the per model session distinctif (stream && conversationId) {- headers['X-Conversation-Id'] = streamIdentity(conversationId, options.model);+ headers[HEADERS.X_CONVERSATION_ID_HEADER] = streamIdentity(conversationId, options.model);// persist the pending stream before the fetch: a reload during the model load or// the prompt processing must still find its way back to the session once it existsChatService.saveStreamState(conversationId, 0, options.model ?? null);@@ -1291,7 +1290,7 @@ export class ChatService {for (const textFile of textFiles) {contentParts.push({- text: formatAttachmentText('File', textFile.name, textFile.content),+ text: formatAttachmentText(AttachmentLabel.FILE, textFile.name, textFile.content),type: ContentPartType.TEXT});}@@ -1304,7 +1303,11 @@ export class ChatService {for (const legacyContextFile of legacyContextFiles) {contentParts.push({- text: formatAttachmentText('File', legacyContextFile.name, legacyContextFile.content),+ text: formatAttachmentText(+ AttachmentLabel.FILE,+ legacyContextFile.name,+ legacyContextFile.content+ ),type: ContentPartType.TEXT});}@@ -1382,7 +1385,7 @@ export class ChatService {}} else {contentParts.push({- text: formatAttachmentText(ATTACHMENT_LABEL_PDF_FILE, pdfFile.name, pdfFile.content),+ text: formatAttachmentText(AttachmentLabel.PDF_FILE, pdfFile.name, pdfFile.content),type: ContentPartType.TEXT});}@@ -1396,7 +1399,7 @@ export class ChatService {for (const mcpPrompt of mcpPrompts) {contentParts.push({text: formatAttachmentText(- ATTACHMENT_LABEL_MCP_PROMPT,+ AttachmentLabel.MCP_PROMPT,mcpPrompt.name,mcpPrompt.content,mcpPrompt.serverName@@ -1413,7 +1416,7 @@ export class ChatService {for (const mcpResource of mcpResources) {contentParts.push({text: formatAttachmentText(- ATTACHMENT_LABEL_MCP_RESOURCE,+ AttachmentLabel.MCP_RESOURCE,mcpResource.name,mcpResource.content,mcpResource.serverNamediff --git a/tools/ui/src/lib/services/index.ts b/tools/ui/src/lib/services/index.tsindex 8704b1bd6c..328d3b4828 100644--- a/tools/ui/src/lib/services/index.ts+++ b/tools/ui/src/lib/services/index.ts@@ -276,7 +276,7 @@ export { MCPService } from './mcp.service';* - **toolsStore**: Exposes the tool definition when the sandbox is enabled* - **agenticStore**: Dispatches ToolSource.FRONTEND calls here*- * @see buildSandboxToolDefinition in constants/sandbox.ts - tool schema sent to the LLM+ * @see buildSandboxToolDefinition in utils/sandbox-tool - tool schema sent to the LLM* @see agenticStore in stores/agentic.svelte.ts - tool dispatch*/export { SandboxService } from './sandbox.service';diff --git a/tools/ui/src/lib/services/mcp.service.ts b/tools/ui/src/lib/services/mcp.service.tsindex fbac5b7b58..43f905c33a 100644--- a/tools/ui/src/lib/services/mcp.service.ts+++ b/tools/ui/src/lib/services/mcp.service.ts@@ -13,12 +13,12 @@ import type {Tool} from '@modelcontextprotocol/sdk/types.js';import {+ CORS_PROXY,CORS_PROXY_ENDPOINT,- CORS_PROXY_HEADER_PREFIX,DEFAULT_CLIENT_VERSION,DEFAULT_IMAGE_MIME_TYPE,DEFAULT_MCP_CONFIG,- MCP_PARTIAL_REDACT_HEADERS+ HEADERS} from '$lib/constants';import {MCPConnectionPhase,@@ -120,7 +120,7 @@ export class MCPService {const details: DiagnosticRequestDetails = {body: summarizeRequestBody(body),credentials: init?.credentials ?? baseInit.credentials,- headers: sanitizeHeaders(requestHeaders, extraRedactedHeaders, MCP_PARTIAL_REDACT_HEADERS),+ headers: sanitizeHeaders(requestHeaders, extraRedactedHeaders, HEADERS.PARTIAL_REDACT),method: getRequestMethod(input, init, baseInit).toUpperCase(),mode: init?.mode ?? baseInit.mode,url: getRequestUrl(input)@@ -141,8 +141,8 @@ export class MCPService {) {for (const [key, value] of new Headers(headers).entries()) {const proxiedKey =- useProxy && !key.toLowerCase().startsWith(CORS_PROXY_HEADER_PREFIX)- ? `${CORS_PROXY_HEADER_PREFIX}${key}`+ useProxy && !key.toLowerCase().startsWith(CORS_PROXY.HEADER_PREFIX)+ ? `${CORS_PROXY.HEADER_PREFIX}${key}`: key;requestHeaders.set(proxiedKey, value);@@ -361,7 +361,7 @@ export class MCPService {{response: {durationMs,- headers: sanitizeHeaders(response.headers, undefined, MCP_PARTIAL_REDACT_HEADERS),+ headers: sanitizeHeaders(response.headers, undefined, HEADERS.PARTIAL_REDACT),status: response.status,statusText: response.statusText,url@@ -751,7 +751,7 @@ export class MCPService {headers: sanitizeHeaders(serverConfig.headers,Object.keys(serverConfig.headers ?? {}),- MCP_PARTIAL_REDACT_HEADERS+ HEADERS.PARTIAL_REDACT),serverName,transportType,diff --git a/tools/ui/src/lib/services/migration.service.ts b/tools/ui/src/lib/services/migration.service.tsindex ffe4bd8467..3dcbbed827 100644--- a/tools/ui/src/lib/services/migration.service.ts+++ b/tools/ui/src/lib/services/migration.service.ts@@ -22,12 +22,13 @@ import {DB_APP_NAME_DEPRECATED,IDXDB_STORES,IDXDB_TABLES,+ LEGACY_AGENTIC_REGEX,+ LEGACY_REASONING_TAGS,NEW_TO_DEPRECATED_MAP,+ SETTINGS_KEYS,STORAGE_APP_NAME,STORAGE_APP_NAME_DEPRECATED} from '$lib/constants';-import { LEGACY_AGENTIC_REGEX, LEGACY_REASONING_TAGS } from '$lib/constants/agentic';-import { SETTINGS_KEYS } from '$lib/constants/settings-keys';import { MessageRole } from '$lib/enums';import Dexie from 'dexie';diff --git a/tools/ui/src/lib/services/models.service.ts b/tools/ui/src/lib/services/models.service.tsindex 7399a3cc6e..9b37927bb6 100644--- a/tools/ui/src/lib/services/models.service.ts+++ b/tools/ui/src/lib/services/models.service.ts@@ -1,16 +1,4 @@-import {- API_MODELS,- MODEL_ACTIVATED_PARAMS_RE,- MODEL_CUSTOM_QUANTIZATION_PREFIX_RE,- MODEL_ID_NOT_FOUND,- MODEL_ID_ORG_SEPARATOR,- MODEL_ID_QUANTIZATION_SEPARATOR,- MODEL_ID_SEGMENT_SEPARATOR,- MODEL_IGNORED_SEGMENTS,- MODEL_PARAMS_RE,- MODEL_QUANTIZATION_SEGMENT_RE,- MODEL_WEIGHT_EXTENSION_RE-} from '$lib/constants';+import { API_MODELS, MODEL_ID } from '$lib/constants';import { ServerModelStatus } from '$lib/enums';import type { ParsedModelId } from '$lib/types/models';import { apiFetch, apiPost, normalizeModelName } from '$lib/utils';@@ -142,13 +130,13 @@ export class ModelsService {};// strip directory path and weight extension so a bare `-m /path/file.gguf`// parses like a clean repo id; the HF `org/model` form is preserved- const source = normalizeModelName(modelId).replace(MODEL_WEIGHT_EXTENSION_RE, '');+ const source = normalizeModelName(modelId).replace(MODEL_ID.WEIGHT_EXTENSION_RE, '');// 1. Extract colon-separated quantization (e.g. `model:Q4_K_M`)- const colonIdx = source.indexOf(MODEL_ID_QUANTIZATION_SEPARATOR);+ const colonIdx = source.indexOf(MODEL_ID.QUANTIZATION_SEPARATOR);let modelPath: string;- if (colonIdx !== MODEL_ID_NOT_FOUND) {+ if (colonIdx !== MODEL_ID.NOT_FOUND) {result.quantization = source.slice(colonIdx + 1) || null;modelPath = source.slice(0, colonIdx);} else {@@ -156,11 +144,11 @@ export class ModelsService {}// 2. Extract org name (e.g. `org/model` -> org = "org")- const slashIdx = modelPath.indexOf(MODEL_ID_ORG_SEPARATOR);+ const slashIdx = modelPath.indexOf(MODEL_ID.ORG_SEPARATOR);let modelStr: string;- if (slashIdx !== MODEL_ID_NOT_FOUND) {+ if (slashIdx !== MODEL_ID.NOT_FOUND) {result.orgName = modelPath.slice(0, slashIdx);modelStr = modelPath.slice(slashIdx + 1);} else {@@ -170,16 +158,16 @@ export class ModelsService {// 3. Handle dot-separated quantization (e.g. `model-name.Q4_K_M`)const dotIdx = modelStr.lastIndexOf('.');- if (dotIdx !== MODEL_ID_NOT_FOUND && !result.quantization) {+ if (dotIdx !== MODEL_ID.NOT_FOUND && !result.quantization) {const afterDot = modelStr.slice(dotIdx + 1);- if (MODEL_QUANTIZATION_SEGMENT_RE.test(afterDot)) {+ if (MODEL_ID.QUANTIZATION_SEGMENT_RE.test(afterDot)) {result.quantization = afterDot;modelStr = modelStr.slice(0, dotIdx);}}- const segments = modelStr.split(MODEL_ID_SEGMENT_SEPARATOR);+ const segments = modelStr.split(MODEL_ID.SEGMENT_SEPARATOR);// 4. Detect trailing quantization from dash-separated segments// Handle UD-prefixed quantization (e.g. `UD-Q8_K_XL`) and@@ -188,8 +176,8 @@ export class ModelsService {const last = segments[segments.length - 1];const secondLast = segments.length > 2 ? segments[segments.length - 2] : null;- if (MODEL_QUANTIZATION_SEGMENT_RE.test(last)) {- if (secondLast && MODEL_CUSTOM_QUANTIZATION_PREFIX_RE.test(secondLast)) {+ if (MODEL_ID.QUANTIZATION_SEGMENT_RE.test(last)) {+ if (secondLast && MODEL_ID.CUSTOM_QUANTIZATION_PREFIX_RE.test(secondLast)) {result.quantization = `${secondLast}-${last}`;segments.splice(segments.length - 2, 2);} else {@@ -200,33 +188,33 @@ export class ModelsService {}// 5. Find params and activated params- let paramsIdx = MODEL_ID_NOT_FOUND;- let activatedParamsIdx = MODEL_ID_NOT_FOUND;+ let paramsIdx = MODEL_ID.NOT_FOUND;+ let activatedParamsIdx = MODEL_ID.NOT_FOUND;for (let i = 0; i < segments.length; i++) {const seg = segments[i];- if (paramsIdx === MODEL_ID_NOT_FOUND && MODEL_PARAMS_RE.test(seg)) {+ if (paramsIdx === MODEL_ID.NOT_FOUND && MODEL_ID.PARAMS_RE.test(seg)) {paramsIdx = i;result.params = seg.toUpperCase();- } else if (paramsIdx !== MODEL_ID_NOT_FOUND && MODEL_ACTIVATED_PARAMS_RE.test(seg)) {+ } else if (paramsIdx !== MODEL_ID.NOT_FOUND && MODEL_ID.ACTIVATED_PARAMS_RE.test(seg)) {activatedParamsIdx = i;result.activatedParams = seg.toUpperCase();}}// 6. Model name = segments before params; tags = remaining segments after params- const pivotIdx = paramsIdx !== MODEL_ID_NOT_FOUND ? paramsIdx : segments.length;+ const pivotIdx = paramsIdx !== MODEL_ID.NOT_FOUND ? paramsIdx : segments.length;- result.modelName = segments.slice(0, pivotIdx).join(MODEL_ID_SEGMENT_SEPARATOR) || null;+ result.modelName = segments.slice(0, pivotIdx).join(MODEL_ID.SEGMENT_SEPARATOR) || null;- if (paramsIdx !== MODEL_ID_NOT_FOUND) {+ if (paramsIdx !== MODEL_ID.NOT_FOUND) {result.tags = segments.slice(paramsIdx + 1).filter((_, relIdx) => {const absIdx = paramsIdx + 1 + relIdx;if (absIdx === activatedParamsIdx) return false;- return !MODEL_IGNORED_SEGMENTS.has(segments[absIdx].toUpperCase());+ return !MODEL_ID.IGNORED_SEGMENTS.has(segments[absIdx].toUpperCase());});}diff --git a/tools/ui/src/lib/services/router.service.ts b/tools/ui/src/lib/services/router.service.tsindex 6fa172eec2..59de4cb6fe 100644--- a/tools/ui/src/lib/services/router.service.ts+++ b/tools/ui/src/lib/services/router.service.ts@@ -1,4 +1,4 @@-import { ROUTES } from '$lib/constants/routes';+import { ROUTES } from '$lib/constants';export class RouterService {static chat(id: string): string {diff --git a/tools/ui/src/lib/services/tools.service.ts b/tools/ui/src/lib/services/tools.service.tsindex 9cb5ecb46d..f100b74f93 100644--- a/tools/ui/src/lib/services/tools.service.ts+++ b/tools/ui/src/lib/services/tools.service.ts@@ -1,5 +1,5 @@import { base } from '$app/paths';-import { API_TOOLS, X_RESP_TYPE_HEADER, X_TOOL_CWD_HEADER } from '$lib/constants';+import { API_TOOLS, HEADERS } from '$lib/constants';import { ToolResponseField } from '$lib/enums';import type { ServerBuiltinToolInfo, ToolExecutionResult } from '$lib/types';import { apiFetch } from '$lib/utils';@@ -31,7 +31,7 @@ export class ToolsService {): Promise<ToolExecutionResult> {const result = await apiFetch<Record<string, unknown>>(API_TOOLS.EXECUTE, {body: JSON.stringify({ params, tool: toolName }),- headers: cwd ? { [X_TOOL_CWD_HEADER]: cwd } : undefined,+ headers: cwd ? { [HEADERS.X_TOOL_CWD_HEADER]: cwd } : undefined,method: 'POST',signal});@@ -64,9 +64,9 @@ export class ToolsService {): Promise<Record<string, unknown>> {const headers: Record<string, string> = {};- if (cwd) headers[X_TOOL_CWD_HEADER] = cwd;+ if (cwd) headers[HEADERS.X_TOOL_CWD_HEADER] = cwd;- if (respType) headers[X_RESP_TYPE_HEADER] = respType;+ if (respType) headers[HEADERS.X_RESP_TYPE_HEADER] = respType;return apiFetch<Record<string, unknown>>(API_TOOLS.EXECUTE, {body: JSON.stringify({ params, tool: toolName }),@@ -99,7 +99,7 @@ export class ToolsService {): AsyncGenerator<ToolStreamEvent> {const headers = getJsonHeaders();- if (cwd) headers[X_TOOL_CWD_HEADER] = cwd;+ if (cwd) headers[HEADERS.X_TOOL_CWD_HEADER] = cwd;const response = await fetch(`${base}${API_TOOLS.EXECUTE}`, {body: JSON.stringify({ params, stream: true, tool: toolName }),diff --git a/tools/ui/src/lib/stores/agentic.svelte.ts b/tools/ui/src/lib/stores/agentic.svelte.tsindex a84fa34dc2..cba3b586fa 100644--- a/tools/ui/src/lib/stores/agentic.svelte.ts+++ b/tools/ui/src/lib/stores/agentic.svelte.ts@@ -27,7 +27,8 @@ import {DEFAULT_AUDIO_EXTENSION,DEFAULT_IMAGE_EXTENSION,IMAGE_MIME_TO_EXTENSION,- MCP_ATTACHMENT_NAME_PREFIX+ MCP_ATTACHMENT_NAME_PREFIX,+ MIME_TYPE_PREFIXES} from '$lib/constants';import { BuiltInTool, ToolPermissionDecision, ToolSource } from '$lib/enums';import {@@ -1122,7 +1123,7 @@ class AgenticStore {attachmentIndex += 1;const name = this.buildAttachmentName(mimeType, attachmentIndex);- if (mimeType.startsWith(MimeTypePrefix.IMAGE)) {+ if (mimeType.startsWith(MIME_TYPE_PREFIXES.IMAGE)) {attachments.push({ base64Url: trimmedLine, name, type: AttachmentType.IMAGE });return `[Attachment saved: ${name}]`;diff --git a/tools/ui/src/lib/stores/chat.svelte.ts b/tools/ui/src/lib/stores/chat.svelte.tsindex edbb8e621b..3965c4cbb5 100644--- a/tools/ui/src/lib/stores/chat.svelte.ts+++ b/tools/ui/src/lib/stores/chat.svelte.ts@@ -11,14 +11,14 @@* @see ChatService in services/chat.service.ts for API operations*/-import { CONTENT_TYPE_HEADER } from '$lib/constants';import {- INACTIVE_CONVERSATION_STATE_MAX_AGE_MS,- MAX_INACTIVE_CONVERSATION_STATES,+ CONVERSATION_ID_SEPARATOR,+ HEADERS,+ INACTIVE_CONVERSATION,+ STREAM_RESUME_RETRY_MS,SYSTEM_MESSAGE_PLACEHOLDER,TITLE_GENERATION} from '$lib/constants';-import { STREAM_RESUME_RETRY_MS } from '$lib/constants/api-endpoints';import { MimeTypeApplication } from '$lib/enums';import {ContinueIntentKind,@@ -234,7 +234,7 @@ class ChatStore {// POST the one conv id we are probinglistResp = await fetch(`./v1/streams/lookup`, {body: JSON.stringify({ conversation_ids: [convId] }),- headers: { ...getAuthHeaders(), [CONTENT_TYPE_HEADER]: MimeTypeApplication.JSON },+ headers: { ...getAuthHeaders(), [HEADERS.CONTENT_TYPE]: MimeTypeApplication.JSON },method: 'POST'});} catch (e) {@@ -414,7 +414,7 @@ class ChatStore {// extract the model suffix, the resume calls in handleStreamResponse must reuse the model// the session was tagged with, not the live dropdown- const sepIdx = id.indexOf('::');+ const sepIdx = id.indexOf(CONVERSATION_ID_SEPARATOR);const attachedModel: string | null = sepIdx === -1 ? null : id.slice(sepIdx + 2);this.setChatStreaming(convId, existingContent, targetMessageId, attachedModel);@@ -808,7 +808,7 @@ class ChatStore {try {const resp = await fetch('./v1/streams/lookup', {body: JSON.stringify({ conversation_ids: lookupIds }),- headers: { ...getAuthHeaders(), [CONTENT_TYPE_HEADER]: MimeTypeApplication.JSON },+ headers: { ...getAuthHeaders(), [HEADERS.CONTENT_TYPE]: MimeTypeApplication.JSON },method: 'POST'});@@ -829,7 +829,7 @@ class ChatStore {for (const s of sessions) {if (s && !s.is_done && typeof s.conversation_id === 'string' && s.conversation_id) {// strip the optional ::model suffix, the sidebar set is keyed by the bare conv id- const sepIdx = s.conversation_id.indexOf('::');+ const sepIdx = s.conversation_id.indexOf(CONVERSATION_ID_SEPARATOR);const bareId = sepIdx === -1 ? s.conversation_id : s.conversation_id.slice(0, sepIdx);running.add(bareId);@@ -930,8 +930,8 @@ class ChatStore {for (const { convId, lastAccessed } of cleanupCandidates) {if (- cleanupCandidates.length - cleanedUp > MAX_INACTIVE_CONVERSATION_STATES ||- now - lastAccessed > INACTIVE_CONVERSATION_STATE_MAX_AGE_MS+ cleanupCandidates.length - cleanedUp > INACTIVE_CONVERSATION.MAX_STATES ||+ now - lastAccessed > INACTIVE_CONVERSATION.MAX_AGE_MS) {this.cleanupConversationState(convId);cleanedUp++;diff --git a/tools/ui/src/lib/stores/conversations.svelte.ts b/tools/ui/src/lib/stores/conversations.svelte.tsindex b1fcac4bed..54613a2701 100644--- a/tools/ui/src/lib/stores/conversations.svelte.ts+++ b/tools/ui/src/lib/stores/conversations.svelte.ts@@ -21,22 +21,12 @@import { browser } from '$app/environment';import { goto } from '$app/navigation';import {- EXPORT_CONV_ID_TRIM_LENGTH,- EXPORT_CONV_NAME_SUFFIX_MAX_LENGTH,- EXPORT_CONV_NONALNUM_REPLACEMENT,- ISO_DATE_TIME_SEPARATOR,- ISO_DATE_TIME_SEPARATOR_REPLACEMENT,- ISO_TIME_SEPARATOR,- ISO_TIME_SEPARATOR_REPLACEMENT,- ISO_TIMESTAMP_SLICE_LENGTH,- MULTIPLE_UNDERSCORE_REGEX,+ EXPORT_CONV,NEWLINE,- NON_ALPHANUMERIC_REGEX,REASONING_EFFORT_DEFAULT_LOCALSTORAGE_KEY,- SESSION_HARNESS,+ ROUTES,ZIP_MAGIC} from '$lib/constants';-import { ROUTES } from '$lib/constants/routes';import {FileExtensionText,MessageRole,@@ -1002,18 +992,18 @@ class ConversationsStore {): string {const conversationName = (conversation.name ?? '').trim().toLowerCase();const sanitizedName = conversationName- .replace(NON_ALPHANUMERIC_REGEX, EXPORT_CONV_NONALNUM_REPLACEMENT)- .replace(MULTIPLE_UNDERSCORE_REGEX, '_')- .substring(0, EXPORT_CONV_NAME_SUFFIX_MAX_LENGTH);+ .replace(EXPORT_CONV.NON_ALPHANUMERIC_REGEX, EXPORT_CONV.NONALNUM_REPLACEMENT)+ .replace(EXPORT_CONV.MULTIPLE_UNDERSCORE_REGEX, '_')+ .substring(0, EXPORT_CONV.NAME_SUFFIX_MAX_LENGTH);// If we have messages, use the timestamp of the newest messageconst referenceDate = msgs?.length? new Date(Math.max(...msgs.map((m) => m.timestamp))): new Date();- const iso = referenceDate.toISOString().slice(0, ISO_TIMESTAMP_SLICE_LENGTH);+ const iso = referenceDate.toISOString().slice(0, EXPORT_CONV.ISO_TIMESTAMP_SLICE);const formattedDate = iso- .replace(ISO_DATE_TIME_SEPARATOR, ISO_DATE_TIME_SEPARATOR_REPLACEMENT)- .replaceAll(ISO_TIME_SEPARATOR, ISO_TIME_SEPARATOR_REPLACEMENT);- const trimmedConvId = conversation.id?.slice(0, EXPORT_CONV_ID_TRIM_LENGTH) ?? '';+ .replace(EXPORT_CONV.ISO_DATE_TIME_SEPARATOR, EXPORT_CONV.ISO_DATE_TIME_SEPARATOR_REPLACEMENT)+ .replaceAll(EXPORT_CONV.ISO_TIME_SEPARATOR, EXPORT_CONV.ISO_TIME_SEPARATOR_REPLACEMENT);+ const trimmedConvId = conversation.id?.slice(0, EXPORT_CONV.ID_TRIM_LENGTH) ?? '';return `${formattedDate}_conv_${trimmedConvId}_${sanitizedName}${FileExtensionText.JSONL}`;}@@ -1028,7 +1018,7 @@ class ConversationsStore {serializeSessionToJsonl(data: ExportedConversation): string {const { conv, messages } = data;const sessionLine = JSON.stringify({- harness: SESSION_HARNESS,+ harness: EXPORT_CONV.HARNESS,type: SessionRecordType.SESSION,...conv});@@ -1209,7 +1199,7 @@ class ConversationsStore {files[entryName] = strToU8(this.serializeSessionToJsonl(session));}- const archiveName = `${new Date().toISOString().split(ISO_DATE_TIME_SEPARATOR)[0]}_conversations${FileExtensionText.ZIP}`;+ const archiveName = `${new Date().toISOString().split(EXPORT_CONV.ISO_DATE_TIME_SEPARATOR)[0]}_conversations${FileExtensionText.ZIP}`;const zipped = zipSync(files);const blob = new Blob([zipped], { type: MimeTypeApplication.ZIP });diff --git a/tools/ui/src/lib/stores/mcp-resources.svelte.ts b/tools/ui/src/lib/stores/mcp-resources.svelte.tsindex 6f0f8d7c80..1002c476e5 100644--- a/tools/ui/src/lib/stores/mcp-resources.svelte.ts+++ b/tools/ui/src/lib/stores/mcp-resources.svelte.ts@@ -13,8 +13,7 @@import {BINARY_CONTENT_LABEL,MCP_RESOURCE_ATTACHMENT_ID_PREFIX,- MCP_RESOURCE_CACHE_MAX_ENTRIES,- MCP_RESOURCE_CACHE_TTL_MS,+ MCP_RESOURCE_CACHE,NEWLINE,RESOURCE_UNKNOWN_TYPE} from '$lib/constants';@@ -251,7 +250,7 @@ class MCPResourceStore {*/cacheResourceContent(resource: MCPResourceInfo, content: MCPResourceContent[]): void {// Enforce cache size limit- if (this._cachedResources.size >= MCP_RESOURCE_CACHE_MAX_ENTRIES) {+ if (this._cachedResources.size >= MCP_RESOURCE_CACHE.MAX_ENTRIES) {// Remove oldest entryconst oldestKey = this._cachedResources.keys().next().value;@@ -280,7 +279,7 @@ class MCPResourceStore {// Check if cache is still validconst age = Date.now() - cached.fetchedAt.getTime();- if (age > MCP_RESOURCE_CACHE_TTL_MS && !cached.subscribed) {+ if (age > MCP_RESOURCE_CACHE.TTL_MS && !cached.subscribed) {// Cache expired and not subscribed, remove itthis._cachedResources.delete(uri);diff --git a/tools/ui/src/lib/stores/mcp.svelte.ts b/tools/ui/src/lib/stores/mcp.svelte.tsindex 4582caf5ce..0b669f88b3 100644--- a/tools/ui/src/lib/stores/mcp.svelte.ts+++ b/tools/ui/src/lib/stores/mcp.svelte.ts@@ -26,14 +26,11 @@ import type { ListChangedHandlers } from '@modelcontextprotocol/sdk/types.js';import { browser } from '$app/environment';import { SETTINGS_KEYS } from '$lib/constants';import {- DEFAULT_CACHE_TTL_MS,+ CACHE,DEFAULT_MCP_CONFIG,EXPECTED_THEMED_ICON_PAIR_COUNT,MCP_ALLOWED_ICON_MIME_TYPES,- MCP_RECONNECT_ATTEMPT_TIMEOUT_MS,- MCP_RECONNECT_BACKOFF_MULTIPLIER,- MCP_RECONNECT_INITIAL_DELAY,- MCP_RECONNECT_MAX_DELAY,+ MCP_RECONNECT,MCP_SERVER_ID_PREFIX} from '$lib/constants';import {@@ -917,7 +914,7 @@ class MCPStore {}this.reconnectingServers.add(serverName);- let backoff = MCP_RECONNECT_INITIAL_DELAY;+ let backoff = MCP_RECONNECT.INITIAL_DELAY;// Flag set by the phase callback when a DISCONNECTED event fires while// reconnectingServers still holds this server (see JSDoc above).let needsReconnect = false;@@ -936,10 +933,10 @@ class MCPStore {() =>reject(new Error(- `Reconnect attempt timed out after ${MCP_RECONNECT_ATTEMPT_TIMEOUT_MS}ms`+ `Reconnect attempt timed out after ${MCP_RECONNECT.ATTEMPT_TIMEOUT_MS}ms`)),- MCP_RECONNECT_ATTEMPT_TIMEOUT_MS+ MCP_RECONNECT.ATTEMPT_TIMEOUT_MS));@@ -980,7 +977,7 @@ class MCPStore {break;} catch (error) {console.warn(`[MCPStore][${serverName}] Reconnection failed:`, error);- backoff = Math.min(backoff * MCP_RECONNECT_BACKOFF_MULTIPLIER, MCP_RECONNECT_MAX_DELAY);+ backoff = Math.min(backoff * MCP_RECONNECT.BACKOFF_MULTIPLIER, MCP_RECONNECT.MAX_DELAY);}}} finally {@@ -1737,7 +1734,7 @@ class MCPStore {// Cache is valid for 5 minutesconst age = Date.now() - serverRes.lastFetched.getTime();- return age < DEFAULT_CACHE_TTL_MS;+ return age < CACHE.DEFAULT_TTL_MS;});if (allServersCached) {diff --git a/tools/ui/src/lib/stores/models.svelte.ts b/tools/ui/src/lib/stores/models.svelte.tsindex 150fb3800f..b2be636c51 100644--- a/tools/ui/src/lib/stores/models.svelte.ts+++ b/tools/ui/src/lib/stores/models.svelte.ts@@ -2,8 +2,7 @@ import { base } from '$app/paths';import {API_MODELS,FAVORITE_MODELS_LOCALSTORAGE_KEY,- MODEL_PROPS_CACHE_MAX_ENTRIES,- MODEL_PROPS_CACHE_TTL_MS,+ MODEL_PROPS_CACHE,SSE_DATA_PREFIX,SSE_LINE_SEPARATOR,SSE_RECORD_SEPARATOR@@ -84,8 +83,8 @@ class ModelsStore {* TTL: 10 minutes — props don't change frequently.*/private modelPropsCache = new TTLCache<string, ApiLlamaCppServerProps>({- maxEntries: MODEL_PROPS_CACHE_MAX_ENTRIES,- ttlMs: MODEL_PROPS_CACHE_TTL_MS+ maxEntries: MODEL_PROPS_CACHE.MAX_ENTRIES,+ ttlMs: MODEL_PROPS_CACHE.TTL_MS});private modelPropsFetching = $state<Set<string>>(new Set());diff --git a/tools/ui/src/lib/stores/tools.svelte.ts b/tools/ui/src/lib/stores/tools.svelte.tsindex 3984dd2bc8..ff276d95ba 100644--- a/tools/ui/src/lib/stores/tools.svelte.ts+++ b/tools/ui/src/lib/stores/tools.svelte.ts@@ -1,6 +1,5 @@import {buildReadMediaToolDefinition,- buildSandboxToolDefinition,DISABLED_TOOL_KEYS_LOCALSTORAGE_KEY,HOME_TILDE,TOOL_GROUP_LABELS,@@ -19,6 +18,7 @@ import { mcpStore } from '$lib/stores/mcp.svelte';import { modelsStore, selectedModelName } from '$lib/stores/models.svelte';import { config } from '$lib/stores/settings.svelte';import type { OpenAIToolDefinition, ToolEntry, ToolGroup } from '$lib/types';+import { buildSandboxToolDefinition } from '$lib/utils';import { SvelteMap, SvelteSet } from 'svelte/reactivity';/** Stable selection identity for a tool, shared by the disabled set and the permission store */diff --git a/tools/ui/src/lib/stores/viewport.svelte.ts b/tools/ui/src/lib/stores/viewport.svelte.tsindex dac241a012..fee8db4acb 100644--- a/tools/ui/src/lib/stores/viewport.svelte.ts+++ b/tools/ui/src/lib/stores/viewport.svelte.ts@@ -1,5 +1,5 @@import { browser } from '$app/environment';-import { DEFAULT_MOBILE_BREAKPOINT } from '$lib/constants/viewport';+import { DEFAULT_MOBILE_BREAKPOINT } from '$lib/constants';import { MediaQuery } from 'svelte/reactivity';export const viewport = $state({diff --git a/tools/ui/src/lib/types/chat.d.ts b/tools/ui/src/lib/types/chat.d.tsindex 2da0439057..cb93e77951 100644--- a/tools/ui/src/lib/types/chat.d.ts+++ b/tools/ui/src/lib/types/chat.d.ts@@ -1,6 +1,39 @@import type { ApiChatCompletionToolCall } from './api';import type { DatabaseMessage, DatabaseMessageExtra } from './database';-import type { ChatFormCommandAction, ErrorDialogType, FileMentionEntryType } from '$lib/enums';+import type {+ AttachmentAction,+ AttachmentItemEnabledWhen,+ AttachmentItemVisibleWhen,+ AttachmentMenuItemId,+ ChatFormCommandAction,+ ErrorDialogType,+ FileMentionEntryType+} from '$lib/enums';+import type { Component } from 'svelte';++/**+ * A single item in the chat form attachment menu.+ */+export interface AttachmentMenuItem {+ /** Unique identifier for the item */+ id: AttachmentMenuItemId;+ /** Display label */+ label: string;+ /** Lucide icon component */+ icon: Component;+ /** Extra CSS class applied to the item (e.g. for test selectors) */+ class?: string;+ /** Whether the item requires a specific modality to be enabled */+ enabledWhen?: AttachmentItemEnabledWhen;+ /** Tooltip shown when the item is disabled */+ disabledTooltip?: string;+ /** Callback key on the Props interface to invoke when clicked */+ action: AttachmentAction;+ /** Whether the item is only shown when a specific capability is present */+ visibleWhen?: AttachmentItemVisibleWhen;+ /** Whether this item has a tooltip even when enabled (uses dynamic text) */+ hasEnabledTooltip?: boolean;+}export interface ChatUploadedFile {id: string;@@ -182,6 +215,18 @@ export interface FileMentionEntry {* command whose backing capability is unavailable (e.g. `/prompt` when no* MCP server exposes prompts): visible but greyed out and not selectable.*/+export interface ChatCommandsOptions {+ /** Gates `/model`. */+ showModelSelector: boolean;+ /** Gates `/prompt`. */+ hasPrompts: () => boolean;+ /** Gates `/cwd`. */+ hasCwdTools: () => boolean;+}++/** Protocol-level verbs accepted by the realtime inference control endpoint. Mirrors `CONTROL_ACTION`. */+export type ControlAction = 'reasoning_end';+export interface ChatFormCommand {name: string;description: string;diff --git a/tools/ui/src/lib/types/index.ts b/tools/ui/src/lib/types/index.tsindex dbe0fa823d..a7e755040c 100644--- a/tools/ui/src/lib/types/index.ts+++ b/tools/ui/src/lib/types/index.ts@@ -40,6 +40,7 @@ export type {// Chat typesexport type {+ AttachmentMenuItem,ChatUploadedFile,ChatAttachmentDisplayItem,ChatMessageSiblingInfo,@@ -55,7 +56,9 @@ export type {AttachmentDisplayItemsOptions,FileProcessingResult,FileMentionEntry,- ChatFormCommand+ ChatFormCommand,+ ChatCommandsOptions,+ ControlAction} from './chat.d';// Database types@@ -174,8 +177,11 @@ export type {SteeringMessage} from './agentic';+// Navigation types+export type { DesktopIconStripItem } from './navigation';+// Tools types-export type { ToolEntry, ToolGroup } from './tools';+export type { ToolEntry, ToolGroup, BuiltinToolUiEntry } from './tools';// Reasoningexport type { ReasoningEffortLevel } from './reasoning';diff --git a/tools/ui/src/lib/types/navigation.d.ts b/tools/ui/src/lib/types/navigation.d.tsnew file mode 100644index 0000000000..357e060dc7--- /dev/null+++ b/tools/ui/src/lib/types/navigation.d.ts@@ -0,0 +1,14 @@+import type { Component } from 'svelte';++/**+ * A single clickable action in the desktop sidebar icon strip.+ */+export interface DesktopIconStripItem {+ icon: Component;+ tooltip: string;+ route?: string;+ activeRouteId?: string;+ activeRoutePrefix?: string;+ activeUrlIncludes?: string;+ keys?: string[];+}diff --git a/tools/ui/src/lib/types/tools.d.ts b/tools/ui/src/lib/types/tools.d.tsindex 95b6256a51..39e6fc5799 100644--- a/tools/ui/src/lib/types/tools.d.ts+++ b/tools/ui/src/lib/types/tools.d.ts@@ -1,5 +1,15 @@import type { OpenAIToolDefinition } from './mcp';import type { ToolSource } from '$lib/enums';+import type { Component } from 'svelte';++/**+ * UI metadata for a built-in or frontend tool, keyed by its `BuiltInTool` id.+ */+export interface BuiltinToolUiEntry {+ icon: Component;+ label: string;+ source: ToolSource.BUILTIN | ToolSource.FRONTEND;+}export interface ToolEntry {source: ToolSource;diff --git a/tools/ui/src/lib/utils/agentic.ts b/tools/ui/src/lib/utils/agentic.tsindex b2dd2cd9ed..2be4dc7147 100644--- a/tools/ui/src/lib/utils/agentic.ts+++ b/tools/ui/src/lib/utils/agentic.ts@@ -1,17 +1,9 @@import {ATTACHMENT_SAVED_REGEX,- MARKDOWN_ATX_HEADING_REGEX,- MARKDOWN_BLOCKQUOTE_REGEX,- MARKDOWN_BOLD_REGEX,- MARKDOWN_CODE_FENCE_REGEX,- MARKDOWN_LINK_REGEX,- MARKDOWN_LIST_BULLET_REGEX,- MARKDOWN_LIST_NUMBERED_REGEX,- MARKDOWN_TABLE_SEPARATOR_REGEX,+ MARKDOWN,NEWLINE,REASONING_TAGS,- SEARCH_SUMMARY_SEPARATOR,- SEARCH_SUMMARY_TOTAL_REGEX,+ SEARCH_SUMMARY,TOOL_RESULT_JSON_OPEN_REGEX} from '$lib/constants';import {@@ -283,11 +275,11 @@ export function splitSearchSummaryList(text: string,captureTotal: (n: number) => void): { lines: string[] } {- const separatorIndex = text.indexOf(SEARCH_SUMMARY_SEPARATOR);+ const separatorIndex = text.indexOf(SEARCH_SUMMARY.SEPARATOR);const matchesText = separatorIndex === -1 ? text : text.slice(0, separatorIndex);const summaryText =- separatorIndex === -1 ? '' : text.slice(separatorIndex + SEARCH_SUMMARY_SEPARATOR.length);- const totalMatch = summaryText.match(SEARCH_SUMMARY_TOTAL_REGEX);+ separatorIndex === -1 ? '' : text.slice(separatorIndex + SEARCH_SUMMARY.SEPARATOR.length);+ const totalMatch = summaryText.match(SEARCH_SUMMARY.TOTAL_REGEX);if (totalMatch) {captureTotal(parseInt(totalMatch[1], 10));@@ -412,31 +404,31 @@ export function classifyToolResult(content: string | undefined): ToolResultKind*/function looksLikeMarkdown(content: string): boolean {// Code fences are unambiguous - triple backticks or tildes at line start.- if (MARKDOWN_CODE_FENCE_REGEX.test(content)) return true;+ if (MARKDOWN.CODE_FENCE_REGEX.test(content)) return true;const lines = content.split(NEWLINE);for (const line of lines) {- if (MARKDOWN_ATX_HEADING_REGEX.test(line)) return true;+ if (MARKDOWN.ATX_HEADING_REGEX.test(line)) return true;- if (MARKDOWN_BLOCKQUOTE_REGEX.test(line)) return true;+ if (MARKDOWN.BLOCKQUOTE_REGEX.test(line)) return true;- if (MARKDOWN_LIST_BULLET_REGEX.test(line)) return true;+ if (MARKDOWN.LIST_BULLET_REGEX.test(line)) return true;- if (MARKDOWN_LIST_NUMBERED_REGEX.test(line)) return true;+ if (MARKDOWN.LIST_NUMBERED_REGEX.test(line)) return true;}// Inline structural markers anywhere in the body.- if (MARKDOWN_LINK_REGEX.test(content)) return true;+ if (MARKDOWN.LINK_REGEX.test(content)) return true;- if (MARKDOWN_BOLD_REGEX.test(content)) return true;+ if (MARKDOWN.BOLD_REGEX.test(content)) return true;// Tables: a pipe-bearing header line followed by a separator row.if (lines.length >= 2) {const head = lines[0];const sep = lines[1];- if (head.includes('|') && MARKDOWN_TABLE_SEPARATOR_REGEX.test(sep)) return true;+ if (head.includes('|') && MARKDOWN.TABLE_SEPARATOR_REGEX.test(sep)) return true;}return false;diff --git a/tools/ui/src/lib/utils/api-fetch.ts b/tools/ui/src/lib/utils/api-fetch.tsindex 7c3b9a9d23..65e1129def 100644--- a/tools/ui/src/lib/utils/api-fetch.ts+++ b/tools/ui/src/lib/utils/api-fetch.ts@@ -1,6 +1,6 @@import { getAuthHeaders, getJsonHeaders } from './api-headers';import { base } from '$app/paths';-import { ERROR_MESSAGES, HTTP_CODE_TO_STRING } from '$lib/constants/error';+import { ERROR_MESSAGES, HTTP_CODE_TO_STRING } from '$lib/constants';import { UrlProtocol } from '$lib/enums';/**diff --git a/tools/ui/src/lib/utils/api-headers.ts b/tools/ui/src/lib/utils/api-headers.tsindex 16823de011..0038e6f3cb 100644--- a/tools/ui/src/lib/utils/api-headers.ts+++ b/tools/ui/src/lib/utils/api-headers.ts@@ -1,11 +1,5 @@import { redactValue } from './redact';-import {- AUTHORIZATION_HEADER,- BEARER_PREFIX,- CONTENT_TYPE_HEADER,- CORS_PROXY_HEADER_PREFIX,- REDACTED_HEADERS-} from '$lib/constants';+import { CORS_PROXY, HEADERS } from '$lib/constants';import { MimeTypeApplication } from '$lib/enums';import { config } from '$lib/stores/settings.svelte';@@ -17,7 +11,7 @@ export function getAuthHeaders(): Record<string, string> {const currentConfig = config();const apiKey = currentConfig.apiKey?.toString().trim();- return apiKey ? { [AUTHORIZATION_HEADER]: `${BEARER_PREFIX}${apiKey}` } : {};+ return apiKey ? { [HEADERS.AUTHORIZATION]: `${HEADERS.BEARER}${apiKey}` } : {};}/**@@ -25,14 +19,14 @@ export function getAuthHeaders(): Record<string, string> {*/export function getJsonHeaders(): Record<string, string> {return {- [CONTENT_TYPE_HEADER]: MimeTypeApplication.JSON,+ [HEADERS.CONTENT_TYPE]: MimeTypeApplication.JSON,...getAuthHeaders()};}/*** Sanitize HTTP headers by redacting sensitive values.- * Known sensitive headers (from REDACTED_HEADERS) and any extra headers+ * Known sensitive headers (from HEADERS.REDACTED) and any extra headers* specified by the caller are fully redacted. Headers listed in* `partialRedactHeaders` are partially redacted, showing only the* specified number of trailing characters.@@ -59,8 +53,8 @@ export function sanitizeHeaders(for (const [key, value] of normalized.entries()) {const normalizedKey = key.toLowerCase();- const unproxiedKey = normalizedKey.startsWith(CORS_PROXY_HEADER_PREFIX)- ? normalizedKey.slice(CORS_PROXY_HEADER_PREFIX.length)+ const unproxiedKey = normalizedKey.startsWith(CORS_PROXY.HEADER_PREFIX)+ ? normalizedKey.slice(CORS_PROXY.HEADER_PREFIX.length): normalizedKey;const partialChars =partialRedactHeaders?.get(normalizedKey) ?? partialRedactHeaders?.get(unproxiedKey);@@ -68,8 +62,8 @@ export function sanitizeHeaders(if (partialChars !== undefined) {sanitized[key] = redactValue(value, partialChars);} else if (- REDACTED_HEADERS.has(normalizedKey) ||- REDACTED_HEADERS.has(unproxiedKey) ||+ HEADERS.REDACTED.has(normalizedKey) ||+ HEADERS.REDACTED.has(unproxiedKey) ||redactedHeaders.has(normalizedKey) ||redactedHeaders.has(unproxiedKey)) {diff --git a/tools/ui/src/lib/utils/api-key-validation.ts b/tools/ui/src/lib/utils/api-key-validation.tsindex 7b087ba9ad..7724bb4f52 100644--- a/tools/ui/src/lib/utils/api-key-validation.ts+++ b/tools/ui/src/lib/utils/api-key-validation.ts@@ -1,7 +1,7 @@import { error } from '@sveltejs/kit';import { browser } from '$app/environment';import { base } from '$app/paths';-import { AUTHORIZATION_HEADER, BEARER_PREFIX, CONTENT_TYPE_HEADER } from '$lib/constants';+import { HEADERS } from '$lib/constants';import { MimeTypeApplication } from '$lib/enums';import { config } from '$lib/stores/settings.svelte';@@ -18,14 +18,14 @@ export async function validateApiKey(fetch: typeof globalThis.fetch): Promise<votry {const headers: Record<string, string> = {- [CONTENT_TYPE_HEADER]: MimeTypeApplication.JSON+ [HEADERS.CONTENT_TYPE]: MimeTypeApplication.JSON};// Probe /props even without a stored key: on a server started with// --api-key the unauthenticated request returns 401 and surfaces the// API key splash, which is the onboarding path for entering the key.if (apiKey) {- headers[AUTHORIZATION_HEADER] = `${BEARER_PREFIX}${apiKey}`;+ headers[HEADERS.AUTHORIZATION] = `${HEADERS.BEARER}${apiKey}`;}const response = await fetch(`${base}/props`, { headers });diff --git a/tools/ui/src/lib/utils/built-in-tools.ts b/tools/ui/src/lib/utils/built-in-tools.tsnew file mode 100644index 0000000000..73b5547900--- /dev/null+++ b/tools/ui/src/lib/utils/built-in-tools.ts@@ -0,0 +1,13 @@+import { BUILTIN_TOOL_UI } from '$lib/constants';+import type { BuiltinToolUiEntry } from '$lib/types';++/**+ * Resolve the UI metadata (label + icon) for a built-in tool by its name.+ * Falls back to null for unknown or non-built-in tools so callers can render+ * a generic chrome instead.+ */+export function getBuiltinToolUi(toolName: string | undefined): BuiltinToolUiEntry | null {+ if (!toolName) return null;++ return (BUILTIN_TOOL_UI as Record<string, BuiltinToolUiEntry>)[toolName] ?? null;+}diff --git a/tools/ui/src/lib/utils/cache-ttl.ts b/tools/ui/src/lib/utils/cache-ttl.tsindex 2f5b2494d0..bb0100755b 100644--- a/tools/ui/src/lib/utils/cache-ttl.ts+++ b/tools/ui/src/lib/utils/cache-ttl.ts@@ -1,4 +1,4 @@-import { DEFAULT_CACHE_MAX_ENTRIES, DEFAULT_CACHE_TTL_MS } from '$lib/constants';+import { CACHE } from '$lib/constants';/*** TTL Cache - Time-To-Live cache implementation for memory optimization@@ -36,8 +36,8 @@ export class TTLCache<K extends string, V> {private readonly onEvict?: (key: string, value: unknown) => void;constructor(options: TTLCacheOptions = {}) {- this.ttlMs = options.ttlMs ?? DEFAULT_CACHE_TTL_MS;- this.maxEntries = options.maxEntries ?? DEFAULT_CACHE_MAX_ENTRIES;+ this.ttlMs = options.ttlMs ?? CACHE.DEFAULT_TTL_MS;+ this.maxEntries = options.maxEntries ?? CACHE.DEFAULT_MAX_ENTRIES;this.onEvict = options.onEvict;}@@ -217,8 +217,8 @@ export class ReactiveTTLMap<K extends string, V> {private readonly maxEntries: number;constructor(options: TTLCacheOptions = {}) {- this.ttlMs = options.ttlMs ?? DEFAULT_CACHE_TTL_MS;- this.maxEntries = options.maxEntries ?? DEFAULT_CACHE_MAX_ENTRIES;+ this.ttlMs = options.ttlMs ?? CACHE.DEFAULT_TTL_MS;+ this.maxEntries = options.maxEntries ?? CACHE.DEFAULT_MAX_ENTRIES;}get(key: K): V | null {diff --git a/tools/ui/src/lib/utils/cap-img-size.ts b/tools/ui/src/lib/utils/cap-img-size.tsindex c4aa4d597c..6878bc1ad8 100644--- a/tools/ui/src/lib/utils/cap-img-size.ts+++ b/tools/ui/src/lib/utils/cap-img-size.ts@@ -1,6 +1,5 @@import { getJpegOrientationFromDataURL, isJpegMimeType } from './jpeg-orientation';-import { MEGAPIXELS_TO_PIXELS } from '$lib/constants/image-size';-import { BASE64_IMAGE_URI_REGEX } from '$lib/constants/uri-template';+import { BASE64_IMAGE_URI_REGEX, IMAGE } from '$lib/constants';import { MimeTypeImage } from '$lib/enums';/**@@ -51,7 +50,7 @@ export function capImageDataURLSize(const targetWidth = img.naturalWidth;const targetHeight = img.naturalHeight;const totalPixels = targetWidth * targetHeight;- const maxPixels = Math.floor(maxMegapixels * MEGAPIXELS_TO_PIXELS);+ const maxPixels = Math.floor(maxMegapixels * IMAGE.MEGAPIXELS_TO_PIXELS);if (maxPixels > 0 && totalPixels > maxPixels) {const scaleFactor = Math.sqrt(maxPixels / totalPixels);diff --git a/tools/ui/src/lib/constants/chat-commands.ts b/tools/ui/src/lib/utils/chat-commands.tssimilarity index 65%rename from tools/ui/src/lib/constants/chat-commands.tsrename to tools/ui/src/lib/utils/chat-commands.tsindex c34c635fd7..9345f0a48e 100644--- a/tools/ui/src/lib/constants/chat-commands.ts+++ b/tools/ui/src/lib/utils/chat-commands.ts@@ -1,23 +1,14 @@-import { SET_WORKING_DIRECTORY_LABEL } from '$lib/constants/working-directory';+import { SET_WORKING_DIRECTORY_LABEL } from '$lib/constants';import { ChatFormCommandAction } from '$lib/enums';-import type { ChatFormCommand } from '$lib/types';--interface ChatCommandsOptions {- /** Gates `/model`. */- showModelSelector: boolean;- /** Gates `/prompt`. */- hasPrompts: () => boolean;- /** Gates `/cwd`. */- hasCwdTools: () => boolean;-}+import type { ChatCommandsOptions, ChatFormCommand } from '$lib/types';/*** The slash commands surfaced by the `/` command picker, in display order.** Availability is supplied as predicates rather than store imports: this- * module is re-exported through the `$lib/constants` barrel, and importing+ * module is re-exported through the `$lib/utils` barrel, and importing* stores at module load would create a circular dependency (the stores- * themselves import from `$lib/constants`).+ * themselves import from `$lib/utils`).*/export function getChatCommands(options: ChatCommandsOptions): ChatFormCommand[] {return [diff --git a/tools/ui/src/lib/utils/code.ts b/tools/ui/src/lib/utils/code.tsindex 9ce1fc9f30..ab3e4b56f8 100644--- a/tools/ui/src/lib/utils/code.ts+++ b/tools/ui/src/lib/utils/code.ts@@ -1,14 +1,4 @@-import {- AMPERSAND_REGEX,- DEFAULT_LANGUAGE,- FENCE_PATTERN,- GT_REGEX,- LANG_PATTERN,- LT_REGEX,- NEWLINE,- TRIM_LEADING_PADDING_REGEX,- TRIM_TRAILING_PADDING_REGEX-} from '$lib/constants';+import { CODE_BLOCK, NEWLINE } from '$lib/constants';import hljs from 'highlight.js';export interface IncompleteCodeBlock {@@ -81,11 +71,16 @@ export function splitGluedClosingCodeFences(markdown: string): string {* so internal blank lines are still rendered as such.*/function trimCodePadding(code: string): string {- return code.replace(TRIM_LEADING_PADDING_REGEX, '').replace(TRIM_TRAILING_PADDING_REGEX, '');+ return code+ .replace(CODE_BLOCK.TRIM_LEADING_PADDING_REGEX, '')+ .replace(CODE_BLOCK.TRIM_TRAILING_PADDING_REGEX, '');}function escapeCode(code: string): string {- return code.replace(AMPERSAND_REGEX, '&').replace(LT_REGEX, '<').replace(GT_REGEX, '>');+ return code+ .replace(CODE_BLOCK.AMPERSAND_REGEX, '&')+ .replace(CODE_BLOCK.LT_REGEX, '<')+ .replace(CODE_BLOCK.GT_REGEX, '>');}/** Bounded cache for highlightCode results. */@@ -152,7 +147,7 @@ export { trimCodePadding };export function detectIncompleteCodeBlock(markdown: string): IncompleteCodeBlock | null {// Count all code fences in the markdown// A code block is incomplete if there's an odd number of ``` fences- const fencePattern = new RegExp(FENCE_PATTERN.source, FENCE_PATTERN.flags);+ const fencePattern = new RegExp(CODE_BLOCK.FENCE_PATTERN.source, CODE_BLOCK.FENCE_PATTERN.flags);const fences: number[] = [];let fenceMatch;@@ -174,8 +169,8 @@ export function detectIncompleteCodeBlock(markdown: string): IncompleteCodeBlockconst openingIndex = fences[fences.length - 1];const afterOpening = markdown.slice(openingIndex + 3);// Extract language and code content- const langMatch = afterOpening.match(LANG_PATTERN);- const language = langMatch?.[1] || DEFAULT_LANGUAGE;+ const langMatch = afterOpening.match(CODE_BLOCK.LANG_PATTERN);+ const language = langMatch?.[1] || CODE_BLOCK.DEFAULT_LANGUAGE;const codeStartIndex = openingIndex + 3 + (langMatch?.[0]?.length ?? 0);const code = markdown.slice(codeStartIndex);diff --git a/tools/ui/src/lib/utils/contenteditable-tokenizer.ts b/tools/ui/src/lib/utils/contenteditable-tokenizer.tsindex 114fdab64a..ea6939b23a 100644--- a/tools/ui/src/lib/utils/contenteditable-tokenizer.ts+++ b/tools/ui/src/lib/utils/contenteditable-tokenizer.ts@@ -520,7 +520,7 @@ export function rangeToTextOffset(root: HTMLElement, range: Range | null): numbe* tokens, `<span data-mention-badge="true">` elements for badges,* `<code data-code-token>` elements for code spans. The badge's class* string + inline SVG are shared with the rehype plugin via- * `$lib/constants/mention-badge`.+ * `$lib/constants`.*/export function buildFragment(tokens: ContentToken[]): DocumentFragment {const fragment = document.createDocumentFragment();diff --git a/tools/ui/src/lib/utils/cors-proxy.ts b/tools/ui/src/lib/utils/cors-proxy.tsindex 1694b7dbe6..58423b7e7d 100644--- a/tools/ui/src/lib/utils/cors-proxy.ts+++ b/tools/ui/src/lib/utils/cors-proxy.ts@@ -3,11 +3,7 @@*/import { base } from '$app/paths';-import {- CORS_PROXY_ENDPOINT,- CORS_PROXY_HEADER_PREFIX,- CORS_PROXY_URL_PARAM-} from '$lib/constants';+import { CORS_PROXY, CORS_PROXY_ENDPOINT } from '$lib/constants';/*** Build a proxied URL that routes through llama-server's CORS proxy.@@ -18,7 +14,7 @@ export function buildProxiedUrl(targetUrl: string): URL {const proxyPath = `${base}${CORS_PROXY_ENDPOINT}`;const proxyUrl = new URL(proxyPath, window.location.origin);- proxyUrl.searchParams.set(CORS_PROXY_URL_PARAM, targetUrl);+ proxyUrl.searchParams.set(CORS_PROXY.URL_PARAM, targetUrl);return proxyUrl;}@@ -32,7 +28,7 @@ export function buildProxiedHeaders(headers: Record<string, string>): Record<strconst proxiedHeaders: Record<string, string> = {};for (const [key, value] of Object.entries(headers)) {- proxiedHeaders[`${CORS_PROXY_HEADER_PREFIX}${key}`] = value;+ proxiedHeaders[`${CORS_PROXY.HEADER_PREFIX}${key}`] = value;}return proxiedHeaders;diff --git a/tools/ui/src/lib/utils/glob-search.ts b/tools/ui/src/lib/utils/glob-search.tsindex c7d5bca79b..ded32793b6 100644--- a/tools/ui/src/lib/utils/glob-search.ts+++ b/tools/ui/src/lib/utils/glob-search.ts@@ -12,12 +12,7 @@ import {joinPath,rankEntries} from './working-directory';-import {- GLOB_WILDCARD,- PATH_NAV_MAX_DEPTH,- PATH_SEPARATOR,- WINDOWS_SEPARATOR-} from '$lib/constants';+import { GLOB, PATH_SEPARATOR, SEARCH } from '$lib/constants';import { BuiltInTool, GlobSearchType } from '$lib/enums';import { ToolsService } from '$lib/services/tools.service';@@ -113,7 +108,7 @@ export async function runGlobSearchWithChildren(options: GlobSearchChildOptions = {}): Promise<GlobSearchChildResult> {const {- childMaxDepth = PATH_NAV_MAX_DEPTH,+ childMaxDepth = SEARCH.PATH_NAV_MAX_DEPTH,descendOnTrailingSeparator = false,type = GlobSearchType.ALL} = options;@@ -128,7 +123,7 @@ export async function runGlobSearchWithChildren(if (last) {const wantsDescend = descendOnTrailingSeparator- ? query.endsWith(PATH_SEPARATOR) || query.endsWith(WINDOWS_SEPARATOR)+ ? query.endsWith(PATH_SEPARATOR) || query.endsWith(GLOB.WINDOWS_SEPARATOR): true;const exact = ranked.find((e) => e.type === 'dir' && lastPathSegment(e.path).toLowerCase() === last.toLowerCase()@@ -137,7 +132,7 @@ export async function runGlobSearchWithChildren(if (wantsDescend && exact) {const exactDir = joinPath(res.base, exact.path);const childRes = await runGlobSearch(- { include: GLOB_WILDCARD, maxDepth: childMaxDepth, path: exactDir, rankQuery: '' },+ { include: GLOB.WILDCARD, maxDepth: childMaxDepth, path: exactDir, rankQuery: '' },type,limit,signaldiff --git a/tools/ui/src/lib/utils/heic-to-jpeg.ts b/tools/ui/src/lib/utils/heic-to-jpeg.tsindex 143b713bf6..9358d6087f 100644--- a/tools/ui/src/lib/utils/heic-to-jpeg.ts+++ b/tools/ui/src/lib/utils/heic-to-jpeg.ts@@ -1,4 +1,4 @@-import { HEIC_JPEG_QUALITY } from '$lib/constants/image-size';+import { IMAGE } from '$lib/constants';import { MimeTypeImage } from '$lib/enums';// heic requires a relatively large decoder, in order to reduce primary bundle size@@ -32,7 +32,7 @@ export async function heicFileToJpegDataURL(file: File | Blob): Promise<string>const { heicTo } = await getHeicTo();const jpegBlob = await heicTo({blob: file,- quality: HEIC_JPEG_QUALITY,+ quality: IMAGE.HEIC_JPEG_QUALITY,type: MimeTypeImage.JPEG});diff --git a/tools/ui/src/lib/utils/index.ts b/tools/ui/src/lib/utils/index.tsindex c3585bd5f8..eef5be9bfe 100644--- a/tools/ui/src/lib/utils/index.ts+++ b/tools/ui/src/lib/utils/index.ts@@ -317,7 +317,16 @@ export { tryParseToolResultObject } from './tool-call-meta';// Per-tool UI metadata (label + icon) used by the tool-call chrome.// Re-exported through $lib/utils so renderer components can read the// label without depending on $lib/constants directly.-export { getBuiltinToolUi, type BuiltinToolUiEntry } from '$lib/constants/built-in-tools';+export { getBuiltinToolUi } from './built-in-tools';+export type { BuiltinToolUiEntry } from '$lib/types';++// Chat command picker++export { getChatCommands } from './chat-commands';++// Sandbox tool definition+// SANDBOX_TOOL_DEFINITION is deprecated; kept for backward compatibility.+export { buildSandboxToolDefinition, SANDBOX_TOOL_DEFINITION } from './sandbox-tool';// Cryptography utilitiesdiff --git a/tools/ui/src/lib/utils/jpeg-orientation.ts b/tools/ui/src/lib/utils/jpeg-orientation.tsindex d0dfb92713..1389a0be27 100644--- a/tools/ui/src/lib/utils/jpeg-orientation.ts+++ b/tools/ui/src/lib/utils/jpeg-orientation.ts@@ -1,14 +1,4 @@-import {- APP1_MARKER,- EXIF_ORIENTATION_TAG,- EXIF_SCAN_BYTE_LIMIT,- EXIF_SIGNATURE,- IFD_ENTRY_SIZE,- JPEG_SOI_MARKER,- SOS_MARKER,- TIFF_LITTLE_ENDIAN,- TIFF_MAGIC-} from '$lib/constants/jpeg-exif';+import { EXIF } from '$lib/constants';import { MimeTypeImage } from '$lib/enums';/**@@ -28,7 +18,7 @@ export function getJpegOrientationFromDataURL(base64UrlJpeg: string): number {}// Keep the slice a multiple of 4 characters so atob accepts it- const charLimit = Math.ceil(EXIF_SCAN_BYTE_LIMIT / 3) * 4;+ const charLimit = Math.ceil(EXIF.SCAN_BYTE_LIMIT / 3) * 4;const slice = base64UrlJpeg.slice(payloadStart, payloadStart + charLimit);const binary = atob(slice.slice(0, slice.length - (slice.length % 4)));const bytes = new Uint8Array(binary.length);@@ -49,7 +39,7 @@ export function getJpegOrientationFromDataURL(base64UrlJpeg: string): number {* @returns The orientation value (1 to 8), or 1 when absent or malformed*/function findExifOrientation(view: DataView): number {- if (view.byteLength < 4 || view.getUint16(0) !== JPEG_SOI_MARKER) {+ if (view.byteLength < 4 || view.getUint16(0) !== EXIF.JPEG_SOI_MARKER) {return 1;}@@ -63,13 +53,13 @@ function findExifOrientation(view: DataView): number {const marker = view.getUint8(offset + 1);// Compressed image data starts here: no EXIF past this point- if (marker === SOS_MARKER) {+ if (marker === EXIF.SOS_MARKER) {return 1;}const segmentLength = view.getUint16(offset + 2);- if (marker === APP1_MARKER) {+ if (marker === EXIF.APP1_MARKER) {return parseExifOrientation(view, offset + 4, segmentLength);}@@ -92,7 +82,7 @@ function parseExifOrientation(view: DataView, start: number, segmentLength: numb// The payload opens with the "Exif\0\0" signatureif (start + 6 > end ||- view.getUint32(start) !== EXIF_SIGNATURE ||+ view.getUint32(start) !== EXIF.EXIF_SIGNATURE ||view.getUint16(start + 4) !== 0) {return 1;@@ -104,9 +94,9 @@ function parseExifOrientation(view: DataView, start: number, segmentLength: numbreturn 1;}- const littleEndian = view.getUint16(tiff) === TIFF_LITTLE_ENDIAN;+ const littleEndian = view.getUint16(tiff) === EXIF.TIFF_LITTLE_ENDIAN;- if (view.getUint16(tiff + 2, littleEndian) !== TIFF_MAGIC) {+ if (view.getUint16(tiff + 2, littleEndian) !== EXIF.TIFF_MAGIC) {return 1;}@@ -120,13 +110,13 @@ function parseExifOrientation(view: DataView, start: number, segmentLength: numb// Scan IFD0 entries for the orientation tagfor (let i = 0; i < entryCount; i++) {- const entry = tiff + ifdOffset + 2 + i * IFD_ENTRY_SIZE;+ const entry = tiff + ifdOffset + 2 + i * EXIF.IFD_ENTRY_SIZE;- if (entry + IFD_ENTRY_SIZE > end) {+ if (entry + EXIF.IFD_ENTRY_SIZE > end) {return 1;}- if (view.getUint16(entry, littleEndian) === EXIF_ORIENTATION_TAG) {+ if (view.getUint16(entry, littleEndian) === EXIF.ORIENTATION_TAG) {const orientation = view.getUint16(entry + 8, littleEndian);return orientation >= 1 && orientation <= 8 ? orientation : 1;diff --git a/tools/ui/src/lib/utils/mcp.ts b/tools/ui/src/lib/utils/mcp.tsindex c4493d8703..61d5f8a9a5 100644--- a/tools/ui/src/lib/utils/mcp.ts+++ b/tools/ui/src/lib/utils/mcp.ts@@ -15,23 +15,16 @@ import {FILE_EXTENSION_REGEX,IMAGE_FILE_EXTENSION_REGEX,MCP_SERVER_ID_PREFIX,- MCP_SSE_ENDPOINT,- MCP_SSE_ENDPOINT_QUERY,- MCP_SSE_ENDPOINT_SLASH,+ MCP_SSE,+ MIME_TYPE_PREFIXES,+ MIME_TYPE_SUBSTRINGS,PATH_SEPARATOR,PROTOCOL_PREFIX_REGEX,RESOURCE_TEXT_CONTENT_SEPARATOR,- TEXT_FILE_EXTENSION_REGEX+ TEXT_FILE_EXTENSION_REGEX,+ URI_PATTERNS} from '$lib/constants';-import {- MCPLogLevel,- MCPTransportType,- MimeTypeIncludes,- MimeTypePrefix,- MimeTypeText,- UriPattern,- UrlProtocol-} from '$lib/enums';+import { MCPLogLevel, MCPTransportType, MimeTypeText, UrlProtocol } from '$lib/enums';import type { MCPResourceContent, MCPResourceInfo, MCPServerSettingsEntry } from '$lib/types';import type { MimeTypeUnion } from '$lib/types/common';import type { Component } from 'svelte';@@ -51,9 +44,9 @@ export function detectMcpTransportFromUrl(url: string): MCPTransportType {}if (- normalized.endsWith(MCP_SSE_ENDPOINT) ||- normalized.endsWith(MCP_SSE_ENDPOINT_SLASH) ||- normalized.includes(MCP_SSE_ENDPOINT_QUERY)+ normalized.endsWith(MCP_SSE.ENDPOINT) ||+ normalized.endsWith(MCP_SSE.ENDPOINT_SLASH) ||+ normalized.includes(MCP_SSE.ENDPOINT_QUERY)) {return MCPTransportType.SSE;}@@ -150,7 +143,7 @@ export function getMcpLogLevelClass(level: MCPLogLevel): string {* @returns True if the MIME type starts with 'image/'*/export function isImageMimeType(mimeType?: MimeTypeUnion): boolean {- return mimeType?.startsWith(MimeTypePrefix.IMAGE) ?? false;+ return mimeType?.startsWith(MIME_TYPE_PREFIXES.IMAGE) ?? false;}/**@@ -213,9 +206,9 @@ export function isCodeResource(mimeType?: MimeTypeUnion, uri?: string): booleanconst u = uri?.toLowerCase() || '';return (- mime.includes(MimeTypeIncludes.JSON) ||- mime.includes(MimeTypeIncludes.JAVASCRIPT) ||- mime.includes(MimeTypeIncludes.TYPESCRIPT) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.JSON) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.JAVASCRIPT) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.TYPESCRIPT) ||CODE_FILE_EXTENSION_REGEX.test(u));}@@ -231,7 +224,7 @@ export function isImageResource(mimeType?: MimeTypeUnion, uri?: string): booleanconst mime = mimeType?.toLowerCase() || '';const u = uri?.toLowerCase() || '';- return mime.startsWith(MimeTypePrefix.IMAGE) || IMAGE_FILE_EXTENSION_REGEX.test(u);+ return mime.startsWith(MIME_TYPE_PREFIXES.IMAGE) || IMAGE_FILE_EXTENSION_REGEX.test(u);}/**@@ -245,24 +238,24 @@ export function getResourceIcon(mimeType?: MimeTypeUnion, uri?: string): Componeconst mime = mimeType?.toLowerCase() || '';const u = uri?.toLowerCase() || '';- if (mime.startsWith(MimeTypePrefix.IMAGE) || IMAGE_FILE_EXTENSION_REGEX.test(u)) {+ if (mime.startsWith(MIME_TYPE_PREFIXES.IMAGE) || IMAGE_FILE_EXTENSION_REGEX.test(u)) {return Image;}if (- mime.includes(MimeTypeIncludes.JSON) ||- mime.includes(MimeTypeIncludes.JAVASCRIPT) ||- mime.includes(MimeTypeIncludes.TYPESCRIPT) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.JSON) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.JAVASCRIPT) ||+ mime.includes(MIME_TYPE_SUBSTRINGS.TYPESCRIPT) ||CODE_FILE_EXTENSION_REGEX.test(u)) {return Code;}- if (mime.includes(MimeTypePrefix.TEXT) || TEXT_FILE_EXTENSION_REGEX.test(u)) {+ if (mime.includes(MIME_TYPE_PREFIXES.TEXT) || TEXT_FILE_EXTENSION_REGEX.test(u)) {return FileText;}- if (u.includes(UriPattern.DATABASE_KEYWORD) || u.includes(UriPattern.DATABASE_SCHEME)) {+ if (u.includes(URI_PATTERNS.DATABASE_KEYWORD) || u.includes(URI_PATTERNS.DATABASE_SCHEME)) {return Database;}diff --git a/tools/ui/src/lib/utils/mention-badge.ts b/tools/ui/src/lib/utils/mention-badge.tsindex 5b1b7d1fe5..0a0cc60c68 100644--- a/tools/ui/src/lib/utils/mention-badge.ts+++ b/tools/ui/src/lib/utils/mention-badge.ts@@ -1,10 +1,11 @@import { abbreviateHome, lastPathSegment } from './path-display';-import { DIRECTORY_PATH_SUFFIX, FILE_URI_PREFIX } from '$lib/constants';import {+ DIRECTORY_PATH_SUFFIX,+ FILE_URI_PREFIX,MENTION_BADGE_FILE_ICON_PATHS,MENTION_BADGE_FOLDER_ICON_PATHS,MENTION_LINK_SCAN_FLAGS-} from '$lib/constants/mention-badge';+} from '$lib/constants';import { FileMentionEntryType } from '$lib/enums';import type { FileMentionEntry } from '$lib/types';@@ -14,7 +15,7 @@ export {MENTION_BADGE_SVG_ATTRIBUTES,MENTION_BADGE_FILE_ICON_PATHS,MENTION_BADGE_FOLDER_ICON_PATHS-} from '$lib/constants/mention-badge';+} from '$lib/constants';// `)` is allowed in a path only when not followed by whitespace or `[`,// so macOS paths parse while adjacent badges still terminate the match.diff --git a/tools/ui/src/lib/utils/path-display.ts b/tools/ui/src/lib/utils/path-display.tsindex 8f8c081e04..19ba335708 100644--- a/tools/ui/src/lib/utils/path-display.ts+++ b/tools/ui/src/lib/utils/path-display.ts@@ -4,10 +4,10 @@ import {CWD_LINK_REGEX,FILE_URI_PREFIX,HOME_TILDE,- HOME_TILDE_PREFIX+ HOME_TILDE_PREFIX,+ PATH_SEPARATOR,+ TRAILING_SLASHES_REGEX} from '$lib/constants';-import { PATH_SEPARATOR } from '$lib/constants/mcp-resource';-import { TRAILING_SLASHES_REGEX } from '$lib/constants/url';export function lastPathSegment(p: string): string {const trimmed = p.replace(TRAILING_SLASHES_REGEX, '');diff --git a/tools/ui/src/lib/constants/sandbox.ts b/tools/ui/src/lib/utils/sandbox-tool.tssimilarity index 84%rename from tools/ui/src/lib/constants/sandbox.tsrename to tools/ui/src/lib/utils/sandbox-tool.tsindex 11e5fcf8fc..bc057e409d 100644--- a/tools/ui/src/lib/constants/sandbox.ts+++ b/tools/ui/src/lib/utils/sandbox-tool.ts@@ -1,18 +1,11 @@-import { BuiltInTool, JsonSchemaType, ToolCallType } from '$lib/enums';+import {+ SANDBOX_TIMEOUT_MS_DEFAULT,+ SANDBOX_TIMEOUT_MS_MAX,+ SANDBOX_TOOL_NAME+} from '$lib/constants';+import { JsonSchemaType, ToolCallType } from '$lib/enums';import type { OpenAIToolDefinition } from '$lib/types';-export const SANDBOX_TOOL_NAME = BuiltInTool.RUN_JAVASCRIPT;--export const SANDBOX_TIMEOUT_MS_DEFAULT = 10000;--export const SANDBOX_TIMEOUT_MS_MAX = 30000;--export const SANDBOX_OUTPUT_MAX_CHARS = 8192;--export const SANDBOX_EMPTY_OUTPUT = '(no output)';--export const SANDBOX_TRUNCATION_NOTICE = '[output truncated]';-const NERDAMER_DESCRIPTION = `Symbolic/numeric math via \`nerdamer\`nerdamer(expr,subs?,opts?)/nerdamer.func(...)→Expression Format via .text(fmt?) (fmt: 'decimals'|'fractions'|'scientific') eval via .evaluate(subs?)diff --git a/tools/ui/src/lib/utils/sanitize-svg.ts b/tools/ui/src/lib/utils/sanitize-svg.tsindex 452ea91aca..586669adf2 100644--- a/tools/ui/src/lib/utils/sanitize-svg.ts+++ b/tools/ui/src/lib/utils/sanitize-svg.ts@@ -1,4 +1,4 @@-import { SVG_MAX_BYTES, SVG_SANITIZE_CONFIG, SVG_TAG_PREFIX } from '$lib/constants';+import { SVG } from '$lib/constants';import DOMPurify from 'dompurify';/**@@ -10,13 +10,13 @@ import DOMPurify from 'dompurify';export function sanitizeSvg(source: string): string {const trimmed = source.trim();- if (!trimmed || trimmed.length > SVG_MAX_BYTES) return '';+ if (!trimmed || trimmed.length > SVG.MAX_BYTES) return '';- if (!trimmed.startsWith(SVG_TAG_PREFIX)) return '';+ if (!trimmed.startsWith(SVG.TAG_PREFIX)) return '';- const clean = DOMPurify.sanitize(trimmed, SVG_SANITIZE_CONFIG) as unknown as string;+ const clean = DOMPurify.sanitize(trimmed, SVG.SANITIZE_CONFIG) as unknown as string;- if (!clean || !clean.includes(SVG_TAG_PREFIX)) return '';+ if (!clean || !clean.includes(SVG.TAG_PREFIX)) return '';return clean;}diff --git a/tools/ui/src/lib/utils/stream-identity.ts b/tools/ui/src/lib/utils/stream-identity.tsindex 253786a7e3..bf0946fc09 100644--- a/tools/ui/src/lib/utils/stream-identity.ts+++ b/tools/ui/src/lib/utils/stream-identity.ts@@ -1,3 +1,5 @@+import { CONVERSATION_ID_SEPARATOR } from '$lib/constants';+/*** Build the conversation identity used by the server side replay buffer.*@@ -11,5 +13,5 @@ export function streamIdentity(conversationId: string, model?: string | null): sif (!model) return conversationId;- return `${conversationId}::${model}`;+ return `${conversationId}${CONVERSATION_ID_SEPARATOR}${model}`;}diff --git a/tools/ui/src/lib/utils/uri-template.ts b/tools/ui/src/lib/utils/uri-template.tsindex 8dc7b97eb9..4ba82719b2 100644--- a/tools/ui/src/lib/utils/uri-template.ts+++ b/tools/ui/src/lib/utils/uri-template.ts@@ -2,8 +2,7 @@ import {LEADING_SLASHES_REGEX,TEMPLATE_EXPRESSION_REGEX,URI_SCHEME_SEPARATOR,- URI_TEMPLATE_OPERATORS,- URI_TEMPLATE_SEPARATORS,+ URI_TEMPLATE_SYMBOLS,VARIABLE_EXPLODE_MODIFIER_REGEX,VARIABLE_PREFIX_MODIFIER_REGEX} from '../constants';@@ -126,60 +125,59 @@ export function expandTemplate(template: string, values: Record<string, string>)if (expandedParts.length === 0) return '';switch (operator) {- case URI_TEMPLATE_OPERATORS.RESERVED:+ case URI_TEMPLATE_SYMBOLS.RESERVED:// Reserved expansion: no encoding- return expandedParts.join(URI_TEMPLATE_SEPARATORS.COMMA);- case URI_TEMPLATE_OPERATORS.FRAGMENT:+ return expandedParts.join(URI_TEMPLATE_SYMBOLS.COMMA);+ case URI_TEMPLATE_SYMBOLS.FRAGMENT:// Fragment expansion- return (- URI_TEMPLATE_OPERATORS.FRAGMENT + expandedParts.join(URI_TEMPLATE_SEPARATORS.COMMA)- );- case URI_TEMPLATE_OPERATORS.PATH_SEGMENT:+ return URI_TEMPLATE_SYMBOLS.FRAGMENT + expandedParts.join(URI_TEMPLATE_SYMBOLS.COMMA);+ case URI_TEMPLATE_SYMBOLS.PATH_SEGMENT:// Path segments- return URI_TEMPLATE_SEPARATORS.SLASH + expandedParts.join(URI_TEMPLATE_SEPARATORS.SLASH);- case URI_TEMPLATE_OPERATORS.LABEL:- // Label expansionreturn (- URI_TEMPLATE_SEPARATORS.PERIOD + expandedParts.join(URI_TEMPLATE_SEPARATORS.PERIOD)+ URI_TEMPLATE_SYMBOLS.PATH_SEGMENT ++ expandedParts.join(URI_TEMPLATE_SYMBOLS.PATH_SEGMENT));- case URI_TEMPLATE_OPERATORS.PATH_PARAM:+ case URI_TEMPLATE_SYMBOLS.LABEL:+ // Label expansion+ return URI_TEMPLATE_SYMBOLS.LABEL + expandedParts.join(URI_TEMPLATE_SYMBOLS.LABEL);+ case URI_TEMPLATE_SYMBOLS.PATH_PARAM:// Path-style parametersreturn varNames.filter((_: string, i: number) => expandedParts[i]).map((name: string, i: number) =>- `${URI_TEMPLATE_SEPARATORS.SEMICOLON}${name}=${expandedParts[i]}`+ `${URI_TEMPLATE_SYMBOLS.PATH_PARAM}${name}=${expandedParts[i]}`).join('');- case URI_TEMPLATE_OPERATORS.FORM_QUERY:+ case URI_TEMPLATE_SYMBOLS.FORM_QUERY:// Form-style queryreturn (- URI_TEMPLATE_SEPARATORS.QUERY_PREFIX ++ URI_TEMPLATE_SYMBOLS.FORM_QUERY +varNames.filter((_: string, i: number) => expandedParts[i]).map((name: string, i: number) =>`${encodeURIComponent(name)}=${encodeURIComponent(expandedParts[i])}`)- .join(URI_TEMPLATE_SEPARATORS.QUERY_CONTINUATION)+ .join(URI_TEMPLATE_SYMBOLS.FORM_CONTINUATION));- case URI_TEMPLATE_OPERATORS.FORM_CONTINUATION:+ case URI_TEMPLATE_SYMBOLS.FORM_CONTINUATION:// Form-style query continuationreturn (- URI_TEMPLATE_SEPARATORS.QUERY_CONTINUATION ++ URI_TEMPLATE_SYMBOLS.FORM_CONTINUATION +varNames.filter((_: string, i: number) => expandedParts[i]).map((name: string, i: number) =>`${encodeURIComponent(name)}=${encodeURIComponent(expandedParts[i])}`)- .join(URI_TEMPLATE_SEPARATORS.COMMA)+ .join(URI_TEMPLATE_SYMBOLS.COMMA));default:// Simple string expansion (default operator)return expandedParts.map((v: string) => encodeURIComponent(v))- .join(URI_TEMPLATE_SEPARATORS.COMMA);+ .join(URI_TEMPLATE_SYMBOLS.COMMA);}});diff --git a/tools/ui/src/lib/utils/working-directory.ts b/tools/ui/src/lib/utils/working-directory.tsindex ae54530192..09ee87ecc4 100644--- a/tools/ui/src/lib/utils/working-directory.ts+++ b/tools/ui/src/lib/utils/working-directory.ts@@ -7,20 +7,13 @@import { lastPathSegment } from './path-display';import {- DRIVE_PREFIX_REGEX,- DRIVE_ROOT_REGEX,- GLOB_RANGE_CLOSE,- GLOB_RANGE_OPEN,- GLOB_SPECIAL_CHARS,- GLOB_WILDCARD,+ GLOB,HOME_TILDE,LEADING_SLASHES_REGEX,- PATH_NAV_MAX_DEPTH,- UNC_ROOT_REGEX,- WINDOWS_SEPARATOR+ PATH_SEPARATOR,+ SEARCH,+ TRAILING_SLASHES_REGEX} from '$lib/constants';-import { PATH_SEPARATOR } from '$lib/constants/mcp-resource';-import { TRAILING_SLASHES_REGEX } from '$lib/constants/url';export interface GlobEntry {path: string;@@ -37,17 +30,18 @@ export interface PathQuery {* backslash is left alone: it is a legal filename character on POSIX.*/function toPosixSeparators(query: string): string {- if (!DRIVE_PREFIX_REGEX.test(query) && !query.startsWith(WINDOWS_SEPARATOR)) return query;+ if (!GLOB.DRIVE_PREFIX_REGEX.test(query) && !query.startsWith(GLOB.WINDOWS_SEPARATOR))+ return query;- return query.split(WINDOWS_SEPARATOR).join(PATH_SEPARATOR);+ return query.split(GLOB.WINDOWS_SEPARATOR).join(PATH_SEPARATOR);}export function rootPrefixLength(path: string): number {- const unc = path.match(UNC_ROOT_REGEX);+ const unc = path.match(GLOB.UNC_ROOT_REGEX);if (unc) return unc[0].length;- const drive = path.match(DRIVE_ROOT_REGEX);+ const drive = path.match(GLOB.DRIVE_ROOT_REGEX);if (drive) return drive[0].length;@@ -83,20 +77,20 @@ export function splitPathQuery(query: string): PathQuery | null {}export function buildCaseInsensitiveGlob(query: string): string {- let out = GLOB_WILDCARD;+ let out = GLOB.WILDCARD;for (const c of query) {const lo = c.toLowerCase();const up = c.toUpperCase();- if (lo !== up) out += GLOB_RANGE_OPEN + lo + up + GLOB_RANGE_CLOSE;+ if (lo !== up) out += GLOB.RANGE_OPEN + lo + up + GLOB.RANGE_CLOSE;// glob metacharacters are escaped into a literal character class so a// query like "a*b" matches a literal '*' instead of becoming "ab"- else if (GLOB_SPECIAL_CHARS.includes(c)) out += GLOB_RANGE_OPEN + c + GLOB_RANGE_CLOSE;+ else if (GLOB.SPECIAL_CHARS.includes(c)) out += GLOB.RANGE_OPEN + c + GLOB.RANGE_CLOSE;else out += c;}- return out + GLOB_WILDCARD;+ return out + GLOB.WILDCARD;}export interface GlobSearchArgs {@@ -120,9 +114,9 @@ export function buildGlobSearchArgs(const include = pathQuery? pathQuery.last? buildCaseInsensitiveGlob(pathQuery.last)- : GLOB_WILDCARD+ : GLOB.WILDCARD: buildCaseInsensitiveGlob(query);- const maxDepth = pathQuery ? PATH_NAV_MAX_DEPTH : searchDepth;+ const maxDepth = pathQuery ? SEARCH.PATH_NAV_MAX_DEPTH : searchDepth;return { include, last: pathQuery?.last, maxDepth, path, rankQuery: pathQuery?.last ?? query };}diff --git a/tools/ui/src/routes/+error.svelte b/tools/ui/src/routes/+error.svelteindex c867f6de92..f167c8e77c 100644--- a/tools/ui/src/routes/+error.svelte+++ b/tools/ui/src/routes/+error.svelte@@ -2,8 +2,7 @@import { goto } from '$app/navigation';import { page } from '$app/stores';import { ServerErrorSplash } from '$lib/components/app';- import { APP_NAME } from '$lib/constants';- import { ROUTES } from '$lib/constants/routes';+ import { APP_NAME, ROUTES } from '$lib/constants';let error = $derived($page.error);let status = $derived($page.status);diff --git a/tools/ui/src/routes/+layout.svelte b/tools/ui/src/routes/+layout.svelteindex 089958bdba..560d36c4d7 100644--- a/tools/ui/src/routes/+layout.svelte+++ b/tools/ui/src/routes/+layout.svelte@@ -7,10 +7,14 @@import { SidebarNavigation } from '$lib/components/app';import { PwaMetaTags, PwaRefreshAlert } from '$lib/components/pwa';import * as Tooltip from '$lib/components/ui/tooltip';- import { AUTHORIZATION_HEADER, BEARER_PREFIX, TOOLTIP_DELAY_DURATION } from '$lib/constants';- import { SETTINGS_KEYS } from '$lib/constants';- import { FAVICON_PATHS, FAVICON_SELECTORS } from '$lib/constants/pwa';- import { ROUTES } from '$lib/constants/routes';+ import {+ FAVICON_PATHS,+ FAVICON_SELECTORS,+ HEADERS,+ ROUTES,+ SETTINGS_KEYS,+ TOOLTIP_DELAY_DURATION+ } from '$lib/constants';import { useKeyboardShortcuts } from '$lib/hooks/use-keyboard-shortcuts.svelte';import { usePwa } from '$lib/hooks/use-pwa.svelte';import { RouterService } from '$lib/services/router.service';@@ -112,8 +116,8 @@page.status !== 403) {const headers: Record<string, string> = {- [AUTHORIZATION_HEADER]: `${BEARER_PREFIX}${apiKey.trim()}`,- 'Content-Type': 'application/json'+ 'Content-Type': 'application/json',+ [HEADERS.AUTHORIZATION]: `${HEADERS.BEARER}${apiKey.trim()}`};fetch(`${base}/props`, { headers })diff --git a/tools/ui/src/routes/search/+page.svelte b/tools/ui/src/routes/search/+page.svelteindex feb36058a3..424b74f67c 100644--- a/tools/ui/src/routes/search/+page.svelte+++ b/tools/ui/src/routes/search/+page.svelte@@ -3,7 +3,7 @@import { goto } from '$app/navigation';import { page } from '$app/state';import { SearchInput, SidebarNavigationSearchResults } from '$lib/components/app';- import { ROUTES } from '$lib/constants/routes';+ import { ROUTES } from '$lib/constants';import { RouterService } from '$lib/services/router.service';import { chatStore } from '$lib/stores/chat.svelte';import { conversations, conversationsStore } from '$lib/stores/conversations.svelte';diff --git a/tools/ui/tests/client/apikey-splash.svelte.test.ts b/tools/ui/tests/client/apikey-splash.svelte.test.tsindex 061a38a61f..bad7f6ccb0 100644--- a/tools/ui/tests/client/apikey-splash.svelte.test.ts+++ b/tools/ui/tests/client/apikey-splash.svelte.test.ts@@ -1,4 +1,4 @@-import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants/storage';+import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants';import { settingsStore } from '$lib/stores/settings.svelte';import { validateApiKey } from '$lib/utils/api-key-validation';import { beforeEach, describe, expect, it } from 'vitest';diff --git a/tools/ui/tests/client/chat-form-enter-code-block.svelte.test.ts b/tools/ui/tests/client/chat-form-enter-code-block.svelte.test.tsindex 9e684a7635..a4fd375b3c 100644--- a/tools/ui/tests/client/chat-form-enter-code-block.svelte.test.ts+++ b/tools/ui/tests/client/chat-form-enter-code-block.svelte.test.ts@@ -6,7 +6,7 @@// consumes the same case locally; see chat-form-contenteditable).import ChatFormTestWrapper from './components/ChatFormTestWrapper.svelte';-import { SETTINGS_KEYS } from '$lib/constants/settings-keys';+import { SETTINGS_KEYS } from '$lib/constants';import { settingsStore } from '$lib/stores/settings.svelte';import { tick } from 'svelte';import { beforeEach, describe, expect, it, vi } from 'vitest';diff --git a/tools/ui/tests/client/settings-registry-invariants.svelte.test.ts b/tools/ui/tests/client/settings-registry-invariants.svelte.test.tsindex 6e169702cf..ddf1393e70 100644--- a/tools/ui/tests/client/settings-registry-invariants.svelte.test.ts+++ b/tools/ui/tests/client/settings-registry-invariants.svelte.test.ts@@ -1,5 +1,4 @@-import { SETTING_CONFIG_DEFAULT } from '$lib/constants/settings-registry';-import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants/storage';+import { CONFIG_LOCALSTORAGE_KEY, SETTING_CONFIG_DEFAULT } from '$lib/constants';import { ParameterSyncService } from '$lib/services/parameter-sync.service';import { serverStore } from '$lib/stores/server.svelte';import { config, settingsStore } from '$lib/stores/settings.svelte';diff --git a/tools/ui/tests/client/settings-render-keys-migration.svelte.test.ts b/tools/ui/tests/client/settings-render-keys-migration.svelte.test.tsindex 380a2e74d0..078cc7cbec 100644--- a/tools/ui/tests/client/settings-render-keys-migration.svelte.test.ts+++ b/tools/ui/tests/client/settings-render-keys-migration.svelte.test.ts@@ -4,7 +4,7 @@// returns to its own default. The toggle is removed from the persisted// config so it does not stay orphaned in localStorage.-import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants/storage';+import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants';import { MigrationService } from '$lib/services/migration.service';import { config, settingsStore } from '$lib/stores/settings.svelte';import { beforeEach, describe, expect, it } from 'vitest';diff --git a/tools/ui/tests/client/ui-settings-sync.svelte.test.ts b/tools/ui/tests/client/ui-settings-sync.svelte.test.tsindex bef2400df1..110011ef0d 100644--- a/tools/ui/tests/client/ui-settings-sync.svelte.test.ts+++ b/tools/ui/tests/client/ui-settings-sync.svelte.test.ts@@ -1,4 +1,4 @@-import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants/storage';+import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants';import { serverStore } from '$lib/stores/server.svelte';import { config, settingsStore } from '$lib/stores/settings.svelte';import { beforeEach, describe, expect, it } from 'vitest';diff --git a/tools/ui/tests/unit/agentic-strip.test.ts b/tools/ui/tests/unit/agentic-strip.test.tsindex f4c2e8a476..ec4fc213c3 100644--- a/tools/ui/tests/unit/agentic-strip.test.ts+++ b/tools/ui/tests/unit/agentic-strip.test.ts@@ -1,4 +1,4 @@-import { LEGACY_AGENTIC_REGEX } from '$lib/constants/agentic';+import { LEGACY_AGENTIC_REGEX } from '$lib/constants';import { describe, expect, it } from 'vitest';/**diff --git a/tools/ui/tests/unit/mcp-override-fallback.test.ts b/tools/ui/tests/unit/mcp-override-fallback.test.tsindex e7400eeb12..47d6ac2536 100644--- a/tools/ui/tests/unit/mcp-override-fallback.test.ts+++ b/tools/ui/tests/unit/mcp-override-fallback.test.ts@@ -1,5 +1,4 @@-import { CONFIG_LOCALSTORAGE_KEY } from '$lib/constants';-import { SETTINGS_KEYS } from '$lib/constants/settings-keys';+import { CONFIG_LOCALSTORAGE_KEY, SETTINGS_KEYS } from '$lib/constants';import type { DatabaseConversation } from '$lib/types/database';import { afterEach, beforeAll, beforeEach, describe, expect, it } from 'vitest';diff --git a/tools/ui/tests/unit/mcp-servers-default.test.ts b/tools/ui/tests/unit/mcp-servers-default.test.tsindex 52bc0dad22..a47a83cf31 100644--- a/tools/ui/tests/unit/mcp-servers-default.test.ts+++ b/tools/ui/tests/unit/mcp-servers-default.test.ts@@ -1,4 +1,4 @@-import { SETTINGS_KEYS } from '$lib/constants/settings-keys';+import { SETTINGS_KEYS } from '$lib/constants';import { describe, expect, it } from 'vitest';/**@@ -12,7 +12,7 @@ import { describe, expect, it } from 'vitest';*/describe('MCP_SERVERS default value', () => {it('does not preload any servers in the MCP_SERVERS setting default', async () => {- const { SETTING_CONFIG_DEFAULT } = await import('$lib/constants/settings-registry');+ const { SETTING_CONFIG_DEFAULT } = await import('$lib/constants');expect(SETTING_CONFIG_DEFAULT[SETTINGS_KEYS.MCP_SERVERS]).toBe('[]');}, 15000);diff --git a/tools/ui/tests/unit/mcp-service.test.ts b/tools/ui/tests/unit/mcp-service.test.tsindex d79a3f025e..358881b470 100644--- a/tools/ui/tests/unit/mcp-service.test.ts+++ b/tools/ui/tests/unit/mcp-service.test.ts@@ -1,5 +1,5 @@import { Client } from '@modelcontextprotocol/sdk/client';-import { CORS_PROXY_HEADER_PREFIX } from '$lib/constants';+import { CORS_PROXY } from '$lib/constants';import { MCPConnectionPhase, MCPTransportType } from '$lib/enums';import { MCPService } from '$lib/services/mcp.service';import type { MCPConnectionLog, MCPServerConfig } from '$lib/types';@@ -96,9 +96,9 @@ describe('MCPService', () => {it('wraps dynamic request headers when using the CORS proxy', async () => {const logs: MCPConnectionLog[] = [];- const proxiedAuthToken = `${CORS_PROXY_HEADER_PREFIX}x-auth-token`;- const proxiedContentType = `${CORS_PROXY_HEADER_PREFIX}content-type`;- const proxiedSessionId = `${CORS_PROXY_HEADER_PREFIX}mcp-session-id`;+ const proxiedAuthToken = `${CORS_PROXY.HEADER_PREFIX}x-auth-token`;+ const proxiedContentType = `${CORS_PROXY.HEADER_PREFIX}content-type`;+ const proxiedSessionId = `${CORS_PROXY.HEADER_PREFIX}mcp-session-id`;const response = new Response('{}', {headers: { 'content-type': 'application/json' },status: 200diff --git a/tools/ui/tests/unit/parse-mcp-server-settings.test.ts b/tools/ui/tests/unit/parse-mcp-server-settings.test.tsindex 85b3420710..a0808a767a 100644--- a/tools/ui/tests/unit/parse-mcp-server-settings.test.ts+++ b/tools/ui/tests/unit/parse-mcp-server-settings.test.ts@@ -1,4 +1,4 @@-import { MCP_SERVER_ID_PREFIX } from '$lib/constants/mcp';+import { MCP_SERVER_ID_PREFIX } from '$lib/constants';import { parseMcpServerSettings } from '$lib/utils/mcp';import { describe, expect, it, vi } from 'vitest';diff --git a/tools/ui/tests/unit/sanitize-headers.test.ts b/tools/ui/tests/unit/sanitize-headers.test.tsindex 099de8bdf1..b5ee864857 100644--- a/tools/ui/tests/unit/sanitize-headers.test.ts+++ b/tools/ui/tests/unit/sanitize-headers.test.ts@@ -1,4 +1,4 @@-import { CORS_PROXY_HEADER_PREFIX } from '$lib/constants';+import { CORS_PROXY } from '$lib/constants';import { sanitizeHeaders } from '$lib/utils/api-headers';import { describe, expect, it } from 'vitest';@@ -61,9 +61,9 @@ describe('sanitizeHeaders', () => {});it('redacts proxied sensitive and custom target headers', () => {- const proxiedAuthorization = `${CORS_PROXY_HEADER_PREFIX}authorization`;- const proxiedSessionId = `${CORS_PROXY_HEADER_PREFIX}mcp-session-id`;- const proxiedVendorKey = `${CORS_PROXY_HEADER_PREFIX}x-vendor-key`;+ const proxiedAuthorization = `${CORS_PROXY.HEADER_PREFIX}authorization`;+ const proxiedSessionId = `${CORS_PROXY.HEADER_PREFIX}mcp-session-id`;+ const proxiedVendorKey = `${CORS_PROXY.HEADER_PREFIX}x-vendor-key`;const headers = new Headers({[proxiedAuthorization]: 'Bearer secret',[proxiedSessionId]: 'session-12345',diff --git a/tools/ui/tests/unit/uri-template.test.ts b/tools/ui/tests/unit/uri-template.test.tsindex 4b52c1a9c3..5ffab7fb07 100644--- a/tools/ui/tests/unit/uri-template.test.ts+++ b/tools/ui/tests/unit/uri-template.test.ts@@ -1,4 +1,4 @@-import { URI_TEMPLATE_OPERATORS } from '../../src/lib/constants/uri-template';+import { URI_TEMPLATE_SYMBOLS } from '../../src/lib/constants/uri-template.constants';import {expandTemplate,extractTemplateVariables,@@ -26,7 +26,7 @@ describe('extractTemplateVariables', () => {it('extracts variables with operators', () => {const vars = extractTemplateVariables('http://example.com{+path}');- expect(vars).toEqual([{ name: 'path', operator: URI_TEMPLATE_OPERATORS.RESERVED }]);+ expect(vars).toEqual([{ name: 'path', operator: URI_TEMPLATE_SYMBOLS.RESERVED }]);});it('extracts comma-separated variable lists', () => {@@ -48,13 +48,13 @@ describe('extractTemplateVariables', () => {it('handles fragment expansion', () => {const vars = extractTemplateVariables('http://example.com/page{#section}');- expect(vars).toEqual([{ name: 'section', operator: URI_TEMPLATE_OPERATORS.FRAGMENT }]);+ expect(vars).toEqual([{ name: 'section', operator: URI_TEMPLATE_SYMBOLS.FRAGMENT }]);});it('handles path segment expansion', () => {const vars = extractTemplateVariables('http://example.com{/path}');- expect(vars).toEqual([{ name: 'path', operator: URI_TEMPLATE_OPERATORS.PATH_SEGMENT }]);+ expect(vars).toEqual([{ name: 'path', operator: URI_TEMPLATE_SYMBOLS.PATH_SEGMENT }]);});it('returns empty array for template without variables', () => {diff --git a/tools/ui/tests/unit/working-directory.test.ts b/tools/ui/tests/unit/working-directory.test.tsindex 35b15c5c5f..6e9b067cf3 100644--- a/tools/ui/tests/unit/working-directory.test.ts+++ b/tools/ui/tests/unit/working-directory.test.ts@@ -1,4 +1,4 @@-import { GLOB_WILDCARD, PATH_NAV_MAX_DEPTH } from '$lib/constants';+import { GLOB, SEARCH } from '$lib/constants';import {buildCaseInsensitiveGlob,buildGlobSearchArgs,@@ -148,7 +148,7 @@ describe('buildGlobSearchArgs', () => {expect(args.path).toBe('~');expect(args.include).toBe(buildCaseInsensitiveGlob('proj'));- expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);+ expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);expect(args.rankQuery).toBe('proj');expect(args.last).toBe('proj');});@@ -157,8 +157,8 @@ describe('buildGlobSearchArgs', () => {const args = buildGlobSearchArgs('~/', '/home', DEPTH);expect(args.path).toBe('~');- expect(args.include).toBe(GLOB_WILDCARD);- expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);+ expect(args.include).toBe(GLOB.WILDCARD);+ expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);});it('navigates an absolute path under its root', () => {@@ -166,7 +166,7 @@ describe('buildGlobSearchArgs', () => {expect(args.path).toBe('/usr/local');expect(args.include).toBe(buildCaseInsensitiveGlob('bin'));- expect(args.maxDepth).toBe(PATH_NAV_MAX_DEPTH);+ expect(args.maxDepth).toBe(SEARCH.PATH_NAV_MAX_DEPTH);expect(args.rankQuery).toBe('bin');expect(args.last).toBe('bin');});diff --git a/tools/ui/vite.config.ts b/tools/ui/vite.config.tsindex 8f80d8ec08..f650b4cfb9 100644--- a/tools/ui/vite.config.ts+++ b/tools/ui/vite.config.ts@@ -2,7 +2,7 @@ import { buildInfoPlugin } from './scripts/vite-plugin-build-info';import { nerdamerPlugin } from './scripts/vite-plugin-nerdamer';import { relativizeBasePlugin } from './scripts/vite-plugin-relativize-base';import { splashScreenPlugin } from './scripts/vite-plugin-splash-screen';-import { SVELTEKIT_PWA_OPTIONS } from './src/lib/constants/pwa';+import { SVELTEKIT_PWA_OPTIONS } from './src/lib/constants/pwa.constants';import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';import { sveltekit } from '@sveltejs/kit/vite';import tailwindcss from '@tailwindcss/vite';