char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
e21152dc9
char/aliceai-t5-moe
1import { Globe , Radio , Zap } from '@lucide/svelte' ; 2import { MCPTransportType } from '$lib/enums' ; 3import { MimeTypeImage } from '$lib/enums/files.enums' ; 4import type { ClientCapabilities , Implementation } from '$lib/types' ; 5import type { Component } from 'svelte' ; 6 7export const DEFAULT_CLIENT_VERSION = '1.0.0' ; 8export const MCP_CLIENT_NAME = 'llama-ui-mcp' ; 9export const DEFAULT_IMAGE_MIME_TYPE = MimeTypeImage . PNG ; 10 11/** MIME types considered safe for rendering MCP server icons */ 12export const MCP_ALLOWED_ICON_MIME_TYPES = new Set ([ 13MimeTypeImage . PNG , 14MimeTypeImage . JPEG , 15MimeTypeImage . JPG , 16MimeTypeImage . SVG , 17MimeTypeImage . WEBP , 18MimeTypeImage . ICO , 19MimeTypeImage . ICO_MICROSOFT 20]); 21 22/** 23* MCP specification version this client targets. 24* Update when the upstream MCP spec introduces a new stable version: 25* https://spec.modelcontextprotocol.io/ 26*/ 27export const MCP_PROTOCOL_VERSION = '2025-06-18' ; 28 29export const DEFAULT_MCP_CONFIG = { 30capabilities :{ tools :{ listChanged :true } } as ClientCapabilities , 31clientInfo :{ name :MCP_CLIENT_NAME , version :DEFAULT_CLIENT_VERSION } as Implementation , 32connectionTimeoutMs :10_000 , // 10 seconds for connection establishment 33protocolVersion :MCP_PROTOCOL_VERSION , 34requestTimeoutSeconds :300 // 5 minutes for long-running tools 35} as const ; 36 37export const MCP_SERVER_ID_PREFIX = 'LlamaUI-MCP-Server' ; 38 39/** Backoff policy for reconnecting to a dropped MCP server. */ 40export const MCP_RECONNECT = { 41/** Per-attempt timeout for a single reconnection attempt before giving up and backing off. */ 42ATTEMPT_TIMEOUT_MS :15_000 , 43BACKOFF_MULTIPLIER :2 , 44INITIAL_DELAY :1000 , 45MAX_DELAY :30000 46}; 47 48/** Maximum number of MCP server avatars to display in the chat form */ 49export const MAX_DISPLAYED_MCP_AVATARS = 4 ; 50 51/** Expected count when two theme-less icons represent a light/dark pair */ 52export const EXPECTED_THEMED_ICON_PAIR_COUNT = 2 ; 53 54/** CORS proxy connection settings */ 55export const CORS_PROXY = { 56/** Header prefix for headers that should be forwarded by the CORS proxy */ 57HEADER_PREFIX :'x-llama-server-proxy-header-' , 58/** CORS proxy URL query parameter name */ 59URL_PARAM :'url' 60} as const ; 61 62/** Standard SSE endpoint path indicators */ 63export const MCP_SSE = { 64ENDPOINT :'/sse' , 65ENDPOINT_QUERY :'/sse?' , 66ENDPOINT_SLASH :'/sse/' 67} as const ; 68 69/** Human-readable labels for MCP transport types */ 70export const MCP_TRANSPORT_LABELS :Record < MCPTransportType , string > = { 71[ MCPTransportType . SSE ] :'SSE' , 72[ MCPTransportType . STREAMABLE_HTTP ] :'HTTP' , 73[ MCPTransportType . WEBSOCKET ] :'WebSocket' 74}; 75 76/** Icon components for MCP transport types */ 77export const MCP_TRANSPORT_ICONS :Record < MCPTransportType , Component > = { 78[ MCPTransportType . SSE ] :Radio , 79[ MCPTransportType . STREAMABLE_HTTP ] :Globe , 80[ MCPTransportType . WEBSOCKET ] :Zap 81};