Environment:777genius Agent teams ai Electron
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Desktop_App |
| Last Updated | 2026-10-22 00:00 GMT |
Overview
Electron 40.x framework providing the desktop application shell with main process, renderer, and preload bridge, built via electron-vite.
Description
The app is built on Electron 40.x using the `electron-vite` build tool. The build produces three targets: main process (CommonJS, bundled to `dist-electron/main/index.cjs`), preload script, and renderer (ESNext via Vite). Production dependencies are bundled into the asar archive to avoid pnpm symlink issues. Native addons (`node-pty`, `better-sqlite3`, `terminal-platform-node`) and Fastify are externalized because they rely on runtime module resolution. The app supports auto-update via electron-updater and error reporting via Sentry.
Usage
Use this environment for the electron-vite build configuration that compiles the three-target Electron application.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| Framework | Electron 40.x | Pinned in pnpm-workspace.yaml overrides |
| Build Tool | electron-vite | Vite-based Electron build tool |
| Memory | 8192 MB heap | `--max-old-space-size=8192` in build script |
| OS | macOS, Windows, or Linux | Cross-platform builds |
Dependencies
Node.js Packages
- `electron` >= 40.x
- `electron-vite` (build orchestration)
- `@sentry/vite-plugin` (source map upload)
- `@vitejs/plugin-react` (renderer JSX)
- `electron-builder` (packaging)
- `@electron/notarize` (macOS notarization)
Credentials
- `SENTRY_AUTH_TOKEN` — Sentry source map upload (optional, for release builds)
- `VITE_POSTHOG_HOST` / `POSTHOG_HOST` — PostHog analytics endpoint
Quick Install
# Install dependencies (includes Electron binary via postinstall)
pnpm install
# Build all three targets
pnpm build
# Run in dev mode with hot reload
pnpm dev
Code Evidence
Three-target build from `electron.vite.config.ts:2`:
import { defineConfig } from 'electron-vite'
Production deps bundling from `electron.vite.config.ts:17-21`:
// Read all production dependencies from package.json
// so they get bundled into the main process output.
// This avoids pnpm symlink issues with electron-builder's asar packaging.
const pkg = JSON.parse(readFileSync(resolve(__dirname, 'package.json'), 'utf-8'))
const prodDeps = Object.keys(pkg.dependencies || {})
Externalized native deps from `electron.vite.config.ts:49-58`:
const runtimeExternalDeps = new Set([
'node-pty',
'better-sqlite3',
'agent-teams-controller',
'terminal-platform-node',
'ws',
'fastify',
'@fastify/cors',
'@fastify/static',
])
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| Native module not found in packaged app | Module not externalized | Add to `runtimeExternalDeps` set |
| pnpm symlink issues in asar | Dependencies not bundled | Ensure `prodDeps` includes all dependencies |
| Electron binary not installed | postinstall failed | Run `node ./scripts/ensure-electron-install.cjs` |
Compatibility Notes
- Electron 44 migration: See `docs/electron-44-migration.md` for upgrade guidance.
- Native addons: Rebuilt via `scripts/postinstall-electron.cjs` after install.
- Standalone web build: `docker/vite.standalone.config.ts` provides a non-Electron web build for Docker.