feat: spinner while waiting for response

This commit is contained in:
mitchell 2026-05-03 02:29:27 -04:00
parent 79fd0a93eb
commit d9bffdec2b
3 changed files with 23 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import type { WriteStream } from "node:tty";
import { spinner } from "@clack/prompts";
import type {
AsyncIterableStream,
LanguageModelUsage,
@ -87,9 +88,17 @@ export default class Renderer {
async renderStream(stream: AsyncIterableStream<TextStreamPart<ToolSet>>) {
this.resetCounts();
const spin = spinner({ withGuide: false, indicator: "timer" });
if (!this.isPlain) {
spin.start("Waiting for response");
}
for await (const part of stream) {
switch (part.type) {
case "reasoning-start": {
if (!this.isPlain) {
spin.clear();
}
if (supportsColorStderr)
this.write(
`${styles.dim.open}${styles.italic.open}`,