Skip to content

armgit / alook

Public Imported from GitHub
0

Multi-Agent Collaboration for Team and Friends

fix: persistent agent running

Gus7f3812aeb77e
diff --git a/src/cli/daemon/agent/claude.ts b/src/cli/daemon/agent/claude.ts
index e36760c67..724122e65 100644
--- a/src/cli/daemon/agent/claude.ts
+++ b/src/cli/daemon/agent/claude.ts
@@ -342,6 +342,13 @@ export class ClaudeBackend implements AgentBackend {
resultStatus = "failed";
lastError = result || "unknown error";
}
+
+ // In steering mode (--input-format stream-json), Claude keeps the
+ // process alive waiting for more stdin. Close stdin on result so the
+ // process exits and session.result resolves.
+ if (useStdinPrompt) {
+ try { proc.stdin?.end(); } catch { /* already closed */ }
+ }
break;
}
@@ -498,7 +505,13 @@ export class ClaudeBackend implements AgentBackend {
supportsStdinNotification: this.supportsStdinNotification,
};
- return { pid: proc.pid, messages, parsedEvents, sessionId: sessionIdPromise, result: resultPromise, send, descriptor };
+ const closeStdin = () => {
+ try {
+ if (proc.stdin && !proc.stdin.destroyed) proc.stdin.end();
+ } catch { /* already closed */ }
+ };
+
+ return { pid: proc.pid, messages, parsedEvents, sessionId: sessionIdPromise, result: resultPromise, send, closeStdin, descriptor };
}
}
diff --git a/src/cli/daemon/agent/codex.ts b/src/cli/daemon/agent/codex.ts
index 047cca71a..5bdf3fc14 100644
--- a/src/cli/daemon/agent/codex.ts
+++ b/src/cli/daemon/agent/codex.ts
@@ -876,6 +876,12 @@ export class CodexBackend implements AgentBackend {
supportsStdinNotification: this.supportsStdinNotification,
};
- return { pid: proc.pid, messages, parsedEvents, sessionId: sessionIdPromise, result: resultPromise, send, descriptor };
+ const closeStdin = () => {
+ try {
+ if (proc.stdin && !proc.stdin.destroyed) proc.stdin.end();
+ } catch { /* already closed */ }
+ };
+
+ return { pid: proc.pid, messages, parsedEvents, sessionId: sessionIdPromise, result: resultPromise, send, closeStdin, descriptor };
}
}
diff --git a/src/cli/daemon/agent/index.ts b/src/cli/daemon/agent/index.ts
index 2a936d76b..64dc6953e 100644
--- a/src/cli/daemon/agent/index.ts
+++ b/src/cli/daemon/agent/index.ts
@@ -21,6 +21,7 @@ export interface AgentSession {
sessionId: Promise<string>;
result: Promise<AgentResult>;
send?(text: string, mode: StdinMode): { ok: boolean; reason?: string };
+ closeStdin?(): void;
descriptor?: RuntimeSessionDescriptor;
}
diff --git a/src/cli/daemon/config.ts b/src/cli/daemon/config.ts
index 31fbcb547..db3d73bb6 100644
--- a/src/cli/daemon/config.ts
+++ b/src/cli/daemon/config.ts
@@ -115,7 +115,7 @@ export function loadDaemonConfig(profile?: string): DaemonConfig {
maxConcurrentTasks: parseInt(
process.env.ALOOK_DAEMON_MAX_CONCURRENT_TASKS || "20",
),
- enableSteering: process.env.ALOOK_ENABLE_STEERING !== "0",
+ enableSteering: process.env.ALOOK_ENABLE_STEERING === "1",
daemonId,
deviceName: process.env.ALOOK_DAEMON_DEVICE_NAME || h,
workspacesRoot,