Skip to content

Commit 6fdb7dc

Browse files
committed
🤖 Wire up FileListToolCall component in ToolMessage routing
- Add import for FileListToolCall component - Add isFileListTool type guard using Zod schema - Add routing case for file_list tool - Fix status type: use ToolStatus instead of custom status strings - Update status checks: 'completed'/'failed'/'executing' instead of 'complete'/'error'/'streaming' Fixes component routing so file_list tool calls render correctly in UI.
1 parent 954e18a commit 6fdb7dc

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/components/Messages/ToolMessage.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { GenericToolCall } from "../tools/GenericToolCall";
55
import { BashToolCall } from "../tools/BashToolCall";
66
import { FileEditToolCall } from "../tools/FileEditToolCall";
77
import { FileReadToolCall } from "../tools/FileReadToolCall";
8+
import { FileListToolCall } from "../tools/FileListToolCall";
89

910
import { ProposePlanToolCall } from "../tools/ProposePlanToolCall";
1011
import { TodoToolCall } from "../tools/TodoToolCall";
@@ -45,6 +46,11 @@ function isFileReadTool(toolName: string, args: unknown): args is FileReadToolAr
4546
return TOOL_DEFINITIONS.file_read.schema.safeParse(args).success;
4647
}
4748

49+
function isFileListTool(toolName: string, args: unknown): args is FileListToolArgs {
50+
if (toolName !== "file_list") return false;
51+
return TOOL_DEFINITIONS.file_list.schema.safeParse(args).success;
52+
}
53+
4854
function isFileEditReplaceStringTool(
4955
toolName: string,
5056
args: unknown
@@ -103,6 +109,18 @@ export const ToolMessage: React.FC<ToolMessageProps> = ({ message, className, wo
103109
);
104110
}
105111

112+
if (isFileListTool(message.toolName, message.args)) {
113+
return (
114+
<div className={className}>
115+
<FileListToolCall
116+
args={message.args}
117+
result={message.result as FileListToolResult | undefined}
118+
status={message.status}
119+
/>
120+
</div>
121+
);
122+
}
123+
106124
if (isFileEditReplaceStringTool(message.toolName, message.args)) {
107125
return (
108126
<div className={className}>

src/components/tools/FileListToolCall.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
DetailLabel,
1212
LoadingDots,
1313
} from "./shared/ToolPrimitives";
14-
import { useToolExpansion, getStatusDisplay } from "./shared/toolUtils";
14+
import { useToolExpansion, getStatusDisplay, ToolStatus } from "./shared/toolUtils";
1515

1616
// FileList-specific styled components
1717

@@ -74,14 +74,14 @@ const EmptyMessage = styled.div`
7474
interface FileListToolCallProps {
7575
args: FileListToolArgs;
7676
result?: FileListToolResult;
77-
status: "pending" | "streaming" | "complete" | "error";
77+
status: ToolStatus;
7878
}
7979

8080
export const FileListToolCall: React.FC<FileListToolCallProps> = ({ args, result, status }) => {
8181
const { expanded, toggleExpanded } = useToolExpansion(false);
82-
const isError = status === "error" || (result && !result.success);
83-
const isComplete = status === "complete";
84-
const isPending = status === "pending" || status === "streaming";
82+
const isError = status === "failed" || (result && !result.success);
83+
const isComplete = status === "completed";
84+
const isPending = status === "pending" || status === "executing";
8585

8686
// Build parameter summary
8787
const params: string[] = [];

0 commit comments

Comments
 (0)