diff --git a/packages/cli/src/run.ts b/packages/cli/src/run.ts index 6a98e15d4e..2f2c86552f 100644 --- a/packages/cli/src/run.ts +++ b/packages/cli/src/run.ts @@ -189,8 +189,10 @@ export async function runScript( partialCb: (args) => { const { responseChunk, tokensSoFar } = args tokens = tokensSoFar - if (stream && responseChunk) process.stdout.write(responseChunk) - else if (!isQuiet) process.stderr.write(responseChunk) + if (responseChunk !== undefined) { + if (stream) process.stdout.write(responseChunk) + else if (!isQuiet) process.stderr.write(responseChunk) + } partialCb?.(args) }, skipLLM,