2 import ChatMessageToolCallBlockDefault from './ChatMessageToolCallBlockDefault.svelte';
3 import ChatMessageToolCallBlockEditFile from './ChatMessageToolCallBlockEditFile.svelte';
4 import ChatMessageToolCallBlockExecShellCommand from './ChatMessageToolCallBlockExecShellCommand.svelte';
5 import ChatMessageToolCallBlockFileGlobSearch from './ChatMessageToolCallBlockFileGlobSearch.svelte';
6 import ChatMessageToolCallBlockGetDatetime from './ChatMessageToolCallBlockGetDatetime.svelte';
7 import ChatMessageToolCallBlockGetInfo from './ChatMessageToolCallBlockGetInfo.svelte';
8 import ChatMessageToolCallBlockGrepSearch from './ChatMessageToolCallBlockGrepSearch.svelte';
9 import ChatMessageToolCallBlockReadFile from './ChatMessageToolCallBlockReadFile.svelte';
10 import ChatMessageToolCallBlockRunJavascript from './ChatMessageToolCallBlockRunJavascript.svelte';
11 import ChatMessageToolCallBlockSearchResults from './ChatMessageToolCallBlockSearchResults.svelte';
12 import ChatMessageToolCallBlockWriteFile from './ChatMessageToolCallBlockWriteFile.svelte';
13 import { BuiltInTool } from '$lib/enums';
14 import type { DatabaseMessageExtra } from '$lib/types';
23 section: AgenticSection;
24 attachments?: DatabaseMessageExtra[];
27 isExecuting?: boolean;
28 onToggle?: () => void;
31 let { attachments, isExecuting, isStreaming, onToggle, open, section }: Props = $props();
33 const searchResults = $derived(extractSearchResults(section.toolResult));
34 const searchQuery = $derived(extractSearchQuery(section.toolArgs));
35 const isSearchCall = $derived(
36 searchResults.length > 0 || (searchQuery.length > 0 && isWebSearchToolName(section.toolName))
41 <ChatMessageToolCallBlockSearchResults {section} {open} {isStreaming} {onToggle} />
42 {:else if section.toolName === BuiltInTool.GET_DATETIME}
43 <ChatMessageToolCallBlockGetDatetime {section} {isStreaming} />
44 {:else if section.toolName === BuiltInTool.GET_INFO}
45 <ChatMessageToolCallBlockGetInfo {section} {isStreaming} />
46 {:else if section.toolName === BuiltInTool.READ_FILE}
47 <ChatMessageToolCallBlockReadFile {section} {open} {isStreaming} {onToggle} />
48 {:else if section.toolName === BuiltInTool.EDIT_FILE}
49 <ChatMessageToolCallBlockEditFile {section} {open} {isStreaming} {onToggle} />
50 {:else if section.toolName === BuiltInTool.WRITE_FILE}
51 <ChatMessageToolCallBlockWriteFile {section} {open} {isStreaming} {onToggle} />
52 {:else if section.toolName === BuiltInTool.EXEC_SHELL_COMMAND}
53 <ChatMessageToolCallBlockExecShellCommand
61 {:else if section.toolName === BuiltInTool.FILE_GLOB_SEARCH}
62 <ChatMessageToolCallBlockFileGlobSearch {section} {open} {isStreaming} {onToggle} />
63 {:else if section.toolName === BuiltInTool.GREP_SEARCH}
64 <ChatMessageToolCallBlockGrepSearch {section} {open} {isStreaming} {onToggle} />
65 {:else if section.toolName === BuiltInTool.RUN_JAVASCRIPT}
66 <ChatMessageToolCallBlockRunJavascript {section} {open} {isStreaming} {onToggle} />
68 <ChatMessageToolCallBlockDefault {section} {open} {isStreaming} {attachments} {onToggle} />