diff --git a/src/ClaudeDev.ts b/src/ClaudeDev.ts index c0991c7..bbe72e2 100644 --- a/src/ClaudeDev.ts +++ b/src/ClaudeDev.ts @@ -1362,7 +1362,7 @@ export class ClaudeDev { let result = "" process.on("line", (line) => { - result += line + result += line + "\n" sendCommandOutput(line) }) @@ -1384,6 +1384,8 @@ export class ClaudeDev { // grouping command_output messages despite any gaps anyways) await delay(50) + result = result.trim() + if (userFeedback) { await this.say("user_feedback", userFeedback.text, userFeedback.images) return this.formatToolResponseWithImages( diff --git a/src/integrations/TerminalManager.ts b/src/integrations/TerminalManager.ts index aa3188e..da7dd4e 100644 --- a/src/integrations/TerminalManager.ts +++ b/src/integrations/TerminalManager.ts @@ -291,21 +291,21 @@ export class TerminalProcess extends EventEmitter { // remove ansi data = stripAnsi(data) // Split data by newlines - let lines = data ? data.split("\n") : [] + // let lines = data ? data.split("\n") : [] // Remove non-human readable characters from the first line - if (lines.length > 0) { - lines[0] = lines[0].replace(/[^\x20-\x7E]/g, "") - } - // Check if first two characters are the same, if so remove the first character - if (lines.length > 0 && lines[0].length >= 2 && lines[0][0] === lines[0][1]) { - lines[0] = lines[0].slice(1) - } - // Process second line: remove everything up to the first alphanumeric character - if (lines.length > 1) { - lines[1] = lines[1].replace(/^[^a-zA-Z0-9]*/, "") - } + // if (lines.length > 0) { + // lines[0] = lines[0].replace(/[^\x20-\x7E]/g, "") + // } + // // Check if first two characters are the same, if so remove the first character + // if (lines.length > 0 && lines[0].length >= 2 && lines[0][0] === lines[0][1]) { + // lines[0] = lines[0].slice(1) + // } + // // Process second line: remove everything up to the first alphanumeric character + // if (lines.length > 1) { + // lines[1] = lines[1].replace(/^[^a-zA-Z0-9]*/, "") + // } // Join lines back - data = lines.join("\n") + // data = lines.join("\n") isFirstChunk = false } else { data = stripAnsi(data) @@ -369,7 +369,7 @@ export class TerminalProcess extends EventEmitter { this.buffer += chunk let lineEndIndex: number while ((lineEndIndex = this.buffer.indexOf("\n")) !== -1) { - let line = this.buffer.slice(0, lineEndIndex).trim() // removes trailing \r + let line = this.buffer.slice(0, lineEndIndex).trimEnd() // removes trailing \r // Remove \r if present (for Windows-style line endings) // if (line.endsWith("\r")) { // line = line.slice(0, -1)