Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/coding-agent/src/cli/daemon-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ async function runStart(parsed: ParsedDaemonClientCommand): Promise<void> {
detached: true,
env: process.env,
stdio: "ignore",
windowsHide: true,
});
child.unref();

Expand Down
2 changes: 2 additions & 0 deletions packages/coding-agent/src/cli/daemon-launch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,8 @@ async function ensureDaemonRunning(socketPath: string, spawnCwd?: string): Promi
// (EPIPE once it exits); crash details come from the daemon log,
// which the supervisor writes to before rethrowing startup errors.
stdio: "ignore",
// detached on Windows would otherwise give the daemon a visible console.
windowsHide: true,
},
);
let childFailure:
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/cli/daemon-update-restart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ export async function launchDaemonUpdateRestartCoordinator(
detached: true,
env: coordinatorEnvironment(agentDir),
stdio: "ignore",
windowsHide: true,
});
let launchError: Error | undefined;
let exitDescription: string | undefined;
Expand Down
2 changes: 2 additions & 0 deletions packages/coding-agent/src/cli/owned-session-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ export async function runOwnedSessionWorkerFrontend(
[SESSION_LEASE_OWNER_ID_ENV]: `owned-${randomUUID()}`,
},
stdio,
// Console-less parents would otherwise flash a console window on Windows.
windowsHide: true,
});
currentChild = child;
if (!interactive) {
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ function readCommandOutput(
encoding: "utf-8",
stdio: ["ignore", "pipe", "pipe"],
shell: shouldUseWindowsShell(command),
windowsHide: true,
});
if (result.status === 0) return result.stdout.trim() || undefined;
if (options.requireSuccess) {
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/core/autonomous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ function runChildProcess(
detached: process.platform !== "win32",
shell: options.shell === true,
stdio: ["ignore", "pipe", "pipe"],
windowsHide: true,
});
if (child.pid) {
trackDetachedChildPid(child.pid);
Expand Down
2 changes: 2 additions & 0 deletions packages/coding-agent/src/core/footer-data-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function resolveBranchWithGitSync(repoDir: string): string | null {
cwd: repoDir,
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"],
windowsHide: true,
});
const branch = result.status === 0 ? result.stdout.trim() : "";
return branch || null;
Expand All @@ -24,6 +25,7 @@ function resolveBranchWithGitAsync(repoDir: string): Promise<string | null> {
{
cwd: repoDir,
encoding: "utf8",
windowsHide: true,
},
(error: ExecFileException | null, stdout: string) => {
if (error) {
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/src/core/package-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,7 @@ export class DefaultPackageManager implements PackageManager {
stdio: isStdoutTakenOver() ? ["ignore", 2, 2] : "inherit",
shell: shouldUseWindowsShell(command),
env: getEnv(),
windowsHide: true,
});
}

Expand All @@ -2397,6 +2398,7 @@ export class DefaultPackageManager implements PackageManager {
stdio: ["ignore", "pipe", "pipe"],
shell: shouldUseWindowsShell(command),
env: options?.env ? { ...baseEnv, ...options.env } : baseEnv,
windowsHide: true,
});
}

Expand Down Expand Up @@ -2464,6 +2466,7 @@ export class DefaultPackageManager implements PackageManager {
encoding: "utf-8",
shell: shouldUseWindowsShell(command),
env: getEnv(),
windowsHide: true,
});
if (result.error || result.status !== 0) {
throw new Error(
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/core/resolve-config-value.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function executeWithDefaultShell(command: string): string | undefined {
encoding: "utf-8",
timeout: 10000,
stdio: ["ignore", "pipe", "ignore"],
windowsHide: true,
});
return output.trim() || undefined;
} catch {
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/src/core/session-file-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ async function deleteSessionArtifacts(sessionPath: string): Promise<void> {
/** Remove the session `.jsonl`, trying the `trash` CLI first, then falling back to unlink. */
async function removeSessionFile(sessionPath: string): Promise<DeleteSessionFileResult> {
const trashArgs = sessionPath.startsWith("-") ? ["--", sessionPath] : [sessionPath];
const trashResult = spawnSync("trash", trashArgs, { encoding: "utf-8" });
const trashResult = spawnSync("trash", trashArgs, { encoding: "utf-8", windowsHide: true });

const getTrashErrorHint = (): string | null => {
const parts: string[] = [];
Expand Down
3 changes: 3 additions & 0 deletions packages/coding-agent/src/core/tools/bash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ export function createLocalBashOperations(options?: { shellPath?: string }): Bas
detached: process.platform !== "win32",
env: env ?? getShellEnv(),
stdio: ["ignore", "pipe", "pipe"],
// Console-less parents (daemon/workers) would otherwise flash a
// console window per bash call on Windows.
windowsHide: true,
});
if (child.pid) trackDetachedChildPid(child.pid);
let timedOut = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ export class DaemonCatalogClient {
cwd: process.cwd(),
env: createCliSubprocessEnv({ ...process.env, [DAEMON_CATALOG_ROLE_ENV]: "1" }),
stdio: ["ignore", "ignore", "ignore", "ipc"],
// The daemon has no console; without this Windows pops one for the child.
windowsHide: true,
});
this.child = child;
child.on("message", (value: unknown) => this.handleMessage(value));
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/modes/daemon/daemon-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ export class AgentDaemon {
detached: true,
env: environment,
stdio: "ignore",
windowsHide: true,
});
child.unref();
const deadline = Date.now() + 10_000;
Expand Down
4 changes: 4 additions & 0 deletions packages/coding-agent/src/modes/daemon/daemon-supervisor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2131,6 +2131,9 @@ export class DaemonSupervisor {
[SESSION_LEASE_OWNER_ID_ENV]: rootActiveSessionId,
}),
stdio: ["ignore", "ignore", "pipe", "pipe"],
// detached on Windows gives the worker its own visible console window
// (the ipython kernel then attaches to it, titled as python) — hide it.
windowsHide: true,
});
const detachWorkerStderr = child.stderr
? attachJsonlLineReader(child.stderr, (line) => this.log(`Session worker ${workerId} stderr: ${line}`), {
Expand Down Expand Up @@ -4864,6 +4867,7 @@ export class DaemonSupervisor {
detached: true,
env: environment,
stdio: "ignore",
windowsHide: true,
});
replacement.unref();
}
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/modes/rpc/rpc-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class RpcClient {
cwd: this.options.cwd,
env: { ...process.env, ...this.options.env },
stdio: ["pipe", "pipe", "pipe"],
windowsHide: true,
});

