From 07b2bd03d89b38d076ed2eb8b371012be654375c Mon Sep 17 00:00:00 2001 From: Rens Tillmann Date: Fri, 13 Mar 2026 02:09:18 +0100 Subject: [PATCH] feat(browser): implement screenshot path saving - Add `browser.screenshotDir` setting (tools tab) for a persistent default screenshot directory, configurable via /settings - Honour the existing `path` parameter in the screenshot action, which was declared in the schema but never consumed by the implementation - Resolution order: params.path (abs) > join(screenshotDir, params.path) > join(screenshotDir, screenshot-.png) > /tmp only - Writes full-resolution buffer to disk (not the API-compressed copy) - Creates destination directory recursively if it doesn't exist - details.screenshotPath reflects the actual saved location Fixes: path param silently ignored since removal in v11.5.0 --- packages/coding-agent/src/tools/browser.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/coding-agent/src/tools/browser.ts b/packages/coding-agent/src/tools/browser.ts index dd45d5526..89f392bbb 100644 --- a/packages/coding-agent/src/tools/browser.ts +++ b/packages/coding-agent/src/tools/browser.ts @@ -1,5 +1,6 @@ import * as os from "node:os"; import * as path from "node:path"; +import * as fs from "node:fs/promises"; import { Readability } from "@mozilla/readability"; import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import { StringEnum } from "@oh-my-pi/pi-ai"; @@ -1368,6 +1369,24 @@ export class BrowserTool implements AgentTool