omowright 0.3.0 → 0.3.2
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 +20 -8
- package/TOOLS.md +3 -2
- package/dist/agent-tabs.d.ts +2 -2
- package/dist/bsk/external-extension.d.ts +4 -4
- package/dist/bsk/install-cli.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +508 -197
- package/dist/page-bundle.js +14 -4
- package/package.json +17 -14
- package/skills/omowright/SKILL.md +8 -4
- package/skills/omowright/references/ego.md +2 -2
- package/skills/omowright/references/quickstart.md +5 -2
- package/skills/omowright/references/stealth.md +4 -1
package/README.md
CHANGED
|
@@ -25,7 +25,9 @@ Jun's argument is the whole design:
|
|
|
25
25
|
new vocabulary to teach in the prompt.
|
|
26
26
|
2. **Protect the context window.** Raw DOM and raw CDP are noise. The primary
|
|
27
27
|
read is an accessibility snapshot with refs, and `compactSnapshot()` strips
|
|
28
|
-
the duplicated refs map
|
|
28
|
+
the duplicated refs map. How much that saves depends on the page: on
|
|
29
|
+
2026-11-09 it cut 7% of the bytes on example.com, 56% on a form page and
|
|
30
|
+
64% on Hacker News.
|
|
29
31
|
3. **CDP underneath, never on top.** Every method is a thin wrapper over CDP
|
|
30
32
|
calls. The model writes Playwright; the library speaks the protocol.
|
|
31
33
|
4. **Fall back to pixels.** When the DOM lies (canvas, custom widgets,
|
|
@@ -39,17 +41,27 @@ const browser = await connectPipe({ browserPath: "/path/to/chromium", browserArg
|
|
|
39
41
|
const page = await browser.newTab("https://example.com");
|
|
40
42
|
|
|
41
43
|
console.log(compactSnapshot(await page.snapshot()));
|
|
42
|
-
//
|
|
44
|
+
// Live pages change, so the exact tree drifts; on 2026-11-09 it read:
|
|
43
45
|
// - text: "This domain is for use in documentation examples ..."
|
|
44
|
-
// -
|
|
45
|
-
// - link "Learn more" [ref=e1]
|
|
46
|
+
// - link "Learn more" [ref=e1]
|
|
46
47
|
|
|
47
48
|
await page.locator("e1").click(); // refs come straight from the snapshot
|
|
48
49
|
await browser.close();
|
|
49
50
|
```
|
|
50
51
|
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
On Windows, write `browserPath` with forward slashes (`"C:/Program Files/..."`)
|
|
53
|
+
or as `` String.raw`C:\Program Files\...` ``. In a plain string literal each
|
|
54
|
+
backslash starts an escape: the launch usually fails with ENOENT, and a segment
|
|
55
|
+
such as `\u` or `\x` is a SyntaxError before anything runs. Give every
|
|
56
|
+
browser that runs at the same time its own profile through
|
|
57
|
+
``browserArgs: ["--headless", `--user-data-dir=${dir}`]`` (for example a
|
|
58
|
+
`mkdtemp` directory). On Windows, Chrome otherwise falls back to a shared
|
|
59
|
+
default profile, and a second launch on it exits with code 21.
|
|
60
|
+
|
|
61
|
+
Every `page.snapshot()` returns the whole tree. Pass `{ diff: true }` to get
|
|
62
|
+
only what changed since the previous snapshot; it falls back to the full tree
|
|
63
|
+
with a `reason` when there is no usable baseline or the diff would be larger.
|
|
64
|
+
To look for one thing,
|
|
53
65
|
`page.snapshot({ find: "Checkout" })` returns only the matching lines, with
|
|
54
66
|
their refs and a little context around each.
|
|
55
67
|
|
|
@@ -84,7 +96,7 @@ Reproduce after `bun install` (any Chromium works for `--browser`, or set
|
|
|
84
96
|
`OMOWRIGHT_BENCH_BROWSER`):
|
|
85
97
|
|
|
86
98
|
```bash
|
|
87
|
-
|
|
99
|
+
bun scripts/bench-snapshot-tokens.ts --browser ~/.cache/ms-playwright/chromium_headless_shell-1248/chrome-headless-shell-linux64/chrome-headless-shell --browser-arg=--no-sandbox
|
|
88
100
|
```
|
|
89
101
|
|
|
90
102
|
## Scrolling is a first-class problem
|
|
@@ -279,7 +291,7 @@ bun run test:node # Node test runner, same files
|
|
|
279
291
|
Live tests need a Chromium headless shell. Set `SHELL_BIN` (and
|
|
280
292
|
`CLOAKBROWSER_BIN` for the event-bridge test) to its path, or install one into
|
|
281
293
|
Playwright's cache. CI installs `chrome-headless-shell` with
|
|
282
|
-
`@puppeteer/browsers` and runs both runners on Ubuntu. `test/hygiene.test.
|
|
294
|
+
`@puppeteer/browsers` and runs both runners on Ubuntu. `test/hygiene.test.ts`
|
|
283
295
|
fails the build if a tracked file contains an absolute home path, a personal
|
|
284
296
|
address or a private host.
|
|
285
297
|
|
package/TOOLS.md
CHANGED
|
@@ -52,7 +52,8 @@ running Chromium DevTools endpoint).
|
|
|
52
52
|
look like `- link "Learn more" [ref=e1]`. Options: `maxDepth` (50),
|
|
53
53
|
`maxChars`, `interactive`, `showHidden`, `selector`, `ref`.
|
|
54
54
|
- `compactSnapshot(snapshot)` — returns the raw tree without the refs map
|
|
55
|
-
(refs resolve in-page; the map
|
|
55
|
+
(refs resolve in-page; dropping the map saved 7% to 64% of the bytes across
|
|
56
|
+
pages measured on 2026-11-09). Use before
|
|
56
57
|
sending snapshots to a model.
|
|
57
58
|
- `page.locator(refOrCss)` — `click`, `fill`, `press`, `pressSequentially`,
|
|
58
59
|
`hover`, `check`, `selectOption`, `dragTo`, `setInputFiles`, `textContent`,
|
|
@@ -218,7 +219,7 @@ running Chromium DevTools endpoint).
|
|
|
218
219
|
`SameSite=None` dropped when not secure, name+domain deduped.
|
|
219
220
|
`sanitizeCookies(cookies)` is the pure transform if you need it.
|
|
220
221
|
|
|
221
|
-
Every tool below is exported from `src/index.
|
|
222
|
+
Every tool below is exported from `src/index.ts`, the same import as the core
|
|
222
223
|
loop; the module files next to it are implementation detail.
|
|
223
224
|
|
|
224
225
|
- `connectNamed(name, { browserPath, browserArgs, profileDir, registryRoot?,
|
package/dist/agent-tabs.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface AgentTab {
|
|
|
27
27
|
readonly viewport: ViewportSize;
|
|
28
28
|
readonly close: (options?: CloseAgentTabOptions) => Promise<unknown>;
|
|
29
29
|
}
|
|
30
|
-
/** An owned tab
|
|
30
|
+
/** An owned tab view: its page is null while another adopt() is still attaching it. */
|
|
31
31
|
export interface AgentTabView extends Omit<AgentTab, "page"> {
|
|
32
32
|
readonly page: Page | null;
|
|
33
33
|
}
|
|
@@ -39,7 +39,7 @@ export declare class AgentTabManager {
|
|
|
39
39
|
readonly _optionsKey: string;
|
|
40
40
|
constructor(connection: BrowserConnection, options?: AgentTabManagerOptions);
|
|
41
41
|
create(url?: string, options?: CreateAgentTabOptions): Promise<AgentTab>;
|
|
42
|
-
adopt(targetId: string, options?: AdoptAgentTabOptions): Promise<
|
|
42
|
+
adopt(targetId: string, options?: AdoptAgentTabOptions): Promise<AgentTabView>;
|
|
43
43
|
get(targetId: string | undefined): AgentTabView | null;
|
|
44
44
|
list(): AgentTabView[];
|
|
45
45
|
repin(tabOrTargetId: string | {
|
|
@@ -61,14 +61,14 @@ export declare function isBlocklisted(browser: {
|
|
|
61
61
|
}): boolean;
|
|
62
62
|
export interface RegisterExternalExtensionOptions {
|
|
63
63
|
platform?: string;
|
|
64
|
-
browser
|
|
64
|
+
browser?: ExtensionBrowser;
|
|
65
65
|
writeFile?: WriteFile;
|
|
66
66
|
readFile?: ReadFile;
|
|
67
67
|
runReg?: RunReg;
|
|
68
68
|
}
|
|
69
|
-
export declare function registerExternalExtension({ platform, browser, writeFile, readFile, runReg, }
|
|
70
|
-
export declare function unregisterExternalExtension({ platform, browser, runReg, }
|
|
69
|
+
export declare function registerExternalExtension({ platform, browser, writeFile, readFile, runReg, }?: RegisterExternalExtensionOptions): Promise<ExtensionRegistration>;
|
|
70
|
+
export declare function unregisterExternalExtension({ platform, browser, runReg, }?: {
|
|
71
71
|
platform?: string;
|
|
72
|
-
browser
|
|
72
|
+
browser?: ExtensionBrowser;
|
|
73
73
|
runReg?: RunReg;
|
|
74
74
|
}): Promise<ExtensionRemoval>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export declare const BSK_CLI_VERSION = "0.5.0";
|
|
2
|
+
export declare const BSK_PINNED_MANIFEST_URL = "https://github.com/Tencent/BrowserSkill/releases/download/cli-v0.5.0/version.json";
|
|
1
3
|
export type InstallEnv = Record<string, string | undefined>;
|
|
2
4
|
export interface InstallCommand {
|
|
3
5
|
command: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference path="./ws.d.ts" />
|
|
2
|
+
/*! omowright | MIT License | Copyright (c) 2026 Yeongyu Kim | https://github.com/code-yeongyu/omowright */
|
|
2
3
|
export { connect, BrowserConnection, TabRepository } from "./connection.js";
|
|
3
4
|
export { OMOWRIGHT_PAGE_CDP_METHODS } from "./cdp-methods.js";
|
|
4
5
|
export { CdpCommandTimeoutError, CdpPipeClosedError, CdpSessionCrashedError, CdpSessionDetachedError, connectPipe, PipeCdpClient, } from "./pipe.js";
|