omowright 0.2.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 (174) hide show
  1. package/README.md +24 -22
  2. package/TOOLS.md +6 -6
  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} +11 -55
  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 +2 -2
  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 +29 -32
  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 +3 -3
  106. package/skills/omowright/references/stealth.md +7 -7
  107. package/src/agent-tabs.js +0 -179
  108. package/src/aria-hidden.js +0 -47
  109. package/src/bridge-schemas.js +0 -44
  110. package/src/bridge-transport.js +0 -83
  111. package/src/browser-context.js +0 -105
  112. package/src/browser-process.js +0 -127
  113. package/src/bsk/browser-signals.js +0 -90
  114. package/src/bsk/browsers.js +0 -114
  115. package/src/bsk/connect.js +0 -75
  116. package/src/bsk/daemon-info.js +0 -100
  117. package/src/bsk/external-extension.js +0 -110
  118. package/src/bsk/identify-browser.js +0 -88
  119. package/src/bsk/install-cli.js +0 -81
  120. package/src/bsk/ipc-client.js +0 -236
  121. package/src/bsk/onboard.js +0 -140
  122. package/src/bsk/screenshot.js +0 -49
  123. package/src/bsk/session.js +0 -131
  124. package/src/bsk/snapshot.js +0 -56
  125. package/src/bsk/targets.js +0 -25
  126. package/src/captcha-wait.js +0 -79
  127. package/src/captcha.js +0 -142
  128. package/src/cdp-errors.js +0 -23
  129. package/src/cdp-methods.js +0 -69
  130. package/src/chrome-profile.js +0 -176
  131. package/src/chrome.js +0 -194
  132. package/src/cloak-profile.js +0 -266
  133. package/src/connection.js +0 -234
  134. package/src/console-events.js +0 -12
  135. package/src/cookies.js +0 -39
  136. package/src/core.js +0 -1702
  137. package/src/cua.js +0 -74
  138. package/src/dialog-policy.js +0 -80
  139. package/src/emulate.js +0 -127
  140. package/src/events.js +0 -111
  141. package/src/frames-snapshot.js +0 -138
  142. package/src/har.js +0 -103
  143. package/src/human-handoff.js +0 -124
  144. package/src/injected.js +0 -3
  145. package/src/instance-lock.js +0 -74
  146. package/src/instances.js +0 -490
  147. package/src/internal-capability.js +0 -1
  148. package/src/launch-endpoint.js +0 -185
  149. package/src/layers.js +0 -138
  150. package/src/llm.js +0 -201
  151. package/src/lock-backend-win32.js +0 -54
  152. package/src/lock-backend.js +0 -81
  153. package/src/native-host-win32.js +0 -201
  154. package/src/network-events.js +0 -223
  155. package/src/network-snoop.js +0 -229
  156. package/src/nul-frames.js +0 -28
  157. package/src/open-shadow-query.js +0 -101
  158. package/src/owner-only.js +0 -196
  159. package/src/page-bundle.js +0 -1478
  160. package/src/page-events.js +0 -45
  161. package/src/page-routes.js +0 -94
  162. package/src/page-setup.js +0 -239
  163. package/src/pipe.js +0 -418
  164. package/src/process-start-time.js +0 -64
  165. package/src/routes.js +0 -256
  166. package/src/running-browser.js +0 -85
  167. package/src/scroll-collect.js +0 -73
  168. package/src/serial-emitter.js +0 -17
  169. package/src/shared-connections.js +0 -285
  170. package/src/snapshot-diff.js +0 -75
  171. package/src/text-matching.js +0 -101
  172. package/src/trace.js +0 -183
  173. package/src/url-match.js +0 -148
  174. package/src/viewport.js +0 -12
package/src/url-match.js DELETED
@@ -1,148 +0,0 @@
1
- // URL matching for page.waitForURL, ported from Playwright's packages/isomorphic/urlMatch.ts
2
- // (Copyright (c) Microsoft Corporation, Apache License 2.0) so that globs, regular expressions and
3
- // predicates written for Playwright match the same URLs here. OmOWright has no baseURL option, so
4
- // globs resolve the way Playwright resolves them without one.
5
-
6
- const escapedChars = new Set(["$", "^", "+", ".", "*", "(", ")", "|", "\\", "?", "{", "}", "[", "]"]);
7
-
8
- function globToRegexPattern(glob) {
9
- const tokens = ["^"];
10
- let inGroup = false;
11
- for (let i = 0; i < glob.length; ++i) {
12
- const c = glob[i];
13
- if (c === "\\" && i + 1 < glob.length) {
14
- const char = glob[++i];
15
- tokens.push(escapedChars.has(char) ? "\\" + char : char);
16
- continue;
17
- }
18
- if (c === "*") {
19
- const charBefore = glob[i - 1];
20
- let starCount = 1;
21
- while (glob[i + 1] === "*") {
22
- starCount++;
23
- i++;
24
- }
25
- if (starCount > 1) {
26
- const charAfter = glob[i + 1];
27
- // Match either /..something../ or /.
28
- if (charAfter === "/") {
29
- if (charBefore === "/") tokens.push("((.+/)|)");
30
- else tokens.push("(.*/)");
31
- ++i;
32
- } else {
33
- tokens.push("(.*)");
34
- }
35
- } else {
36
- tokens.push("([^/]*)");
37
- }
38
- continue;
39
- }
40
-
41
- switch (c) {
42
- case "{":
43
- if (inGroup) throw new Error(`Invalid glob pattern ${JSON.stringify(glob)}: nested '{' is not supported`);
44
- inGroup = true;
45
- tokens.push("(");
46
- break;
47
- case "}":
48
- if (!inGroup) throw new Error(`Invalid glob pattern ${JSON.stringify(glob)}: unmatched '}'`);
49
- inGroup = false;
50
- tokens.push(")");
51
- break;
52
- case ",":
53
- if (inGroup) {
54
- tokens.push("|");
55
- break;
56
- }
57
- tokens.push("\\" + c);
58
- break;
59
- default:
60
- tokens.push(escapedChars.has(c) ? "\\" + c : c);
61
- }
62
- }
63
- if (inGroup) throw new Error(`Invalid glob pattern ${JSON.stringify(glob)}: unmatched '{'`);
64
- tokens.push("$");
65
- return tokens.join("");
66
- }
67
-
68
- function resolveGlob(match) {
69
- if (match.startsWith("*")) return match;
70
- const tokenMap = new Map();
71
- function mapToken(original, replacement) {
72
- if (original.length === 0) return "";
73
- tokenMap.set(replacement, original);
74
- return replacement;
75
- }
76
- // Escaped `\\?` behaves the same as `?` in these glob patterns.
77
- match = match.replaceAll(/\\\\\?/g, "?");
78
- if (match.startsWith("about:") || match.startsWith("data:")
79
- || match.startsWith("chrome:") || match.startsWith("edge:")
80
- || match.startsWith("file:")) return match;
81
- // Glob symbols may be escaped in the URL and some of them such as ? affect resolution,
82
- // so they are replaced with safe components first.
83
- const relativePath = match.split("/").map((token, index) => {
84
- if (token === "." || token === ".." || token === "") return token;
85
- // http*:// and similar: the stand-in scheme must be a web scheme so slashes follow the host.
86
- if (index === 0 && token.endsWith(":")) {
87
- if (token.indexOf("*") !== -1 || token.indexOf("{") !== -1) return mapToken(token, "http:");
88
- // An explicit scheme is kept as is; it decides trailing slashes after the host.
89
- return token;
90
- }
91
- // Literal components round-trip through new URL() so default ports, percent-encoding and IDN
92
- // hosts are normalized; only components with glob characters are replaced.
93
- if (!/[*?{}\\]/.test(token)) return token;
94
- const questionIndex = token.indexOf("?");
95
- if (questionIndex === -1) return mapToken(token, `$_${index}_$`);
96
- const newPrefix = mapToken(token.substring(0, questionIndex), `$_${index}_$`);
97
- const newSuffix = mapToken(token.substring(questionIndex), `?$_${index}_$`);
98
- return newPrefix + newSuffix;
99
- }).join("/");
100
- const result = resolveURL(relativePath);
101
- let resolved = result.resolved;
102
- for (const [token, original] of tokenMap) {
103
- const normalize = result.caseInsensitivePart?.includes(token);
104
- const replacement = normalize ? original.toLowerCase() : original;
105
- // The function form keeps `$$`, `$&` and similar replacement patterns literal.
106
- resolved = resolved.replace(token, () => replacement);
107
- }
108
- return resolved;
109
- }
110
-
111
- function resolveURL(givenURL) {
112
- try {
113
- const url = new URL(givenURL);
114
- // Scheme and host are case-insensitive.
115
- return { resolved: url.toString(), caseInsensitivePart: url.origin };
116
- } catch {
117
- return { resolved: givenURL };
118
- }
119
- }
120
-
121
- function parseURL(url) {
122
- try {
123
- return new URL(url);
124
- } catch {
125
- return null;
126
- }
127
- }
128
-
129
- function isRegExp(value) {
130
- return value instanceof RegExp || Object.prototype.toString.call(value) === "[object RegExp]";
131
- }
132
-
133
- /**
134
- * Playwright's URL match: a glob string, a RegExp, or a predicate receiving a URL object.
135
- * An empty or missing match accepts every URL; an invalid glob throws.
136
- */
137
- export async function urlMatches(urlString, match) {
138
- if (match === undefined || match === "") return true;
139
- if (typeof match === "string") match = new RegExp(globToRegexPattern(resolveGlob(match)));
140
- if (isRegExp(match)) {
141
- match.lastIndex = 0;
142
- return match.test(urlString);
143
- }
144
- if (typeof match !== "function") throw new TypeError("url parameter should be string, RegExp or function");
145
- const url = parseURL(urlString);
146
- if (!url) return false;
147
- return Boolean(await match(url));
148
- }
package/src/viewport.js DELETED
@@ -1,12 +0,0 @@
1
- export const DEFAULT_AGENT_VIEWPORT = Object.freeze({ width: 1440, height: 900 });
2
-
3
- function validateViewport(viewport) {
4
- if (!viewport || !Number.isInteger(viewport.width) || viewport.width <= 0 || !Number.isInteger(viewport.height) || viewport.height <= 0) throw new TypeError("viewport width and height must be positive integers");
5
- return { width: viewport.width, height: viewport.height };
6
- }
7
- export async function repinViewport(page, viewport, options = {}) {
8
- const size = validateViewport(viewport); const sessionId = await page.resolveSessionId();
9
- await page.cdp.send("Emulation.setDeviceMetricsOverride", { ...size, screenWidth: size.width, screenHeight: size.height, deviceScaleFactor: options.deviceScaleFactor ?? 1, mobile: options.mobile ?? false }, sessionId);
10
- page.setCachedViewportSize(size); return { ...size };
11
- }
12
- export { validateViewport };