// Collect stderr for debugging
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/package-manager-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ async function runSelfUpdate(command: SelfUpdateCommand): Promise<void> {
const child = spawn(step.command, step.args, {
stdio: "inherit",
shell: shouldUseWindowsShell(step.command),
windowsHide: true,
});
child.on("error", (error) => {
reject(error);
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/utils/clipboard-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function runCommand(
timeout: timeoutMs,
maxBuffer: maxBufferBytes,
env: options?.env,
windowsHide: true,
});

if (result.error) {
Expand Down
8 changes: 7 additions & 1 deletion packages/coding-agent/src/utils/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type NativeClipboardExecOptions = {
input: string;
timeout: number;
stdio: ["pipe", "ignore", "ignore"];
windowsHide: boolean;
};

function copyToX11Clipboard(options: NativeClipboardExecOptions): void {
Expand Down Expand Up @@ -61,7 +62,12 @@ export async function copyToClipboard(text: string): Promise<void> {
return;
}

const options: NativeClipboardExecOptions = { input: text, timeout: 5000, stdio: ["pipe", "ignore", "ignore"] };
const options: NativeClipboardExecOptions = {
input: text,
timeout: 5000,
stdio: ["pipe", "ignore", "ignore"],
windowsHide: true,
};

if (!copied) {
try {
Expand Down
1 change: 1 addition & 0 deletions packages/coding-agent/src/utils/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ function runGit(cwd: string, args: string[]): string | null {
cwd,
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"],
windowsHide: true,
});
if (result.status !== 0 || typeof result.stdout !== "string") return null;
return result.stdout.trim() || null;
Expand Down
5 changes: 3 additions & 2 deletions packages/coding-agent/src/utils/shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function findBashOnPath(): string | null {
if (process.platform === "win32") {
// Windows: Use 'where' and verify file exists (where can return non-existent paths)
try {
const result = spawnSync("where", ["bash.exe"], { encoding: "utf-8", timeout: 5000 });
const result = spawnSync("where", ["bash.exe"], { encoding: "utf-8", timeout: 5000, windowsHide: true });
if (result.status === 0 && result.stdout) {
const firstMatch = result.stdout.trim().split(/\r?\n/)[0];
if (firstMatch && existsSync(firstMatch)) {
Expand All @@ -31,7 +31,7 @@ function findBashOnPath(): string | null {

// Unix: Use 'which' and trust its output (handles Termux and special filesystems)
try {
const result = spawnSync("which", ["bash"], { encoding: "utf-8", timeout: 5000 });
const result = spawnSync("which", ["bash"], { encoding: "utf-8", timeout: 5000, windowsHide: true });
if (result.status === 0 && result.stdout) {
const firstMatch = result.stdout.trim().split(/\r?\n/)[0];
if (firstMatch) {
Expand Down Expand Up @@ -194,6 +194,7 @@ export function killProcessTree(pid: number): void {
spawn("taskkill", ["/F", "/T", "/PID", String(pid)], {
stdio: "ignore",
detached: true,
windowsHide: true,
});
} catch {
// Ignore errors if taskkill fails
Expand Down
7 changes: 5 additions & 2 deletions packages/coding-agent/src/utils/tools-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const TOOLS: Record<string, ToolConfig> = {
// Check that a command both launches and reports a successful version.
function commandWorks(cmd: string): boolean {
try {
const result = spawnSync(cmd, ["--version"], { stdio: "pipe", timeout: COMMAND_TIMEOUT_MS });
const result = spawnSync(cmd, ["--version"], { stdio: "pipe", timeout: COMMAND_TIMEOUT_MS, windowsHide: true });
return !result.error && result.status === 0;
} catch {
return false;
Expand Down Expand Up @@ -224,7 +224,10 @@ async function downloadTool(tool: ManagedTool): Promise<string> {

try {
if (assetName.endsWith(".tar.gz")) {
const extractResult = spawnSync("tar", ["xzf", archivePath, "-C", extractDir], { stdio: "pipe" });
const extractResult = spawnSync("tar", ["xzf", archivePath, "-C", extractDir], {
stdio: "pipe",
windowsHide: true,
});
if (extractResult.error || extractResult.status !== 0) {
const errMsg = extractResult.error?.message ?? extractResult.stderr?.toString().trim() ?? "unknown error";
throw new Error(`Failed to extract ${assetName}: ${errMsg}`);
Expand Down