Environment:3641397194 wq Gpt6 Astra Electron
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Desktop |
| Last Updated | 2026-10-26 14:00 GMT |
Overview
Electron 35.7.5+ desktop application runtime providing BrowserWindow, IPC (`ipcMain`/`contextBridge`), and webContents APIs for the ColdBrew Zero workbench, with contextIsolation and sandbox enabled.
Description
This environment is the Electron main-process runtime that hosts the ColdBrew Zero desktop workbench. It provides `BrowserWindow` creation, the `ipcMain` IPC hub, `webContents` navigation/lifecycle hooks, and the `contextBridge` preload mechanism. The desktop app is packaged with Electron 35.7.5+ (declared in `desktop/package.json`) and enforces a strict trust boundary: the renderer runs with `contextIsolation: true` and `sandbox: true`, all privileged operations are exposed only via explicitly bridged `ipcMain.handle` channels, and `window-security.js` asserts the sender frame/URL on every IPC call and blocks all navigation, webview attachment, and window-open attempts. The main process also handles the relay IPC handlers, seat-pack install/uninstall orchestration, and REA upstream preparation.
Usage
Use this environment for implementations that operate in the Electron main process and depend on BrowserWindow/IPC/webContents APIs — specifically the IPC trust boundary enforcement (`window-security.js`). The Electron runtime bundles a compatible Node.js, so no separate Node.js install is required for desktop usage (the separate `Node_js` environment applies to the REA launcher, which needs a standalone Node.js).
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Windows / macOS / Linux | Cross-platform desktop app |
| Electron | 35.7.5+ | Declared in `desktop/package.json`; bundled via electron-builder |
| Security | contextIsolation: true, sandbox: true | Renderer is sandboxed; privileged APIs only via contextBridge |
| IPC | ipcMain.handle / contextBridge | All privileged operations are bridged channels |
Dependencies
System Packages
- Electron 35.7.5+ (bundles Chromium + Node.js runtime)
JavaScript Packages
- `electron` >= 35.7.5 (devDependency — the packaged app bundles the runtime)
- `electron-builder` >= 26.15.3 (packaging)
Credentials
This environment does not require external credentials. Relay/API tokens and seat-specific keys are managed at runtime via the RelayAdapter configuration and persisted in the user's config directory, not by the Electron runtime itself.
Quick Install
# Electron is installed as a devDependency of the desktop app:
cd desktop && npm install
npm start # launch the workbench in development mode
# The packaged app bundles Electron; end users do not install Electron separately.
Code Evidence
BrowserWindow with sandbox + contextIsolation from `desktop/src/main.js`:
const { BrowserWindow } = require('electron');
const win = new BrowserWindow({
webPreferences: {
contextIsolation: true,
sandbox: true,
preload: path.join(__dirname, 'preload.js'),
},
});
win.loadFile(path.join(__dirname, '../renderer/workbench.html'));
IPC trust-boundary assertion from `window-security.js`:
function assertTrustedSender(event, window, entryFile) {
if (event.frameId !== window.webContents.mainFrame.id) throw new Error('untrusted frame');
if (!isTrustedDocument(event.senderFrame.url, entryFile)) throw new Error('untrusted sender');
}
Electron version from `desktop/package.json`:
"devDependencies": {
"electron": ">=35.7.5",
"electron-builder": ">=26.15.3"
}
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `Electron failed to launch` | Electron not installed | Run `npm install` in `desktop/` |
| IPC handler throws `untrusted sender` | Renderer loaded a non-trusted document | Ensure `loadFile()` targets the exact entry HTML; check `assertTrustedSender` |
| `contextBridge is not defined` | preload.js not wired | Confirm `webPreferences.preload` points to `preload.js` and contextIsolation is on |
Compatibility Notes
- Electron 35.7.5+: The trust boundary and navigation hooks target the 35.x API (`will-frame-navigate`).
- contextIsolation + sandbox: Renderer cannot use Node.js APIs directly; all bridging is explicit via `contextBridge.exposeInMainWorld`.
- Bundled Node.js: The desktop app uses Electron's bundled Node.js; standalone Node.js (the `Node_js` environment) is only required for REA upstream preparation.
- Navigation lockdown: `protectWindow` blocks all navigation, webview attachment, and window-open; external URLs are handled by the host-allowlisted shell handler in `main.js`.