@@ -12,6 +12,7 @@ import { loadAgents } from "./agents.ts";
1212 import { loadCustomCommands } from "./custom-commands.ts";
1313 import { logError } from "./error-log.ts";
1414 import { parseAppError } from "./error-parse.ts";
15+import { LiveOutputBlock } from "./live-output.ts";
1516 import { loadSkillsIndex } from "./skills.ts";
1617 import { Spinner } from "./spinner.ts";
1718 import { renderStatusBar } from "./status-bar.ts";
@@ -179,14 +180,24 @@ export function renderBanner(model: string, cwd: string): void {
179180
180181 export class CliReporter implements AgentReporter {
181182 private spinner = new Spinner();
183+ private liveOutput = new LiveOutputBlock();
182184
183- info(msg: string): void {
185+ private haltSpinner(): void {
186+ this.spinner.stop();
187+ }
188+
189+ private haltSpinnerAndFlushLiveOutput(): void {
184190 this.spinner.stop();
191+ this.liveOutput.finish();
192+ }
193+
194+ info(msg: string): void {
195+ this.haltSpinnerAndFlushLiveOutput();
185196 writeln(`${G.info} ${c.dim(msg)}`);
186197 }
187198
188199 error(msg: string | Error, hint?: string): void {
189- this.spinner.stop();
200+ this.haltSpinnerAndFlushLiveOutput();
190201 if (typeof msg === "string") {
191202 renderError(msg, hint);
192203 } else {
@@ -195,18 +206,18 @@ export class CliReporter implements AgentReporter {
195206 }
196207
197208 warn(msg: string): void {
198- this.spinner.stop();
209+ this.haltSpinnerAndFlushLiveOutput();
199210 writeln(`${G.warn} ${msg}`);
200211 }
201212
202213 writeText(text: string): void {
203- this.spinner.stop();
214+ this.haltSpinnerAndFlushLiveOutput();
204215 writeln(text);
205216 }
206217
207218 streamChunk(text: string): void {
208- this.spinner.stop();
209- write(text);
219+ this.haltSpinner();
220+ this.liveOutput.append(text);
210221 }
211222
212223 startSpinner(label?: string): void {
@@ -214,11 +225,11 @@ export class CliReporter implements AgentReporter {
214225 }
215226
216227 stopSpinner(): void {
217- this.spinner.stop();
228+ this.haltSpinner();
218229 }
219230
220231 renderSubState(label: string): void {
221- this.spinner.stop();
232+ this.haltSpinnerAndFlushLiveOutput();
222233 writeln(` ${G.info} ${c.dim(label)}`);
223234 this.spinner.start();
224235 }
@@ -227,15 +238,17 @@ export class CliReporter implements AgentReporter {
227238 events: AsyncIterable<TurnEvent>,
228239 opts?: { showReasoning?: boolean },
229240 ): Promise<TurnResult> {
241+ this.liveOutput.finish();
230242 return renderTurn(events, this.spinner, opts);
231243 }
232244
233245 renderStatusBar(data: StatusBarData): void {
246+ this.liveOutput.finish();
234247 renderStatusBar(data);
235248 }
236249
237250 renderHook(toolName: string, scriptPath: string, success: boolean): void {
238- this.spinner.stop();
251+ this.haltSpinnerAndFlushLiveOutput();
239252 renderHook(toolName, scriptPath, success);
240253 }