* webui: Move static build output from `tools/server/public` to `build/ui` directory * refactor: Move to `tools/ui` * refactor: rename CMake variables and preprocessor defines - Rename LLAMA_BUILD_WEBUI -> LLAMA_BUILD_UI (old kept as deprecated) - Rename LLAMA_USE_PREBUILT_WEBUI -> LLAMA_USE_PREBUILT_UI (old kept as deprecated) - Backward compat: old vars auto-forward to new ones with DEPRECATION warning - Rename internal vars: WEBUI_SOURCE -> UI_SOURCE, WEBUI_SOURCE_DIR -> UI_SOURCE_DIR, etc. - Rename HF bucket: LLAMA_WEBUI_HF_BUCKET -> LLAMA_UI_HF_BUCKET - Emit both LLAMA_BUILD_WEBUI and LLAMA_BUILD_UI preprocessor defines - Emit both LLAMA_WEBUI_DEFAULT_ENABLED and LLAMA_UI_DEFAULT_ENABLED * refactor: rename CLI flags (--webui -> --ui) with backward compat - Add --ui/--no-ui (old --webui/--no-webui kept as deprecated aliases) - Add --ui-config (old --webui-config kept as deprecated alias) - Add --ui-config-file (old --webui-config-file kept as deprecated alias) - Add --ui-mcp-proxy/--no-ui-mcp-proxy (old --webui-mcp-proxy kept as deprecated) - Add new env vars: LLAMA_ARG_UI, LLAMA_ARG_UI_CONFIG, LLAMA_ARG_UI_CONFIG_FILE, LLAMA_ARG_UI_MCP_PROXY - C++ struct fields: params.ui, params.ui_config_json, params.ui_mcp_proxy added alongside old fields - Backward compat: old fields synced to new ones in g_params_to_internals * refactor: update C++ server internals with backward compat - Rename json_webui_settings -> json_ui_settings (both kept in server_context_meta) - Rename params.webui usage -> params.ui (both synced, old still works) - JSON API emits both "ui"/"ui_settings" and "webui"/"webui_settings" keys - Server routes use params.ui_mcp_proxy || params.webui_mcp_proxy - Preprocessor guards use #if defined(LLAMA_BUILD_UI) || defined(LLAMA_BUILD_WEBUI) * refactor: rename CI/CD workflows, artifacts, and build script - Rename webui-build.yml -> ui-build.yml; artifact webui-build -> ui-build - Rename webui-publish.yml -> ui-publish.yml; var HF_BUCKET_WEBUI_STATIC_OUTPUT -> HF_BUCKET_UI_STATIC_OUTPUT - Rename server-webui.yml -> server-ui.yml; job webui-build/checks -> ui-build/checks - Update server.yml: job/artifact refs webui-build -> ui-build - Update release.yml: all webui-build/publish refs -> ui-build/publish; HF_TOKEN_WEBUI_STATIC_OUTPUT -> HF_TOKEN_UI_STATIC_OUTPUT - Update server-self-hosted.yml: webui-build -> ui-build - Update build-self-hosted.yml: HF_WEBUI_VERSION -> HF_UI_VERSION - Rename webui-download.cmake -> ui-download.cmake (internal refs updated) - Update labeler.yml: server/webui -> server/ui path label * docs: update CODEOWNERS and server README docs - Update CODEOWNERS: team ggml-org/llama-webui -> ggml-org/llama-ui, path /tools/server/webui/ -> /tools/ui/ - Update server README.md: CLI tables show --ui flags with deprecated --webui aliases - Update server README-dev.md: "WebUI" -> "UI", paths updated to tools/ui/ * fix: Small fixes for UI build * fix: CMake.txt syntax * chore: Formatting * fix: `.editorconfig` for llama-ui * chore: Formatting * refactor: Use `APP_NAME` in Error route * refactor: Cleanup * refactor: Single migration service * make llama-ui a linkable target * fix: UI Build output * fix: Missing change * fix: separate llama-ui npm build output into build/tools/ui/dist subfolder + use cmake npm build instead of downloading ui-build.yml artifacts in CI * refactor: UI workflows cleanup --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
255 lines
8.4 KiB
TypeScript
255 lines
8.4 KiB
TypeScript
/**
|
|
*
|
|
* MCP (Model Context Protocol)
|
|
*
|
|
* Components for managing MCP server connections and displaying server status.
|
|
* MCP enables agentic workflows by connecting to external tool servers.
|
|
*
|
|
* The MCP system integrates with:
|
|
* - `mcpStore` for server CRUD operations and health checks
|
|
* - `conversationsStore` for per-conversation server enable/disable
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* **McpServersSettings** - MCP servers configuration section
|
|
*
|
|
* Settings section for configuring MCP server connections.
|
|
* Displays server cards with status, tools, and management actions.
|
|
* Used within the MCP tab of ChatSettings.
|
|
*
|
|
* **Architecture:**
|
|
* - Manages add server form state locally
|
|
* - Delegates server display to McpServerCard components
|
|
* - Integrates with mcpStore for server operations
|
|
* - Shows skeleton loading states during health checks
|
|
*
|
|
* **Features:**
|
|
* - Add new MCP servers by URL with validation
|
|
* - Server cards with connection status indicators
|
|
* - Health check status (connected/disconnected/error)
|
|
* - Tools list per server showing available capabilities
|
|
* - Enable/disable toggle per conversation
|
|
* - Edit/delete server actions
|
|
* - Skeleton loading states during connection
|
|
* - Empty state with helpful message
|
|
*
|
|
* @example
|
|
* ```svelte
|
|
* <McpServersSettings />
|
|
* ```
|
|
*/
|
|
export { default as McpServersSettings } from '../settings/SettingsMcpServers.svelte';
|
|
|
|
/**
|
|
* **McpActiveServersAvatars** - Active MCP servers indicator
|
|
*
|
|
* Compact avatar row showing favicons of active MCP servers.
|
|
* Displays up to 3 server icons with "+N" counter for additional servers.
|
|
* Clickable to open MCP settings dialog.
|
|
*
|
|
* **Architecture:**
|
|
* - Filters servers by enabled status and health check
|
|
* - Fetches favicons from server URLs
|
|
* - Integrates with conversationsStore for per-chat server state
|
|
*
|
|
* **Features:**
|
|
* - Overlapping favicon avatars (max 3 visible)
|
|
* - "+N" counter for additional servers
|
|
* - Click handler for settings navigation
|
|
* - Disabled state support
|
|
* - Only shows healthy, enabled servers
|
|
*
|
|
* @example
|
|
* ```svelte
|
|
* <McpActiveServersAvatars
|
|
* onSettingsClick={() => showMcpSettings = true}
|
|
* />
|
|
* ```
|
|
*/
|
|
export { default as McpActiveServersAvatars } from './McpActiveServersAvatars.svelte';
|
|
|
|
/**
|
|
* **McpCapabilitiesBadges** - Server capabilities display
|
|
*
|
|
* Displays MCP server capabilities as colored badges.
|
|
* Shows which features the server supports (tools, resources, prompts, etc.).
|
|
*
|
|
* **Features:**
|
|
* - Tools badge (green) - server provides callable tools
|
|
* - Resources badge (blue) - server provides data resources
|
|
* - Prompts badge (purple) - server provides prompt templates
|
|
* - Logging badge (orange) - server supports logging
|
|
* - Completions badge (cyan) - server provides completions
|
|
* - Tasks badge (pink) - server supports task management
|
|
*/
|
|
export { default as McpCapabilitiesBadges } from './McpCapabilitiesBadges.svelte';
|
|
|
|
/**
|
|
* **McpConnectionLogs** - Connection log viewer
|
|
*
|
|
* Collapsible panel showing MCP server connection logs.
|
|
* Displays timestamped log entries with level-based styling.
|
|
*
|
|
* **Features:**
|
|
* - Collapsible log list with entry count
|
|
* - Connection time display in milliseconds
|
|
* - Log level icons and color coding
|
|
* - Scrollable log container with max height
|
|
* - Monospace font for log readability
|
|
*/
|
|
export { default as McpConnectionLogs } from './McpConnectionLogs.svelte';
|
|
|
|
/**
|
|
* **McpServerForm** - Server URL and headers input form
|
|
*
|
|
* Reusable form for entering MCP server connection details.
|
|
* Used in both add new server and edit server flows.
|
|
*
|
|
* **Features:**
|
|
* - URL input with validation error display
|
|
* - Custom headers key-value pairs editor
|
|
* - Controlled component with change callbacks
|
|
*
|
|
* @example
|
|
* ```svelte
|
|
* <McpServerForm
|
|
* url={serverUrl}
|
|
* headers={serverHeaders}
|
|
* onUrlChange={(v) => serverUrl = v}
|
|
* onHeadersChange={(v) => serverHeaders = v}
|
|
* urlError={validationError}
|
|
* />
|
|
* ```
|
|
*/
|
|
export { default as McpServerForm } from './McpServerForm.svelte';
|
|
|
|
/**
|
|
* MCP protocol logo SVG component. Renders the official MCP icon
|
|
* with customizable size via class and style props.
|
|
*/
|
|
export { default as McpLogo } from './McpLogo.svelte';
|
|
|
|
/**
|
|
*
|
|
* SERVER CARD
|
|
*
|
|
* Components for displaying individual MCP server status and controls.
|
|
* McpServerCard is the main component, with sub-components for specific sections.
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* **McpServerCard** - Individual server display card
|
|
*
|
|
* Main component for displaying a single MCP server with all its details.
|
|
* Manages edit mode, delete confirmation, and health check actions.
|
|
*
|
|
* **Architecture:**
|
|
* - Composes header, tools list, logs, and actions sub-components
|
|
* - Manages local edit/delete state
|
|
* - Reads health state from mcpStore
|
|
* - Triggers health checks via mcpStore
|
|
*
|
|
* **Features:**
|
|
* - Server header with favicon, name, version, and toggle
|
|
* - Capabilities badges display
|
|
* - Tools list with descriptions
|
|
* - Connection logs viewer
|
|
* - Edit form for URL and headers
|
|
* - Delete confirmation dialog
|
|
* - Skeleton loading states
|
|
*/
|
|
export { default as McpServerCard } from './McpServerCard/McpServerCard.svelte';
|
|
|
|
/** Server card header with favicon, name, version badge, and enable toggle. */
|
|
export { default as McpServerCardHeader } from './McpServerCard/McpServerCardHeader.svelte';
|
|
|
|
/** Action buttons row: edit, refresh, delete. */
|
|
export { default as McpServerCardActions } from './McpServerCard/McpServerCardActions.svelte';
|
|
|
|
/** Collapsible tools list showing available server tools with descriptions. */
|
|
export { default as McpServerCardToolsList } from './McpServerCard/McpServerCardToolsList.svelte';
|
|
|
|
/** Inline edit form for server URL and custom headers. */
|
|
export { default as McpServerCardEditForm } from './McpServerCard/McpServerCardEditForm.svelte';
|
|
|
|
/** Delete confirmation dialog with server name display. */
|
|
export { default as McpServerCardDeleteDialog } from './McpServerCard/McpServerCardDeleteDialog.svelte';
|
|
|
|
/** Skeleton loading state for server card during health checks. */
|
|
export { default as McpServerCardSkeleton } from './McpServerCardSkeleton.svelte';
|
|
|
|
/**
|
|
* **McpServerIdentity** - Server identity display (icon, name, version)
|
|
*
|
|
* Reusable headless component for displaying server name, favicon/icon, and version badge.
|
|
* Accepts all data via props with no store dependencies for predictable rendering.
|
|
*
|
|
* **Features:**
|
|
* - Server favicon/icon with fallback
|
|
* - Truncated display name with max-width
|
|
* - Optional version badge (v1.2.3)
|
|
* - Optional external link to server website
|
|
*
|
|
* @example
|
|
* ```svelte
|
|
* <McpServerIdentity displayName={name} faviconUrl={iconUrl} serverInfo={info} />
|
|
* ```
|
|
*/
|
|
export { default as McpServerIdentity } from './McpServerIdentity.svelte';
|
|
|
|
/**
|
|
* **McpServerInfo** - Server instructions display
|
|
*
|
|
* Collapsible panel showing server-provided instructions.
|
|
* Displays guidance text from the MCP server for users.
|
|
*/
|
|
export { default as McpServerInfo } from './McpServerInfo.svelte';
|
|
|
|
/**
|
|
* **McpResourcesBrowser** - MCP resources tree browser
|
|
*
|
|
* Tree view component showing resources grouped by server.
|
|
* Supports resource selection and quick attach actions.
|
|
*
|
|
* **Features:**
|
|
* - Collapsible server sections
|
|
* - Resource icons based on MIME type
|
|
* - Resource selection highlighting
|
|
* - Quick attach button per resource
|
|
* - Refresh all resources action
|
|
* - Loading states per server
|
|
*/
|
|
export { default as McpResourcesBrowser } from './McpResourcesBrowser/McpResourcesBrowser.svelte';
|
|
|
|
/**
|
|
* **McpResourcePreview** - MCP resource content preview
|
|
*
|
|
* Preview panel showing resource content with metadata.
|
|
* Supports text and binary content display.
|
|
*
|
|
* **Features:**
|
|
* - Text content display with monospace formatting
|
|
* - Image preview for image MIME types
|
|
* - Copy to clipboard action
|
|
* - Download content action
|
|
* - Resource metadata display (MIME type, priority, server)
|
|
* - Loading and error states
|
|
*/
|
|
export { default as McpResourcePreview } from './McpResourcePreview.svelte';
|
|
|
|
/**
|
|
* **McpResourceTemplateForm** - MCP resource template variable form
|
|
*
|
|
* Form for filling in resource template variables with auto-completion
|
|
* via the Completions API. Shows live URI preview as variables are filled.
|
|
*
|
|
* **Features:**
|
|
* - Template variable input fields
|
|
* - Completions API integration for variable auto-complete
|
|
* - Live URI preview as variables are filled
|
|
* - Read resolved resource action
|
|
*/
|
|
export { default as McpResourceTemplateForm } from './McpResourceTemplateForm.svelte';
|