{#snippet chunkRow(rendered: RenderedChunk)} {#if rendered.role === "user"}
{#if rendered.chunk.type === "text"}

{rendered.chunk.text}

{/if}
{:else if rendered.chunk.type === "thinking"}
{rendered.streaming ? "Thinking" : "Thoughts"} {#if rendered.streaming} {/if}

{rendered.chunk.text}

{:else if rendered.chunk.type === "tool-call" || rendered.chunk.type === "tool-result"}
{#if rendered.chunk.type === "tool-call"}
{rendered.chunk.toolName}
{JSON.stringify(rendered.chunk.input, null, 2)}
{:else}
{rendered.chunk.toolName}
{rendered.chunk.content}
{/if}
{:else}
{#if rendered.chunk.type === "text"} {:else if rendered.chunk.type === "error"} {:else if rendered.chunk.type === "system"}
{rendered.chunk.text}
{/if}
{/if} {/snippet}
{#if hasEarlier && onShowEarlier}
{/if} {#each keyedRows as { row, key } (key)} {#if row.kind === "step-metrics"} {@const sv = viewStepMetrics(row.step, row.index)}
{sv.label} · {sv.tokensLabel} {#if sv.tps} · {sv.tps}{/if} {#if sv.genTotal} · {sv.genTotal}{/if}
{:else if row.kind === "turn-metrics"} {@const turnView = viewTurnMetrics(row.turn, row.turnNumber)} {@const lastCache = viewCacheRate(row.turn.usage)} {@const chatCache = viewCacheRate(row.cumulativeUsage)} {@const retention = viewExpectedCache(row.turn.usage, row.prevTurnUsage)}
{turnView.label} · {turnView.tokensLabel} ({turnView.breakdown}) {#if turnView.tps} · {turnView.tps}{/if} {#if turnView.duration} · {turnView.duration}{/if}
Last turn: {lastCache.pct}% Chat Total: {chatCache.pct}% {#if retention} Retention: {retention.pct}% {/if}
{:else if row.group.kind === "single"} {@render chunkRow(row.group.chunk)} {:else}
    {#each row.group.entries as entry (entry.call.toolCallId)}
  • {entry.call.toolName}
    {JSON.stringify(entry.call.input, null, 2)}
    {#if entry.result}
    {entry.result.content}
    {/if}
  • {/each}
{/if} {/each}