Advanced Setting to enable browser session (#1736)

* feat: add Advanced Setting to enable browser session

* ensure browser tool is removed from system prompt

* fix test

* Update BrowserSession.ts

* Update BrowserSession.ts

---------

Co-authored-by: Saoud Rizwan <7799382+saoudrizwan@users.noreply.github.com>
This commit is contained in:
brownrw8 2025-02-10 18:02:00 -10:00 committed by GitHub
parent 82eba4d668
commit 7b6a3d25e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 26 additions and 6 deletions

View file

@ -0,0 +1,5 @@
---
"claude-dev": minor
---
Advanced Setting to disable browser tool

View file

@ -162,6 +162,11 @@
"default": true,
"description": "Enables extension to save checkpoints of workspace throughout the task."
},
"cline.disableBrowserTool": {
"type": "boolean",
"default": false,
"description": "Disables extension from spawning browser session."
},
"cline.modelSettings.o3Mini.reasoningEffort": {
"type": "string",
"enum": [

View file

@ -1259,12 +1259,12 @@ export class Cline {
throw new Error("MCP hub not available")
}
let systemPrompt = await SYSTEM_PROMPT(
cwd,
this.api.getModel().info.supportsComputerUse ?? false,
mcpHub,
this.browserSettings,
)
const disableBrowserTool = vscode.workspace.getConfiguration("cline").get<boolean>("disableBrowserTool") ?? false
const modelSupportsComputerUse = this.api.getModel().info.supportsComputerUse ?? false
const supportsComputerUse = modelSupportsComputerUse && !disableBrowserTool // only enable computer use if the model supports it and the user hasn't disabled it
let systemPrompt = await SYSTEM_PROMPT(cwd, supportsComputerUse, mcpHub, this.browserSettings)
let settingsCustomInstructions = this.customInstructions?.trim()
const clineRulesFilePath = path.resolve(cwd, GlobalFileNames.clineRules)

View file

@ -34,4 +34,14 @@ describe("Extension Tests", function () {
await vscode.commands.executeCommand("cline.historyButtonClicked")
// Success if no error thrown
})
it("should handle advanced settings configuration", async () => {
// Test browser session setting
await vscode.workspace.getConfiguration().update("cline.disableBrowserTool", true, true)
const updatedConfig = vscode.workspace.getConfiguration("cline")
expect(updatedConfig.get("disableBrowserTool")).to.be.true
// Reset settings
await vscode.workspace.getConfiguration().update("cline.disableBrowserTool", undefined, true)
})
})