How zhdh2008/ui-tars-desktop works
Main components
• Desktop Applications: There are two main “apps” (apps/agent-tars and apps/ui-tars). Agent TARS acts as a multimodal AI agent that integrates web page visual recognition, command line, and filesystem operations, whereas UI-TARS provides a GUI layer for natural language control.
• Electron Main Process: Both apps include an Electron “main” process that handles activities like creating windows, inter-process communications (IPC) via ipcRoutes, system-level operations (menus, file permissions, logging) and integrating with shared modules.
• Renderer/UI Process: The “renderer” directories under both apps contain the UI code (React with TSX), layout components, hooks, state management, and styling, forming the client-facing interface.
• Shared Libraries/Packages: The packages folder shows multiple libraries (agent-infra, common, ui-tars, etc.) that are used throughout the project. They include modules for logging, browser automation, agent actions, search functionalities, and more. They represent common infrastructure and utilities that both apps depend on.
• LLM Providers and Custom Tools: Notice the “llmProvider” and “customTools” directories in agent-tars. These define extensible interfaces and providers (like Anthropic, Azure OpenAI, Gemini, etc.) for interacting with large language models.
• IPC and Service Modules: Both the main and renderer sides have dedicated IPC route files (e.g., ipcRoutes) and service modules to facilitate communication between application parts, the operating system, and even external services.
• Deployment and Build Configurations: The presence of configuration files, build scripts (e.g., electron-builder.yml, vite configurations, forge configs), and GitHub workflows (in .github/workflows) indicate a well‐structured CI/CD and build process.
Relationships and interactions
• At the bottom, denote shared backend modules and external integrations such as:
▸ LLM providers (improving the AI capabilities) with their factory-pattern module (ProviderFactory.ts).
▸ File system operations, custom tools, and menu management.
▸ Shared libraries in the packages directory that support browser automation, logging, search functionalities, etc.
• From UI events triggered in the renderer to the main process via IPC (e.g., file permission requests, agent actions).
• From the main process to external services (like LLM providers or browser sessions) when invoking custom tools or fetching web information.
• From shared modules back to both main and renderer layers.
Architectural patterns and components
• Modular separation: Distinct modules for UI, system integration, agent logic (LLM and custom tool execution), and shared libraries.
• Plugin/Provider model: Emphasize the pluggable LLM providers and custom tool mechanisms that support various AI integrations.
• Use of micro-frontends: Show that within the renderer process, different feature components (like ChatUI, CanvasPanel, and Sidebar) are organized modularly—enhancing maintainability.
Following technical details
• Technologies and frameworks: Electron, Node.js, React (TypeScript/TSX), Vite, and build tools like Electron Builder.
• Agent TARS (with its customTools, ipcRoutes, llmProvider, mcp, and preload modules).
• UI-TARS Desktop (with components for ChatUI, window management, renderer processes, and preload scripts).
• Shared packages (agent-infra, logger, search, common utilities).
• External integrations (LLM providers: OpenAI, Anthropic, etc.)
• Renderer → IPC → Main Process.
• Main Process → LLM Providers / File System Services.
• Modules communicating via shared libraries.
Be as detailed as possible
• Avoid oversimplification—focus on representing the critical interoperability between renderer, main process, and shared libraries.
• Note sections for any CI/CD or build configurations if relevant for understanding the system lifecycle.