feat(app): add text selection and fix shell error display

- Add selectable prop to all Text components in tool call content areas
- Add ShellErrorResultSchema to parse tool_result error format
- Update ShellToolCallSchema to extract content from error results
- Also handle tool_result extraction in formatValue as fallback
This commit is contained in:
Mohamed Boudra
2026-01-11 00:20:29 +07:00
parent 018e3b6a8c
commit f5810c18ac
2 changed files with 45 additions and 8 deletions
+26 -2
View File
@@ -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: "",
};
});