browser integration
This commit is contained in:
@@ -96,4 +96,36 @@ let tools: [Tool] = [
|
||||
""",
|
||||
run: browserTool
|
||||
),
|
||||
Tool(
|
||||
name: "chrome",
|
||||
description: "Drive Chrome on this Mac through its DevTools protocol: pages, DOM, network, console and performance traces. "
|
||||
+ "It is Chrome with byre's own profile, started on first use and kept between calls, so a site the human has logged into there (passkeys included) stays logged in; when a site needs a login, ask the human to sign in in that Chrome window. "
|
||||
+ "ops: tabs (list tabs: id, title, url), navigate (url, optionally new_tab; waits for the page to load and clears the tab's network and console logs), "
|
||||
+ "js (run code in the tab and return its value: the last expression's, promises awaited, objects as JSON; use it to explore the DOM), select (tab), close (tab), "
|
||||
+ "network (the tab's requests since this tool first touched the tab or its last navigate: number, status, type, start and duration in ms, bytes, method, url; with request, one request's headers and bodies; filter keeps urls containing the text), "
|
||||
+ "console (console messages, exceptions and browser log entries), "
|
||||
+ "trace_start and trace_stop (a performance trace: start, navigate or act, stop; stop saves the trace file and reports FCP, LCP, DOMContentLoaded, load and the main thread's long tasks), "
|
||||
+ "cdp (send any DevTools protocol method with params to the tab, e.g. DOM.getDocument, CSS.getComputedStyleForNode, Emulation.setCPUThrottlingRate, Network.setCacheDisabled; returns its result as JSON). "
|
||||
+ "tab is a tab id from tabs; without it, the tab this tool last used, else Chrome's first tab. capture screenshots the tab's page. "
|
||||
+ "It drives Chrome without the mouse or keyboard; select, close, navigate with new_tab, cdp, capture and the first call that starts Chrome can change what is in front, so those hold the shared input lock like act does.",
|
||||
schema: """
|
||||
{"type": "object", "properties": {
|
||||
"op": {"type": "string", "enum": ["tabs", "navigate", "js", "select", "close", "network", "console", "trace_start", "trace_stop", "cdp"]},
|
||||
"tab": {"type": "string", "description": "Tab id from tabs (default: the tab this tool last used, else Chrome's first tab)."},
|
||||
"url": {"type": "string", "description": "For navigate."},
|
||||
"new_tab": {"type": "boolean", "description": "For navigate: open the url in a new tab."},
|
||||
"code": {"type": "string", "description": "For js."},
|
||||
"request": {"type": "integer", "description": "For network: the request number to show in full."},
|
||||
"filter": {"type": "string", "description": "For network: only requests whose url contains this text (case-insensitive)."},
|
||||
"method": {"type": "string", "description": "For cdp: the protocol method, e.g. DOM.getDocument."},
|
||||
"params": {"type": "object", "description": "For cdp: the method's parameters."},
|
||||
"wait_for": {"type": "string", "description": "Then wait until this text (case-insensitive) is in the tab's title or page text, polling every 200ms."},
|
||||
"wait_ms": {"type": "integer", "description": "Wait this long after the op, before wait_for and capture."},
|
||||
"timeout_ms": {"type": "integer", "description": "How long navigate waits for the load (default 15000) and wait_for waits (default 10000). Giving up is reported, not an error."},
|
||||
"capture": {"type": "boolean", "description": "Finish with a screenshot of the tab's page."},
|
||||
"max_edge": {"type": "number", "description": "Longest edge of the screenshot in pixels, 16 to 8192 (default 1568, which is as much as you can see)."}
|
||||
}, "required": ["op"]}
|
||||
""",
|
||||
run: chromeTool
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user