an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions
HTML agent-harnessagent-orchestrationagentsai-agentsautonomous-agentsclaude-codecodexcoding-agentsdesktop-appdeveloper-toolselectrongemini-cliharnessharness-engineeringlocal-firstmemorymulti-agentopencodeorchestrationtypescript
fix(pty): restore +x on node-pty spawn-helper so agents can spawn
Chaitanya Giri09e5e453ddab
diff --git a/package.json b/package.jsonindex 52047aaf..dbdcd621 100644--- a/package.json+++ b/package.json@@ -14,7 +14,7 @@"dev": "electron-vite dev","build": "electron-vite build","preview": "electron-vite preview",- "postinstall": "electron-rebuild -f",+ "postinstall": "electron-rebuild -f && node tools/ensure-pty-perms.cjs","typecheck:node": "tsc --noEmit -p tsconfig.node.json","typecheck:web": "tsc --noEmit -p tsconfig.web.json","typecheck": "npm run typecheck:node && npm run typecheck:web",diff --git a/tools/ensure-pty-perms.cjs b/tools/ensure-pty-perms.cjsnew file mode 100644index 00000000..51807a0d--- /dev/null+++ b/tools/ensure-pty-perms.cjs@@ -0,0 +1,52 @@+#!/usr/bin/env node+'use strict';+/**+ * Guarantee node-pty's `spawn-helper` binaries are executable.+ *+ * On macOS/Linux node-pty does not exec the target command directly — it execs a+ * small `spawn-helper` binary that lives next to the loaded native module. Its+ * loader (node_modules/node-pty/lib/utils.js) resolves the native module from, in+ * order, `build/Release`, `build/Debug`, then `prebuilds/<platform>-<arch>`, and+ * derives `spawn-helper` from that same directory.+ *+ * In some installs the helper shipped inside `prebuilds/` lands with mode 644 (no+ * execute bit). When that's the copy node-pty loads, `pty.fork` fails with+ * "posix_spawnp failed" on EVERY spawn — so no PTY (and therefore no agent) can+ * start. `electron-rebuild` produces a correct copy under `bin/<runtime>-<abi>/`,+ * but node-pty's loader never looks there, so it falls back to the prebuild.+ *+ * This restores +x on every spawn-helper we can find so whichever one node-pty+ * resolves is runnable. No-op on Windows (conpty, no helper). Best-effort: a+ * missing node-pty or a chmod failure must never break `npm install`.+ */+const { chmodSync, existsSync, readdirSync, statSync } = require('node:fs');+const { join } = require('node:path');++if (process.platform === 'win32') process.exit(0);++try {+ const root = join(__dirname, '..', 'node_modules', 'node-pty');+ if (!existsSync(root)) process.exit(0);++ // Directories node-pty may load the native module (and thus the helper) from.+ const candidates = [join(root, 'build', 'Release'), join(root, 'build', 'Debug')];+ for (const base of [join(root, 'prebuilds'), join(root, 'bin')]) {+ if (!existsSync(base)) continue;+ for (const entry of readdirSync(base)) candidates.push(join(base, entry));+ }++ let fixed = 0;+ for (const dir of candidates) {+ const helper = join(dir, 'spawn-helper');+ if (!existsSync(helper)) continue;+ const mode = statSync(helper).mode & 0o777;+ if ((mode & 0o111) !== 0o111) {+ chmodSync(helper, mode | 0o755);+ fixed++;+ console.log('[ensure-pty-perms] +x', helper);+ }+ }+ if (fixed === 0) console.log('[ensure-pty-perms] node-pty spawn-helpers already executable');+} catch (e) {+ console.warn('[ensure-pty-perms] skipped:', e && e.message ? e.message : e);+}