2 import { BuiltInTool } from '$lib/enums';
9 import type { DatabaseMessageExtra } from '$lib/types';
10 import ChatMessageToolCallBlockDefault from './ChatMessageToolCallBlockDefault.svelte';
11 import ChatMessageToolCallBlockEditFile from './ChatMessageToolCallBlockEditFile.svelte';
12 import ChatMessageToolCallBlockExecShellCommand from './ChatMessageToolCallBlockExecShellCommand.svelte';
13 import ChatMessageToolCallBlockFileGlobSearch from './ChatMessageToolCallBlockFileGlobSearch.svelte';
14 import ChatMessageToolCallBlockGetDatetime from './ChatMessageToolCallBlockGetDatetime.svelte';
15 import ChatMessageToolCallBlockGetInfo from './ChatMessageToolCallBlockGetInfo.svelte';
16 import ChatMessageToolCallBlockGrepSearch from './ChatMessageToolCallBlockGrepSearch.svelte';
17 import ChatMessageToolCallBlockReadFile from './ChatMessageToolCallBlockReadFile.svelte';
18 import ChatMessageToolCallBlockRunJavascript from './ChatMessageToolCallBlockRunJavascript.svelte';
19 import ChatMessageToolCallBlockSearchResults from './ChatMessageToolCallBlockSearchResults.svelte';
20 import ChatMessageToolCallBlockWriteFile from './ChatMessageToolCallBlockWriteFile.svelte';
23 section: AgenticSection;
24 attachments?: DatabaseMessageExtra[];
27 isExecuting?: boolean;
28 onToggle?: () => void;
31 let { section, attachments, open, isStreaming, isExecuting, onToggle }: 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} />