{#snippet renderSection(section: (typeof sectionsParsed)[number], index: number)} {#if section.type === AgenticSectionType.TEXT}
{:else if section.type === AgenticSectionType.TOOL_CALL_STREAMING} {@const streamingIcon = isStreaming ? Loader2 : Loader2} {@const streamingIconClass = isStreaming ? 'h-4 w-4 animate-spin' : 'h-4 w-4'} toggleExpanded(index, section)} >
Arguments: {#if isStreaming} {/if}
{#if section.toolArgs} {:else if isStreaming}
Receiving arguments...
{:else}
Response was truncated
{/if}
{:else if section.type === AgenticSectionType.TOOL_CALL || section.type === AgenticSectionType.TOOL_CALL_PENDING} {@const isPending = section.type === AgenticSectionType.TOOL_CALL_PENDING} {@const toolIcon = isPending ? Loader2 : Wrench} {@const toolIconClass = isPending ? 'h-4 w-4 animate-spin' : 'h-4 w-4'} toggleExpanded(index, section)} > {#if section.toolArgs && section.toolArgs !== '{}'}
Arguments:
{/if}
Result: {#if isPending} {/if}
{#if isPending}
Waiting for result...
{:else if section.toolResult}
{#each section.parsedLines as line, i (i)}
{line.text}
{#if line.image} {line.image.name} {/if} {/each}
{:else}
No output
{/if}
{:else if section.type === AgenticSectionType.REASONING} {@const reasoningSubtitle = section.wasInterrupted ? hasReasoningError ? 'Error' : 'Cancelled' : isStreaming ? '' : undefined} toggleExpanded(index, section)} >
{#if renderThinkingAsMarkdown} {:else}
{section.content}
{/if}
{:else if section.type === AgenticSectionType.REASONING_PENDING} {@const reasoningTitle = isStreaming ? 'Reasoning...' : 'Reasoning'} {@const reasoningSubtitle = isStreaming ? '' : hasReasoningError ? 'Error' : 'Cancelled'} toggleExpanded(index, section)} >
{#if renderThinkingAsMarkdown} {:else}
{section.content}
{/if}
{/if} {/snippet}
{#if highlightTurns && turnGroups.length > 1} {#each turnGroups as turn, turnIndex (turnIndex)} {@const turnStats = message?.timings?.agentic?.perTurn?.[turnIndex]}
Turn {turnIndex + 1} {#each turn.sections as section, sIdx (turn.flatIndices[sIdx])} {@render renderSection(section, turn.flatIndices[sIdx])} {/each} {#if turnStats}
0 ? buildTurnAgenticTimings(turnStats) : undefined} initialView={ChatMessageStatsView.GENERATION} hideSummary />
{/if}
{/each} {:else} {#each sectionsParsed as section, index (index)} {@render renderSection(section, index)} {/each} {/if} {#if pendingPermission && !permissionDismissed} {/if} {#if pendingContinue && !continueDismissed} {/if}