diff --git a/packages/app/src/components/tool-call-details.tsx b/packages/app/src/components/tool-call-details.tsx
index c8b294fb2..39c5a0c61 100644
--- a/packages/app/src/components/tool-call-details.tsx
+++ b/packages/app/src/components/tool-call-details.tsx
@@ -27,6 +27,19 @@ function formatValue(value: unknown): string {
if (typeof value === "string") {
return value;
}
+ // Extract content from tool_result objects
+ if (
+ typeof value === "object" &&
+ value !== null &&
+ "type" in value &&
+ (value as { type: string }).type === "tool_result" &&
+ "content" in value
+ ) {
+ const content = (value as { content: unknown }).content;
+ if (typeof content === "string") {
+ return content;
+ }
+ }
try {
return JSON.stringify(value, null, 2);
} catch {
@@ -66,7 +79,7 @@ export function ToolCallDetailsContent({
contentContainerStyle={styles.jsonContent}
showsHorizontalScrollIndicator={true}
>
- {display.command}
+ {display.command}
{display.output ? (
- {display.output}
+ {display.output}
) : null}
@@ -126,7 +139,7 @@ export function ToolCallDetailsContent({
nestedScrollEnabled
showsHorizontalScrollIndicator={true}
>
- {display.content}
+ {display.content}
) : null}
@@ -151,7 +164,7 @@ export function ToolCallDetailsContent({
contentContainerStyle={styles.jsonContent}
showsHorizontalScrollIndicator={true}
>
- {pair.value}
+ {pair.value}
);
@@ -175,7 +188,7 @@ export function ToolCallDetailsContent({
contentContainerStyle={styles.jsonContent}
showsHorizontalScrollIndicator={true}
>
- {pair.value}
+ {pair.value}
);
@@ -195,7 +208,7 @@ export function ToolCallDetailsContent({
contentContainerStyle={styles.jsonContent}
showsHorizontalScrollIndicator={true}
>
-
+
{errorText}
diff --git a/packages/app/src/utils/tool-call-parsers.ts b/packages/app/src/utils/tool-call-parsers.ts
index 523ba691b..032ad8bd0 100644
--- a/packages/app/src/utils/tool-call-parsers.ts
+++ b/packages/app/src/utils/tool-call-parsers.ts
@@ -900,6 +900,13 @@ const ShellResultSchema = z.object({
output: z.string(),
}).passthrough();
+// Shell error result: { type: "tool_result", content: "Exit code 128\n...", is_error: true }
+const ShellErrorResultSchema = z.object({
+ type: z.literal("tool_result"),
+ content: z.string(),
+ is_error: z.literal(true),
+}).passthrough();
+
// Shell tool call display schema
const ShellToolCallSchema = z
.object({
@@ -911,13 +918,30 @@ const ShellToolCallSchema = z
? data.input.command.join(" ")
: data.input.command;
+ // Try parsing as success result first
const resultParsed = ShellResultSchema.safeParse(data.result);
- const output = resultParsed.success ? resultParsed.data.output : "";
+ if (resultParsed.success) {
+ return {
+ type: "shell" as const,
+ command,
+ output: resultParsed.data.output,
+ };
+ }
+
+ // Try parsing as error result
+ const errorParsed = ShellErrorResultSchema.safeParse(data.result);
+ if (errorParsed.success) {
+ return {
+ type: "shell" as const,
+ command,
+ output: errorParsed.data.content,
+ };
+ }
return {
type: "shell" as const,
command,
- output,
+ output: "",
};
});