Skip to content
Open
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
11 changes: 9 additions & 2 deletions packages/provider-cursor/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const createServer = () => {
requestSignal.addEventListener("abort", killProcess);

let buffer = "";
let stderrBuffer = "";

const processLine = async (line: string) => {
const event = parseStreamLine(line);
Expand Down Expand Up @@ -165,7 +166,9 @@ export const createServer = () => {
});

cursorProcess.stderr.on("data", (chunk: Buffer) => {
console.error("[cursor-agent stderr]:", chunk.toString());
const text = chunk.toString();
stderrBuffer += text;
console.error("[cursor-agent stderr]:", text);
});

cursorProcess.stdin.write(fullPrompt);
Expand All @@ -177,7 +180,11 @@ export const createServer = () => {
if (code === 0 || cursorProcess.killed) {
resolve();
} else {
reject(new Error(`cursor-agent exited with code ${code}`));
const stderrOutput = stderrBuffer.trim();
const errorMsg = stderrOutput
? `cursor-agent exited with code ${code}\n${stderrOutput}`
: `cursor-agent exited with code ${code}`;
reject(new Error(errorMsg));
}
});

Expand Down