Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1```mermaid2sequenceDiagram3 participant UI as 🧩 McpServersSettings / ChatForm4 participant chatStore as 🗄️ chatStore5 participant mcpStore as 🗄️ mcpStore6 participant mcpResStore as 🗄️ mcpResourceStore7 participant convStore as 🗄️ conversationsStore8 participant MCPSvc as ⚙️ MCPService9 participant LS as 💾 LocalStorage10 participant ExtMCP as 🔌 External MCP Server11 12 Note over mcpStore: State:<br/>isInitializing, error<br/>toolCount, connectedServers<br/>healthChecks (Map)<br/>connections (Map)<br/>toolsIndex (Map)<br/>serverConfigs (Map)13 14 Note over mcpResStore: State:<br/>serverResources (Map)<br/>cachedResources (Map)<br/>subscriptions (Map)<br/>attachments[]15 16 %% ═══════════════════════════════════════════════════════════════════════════17 Note over UI,ExtMCP: 🚀 INITIALIZATION (App Startup)18 %% ═══════════════════════════════════════════════════════════════════════════19 20 UI->>mcpStore: ensureInitialized()21 activate mcpStore22 23 mcpStore->>LS: get(MCP_SERVERS_LOCALSTORAGE_KEY)24 LS-->>mcpStore: MCPServerSettingsEntry[]25 26 mcpStore->>mcpStore: parseServerSettings(servers)27 Note right of mcpStore: Filter enabled servers<br/>Build MCPServerConfig objects<br/>Per-chat overrides checked via convStore28 29 loop For each enabled server30 mcpStore->>mcpStore: runHealthCheck(serverId)31 mcpStore->>mcpStore: updateHealthCheck(id, CONNECTING)32 33 mcpStore->>MCPSvc: connect(serverName, config, clientInfo, capabilities, onPhase)34 activate MCPSvc35 36 MCPSvc->>MCPSvc: createTransport(config)37 Note right of MCPSvc: WebSocket / StreamableHTTP / SSE<br/>with optional CORS proxy38 39 MCPSvc->>ExtMCP: Transport handshake40 ExtMCP-->>MCPSvc: Connection established41 42 MCPSvc->>ExtMCP: Initialize request43 Note right of ExtMCP: Exchange capabilities<br/>Server info, protocol version44 45 ExtMCP-->>MCPSvc: InitializeResult (serverInfo, capabilities)46 47 MCPSvc->>ExtMCP: listTools()48 ExtMCP-->>MCPSvc: Tool[]49 50 MCPSvc-->>mcpStore: MCPConnection51 deactivate MCPSvc52 53 mcpStore->>mcpStore: connections.set(serverName, connection)54 mcpStore->>mcpStore: indexTools(connection.tools, serverName)55 Note right of mcpStore: toolsIndex.set(toolName, serverName)<br/>Handle name conflicts with prefixes56 57 mcpStore->>mcpStore: updateHealthCheck(id, SUCCESS)58 mcpStore->>mcpStore: _connectedServers.push(serverName)59 60 alt Server supports resources61 mcpStore->>MCPSvc: listAllResources(connection)62 MCPSvc->>ExtMCP: listResources()63 ExtMCP-->>MCPSvc: MCPResource[]64 MCPSvc-->>mcpStore: resources65 66 mcpStore->>MCPSvc: listAllResourceTemplates(connection)67 MCPSvc->>ExtMCP: listResourceTemplates()68 ExtMCP-->>MCPSvc: MCPResourceTemplate[]69 MCPSvc-->>mcpStore: templates70 71 mcpStore->>mcpResStore: setServerResources(serverName, resources, templates)72 end73 end74 75 mcpStore->>mcpStore: _isInitializing = false76 deactivate mcpStore77 78 %% ═══════════════════════════════════════════════════════════════════════════79 Note over UI,ExtMCP: 🔧 TOOL EXECUTION (Chat with Tools)80 %% ═══════════════════════════════════════════════════════════════════════════81 82 UI->>mcpStore: executeTool(mcpCall: MCPToolCall, signal?)83 activate mcpStore84 85 mcpStore->>mcpStore: toolsIndex.get(mcpCall.function.name)86 Note right of mcpStore: Resolve serverName from toolsIndex<br/>MCPToolCall = {id, type, function: {name, arguments}}87 88 mcpStore->>mcpStore: acquireConnection()89 Note right of mcpStore: activeFlowCount++<br/>Prevent shutdown during execution90 91 mcpStore->>mcpStore: connection = connections.get(serverName)92 93 mcpStore->>MCPSvc: callTool(connection, {name, arguments}, signal)94 activate MCPSvc95 96 MCPSvc->>MCPSvc: throwIfAborted(signal)97 MCPSvc->>ExtMCP: callTool(name, arguments)98 99 alt Tool execution success100 ExtMCP-->>MCPSvc: ToolCallResult (content, isError)101 MCPSvc->>MCPSvc: formatToolResult(result)102 Note right of MCPSvc: Handle text, image (base64),<br/>embedded resource content103 MCPSvc-->>mcpStore: ToolExecutionResult104 else Tool execution error105 ExtMCP-->>MCPSvc: Error106 MCPSvc-->>mcpStore: throw Error107 else Aborted108 MCPSvc-->>mcpStore: throw AbortError109 end110 111 deactivate MCPSvc112 113 mcpStore->>mcpStore: releaseConnection()114 Note right of mcpStore: activeFlowCount--115 116 mcpStore-->>UI: ToolExecutionResult117 deactivate mcpStore118 119 %% ═══════════════════════════════════════════════════════════════════════════120 Note over UI,ExtMCP: � RESOURCE ATTACHMENT CONSUMPTION121 %% ═══════════════════════════════════════════════════════════════════════════122 123 chatStore->>mcpStore: consumeResourceAttachmentsAsExtras()124 activate mcpStore125 mcpStore->>mcpResStore: getAttachments()126 mcpResStore-->>mcpStore: MCPResourceAttachment[]127 mcpStore->>mcpStore: Convert attachments to message extras128 mcpStore->>mcpResStore: clearAttachments()129 mcpStore-->>chatStore: MessageExtra[] (for user message)130 deactivate mcpStore131 132 %% ═══════════════════════════════════════════════════════════════════════════133 Note over UI,ExtMCP: �📝 PROMPT OPERATIONS134 %% ═══════════════════════════════════════════════════════════════════════════135 136 UI->>mcpStore: getAllPrompts()137 activate mcpStore138 139 loop For each connected server with prompts capability140 mcpStore->>MCPSvc: listPrompts(connection)141 MCPSvc->>ExtMCP: listPrompts()142 ExtMCP-->>MCPSvc: Prompt[]143 MCPSvc-->>mcpStore: prompts144 end145 146 mcpStore-->>UI: MCPPromptInfo[] (with serverName)147 deactivate mcpStore148 149 UI->>mcpStore: getPrompt(serverName, promptName, args?)150 activate mcpStore151 152 mcpStore->>MCPSvc: getPrompt(connection, name, args)153 MCPSvc->>ExtMCP: getPrompt({name, arguments})154 ExtMCP-->>MCPSvc: GetPromptResult (messages)155 MCPSvc-->>mcpStore: GetPromptResult156 157 mcpStore-->>UI: GetPromptResult158 deactivate mcpStore159 160 %% ═══════════════════════════════════════════════════════════════════════════161 Note over UI,ExtMCP: 📁 RESOURCE OPERATIONS162 %% ═══════════════════════════════════════════════════════════════════════════163 164 UI->>mcpResStore: addAttachment(resourceInfo)165 activate mcpResStore166 mcpResStore->>mcpResStore: Create MCPResourceAttachment (loading: true)167 mcpResStore-->>UI: attachment168 169 UI->>mcpStore: readResource(serverName, uri)170 activate mcpStore171 172 mcpStore->>MCPSvc: readResource(connection, uri)173 MCPSvc->>ExtMCP: readResource({uri})174 ExtMCP-->>MCPSvc: MCPReadResourceResult (contents)175 MCPSvc-->>mcpStore: contents176 177 mcpStore-->>UI: MCPResourceContent[]178 deactivate mcpStore179 180 UI->>mcpResStore: updateAttachmentContent(attachmentId, content)181 mcpResStore->>mcpResStore: cacheResourceContent(resource, content)182 deactivate mcpResStore183 184 %% ═══════════════════════════════════════════════════════════════════════════185 Note over UI,ExtMCP: 🔄 AUTO-RECONNECTION186 %% ═══════════════════════════════════════════════════════════════════════════187 188 Note over mcpStore: On WebSocket close or connection error:189 mcpStore->>mcpStore: autoReconnect(serverName, attempt)190 activate mcpStore191 192 mcpStore->>mcpStore: Calculate backoff delay193 Note right of mcpStore: delay = min(30s, 1s * 2^attempt)194 195 mcpStore->>mcpStore: Wait for delay196 mcpStore->>mcpStore: reconnectServer(serverName)197 198 alt Reconnection success199 mcpStore->>mcpStore: updateHealthCheck(id, SUCCESS)200 else Max attempts reached201 mcpStore->>mcpStore: updateHealthCheck(id, ERROR)202 end203 deactivate mcpStore204 205 %% ═══════════════════════════════════════════════════════════════════════════206 Note over UI,ExtMCP: 🛑 SHUTDOWN207 %% ═══════════════════════════════════════════════════════════════════════════208 209 UI->>mcpStore: shutdown()210 activate mcpStore211 212 mcpStore->>mcpStore: Wait for activeFlowCount == 0213 214 loop For each connection215 mcpStore->>MCPSvc: disconnect(connection)216 MCPSvc->>MCPSvc: transport.onclose = undefined217 MCPSvc->>ExtMCP: close()218 end219 220 mcpStore->>mcpStore: connections.clear()221 mcpStore->>mcpStore: toolsIndex.clear()222 mcpStore->>mcpStore: _connectedServers = []223 224 mcpStore->>mcpResStore: clear()225 deactivate mcpStore226```227 