omowright 0.3.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 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, which is about 54% of the bytes on a real page.
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
- // - heading "Example Domain" [level=1]
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
- // - paragraph:
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
- Re-snapshots come back as a unified diff against the previous tree, so a model
52
- reads what changed instead of the whole page again. To look for one thing,
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
- node scripts/bench-snapshot-tokens.mjs --browser ~/.cache/ms-playwright/chromium_headless_shell-1248/chrome-headless-shell-linux64/chrome-headless-shell --browser-arg=--no-sandbox
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.mjs`
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 is ~54% of bytes on real pages). Use before
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.js`, the same import as the core
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?,
@@ -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 as get()/list() report it: its page is null while the tab is still being adopted. */
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<AgentTab>;
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: ExtensionBrowser;
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, }: RegisterExternalExtensionOptions): Promise<ExtensionRegistration>;
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: ExtensionBrowser;
72
+ browser?: ExtensionBrowser;
73
73
  runReg?: RunReg;
74
74
  }): Promise<ExtensionRemoval>;
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";
package/dist/index.js CHANGED
@@ -3843,6 +3843,7 @@ __export(exports_util, {
3843
3843
  required: () => required,
3844
3844
  safeExtend: () => safeExtend,
3845
3845
  shallowClone: () => shallowClone,
3846
+ sizeCaps: () => sizeCaps,
3846
3847
  slugify: () => slugify,
3847
3848
  stringifyPrimitive: () => stringifyPrimitive,
3848
3849
  toZod: () => toZod,
@@ -5164,6 +5165,18 @@ function prefixIssues(path, issues) {
5164
5165
  function unwrapMessage(message) {
5165
5166
  return typeof message === "string" ? message : message?.message;
5166
5167
  }
5168
+ function sizeCaps(defChecks) {
5169
+ const caps = [];
5170
+ for (const ch of defChecks ?? []) {
5171
+ const d = ch._zod.def;
5172
+ if (!/_(length|size)$|_equals$/.test(d.check))
5173
+ break;
5174
+ const max = d.maximum ?? d.length ?? d.size;
5175
+ if (max >= 0)
5176
+ caps.push([max, ch]);
5177
+ }
5178
+ return caps;
5179
+ }
5167
5180
  function attachSchema(issues, start, inst) {
5168
5181
  var _a;
5169
5182
  for (let i = start;i < issues.length; i++) {
@@ -6516,7 +6529,7 @@ ${content.join(`
6516
6529
  var version = {
6517
6530
  major: 4,
6518
6531
  minor: 6,
6519
- patch: 5
6532
+ patch: 7
6520
6533
  };
6521
6534
 
6522
6535
  // node_modules/zod/v4/core/schemas.js
@@ -7265,6 +7278,31 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
7265
7278
  return payload;
7266
7279
  };
7267
7280
  });
7281
+ function capSize(inst, size) {
7282
+ const caps = sizeCaps(inst._zod.def.checks);
7283
+ if (!caps.length)
7284
+ return;
7285
+ const cap = Math.min(...caps.map((c) => c[0]));
7286
+ const parse = inst._zod.parse;
7287
+ inst._zod.parse = (payload, ctx) => {
7288
+ const n = size(payload.value);
7289
+ if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
7290
+ for (const [max, ch] of sizeCaps(inst._zod.def.checks)) {
7291
+ if (n > max && ch._zod.def.when(payload)) {
7292
+ const start = payload.issues.length;
7293
+ ch._zod.check(payload);
7294
+ payload.issues[start].continue = false;
7295
+ attachSchema(payload.issues, start, inst);
7296
+ return payload;
7297
+ }
7298
+ }
7299
+ }
7300
+ return parse(payload, ctx);
7301
+ };
7302
+ }
7303
+ var arraySize = (input) => Array.isArray(input) ? input.length : -1;
7304
+ var mapSize = (input) => input instanceof Map ? input.size : -1;
7305
+ var setSize = (input) => input instanceof Set ? input.size : -1;
7268
7306
  function handleArrayResult(result, final, index) {
7269
7307
  if (result.issues.length) {
7270
7308
  final.issues.push(...prefixIssues(index, result.issues));
@@ -7308,6 +7346,7 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
7308
7346
  }
7309
7347
  return payload;
7310
7348
  };
7349
+ capSize(inst, arraySize);
7311
7350
  });
7312
7351
  function handlePropertyResult(result, final, key, input, optin, optout) {
7313
7352
  const isPresent = key in input;
@@ -8262,6 +8301,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
8262
8301
  return Promise.all(proms).then(() => payload);
8263
8302
  return payload;
8264
8303
  };
8304
+ capSize(inst, mapSize);
8265
8305
  });
8266
8306
  function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
8267
8307
  if (keyResult.issues.length) {
@@ -8328,6 +8368,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
8328
8368
  return Promise.all(proms).then(() => payload);
8329
8369
  return payload;
8330
8370
  };
8371
+ capSize(inst, setSize);
8331
8372
  });
8332
8373
  function handleSetResult(result, final) {
8333
8374
  if (result.issues.length) {
@@ -17709,9 +17750,15 @@ function generateNullableCheck(doc, ctx, schema, accessor, buildsValue = true) {
17709
17750
  doc.write(`}`);
17710
17751
  return outputVar;
17711
17752
  }
17753
+ function generateSizeGate(doc, schema, size) {
17754
+ for (const [max, check] of sizeCaps(schema._zod.def.checks)) {
17755
+ doc.write(`if (${size} > ${numericOperand(max, check._zod.def.check)}) return INVALID;`);
17756
+ }
17757
+ }
17712
17758
  function generateArrayCheck(doc, ctx, schema, accessor, buildsValue = true) {
17713
17759
  const def = schema._zod.def;
17714
17760
  doc.write(`if (!Array.isArray(${accessor})) return INVALID;`);
17761
+ generateSizeGate(doc, schema, `${accessor}.length`);
17715
17762
  const outputVar = buildsValue ? newVar(ctx) : null;
17716
17763
  const iVar = newVar(ctx);
17717
17764
  const elemVar = newVar(ctx);
@@ -18111,6 +18158,7 @@ function literalPropertyKey(ctx, key) {
18111
18158
  function generateMapCheck(doc, ctx, schema, accessor) {
18112
18159
  const def = schema._zod.def;
18113
18160
  doc.write(`if (!(${accessor} instanceof Map)) return INVALID;`);
18161
+ generateSizeGate(doc, schema, `${accessor}.size`);
18114
18162
  const outputVar = newVar(ctx);
18115
18163
  const kVar = newVar(ctx);
18116
18164
  const valVar = newVar(ctx);
@@ -18127,6 +18175,7 @@ function generateMapCheck(doc, ctx, schema, accessor) {
18127
18175
  function generateSetCheck(doc, ctx, schema, accessor) {
18128
18176
  const def = schema._zod.def;
18129
18177
  doc.write(`if (!(${accessor} instanceof Set)) return INVALID;`);
18178
+ generateSizeGate(doc, schema, `${accessor}.size`);
18130
18179
  const outputVar = newVar(ctx);
18131
18180
  const valVar = newVar(ctx);
18132
18181
  doc.write(`const ${outputVar} = new Set();`);
@@ -25927,11 +25976,11 @@ function collectTrackedSessionIds(xn, jn) {
25927
25976
  Vn.add(jn.sessionId);
25928
25977
  return Vn;
25929
25978
  }
25930
- async function waitForNavigationReadiness(page, mode = `interactive`, timeoutMs = ACTION_MAX_WAIT_MS) {
25979
+ async function waitForNavigationReadiness(page, mode = `interactive`, timeoutMs = ACTION_MAX_WAIT_MS, signal) {
25931
25980
  let timer;
25932
25981
  try {
25933
25982
  return await Promise.race([
25934
- waitForNavigationReadinessInner(page, mode, timeoutMs),
25983
+ waitForNavigationReadinessInner(page, mode, timeoutMs, signal),
25935
25984
  new Promise((_, reject) => {
25936
25985
  timer = setTimeout(() => reject(new NavigationReadinessTimeoutError(mode, timeoutMs)), timeoutMs + 1000);
25937
25986
  })
@@ -25970,7 +26019,7 @@ async function waitForNavigationDomQuiet(page, budgetMs) {
25970
26019
  window.addEventListener("load", onLoad, { once: true });
25971
26020
  }), budgetMs);
25972
26021
  }
25973
- async function waitForNavigationReadinessInner(page, mode, timeoutMs) {
26022
+ async function waitForNavigationReadinessInner(page, mode, timeoutMs, signal) {
25974
26023
  if (isPdfViewerUrl(page.url())) {
25975
26024
  await waitForDomReady(page, Math.min(DOM_READY_TIMEOUT_MS, timeoutMs)).catch(() => {});
25976
26025
  return { bodyExists: true, interactiveCount: 0, landmarkCount: 0, textChars: 0, state: "ready" };
@@ -25991,6 +26040,7 @@ async function waitForNavigationReadinessInner(page, mode, timeoutMs) {
25991
26040
  await ensureDomMonitor(page).catch(() => {});
25992
26041
  while (Date.now() < deadline) {
25993
26042
  await sleep$12(PROBE_INTERVAL_MS);
26043
+ signal?.throwIfAborted();
25994
26044
  try {
25995
26045
  if (navigated) {
25996
26046
  navigated = false;
@@ -26006,17 +26056,23 @@ async function waitForNavigationReadinessInner(page, mode, timeoutMs) {
26006
26056
  quietSamples = 0;
26007
26057
  continue;
26008
26058
  }
26009
- if (network.captureTrackedRequests(page.url()).size > 0) {
26059
+ const hasPendingRequests = network.captureTrackedRequests(page.url()).size > 0;
26060
+ if (hasPendingRequests) {
26010
26061
  networkStarted ??= Date.now();
26011
26062
  if (Date.now() - networkStarted < NAVIGATION_NETWORK_BUDGET_MS) {
26012
26063
  quietSamples = 0;
26013
26064
  continue;
26014
26065
  }
26015
26066
  }
26016
- const settleDeadline = Math.min(deadline, (networkStarted ?? Date.now()) + NAVIGATION_NETWORK_BUDGET_MS);
26067
+ const settleDeadline = Math.min(deadline, Date.now() + (hasPendingRequests ? 0 : NAVIGATION_NETWORK_BUDGET_MS));
26017
26068
  await waitForNavigationDomQuiet(page, Math.max(settleDeadline - Date.now(), 0));
26018
26069
  if (navigated)
26019
26070
  continue;
26071
+ if (network.captureTrackedRequests(page.url()).size > 0) {
26072
+ networkStarted ??= Date.now();
26073
+ if (Date.now() - networkStarted < NAVIGATION_NETWORK_BUDGET_MS)
26074
+ continue;
26075
+ }
26020
26076
  if (mode === "interactive")
26021
26077
  return probe;
26022
26078
  const sample = await readDomMonitor(page);
@@ -29453,10 +29509,12 @@ function createOmOPageClass() {
29453
29509
  await networkReady(this);
29454
29510
  const releaseNetwork = [`interactive`, `stable`, `networkidle`].includes(jn.waitUntil ?? `interactive`) ? acquireNetwork(this.cdp, await this.resolveSessionId()) : null;
29455
29511
  const documents = trackDocumentResponses(this, this.frameManager.mainFrameId);
29512
+ const readinessController = new AbortController;
29513
+ let readiness;
29456
29514
  try {
29457
29515
  await releaseNetwork?.ready;
29458
29516
  await documents.ready;
29459
- let Vn = jn.waitUntil ?? `interactive`, qn = await this.resolveSessionId(this.#n), Jn = () => {}, Yn = Vn === `commit` ? null : Vn === `interactive` || Vn === `stable` ? waitForNavigationReadiness(this, Vn, DEFAULT_WAIT_TIMEOUT_MS).then(() => {}) : Vn === `networkidle` ? this.#S(DEFAULT_WAIT_TIMEOUT_MS) : new Promise((xn, jn) => {
29517
+ let Vn = jn.waitUntil ?? `interactive`, qn = await this.resolveSessionId(this.#n), Jn = () => {}, Yn = Vn === `commit` ? null : Vn === `interactive` || Vn === `stable` ? readiness = waitForNavigationReadiness(this, Vn, DEFAULT_WAIT_TIMEOUT_MS, readinessController.signal).then(() => {}) : Vn === `networkidle` ? this.#S(DEFAULT_WAIT_TIMEOUT_MS) : new Promise((xn, jn) => {
29460
29518
  let Yn = false, Zn, Qn = () => {}, ei = (xn) => {
29461
29519
  Yn || (Yn = true, clearTimeout(Zn), Qn(), xn());
29462
29520
  };
@@ -29467,10 +29525,13 @@ function createOmOPageClass() {
29467
29525
  Qn = this.cdp.on(ti, (jn, Vn) => {
29468
29526
  Vn.sessionId === qn && ei(xn);
29469
29527
  }), Jn = () => ei(xn);
29470
- }), Zn = await this.cdp.send(`Page.navigate`, { url: xn }, qn);
29528
+ });
29529
+ Yn?.catch(() => {});
29530
+ const Zn = await this.cdp.send(`Page.navigate`, { url: xn }, qn);
29471
29531
  if (Zn.errorText)
29472
29532
  throw Error(Zn.errorText);
29473
- if (this.#r = xn, Vn === `domcontentloaded` && Yn) {
29533
+ this.#r = (await this.cdp.send(`Page.getFrameTree`, {}, qn)).frameTree.frame.url;
29534
+ if (Vn === `domcontentloaded` && Yn) {
29474
29535
  if (!Zn.loaderId) {
29475
29536
  Jn(), await this.#v(`Timed out waiting for "${Vn}" after goto`);
29476
29537
  return null;
@@ -29486,6 +29547,8 @@ function createOmOPageClass() {
29486
29547
  Yn && await Yn;
29487
29548
  return documents.response(Zn.loaderId);
29488
29549
  } finally {
29550
+ readinessController.abort();
29551
+ await readiness?.catch(() => {});
29489
29552
  documents.dispose(), releaseNetwork?.();
29490
29553
  }
29491
29554
  }
@@ -30321,19 +30384,18 @@ class AgentTabManager {
30321
30384
  if (await this.#isHeadless())
30322
30385
  await this.#connection.cdp.send("Target.activateTarget", { targetId });
30323
30386
  const tab = await this.adopt(targetId, { viewport });
30387
+ if (tab.page === null)
30388
+ throw new TypeError(`Target ${targetId} is still being adopted`);
30324
30389
  if (url !== "about:blank")
30325
30390
  await tab.page.goto(url);
30326
- return tab;
30391
+ return Object.freeze({ ...tab, page: tab.page });
30327
30392
  }
30328
30393
  async adopt(targetId, options = {}) {
30329
30394
  if (this.#disposed)
30330
30395
  throw Error("Agent tab manager is disposed");
30331
30396
  const existing = this.#owned.get(targetId);
30332
- if (existing) {
30333
- if (existing.page === null)
30334
- throw new TypeError(`Target ${targetId} is still being adopted`);
30335
- return this.#public(existing, existing.page);
30336
- }
30397
+ if (existing)
30398
+ return this.#public(existing);
30337
30399
  const viewport = { ...this.viewport, ...options.viewport };
30338
30400
  const record = {
30339
30401
  targetId,
@@ -30750,6 +30812,8 @@ class BrowserConnection {
30750
30812
  async#attachPopup(targetId, pending) {
30751
30813
  const tabs = getAgentTabs(this) ?? createAgentTabs(this);
30752
30814
  const { page } = await tabs.adopt(targetId);
30815
+ if (page === null)
30816
+ throw new TypeError(`Popup target ${targetId} is still being adopted`);
30753
30817
  Object.assign(page, { popupMetadata: Object.freeze(pending.metadata) });
30754
30818
  await page.waitForLoadState("interactive");
30755
30819
  pending.resolve(page);
@@ -35527,9 +35591,95 @@ async function snapshotWithFrames(page, opts = {}) {
35527
35591
  const missingFrames = collectMissingFrames(page, result.refs);
35528
35592
  return missingFrames.length > 0 ? { ...result, missingFrames } : result;
35529
35593
  }
35594
+ // package.json
35595
+ var package_default = {
35596
+ name: "omowright",
35597
+ version: "0.3.1",
35598
+ description: "OmOWright browser automation for standard Chromium CDP endpoints.",
35599
+ keywords: [
35600
+ "accessibility-snapshot",
35601
+ "ai-agent",
35602
+ "browser-automation",
35603
+ "bun",
35604
+ "cdp",
35605
+ "chrome-devtools-protocol",
35606
+ "chromium",
35607
+ "llm"
35608
+ ],
35609
+ homepage: "https://github.com/code-yeongyu/omowright#readme",
35610
+ bugs: {
35611
+ url: "https://github.com/code-yeongyu/omowright/issues"
35612
+ },
35613
+ license: "MIT",
35614
+ repository: {
35615
+ type: "git",
35616
+ url: "git+https://github.com/code-yeongyu/omowright.git"
35617
+ },
35618
+ bin: {
35619
+ "omowright-cloak": "./dist/bin/omowright-cloak.js"
35620
+ },
35621
+ files: [
35622
+ "dist/",
35623
+ "skills/",
35624
+ "presets/",
35625
+ "README.md",
35626
+ "LICENSE",
35627
+ "TOOLS.md"
35628
+ ],
35629
+ type: "module",
35630
+ exports: {
35631
+ ".": {
35632
+ types: "./dist/index.d.ts",
35633
+ import: "./dist/index.js",
35634
+ default: "./dist/index.js"
35635
+ },
35636
+ "./package.json": "./package.json"
35637
+ },
35638
+ publishConfig: {
35639
+ access: "public",
35640
+ provenance: true
35641
+ },
35642
+ scripts: {
35643
+ test: "bun test",
35644
+ "test:node": "bun scripts/node-test.ts",
35645
+ "test:cloak-profile": "bun test test/cloak-profile.test.ts test/cloak-profile.integration.test.ts",
35646
+ typecheck: "tsc --noEmit -p tsconfig.json",
35647
+ "typecheck:control": "bun scripts/typecheck-control.ts",
35648
+ check: "bun run typecheck:control && bun run typecheck && bun run lint && bun run fmt:check",
35649
+ lint: "oxlint --deny-warnings src bin bridge test scripts",
35650
+ "lint:fix": "oxlint --fix src bin bridge test scripts",
35651
+ fmt: "oxfmt --write src bin bridge test scripts",
35652
+ "fmt:check": "oxfmt --check src bin bridge test scripts",
35653
+ format: "bun run fmt",
35654
+ "format:check": "bun run fmt:check",
35655
+ verify: "bun run check",
35656
+ build: "bun build.ts",
35657
+ "build:extension": "bun bridge/build-extension.ts",
35658
+ prepack: "bun run build",
35659
+ preversion: "git diff --quiet HEAD --"
35660
+ },
35661
+ dependencies: {
35662
+ ws: "^8.18.3",
35663
+ zod: "^4.6.6"
35664
+ },
35665
+ devDependencies: {
35666
+ "@types/bun": "1.4.4",
35667
+ acorn: "8.15.0",
35668
+ "gpt-tokenizer": "4.1.0",
35669
+ oxfmt: "^0.77.0",
35670
+ oxlint: "^1.92.0",
35671
+ typescript: "^7.0.2",
35672
+ "typescript-5": "npm:typescript@5.9.3"
35673
+ },
35674
+ engines: {
35675
+ bun: ">=1.4",
35676
+ node: ">=22"
35677
+ }
35678
+ };
35679
+
35530
35680
  // src/har.ts
35531
35681
  var HTTP_VERSION = "HTTP/1.1";
35532
- var CREATOR = Object.freeze({ name: "omowright", version: "0.0.1" });
35682
+ var CREATOR = Object.freeze({ name: "omowright", version: package_default.version });
35533
35683
  function headerList(headers) {
35534
35684
  return Object.entries(headers ?? {}).map(([name, value]) => ({ name, value: String(value) }));
35535
35685
  }
@@ -37224,6 +37374,29 @@ function resolveBrowser(browser, browsers) {
37224
37374
  }
37225
37375
  return named.length === 1 ? readProperty(named[0], "instance_id") : browser;
37226
37376
  }
37377
+ function describeBrowser(b) {
37378
+ const name = optionalProperty(b, "browser_name");
37379
+ const label = optionalProperty(b, "label");
37380
+ const parts = [
37381
+ `${String(label || name || "browser")} [${String(optionalProperty(b, "instance_id"))}]`,
37382
+ [name, optionalProperty(b, "browser_version")].filter(Boolean).join(" ")
37383
+ ];
37384
+ const sessions = optionalProperty(b, "session_count");
37385
+ if (typeof sessions === "number")
37386
+ parts.push(`${sessions} session${sessions === 1 ? "" : "s"}`);
37387
+ const since = optionalProperty(b, "connected_at_ms");
37388
+ if (typeof since === "number" && Number.isFinite(since) && Math.abs(since) <= 8640000000000000) {
37389
+ parts.push(`online since ${new Date(since).toISOString()}`);
37390
+ }
37391
+ return parts.filter(Boolean).join(", ");
37392
+ }
37393
+ function multipleBrowsersError(error, statusBrowsers) {
37394
+ const listed = optionalProperty(error.data, "browsers");
37395
+ const browsers = Array.isArray(listed) ? listed : statusBrowsers;
37396
+ const data = error.data;
37397
+ const extra = typeof data === "object" && data !== null ? data : {};
37398
+ return new BskRpcError(error.code, `more than one browser is online; pass browser: "<instance_id or label>" to connectBrowserSkill(). Online: ${browsers.map(describeBrowser).join("; ")}. Tabs are only visible inside a session: ask the user which browser holds the page, or open a session per browser and read tabList({ scope: "user" }) before stopping it.`, { ...extra, browsers });
37399
+ }
37227
37400
  async function connectBrowserSkill({
37228
37401
  client,
37229
37402
  home,
@@ -37244,13 +37417,22 @@ async function connectBrowserSkill({
37244
37417
  if (browsers.length === 0) {
37245
37418
  throw new BskRpcError("no_browser_connected", "the BrowserSkill daemon is up but no browser extension is connected; open the browser that has the BrowserSkill extension enabled (bskDoctor() explains the remaining step); never substitute another browser for the user's without telling them");
37246
37419
  }
37247
- const started = await ipc.call("session.start", compact({
37248
- task_name: name,
37249
- browser_instance_id: chooseBrowser(browser, browsers),
37250
- width,
37251
- height,
37252
- focused
37253
- }), { idPrefix: "session-start" });
37420
+ const browserInstanceId = chooseBrowser(browser, browsers);
37421
+ let started;
37422
+ try {
37423
+ started = await ipc.call("session.start", compact({
37424
+ task_name: name,
37425
+ browser_instance_id: browserInstanceId,
37426
+ width,
37427
+ height,
37428
+ focused
37429
+ }), { idPrefix: "session-start" });
37430
+ } catch (error) {
37431
+ if (error instanceof BskRpcError && error.code === "multiple_browsers_online") {
37432
+ throw multipleBrowsersError(error, browsers);
37433
+ }
37434
+ throw error;
37435
+ }
37254
37436
  return new BskSession(ipc, {
37255
37437
  sessionId: readProperty(started, "session_id"),
37256
37438
  browserInstanceId: readProperty(started, "browser_instance_id") ?? null,
@@ -37324,7 +37506,7 @@ import { randomBytes as randomBytes2 } from "node:crypto";
37324
37506
 
37325
37507
  // src/aside/cli-contract.ts
37326
37508
  var SCRIPT_AT_EOF = /piped stdin runs as one script/i;
37327
- var LISTS_REPL_TOOL = /^\s*repl\b/m;
37509
+ var LISTS_REPL_TOOL = /^\s*repl(?:[ \t]|$)/m;
37328
37510
  function captureCli({
37329
37511
  spawn,
37330
37512
  command,
@@ -37392,6 +37574,7 @@ class AsideReplError extends Error {
37392
37574
 
37393
37575
  // src/aside/line-transport.ts
37394
37576
  var CLOSE_TIMEOUT_MS = 5000;
37577
+ var KILL_GRACE_MS = 2000;
37395
37578
  var PROMPT = "repl > ";
37396
37579
  var MARKER = /^\[(ok|error) \| \d+ms\]$/;
37397
37580
  var ANSI = /\x1B\[[0-9;?]*[ -/]*[@-~]/g;
@@ -37404,11 +37587,14 @@ class LineTransport {
37404
37587
  #lines = [];
37405
37588
  #waiter = null;
37406
37589
  #closed = false;
37590
+ #exited = false;
37591
+ #terminated = false;
37407
37592
  #exit;
37408
37593
  constructor(child) {
37409
37594
  this.#child = child;
37410
37595
  this.#exit = new Promise((resolve) => child.once("exit", (code, signal) => {
37411
37596
  this.#closed = true;
37597
+ this.#exited = true;
37412
37598
  this.#settle(new AsideReplError("repl_closed", `aside repl exited (code ${code}, signal ${signal})`, {
37413
37599
  output: this.#lines.splice(0)
37414
37600
  }));
@@ -37456,20 +37642,34 @@ class LineTransport {
37456
37642
  return body;
37457
37643
  }
37458
37644
  async close() {
37459
- if (this.#closed)
37645
+ this.#closed = true;
37646
+ if (this.#exited)
37460
37647
  return;
37461
- this.#child.stdin.end(`exit
37648
+ if (!this.#terminated) {
37649
+ this.#child.stdin.end(`exit
37462
37650
  `);
37651
+ if (await this.#exitsWithin(CLOSE_TIMEOUT_MS))
37652
+ return;
37653
+ this.#terminate();
37654
+ }
37655
+ if (await this.#exitsWithin(KILL_GRACE_MS))
37656
+ return;
37657
+ this.#child.kill("SIGKILL");
37658
+ await this.#exit;
37659
+ }
37660
+ async#exitsWithin(ms) {
37463
37661
  let timer;
37464
37662
  const timedOut = new Promise((resolve) => {
37465
- timer = setTimeout(() => resolve(true), CLOSE_TIMEOUT_MS);
37663
+ timer = setTimeout(() => resolve(false), ms);
37466
37664
  });
37467
- const late = await Promise.race([this.#exit.then(() => false), timedOut]);
37665
+ const exited = await Promise.race([this.#exit.then(() => true), timedOut]);
37468
37666
  clearTimeout(timer);
37469
- if (late) {
37470
- this.#child.kill();
37471
- await this.#exit;
37472
- }
37667
+ return exited;
37668
+ }
37669
+ #terminate() {
37670
+ this.#closed = true;
37671
+ this.#terminated = true;
37672
+ this.#child.kill();
37473
37673
  }
37474
37674
  #onData(chunk) {
37475
37675
  this.#buffer += chunk;
@@ -37490,7 +37690,7 @@ class LineTransport {
37490
37690
  this.#waiter = null;
37491
37691
  const output = this.#lines.splice(0);
37492
37692
  reject(new AsideReplError(timeoutCode, `aside repl did not answer within ${timeoutMs} ms`, { output }));
37493
- this.#child.kill();
37693
+ this.#terminate();
37494
37694
  }, timeoutMs);
37495
37695
  this.#waiter = { isDone, resolve, reject, timer };
37496
37696
  this.#check();
@@ -37518,7 +37718,7 @@ class LineTransport {
37518
37718
  // src/aside/mcp-transport.ts
37519
37719
  var PROTOCOL_VERSION = "2025-06-18";
37520
37720
  var CLOSE_TIMEOUT_MS2 = 5000;
37521
- var KILL_GRACE_MS = 2000;
37721
+ var KILL_GRACE_MS2 = 2000;
37522
37722
  var STDERR_LINES = 50;
37523
37723
  var optional2 = (value, key) => value === null || value === undefined ? undefined : readProperty(value, key);
37524
37724
  var textLines = (part) => {
@@ -37602,7 +37802,7 @@ class McpTransport {
37602
37802
  return;
37603
37803
  this.#terminate();
37604
37804
  }
37605
- if (await this.#exitsWithin(KILL_GRACE_MS))
37805
+ if (await this.#exitsWithin(KILL_GRACE_MS2))
37606
37806
  return;
37607
37807
  this.#child.kill("SIGKILL");
37608
37808
  await this.#exit;
@@ -38112,7 +38312,7 @@ async function connectAside({
38112
38312
  try {
38113
38313
  return await session.ready(startTimeoutMs);
38114
38314
  } catch (error) {
38115
- child.kill();
38315
+ await session.close();
38116
38316
  if (!(error instanceof AsideReplError) || error.code !== "repl_start_timeout")
38117
38317
  throw error;
38118
38318
  const version = await asideCliVersion({ ...cli, timeoutMs: CLI_PROBE_TIMEOUT_MS });
@@ -38476,7 +38676,9 @@ async function registerExternalExtension({
38476
38676
  writeFile = writeFileSync4,
38477
38677
  readFile = readFileSync7,
38478
38678
  runReg = runRegDefault
38479
- }) {
38679
+ } = {}) {
38680
+ if (browser === undefined)
38681
+ throw readProperty(browser, "store");
38480
38682
  const entry = externalExtensionEntry({ platform, browser });
38481
38683
  const id = BROWSERSKILL_EXTENSION_IDS[browser.store];
38482
38684
  const label = browser.label ?? browser.id;
@@ -38533,7 +38735,9 @@ async function unregisterExternalExtension({
38533
38735
  platform = process.platform,
38534
38736
  browser,
38535
38737
  runReg = runRegDefault
38536
- }) {
38738
+ } = {}) {
38739
+ if (browser === undefined)
38740
+ throw readProperty(browser, "store");
38537
38741
  const entry = externalExtensionEntry({ platform, browser });
38538
38742
  if (entry.kind === "store")
38539
38743
  return { ...entry, removed: false };
@@ -39138,10 +39342,22 @@ async function connectBrowser({
39138
39342
  attached: opened.map((entry) => entry.engine),
39139
39343
  crossCheck: extra,
39140
39344
  closeAll: async () => {
39141
- await Promise.all(opened.map(({ handle }) => closeHandle(handle).catch(() => {})));
39345
+ const failures = (await Promise.all(opened.map(async ({ engine, handle }) => {
39346
+ try {
39347
+ await closeHandle(handle);
39348
+ return null;
39349
+ } catch (cause) {
39350
+ return new Error(`${engine} failed to close: ${reasonOf(cause)}`, { cause });
39351
+ }
39352
+ }))).filter((error) => error !== null);
39353
+ if (failures.length)
39354
+ throw new AggregateError(failures, failures.map((error) => error.message).join("; "));
39142
39355
  }
39143
39356
  };
39144
39357
  }
39358
+
39359
+ // src/index.ts
39360
+ /*! omowright | MIT License | Copyright (c) 2026 Yeongyu Kim | https://github.com/code-yeongyu/omowright */
39145
39361
  export {
39146
39362
  AgentTabManager,
39147
39363
  AsideReplError,
@@ -28,6 +28,7 @@
28
28
  li: "listitem",
29
29
  p: "paragraph",
30
30
  label: "label",
31
+ output: "status",
31
32
  };
32
33
  const VALID_ARIA_ROLES = /* @__PURE__ */ new Set([
33
34
  "alert",
@@ -422,8 +423,13 @@
422
423
  .map((id) => doc.getElementById(id))
423
424
  .filter(Boolean);
424
425
  }
426
+ // aria-hidden is an ASCII case-insensitive token: "TRUE" hides like "true"; any other value is the spec's
427
+ // undefined state and hides nothing.
428
+ function hasAriaHiddenTrue(element) {
429
+ return element.getAttribute("aria-hidden")?.toLowerCase() === "true";
430
+ }
425
431
  function isHiddenForAria(element) {
426
- if (element.getAttribute("aria-hidden") === "true") return true;
432
+ if (hasAriaHiddenTrue(element)) return true;
427
433
  try {
428
434
  const style = window.getComputedStyle(element);
429
435
  if (style.display === "none" || style.visibility === "hidden") return true;
@@ -704,7 +710,7 @@
704
710
  return result;
705
711
  }
706
712
  function isVisibleUncached(element) {
707
- if (element.getAttribute("aria-hidden") === "true") return false;
713
+ if (hasAriaHiddenTrue(element)) return false;
708
714
  const targetVisibility = window.getComputedStyle(element).visibility;
709
715
  let hasContentsAncestor = false;
710
716
  for (
@@ -794,7 +800,7 @@
794
800
  function shouldTraverse(element, options) {
795
801
  const tag = element.tagName.toLowerCase();
796
802
  if (SKIP_TAGS.has(tag)) return false;
797
- if (element.getAttribute("aria-hidden") === "true" && element.children.length === 0) return false;
803
+ if (hasAriaHiddenTrue(element) && element.children.length === 0) return false;
798
804
  if (!options.showHidden && !isVisible(element)) {
799
805
  if (tag === "input") {
800
806
  const type = element.type;
@@ -1048,7 +1054,11 @@
1048
1054
  : [];
1049
1055
  return;
1050
1056
  }
1051
- if (withoutWhitespace(current.name) === withoutWhitespace(merged)) current.children = [];
1057
+ if (withoutWhitespace(current.name) === withoutWhitespace(merged))
1058
+ current.children =
1059
+ current.element && !getLiveRegionRoot(current.element)
1060
+ ? nestedLiveTexts(current.element, withoutWhitespace(texts.join(" ")), withoutWhitespace(current.name))
1061
+ : [];
1052
1062
  };
1053
1063
  // Capped text of the live regions inside `element` that appears in the node's text but not in its cut name.
1054
1064
  const nestedLiveTexts = (element, fullText, nameText) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omowright",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "OmOWright browser automation for standard Chromium CDP endpoints.",
5
5
  "keywords": [
6
6
  "accessibility-snapshot",
@@ -66,7 +66,7 @@
66
66
  },
67
67
  "dependencies": {
68
68
  "ws": "^8.18.3",
69
- "zod": "^4.1.5"
69
+ "zod": "^4.6.6"
70
70
  },
71
71
  "devDependencies": {
72
72
  "@types/bun": "1.4.4",
@@ -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 (57% smaller via compactSnapshot), ref-based clicks, coordinate control (CUA), viewport pinning, CAPTCHA solving (reCAPTCHA, Turnstile, hCaptcha, slider, OCR), 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."
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
@@ -30,7 +30,8 @@ const { engine, handle, attempts } = await connectBrowser({ allow: ["aside", "eg
30
30
  `attempts` has one entry per engine in order: `ok`, `ms`, and `verified` (the
31
31
  check that proved it attached) or the `reason` it did not (often one step only
32
32
  the user can take, such as `aside login`); engines after the primary read
33
- `not tried`. `crossCheck: true` also attaches the other allowed engines, returned
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
34
35
  in `crossCheck` and listed in `attached`. Each is a SECOND BROWSER (a BrowserSkill
35
36
  tab has no CDP endpoint): compare results through it, act through `handle`, and
36
37
  end with `await result.closeAll()`, which closes every handle the call opened. When a
@@ -150,6 +151,8 @@ screenshot — coordinates read off an unpinned screenshot are stale.
150
151
  | First use, page API, snapshot options, locator rules | `references/quickstart.md`; dialogs and readiness in `TOOLS.md` |
151
152
  | Driving a browser inside `eval` cells, kernel persistence, parallel lanes | `references/eval-kernel.md` |
152
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` |
153
156
  | API JSON instead of DOM scraping, wait for a request, infinite scroll, QA flight trace (jsonl/HAR), request routes | `presets/network/SKILL.md` |
154
157
  | Cross-origin iframes and shadow DOM, overlays that swallow clicks, login/OTP handoff to a human, device emulation | `references/frames-layers-human.md` |
155
158
  | Reading an item from the 1Password web vault (tab-scoped session, sign-in check, secret handling) | `references/1password.md` |
@@ -164,7 +167,8 @@ Preset and `TOOLS.md` paths are relative to the package root.
164
167
  cookies. Detail in `references/stealth.md`. Cookie reuse is fine for ordinary
165
168
  sessions (Grafana, internal tools).
166
169
  - **Always `compactSnapshot()`** before sending a snapshot to a model — the refs
167
- map is ~54% of bytes and resolves in-page, so dropping it is free.
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.
168
172
  - **Refs die on every new snapshot.** Pass `page.locator("e1")` straight from the
169
173
  latest snapshot; never reuse a ref across snapshots, never put one in CSS.
170
174
  - **Refs stay page-level.** Child-frame refs look like `f1e3` and still go to
@@ -183,7 +187,7 @@ Preset and `TOOLS.md` paths are relative to the package root.
183
187
 
184
188
  ## Delegating the pixel loop
185
189
 
186
- CAPTCHA solving and pixel-level visual browsing are iterative (screenshot, reason,
190
+ Working through a CAPTCHA and pixel-level visual browsing are iterative (screenshot, reason,
187
191
  act, verify). When that loop would consume your own context, delegate the blocked
188
192
  page to a `deep` subagent that loads these references. Drive it yourself when the
189
193
  flow is short or the state is already in your hands.
@@ -5,7 +5,7 @@ Ego Lite is second in `connectBrowser()`'s order. Its CDP bindings
5
5
  load omowright there by absolute path:
6
6
 
7
7
  ```bash
8
- ego-browser nodejs -e "const { connectBrowser } = await import('file:///<abs>/omowright/src/index.js'); const { handle: browser } = await connectBrowser({ allow: ['ego'] }); const page = await browser.newTab('https://example.com'); console.log(await page.title()); await browser.close();"
8
+ ego-browser nodejs -e "const { connectBrowser } = await import('file:///<abs>/omowright/src/index.ts'); const { handle: browser } = await connectBrowser({ allow: ['ego'] }); const page = await browser.newTab('https://example.com'); console.log(await page.title()); await browser.close();"
9
9
  ```
10
10
 
11
11
  The script runs as ESM with top-level await, outside your shell's working
@@ -21,4 +21,4 @@ One client at a time owns Ego's callbacks in a runtime: a second connect
21
21
  rejects with `ego_busy` and changes nothing, so close the first.
22
22
  `close()` releases the callbacks and leaves the user's browser running.
23
23
  Sends Ego refuses (the user took the space over, no space selected) reject at
24
- once with Ego's `error_code`, such as `EGO_TASK_SPACE_USER_CONTROLLED`.
24
+ once with Ego's `error_code`, such as `EGO_TASK_SPACE_USER_IN_CONTROL`.
@@ -46,7 +46,10 @@ await userBrowser.close();
46
46
  ```
47
47
 
48
48
  Always launch with a dedicated `--user-data-dir` (a `mkdtemp` dir) and delete it
49
- after `browser.close()`. Under Node, `node:sqlite` loads lazily with a
49
+ after `browser.close()`. On Windows a second launch on Chrome's shared default
50
+ profile exits with code 21. Also on Windows, write `browserPath` with forward
51
+ slashes or `String.raw`: backslashes in a plain string literal are escapes
52
+ (usually ENOENT, a SyntaxError for segments such as `\u`). Under Node, `node:sqlite` loads lazily with a
50
53
  `bun:sqlite` fallback under Bun (see Runtime above).
51
54
 
52
55
  ## Page essentials
@@ -69,7 +72,7 @@ await page.close();
69
72
 
70
73
  ```js
71
74
  const snap = await page.snapshot(); // { tree, refs } or JSON string
72
- const tree = compactSnapshot(snap); // raw tree, ~57% smaller
75
+ const tree = compactSnapshot(snap); // raw tree without the refs map: 7%-64% smaller on pages measured 2026-11-09
73
76
  await page.snapshot({ interactive: true }); // controls, headings, landmarks and state feedback
74
77
  await page.snapshot({ maxDepth: 20, maxChars: 4000, selector: "main" });
75
78
  ```
@@ -12,7 +12,10 @@ python3 -c "import cloakbrowser, json; print(cloakbrowser.binary_info()['binary_
12
12
  ```
13
13
 
14
14
  Not installed: `uv pip install "cloakbrowser==0.5.7"` in a venv, then
15
- `python -c "import cloakbrowser; cloakbrowser.ensure_binary()"`.
15
+ `python -c "import cloakbrowser; cloakbrowser.ensure_binary()"`. The pin is
16
+ deliberate: these docs are written against 0.5.7, and current releases (0.7.1
17
+ on 2026-11-07) ask for a license key on every launch. Moving it is a separate,
18
+ tested change.
16
19
 
17
20
  ## Single-instance rule
18
21