Getting Started
Environment Requirements
| Item | Requirement |
|---|---|
| Package manager | pnpm (the repository uses a pnpm workspace, see pnpm-workspace.yaml) |
| Node.js | package.json does not declare engines; a Node toolchain is required for development. Electron 43 ships Node 24.x |
| Platform | Electron is cross-platform; debugging examples mainly target Windows |
| CDP tools | .ai-zen/tools/cdp-*.mjs need Node.js ≥ 21 (built-in WebSocket / fetch, zero external dependencies) |
Installation
# Install all workspace dependencies at the repository root
pnpm installIf the Electron binary download fails, see Environment Setup.
Start the Development Environment
# One-click development: rolldown watch(main) + vite(render) + nodemon restarts electron
pnpm dev- Composition:
vite(render hot reload) +rolldown --watch(main compile) +nodemon(restart electron on main changes) +electron(with--remote-debugging-port=9222) - In development mode Electron loads
http://localhost:5173(hard-coded inpackages/main/src/app.ts), CDP debug port9222(override with theCDP_PORTenv var)
⚠️ Make sure there is no already-running dev instance before starting: Two vite processes fight over port 5173 (the later one backs off to 5174, but Electron hard-codes 5173), and two Electron processes fight over CDP 9222, leading to unpredictable behavior. If an instance already exists, use CDP Debugging directly and do not run
pnpm devagain.
Build and Type Check
# Build everything
pnpm build
# render type check (after changing apis/stores/views)
cd packages/render && pnpm exec vue-tsc --noEmit
# main build (after changing host/main)
cd packages/main && pnpm buildUsage Flow (User Perspective)
The first screen after launch is the connection status screen (the window comes up first, the connection after): it shows "connecting to <label>" (during a retry wait it adds "retry N, in about X seconds"); only once the connection is ready does the app fall through to the guide page or the main interface, depending on whether any workspace exists. When it cannot connect, that screen shows the error (including "still not connected after 3 retries") together with "retry" and "go to settings" — the settings page is reachable while disconnected: switch back to "local" or change the address / credential there, and a successful save-and-reconnect takes you to the main interface.
Once connected, on first launch you enter the guide page (when there is no workspace), create a workspace (name/directory are both optional; directory defaults to Desktop), then enter the main interface:
- Create a workspace: Sidebar "Create" → fill in name + choose directory (
dialog:selectDirectorynative directory picker, defaults to Desktop, remembers last location) - Create a conversation: Button + dropdown to select an Agent (default preselected) → enter the conversation
- Send a message: User message appears on screen → AI streams a reply (reasoning / tool calls can be collapsed)
- Stop generation: While streaming, the send button switches to "Stop" → the host cancels this turn, keeping the already-generated part
- Switch conversations: Switch at any time;
getStateasks the host for a live snapshot every time, so nothing is lost
Core Concepts
- Workspace:
{ id, name, cwd };cwdis the working directory conversations run in on the host, defaulting to Desktop as fallback; deleting a workspace cascades to delete its conversations. - Conversation:
{ id, workspaceId, agentId, modelId, name, messages, createdAt, updatedAt };modelIdis the model this conversation effectively uses (the host's three-level resolution result). - Model priority: conversation
modelId> Agent definition > global default. - the agent belongs to the host: each conversation has an agent on the host that lives as long as the conversation does (readable while streaming); the host reclaims it on an idle grace period. When idle, the host's archive takes over.
chat:pushevents:start → user → message… → done / error(+ independentmigrated/renamed/notice/agents).
References
- Architecture Design — layering, connection, protocol surface, state ownership
- Environment Setup — Electron binary,
path.txt - CDP Debugging — DevTools Protocol debugging methods