Command Palette

Search for a command to run...

AI Elements / Devtools/AI Stream Debugger

AI Stream Debugger

Real-time streaming chunk visualization for AI responses with auto-scroll, pause/resume, chunk type indicators, and timestamps for debugging SSE streams.

Open in v0Open in
Stream DebuggerLive0 chunks

Waiting for stream data...

Overview

A compound component for debugging AI streaming responses in real-time. Visualizes SSE (Server-Sent Events) chunks with auto-scroll, pause/resume controls, chunk type indicators, and millisecond-precision timestamps. Essential for debugging streaming implementations.

Installation

bunx shadcn@latest add @elements/stream-debugger

Usage

import {
  StreamDebugger,
  StreamDebuggerHeader,
  StreamDebuggerContent,
  StreamDebuggerChunk,
} from "@/components/elements/ai-elements/devtools/stream-debugger";

export function StreamDebuggerExample() {
  const chunks = [
    { type: "text", content: "Hello", timestamp: Date.now() },
    { type: "text", content: " world", timestamp: Date.now() + 50 },
    { type: "tool_call", content: "searchDatabase", timestamp: Date.now() + 100 },
    { type: "finish", content: "stop", timestamp: Date.now() + 150 },
  ];

  return (
    <StreamDebugger>
      <StreamDebuggerHeader />
      <StreamDebuggerContent chunks={chunks} />
    </StreamDebugger>
  );
}

Props

StreamDebuggerContent

PropTypeDefaultDescription
chunksChunk[]-Array of stream chunks to display
maxChunksnumber100Maximum chunks to display
autoScrollbooleantrueAuto-scroll to latest chunk

Chunk Types

type ChunkType = "text" | "tool_call" | "tool_result" | "error" | "finish";

interface Chunk {
  type: ChunkType;
  content: string;
  timestamp: number;
}

Features

  • Real-time chunk visualization with auto-scroll
  • Pause/resume controls for analysis
  • Chunk type indicators (text, tool_call, tool_result, error, finish)
  • Millisecond-precision timestamps
  • Live/paused status indicator
  • Clear button to reset view
  • Configurable max chunks limit