You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a5f446d
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: extensions/browser/skills/browser-automation/SKILL.md
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,15 +48,15 @@ Use this skill when you need the `browser` tool for anything beyond a single pag
48
48
49
49
## Code Mode Loop
50
50
51
-
When `tools.codeMode` is enabled, the Browser tool has no normal turn — it is cataloged behind `exec`/`wait`. Call it from exec cells as an async global, using the callable name the exec quick index advertises for the Browser tool (normally `browser`; colliding names get suffixed, and a client tool can win an identical name). If the quick index omits or renames it, discover it with `catalog.search("browser")` and call the returned handle:
51
+
When `tools.codeMode` is enabled, the Browser tool has no normal turn — it is cataloged behind `exec`/`wait`. Call it from exec cells as an async global, using the callable name the exec quick index advertises for the Browser tool (normally `browser`; colliding names get suffixed, and a client tool can win an identical name). An exact `catalog.search("browser")`returns a handle already bound to the effective callable name, so resolve the handle in each cell and call it instead of hard-coding the literal global; an empty result means the Browser tool is not cataloged in this run.
52
52
53
-
```javascript
54
-
let previous = { url:undefined, newElements:undefined };
55
-
```
56
-
57
-
Keep the same labeled tab through the loop, and alternate reads with actions:
53
+
Keep the same labeled tab through the loop, and alternate reads with actions. Each `exec` cell starts a fresh VM — bindings from a completed cell are gone in the next, and only runs left `waiting` keep their state until `wait` resumes them — so carry comparison state across cells by returning it and re-embedding the returned values in the next cell:
58
54
59
55
```javascript
56
+
// previous = the url/newElements returned by the last completed cell (a fresh
57
+
// VM runs this cell, so prior bindings do not exist here).
- To read text inside code mode, run a targeted `act` evaluate (requires the evaluate capability; `browser.evaluateEnabled` can disable it) and keep the returned value bounded, because page-script output is untrusted:
When evaluate is unavailable, keep the loop on structured state only.
95
95
96
96
- Return only the fields the next step needs; never return the whole details object.
97
-
- Keep `previous` between cells when a url change or new-element count helps explain a change.
97
+
- Completed cells share no state: re-embed the previous cell's returned `url`/`newElements` in the next cell, or keep the comparison inside one cell. Only `waiting` runs persist, resumed by `wait`.
98
98
- Interleave each act with a URL or tabs check before the next dependent act.
99
99
- If a batch returns `aborted`, take a fresh snapshot before continuing.
100
-
- If `newElements` is positive, inspect those elements first, then update the saved state.
100
+
- If `newElements` is positive, inspect those elements first, then update the re-embedded state.
101
101
- Use separate act calls when navigation is expected between steps.
0 commit comments