fix: Account for when tool call args are not properly formatted (#277)

* fix: Account for when tool call args are not properly formatted

* cr
This commit is contained in:
Brace Sproul 2025-06-19 16:08:06 -07:00 • committed by GitHub
parent e8c742dc71
commit c6e29e0166
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -141,6 +141,21 @@ export function ActionStep(props: ActionStepProps) {
}
if (props.actionType === "shell") {
let commandStr = "";
if (props.command) {
if (Array.isArray(props.command)) {
commandStr = props.command.join(" ");
} else if (
typeof props.command === "string" &&
(props.command as string).length > 0
) {
try {
commandStr = JSON.parse(props.command);
} catch {
commandStr = props.command;
}
}
}
return (
<div className="flex-1">
{props.workdir && (
@ -149,7 +164,7 @@ export function ActionStep(props: ActionStepProps) {
</div>
)}
<code className="text-foreground/80 text-xs font-normal">
{props.command?.join(" ")}
{commandStr}
</code>
</div>
);