mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-16 19:00:38 +09:00
fix cursor stream-json multiplexed output handling
This commit is contained in:
parent
875924a7f3
commit
426c1044b6
6 changed files with 89 additions and 7 deletions
16
packages/adapters/cursor-local/src/shared/stream.ts
Normal file
16
packages/adapters/cursor-local/src/shared/stream.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export function normalizeCursorStreamLine(rawLine: string): {
|
||||
stream: "stdout" | "stderr" | null;
|
||||
line: string;
|
||||
} {
|
||||
const trimmed = rawLine.trim();
|
||||
if (!trimmed) return { stream: null, line: "" };
|
||||
|
||||
const prefixed = trimmed.match(/^(stdout|stderr)\s*[:=]?\s*([\[{].*)$/i);
|
||||
if (!prefixed) {
|
||||
return { stream: null, line: trimmed };
|
||||
}
|
||||
|
||||
const stream = prefixed[1]?.toLowerCase() === "stderr" ? "stderr" : "stdout";
|
||||
const line = (prefixed[2] ?? "").trim();
|
||||
return { stream, line };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue