{#if edit}
{#if editedOutput} { editedOutput = updated; }} /> {:else} {/if}
{:else}
{#if !done && (!output || output.length === 0)} {:else} {#each displayItems as displayItem, groupIdx} {#if displayItem.type === 'message_item'} c.text).join('') || ''} /> {:else if displayItem.type === 'tool_group'} {@const calls = displayItem.calls} {@const outputs = displayItem.outputs} {@const hasPending = groupHasPending(calls)} {@const allDone = groupAllDone(calls)} {@const hasRejected = groupHasRejected(calls)} {@const isGroupOpen = expandedGroups.has(groupIdx)} {@const hasPendingApproval = calls.some((c: any) => c.status === 'pending')}
{#if isGroupOpen}
{#each calls as item} {@const args = item.arguments || {}} {@const toolName = item.name} {@const callId = item.call_id || toolName} {@const isExecuting = item.status === 'running' || (!item.status && !done)} {@const isDone = item.status === 'completed'} {@const isRejected = item.status === 'rejected'} {@const isPending = item.status === 'pending'} {@const isExpanded = expandedCalls.has(callId)} {@const pairedOutput = outputs.get(item.call_id)}
{:else}
{/if}
{#if isExpanded}
{#if Object.keys(args).length > 0}
Input
{#if toolName === 'edit_file' && args.target}
−{args.target.length > 500 ? args.target.slice(0, 500) + '…' : args.target}
+{(args.replacement || '').length > 500 ? args.replacement.slice(0, 500) + '…' : args.replacement || ''}
{#if args.start_line}
Lines {args.start_line}–{args.end_line || 'end'}
{/if} {:else if toolName === 'run_command'} {args.command} {:else}
{#each Object.entries(args) as [key, value]}
{key} {typeof value === 'object' ? JSON.stringify(value) : value}
{/each}
{/if}
{/if} {#if pairedOutput?.output}
Output
{pairedOutput.output.length > 10000 ? pairedOutput.output.slice(0, 10000) : pairedOutput.output}
{#if pairedOutput.output.length > 10000}
{pairedOutput.output.length.toLocaleString()} total characters
{/if}
{/if}
{/if}
{/each}
{/if} {#if !isGroupOpen && hasPendingApproval && chatId}
{#each calls.filter((c: any) => c.status === 'pending') as item}
{toolLabel(item.name, item.arguments || {})}
{/each}
{/if}
{/if} {/each} {#if !done} {@const flushedText = (output || []) .filter((i: any) => i.type === 'message') .flatMap((i: any) => i.content || []) .map((c: any) => c.text) .join('')} {@const pendingText = content.slice(flushedText.length)} {#if pendingText} {/if} {/if} {/if}
{#if done || siblingTotal > 1}
{#if siblingTotal > 1} {siblingIndex + 1}/{siblingTotal} {/if} {#if done && onedit} {/if} {#if done} {/if} {#if done && onregenerate} {/if}
{/if} {/if}