mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(examples): todo renderResult returns undefined on validation errors
When a todo call fails schema validation, createErrorToolResult produces
details: {} (a truthy empty object), so renderResult skips both the
!details and details.error branches, then switch (details.action) has no
default and returns undefined. ToolExecutionComponent.updateDisplay()
then calls addChild(undefined), and the next Box.render pass crashes the
whole interactive TUI.
Add a default case that renders the validation error text.
This commit is contained in:
parent
c55972086d
commit
3953e9ef49
1 changed files with 7 additions and 0 deletions
|
|
@ -276,6 +276,13 @@ export default function (pi: ExtensionAPI) {
|
|||
|
||||
case "clear":
|
||||
return new Text(theme.fg("success", "✓ ") + theme.fg("muted", "Cleared all todos"), 0, 0);
|
||||
|
||||
default:
|
||||
return new Text(
|
||||
result.content[0]?.type === "text" ? theme.fg("error", result.content[0].text) : "",
|
||||
0,
|
||||
0,
|
||||
);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue