2 import { SyntaxHighlightedCode } from '$lib/components/app';
3 import { DEFAULT_LANGUAGE, MAX_HEIGHT_CODE_BLOCK } from '$lib/constants';
4 import { type AgenticSection } from '$lib/utils';
5 import { parseReadFileMeta } from './parsers/read-file';
6 import ToolCallBlock from './ToolCallBlock.svelte';
9 section: AgenticSection;
12 onToggle?: () => void;
15 let { section, open, isStreaming, onToggle }: Props = $props();
17 const readFileMeta = $derived(parseReadFileMeta(section));
20 <ToolCallBlock {section} {open} {isStreaming} meta={readFileMeta} {onToggle}>
21 {#snippet titleSnippet()}
22 <span class="text-muted-foreground">Read file </span>
23 <span class="font-mono">{readFileMeta?.fileName}</span>
24 {#if readFileMeta?.lineRange}
25 <span class="text-muted-foreground"
26 > (lines {readFileMeta.lineRange.start}-{readFileMeta.lineRange.end})</span
31 {#snippet children(_meta, _ctx)}
32 {#if section.toolResult}
33 <SyntaxHighlightedCode
34 code={section.toolResult}
35 language={readFileMeta?.language ?? DEFAULT_LANGUAGE}
36 maxHeight={MAX_HEIGHT_CODE_BLOCK}
39 <div class="rounded bg-muted/20 p-2 text-xs text-muted-foreground/70 italic">
40 Waiting for file content...