Skip to content

AI-Zen Desktop ​

npm package @ai-zen/desktop-workspace · License ISC

AI-Zen Desktop is the desktop workbench of AI-Zen: built with Electron + Vue 3, it supports multiple workspaces and multiple concurrent conversations. Each workspace points to a local directory, where you have streaming conversations with the AI.

Tech Stack ​

LayerTechnology
Main processElectron 43 (Node 24) + TypeScript + rolldown bundling
Renderer processVue 3 + Vite + Pinia + Element Plus
Streaming Markdownmarkdown-it + highlight.js (languages registered on demand, synchronous rendering)
Agent runtime@ai-zen/agents-sdk (Provider / Agent / MCP capabilities) — running on the resident host side
Data storagethe resident agents-host (workspaces and conversation archives live on its disk; Desktop's own persistence is just the one connection-settings file, desktop/connection.json)

Project Structure ​

desktop/
├── packages/
│   ├── main/       ← Electron main process (rolldown bundling, ESM; object-oriented single root DesktopApp)
│   ├── render/     ← Vue 3 renderer process (Vite; thin client, only calls services + subscribes to events)
│   └── shared/     ← Shared types / IPC event DTOs (pure types, zero runtime)
├── scripts/dev.mjs ← Root `pnpm dev` one-click development
└── AGENTS.md       ← Handover guide (collaboration principles / startup / pitfalls)

Communication Architecture ​

Frontend/backend separation mindset: render is a thin client and does not generate business state; everything goes through a single IPC channel for calls + event callbacks.

  • Call: invokeService(service, method, ...args) dynamically dispatches to the corresponding service in the main process (exposed via preload, very thin, zero business definitions)
  • Push: chat:push single-channel event stream start → user → message… → done / error (+ independent migrated / renamed / notice / agents)
  • Exception: the connection: connection:get / save / test / state / reconnect (state doubles as the push channel) do not belong to those six services — "which host" has to be answered while no host exists yet. The window comes up first and the connection after, so when it cannot connect the window shows a status screen (retry / go to settings)

See Architecture Design for details.

Core Concepts ​

  • Workspace: { id, name, cwd }; cwd is the working directory conversations run in on the host, one workspace per local directory.
  • Conversation: { id, workspaceId, agentId, modelId, name, messages, createdAt, updatedAt }, multiple conversations per workspace.
  • Model priority: conversation-level modelId > Agent definition > global default (resolved on the host; the client only reads the effective value).
  • The agent belongs to the host: each conversation has an agent on the host, and it lives as long as the conversation does; when idle, the host's archive (workspaces/<id>/sessions/) takes over.

Documentation Navigation ​

  • Getting Started — environment requirements, installation, startup, core concepts and usage flow
  • Architecture Design — layering, connection, protocol surface, state ownership
  • Environment Setup — handling Electron binary download failures, path.txt
  • CDP Debugging — debugging the renderer process via the Chrome DevTools Protocol

For collaboration principles / startup / pitfalls, please read AGENTS.md at the repository root.

MIT License