@xbrowser/cli 1.8.5 → 1.8.7

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.
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-TAHJCCME.js";
23
+ } from "./chunk-HXLMMSU3.js";
24
24
  import "./chunk-VJNMAWPZ.js";
25
25
  import "./chunk-TNEN6VQ2.js";
26
26
  import "./chunk-GDKLH7ZY.js";
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-7EOQV6ZW.js";
23
+ } from "./chunk-CJJ564VK.js";
24
24
  import "./chunk-VJNMAWPZ.js";
25
25
  import "./chunk-TNEN6VQ2.js";
26
26
  import "./chunk-GDKLH7ZY.js";
@@ -20,7 +20,7 @@ import {
20
20
  saveSessionDiskMeta,
21
21
  setActivePage,
22
22
  touchSession
23
- } from "./chunk-U25ZKXBJ.js";
23
+ } from "./chunk-SJLRCE6N.js";
24
24
  import "./chunk-TNEN6VQ2.js";
25
25
  import "./chunk-GDKLH7ZY.js";
26
26
  import "./chunk-KFQGP6VL.js";
@@ -656,7 +656,7 @@ async function closeSessionByName(name) {
656
656
  } catch {
657
657
  }
658
658
  try {
659
- const { SessionRecorder } = await import("./session-recorder-H2WPBCSW.js");
659
+ const { SessionRecorder } = await import("./session-recorder-33UKWCIR.js");
660
660
  SessionRecorder.cleanup(session.name);
661
661
  } catch {
662
662
  }
@@ -1891,15 +1891,37 @@ var SessionRecorder = class _SessionRecorder {
1891
1891
  }
1892
1892
  // ==================== Private ====================
1893
1893
  async injectActionScript(page) {
1894
- try {
1895
- await page.evaluate(getSelectorGeneratorScript());
1896
- await page.evaluate(ACTION_SIGNAL_SCRIPT);
1897
- await page.evaluate(`window.__xb_action_script_src = ${JSON.stringify(ACTION_SIGNAL_SCRIPT)};`);
1898
- } catch {
1894
+ let success = false;
1895
+ const maxAttempts = 3;
1896
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
1897
+ try {
1898
+ await page.evaluate(getSelectorGeneratorScript());
1899
+ await page.evaluate(ACTION_SIGNAL_SCRIPT);
1900
+ await page.evaluate(`window.__xb_action_script_src = ${JSON.stringify(ACTION_SIGNAL_SCRIPT)};`);
1901
+ const injected = await page.evaluate(`(function() {
1902
+ try { return !!window.__xb_action_signal; } catch(e) { return false; }
1903
+ })()`).catch(() => false);
1904
+ if (injected) {
1905
+ success = true;
1906
+ break;
1907
+ }
1908
+ console.error(`[recorder] Action signal injection verification failed (attempt ${attempt}/${maxAttempts})`);
1909
+ } catch (e) {
1910
+ const msg = e instanceof Error ? e.message : String(e);
1911
+ console.error(`[recorder] Action signal injection error (attempt ${attempt}/${maxAttempts}): ${msg}`);
1912
+ }
1913
+ if (attempt < maxAttempts) {
1914
+ await new Promise((r) => setTimeout(r, 1e3));
1915
+ }
1916
+ }
1917
+ if (!success) {
1918
+ console.error(`[recorder] WARNING: Action signal injection FAILED after ${maxAttempts} attempts. User actions will NOT be recorded. Check that the page supports Runtime.evaluate.`);
1899
1919
  }
1900
1920
  try {
1901
1921
  await page.evaluate(CHECKPOINT_OVERLAY_SCRIPT);
1902
- } catch {
1922
+ } catch (e) {
1923
+ const msg = e instanceof Error ? e.message : String(e);
1924
+ console.error(`[recorder] Checkpoint overlay injection failed (non-fatal): ${msg}`);
1903
1925
  }
1904
1926
  try {
1905
1927
  await page.evaluate(`
@@ -2051,7 +2073,11 @@ var SessionRecorder = class _SessionRecorder {
2051
2073
  await this.injectActionScript(page);
2052
2074
  return;
2053
2075
  }
2054
- } catch {
2076
+ } catch (e) {
2077
+ const msg = e instanceof Error ? e.message : String(e);
2078
+ if (attempt < 4) {
2079
+ console.error(`[recorder] injectActionScript retry ${attempt + 1}/5 failed: ${msg}`);
2080
+ }
2055
2081
  }
2056
2082
  await new Promise((r) => setTimeout(r, 1e3));
2057
2083
  }
@@ -2071,7 +2097,9 @@ var SessionRecorder = class _SessionRecorder {
2071
2097
  if (url && url !== "about:blank" && !url.startsWith("chrome")) {
2072
2098
  try {
2073
2099
  await this.injectActionScript(page);
2074
- } catch {
2100
+ } catch (e) {
2101
+ const msg = e instanceof Error ? e.message : String(e);
2102
+ console.error(`[recorder] injectActionScript after navigation failed: ${msg}`);
2075
2103
  }
2076
2104
  }
2077
2105
  });
@@ -2021,7 +2021,7 @@ async function closeSessionByName(name) {
2021
2021
  } catch {
2022
2022
  }
2023
2023
  try {
2024
- const { SessionRecorder } = await import("./session-recorder-CV5EJSDY.js");
2024
+ const { SessionRecorder } = await import("./session-recorder-BMIJ3ZJM.js");
2025
2025
  SessionRecorder.cleanup(session.name);
2026
2026
  } catch {
2027
2027
  }
@@ -1494,15 +1494,37 @@ var SessionRecorder = class _SessionRecorder {
1494
1494
  }
1495
1495
  // ==================== Private ====================
1496
1496
  async injectActionScript(page) {
1497
- try {
1498
- await page.evaluate(getSelectorGeneratorScript());
1499
- await page.evaluate(ACTION_SIGNAL_SCRIPT);
1500
- await page.evaluate(`window.__xb_action_script_src = ${JSON.stringify(ACTION_SIGNAL_SCRIPT)};`);
1501
- } catch {
1497
+ let success = false;
1498
+ const maxAttempts = 3;
1499
+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {
1500
+ try {
1501
+ await page.evaluate(getSelectorGeneratorScript());
1502
+ await page.evaluate(ACTION_SIGNAL_SCRIPT);
1503
+ await page.evaluate(`window.__xb_action_script_src = ${JSON.stringify(ACTION_SIGNAL_SCRIPT)};`);
1504
+ const injected = await page.evaluate(`(function() {
1505
+ try { return !!window.__xb_action_signal; } catch(e) { return false; }
1506
+ })()`).catch(() => false);
1507
+ if (injected) {
1508
+ success = true;
1509
+ break;
1510
+ }
1511
+ console.error(`[recorder] Action signal injection verification failed (attempt ${attempt}/${maxAttempts})`);
1512
+ } catch (e) {
1513
+ const msg = e instanceof Error ? e.message : String(e);
1514
+ console.error(`[recorder] Action signal injection error (attempt ${attempt}/${maxAttempts}): ${msg}`);
1515
+ }
1516
+ if (attempt < maxAttempts) {
1517
+ await new Promise((r) => setTimeout(r, 1e3));
1518
+ }
1519
+ }
1520
+ if (!success) {
1521
+ console.error(`[recorder] WARNING: Action signal injection FAILED after ${maxAttempts} attempts. User actions will NOT be recorded. Check that the page supports Runtime.evaluate.`);
1502
1522
  }
1503
1523
  try {
1504
1524
  await page.evaluate(CHECKPOINT_OVERLAY_SCRIPT);
1505
- } catch {
1525
+ } catch (e) {
1526
+ const msg = e instanceof Error ? e.message : String(e);
1527
+ console.error(`[recorder] Checkpoint overlay injection failed (non-fatal): ${msg}`);
1506
1528
  }
1507
1529
  try {
1508
1530
  await page.evaluate(`
@@ -1654,7 +1676,11 @@ var SessionRecorder = class _SessionRecorder {
1654
1676
  await this.injectActionScript(page);
1655
1677
  return;
1656
1678
  }
1657
- } catch {
1679
+ } catch (e) {
1680
+ const msg = e instanceof Error ? e.message : String(e);
1681
+ if (attempt < 4) {
1682
+ console.error(`[recorder] injectActionScript retry ${attempt + 1}/5 failed: ${msg}`);
1683
+ }
1658
1684
  }
1659
1685
  await new Promise((r) => setTimeout(r, 1e3));
1660
1686
  }
@@ -1674,7 +1700,9 @@ var SessionRecorder = class _SessionRecorder {
1674
1700
  if (url && url !== "about:blank" && !url.startsWith("chrome")) {
1675
1701
  try {
1676
1702
  await this.injectActionScript(page);
1677
- } catch {
1703
+ } catch (e) {
1704
+ const msg = e instanceof Error ? e.message : String(e);
1705
+ console.error(`[recorder] injectActionScript after navigation failed: ${msg}`);
1678
1706
  }
1679
1707
  }
1680
1708
  });
@@ -4965,7 +4965,7 @@ async function closeSessionByName(name) {
4965
4965
  } catch {
4966
4966
  }
4967
4967
  try {
4968
- const { SessionRecorder } = await import("./session-recorder-H2WPBCSW.js");
4968
+ const { SessionRecorder } = await import("./session-recorder-33UKWCIR.js");
4969
4969
  SessionRecorder.cleanup(session.name);
4970
4970
  } catch {
4971
4971
  }