mirror of
https://github.com/nightly-labs/openbot.git
synced 2026-11-26 02:29:31 +08:00
* fix(dev): strip Electron runtime flags from spawned children * feat(opencode): support Go subscription key instead of Zen * refactor(settings): minimalist OpenCode Go key dialog * feat(settings): key tier badge and Reconnect opens key dialog * feat(dev): exact role matching in dev-automation * refactor(contracts): free-tier ids as explicit product rule * fix(settings): keep keyless Connect/Restart, reconnect from key dialog * fix(settings): keep Sign in beside Connect/Restart on OpenCode row
23 lines
1.0 KiB
TypeScript
23 lines
1.0 KiB
TypeScript
/**
|
|
* Environment flags the Electron runtime itself reads, which must never reach
|
|
* a spawned Electron child.
|
|
*
|
|
* Agent shells often run inside an Electron harness that sets
|
|
* `ELECTRON_RUN_AS_NODE=1` (this process is proof: it runs as Node inside
|
|
* Electron). The dev scripts forward the parent environment to electron-vite
|
|
* and the Electron binary, and a leaked `ELECTRON_RUN_AS_NODE=1` makes the
|
|
* child run as plain Node: it loads the built main entry with the Node module
|
|
* loader and dies with
|
|
* `SyntaxError: ... does not provide an export named 'BrowserWindow'`.
|
|
* `ELECTRON_EXTRA_LAUNCH_ARGS` would likewise inject flags into every
|
|
* spawned Electron, so both are stripped at every Electron spawn boundary.
|
|
*/
|
|
|
|
export const ELECTRON_RUNTIME_ENV_KEYS = ["ELECTRON_RUN_AS_NODE", "ELECTRON_EXTRA_LAUNCH_ARGS"] as const;
|
|
|
|
export function withoutElectronRuntimeFlags(environment: NodeJS.ProcessEnv): NodeJS.ProcessEnv {
|
|
const child = { ...environment };
|
|
for (const key of ELECTRON_RUNTIME_ENV_KEYS) delete child[key];
|
|
return child;
|
|
}
|