fix(control-ui): treat null tool args as absent

This commit is contained in:
ChroniCat 2026-03-18 14:51:57 +08:00
parent 1b76c07ee7
commit a7eb6c58ab
2 changed files with 5 additions and 1 deletions

View File

@ -159,6 +159,10 @@ describe("tool-helpers", () => {
it("returns null for undefined arguments", () => {
expect(formatToolPayloadForSidebar(undefined)).toBeNull();
});
it("returns null for null arguments", () => {
expect(formatToolPayloadForSidebar(null)).toBeNull();
});
});
describe("buildToolSidebarContent", () => {

View File

@ -27,7 +27,7 @@ export function formatToolOutputForSidebar(text: string): string {
* Uses JSON code blocks for structured values and preserves plain text input.
*/
export function formatToolPayloadForSidebar(value: unknown): string | null {
if (value === undefined) {
if (value === undefined || value === null) {
return null;
}
if (typeof value === "string") {