chromeflow 0.1.32 → 0.1.34
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/CLAUDE.md +5 -5
- package/dist/tools/browser.js +2 -2
- package/dist/tools/capture.js +7 -3
- package/dist/tools/flow.js +1 -1
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -22,11 +22,11 @@ Do NOT ask "should I open the browser?" — just do it. The user expects seamles
|
|
|
22
22
|
`scroll_page` then retry, or use `highlight_region` to show the user. Never use
|
|
23
23
|
`osascript`, `applescript`, or any shell command to control the browser.
|
|
24
24
|
|
|
25
|
-
2. **Never use `take_screenshot` to
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
`
|
|
29
|
-
|
|
25
|
+
2. **Never use `take_screenshot` to read page content.** After `scroll_page`, after
|
|
26
|
+
`click_element`, after navigation — always call `get_page_text`, not `take_screenshot`.
|
|
27
|
+
`get_page_text` returns up to 20,000 characters; if truncated it tells you the next
|
|
28
|
+
`startIndex` to paginate. Screenshots are only for locating an element's pixel position
|
|
29
|
+
when DOM queries have already failed. Never take more than 1–2 screenshots in a row.
|
|
30
30
|
|
|
31
31
|
3. **Use `wait_for_selector` to wait for async page changes** (build completion, modals,
|
|
32
32
|
toasts). Never poll with repeated `take_screenshot` calls.
|
package/dist/tools/browser.js
CHANGED
|
@@ -6,7 +6,7 @@ import { execSync } from "child_process";
|
|
|
6
6
|
function registerBrowserTools(server, bridge) {
|
|
7
7
|
server.tool(
|
|
8
8
|
"open_page",
|
|
9
|
-
"Navigate to a URL. By default reuses the active tab. Set new_tab=true to open alongside the current tab without losing it.",
|
|
9
|
+
"Navigate to a URL. By default reuses the active tab. Set new_tab=true to open alongside the current tab without losing it. After navigating, call get_page_text to read the page \u2014 do NOT take a screenshot.",
|
|
10
10
|
{
|
|
11
11
|
url: z.string().url().describe("The URL to navigate to"),
|
|
12
12
|
new_tab: z.boolean().optional().describe("Open in a new tab instead of replacing the current one (default false)")
|
|
@@ -50,7 +50,7 @@ ${lines.join("\n")}` }]
|
|
|
50
50
|
);
|
|
51
51
|
server.tool(
|
|
52
52
|
"take_screenshot",
|
|
53
|
-
"Capture a screenshot
|
|
53
|
+
"Capture a screenshot of the current page. IMPORTANT: Do NOT use this to read page content or check what is on the page \u2014 call get_page_text instead, which is faster and returns searchable text. Screenshots are ONLY for locating a specific element's pixel coordinates when get_elements has already failed. Never take a screenshot immediately after open_page, scroll_page, or click_element \u2014 always use get_page_text after those actions. Never take more than 1-2 screenshots in a row. To also save or copy the image, use take_and_copy_screenshot instead.",
|
|
54
54
|
{},
|
|
55
55
|
async () => {
|
|
56
56
|
const response = await bridge.request({ type: "screenshot" });
|
package/dist/tools/capture.js
CHANGED
|
@@ -60,14 +60,18 @@ After filling, call wait_for_click only if the user needs to review/confirm; oth
|
|
|
60
60
|
"get_page_text",
|
|
61
61
|
`Get the visible text content of the current page without taking a screenshot.
|
|
62
62
|
Use this instead of take_screenshot whenever you need to read what's on the page \u2014 errors, build status, form labels, confirmation messages, etc.
|
|
63
|
-
|
|
63
|
+
Returns up to 20,000 characters at a time. If the response ends with "... (N more characters)", call again with startIndex to read the next chunk.
|
|
64
|
+
Never use take_screenshot just to read page content \u2014 paginate with startIndex instead.`,
|
|
64
65
|
{
|
|
65
66
|
selector: z.string().optional().describe(
|
|
66
67
|
`CSS selector to scope the extraction (e.g. 'main', '.error-toast', '[data-testid="status"]'). Omit to auto-extract from the main content area.`
|
|
68
|
+
),
|
|
69
|
+
startIndex: z.number().optional().describe(
|
|
70
|
+
"Character offset to start from. Use this to read past the first 20,000 characters \u2014 the response will tell you the next startIndex when more content exists."
|
|
67
71
|
)
|
|
68
72
|
},
|
|
69
|
-
async ({ selector }) => {
|
|
70
|
-
const response = await bridge.request({ type: "get_page_text", selector });
|
|
73
|
+
async ({ selector, startIndex }) => {
|
|
74
|
+
const response = await bridge.request({ type: "get_page_text", selector, startIndex });
|
|
71
75
|
if (response.type !== "page_text_response") throw new Error("Unexpected response");
|
|
72
76
|
const text = response.text;
|
|
73
77
|
return {
|
package/dist/tools/flow.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
function registerFlowTools(server, bridge) {
|
|
3
3
|
server.tool(
|
|
4
4
|
"scroll_page",
|
|
5
|
-
"Scroll the page or the focused panel up or down. Use this when the target location is unknown. If you know which field or element you need, use scroll_to_element instead \u2014 it scrolls precisely without guessing. After scrolling,
|
|
5
|
+
"Scroll the page or the focused panel up or down. Use this when the target location is unknown. If you know which field or element you need, use scroll_to_element instead \u2014 it scrolls precisely without guessing. After scrolling, call get_page_text to read the new content \u2014 NEVER call take_screenshot after scrolling.",
|
|
6
6
|
{
|
|
7
7
|
direction: z.enum(["down", "up"]).describe("Scroll direction"),
|
|
8
8
|
amount: z.number().optional().describe("Pixels to scroll (default 400)")
|
package/package.json
CHANGED