browser-pilot 0.0.13 → 0.0.14
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 +59 -3
- package/dist/actions.cjs +418 -14
- package/dist/actions.d.cts +13 -3
- package/dist/actions.d.ts +13 -3
- package/dist/actions.mjs +1 -1
- package/dist/browser-LZTEHUDI.mjs +9 -0
- package/dist/browser.cjs +600 -20
- package/dist/browser.d.cts +12 -3
- package/dist/browser.d.ts +12 -3
- package/dist/browser.mjs +3 -3
- package/dist/cdp.cjs +31 -2
- package/dist/cdp.d.cts +1 -1
- package/dist/cdp.d.ts +1 -1
- package/dist/cdp.mjs +3 -1
- package/dist/chunk-7NDR6V7S.mjs +7788 -0
- package/dist/{chunk-VDAMDOS6.mjs → chunk-IN5HPAPB.mjs} +147 -7
- package/dist/{chunk-HP6R3W32.mjs → chunk-KIFB526Y.mjs} +44 -2
- package/dist/chunk-LUGLEMVR.mjs +11 -0
- package/dist/chunk-SPSZZH22.mjs +308 -0
- package/dist/{chunk-A2ZRAEO3.mjs → chunk-XMJABKCF.mjs} +408 -14
- package/dist/cli.mjs +1063 -7746
- package/dist/client-3AFV2IAF.mjs +10 -0
- package/dist/{client-DRqxBdHv.d.ts → client-Ck2nQksT.d.cts} +8 -6
- package/dist/{client-DRqxBdHv.d.cts → client-Ck2nQksT.d.ts} +8 -6
- package/dist/index.cjs +600 -20
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +3 -3
- package/dist/transport-WHEBAZUP.mjs +83 -0
- package/dist/{types-CzgQjai9.d.ts → types-BSoh5v1Y.d.cts} +62 -2
- package/dist/{types-BXMGFtnB.d.cts → types-CjT0vClo.d.ts} +62 -2
- package/package.json +2 -2
package/dist/browser.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CDPClient } from './client-
|
|
1
|
+
import { C as CDPClient } from './client-Ck2nQksT.cjs';
|
|
2
2
|
import { TargetInfo } from './cdp.cjs';
|
|
3
3
|
import { b as ConnectOptions } from './types--wXNHUwt.cjs';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { J as Page } from './types-BSoh5v1Y.cjs';
|
|
5
|
+
export { l as ActionOptions, m as ActionResult, n as ConsoleHandler, o as ConsoleMessage, p as ConsoleMessageType, q as CustomSelectConfig, D as Dialog, r as DialogHandler, s as DialogType, t as Download, E as ElementInfo, u as ElementNotFoundError, v as EmulationState, w as ErrorHandler, ai as FailureHint, F as FileInput, x as FillOptions, y as FormField, z as FormOption, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, H as NetworkIdleOptions, K as PageError, L as PageSnapshot, M as SnapshotNode, O as SnapshotOptions, Q as SubmitOptions, T as TimeoutError, U as TypeOptions, V as UserAgentMetadata, W as UserAgentOptions, X as ViewportOptions, Y as WaitForOptions } from './types-BSoh5v1Y.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Browser class - manages CDP connection and pages
|
|
@@ -34,6 +34,15 @@ declare class Browser {
|
|
|
34
34
|
private pages;
|
|
35
35
|
private pageCounter;
|
|
36
36
|
private constructor();
|
|
37
|
+
/**
|
|
38
|
+
* Create a Browser from an existing CDPClient (used by daemon fast-path).
|
|
39
|
+
* The caller is responsible for the CDP connection lifecycle.
|
|
40
|
+
*/
|
|
41
|
+
static fromCDP(cdp: CDPClient, sessionInfo: {
|
|
42
|
+
wsUrl: string;
|
|
43
|
+
provider?: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
}): Browser;
|
|
37
46
|
/**
|
|
38
47
|
* Connect to a browser instance
|
|
39
48
|
*/
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as CDPClient } from './client-
|
|
1
|
+
import { C as CDPClient } from './client-Ck2nQksT.js';
|
|
2
2
|
import { TargetInfo } from './cdp.js';
|
|
3
3
|
import { b as ConnectOptions } from './types--wXNHUwt.js';
|
|
4
|
-
import {
|
|
5
|
-
export {
|
|
4
|
+
import { J as Page } from './types-CjT0vClo.js';
|
|
5
|
+
export { l as ActionOptions, m as ActionResult, n as ConsoleHandler, o as ConsoleMessage, p as ConsoleMessageType, q as CustomSelectConfig, D as Dialog, r as DialogHandler, s as DialogType, t as Download, E as ElementInfo, u as ElementNotFoundError, v as EmulationState, w as ErrorHandler, ai as FailureHint, F as FileInput, x as FillOptions, y as FormField, z as FormOption, G as GeolocationOptions, I as InteractiveElement, N as NavigationError, H as NetworkIdleOptions, K as PageError, L as PageSnapshot, M as SnapshotNode, O as SnapshotOptions, Q as SubmitOptions, T as TimeoutError, U as TypeOptions, V as UserAgentMetadata, W as UserAgentOptions, X as ViewportOptions, Y as WaitForOptions } from './types-CjT0vClo.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Browser class - manages CDP connection and pages
|
|
@@ -34,6 +34,15 @@ declare class Browser {
|
|
|
34
34
|
private pages;
|
|
35
35
|
private pageCounter;
|
|
36
36
|
private constructor();
|
|
37
|
+
/**
|
|
38
|
+
* Create a Browser from an existing CDPClient (used by daemon fast-path).
|
|
39
|
+
* The caller is responsible for the CDP connection lifecycle.
|
|
40
|
+
*/
|
|
41
|
+
static fromCDP(cdp: CDPClient, sessionInfo: {
|
|
42
|
+
wsUrl: string;
|
|
43
|
+
provider?: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
}): Browser;
|
|
37
46
|
/**
|
|
38
47
|
* Connect to a browser instance
|
|
39
48
|
*/
|
package/dist/browser.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
Browser,
|
|
3
3
|
Page,
|
|
4
4
|
connect
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-IN5HPAPB.mjs";
|
|
6
|
+
import "./chunk-KIFB526Y.mjs";
|
|
7
7
|
import "./chunk-BRAFQUMG.mjs";
|
|
8
8
|
import {
|
|
9
9
|
ElementNotFoundError,
|
|
10
10
|
NavigationError,
|
|
11
11
|
TimeoutError
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XMJABKCF.mjs";
|
|
13
13
|
import "./chunk-JXAUPHZM.mjs";
|
|
14
14
|
export {
|
|
15
15
|
Browser,
|
package/dist/cdp.cjs
CHANGED
|
@@ -22,10 +22,16 @@ var cdp_exports = {};
|
|
|
22
22
|
__export(cdp_exports, {
|
|
23
23
|
CDPError: () => CDPError,
|
|
24
24
|
createCDPClient: () => createCDPClient,
|
|
25
|
+
createCDPClientFromTransport: () => createCDPClientFromTransport,
|
|
25
26
|
createTransport: () => createTransport
|
|
26
27
|
});
|
|
27
28
|
module.exports = __toCommonJS(cdp_exports);
|
|
28
29
|
|
|
30
|
+
// src/utils/json.ts
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return typeof value === "object" && value !== null;
|
|
33
|
+
}
|
|
34
|
+
|
|
29
35
|
// src/cdp/protocol.ts
|
|
30
36
|
var CDPError = class extends Error {
|
|
31
37
|
code;
|
|
@@ -140,9 +146,16 @@ function getReadyStateString(state) {
|
|
|
140
146
|
}
|
|
141
147
|
|
|
142
148
|
// src/cdp/client.ts
|
|
149
|
+
function createCDPClientFromTransport(transport, options = {}) {
|
|
150
|
+
return buildCDPClient(transport, options);
|
|
151
|
+
}
|
|
143
152
|
async function createCDPClient(wsUrl, options = {}) {
|
|
144
|
-
const {
|
|
153
|
+
const { timeout = 3e4 } = options;
|
|
145
154
|
const transport = await createTransport(wsUrl, { timeout });
|
|
155
|
+
return buildCDPClient(transport, options);
|
|
156
|
+
}
|
|
157
|
+
function buildCDPClient(transport, options = {}) {
|
|
158
|
+
const { debug = false, timeout = 3e4 } = options;
|
|
146
159
|
let messageId = 0;
|
|
147
160
|
let currentSessionId;
|
|
148
161
|
let connected = true;
|
|
@@ -152,7 +165,19 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
152
165
|
transport.onMessage((raw) => {
|
|
153
166
|
let msg;
|
|
154
167
|
try {
|
|
155
|
-
|
|
168
|
+
const parsed = JSON.parse(raw);
|
|
169
|
+
if (!isRecord(parsed)) {
|
|
170
|
+
if (debug) console.error("[CDP] Ignoring non-object message:", raw);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if ("id" in parsed && typeof parsed["id"] === "number") {
|
|
174
|
+
msg = parsed;
|
|
175
|
+
} else if ("method" in parsed && typeof parsed["method"] === "string") {
|
|
176
|
+
msg = parsed;
|
|
177
|
+
} else {
|
|
178
|
+
if (debug) console.error("[CDP] Ignoring invalid message shape:", raw);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
156
181
|
} catch {
|
|
157
182
|
if (debug) console.error("[CDP] Failed to parse message:", raw);
|
|
158
183
|
return;
|
|
@@ -265,6 +290,9 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
265
290
|
onAny(handler) {
|
|
266
291
|
anyEventHandlers.add(handler);
|
|
267
292
|
},
|
|
293
|
+
offAny(handler) {
|
|
294
|
+
anyEventHandlers.delete(handler);
|
|
295
|
+
},
|
|
268
296
|
async close() {
|
|
269
297
|
connected = false;
|
|
270
298
|
await transport.close();
|
|
@@ -290,5 +318,6 @@ async function createCDPClient(wsUrl, options = {}) {
|
|
|
290
318
|
0 && (module.exports = {
|
|
291
319
|
CDPError,
|
|
292
320
|
createCDPClient,
|
|
321
|
+
createCDPClientFromTransport,
|
|
293
322
|
createTransport
|
|
294
323
|
});
|
package/dist/cdp.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CDPClient, a as CDPClientOptions, T as Transport,
|
|
1
|
+
export { C as CDPClient, a as CDPClientOptions, T as Transport, e as TransportOptions, c as createCDPClient, b as createCDPClientFromTransport, d as createTransport } from './client-Ck2nQksT.cjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CDP Protocol type definitions
|
package/dist/cdp.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { C as CDPClient, a as CDPClientOptions, T as Transport,
|
|
1
|
+
export { C as CDPClient, a as CDPClientOptions, T as Transport, e as TransportOptions, c as createCDPClient, b as createCDPClientFromTransport, d as createTransport } from './client-Ck2nQksT.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* CDP Protocol type definitions
|
package/dist/cdp.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCDPClient,
|
|
3
|
+
createCDPClientFromTransport,
|
|
3
4
|
createTransport
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KIFB526Y.mjs";
|
|
5
6
|
import {
|
|
6
7
|
CDPError
|
|
7
8
|
} from "./chunk-JXAUPHZM.mjs";
|
|
8
9
|
export {
|
|
9
10
|
CDPError,
|
|
10
11
|
createCDPClient,
|
|
12
|
+
createCDPClientFromTransport,
|
|
11
13
|
createTransport
|
|
12
14
|
};
|