chromeflow 0.1.32 → 0.1.33
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/capture.js +7 -3
- 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/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/package.json
CHANGED