clawcompany 0.10.0 → 0.12.0
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 +81 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -197,7 +197,7 @@ Own marketing strategy, content creation, brand voice, growth initiatives. Write
|
|
|
197
197
|
budgetTier: "earn",
|
|
198
198
|
budgetMonthly: null,
|
|
199
199
|
maxTokensPerTask: null,
|
|
200
|
-
tools: ["http", "filesystem", "web_fetch", "web_search"],
|
|
200
|
+
tools: ["http", "filesystem", "web_fetch", "web_search", "browser_use"],
|
|
201
201
|
skills: [],
|
|
202
202
|
isBuiltin: true,
|
|
203
203
|
isActive: true,
|
|
@@ -223,7 +223,7 @@ CRITICAL: All data, figures, prices, and statistics MUST come from tool calls (w
|
|
|
223
223
|
budgetTier: "earn",
|
|
224
224
|
budgetMonthly: null,
|
|
225
225
|
maxTokensPerTask: null,
|
|
226
|
-
tools: ["http", "filesystem", "web_fetch", "web_search", "price_feed"],
|
|
226
|
+
tools: ["http", "filesystem", "web_fetch", "web_search", "price_feed", "browser_use"],
|
|
227
227
|
skills: [],
|
|
228
228
|
isBuiltin: true,
|
|
229
229
|
isActive: true,
|
|
@@ -271,7 +271,7 @@ Write code, implement features, fix bugs, write tests. Execute the technical vis
|
|
|
271
271
|
budgetTier: "earn",
|
|
272
272
|
budgetMonthly: null,
|
|
273
273
|
maxTokensPerTask: null,
|
|
274
|
-
tools: ["shell", "filesystem", "http", "code_interpreter"],
|
|
274
|
+
tools: ["shell", "filesystem", "http", "code_interpreter", "browser_use"],
|
|
275
275
|
skills: ["coding"],
|
|
276
276
|
isBuiltin: true,
|
|
277
277
|
isActive: true,
|
|
@@ -947,7 +947,7 @@ import { join } from "path";
|
|
|
947
947
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "fs";
|
|
948
948
|
function banner() {
|
|
949
949
|
console.log("");
|
|
950
|
-
console.log(" \u{1F99E} ClawCompany v0.
|
|
950
|
+
console.log(" \u{1F99E} ClawCompany v0.12.0");
|
|
951
951
|
console.log(" Build for OPC. Every human being is a chairman.");
|
|
952
952
|
console.log("");
|
|
953
953
|
}
|
|
@@ -1833,6 +1833,8 @@ var ToolExecutor = class {
|
|
|
1833
1833
|
return this.execWebSearch(args);
|
|
1834
1834
|
case "price_feed":
|
|
1835
1835
|
return this.execPriceFeed(args);
|
|
1836
|
+
case "browser_use":
|
|
1837
|
+
return this.execBrowserUse(args);
|
|
1836
1838
|
default:
|
|
1837
1839
|
return `Unknown tool: ${toolName}`;
|
|
1838
1840
|
}
|
|
@@ -1975,6 +1977,57 @@ ${text.slice(0, 5e3)}`;
|
|
|
1975
1977
|
return `Error: ${err.message}`;
|
|
1976
1978
|
}
|
|
1977
1979
|
}
|
|
1980
|
+
async execBrowserUse(args) {
|
|
1981
|
+
const { action, url, index, text, path, code, direction } = args;
|
|
1982
|
+
let cmd;
|
|
1983
|
+
switch (action) {
|
|
1984
|
+
case "open":
|
|
1985
|
+
if (!url) return "Error: url is required for open action";
|
|
1986
|
+
cmd = `browser-use open ${JSON.stringify(url)}`;
|
|
1987
|
+
break;
|
|
1988
|
+
case "state":
|
|
1989
|
+
cmd = "browser-use state --json";
|
|
1990
|
+
break;
|
|
1991
|
+
case "click":
|
|
1992
|
+
if (index === void 0) return "Error: index is required for click action";
|
|
1993
|
+
cmd = `browser-use click ${index}`;
|
|
1994
|
+
break;
|
|
1995
|
+
case "type":
|
|
1996
|
+
if (!text) return "Error: text is required for type action";
|
|
1997
|
+
cmd = `browser-use type ${JSON.stringify(text)}`;
|
|
1998
|
+
break;
|
|
1999
|
+
case "input":
|
|
2000
|
+
if (index === void 0 || !text) return "Error: index and text are required for input action";
|
|
2001
|
+
cmd = `browser-use input ${index} ${JSON.stringify(text)}`;
|
|
2002
|
+
break;
|
|
2003
|
+
case "screenshot":
|
|
2004
|
+
cmd = `browser-use screenshot ${JSON.stringify(path ?? "/tmp/screenshot.png")}`;
|
|
2005
|
+
break;
|
|
2006
|
+
case "eval":
|
|
2007
|
+
if (!code) return "Error: code is required for eval action";
|
|
2008
|
+
cmd = `browser-use eval ${JSON.stringify(code)}`;
|
|
2009
|
+
break;
|
|
2010
|
+
case "scroll":
|
|
2011
|
+
if (!direction) return "Error: direction is required for scroll action";
|
|
2012
|
+
cmd = `browser-use scroll ${direction}`;
|
|
2013
|
+
break;
|
|
2014
|
+
case "close":
|
|
2015
|
+
cmd = "browser-use close";
|
|
2016
|
+
break;
|
|
2017
|
+
default:
|
|
2018
|
+
return `Unknown browser action: ${action}. Valid: open, state, click, type, input, screenshot, eval, scroll, close`;
|
|
2019
|
+
}
|
|
2020
|
+
try {
|
|
2021
|
+
const { stdout, stderr } = await execAsync(cmd, { timeout: 3e4 });
|
|
2022
|
+
return stdout + (stderr ? `
|
|
2023
|
+
STDERR: ${stderr}` : "");
|
|
2024
|
+
} catch (err) {
|
|
2025
|
+
if (err.code === "ENOENT" || err.message?.includes("not found") || err.message?.includes("ENOENT")) {
|
|
2026
|
+
return "Error: browser-use not installed. Run: pip install browser-use && browser-use install";
|
|
2027
|
+
}
|
|
2028
|
+
return `Error: ${err.message}`;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
1978
2031
|
async execPriceFeed(args) {
|
|
1979
2032
|
const asset = (args.asset ?? "bitcoin").toLowerCase();
|
|
1980
2033
|
const currency = (args.currency ?? "usd").toLowerCase();
|
|
@@ -2106,6 +2159,30 @@ var BUILTIN_TOOLS = {
|
|
|
2106
2159
|
}
|
|
2107
2160
|
}
|
|
2108
2161
|
},
|
|
2162
|
+
browser_use: {
|
|
2163
|
+
type: "function",
|
|
2164
|
+
function: {
|
|
2165
|
+
name: "browser_use",
|
|
2166
|
+
description: "Control a web browser \u2014 navigate pages, click elements, fill forms, take screenshots, run JavaScript. Uses browser-use CLI.",
|
|
2167
|
+
parameters: {
|
|
2168
|
+
type: "object",
|
|
2169
|
+
properties: {
|
|
2170
|
+
action: {
|
|
2171
|
+
type: "string",
|
|
2172
|
+
enum: ["open", "state", "click", "type", "input", "screenshot", "eval", "scroll", "close"],
|
|
2173
|
+
description: "Browser action to perform"
|
|
2174
|
+
},
|
|
2175
|
+
url: { type: "string", description: "URL to open (for open action)" },
|
|
2176
|
+
index: { type: "number", description: "Element index to interact with (for click/input actions)" },
|
|
2177
|
+
text: { type: "string", description: "Text to type (for type/input actions)" },
|
|
2178
|
+
path: { type: "string", description: "Screenshot save path (default: /tmp/screenshot.png)" },
|
|
2179
|
+
code: { type: "string", description: "JavaScript code to evaluate (for eval action)" },
|
|
2180
|
+
direction: { type: "string", enum: ["up", "down"], description: "Scroll direction (for scroll action)" }
|
|
2181
|
+
},
|
|
2182
|
+
required: ["action"]
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
},
|
|
2109
2186
|
price_feed: {
|
|
2110
2187
|
type: "function",
|
|
2111
2188
|
function: {
|
package/package.json
CHANGED