refactor: improve error handling and CLI integration

- Updated CodexProvider to read prompts from stdin to prevent shell escaping issues.
- Enhanced AgentService to handle streamed error messages from providers, ensuring a consistent user experience.
- Modified UI components to display error messages clearly, including visual indicators for errors in chat bubbles.
- Updated CLI status handling to support both Claude and Codex APIs, improving compatibility and user feedback.

These changes enhance the robustness of the application and improve the user experience during error scenarios.
This commit is contained in:
DhanushSantosh
2026-01-06 14:10:48 +05:30
parent a57dcc170d
commit 27c6d5a3bb
13 changed files with 145 additions and 38 deletions

View File

@@ -44,11 +44,15 @@ export async function* spawnJSONLProcess(options: SubprocessOptions): AsyncGener
console.log(`[SubprocessManager] Passing ${stdinData.length} bytes via stdin`);
}
// On Windows, .cmd files must be run through shell (cmd.exe)
const needsShell = process.platform === 'win32' && command.toLowerCase().endsWith('.cmd');
const childProcess: ChildProcess = spawn(command, args, {
cwd,
env: processEnv,
// Use 'pipe' for stdin when we need to write data, otherwise 'ignore'
stdio: [stdinData ? 'pipe' : 'ignore', 'pipe', 'pipe'],
shell: needsShell,
});
// Write stdin data if provided
@@ -194,10 +198,14 @@ export async function spawnProcess(options: SubprocessOptions): Promise<Subproce
};
return new Promise((resolve, reject) => {
// On Windows, .cmd files must be run through shell (cmd.exe)
const needsShell = process.platform === 'win32' && command.toLowerCase().endsWith('.cmd');
const childProcess = spawn(command, args, {
cwd,
env: processEnv,
stdio: ['ignore', 'pipe', 'pipe'],
shell: needsShell,
});
let stdout = '';