@browserbasehq/browse-cli 0.2.0 → 0.2.1-alpha-1dbc07194bc92e6a3477d5b7348114f156d8554d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +52 -49
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -101696,16 +101696,7 @@ var actTool = (v32, executionModel, variables, toolTimeout) => {
|
|
|
101696
101696
|
return response;
|
|
101697
101697
|
} catch (error46) {
|
|
101698
101698
|
if (error46 instanceof TimeoutError) {
|
|
101699
|
-
|
|
101700
|
-
v32.logger({
|
|
101701
|
-
category: "agent",
|
|
101702
|
-
message: timeoutMessage,
|
|
101703
|
-
level: 0
|
|
101704
|
-
});
|
|
101705
|
-
return {
|
|
101706
|
-
success: false,
|
|
101707
|
-
error: `${timeoutMessage} \u2014 try using a different description for the action`
|
|
101708
|
-
};
|
|
101699
|
+
throw error46;
|
|
101709
101700
|
}
|
|
101710
101701
|
return {
|
|
101711
101702
|
success: false,
|
|
@@ -101890,18 +101881,7 @@ var ariaTreeTool = (v32, toolTimeout) => tool({
|
|
|
101890
101881
|
return { success: true, content, pageUrl };
|
|
101891
101882
|
} catch (error46) {
|
|
101892
101883
|
if (error46 instanceof TimeoutError) {
|
|
101893
|
-
|
|
101894
|
-
v32.logger({
|
|
101895
|
-
category: "agent",
|
|
101896
|
-
message: timeoutMessage,
|
|
101897
|
-
level: 0
|
|
101898
|
-
});
|
|
101899
|
-
return {
|
|
101900
|
-
content: "",
|
|
101901
|
-
error: timeoutMessage,
|
|
101902
|
-
success: false,
|
|
101903
|
-
pageUrl: ""
|
|
101904
|
-
};
|
|
101884
|
+
throw error46;
|
|
101905
101885
|
}
|
|
101906
101886
|
return {
|
|
101907
101887
|
content: "",
|
|
@@ -101984,16 +101964,7 @@ For any form with 2+ inputs/textareas. Faster than individual typing.`,
|
|
|
101984
101964
|
};
|
|
101985
101965
|
} catch (error46) {
|
|
101986
101966
|
if (error46 instanceof TimeoutError) {
|
|
101987
|
-
|
|
101988
|
-
v32.logger({
|
|
101989
|
-
category: "agent",
|
|
101990
|
-
message: timeoutMessage,
|
|
101991
|
-
level: 0
|
|
101992
|
-
});
|
|
101993
|
-
return {
|
|
101994
|
-
success: false,
|
|
101995
|
-
error: `${timeoutMessage} \u2014 try filling fewer fields at once or use a different tool`
|
|
101996
|
-
};
|
|
101967
|
+
throw error46;
|
|
101997
101968
|
}
|
|
101998
101969
|
return {
|
|
101999
101970
|
success: false,
|
|
@@ -102254,16 +102225,7 @@ var extractTool = (v32, executionModel, toolTimeout) => tool({
|
|
|
102254
102225
|
return { success: true, result };
|
|
102255
102226
|
} catch (error46) {
|
|
102256
102227
|
if (error46 instanceof TimeoutError) {
|
|
102257
|
-
|
|
102258
|
-
v32.logger({
|
|
102259
|
-
category: "agent",
|
|
102260
|
-
message: timeoutMessage,
|
|
102261
|
-
level: 0
|
|
102262
|
-
});
|
|
102263
|
-
return {
|
|
102264
|
-
success: false,
|
|
102265
|
-
error: timeoutMessage
|
|
102266
|
-
};
|
|
102228
|
+
throw error46;
|
|
102267
102229
|
}
|
|
102268
102230
|
return { success: false, error: error46?.message ?? String(error46) };
|
|
102269
102231
|
}
|
|
@@ -102976,6 +102938,8 @@ var searchTool2 = (v32) => tool({
|
|
|
102976
102938
|
});
|
|
102977
102939
|
|
|
102978
102940
|
// ../core/dist/esm/lib/v3/agent/tools/index.js
|
|
102941
|
+
init_timeoutConfig();
|
|
102942
|
+
init_sdkErrors();
|
|
102979
102943
|
function filterTools(tools, mode, excludeTools) {
|
|
102980
102944
|
const filtered = { ...tools };
|
|
102981
102945
|
if (mode === "hybrid") {
|
|
@@ -102994,6 +102958,33 @@ function filterTools(tools, mode, excludeTools) {
|
|
|
102994
102958
|
}
|
|
102995
102959
|
return filtered;
|
|
102996
102960
|
}
|
|
102961
|
+
function wrapToolWithTimeout(agentTool, toolName, v32, timeoutMs, timeoutHint) {
|
|
102962
|
+
if (!timeoutMs || !agentTool.execute)
|
|
102963
|
+
return agentTool;
|
|
102964
|
+
const originalExecute = agentTool.execute;
|
|
102965
|
+
return {
|
|
102966
|
+
...agentTool,
|
|
102967
|
+
execute: async (...args) => {
|
|
102968
|
+
try {
|
|
102969
|
+
return await withTimeout(originalExecute(...args), timeoutMs, toolName);
|
|
102970
|
+
} catch (error46) {
|
|
102971
|
+
if (error46 instanceof TimeoutError) {
|
|
102972
|
+
const message = `TimeoutError: ${error46.message}${timeoutHint ? ` ${timeoutHint}` : ""}`;
|
|
102973
|
+
v32.logger({
|
|
102974
|
+
category: "agent",
|
|
102975
|
+
message,
|
|
102976
|
+
level: 0
|
|
102977
|
+
});
|
|
102978
|
+
return {
|
|
102979
|
+
success: false,
|
|
102980
|
+
error: message
|
|
102981
|
+
};
|
|
102982
|
+
}
|
|
102983
|
+
throw error46;
|
|
102984
|
+
}
|
|
102985
|
+
}
|
|
102986
|
+
};
|
|
102987
|
+
}
|
|
102997
102988
|
function createAgentTools(v32, options) {
|
|
102998
102989
|
const executionModel = options?.executionModel;
|
|
102999
102990
|
const mode = options?.mode ?? "dom";
|
|
@@ -103001,7 +102992,13 @@ function createAgentTools(v32, options) {
|
|
|
103001
102992
|
const excludeTools = options?.excludeTools;
|
|
103002
102993
|
const variables = options?.variables;
|
|
103003
102994
|
const toolTimeout = options?.toolTimeout;
|
|
103004
|
-
const
|
|
102995
|
+
const timeoutHints = {
|
|
102996
|
+
act: "(it may continue executing in the background) \u2014 try using a different description for the action",
|
|
102997
|
+
ariaTree: "\u2014 the page may be too large",
|
|
102998
|
+
extract: "\u2014 try using a smaller or simpler schema",
|
|
102999
|
+
fillForm: "(it may continue executing in the background) \u2014 try filling fewer fields at once or use a different tool"
|
|
103000
|
+
};
|
|
103001
|
+
const unwrappedTools = {
|
|
103005
103002
|
act: actTool(v32, executionModel, variables, toolTimeout),
|
|
103006
103003
|
ariaTree: ariaTreeTool(v32, toolTimeout),
|
|
103007
103004
|
click: clickTool(v32, provider),
|
|
@@ -103015,15 +103012,21 @@ function createAgentTools(v32, options) {
|
|
|
103015
103012
|
navback: navBackTool(v32),
|
|
103016
103013
|
screenshot: screenshotTool(v32),
|
|
103017
103014
|
scroll: mode === "hybrid" ? scrollVisionTool(v32, provider) : scrollTool(v32),
|
|
103018
|
-
|
|
103019
|
-
type: typeTool(v32, provider, variables),
|
|
103020
|
-
wait: waitTool(v32, mode)
|
|
103015
|
+
type: typeTool(v32, provider, variables)
|
|
103021
103016
|
};
|
|
103022
103017
|
if (options?.useSearch && options.browserbaseApiKey) {
|
|
103023
|
-
|
|
103018
|
+
unwrappedTools.search = searchTool(v32, options.browserbaseApiKey);
|
|
103024
103019
|
} else if (process.env.BRAVE_API_KEY) {
|
|
103025
|
-
|
|
103020
|
+
unwrappedTools.search = searchTool2(v32);
|
|
103026
103021
|
}
|
|
103022
|
+
const allTools = {
|
|
103023
|
+
...Object.fromEntries(Object.entries(unwrappedTools).map(([name18, t3]) => [
|
|
103024
|
+
name18,
|
|
103025
|
+
wrapToolWithTimeout(t3, `${name18}()`, v32, toolTimeout, timeoutHints[name18])
|
|
103026
|
+
])),
|
|
103027
|
+
think: thinkTool(),
|
|
103028
|
+
wait: waitTool(v32, mode)
|
|
103029
|
+
};
|
|
103027
103030
|
return filterTools(allTools, mode, excludeTools);
|
|
103028
103031
|
}
|
|
103029
103032
|
|
|
@@ -164513,7 +164516,7 @@ var import_child_process4 = require("child_process");
|
|
|
164513
164516
|
var readline = __toESM(require("readline"));
|
|
164514
164517
|
|
|
164515
164518
|
// package.json
|
|
164516
|
-
var version3 = "0.2.
|
|
164519
|
+
var version3 = "0.2.1-alpha-1dbc07194bc92e6a3477d5b7348114f156d8554d";
|
|
164517
164520
|
|
|
164518
164521
|
// src/index.ts
|
|
164519
164522
|
var program = new import_commander.Command();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserbasehq/browse-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-alpha-1dbc07194bc92e6a3477d5b7348114f156d8554d",
|
|
4
4
|
"description": "Browser automation CLI for AI agents, built on Stagehand",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"pino": "^9.6.0",
|
|
48
48
|
"pino-pretty": "^13.0.0",
|
|
49
49
|
"ws": "^8.18.0",
|
|
50
|
-
"@browserbasehq/stagehand": "3.2.
|
|
50
|
+
"@browserbasehq/stagehand": "3.2.1-alpha-1dbc07194bc92e6a3477d5b7348114f156d8554d"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/node": "^20.11.30",
|