{#if loading}

{t('agentChat.loading')}

{:else if messages.length === 0 && !running}

{t('agentChat.emptyTitle')}

{t('agentChat.emptyHint')}

{#if suggestions.length > 0}
{#each suggestions as s (s.label)} {/each}
{/if}
{/if} {#each messages as m (m.id)} {#if m.role === 'user'}
{#if m.status === 'steering'} {t('agentChat.steering')} {/if} {#if (m.attachments ?? []).length > 0}
{#each (m.attachments ?? []) as a (a.path)} {@const href = assetUrl(a.path)} {#if a.kind === 'image' && href} {a.name} {:else} {/if} {/each}
{/if} {#each bubbleParts(m.content, (m.mentions ?? []) as WorkflowMention[]) as part, i (`${i}-${part.type}`)} {#if part.type === 'chip'} {part.text} {:else}{part.text}{/if} {/each}
{:else if m.role === 'tool'}
{#if m.tool_name === 'ask_user' && lastQuestion && m.id === messages.findLast((x) => x.role === 'tool' && x.tool_name === 'ask_user')?.id}
{#if lastQuestion.question}

{lastQuestion.question}

{/if}
{#each lastQuestion.options as opt (opt)} {/each}

{answerLabel(lastQuestion.scope) || t('agentChat.pickOption')}

{/if} {#if m.tool_name && ENQUEUE_TOOLS.has(m.tool_name)} {@const arts = artifactJobs(m)} {#if arts.length > 0}
{#each arts as job (job.id)} {/each}
{/if} {/if}
{:else if m.role === 'assistant'} {@const color = agentColor(m.agent_name)}
{agentDisplayName(m.agent_name)}
{#if m.reasoning}
{/if}
{m.content}
{/if} {/each} {#if running}
{agentDisplayName(null)}
{#if liveTools.length > 0}
{#each liveTools as t, i (i)} {/each}
{/if} {#if streaming}
{streaming}
{:else}
{t('agentChat.working')}
{/if} {#if streamingReasoning} {/if}
{/if}