Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:777genius Agent teams ai Electron Main Process

From Leeroopedia
Knowledge Sources
Domains Infrastructure, Desktop_App
Last Updated 2026-10-22 00:00 GMT

Overview

Node.js runtime executing the Electron main process for the agent-teams desktop app, providing IPC, file system access, and process management.

Description

The Electron main process is the backend of the Electron 40.x desktop application. It runs in Node.js (>=24.15.0 <25 || >=26 <27) with access to native modules, the file system, and OS-level APIs. It hosts IPC handlers, team provisioning services, CLI runtime detection, SQLite databases, and the Fastify HTTP server. The main process has path aliases `@main/*` and `@shared/*` and compiles to CommonJS (`dist-electron/main/index.cjs`). Production dependencies from `package.json` are bundled into the asar archive; native addons (`node-pty`, `better-sqlite3`, `terminal-platform-node`) are externalized.

Usage

Use this environment for any implementation running in the Electron main process: team configuration, provisioning, inbox messaging, kanban management, diff extraction, review persistence, CLI installer status, session discovery, chunk building, and the Fastify HTTP API.

System Requirements

Category Requirement Notes
OS macOS, Windows, or Linux Cross-platform; platform-specific code paths exist for process killing and path handling
Runtime \| >=26 <27 Pinned in `package.json` engines field
Framework Electron 40.x Provides main process APIs, IPC, and window management
Memory 8192 MB heap for build `--max-old-space-size=8192` in build script
Disk ~500 MB for node_modules + runtime artifacts Includes staged CLI binaries and SQLite databases

Dependencies

System Packages

  • `node-pty` (native addon — externalized, not bundled)
  • `better-sqlite3` (native addon — used by review persistence scope lock)
  • `terminal-platform-node` (native addon — externalized)
  • `fastify` + `@fastify/cors` + `@fastify/static` (externalized runtime deps)

Node.js Packages

  • `electron` >= 40.x
  • `better-sqlite3` (native SQLite binding)
  • `node:sqlite` (built-in `DatabaseSync` — Node.js 24+ experimental)
  • `fastify` >= 5.x
  • `zustand` (shared types only; renderer-side store)
  • `typescript` (native compiler — `@typescript/native`)

Credentials

The following environment variables may be set at runtime:

  • `APPLE_API_KEY`, `APPLE_API_KEY_ID`, `APPLE_API_ISSUER` — Apple notarization (macOS builds only)
  • `SENTRY_AUTH_TOKEN` — Sentry source map upload
  • `POSTHOG_HOST` / `VITE_POSTHOG_HOST` — PostHog analytics endpoint
  • `CLAUDE_TEAM_PARALLEL_PROVIDER_STATUS` — Parallel provider status probe control

Quick Install

# Install all dependencies (requires pnpm)
pnpm install

# The postinstall script rebuilds native Electron modules
# (node-pty, better-sqlite3, cpu-features)

Code Evidence

Node.js engine constraint from `package.json:22-24`:

"engines": {
  "node": ">=24.15.0 <25 || >=26 <27"
}

Native module externalization 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',
])

SQLite usage from `ReviewPersistenceScopeLock.ts:1`:

import { DatabaseSync } from 'node:sqlite';

Platform-aware process killing from `TeamProvisioningRunProgress.ts:48-50`:

// Windows taskkill accepts only a PID. Once Node has observed this exact
// ChildProcess exit, that PID can already belong to another process

Common Errors

Error Message Cause Solution
`node:sqlite` not found Node.js < 24 Upgrade to Node.js >= 24.15.0
`better-sqlite3` native build fails Missing build tools or Electron version mismatch Run `pnpm postinstall` to rebuild native modules
`EPERM` on Windows rename Antivirus or file lock on atomic write target Rename retry loop handles transient `EPERM`/`EACCES`/`EBUSY`
CLI process cleanup deletes team files SIGTERM triggers graceful cleanup in Claude CLI >= 2.1.x Use `SIGKILL` via `killTeamProcess()` instead

Compatibility Notes

  • Windows: `taskkill` used for process tree termination; path normalization lowercases paths; `powershell.exe` startup costs ~1s for process start time probes.
  • macOS: Notarization requires Apple Developer credentials; app must be in `/Applications` for auto-update.
  • Linux: `afterInstall.sh` runs post-install; musl variants supported (`linux-x64-musl`, `linux-arm64-musl`).
  • Native addons: Must be rebuilt per Electron version via `postinstall-electron.cjs`.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment