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:0xsline OpenChatCut Electron

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

Overview

Electron >= 43 runtime for the OpenChatCut desktop application, providing the main process, renderer window, and native worker threads for ASR and inference.

Description

Electron powers the desktop application that bundles the Vite-built renderer, an embedded HTTP server, and native inference workers. The main process manages window lifecycle, GPU crash recovery, auto-updates, and IPC bridges. Worker threads (`native-asr-worker`, `native-semantic-worker`, `native-clap-worker`, `native-rhythm-worker`) run inference in separate processes. The preload script exposes a sandboxed API to the renderer.

Usage

Use this environment for desktop native ASR, local inference workers, window management, auto-update, and embedded server lifecycle. It is the mandatory prerequisite for the desktop native ASR worker and any implementation running inside the Electron main or worker process.

System Requirements

Category Requirement Notes
OS macOS, Windows, Linux Packaged via electron-builder
Hardware GPU recommended Metal (macOS), D3D (Windows), VAAPI (Linux) for rendering
Disk 500MB+ for app bundle Includes Chromium, FFmpeg, whisper-cli binaries

Dependencies

npm Packages

  • `electron` >= 43.8.3 (devDependency)
  • `electron-builder` 26.15.7 (packaging)
  • `electron-updater` >= 6.8.9 (auto-update)

Quick Install

# Install Electron and packaging tools:
npm install --save-dev electron electron-builder

# Run desktop dev mode:
npm run desktop:dev

# Build desktop distribution:
npm run desktop:dist  # macOS arm64
npm run desktop:dist:win  # Windows x64
npm run desktop:dist:linux  # Linux x64

Code Evidence

Desktop build entry from `package.json:69`:

"desktop:build:main": "esbuild desktop/bootstrap.ts --bundle --platform=node --format=esm --packages=external --external:./app-main.mjs --sourcemap --outfile=desktop-dist/main.mjs && esbuild desktop/main.ts --bundle --platform=node --format=esm --packages=external --sourcemap --outfile=desktop-dist/app-main.mjs && esbuild desktop/native-asr-worker.ts --bundle --platform=node --format=esm --packages=external --sourcemap --outfile=desktop-dist/native-asr-worker.mjs"

ASR worker thread spawn pattern from `desktop/native-asr-worker.ts:56-57`:

const port = process.parentPort;
if (!port) throw new Error('native ASR process requires a parent port');

Common Errors

Error Message Cause Solution
`native ASR process requires a parent port` Worker not spawned via Electron's utilityProcess Ensure worker is spawned from main process with proper IPC
`app.asar` spawn failure Binary inside asar archive Use `unpackedPath()` to resolve to `app.asar.unpacked` twin
GPU process crash Driver issue or GL context loss Window recovery handles this; check `window-recovery.ts`

Compatibility Notes

  • macOS: Preferred platform for desktop builds (arm64 + x64). whisper.cpp uses Metal acceleration by default.
  • Windows: Packaged via NSIS installer. whisper-cli requires `.exe` suffix. Hardware binaries directory swapped for hardware encoder support.
  • Linux: Packaged as AppImage. GL backend defaults to `angle-egl`.
  • asar unpacking: Native binaries (FFmpeg, FFprobe, whisper-cli) must be listed in `asarUnpack` in electron-builder config; they cannot be spawned from inside `app.asar`.

Related Pages

Page Connections

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