fix(browser): resolve params.path relative to cwd regardless of screenshotDir

screenshotDir is a default save location, not an anchor for explicit
paths. A relative params.path should always resolve against cwd so its
semantics are stable and predictable regardless of user settings.
This commit is contained in:
Rens Tillmann
2026-03-20 21:07:34 +01:00
parent 7e7d8d921d
commit ead5e91c4e
+1 -1
View File
@@ -1375,7 +1375,7 @@ export class BrowserTool implements AgentTool<typeof browserSchema, BrowserToolD
const paramPath = params.path ? expandPath(params.path as string) : undefined;
let dest: string;
if (paramPath) {
dest = path.isAbsolute(paramPath) ? paramPath : path.join(screenshotDir ?? process.cwd(), paramPath);
dest = path.isAbsolute(paramPath) ? paramPath : path.join(process.cwd(), paramPath);
} else if (screenshotDir) {
const ts = new Date().toISOString().replace(/[:.]/g, "-").slice(0, -1);
dest = path.join(screenshotDir, `screenshot-${ts}.png`);