omowright 0.1.0 → 0.3.0

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.
Files changed (165) hide show
  1. package/README.md +33 -23
  2. package/TOOLS.md +140 -19
  3. package/dist/agent-tabs.d.ts +56 -0
  4. package/dist/aria-hidden.d.ts +1 -0
  5. package/dist/aside/cli-binary.d.ts +7 -0
  6. package/dist/aside/cli-contract.d.ts +9 -0
  7. package/dist/aside/errors.d.ts +8 -0
  8. package/dist/aside/line-transport.d.ts +11 -0
  9. package/dist/aside/mcp-transport.d.ts +11 -0
  10. package/dist/aside/onboard.d.ts +76 -0
  11. package/dist/aside/session-types.d.ts +68 -0
  12. package/dist/aside/session.d.ts +20 -0
  13. package/{bin/omowright-cloak.mjs → dist/bin/omowright-cloak.js} +28 -31
  14. package/dist/bridge-schemas.d.ts +326 -0
  15. package/dist/bridge-transport.d.ts +144 -0
  16. package/dist/browser-context.d.ts +4024 -0
  17. package/dist/browser-process.d.ts +10 -0
  18. package/dist/bsk/browser-signals.d.ts +23 -0
  19. package/dist/bsk/browsers.d.ts +46 -0
  20. package/dist/bsk/connect.d.ts +23 -0
  21. package/dist/bsk/daemon-info.d.ts +16 -0
  22. package/dist/bsk/external-extension.d.ts +74 -0
  23. package/dist/bsk/identify-browser.d.ts +48 -0
  24. package/dist/bsk/install-cli.d.ts +37 -0
  25. package/dist/bsk/ipc-client.d.ts +45 -0
  26. package/dist/bsk/onboard.d.ts +96 -0
  27. package/dist/bsk/reply-fields.d.ts +3 -0
  28. package/dist/bsk/screenshot.d.ts +24 -0
  29. package/dist/bsk/session.d.ts +142 -0
  30. package/dist/bsk/snapshot.d.ts +16 -0
  31. package/dist/bsk/targets.d.ts +20 -0
  32. package/dist/captcha-wait.d.ts +17 -0
  33. package/dist/captcha.d.ts +46 -0
  34. package/dist/cdp-errors.d.ts +38 -0
  35. package/dist/cdp-methods.d.ts +10 -0
  36. package/dist/cdp-protocol.d.ts +459 -0
  37. package/dist/chrome-profile.d.ts +77 -0
  38. package/dist/chrome.d.ts +130 -0
  39. package/dist/cloak-profile.d.ts +43 -0
  40. package/dist/connection.d.ts +4024 -0
  41. package/dist/console-events.d.ts +22 -0
  42. package/dist/cookies.d.ts +42 -0
  43. package/dist/core.d.ts +10810 -0
  44. package/dist/cua.d.ts +56 -0
  45. package/dist/dialog-policy.d.ts +43 -0
  46. package/dist/ego/bindings.d.ts +68 -0
  47. package/dist/ego/cdp-client.d.ts +28 -0
  48. package/dist/ego/client.d.ts +8 -0
  49. package/dist/ego/errors.d.ts +7 -0
  50. package/dist/emulate.d.ts +62 -0
  51. package/dist/engines.d.ts +59 -0
  52. package/dist/events.d.ts +93 -0
  53. package/dist/frames-snapshot.d.ts +58 -0
  54. package/dist/har.d.ts +88 -0
  55. package/dist/human-handoff.d.ts +30 -0
  56. package/{src/index.js → dist/index.d.ts} +12 -53
  57. package/dist/index.js +39262 -0
  58. package/dist/injected.d.ts +1 -0
  59. package/dist/instance-lock.d.ts +5 -0
  60. package/dist/instances.d.ts +45 -0
  61. package/dist/internal-capability.d.ts +1 -0
  62. package/dist/launch-endpoint.d.ts +34 -0
  63. package/dist/layers.d.ts +31 -0
  64. package/dist/llm.d.ts +1349 -0
  65. package/dist/lock-backend-win32-xbcm60vz.js +57 -0
  66. package/dist/lock-backend-win32.d.ts +3 -0
  67. package/dist/lock-backend.d.ts +6 -0
  68. package/dist/native-host-win32.d.ts +38 -0
  69. package/dist/network-events.d.ts +66 -0
  70. package/dist/network-snoop.d.ts +56 -0
  71. package/dist/nul-frames.d.ts +4 -0
  72. package/dist/open-shadow-query.d.ts +1 -0
  73. package/dist/owner-only.d.ts +15 -0
  74. package/dist/page-bundle.js +1587 -0
  75. package/dist/page-events.d.ts +25 -0
  76. package/dist/page-routes.d.ts +30 -0
  77. package/dist/page-setup.d.ts +55 -0
  78. package/dist/pipe.d.ts +71 -0
  79. package/dist/process-start-time.d.ts +2 -0
  80. package/dist/read-property.d.ts +2 -0
  81. package/dist/routes.d.ts +60 -0
  82. package/dist/running-browser.d.ts +39 -0
  83. package/dist/scroll-collect.d.ts +36 -0
  84. package/dist/serial-emitter.d.ts +5 -0
  85. package/dist/shared-connections.d.ts +11 -0
  86. package/dist/snapshot-diff.d.ts +57 -0
  87. package/dist/text-matching.d.ts +21 -0
  88. package/dist/trace.d.ts +59 -0
  89. package/dist/url-match.d.ts +7 -0
  90. package/dist/viewport.d.ts +26 -0
  91. package/dist/ws.d.ts +62 -0
  92. package/package.json +47 -26
  93. package/presets/agent-events/SKILL.md +1 -1
  94. package/presets/captcha/SKILL.md +1 -3
  95. package/presets/chrome/SKILL.md +11 -7
  96. package/presets/cloak-bridge/SKILL.md +11 -11
  97. package/presets/network/SKILL.md +15 -13
  98. package/presets/visual-browse/SKILL.md +14 -10
  99. package/skills/omowright/SKILL.md +77 -47
  100. package/skills/omowright/references/aside.md +50 -0
  101. package/skills/omowright/references/browserskill.md +39 -33
  102. package/skills/omowright/references/ego.md +24 -0
  103. package/skills/omowright/references/eval-kernel.md +44 -23
  104. package/skills/omowright/references/frames-layers-human.md +16 -7
  105. package/skills/omowright/references/quickstart.md +17 -4
  106. package/skills/omowright/references/stealth.md +7 -7
  107. package/src/agent-tabs.js +0 -160
  108. package/src/bridge-schemas.js +0 -44
  109. package/src/bridge-transport.js +0 -57
  110. package/src/browser-process.js +0 -122
  111. package/src/bsk/browser-signals.js +0 -90
  112. package/src/bsk/browsers.js +0 -114
  113. package/src/bsk/connect.js +0 -45
  114. package/src/bsk/daemon-info.js +0 -100
  115. package/src/bsk/external-extension.js +0 -110
  116. package/src/bsk/identify-browser.js +0 -88
  117. package/src/bsk/install-cli.js +0 -81
  118. package/src/bsk/ipc-client.js +0 -236
  119. package/src/bsk/onboard.js +0 -133
  120. package/src/bsk/screenshot.js +0 -49
  121. package/src/bsk/session.js +0 -131
  122. package/src/bsk/snapshot.js +0 -56
  123. package/src/bsk/targets.js +0 -25
  124. package/src/captcha-wait.js +0 -74
  125. package/src/captcha.js +0 -142
  126. package/src/cdp-errors.js +0 -23
  127. package/src/cdp-methods.js +0 -61
  128. package/src/chrome-profile.js +0 -176
  129. package/src/chrome.js +0 -192
  130. package/src/cloak-profile.js +0 -266
  131. package/src/connection.js +0 -135
  132. package/src/cookies.js +0 -29
  133. package/src/core.js +0 -1710
  134. package/src/cua.js +0 -74
  135. package/src/dialog-policy.js +0 -80
  136. package/src/emulate.js +0 -127
  137. package/src/events.js +0 -111
  138. package/src/frames-snapshot.js +0 -138
  139. package/src/har.js +0 -103
  140. package/src/human-handoff.js +0 -122
  141. package/src/injected.js +0 -3
  142. package/src/instance-lock.js +0 -230
  143. package/src/instances.js +0 -493
  144. package/src/internal-capability.js +0 -1
  145. package/src/launch-endpoint.js +0 -185
  146. package/src/layers.js +0 -138
  147. package/src/llm.js +0 -201
  148. package/src/lock-file.js +0 -130
  149. package/src/native-host-win32.js +0 -201
  150. package/src/network-events.js +0 -201
  151. package/src/network-snoop.js +0 -229
  152. package/src/open-shadow-query.js +0 -22
  153. package/src/owner-only.js +0 -109
  154. package/src/page-bundle.js +0 -1397
  155. package/src/page-routes.js +0 -94
  156. package/src/pipe.js +0 -391
  157. package/src/routes.js +0 -256
  158. package/src/running-browser.js +0 -85
  159. package/src/scroll-collect.js +0 -73
  160. package/src/serial-emitter.js +0 -17
  161. package/src/shared-connections.js +0 -278
  162. package/src/snapshot-diff.js +0 -75
  163. package/src/trace.js +0 -183
  164. package/src/url-match.js +0 -148
  165. package/src/viewport.js +0 -12
