fix: preserve explicit maxChars=0 (#796) (thanks @gabriel-trigo)

This commit is contained in:
Peter Steinberger
2026-01-13 02:29:48 +00:00
parent 56c406b19e
commit 46a694bbc7
5 changed files with 46 additions and 3 deletions

View File

@@ -89,4 +89,17 @@ describe("browser tool snapshot maxChars", () => {
}),
);
});
it("skips the default when maxChars is explicitly zero", async () => {
const tool = createBrowserTool();
await tool.execute?.(null, {
action: "snapshot",
format: "ai",
maxChars: 0,
});
expect(browserClientMocks.browserSnapshot).toHaveBeenCalled();
const [, opts] = browserClientMocks.browserSnapshot.mock.calls.at(-1) ?? [];
expect(Object.hasOwn(opts ?? {}, "maxChars")).toBe(false);
});
});