feat: Renamed textBuffer to assistantTextBuffer in headless.ts and vali…

- src/headless.ts
- .sf/REQUIREMENTS.md

SF-Task: S01/T04
This commit is contained in:
Mikael Hugo 2026-05-02 08:48:44 +02:00
parent 8bbda93d24
commit 1990d2a2ee

View file

@ -754,7 +754,7 @@ async function runHeadlessOnce(
| { costUsd: number; inputTokens: number; outputTokens: number }
| undefined;
let thinkingBuffer = "";
let textBuffer = "";
let assistantTextBuffer = "";
// Drop only adjacent identical formatProgress output. A widget that
// re-emits the same setStatus on every LLM call would otherwise print
// the same line N times in a row. Two different lines still both show;
@ -1270,7 +1270,7 @@ async function runHeadlessOnce(
}
// Non-verbose: accumulate text_delta for truncated one-liner
else if (ame?.type === "text_delta") {
textBuffer += String(ame.delta ?? ame.text ?? "");
assistantTextBuffer += String(ame.delta ?? ame.text ?? "");
}
}
@ -1299,9 +1299,9 @@ async function runHeadlessOnce(
!options.verbose &&
(eventType === "tool_execution_start" || eventType === "message_end")
) {
if (textBuffer.trim()) {
writeHeadlessLine(formatTextLine(textBuffer));
textBuffer = "";
if (assistantTextBuffer.trim()) {
writeHeadlessLine(formatTextLine(assistantTextBuffer));
assistantTextBuffer = "";
}
if (thinkingBuffer.trim()) {
writeHeadlessLine(formatThinkingLine(thinkingBuffer));