{#if parentSession} {/if} {#if childSessions.length > 0}
{childSessions.length} subagent{childSessions.length > 1 ? 's' : ''} {#each childSessions as child (child.id)} {/each}
{/if} {#if hasToolCalls}
{#if showTree && session} {/if} {/if}
{#if !session || session.messages.length === 0}
Ask Claude anything Type / for skills • Shift+Enter for newline
{:else} {#each session.messages as msg (msg.id)}
{#if msg.type === 'init'}
Session started {(msg.content as import('../../adapters/claude-messages').InitContent).model}
{:else if msg.type === 'text'} {@const textContent = (msg.content as TextContent).text} {@const firstLine = textContent.split('\n')[0].slice(0, 120)}
{firstLine}{firstLine.length >= 120 ? '...' : ''} {#if projectId} {/if}
{@html renderMarkdown(textContent)}
{:else if msg.type === 'thinking'}
Thinking...
{(msg.content as ThinkingContent).text}
{:else if msg.type === 'tool_call'} {@const tc = msg.content as ToolCallContent} {@const pairedResult = toolResultMap[tc.toolUseId]}
{tc.name} {#if pairedResult} {:else if isRunning} {/if}
{formatToolInput(tc.input)}
{#if pairedResult} {@const outputStr = formatToolInput(pairedResult.output)} {@const limit = getTruncationLimit(tc.name)} {@const truncated = truncateByLines(outputStr, limit)}
{#if truncated.truncated && !expandedTools.has(tc.toolUseId)}
{truncated.text}
{:else}
{outputStr}
{/if}
{:else if isRunning}
Awaiting tool result
{/if}
{:else if msg.type === 'tool_result'} {:else if msg.type === 'cost'} {@const cost = msg.content as CostContent}
${cost.totalCostUsd.toFixed(4)} {cost.inputTokens + cost.outputTokens} tokens {cost.numTurns} turns {(cost.durationMs / 1000).toFixed(1)}s
{#if cost.result}
{cost.result.split('\n')[0].slice(0, 80)}{cost.result.length > 80 ? '...' : ''}
{cost.result}
{/if} {:else if msg.type === 'error'}
{(msg.content as ErrorContent).message}
{:else if msg.type === 'status'} {@const statusContent = msg.content as StatusContent} {#if isHookMessage(statusContent)}
{hookDisplayName(statusContent.subtype)}
{statusContent.message || JSON.stringify(msg.content, null, 2)}
{:else}
{statusContent.message || statusContent.subtype}
{/if} {/if}
{/each}
{/if}
{#if session}
{#if session.status === 'running' || session.status === 'starting'}
Running... {#if contextPercent > 0} {contextPercent}% {/if} {#if !autoScroll} {/if}
{:else if session.status === 'done'}
${session.costUsd.toFixed(4)} {#if totalCost && totalCost.costUsd > session.costUsd} (total: ${totalCost.costUsd.toFixed(4)}) {/if} {session.inputTokens + session.outputTokens} tok {(session.durationMs / 1000).toFixed(1)}s {#if contextPercent > 0} {contextPercent}% {/if} {#if !autoScroll} {/if}
{:else if session.status === 'error'}
Error: {session.error ?? 'Unknown'} {#if session.error?.includes('Sidecar') || session.error?.includes('crashed')} {/if}
{/if}
{/if} {#if session && (session.status === 'done' || session.status === 'error') && session.sdkSessionId}
{#if capabilities.supportsResume} {/if}
{/if}
{#if capabilities.hasSkills && showSkillMenu && filteredSkills.length > 0}
{#each filteredSkills as skill, i (skill.name)} {/each}
{/if}