Skip to content

Getting Started ​

Environment Requirements ​

ItemRequirement
Package managerpnpm (the repository uses a pnpm workspace, see pnpm-workspace.yaml)
Node.jspackage.json does not declare engines; a Node toolchain is required for development. Electron 43 ships Node 24.x
PlatformElectron 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 ​

bash
# Install all workspace dependencies at the repository root
pnpm install

If the Electron binary download fails, see Environment Setup.

Start the Development Environment ​

bash
# 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 in packages/main/src/app.ts), CDP debug port 9222 (override with the CDP_PORT env 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 dev again.

Build and Type Check ​

bash
# 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 build

Usage 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:

  1. Create a workspace: Sidebar "Create" → fill in name + choose directory (dialog:selectDirectory native directory picker, defaults to Desktop, remembers last location)
  2. Create a conversation: Button + dropdown to select an Agent (default preselected) → enter the conversation
  3. Send a message: User message appears on screen → AI streams a reply (reasoning / tool calls can be collapsed)
  4. Stop generation: While streaming, the send button switches to "Stop" → the host cancels this turn, keeping the already-generated part
  5. Switch conversations: Switch at any time; getState asks the host for a live snapshot every time, so nothing is lost

Core Concepts ​

  • Workspace: { id, name, cwd }; cwd is 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 }; modelId is 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:push events: start → user → message… → done / error (+ independent migrated / renamed / notice / agents).

References ​

MIT License