fix: add npm-global to PATH for codex CLI, clear typing after response
- Enrich spawned process PATH with ~/.npm-global/bin so codex CLI is findable when running under launchd - Clear typing indicator in streaming callback after sending response, instead of waiting for runner process to fully exit
This commit is contained in:
@@ -133,12 +133,16 @@ function prepareGroupEnvironment(
|
|||||||
delete cleanEnv.CLAUDECODE;
|
delete cleanEnv.CLAUDECODE;
|
||||||
delete cleanEnv.CLAUDE_CODE_ENTRYPOINT;
|
delete cleanEnv.CLAUDE_CODE_ENTRYPOINT;
|
||||||
|
|
||||||
// Ensure node is findable by SDK subprocess (cli.js uses #!/usr/bin/env node)
|
// Ensure node and npm-global binaries (codex, etc.) are findable
|
||||||
const nodeBin = path.dirname(process.execPath);
|
const nodeBin = path.dirname(process.execPath);
|
||||||
|
const npmGlobalBin = path.join(os.homedir(), '.npm-global', 'bin');
|
||||||
const currentPath = cleanEnv.PATH || '/usr/local/bin:/usr/bin:/bin';
|
const currentPath = cleanEnv.PATH || '/usr/local/bin:/usr/bin:/bin';
|
||||||
const enrichedPath = currentPath.includes(nodeBin)
|
const extraPaths = [nodeBin, npmGlobalBin].filter(
|
||||||
? currentPath
|
(p) => !currentPath.includes(p) && fs.existsSync(p),
|
||||||
: `${nodeBin}:${currentPath}`;
|
);
|
||||||
|
const enrichedPath = extraPaths.length > 0
|
||||||
|
? `${extraPaths.join(':')}:${currentPath}`
|
||||||
|
: currentPath;
|
||||||
|
|
||||||
const env: Record<string, string> = {
|
const env: Record<string, string> = {
|
||||||
...cleanEnv,
|
...cleanEnv,
|
||||||
|
|||||||
@@ -257,6 +257,9 @@ async function processGroupMessages(chatJid: string): Promise<boolean> {
|
|||||||
await channel.sendMessage(chatJid, text);
|
await channel.sendMessage(chatJid, text);
|
||||||
outputSentToUser = true;
|
outputSentToUser = true;
|
||||||
}
|
}
|
||||||
|
// Clear typing indicator after sending a response — the runner may stay
|
||||||
|
// alive waiting for IPC messages, but the user shouldn't see "typing..."
|
||||||
|
await channel.setTyping?.(chatJid, false);
|
||||||
// Only reset idle timer on actual results, not session-update markers (result: null)
|
// Only reset idle timer on actual results, not session-update markers (result: null)
|
||||||
resetIdleTimer();
|
resetIdleTimer();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user