omowright 0.2.0 → 0.3.1
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/README.md +43 -29
- package/TOOLS.md +9 -8
- package/dist/agent-tabs.d.ts +56 -0
- package/dist/aria-hidden.d.ts +1 -0
- package/dist/aside/cli-binary.d.ts +7 -0
- package/dist/aside/cli-contract.d.ts +9 -0
- package/dist/aside/errors.d.ts +8 -0
- package/dist/aside/line-transport.d.ts +11 -0
- package/dist/aside/mcp-transport.d.ts +11 -0
- package/dist/aside/onboard.d.ts +76 -0
- package/dist/aside/session-types.d.ts +68 -0
- package/dist/aside/session.d.ts +20 -0
- package/{bin/omowright-cloak.mjs → dist/bin/omowright-cloak.js} +28 -31
- package/dist/bridge-schemas.d.ts +326 -0
- package/dist/bridge-transport.d.ts +144 -0
- package/dist/browser-context.d.ts +4024 -0
- package/dist/browser-process.d.ts +10 -0
- package/dist/bsk/browser-signals.d.ts +23 -0
- package/dist/bsk/browsers.d.ts +46 -0
- package/dist/bsk/connect.d.ts +23 -0
- package/dist/bsk/daemon-info.d.ts +16 -0
- package/dist/bsk/external-extension.d.ts +74 -0
- package/dist/bsk/identify-browser.d.ts +48 -0
- package/dist/bsk/install-cli.d.ts +37 -0
- package/dist/bsk/ipc-client.d.ts +45 -0
- package/dist/bsk/onboard.d.ts +96 -0
- package/dist/bsk/reply-fields.d.ts +3 -0
- package/dist/bsk/screenshot.d.ts +24 -0
- package/dist/bsk/session.d.ts +142 -0
- package/dist/bsk/snapshot.d.ts +16 -0
- package/dist/bsk/targets.d.ts +20 -0
- package/dist/captcha-wait.d.ts +17 -0
- package/dist/captcha.d.ts +46 -0
- package/dist/cdp-errors.d.ts +38 -0
- package/dist/cdp-methods.d.ts +10 -0
- package/dist/cdp-protocol.d.ts +459 -0
- package/dist/chrome-profile.d.ts +77 -0
- package/dist/chrome.d.ts +130 -0
- package/dist/cloak-profile.d.ts +43 -0
- package/dist/connection.d.ts +4024 -0
- package/dist/console-events.d.ts +22 -0
- package/dist/cookies.d.ts +42 -0
- package/dist/core.d.ts +10810 -0
- package/dist/cua.d.ts +56 -0
- package/dist/dialog-policy.d.ts +43 -0
- package/dist/ego/bindings.d.ts +68 -0
- package/dist/ego/cdp-client.d.ts +28 -0
- package/dist/ego/client.d.ts +8 -0
- package/dist/ego/errors.d.ts +7 -0
- package/dist/emulate.d.ts +62 -0
- package/dist/engines.d.ts +59 -0
- package/dist/events.d.ts +93 -0
- package/dist/frames-snapshot.d.ts +58 -0
- package/dist/har.d.ts +88 -0
- package/dist/human-handoff.d.ts +30 -0
- package/{src/index.js → dist/index.d.ts} +12 -55
- package/dist/index.js +39478 -0
- package/dist/injected.d.ts +1 -0
- package/dist/instance-lock.d.ts +5 -0
- package/dist/instances.d.ts +45 -0
- package/dist/internal-capability.d.ts +1 -0
- package/dist/launch-endpoint.d.ts +34 -0
- package/dist/layers.d.ts +31 -0
- package/dist/llm.d.ts +1349 -0
- package/dist/lock-backend-win32-xbcm60vz.js +57 -0
- package/dist/lock-backend-win32.d.ts +3 -0
- package/dist/lock-backend.d.ts +6 -0
- package/dist/native-host-win32.d.ts +38 -0
- package/dist/network-events.d.ts +66 -0
- package/dist/network-snoop.d.ts +56 -0
- package/dist/nul-frames.d.ts +4 -0
- package/dist/open-shadow-query.d.ts +1 -0
- package/dist/owner-only.d.ts +15 -0
- package/dist/page-bundle.js +1597 -0
- package/dist/page-events.d.ts +25 -0
- package/dist/page-routes.d.ts +30 -0
- package/dist/page-setup.d.ts +55 -0
- package/dist/pipe.d.ts +71 -0
- package/dist/process-start-time.d.ts +2 -0
- package/dist/read-property.d.ts +2 -0
- package/dist/routes.d.ts +60 -0
- package/dist/running-browser.d.ts +39 -0
- package/dist/scroll-collect.d.ts +36 -0
- package/dist/serial-emitter.d.ts +5 -0
- package/dist/shared-connections.d.ts +11 -0
- package/dist/snapshot-diff.d.ts +57 -0
- package/dist/text-matching.d.ts +21 -0
- package/dist/trace.d.ts +59 -0
- package/dist/url-match.d.ts +7 -0
- package/dist/viewport.d.ts +26 -0
- package/dist/ws.d.ts +62 -0
- package/package.json +47 -26
- package/presets/agent-events/SKILL.md +1 -1
- package/presets/captcha/SKILL.md +1 -3
- package/presets/chrome/SKILL.md +2 -2
- package/presets/cloak-bridge/SKILL.md +11 -11
- package/presets/network/SKILL.md +15 -13
- package/presets/visual-browse/SKILL.md +14 -10
- package/skills/omowright/SKILL.md +83 -49
- package/skills/omowright/references/aside.md +50 -0
- package/skills/omowright/references/browserskill.md +29 -32
- package/skills/omowright/references/ego.md +24 -0
- package/skills/omowright/references/eval-kernel.md +44 -23
- package/skills/omowright/references/frames-layers-human.md +16 -7
- package/skills/omowright/references/quickstart.md +7 -4
- package/skills/omowright/references/stealth.md +11 -8
- package/src/agent-tabs.js +0 -179
- package/src/aria-hidden.js +0 -47
- package/src/bridge-schemas.js +0 -44
- package/src/bridge-transport.js +0 -83
- package/src/browser-context.js +0 -105
- package/src/browser-process.js +0 -127
- package/src/bsk/browser-signals.js +0 -90
- package/src/bsk/browsers.js +0 -114
- package/src/bsk/connect.js +0 -75
- package/src/bsk/daemon-info.js +0 -100
- package/src/bsk/external-extension.js +0 -110
- package/src/bsk/identify-browser.js +0 -88
- package/src/bsk/install-cli.js +0 -81
- package/src/bsk/ipc-client.js +0 -236
- package/src/bsk/onboard.js +0 -140
- package/src/bsk/screenshot.js +0 -49
- package/src/bsk/session.js +0 -131
- package/src/bsk/snapshot.js +0 -56
- package/src/bsk/targets.js +0 -25
- package/src/captcha-wait.js +0 -79
- package/src/captcha.js +0 -142
- package/src/cdp-errors.js +0 -23
- package/src/cdp-methods.js +0 -69
- package/src/chrome-profile.js +0 -176
- package/src/chrome.js +0 -194
- package/src/cloak-profile.js +0 -266
- package/src/connection.js +0 -234
- package/src/console-events.js +0 -12
- package/src/cookies.js +0 -39
- package/src/core.js +0 -1702
- package/src/cua.js +0 -74
- package/src/dialog-policy.js +0 -80
- package/src/emulate.js +0 -127
- package/src/events.js +0 -111
- package/src/frames-snapshot.js +0 -138
- package/src/har.js +0 -103
- package/src/human-handoff.js +0 -124
- package/src/injected.js +0 -3
- package/src/instance-lock.js +0 -74
- package/src/instances.js +0 -490
- package/src/internal-capability.js +0 -1
- package/src/launch-endpoint.js +0 -185
- package/src/layers.js +0 -138
- package/src/llm.js +0 -201
- package/src/lock-backend-win32.js +0 -54
- package/src/lock-backend.js +0 -81
- package/src/native-host-win32.js +0 -201
- package/src/network-events.js +0 -223
- package/src/network-snoop.js +0 -229
- package/src/nul-frames.js +0 -28
- package/src/open-shadow-query.js +0 -101
- package/src/owner-only.js +0 -196
- package/src/page-bundle.js +0 -1478
- package/src/page-events.js +0 -45
- package/src/page-routes.js +0 -94
- package/src/page-setup.js +0 -239
- package/src/pipe.js +0 -418
- package/src/process-start-time.js +0 -64
- package/src/routes.js +0 -256
- package/src/running-browser.js +0 -85
- package/src/scroll-collect.js +0 -73
- package/src/serial-emitter.js +0 -17
- package/src/shared-connections.js +0 -285
- package/src/snapshot-diff.js +0 -75
- package/src/text-matching.js +0 -101
- package/src/trace.js +0 -183
- package/src/url-match.js +0 -148
- package/src/viewport.js +0 -12
package/package.json
CHANGED
|
@@ -1,63 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omowright",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "0.3.1",
|
|
5
4
|
"description": "OmOWright browser automation for standard Chromium CDP endpoints.",
|
|
6
|
-
"license": "MIT",
|
|
7
5
|
"keywords": [
|
|
6
|
+
"accessibility-snapshot",
|
|
7
|
+
"ai-agent",
|
|
8
8
|
"browser-automation",
|
|
9
|
+
"bun",
|
|
9
10
|
"cdp",
|
|
10
11
|
"chrome-devtools-protocol",
|
|
11
12
|
"chromium",
|
|
12
|
-
"
|
|
13
|
-
"accessibility-snapshot",
|
|
14
|
-
"llm",
|
|
15
|
-
"bun"
|
|
13
|
+
"llm"
|
|
16
14
|
],
|
|
17
15
|
"homepage": "https://github.com/code-yeongyu/omowright#readme",
|
|
18
16
|
"bugs": {
|
|
19
17
|
"url": "https://github.com/code-yeongyu/omowright/issues"
|
|
20
18
|
},
|
|
19
|
+
"license": "MIT",
|
|
21
20
|
"repository": {
|
|
22
21
|
"type": "git",
|
|
23
22
|
"url": "git+https://github.com/code-yeongyu/omowright.git"
|
|
24
23
|
},
|
|
25
|
-
"engines": {
|
|
26
|
-
"node": ">=22",
|
|
27
|
-
"bun": ">=1.4"
|
|
28
|
-
},
|
|
29
24
|
"bin": {
|
|
30
|
-
"omowright-cloak": "bin/omowright-cloak.
|
|
31
|
-
},
|
|
32
|
-
"exports": {
|
|
33
|
-
".": "./src/index.js"
|
|
25
|
+
"omowright-cloak": "./dist/bin/omowright-cloak.js"
|
|
34
26
|
},
|
|
35
27
|
"files": [
|
|
36
|
-
"
|
|
37
|
-
"bin/",
|
|
28
|
+
"dist/",
|
|
38
29
|
"skills/",
|
|
39
30
|
"presets/",
|
|
40
31
|
"README.md",
|
|
41
32
|
"LICENSE",
|
|
42
33
|
"TOOLS.md"
|
|
43
34
|
],
|
|
35
|
+
"type": "module",
|
|
36
|
+
"exports": {
|
|
37
|
+
".": {
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"import": "./dist/index.js",
|
|
40
|
+
"default": "./dist/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./package.json": "./package.json"
|
|
43
|
+
},
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public",
|
|
46
46
|
"provenance": true
|
|
47
47
|
},
|
|
48
48
|
"scripts": {
|
|
49
|
-
"
|
|
50
|
-
"test": "bun
|
|
51
|
-
"test:
|
|
52
|
-
"
|
|
53
|
-
"
|
|
49
|
+
"test": "bun test",
|
|
50
|
+
"test:node": "bun scripts/node-test.ts",
|
|
51
|
+
"test:cloak-profile": "bun test test/cloak-profile.test.ts test/cloak-profile.integration.test.ts",
|
|
52
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
53
|
+
"typecheck:control": "bun scripts/typecheck-control.ts",
|
|
54
|
+
"check": "bun run typecheck:control && bun run typecheck && bun run lint && bun run fmt:check",
|
|
55
|
+
"lint": "oxlint --deny-warnings src bin bridge test scripts",
|
|
56
|
+
"lint:fix": "oxlint --fix src bin bridge test scripts",
|
|
57
|
+
"fmt": "oxfmt --write src bin bridge test scripts",
|
|
58
|
+
"fmt:check": "oxfmt --check src bin bridge test scripts",
|
|
59
|
+
"format": "bun run fmt",
|
|
60
|
+
"format:check": "bun run fmt:check",
|
|
61
|
+
"verify": "bun run check",
|
|
62
|
+
"build": "bun build.ts",
|
|
63
|
+
"build:extension": "bun bridge/build-extension.ts",
|
|
64
|
+
"prepack": "bun run build",
|
|
65
|
+
"preversion": "git diff --quiet HEAD --"
|
|
66
|
+
},
|
|
67
|
+
"dependencies": {
|
|
68
|
+
"ws": "^8.18.3",
|
|
69
|
+
"zod": "^4.6.6"
|
|
54
70
|
},
|
|
55
71
|
"devDependencies": {
|
|
72
|
+
"@types/bun": "1.4.4",
|
|
56
73
|
"acorn": "8.15.0",
|
|
57
|
-
"gpt-tokenizer": "4.1.0"
|
|
74
|
+
"gpt-tokenizer": "4.1.0",
|
|
75
|
+
"oxfmt": "^0.77.0",
|
|
76
|
+
"oxlint": "^1.92.0",
|
|
77
|
+
"typescript": "^7.0.2",
|
|
78
|
+
"typescript-5": "npm:typescript@5.9.3"
|
|
58
79
|
},
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
80
|
+
"engines": {
|
|
81
|
+
"bun": ">=1.4",
|
|
82
|
+
"node": ">=22"
|
|
62
83
|
}
|
|
63
84
|
}
|
|
@@ -30,7 +30,7 @@ event. Waits are bounded; predicates may be async:
|
|
|
30
30
|
```js
|
|
31
31
|
const opened = events.waitForEvent("popupOpened", {
|
|
32
32
|
timeout: 30_000,
|
|
33
|
-
predicate: tab => tab.openerTargetId === mainTargetId,
|
|
33
|
+
predicate: (tab) => tab.openerTargetId === mainTargetId,
|
|
34
34
|
});
|
|
35
35
|
await mainPage.evaluate("window.open('https://example.com')");
|
|
36
36
|
const popup = await opened;
|
package/presets/captcha/SKILL.md
CHANGED
|
@@ -45,9 +45,7 @@ await captcha.click(bounds, {
|
|
|
45
45
|
});
|
|
46
46
|
const result = await captcha.waitFor({
|
|
47
47
|
// Replace with your application's authoritative acceptance condition.
|
|
48
|
-
until: page => page.evaluate(
|
|
49
|
-
`document.querySelector("#application-status")?.dataset.accepted === "true"`
|
|
50
|
-
),
|
|
48
|
+
until: (page) => page.evaluate(`document.querySelector("#application-status")?.dataset.accepted === "true"`),
|
|
51
49
|
timeoutMs: 10000,
|
|
52
50
|
pollMs: 100,
|
|
53
51
|
});
|
package/presets/chrome/SKILL.md
CHANGED
|
@@ -12,8 +12,8 @@ CDP and the browser's own profile files — no extension required.
|
|
|
12
12
|
import { createChromeApi } from "omowright";
|
|
13
13
|
|
|
14
14
|
const chrome = createChromeApi(connection, {
|
|
15
|
-
profilePath: "/path/to/user-data-dir",
|
|
16
|
-
downloadDir: "/path/to/downloads",
|
|
15
|
+
profilePath: "/path/to/user-data-dir", // enables bookmarks/history/topSites/downloads.search
|
|
16
|
+
downloadDir: "/path/to/downloads", // optional, defaults to a temp dir
|
|
17
17
|
});
|
|
18
18
|
```
|
|
19
19
|
|
|
@@ -25,17 +25,17 @@ authorization.
|
|
|
25
25
|
|
|
26
26
|
## Support matrix
|
|
27
27
|
|
|
28
|
-
| API
|
|
29
|
-
|
|
30
|
-
| bookmarks.create/move/remove
|
|
31
|
-
| history.deleteUrl/deleteRange
|
|
32
|
-
| tabGroups.update
|
|
33
|
-
| debugger.attach/detach
|
|
34
|
-
| notifications, tabGroups, tabs, windows events | Forwarded without replay
|
|
35
|
-
| bookmarks.update/removeTree
|
|
36
|
-
| history.addUrl
|
|
37
|
-
| downloads.pause/resume/cancel/erase
|
|
38
|
-
| standalone reads and downloads.download
|
|
28
|
+
| API | Bridge behavior |
|
|
29
|
+
| ---------------------------------------------- | ---------------------------------------------------- |
|
|
30
|
+
| bookmarks.create/move/remove | Supported only when negotiated |
|
|
31
|
+
| history.deleteUrl/deleteRange | Supported only when negotiated |
|
|
32
|
+
| tabGroups.update | Supported only when negotiated |
|
|
33
|
+
| debugger.attach/detach | Supported only when negotiated, numeric tab IDs only |
|
|
34
|
+
| notifications, tabGroups, tabs, windows events | Forwarded without replay |
|
|
35
|
+
| bookmarks.update/removeTree | Unsupported |
|
|
36
|
+
| history.addUrl | Unsupported |
|
|
37
|
+
| downloads.pause/resume/cancel/erase | Unsupported |
|
|
38
|
+
| standalone reads and downloads.download | Existing CDP/profile behavior |
|
|
39
39
|
|
|
40
40
|
**NEVER RETRY A MUTATION AFTER DISCONNECT — COMPLETION IS INDETERMINATE.**
|
|
41
41
|
Subscribe to events before triggering actions. CloakBrowser native-host
|
package/presets/network/SKILL.md
CHANGED
|
@@ -10,8 +10,7 @@ costs nothing and pages can't see it. All four tools come from the package
|
|
|
10
10
|
entrypoint:
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
|
-
const { createNetworkSnoop, collectWhileScrolling, createTrace, createRoutes } =
|
|
14
|
-
await import("omowright");
|
|
13
|
+
const { createNetworkSnoop, collectWhileScrolling, createTrace, createRoutes } = await import("omowright");
|
|
15
14
|
```
|
|
16
15
|
|
|
17
16
|
## Snoop before you scrape
|
|
@@ -23,8 +22,8 @@ truncated labels. Snapshot to find and click; snoop to read.
|
|
|
23
22
|
```js
|
|
24
23
|
const snoop = createNetworkSnoop(page, { match: { url: /\/api\//, mimeType: "json" } }); // strings match as substrings
|
|
25
24
|
await page.goto("https://example.com/search?q=widgets");
|
|
26
|
-
const results = snoop.popJson();
|
|
27
|
-
console.log(snoop.summary({ max: 20 }));
|
|
25
|
+
const results = snoop.popJson(); // parsed bodies, buffer drained
|
|
26
|
+
console.log(snoop.summary({ max: 20 })); // "GET 200 application/json 8123B https://..."
|
|
28
27
|
snoop.dispose();
|
|
29
28
|
```
|
|
30
29
|
|
|
@@ -40,7 +39,7 @@ you need instead:
|
|
|
40
39
|
```js
|
|
41
40
|
const saved = snoop.waitFor({ url: "/api/cart", method: "POST" }, { timeoutMs: 10000 });
|
|
42
41
|
await page.locator("e7").click();
|
|
43
|
-
const entry = await saved;
|
|
42
|
+
const entry = await saved; // { status, body, ... }
|
|
44
43
|
if (entry.status !== 200) throw new Error(`cart save failed: ${entry.status} ${entry.statusText}`);
|
|
45
44
|
```
|
|
46
45
|
|
|
@@ -58,13 +57,13 @@ const items = [];
|
|
|
58
57
|
const gen = collectWhileScrolling(page, snoop, {
|
|
59
58
|
minItems: 200,
|
|
60
59
|
maxScrolls: 15,
|
|
61
|
-
extract: json => json.items ?? [],
|
|
62
|
-
scroll: "wheel",
|
|
60
|
+
extract: (json) => json.items ?? [],
|
|
61
|
+
scroll: "wheel", // "end" jumps to the bottom instead
|
|
63
62
|
settleMs: 800,
|
|
64
63
|
});
|
|
65
64
|
let step;
|
|
66
65
|
while (!(step = await gen.next()).done) items.push(step.value);
|
|
67
|
-
step.value;
|
|
66
|
+
step.value; // { rounds, total, stoppedBecause }
|
|
68
67
|
```
|
|
69
68
|
|
|
70
69
|
`for await (const item of gen)` works too when you don't need the return
|
|
@@ -85,7 +84,7 @@ await trace.step("apply coupon", async () => {
|
|
|
85
84
|
await page.locator("e4").click();
|
|
86
85
|
});
|
|
87
86
|
trace.mark("expected total", { total: "90.00" });
|
|
88
|
-
const summary = await trace.stop();
|
|
87
|
+
const summary = await trace.stop(); // { steps, events, network, startedAt, endedAt, url }
|
|
89
88
|
```
|
|
90
89
|
|
|
91
90
|
What lands in `dir`:
|
|
@@ -110,11 +109,14 @@ failure. The recorder rides the existing network and console paths.
|
|
|
110
109
|
const routes = createRoutes(page);
|
|
111
110
|
await routes.route("*/analytics/*", ({ abort }) => abort("BlockedByClient"));
|
|
112
111
|
await routes.route(/\/api\/flags$/, ({ fulfill }) =>
|
|
113
|
-
fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ beta: true }) })
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ beta: true }) }),
|
|
113
|
+
);
|
|
114
|
+
await routes.route(
|
|
115
|
+
({ method }) => method === "POST",
|
|
116
|
+
({ request, continue: go }) => go({ headers: { ...request.headers, "x-test-run": "1" } }),
|
|
117
|
+
);
|
|
116
118
|
// ... drive the page ...
|
|
117
|
-
await routes.dispose();
|
|
119
|
+
await routes.dispose(); // Fetch.disable
|
|
118
120
|
```
|
|
119
121
|
|
|
120
122
|
Glob strings use `*` and `?`; a string without either is a substring match. A
|
|
@@ -14,13 +14,13 @@ to reach.
|
|
|
14
14
|
**TWO IDENTICAL FAILURES ON THE SAME TARGET MEAN CLIMB, NOT RETRY.** The failure
|
|
15
15
|
itself selects the next rung — never pause to ask which one.
|
|
16
16
|
|
|
17
|
-
| Rung
|
|
18
|
-
|
|
19
|
-
| 1. `page.snapshot()` + `page.locator(ref)` | Everything with a usable ref
|
|
20
|
-
| 2. `createCua(page)` coordinates
|
|
21
|
-
| 3. Pin the viewport, then retry rung 2
|
|
22
|
-
| 4. `createCaptcha(page)`
|
|
23
|
-
| 5. Environment diagnosis
|
|
17
|
+
| Rung | Use | Advance when |
|
|
18
|
+
| ------------------------------------------ | ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
|
|
19
|
+
| 1. `page.snapshot()` + `page.locator(ref)` | Everything with a usable ref | Ref is absent, stale, obscured, or the click lands on the wrong node twice |
|
|
20
|
+
| 2. `createCua(page)` coordinates | Canvas, extension popups, custom controls, drag surfaces | The click misses, or the screenshot and the coordinates disagree |
|
|
21
|
+
| 3. Pin the viewport, then retry rung 2 | Coordinate drift: window resized, DPI scaled, or the tab was created at a different size | Coordinates land correctly but the widget still refuses input |
|
|
22
|
+
| 4. `createCaptcha(page)` | A challenge widget is what blocks progress | The widget is solved but the flow still stalls |
|
|
23
|
+
| 5. Environment diagnosis | Browser-level failure (entitlements, extension service worker, FIDO) | Logs name a cause outside the page |
|
|
24
24
|
|
|
25
25
|
**RUNG 5 ENDS IN A WRITTEN DIAGNOSIS, NEVER A CODE CHANGE.** When the browser log
|
|
26
26
|
names the cause (service-worker failure, missing entitlement, FIDO unavailable),
|
|
@@ -37,11 +37,15 @@ repeats the miss. Pin both to one box:
|
|
|
37
37
|
|
|
38
38
|
```js
|
|
39
39
|
await page._sendToTarget("Emulation.setDeviceMetricsOverride", {
|
|
40
|
-
width: 1440,
|
|
41
|
-
|
|
40
|
+
width: 1440,
|
|
41
|
+
height: 900,
|
|
42
|
+
deviceScaleFactor: 1,
|
|
43
|
+
mobile: false,
|
|
44
|
+
screenWidth: 1440,
|
|
45
|
+
screenHeight: 900,
|
|
42
46
|
viewport: { x: 0, y: 0, width: 1440, height: 900, scale: 1 },
|
|
43
47
|
});
|
|
44
|
-
const size = await page.refreshViewportSize();
|
|
48
|
+
const size = await page.refreshViewportSize(); // -> { width: 1440, height: 900 }
|
|
45
49
|
```
|
|
46
50
|
|
|
47
51
|
Pin every page you act on, including tabs you did not open, then take a fresh
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: omowright
|
|
3
|
-
description: "The default code-driven browser path for interactive browsing work: drives any browser from code with token-efficient a11y snapshots (
|
|
3
|
+
description: "The default code-driven browser path for interactive browsing work: drives any browser from code with token-efficient a11y snapshots (compactSnapshot drops the refs map), ref-based clicks, coordinate control (CUA), viewport pinning, CAPTCHA input helpers for reCAPTCHA, Turnstile, hCaptcha, slider and text OCR, with a human fallback (not a solver), Chrome MV3 APIs (tabs/bookmarks/history/downloads/topSites), network snoop (read API JSON instead of DOM), flight-recorder trace (jsonl + HAR + screenshots), OOPIF-aware snapshots, dialog policy, human handoff for login/OTP, device emulation, request routes, and one connectBrowser() entry that picks the engine in priority order: the user's agent browser (Aside, Ego Lite), then the user's own browser through BrowserSkill, then the owned stealth CloakBrowser with zero exposed CDP ports; each engine has its own setup check (asideOnboard, bskOnboard). MUST USE for interactive browser work: scraping, blocked/WAF/JS-rendered pages, logins, the user's logged-in sites and open tabs, extension popups, form filling, screenshots, web QA, CAPTCHAs. The ulw-research browsing lane runs on ultimate-browsing, not this skill."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# OmOWright
|
|
@@ -9,32 +9,49 @@ Browser automation as a code library. Install it with
|
|
|
9
9
|
`bun add github:code-yeongyu/omowright` (or import it by the path of a local
|
|
10
10
|
checkout). Bun >= 1.4 recommended, Node >= 22 supported.
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Pick the engine with connectBrowser
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
| **Owned** (default) | scraping, WAF/bot-scored targets, headless, anything that must not touch the user's profile | `connectPipe` / `connectCloakProfile` — no CLI, no daemon, no open CDP port |
|
|
17
|
-
| **Attached** | the task needs the user's logged-in sessions, cookies, or open tabs | `connectBrowserSkill` — stock BrowserSkill daemon + extension; `references/browserskill.md` |
|
|
14
|
+
**START EVERY BROWSER TASK WITH `connectBrowser()`.** It tries the engines in
|
|
15
|
+
this order and returns the first that connects:
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
| Order | Engine | Handle | Read |
|
|
18
|
+
| ----- | ---------------------------------------------------------------------------------------------- | ------------------------------------------ | ---------------------------- |
|
|
19
|
+
| 1 | **Aside**: the user's Aside browser, signed in | `AsideSession` (`run`, `open`, `snapshot`) | `references/aside.md` |
|
|
20
|
+
| 2 | **Ego Lite**: an agent task space in the user's Ego browser (only inside `ego-browser nodejs`) | `BrowserConnection` (full Page API) | `references/ego.md` |
|
|
21
|
+
| 3 | **BrowserSkill**: the user's own Chrome/Edge/Brave via extension | `BskSession` | `references/browserskill.md` |
|
|
22
|
+
| 4 | **CloakBrowser**: owned stealth browser, no user profile | `BrowserConnection` | `references/stealth.md` |
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
```js
|
|
25
|
+
const { connectBrowser } = await import("omowright");
|
|
26
|
+
// the task needs the user's sessions: CloakBrowser may not stand in
|
|
27
|
+
const { engine, handle, attempts } = await connectBrowser({ allow: ["aside", "ego", "bsk"] });
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
`attempts` has one entry per engine in order: `ok`, `ms`, and `verified` (the
|
|
31
|
+
check that proved it attached) or the `reason` it did not (often one step only
|
|
32
|
+
the user can take, such as `aside login`); engines after the primary read
|
|
33
|
+
`not tried` when allowed, or `not allowed by the caller` when excluded from `allow`.
|
|
34
|
+
`crossCheck: true` also attaches the other allowed engines, returned
|
|
35
|
+
in `crossCheck` and listed in `attached`. Each is a SECOND BROWSER (a BrowserSkill
|
|
36
|
+
tab has no CDP endpoint): compare results through it, act through `handle`, and
|
|
37
|
+
end with `await result.closeAll()`, which closes every handle the call opened. When a
|
|
38
|
+
higher engine failed for a reason the user can fix, tell them that step along
|
|
39
|
+
with the engine you used. **SET `allow` FOR EVERY TASK**: without `"cloak"`
|
|
40
|
+
when it needs the user's sessions (the default includes it), with only
|
|
41
|
+
`["cloak"]` for scraping or WAF targets. `prefer` tries one engine first; per-engine options go
|
|
42
|
+
under its name (`{ cloak: { profileDir } }`). The handle type follows
|
|
43
|
+
`engine`, so branch on it.
|
|
44
|
+
|
|
45
|
+
## Core loop (Page API: Ego Lite and CloakBrowser)
|
|
25
46
|
|
|
26
47
|
```js
|
|
27
|
-
const {
|
|
28
|
-
const browser = await
|
|
29
|
-
browserPath: "<CloakBrowser binary>", // DEFAULT engine
|
|
30
|
-
browserArgs: ["--no-first-run", `--user-data-dir=${profileDir}`],
|
|
31
|
-
storageRoot: profileDir,
|
|
32
|
-
});
|
|
48
|
+
const { connectBrowser, compactSnapshot } = await import("omowright");
|
|
49
|
+
const { engine, handle: browser } = await connectBrowser({ allow: ["ego", "cloak"] });
|
|
33
50
|
const page = await browser.newTab("https://example.com");
|
|
34
|
-
const tree = compactSnapshot(await page.snapshot());
|
|
35
|
-
await page.locator("e1").click();
|
|
51
|
+
const tree = compactSnapshot(await page.snapshot()); // ALWAYS compact before reading
|
|
52
|
+
await page.locator("e1").click(); // refs come from the snapshot
|
|
36
53
|
const changes = compactSnapshot(await page.snapshot({ diff: true }));
|
|
37
|
-
await browser.close();
|
|
54
|
+
await browser.close(); // Ego: the user's browser stays open
|
|
38
55
|
```
|
|
39
56
|
|
|
40
57
|
Snapshot once, act on refs, then re-snapshot with `{ diff: true }` after each batch
|
|
@@ -48,12 +65,21 @@ changed snapshot options, unreferenced text changes, or a delta larger than the
|
|
|
48
65
|
tree). Read it as the new baseline. Baselines belong to each page; `diff: false`
|
|
49
66
|
returns the ordinary full snapshot and replaces its baseline.
|
|
50
67
|
|
|
51
|
-
|
|
68
|
+
To look for one thing on a long page, search instead of reading the whole tree:
|
|
69
|
+
`page.snapshot({ find: "Checkout" })` (case-insensitive text, or a RegExp matched per
|
|
70
|
+
line; its g and y flags are ignored) returns only
|
|
71
|
+
the matching lines plus `context` lines around each (default 2, up to 10), `...` between
|
|
72
|
+
gaps, `refs` for just those lines and `find: { query, matches }`. Zero matches is an
|
|
73
|
+
empty tree, not an error. A search does not move the diff baseline, and `find` cannot
|
|
74
|
+
be combined with `diff`. `maxChars` still caps the whole captured tree before the
|
|
75
|
+
search runs, so leave it off when searching a large page.
|
|
76
|
+
|
|
77
|
+
## Owned engine: CloakBrowser
|
|
52
78
|
|
|
53
|
-
|
|
79
|
+
When omowright owns the browser, use the CloakBrowser binary, not a plain headless shell: most real
|
|
54
80
|
targets sit behind WAFs or bot scoring, and CloakBrowser's source-level
|
|
55
81
|
fingerprint patches (Cloudflare Turnstile, FingerprintJS, BrowserScan) make it
|
|
56
|
-
the safe
|
|
82
|
+
the safe choice. Plain headless shell is the speed fallback for trivially open
|
|
57
83
|
pages: any Chrome/Chromium or
|
|
58
84
|
`~/Library/Caches/ms-playwright/chromium_headless_shell-*/.../chrome-headless-shell`.
|
|
59
85
|
|
|
@@ -73,14 +99,14 @@ HANGS during early init — attach with `connect()` instead. Full pattern:
|
|
|
73
99
|
|
|
74
100
|
A blocked page is a rung to climb, not a reason to stop and report.
|
|
75
101
|
|
|
76
|
-
| Rung
|
|
77
|
-
|
|
78
|
-
| 1. `snapshot()` + `locator(ref)`
|
|
79
|
-
| 1b. `snapshotWithLayers` / `describeLayers` | A blocking overlay explains two identical misses; dismiss it first | `@layers none`, or the overlay is gone and the click still misses
|
|
80
|
-
| 2. `createCua(page)` coordinates
|
|
81
|
-
| 3. Pin the viewport, retry rung 2
|
|
82
|
-
| 4. `createCaptcha(page)`
|
|
83
|
-
| 5. Read the browser log
|
|
102
|
+
| Rung | Use | Advance when |
|
|
103
|
+
| ------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------- |
|
|
104
|
+
| 1. `snapshot()` + `locator(ref)` | Anything with a usable ref | Ref absent, stale, obscured, or the click hits the wrong node twice |
|
|
105
|
+
| 1b. `snapshotWithLayers` / `describeLayers` | A blocking overlay explains two identical misses; dismiss it first | `@layers none`, or the overlay is gone and the click still misses |
|
|
106
|
+
| 2. `createCua(page)` coordinates | Canvas, extension popups, custom controls | Click misses, or screenshot and coordinates disagree |
|
|
107
|
+
| 3. Pin the viewport, retry rung 2 | Coordinate drift after a resize, DPI scale, or foreign tab | Coordinates land right but the widget still refuses input |
|
|
108
|
+
| 4. `createCaptcha(page)` | A challenge widget is the blocker | Widget solved, flow still stalls |
|
|
109
|
+
| 5. Read the browser log | Browser-level failure | The log names a cause outside the page |
|
|
84
110
|
|
|
85
111
|
**TWO IDENTICAL FAILURES SELECT THE NEXT RUNG — A THIRD IDENTICAL ATTEMPT IS A
|
|
86
112
|
DEFECT.** Verify after every action batch: `snapshot({ diff: true })` for DOM state,
|
|
@@ -99,11 +125,15 @@ disagree, every coordinate is off by a constant and retrying repeats the miss:
|
|
|
99
125
|
|
|
100
126
|
```js
|
|
101
127
|
await page._sendToTarget("Emulation.setDeviceMetricsOverride", {
|
|
102
|
-
width: 1440,
|
|
103
|
-
|
|
128
|
+
width: 1440,
|
|
129
|
+
height: 900,
|
|
130
|
+
deviceScaleFactor: 1,
|
|
131
|
+
mobile: false,
|
|
132
|
+
screenWidth: 1440,
|
|
133
|
+
screenHeight: 900,
|
|
104
134
|
viewport: { x: 0, y: 0, width: 1440, height: 900, scale: 1 },
|
|
105
135
|
});
|
|
106
|
-
await page.refreshViewportSize();
|
|
136
|
+
await page.refreshViewportSize(); // -> { width: 1440, height: 900 }
|
|
107
137
|
```
|
|
108
138
|
|
|
109
139
|
Pin every page you act on, including tabs you did not open, then take a fresh
|
|
@@ -111,18 +141,21 @@ screenshot — coordinates read off an unpinned screenshot are stale.
|
|
|
111
141
|
|
|
112
142
|
## Route by task
|
|
113
143
|
|
|
114
|
-
| Task
|
|
115
|
-
|
|
116
|
-
| The user's
|
|
117
|
-
|
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
|
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
144
|
+
| Task | Read |
|
|
145
|
+
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
146
|
+
| The user's Aside browser: REPL session, setup, failure codes | `references/aside.md` |
|
|
147
|
+
| The user's own signed-in browser and tabs, BrowserSkill sessions, trace-free `bskSnapshot`, one-click extension onboarding | `references/browserskill.md` |
|
|
148
|
+
| Visual browsing, coordinate UI, viewport pinning, extension popups | `presets/visual-browse/SKILL.md` — consider delegating, below |
|
|
149
|
+
| CAPTCHA (checkbox, slider, text OCR, image grid) | `presets/captcha/SKILL.md` — consider delegating, below |
|
|
150
|
+
| WAF/Cloudflare/bot-detection pages, CloakBrowser, cookie rules | `references/stealth.md` |
|
|
151
|
+
| First use, page API, snapshot options, locator rules | `references/quickstart.md`; dialogs and readiness in `TOOLS.md` |
|
|
152
|
+
| Driving a browser inside `eval` cells, kernel persistence, parallel lanes | `references/eval-kernel.md` |
|
|
153
|
+
| Tabs/windows/bookmarks/history/downloads/topSites (Chrome MV3) | `presets/chrome/SKILL.md` |
|
|
154
|
+
| Tab, popup and download lifecycle as push events, manager-owned background tabs (no polling) | `presets/agent-events/SKILL.md` |
|
|
155
|
+
| A user-driven CloakBrowser profile that needs MV3 Chrome writes/events through the native-messaging bridge | `presets/cloak-bridge/SKILL.md` |
|
|
156
|
+
| API JSON instead of DOM scraping, wait for a request, infinite scroll, QA flight trace (jsonl/HAR), request routes | `presets/network/SKILL.md` |
|
|
157
|
+
| Cross-origin iframes and shadow DOM, overlays that swallow clicks, login/OTP handoff to a human, device emulation | `references/frames-layers-human.md` |
|
|
158
|
+
| Reading an item from the 1Password web vault (tab-scoped session, sign-in check, secret handling) | `references/1password.md` |
|
|
126
159
|
|
|
127
160
|
Preset and `TOOLS.md` paths are relative to the package root.
|
|
128
161
|
|
|
@@ -134,7 +167,8 @@ Preset and `TOOLS.md` paths are relative to the package root.
|
|
|
134
167
|
cookies. Detail in `references/stealth.md`. Cookie reuse is fine for ordinary
|
|
135
168
|
sessions (Grafana, internal tools).
|
|
136
169
|
- **Always `compactSnapshot()`** before sending a snapshot to a model — the refs
|
|
137
|
-
map
|
|
170
|
+
map resolves in-page, so dropping it is free; it was 7% to 64% of the bytes
|
|
171
|
+
across pages measured on 2026-11-09.
|
|
138
172
|
- **Refs die on every new snapshot.** Pass `page.locator("e1")` straight from the
|
|
139
173
|
latest snapshot; never reuse a ref across snapshots, never put one in CSS.
|
|
140
174
|
- **Refs stay page-level.** Child-frame refs look like `f1e3` and still go to
|
|
@@ -153,7 +187,7 @@ Preset and `TOOLS.md` paths are relative to the package root.
|
|
|
153
187
|
|
|
154
188
|
## Delegating the pixel loop
|
|
155
189
|
|
|
156
|
-
CAPTCHA
|
|
190
|
+
Working through a CAPTCHA and pixel-level visual browsing are iterative (screenshot, reason,
|
|
157
191
|
act, verify). When that loop would consume your own context, delegate the blocked
|
|
158
192
|
page to a `deep` subagent that loads these references. Drive it yourself when the
|
|
159
193
|
flow is short or the state is already in your hands.
|
|
@@ -168,7 +202,7 @@ task(category: "deep", run_in_background: true, prompt: `
|
|
|
168
202
|
TASK: Get past the CAPTCHA blocking <url> and return the post-solve state.
|
|
169
203
|
1. Read `presets/captcha/SKILL.md`, `presets/visual-browse/SKILL.md` (package
|
|
170
204
|
root), and `references/stealth.md` (this skill).
|
|
171
|
-
2. connectPipe with the CloakBrowser binary
|
|
205
|
+
2. connectPipe with the CloakBrowser binary.
|
|
172
206
|
3. Pin the viewport (setDeviceMetricsOverride 1440x900 + refreshViewportSize)
|
|
173
207
|
before computing any coordinate.
|
|
174
208
|
4. createCaptcha(page) - click(bounds) for checkbox widgets, drag(from, to,
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Aside engine: the user's Aside browser through one `aside repl` session
|
|
2
|
+
|
|
3
|
+
Aside is the first engine `connectBrowser()` tries. It drives the user's own
|
|
4
|
+
Aside browser, signed in as they are, through the Aside CLI's REPL. omowright
|
|
5
|
+
keeps ONE CLI process per session, and `globalThis` state survives between
|
|
6
|
+
calls. `aside repl --help` decides which process: CLIs up to 1.26.916 keep a
|
|
7
|
+
piped `aside repl` (each call is one stdin line, 4-17 ms); CLIs whose help says
|
|
8
|
+
"piped stdin runs as one script" (1.26.1107 on) keep `aside mcp` and run each
|
|
9
|
+
call through its `repl` tool. The help probe has its own 5 s budget, apart from
|
|
10
|
+
the start timeout; if `aside repl --help` does not answer in time, omowright
|
|
11
|
+
uses `aside mcp` when `aside mcp --help` lists a `repl` tool, else the piped
|
|
12
|
+
`aside repl`. Only `aside repl`, `aside mcp`'s `repl` tool, the two `--help` probes,
|
|
13
|
+
`aside --version` and `aside account status` are run, never a prompt or
|
|
14
|
+
`aside exec`, which would hand the task to Aside's own model.
|
|
15
|
+
|
|
16
|
+
## Core loop
|
|
17
|
+
|
|
18
|
+
```js
|
|
19
|
+
const { connectAside } = await import("omowright");
|
|
20
|
+
const aside = await connectAside(); // runs asideOnboard() first
|
|
21
|
+
await aside.open("https://example.com/"); // new tab, becomes `page`
|
|
22
|
+
const { tree } = await aside.snapshot({ find: "checkout" });
|
|
23
|
+
await aside.run('await page.locator("e3").click();');
|
|
24
|
+
const title = await aside.run("return await page.title();");
|
|
25
|
+
await aside.run("await closeTab(page);"); // close tabs you opened
|
|
26
|
+
await aside.close(); // ALWAYS, in finally
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`run(code)` executes Playwright-style JavaScript in Aside's REPL scope (`page`,
|
|
30
|
+
`tabs`, `openTab`, `closeTab`, `snapshot`, `listBrowserTabs`,
|
|
31
|
+
`attachBrowserTab`) and resolves with the JSON value the code returns; return
|
|
32
|
+
plain data, never a handle. `runWithLogs(code)` also returns console output.
|
|
33
|
+
Refs from `snapshot()` are Aside refs: use them only with `page.locator(ref)`
|
|
34
|
+
inside `run()`. There is no raw CDP (`page.context()` is undefined), so the
|
|
35
|
+
omowright Page API, `compactSnapshot` and CUA do not apply; when the task needs
|
|
36
|
+
them, use the next engine.
|
|
37
|
+
|
|
38
|
+
## Setup and failures
|
|
39
|
+
|
|
40
|
+
`asideDoctor()` reads the Aside app (macOS), the CLI and its sign-in without
|
|
41
|
+
changing anything; `asideOnboard()` also installs a missing CLI with Aside's
|
|
42
|
+
official installer. `connectAside()` runs the setup itself and rejects with
|
|
43
|
+
`AsideReplError` code `aside_not_ready`, whose message is the one step only the
|
|
44
|
+
user can take (install the app, or run the printed `aside login` command and
|
|
45
|
+
approve the code in Aside). Relay that step; do not try another engine on the
|
|
46
|
+
user's behalf without saying why.
|
|
47
|
+
|
|
48
|
+
`repl_error` is the page code's own exception and the session stays usable.
|
|
49
|
+
`repl_timeout` closes the session: connect again. `repl_start_timeout` and
|
|
50
|
+
`repl_unsupported_cli` name the CLI version; relay them with `aside --update`.
|