@xbrowser/cli 1.22.0 → 1.23.1

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.
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-JKVUFP3G.js";
5
5
  import {
6
6
  getPluginLoader
7
- } from "./chunk-PIWNMC36.js";
7
+ } from "./chunk-A3MORKYR.js";
8
8
  import {
9
9
  version
10
10
  } from "./chunk-43TEMG4U.js";
@@ -7985,7 +7985,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
7985
7985
  const errorMessage = errMsg(err);
7986
7986
  if (session?.page && process.env.XBROWSER_RECOVERY && !extraOpts?._recoveryAttempted) {
7987
7987
  try {
7988
- const { attemptRecovery } = await import("./recovery-MDWAVXE4.js");
7988
+ const { attemptRecovery } = await import("./recovery-LGY25LIM.js");
7989
7989
  const recovery = await attemptRecovery(
7990
7990
  session.page,
7991
7991
  sessionName,
@@ -9025,7 +9025,7 @@ function createRPCHandler() {
9025
9025
  return result;
9026
9026
  } catch (err) {
9027
9027
  const errorMessage = errMsg(err);
9028
- const { attemptRecovery } = await import("./recovery-MDWAVXE4.js");
9028
+ const { attemptRecovery } = await import("./recovery-LGY25LIM.js");
9029
9029
  const recovery = await attemptRecovery(
9030
9030
  session?.page,
9031
9031
  sessionName,
@@ -9192,9 +9192,9 @@ function createRPCHandler() {
9192
9192
  return result;
9193
9193
  }
9194
9194
  async function handlePluginsReload() {
9195
- const { resetPluginLoader } = await import("./plugin-singleton-FCNDN3FX.js");
9195
+ const { resetPluginLoader } = await import("./plugin-singleton-GJO7EZXB.js");
9196
9196
  resetPluginLoader();
9197
- const loader = await import("./plugin-singleton-FCNDN3FX.js").then((m) => m.getPluginLoader());
9197
+ const loader = await import("./plugin-singleton-GJO7EZXB.js").then((m) => m.getPluginLoader());
9198
9198
  const sites = loader.getCore().loader.getSites();
9199
9199
  return { ok: true, plugins: sites.length };
9200
9200
  }
@@ -9590,7 +9590,7 @@ function createRPCHandler() {
9590
9590
  if (isNewFormat) {
9591
9591
  try {
9592
9592
  const replayErrors = [];
9593
- const { SessionReplayer } = await import("./session-replayer-XM5L7LFD.js");
9593
+ const { SessionReplayer } = await import("./session-replayer-N665T3G5.js");
9594
9594
  const replayer = new SessionReplayer({
9595
9595
  page: session.page,
9596
9596
  stepDelay: slowMo * 500,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HumanInteractionManager
3
- } from "./chunk-TEXCXIBW.js";
3
+ } from "./chunk-LPW6QS4M.js";
4
4
  import "./chunk-ZTHE5RBZ.js";
5
5
  import "./chunk-KFQGP6VL.js";
6
6
  export {
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  HumanInteractionManager
3
- } from "./chunk-NKW4A74J.js";
3
+ } from "./chunk-W44UXZSC.js";
4
+ import "./chunk-ZTHE5RBZ.js";
4
5
  import "./chunk-KFQGP6VL.js";
5
6
  export {
6
7
  HumanInteractionManager
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  HumanInteractionManager
3
- } from "./chunk-OMU63E6J.js";
3
+ } from "./chunk-FBQZ3PVD.js";
4
4
  import "./chunk-HBMEFSTB.js";
5
5
  import "./chunk-KFQGP6VL.js";
6
6
  export {
package/dist/index.d.ts CHANGED
@@ -1148,7 +1148,7 @@ interface DetectionConfig {
1148
1148
  * along with optional `waitForHuman` (CAPTCHA handling) and
1149
1149
  * `detectAntiBot` (anti-bot detection) capabilities.
1150
1150
  */
1151
- interface BrowserCommandContext extends CommandContext {
1151
+ interface BrowserCommandContext extends Omit<CommandContext, 'waitForHuman' | 'detectAntiBot' | 'page'> {
1152
1152
  page: XBPage;
1153
1153
  browser: XBBrowser;
1154
1154
  browserContext: XBContext;
@@ -2944,26 +2944,38 @@ interface HTTPServerConfig {
2944
2944
  port?: number;
2945
2945
  host?: string;
2946
2946
  tokens?: string[];
2947
+ /**
2948
+ * Explicit CORS origin allowlist for remote web clients (e.g.
2949
+ * `['https://app.example']`, or `['*']` to opt back into wildcard).
2950
+ * When omitted, only loopback browser origins are granted CORS.
2951
+ */
2952
+ corsOrigins?: string[];
2947
2953
  }
2948
2954
 
2949
2955
  /**
2950
2956
  * HTTP server exposing the xbrowser REST API for remote command execution.
2951
2957
  *
2952
2958
  * Provides endpoints for health checks, session management, single command
2953
- * execution, and command chain execution. Supports optional Bearer token
2959
+ * execution, and command chain execution. Supports Bearer token
2954
2960
  * authentication via config or environment variable.
2961
+ *
2962
+ * Secure defaults: binds loopback (127.0.0.1) only, and grants CORS only
2963
+ * to loopback browser origins. Binding a non-loopback host requires a
2964
+ * token — `start()` refuses otherwise.
2955
2965
  */
2956
2966
  declare class HTTPServer {
2957
2967
  private port;
2958
2968
  private host;
2959
2969
  private server;
2960
2970
  private validTokens;
2971
+ private corsOrigins;
2961
2972
  constructor(config?: HTTPServerConfig);
2962
2973
  /**
2963
2974
  * Start the HTTP server and begin listening for requests.
2964
2975
  *
2965
2976
  * @returns The actual port and host the server bound to.
2966
- * @throws If the server is already running or fails to start.
2977
+ * @throws If the server is already running, if binding a non-loopback
2978
+ * host without an auth token, or if the port cannot be bound.
2967
2979
  */
2968
2980
  start(): Promise<{
2969
2981
  port: number;