From 82eba4d66822097b85a4214da8bd23f16af9e488 Mon Sep 17 00:00:00 2001 From: supermomonga Date: Mon, 10 Feb 2025 17:13:48 +0900 Subject: [PATCH] Add extension setting for chromium executable path (#1721) * Add extension setting for chromium executable path * apply changeset * Update src/services/browser/BrowserSession.ts Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> * format code --------- Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com> --- .changeset/poor-cobras-destroy.md | 5 +++++ package.json | 5 +++++ src/services/browser/BrowserSession.ts | 13 ++++++++----- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 .changeset/poor-cobras-destroy.md diff --git a/.changeset/poor-cobras-destroy.md b/.changeset/poor-cobras-destroy.md new file mode 100644 index 0000000000..991c7324cc --- /dev/null +++ b/.changeset/poor-cobras-destroy.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +Add extension setting for chromium executable path diff --git a/package.json b/package.json index 7276e45b8d..898e2b9edf 100644 --- a/package.json +++ b/package.json @@ -171,6 +171,11 @@ ], "default": "medium", "description": "Controls the reasoning effort when using the o3-mini model. Higher values may result in more thorough but slower responses." + }, + "cline.chromeExecutablePath": { + "type": "string", + "default": null, + "description": "Path to Chrome executable for browser use functionality. If not set, the extension will attempt to find or download it automatically." } } } diff --git a/src/services/browser/BrowserSession.ts b/src/services/browser/BrowserSession.ts index cbc7734d36..14b6ecef8b 100644 --- a/src/services/browser/BrowserSession.ts +++ b/src/services/browser/BrowserSession.ts @@ -42,11 +42,14 @@ export class BrowserSession { await fs.mkdir(puppeteerDir, { recursive: true }) } - // if chromium doesn't exist, this will download it to path.join(puppeteerDir, ".chromium-browser-snapshots") - // if it does exist it will return the path to existing chromium - const stats: PCRStats = await PCR({ - downloadPath: puppeteerDir, - }) + const chromeExecutablePath = vscode.workspace.getConfiguration("cline").get("chromeExecutablePath") + if (chromeExecutablePath && !(await fileExistsAtPath(chromeExecutablePath))) + throw new Error(`Chrome executable not found at path: ${chromeExecutablePath}`) + const stats: PCRStats = chromeExecutablePath + ? { puppeteer: require("puppeteer-core"), executablePath: chromeExecutablePath } + : // if chromium doesn't exist, this will download it to path.join(puppeteerDir, ".chromium-browser-snapshots") + // if it does exist it will return the path to existing chromium + await PCR({ downloadPath: puppeteerDir }) return stats }