package/src/connection.js DELETED
@@ -1,135 +0,0 @@
1
- import path from "node:path";
2
- import { mkdir } from "node:fs/promises";
3
- import {
4
- CdpClient,
5
- FrameManager,
6
- OmOPage,
7
- SessionManager,
8
- } from "./core.js";
9
- import { acquireSharedConnection, canShareConnection } from "./shared-connections.js";
10
-
11
- export class TabRepository {
12
- #client;
13
- constructor(client) { this.#client = client; }
14
- async listTargets() { return this.#client.discoverTargets(); }
15
- }
16
-
17
- export class BrowserConnection {
18
- #client;
19
- #sessions;
20
- #pages = new Map();
21
- #storageRoot;
22
-
23
- constructor(client, options = {}) {
24
- this.#client = client;
25
- this.#sessions = new SessionManager(client);
26
- this.tabs = new TabRepository(client);
27
- this.#storageRoot = path.resolve(options.storageRoot ?? process.cwd());
28
- }
29
-
30
- async initialize() {
31
- await this.#client.ensureConnected();
32
- return this;
33
- }
34
-
35
- get cdp() { return this.#client; }
36
-
37
- setDialogPolicy(policy) {
38
- if (typeof this.#client.setDialogPolicy !== "function") {
39
- throw new Error("dialog policy is not supported by this transport");
40
- }
41
- this.#client.setDialogPolicy(policy);
42
- }
43
-
44
- async listTargets() { return this.tabs.listTargets(); }
45
-
46
- async newTab(url = "about:blank") {
47
- const { createAgentTabs } = await import("./agent-tabs.js");
48
- return (await createAgentTabs(this).create(url)).page;
49
- }
50
-
51
- async attachPage(targetId) {
52
- if (this.#pages.has(targetId)) return this.#pages.get(targetId).page;
53
- const sessionId = await this.#sessions.resolvePageSession(targetId);
54
- const frames = new FrameManager(this.#client, targetId, sessionId);
55
- await frames.initialize();
56
-
57
- const entry = { frames, page: null };
58
- const host = this.#createPageHost(targetId, entry);
59
- const page = new OmOPage(this.#client, frames, targetId, sessionId, host);
60
- entry.page = page;
61
- this.#pages.set(targetId, entry);
62
- return page;
63
- }
64
-
65
- #createPageHost(targetId, entry) {
66
- return {
67
- daemonSession: { accountId: 0, id: "standalone" },
68
- extensionBridgeRoute: {},
69
- page: null,
70
- resolvePageSession: (id, preferred) => this.#sessions.resolvePageSession(id, preferred),
71
- resolvePath: value => path.resolve(this.#storageRoot, value),
72
- ensurePath: async value => {
73
- const resolved = path.resolve(this.#storageRoot, value);
74
- await mkdir(path.dirname(resolved), { recursive: true });
75
- return resolved;
76
- },
77
- registerReadableDownload: value => value,
78
- isReadableDownload: () => false,
79
- openPopupTab: async () => { throw Error("Popup tab control requires the extension bridge"); },
80
- closeTab: async (_page, options = {}) => {
81
- if (options.runBeforeUnload) {
82
- await this.#client.send("Page.close", undefined, await this.#sessions.resolvePageSession(targetId));
83
- } else {
84
- await this.#client.send("Target.closeTarget", { targetId });
85
- }
86
- await entry.page?.dispose();
87
- await entry.frames.dispose();
88
- this.#pages.delete(targetId);
89
- },
90
- };
91
- }
92
-
93
- async close() {
94
- for (const [targetId, entry] of [...this.#pages]) {
95
- await entry.page.dispose().catch(() => {});
96
- await entry.frames.dispose().catch(() => {});
97
- this.#pages.delete(targetId);
98
- }
99
- await this.#sessions.dispose();
100
- await this.#client.close();
101
- }
102
- }
103
-
104
- // The browser's WebSocket URL carries its GUID: a ws:// URL is one already, an
105
- // HTTP endpoint answers it on /json/version (no WebSocket, so no consent prompt).
106
- async function browserKey(client, cdpUrl) {
107
- if (/^wss?:\/\//.test(cdpUrl)) return cdpUrl;
108
- return (await client.discoverVersion()).webSocketDebuggerUrl;
109
- }
110
-
111
- // Attaches in one process share one connection per browser (#76): each new
112
- // connection to a user's Chrome is a new "Allow remote debugging?" prompt.
113
- function createClient(cdpHttpUrl, options) {
114
- if (typeof cdpHttpUrl !== "string" || cdpHttpUrl.length === 0) {
115
- throw new TypeError("connect(cdpHttpUrl) requires a Chromium CDP HTTP URL");
116
- }
117
- return new CdpClient({ cdpUrl: cdpHttpUrl, ...options.client, dialogPolicy: options.dialogPolicy ?? options.client?.dialogPolicy });
118
- }
119
-
120
- // A connection of its own, never shared: for callers that lease or own the
121
- // connection themselves (the named-instance registry).
122
- export async function openConnection(cdpHttpUrl, options = {}) {
123
- return new BrowserConnection(createClient(cdpHttpUrl, options), options).initialize();
124
- }
125
-
126
- export async function connect(cdpHttpUrl, options = {}) {
127
- const client = createClient(cdpHttpUrl, options);
128
- if (!canShareConnection(options)) return new BrowserConnection(client, options).initialize();
129
- const key = await browserKey(client, cdpHttpUrl);
130
- // Opened on the resolved GUID URL, never the port: a reconnect then reaches
131
- // only this browser, and fails once it is gone (#79 review).
132
- return acquireSharedConnection(key, options, {
133
- open: (snapshot) => openConnection(key, snapshot),
134
- });
135
- }
package/src/cookies.js DELETED
@@ -1,29 +0,0 @@
1
- export function sanitizeCookies(cookies) {
2
- const byKey = new Map();
3
- for (const cookie of cookies) {
4
- const out = {
5
- name: cookie.name,
6
- value: cookie.value,
7
- path: cookie.path || "/",
8
- secure: Boolean(cookie.secure),
9
- httpOnly: Boolean(cookie.httpOnly),
10
- };
11
- if (cookie.name.startsWith("__Host-")) {
12
- out.secure = true;
13
- out.path = "/";
14
- out.url = `https://${cookie.domain.replace(/^\./, "")}`;
15
- } else {
16
- out.domain = cookie.domain;
17
- }
18
- if (cookie.expires && cookie.expires > 0) out.expires = cookie.expires;
19
- if (cookie.sameSite && (cookie.sameSite !== "None" || out.secure)) out.sameSite = cookie.sameSite;
20
- const key = `${out.name}|${out.domain ?? out.url}`;
21
- const prev = byKey.get(key);
22
- if (!prev || (out.expires ?? 0) > (prev.expires ?? 0)) byKey.set(key, out);
23
- }
24
- return [...byKey.values()];
25
- }
26
-
27
- export async function injectCookies(page, cookies) {
28
- await page._sendToTarget("Network.setCookies", { cookies: sanitizeCookies(cookies) });
29
- }