Skip to content

Commit 7028670

Browse files
committed
Misc updates
1 parent 8d73ad7 commit 7028670

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

src/core/Cline.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ export class Cline {
15041504
}
15051505

15061506
this.consecutiveMistakeCount = 0
1507-
const didApprove = await askApproval("browser_action_launch", url)
1507+
const didApprove = this.alwaysAllowBrowser || await askApproval("browser_action_launch", url)
15081508
if (!didApprove) {
15091509
break
15101510
}
@@ -1567,7 +1567,6 @@ export class Cline {
15671567
break
15681568
}
15691569
}
1570-
15711570
switch (action) {
15721571
case "launch":
15731572
case "click":
@@ -1595,7 +1594,7 @@ export class Cline {
15951594
break
15961595
}
15971596
} catch (error) {
1598-
await this.browserSession.closeBrowser()
1597+
await this.browserSession.closeBrowser() // if any error occurs, the browser session is terminated
15991598
await handleError("executing browser action", error)
16001599
break
16011600
}
@@ -1763,11 +1762,7 @@ export class Cline {
17631762

17641763
const { response, text, images } = await this.ask("completion_result", "", false)
17651764
if (response === "yesButtonClicked") {
1766-
// Only close browser if not in interactive mode
1767-
if (!this.browserSession.isInInteractiveMode) {
1768-
await this.browserSession.closeBrowser()
1769-
}
1770-
pushToolResult("")
1765+
pushToolResult("") // signals to recursive loop to stop (for now this never happens since yesButtonClicked will trigger a new task)
17711766
break
17721767
}
17731768
await this.say("user_feedback", text ?? "", images)
@@ -1794,7 +1789,7 @@ export class Cline {
17941789
break
17951790
}
17961791
} catch (error) {
1797-
await handleError("completing task", error)
1792+
await handleError("inspecting site", error)
17981793
break
17991794
}
18001795
}

src/services/browser/BrowserSession.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,21 @@ export class BrowserSession {
5656
"--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36",
5757
],
5858
defaultViewport: {
59-
width: 900,
60-
height: 600
59+
width: 1440,
60+
height: 900
6161
},
6262
headless: false, // Always use non-headless mode
6363
})
6464

6565
}
6666

6767
this.page = await this.browser?.newPage()
68+
await this.page?.setViewport({
69+
width: 1440,
70+
height: 900,
71+
deviceScaleFactor: 1,
72+
isMobile: false
73+
});
6874

6975
return {
7076
screenshot: "",
@@ -182,7 +188,7 @@ export class BrowserSession {
182188
}
183189

184190
private async waitTillHTMLStable(page: Page, timeout = 5_000) {
185-
const checkDurationMsecs = 500
191+
const checkDurationMsecs = 500 // 1000
186192
const maxChecks = timeout / checkDurationMsecs
187193
let lastHTMLSize = 0
188194
let checkCounts = 1
@@ -273,8 +279,4 @@ export class BrowserSession {
273279
await delay(300)
274280
})
275281
}
276-
277-
get isInInteractiveMode(): boolean {
278-
return this.isInteractive
279-
}
280282
}

0 commit comments

Comments
 (0)