|
@@ -30,6 +30,7 @@ export async function browserActionTool(
|
|
|
// if the block is complete and we don't have a valid action cline is a mistake
|
|
// if the block is complete and we don't have a valid action cline is a mistake
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "action"))
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "action"))
|
|
|
// Do not close the browser on parameter validation errors
|
|
// Do not close the browser on parameter validation errors
|
|
|
}
|
|
}
|
|
@@ -63,6 +64,7 @@ export async function browserActionTool(
|
|
|
if (!url) {
|
|
if (!url) {
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "url"))
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "url"))
|
|
|
// Do not close the browser on parameter validation errors
|
|
// Do not close the browser on parameter validation errors
|
|
|
return
|
|
return
|
|
@@ -102,22 +104,24 @@ export async function browserActionTool(
|
|
|
if (!coordinate) {
|
|
if (!coordinate) {
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "coordinate"))
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "coordinate"))
|
|
|
// Do not close the browser on parameter validation errors
|
|
// Do not close the browser on parameter validation errors
|
|
|
return // can't be within an inner switch
|
|
return // can't be within an inner switch
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Get viewport dimensions from the browser session
|
|
// Get viewport dimensions from the browser session
|
|
|
const viewportSize = cline.browserSession.getViewportSize()
|
|
const viewportSize = cline.browserSession.getViewportSize()
|
|
|
const viewportWidth = viewportSize.width || 900 // default to 900 if not available
|
|
const viewportWidth = viewportSize.width || 900 // default to 900 if not available
|
|
|
const viewportHeight = viewportSize.height || 600 // default to 600 if not available
|
|
const viewportHeight = viewportSize.height || 600 // default to 600 if not available
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// Scale coordinate from image dimensions to viewport dimensions
|
|
// Scale coordinate from image dimensions to viewport dimensions
|
|
|
try {
|
|
try {
|
|
|
processedCoordinate = scaleCoordinate(coordinate, viewportWidth, viewportHeight)
|
|
processedCoordinate = scaleCoordinate(coordinate, viewportWidth, viewportHeight)
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(
|
|
pushToolResult(
|
|
|
await cline.sayAndCreateMissingParamError(
|
|
await cline.sayAndCreateMissingParamError(
|
|
|
"browser_action",
|
|
"browser_action",
|
|
@@ -133,16 +137,18 @@ export async function browserActionTool(
|
|
|
if (!text) {
|
|
if (!text) {
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "text"))
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "text"))
|
|
|
// Do not close the browser on parameter validation errors
|
|
// Do not close the browser on parameter validation errors
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if (action === "resize") {
|
|
if (action === "resize") {
|
|
|
if (!size) {
|
|
if (!size) {
|
|
|
cline.consecutiveMistakeCount++
|
|
cline.consecutiveMistakeCount++
|
|
|
cline.recordToolError("browser_action")
|
|
cline.recordToolError("browser_action")
|
|
|
|
|
+ cline.didToolFailInCurrentTurn = true
|
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "size"))
|
|
pushToolResult(await cline.sayAndCreateMissingParamError("browser_action", "size"))
|
|
|
// Do not close the browser on parameter validation errors
|
|
// Do not close the browser on parameter validation errors
|
|
|
return
|
|
return
|