{#snippet renderSection(section: AgenticSection, index: number)} {#if section.type === AgenticSectionType.TEXT}
{:else if section.type === AgenticSectionType.REASONING || section.type === AgenticSectionType.REASONING_PENDING} toggleExpanded(index, section)} open={isExpanded(index, section)} {section} /> {:else if section.type === AgenticSectionType.TOOL_CALL || section.type === AgenticSectionType.TOOL_CALL_PENDING || section.type === AgenticSectionType.TOOL_CALL_STREAMING} toggleExpanded(index, section)} open={isExpanded(index, section)} {section} /> {/if} {/snippet}
{#if turnGroups.length > 1} {#each turnGroups as turn, turnIndex (turnIndex)} {@const turnStats = message?.timings?.agentic?.perTurn?.[turnIndex]}
{#each turn.sections as section, sIdx (turn.flatIndices[sIdx])} {@render renderSection(section, turn.flatIndices[sIdx])} {/each} {#if turnStats && showAgenticTurnStats}
0 ? buildTurnAgenticTimings(turnStats) : undefined} hideSummary initialView={ChatMessageStatsView.GENERATION} predictedMs={turnStats.llm.predicted_ms} predictedTokens={turnStats.llm.predicted_n} promptMs={turnStats.llm.prompt_ms} promptTokens={turnStats.llm.prompt_n} />
{/if}
{/each} {:else} {#each sections as section, index (index)} {@render renderSection(section, index)} {/each} {/if} {#if pendingPermission && !permissionDismissed} {/if} {#if pendingContinue && !continueDismissed} {/if}