Start MCP poller immediately when session starts
This commit is contained in:
parent
ad3c2928cf
commit
bc30ef22fe
16
main.ts
16
main.ts
|
|
@ -220,7 +220,6 @@ function spawnSessionPty(
|
||||||
activePtyProcesses.set(sessionId, ptyProcess);
|
activePtyProcesses.set(sessionId, ptyProcess);
|
||||||
|
|
||||||
let terminalReady = false;
|
let terminalReady = false;
|
||||||
let claudeReady = false;
|
|
||||||
let dataBuffer = "";
|
let dataBuffer = "";
|
||||||
|
|
||||||
ptyProcess.onData((data) => {
|
ptyProcess.onData((data) => {
|
||||||
|
|
@ -264,21 +263,14 @@ function spawnSessionPty(
|
||||||
const flags = [sessionFlag, skipPermissionsFlag, mcpConfigFlag].filter(f => f).join(" ");
|
const flags = [sessionFlag, skipPermissionsFlag, mcpConfigFlag].filter(f => f).join(" ");
|
||||||
const claudeCmd = `claude ${flags}\r`;
|
const claudeCmd = `claude ${flags}\r`;
|
||||||
ptyProcess.write(claudeCmd);
|
ptyProcess.write(claudeCmd);
|
||||||
} else if (config.codingAgent === "codex") {
|
|
||||||
ptyProcess.write("codex\r");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Detect when Claude is ready (shows "> " prompt)
|
// Start MCP poller immediately (auth is handled by shell environment)
|
||||||
if (terminalReady && !claudeReady && config.codingAgent === "claude") {
|
|
||||||
if (data.includes("> ")) {
|
|
||||||
claudeReady = true;
|
|
||||||
// Spawn MCP poller now that Claude is authenticated and ready
|
|
||||||
// Check if poller doesn't already exist to prevent duplicates
|
|
||||||
if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) {
|
if (!mcpPollerPtyProcesses.has(sessionId) && projectDir) {
|
||||||
spawnMcpPoller(sessionId, projectDir);
|
spawnMcpPoller(sessionId, projectDir);
|
||||||
}
|
}
|
||||||
|
} else if (config.codingAgent === "codex") {
|
||||||
|
ptyProcess.write("codex\r");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue