@xbrowser/cli 1.10.0 → 1.12.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 (42) hide show
  1. package/dist/{anti-bot-DR56Y63V.js → anti-bot-GTTYNEFB.js} +1 -1
  2. package/dist/{browser-WQZ3D6AE.js → browser-3HQKDZQ6.js} +4 -2
  3. package/dist/{browser-T3V3JWVH.js → browser-ILXTEWH4.js} +1 -1
  4. package/dist/{browser-HBL72GPZ.js → browser-XPDMY2NX.js} +3 -3
  5. package/dist/{cdp-driver-J3YQ4LJV.js → cdp-driver-ESH3PDE6.js} +2 -1
  6. package/dist/cdp-driver-N2E2ZNSC.js +4644 -0
  7. package/dist/cdp-driver-YIKR4BUX.js +49 -0
  8. package/dist/chunk-3FWLW7FS.js +106 -0
  9. package/dist/chunk-A6LPGFAL.js +437 -0
  10. package/dist/{chunk-RRBXV7KE.js → chunk-DKM2JOZL.js} +633 -63
  11. package/dist/{chunk-ABXMBNQ6.js → chunk-H2A5JUK5.js} +37 -466
  12. package/dist/{chunk-5UGR6MUK.js → chunk-HBHOKZPN.js} +51 -16
  13. package/dist/{chunk-BNO7OKO4.js → chunk-HBMEFSTB.js} +39 -0
  14. package/dist/{chunk-INTQPBYF.js → chunk-JKVUFP3G.js} +6 -2
  15. package/dist/chunk-KJTABK3Z.js +1255 -0
  16. package/dist/{chunk-DWDXEGVK.js → chunk-NKW4A74J.js} +9 -3
  17. package/dist/{chunk-4452SPFI.js → chunk-NODRQGOK.js} +51 -16
  18. package/dist/{chunk-SQHSZENE.js → chunk-OMU63E6J.js} +3 -22
  19. package/dist/{chunk-NITFVWWS.js → chunk-OVW2UEWN.js} +981 -407
  20. package/dist/{chunk-WSCP7QCJ.js → chunk-R6IJ6PIV.js} +14 -11
  21. package/dist/{chunk-YMUSHPU4.js → chunk-SH6OTPXN.js} +46 -16
  22. package/dist/{chunk-MWFHZUIY.js → chunk-TEXCXIBW.js} +1 -1
  23. package/dist/{cdp-driver-2T4P4ZE2.js → chunk-Z6CUR3VG.js} +1542 -134
  24. package/dist/{chunk-IIM5GOD7.js → chunk-ZTHE5RBZ.js} +7 -1
  25. package/dist/cli.js +1136 -584
  26. package/dist/{daemon-client-GKEPT4NY.js → daemon-client-7D6EZNOE.js} +46 -16
  27. package/dist/{daemon-client-O6BYVRXV.js → daemon-client-HEGAXWGK.js} +1 -1
  28. package/dist/daemon-main.js +1031 -522
  29. package/dist/{human-interaction-5AO42MBA.js → human-interaction-4YR2N6R6.js} +2 -2
  30. package/dist/{human-interaction-C5OEGXGO.js → human-interaction-Y5IDH6LD.js} +1 -1
  31. package/dist/{human-interaction-ISXZTAYY.js → human-interaction-ZUTR5AC2.js} +2 -2
  32. package/dist/index.d.ts +10 -0
  33. package/dist/index.js +1147 -593
  34. package/dist/{proxy-C6CK3UH5.js → proxy-LUR4U5YF.js} +2 -1
  35. package/dist/{recovery-J2ISVGUL.js → recovery-FTZGV6VY.js} +2 -2
  36. package/dist/{recovery-ZJVVHP7N.js → recovery-L5GLDX4O.js} +1 -1
  37. package/dist/{recovery-EF33LKRJ.js → recovery-Z3RDZENA.js} +2 -2
  38. package/dist/{session-recorder-H3KEYU26.js → session-recorder-3BEVWHOK.js} +1 -1
  39. package/dist/{session-recorder-QRZMKFVL.js → session-recorder-SLDBENVF.js} +1 -1
  40. package/dist/{session-replayer-LJUC4TI7.js → session-replayer-K4A6OI4M.js} +90 -2
  41. package/package.json +1 -1
  42. package/dist/chunk-BAHSRZIX.js +0 -2191
