← Documentation Home

AgentStudio Electron IDE Architecture

Entry Point

Active Entry Point: src/main/main.tsdist/main/main.js (as specified in package.json)

Legacy Entry Point: src/main.ts (500+ lines, direct IPC handlers) - TO BE REMOVED

Architecture Decisions

Main Process Structure

IPC Handler Pattern

All IPC handlers are registered via initializeIpcRouter() which calls:

Service Initialization

Services are initialized in src/main/main.ts before IPC router:

  1. Extension host initialization
  2. IPC router registration
  3. Auto-updater setup
  4. Window creation

Legacy main.ts Migration Status

Status: src/main.ts contains service-specific handlers that need migration:

Action Required: Migrate service-dependent handlers to ipc-router.ts with proper service injection, then delete src/main.ts.

Build Configuration

Security

Extension System

Status: Placeholder implementation

Future Work: Complete extension host or remove if not needed.

Code-Server Integration (Option A2)

Code-server is deployed as standalone service (no iframes):

See infrastructure/CODE_SERVER_DEPLOYMENT.md for deployment details.

kAgent Integration

kAgent deployed in same Kubernetes cluster:

Known Issues

  1. Duplicate main.ts: Legacy file needs handler migration and deletion
  2. Extension Host: Placeholder implementation needs completion or removal
  3. Hardcoded Paths: Fixed in kagent.service.ts and vite.config.ts (now use environment variables)
  4. TypeScript Strict Mode: Enabled - may reveal type errors that need fixing

File Structure

src/
├── main/
│   ├── main.ts              # Entry point (ACTIVE)
│   ├── ipc-router.ts        # IPC handlers
│   ├── extension-host.ts    # Extension system
│   ├── auto-updater.ts      # Auto-update
│   └── security/             # Security modules
├── preload/
│   └── preload.ts           # Secure IPC bridge
├── renderer/                # React UI
├── services/                # Business logic services
└── types/                   # TypeScript types

Development Workflow

  1. Development: npm run dev (concurrently runs Vite dev server + Electron)
  2. Build: npm run build (TypeScript + Vite)
  3. Package: npm run package (electron-builder)
  4. Test: npm test (Vitest)