Skip to content

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

fix(integration): correct dispatch wrap call + Windows guard for hidden Claude spawn

Chaitanya Giri28b18833d530
diff --git a/src/main/hiddenClaude.ts b/src/main/hiddenClaude.ts
index 76032171..06d75f78 100644
--- a/src/main/hiddenClaude.ts
+++ b/src/main/hiddenClaude.ts
@@ -119,9 +119,15 @@ export function runHiddenClaude(prompt: string, opts: HiddenClaudeOptions): Prom
const timeoutMs = opts.timeoutMs ?? 180_000;
const spawnedAt = Date.now();
+ // Windows: node-pty's CreateProcess can't exec the npm `.cmd`/extensionless
+ // `claude` shim directly (ERROR_BAD_EXE_FORMAT, error 193) — route non-.exe
+ // targets through cmd.exe. A real claude.exe (WinGet) launches directly. (#22)
+ const winWrap = process.platform === 'win32' && !/\.(exe|com)$/i.test(exe);
+ const spawnFile = winWrap ? (process.env.ComSpec || 'cmd.exe') : exe;
+ const spawnArgs = winWrap ? ['/c', exe, ...args] : args;
let ptyProc: pty.IPty;
try {
- ptyProc = pty.spawn(exe, args, {
+ ptyProc = pty.spawn(spawnFile, spawnArgs, {
name: 'xterm-color',
cols: 220,
rows: 50,
diff --git a/src/renderer/src/hooks/useHive.ts b/src/renderer/src/hooks/useHive.ts
index c47b013d..b4150d3f 100644
--- a/src/renderer/src/hooks/useHive.ts
+++ b/src/renderer/src/hooks/useHive.ts
@@ -390,7 +390,7 @@ export function useHive(config: HarnessConfig | null): void {
if (next.text.trim().toLowerCase() === '/clear') {
useStore.getState().updateAgent(target.id, { contextTokens: 0, contextLimit: undefined, progress: 0 });
}
- submitToPty(target.ptyId, wrap ? wrap(next.text) : next.text).catch(() => { /* pty may have died */ });
+ submitToPty(target.ptyId, wrap ? wrap(next) : next.text).catch(() => { /* pty may have died */ });
return true;
};