@@ -11,6 +11,7 @@ import {
11
11
  import "./chunk-KFQGP6VL.js";
12
12
 
13
13
  // src/client/daemon-client.ts
14
+ import { request as httpRequest } from "http";
14
15
  var DAEMON_PORT = 9224;
15
16
  var DAEMON_BASE = `http://localhost:${DAEMON_PORT}`;
16
17
  var _ensurePromise = null;
@@ -65,22 +66,48 @@ async function ensureDaemonRunning() {
65
66
  }
66
67
  async function rpcCall(method, params = {}, timeoutMs = 1e4) {
67
68
  await ensureDaemonRunning();
68
- const resp = await fetch(`${DAEMON_BASE}/rpc`, {
69
- method: "POST",
70
- headers: { "Content-Type": "application/json" },
71
- body: JSON.stringify({ method, params }),
72
- signal: AbortSignal.timeout(timeoutMs)
69
+ return new Promise((resolve, reject) => {
70
+ const body = JSON.stringify({ method, params });
71
+ const req = httpRequest(
72
+ {
73
+ hostname: "127.0.0.1",
74
+ port: DAEMON_PORT,
75
+ path: "/rpc",
76
+ method: "POST",
77
+ headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(body) }
78
+ },
79
+ (res) => {
80
+ const chunks = [];
81
+ res.on("data", (c) => chunks.push(c));
82
+ res.on("end", () => {
83
+ try {
84
+ const code = res.statusCode ?? 200;
85
+ if (code >= 400) {
86
+ let detail = `HTTP ${code}`;
87
+ try {
88
+ const body2 = JSON.parse(Buffer.concat(chunks).toString("utf8"));
89
+ if (body2?.error) detail = body2.error;
90
+ } catch {
91
+ }
92
+ reject(new Error(`Daemon error: ${detail}`));
93
+ return;
94
+ }
95
+ const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8"));
96
+ if (parsed && typeof parsed.error === "string" && Object.keys(parsed).length === 1) {
97
+ reject(new Error(`Daemon error: ${parsed.error}`));
98
+ } else {
99
+ resolve(parsed);
100
+ }
101
+ } catch (e) {
102
+ reject(e instanceof Error ? e : new Error(String(e)));
103
+ }
104
+ });
105
+ }
106
+ );
107
+ req.setTimeout(timeoutMs, () => req.destroy(new Error(`RPC ${method} timeout after ${timeoutMs}ms`)));
108
+ req.on("error", reject);
109
+ req.end(body);
73
110
  });
74
- if (!resp.ok) {
75
- let detail = resp.statusText;
76
- try {
77
- const body = await resp.json();
78
- if (body?.error) detail = body.error;
79
- } catch {
80
- }
81
- throw new Error(`Daemon error: ${detail}`);
82
- }
83
- return resp.json();
84
111
  }
85
112
  async function isDaemonRunning() {
86
113
  try {
@@ -205,7 +232,10 @@ async function forwardRecordSummary(session) {
205
232
  return rpcCall("record:summary", { session }, 5e3);
206
233
  }
207
234
  async function forwardReplay(file, session, slowMo) {
208
- return rpcCall("replay", { file, session, slowMo }, 12e4);
235
+ return longRpcCall("replay", { file, session, slowMo }, 20 * 6e4);
236
+ }
237
+ function longRpcCall(method, params, timeoutMs) {
238
+ return rpcCall(method, params, timeoutMs);
209
239
  }
210
240
  async function forwardRecordCheckpoint(session, type, hint, selector) {
211
241
  return rpcCall("record:checkpoint", { session, type, hint, selector }, 1e4);
@@ -30,7 +30,7 @@ import {
30
30
  forwardSessionList,
31
31
  forwardViewerCheckSelector,
32
32
  isDaemonRunning
33
- } from "./chunk-YMUSHPU4.js";
33
+ } from "./chunk-SH6OTPXN.js";
34
34
  import "./chunk-Q2DFJQGS.js";
35
35
  import "./chunk-GDKLH7ZY.js";
36
36
  import "./chunk-KFQGP6VL.js";