Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,16 @@ const toolNameIcons: Record<string, Icon> = {
Skill: Command,
};

// Tools that render a friendly "<prefix> `<input>` <suffix>" line instead of
// the raw JSON input preview. `inputKey` is the rawInput field to highlight.
const toolNameDisplays: Record<
string,
{ prefix: string; suffix: string; inputKey: string }
> = {
Skill: { prefix: "Reading", suffix: "skill", inputKey: "skill" },
ToolSearch: { prefix: "Searching", suffix: "tools", inputKey: "query" },
};

interface ToolCallViewProps extends ToolViewProps {
agentToolName?: string;
}
Expand All @@ -74,13 +84,27 @@ export function ToolCallView({
Wrench;

const filePath = kind === "read" && locations?.[0]?.path;
const displayText = filePath
? `Read ${getFilename(filePath)}`
: title
? compactHomePath(title)
const toolDisplay = agentToolName
? toolNameDisplays[agentToolName]
: undefined;
const highlightValue =
toolDisplay && rawInput && typeof rawInput === "object"
? (rawInput as Record<string, unknown>)[toolDisplay.inputKey]
: undefined;
const specialDisplay =
toolDisplay && typeof highlightValue === "string"
? { ...toolDisplay, value: highlightValue }
: undefined;

const displayText = specialDisplay
? specialDisplay.prefix
: filePath
? `Read ${getFilename(filePath)}`
: title
? compactHomePath(title)
: undefined;

const inputPreview = compactInput(rawInput);
const inputPreview = specialDisplay?.value ?? compactInput(rawInput);
const fullInput = formatInput(rawInput);

const output = stripCodeFences(getContentText(content) ?? "");
Expand Down Expand Up @@ -115,6 +139,7 @@ export function ToolCallView({
<span className="font-mono text-accent-11">{inputPreview}</span>
</ToolTitle>
)}
{specialDisplay && <ToolTitle>{specialDisplay.suffix}</ToolTitle>}
<StatusIndicators isFailed={isFailed} wasCancelled={wasCancelled} />
</Flex>
</Flex>
Expand Down
Loading