@xbrowser/cli 1.6.3 → 1.7.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.
@@ -98,6 +98,9 @@ async function startDaemonProcess(port = 9224) {
98
98
  });
99
99
  });
100
100
  }
101
+ async function stopDaemonProcess() {
102
+ await xcliStopDaemon(getDaemonConfig());
103
+ }
101
104
  function getDaemonProcessStatus() {
102
105
  const config = getDaemonConfig();
103
106
  const running = isDaemonRunning(config);
@@ -113,8 +116,16 @@ function getDaemonProcessStatus() {
113
116
  };
114
117
  }
115
118
 
119
+ // src/version.ts
120
+ import { createRequire } from "module";
121
+ var require2 = createRequire(import.meta.url);
122
+ var pkg = require2("../package.json");
123
+ var version = pkg.version;
124
+
116
125
  export {
117
126
  getDaemonConfig,
118
127
  startDaemonProcess,
119
- getDaemonProcessStatus
128
+ stopDaemonProcess,
129
+ getDaemonProcessStatus,
130
+ version
120
131
  };
@@ -123,6 +123,12 @@ function getDaemonProcessStatus() {
123
123
  };
124
124
  }
125
125
 
126
+ // src/version.ts
127
+ import { createRequire } from "module";
128
+ var require2 = createRequire(import.meta.url);
129
+ var pkg = require2("../package.json");
130
+ var version = pkg.version;
131
+
126
132
  // src/client/daemon-client.ts
127
133
  var DAEMON_PORT = 9224;
128
134
  var DAEMON_BASE = `http://localhost:${DAEMON_PORT}`;
@@ -136,8 +142,22 @@ async function ensureDaemonRunning() {
136
142
  _ensurePromise = null;
137
143
  }
138
144
  for (let attempt = 0; attempt < 3; attempt++) {
139
- const healthOk = await fetch(`${DAEMON_BASE}/health`, { signal: AbortSignal.timeout(2e3) }).then((r) => r.ok ? r.json() : null).then((d) => d?.status === "ok").catch(() => false);
140
- if (healthOk) return;
145
+ const healthOk = await fetch(`${DAEMON_BASE}/health`, { signal: AbortSignal.timeout(2e3) }).then((r) => r.ok ? r.json() : null).then((d) => {
146
+ if (d?.status === "ok") {
147
+ if (d.version && d.version !== version) {
148
+ return { needsRestart: true };
149
+ }
150
+ return { needsRestart: false };
151
+ }
152
+ return null;
153
+ }).catch(() => null);
154
+ if (healthOk?.needsRestart === false) return;
155
+ if (healthOk?.needsRestart === true) {
156
+ console.error(`\u26A0\uFE0F Daemon version mismatch. Restarting...`);
157
+ await stopDaemonProcess().catch(() => {
158
+ });
159
+ break;
160
+ }
141
161
  if (attempt < 2) await new Promise((r) => setTimeout(r, 500));
142
162
  }
143
163
  console.error("\u{1F504} Starting daemon...");
@@ -308,6 +328,7 @@ async function forwardViewerCheckSelector(name, selector) {
308
328
  }
309
329
 
310
330
  export {
331
+ version,
311
332
  getDaemonConfig,
312
333
  startDaemonProcess,
313
334
  stopDaemonProcess,
package/dist/cli.js CHANGED
@@ -53,8 +53,9 @@ import {
53
53
  getDaemonProcessStatus,
54
54
  killAllDaemonProcesses,
55
55
  startDaemonProcess,
56
- stopDaemonProcess
57
- } from "./chunk-L35D5DAY.js";
56
+ stopDaemonProcess,
57
+ version
58
+ } from "./chunk-53LRNYPG.js";
58
59
  import {
59
60
  errMsg
60
61
  } from "./chunk-GDKLH7ZY.js";
@@ -178,12 +179,6 @@ function asZodSchema(value) {
178
179
  return value;
179
180
  }
180
181
 
181
- // src/version.ts
182
- import { createRequire } from "module";
183
- var require2 = createRequire(import.meta.url);
184
- var pkg = require2("../package.json");
185
- var version = pkg.version;
186
-
187
182
  // src/executor.ts
188
183
  import {
189
184
  ok as ok25,
@@ -6119,14 +6114,14 @@ function ensurePluginDependencies(pluginsDir) {
6119
6114
  if (existsSync3(zodPath)) return;
6120
6115
  mkdirSync4(pluginsDir, { recursive: true });
6121
6116
  const pkgPath = join5(pluginsDir, "package.json");
6122
- let pkg2 = {};
6117
+ let pkg = {};
6123
6118
  if (existsSync3(pkgPath)) {
6124
6119
  try {
6125
- pkg2 = readJsonFile(pkgPath, {});
6120
+ pkg = readJsonFile(pkgPath, {});
6126
6121
  } catch {
6127
6122
  }
6128
6123
  }
6129
- const existingDeps = pkg2.dependencies || {};
6124
+ const existingDeps = pkg.dependencies || {};
6130
6125
  let needsInstall = false;
6131
6126
  for (const [dep, version2] of Object.entries(SHARED_PLUGIN_DEPENDENCIES)) {
6132
6127
  if (!existingDeps[dep]) {
@@ -6135,10 +6130,10 @@ function ensurePluginDependencies(pluginsDir) {
6135
6130
  }
6136
6131
  }
6137
6132
  if (!needsInstall && existsSync3(join5(pluginsDir, "node_modules"))) return;
6138
- pkg2.dependencies = existingDeps;
6139
- pkg2.private = true;
6140
- pkg2.description = pkg2.description || "xbrowser plugins \u2014 shared dependencies";
6141
- writeFileSync5(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
6133
+ pkg.dependencies = existingDeps;
6134
+ pkg.private = true;
6135
+ pkg.description = pkg.description || "xbrowser plugins \u2014 shared dependencies";
6136
+ writeFileSync5(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
6142
6137
  try {
6143
6138
  execSync("npm install --production --no-package-lock --no-fund --no-audit", {
6144
6139
  cwd: pluginsDir,
@@ -7186,7 +7181,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
7186
7181
  params = result.data;
7187
7182
  }
7188
7183
  if (command.scope !== "cli" && !process.env.XBROWSER_DAEMON_WORKER) {
7189
- const { forwardExec } = await import("./daemon-client-S3EUTRC6.js");
7184
+ const { forwardExec } = await import("./daemon-client-TOUDMIY5.js");
7190
7185
  const result = await forwardExec(commandName, params, sessionName, extraOpts?.cdpEndpoint);
7191
7186
  if (result) return result;
7192
7187
  }
@@ -8030,10 +8025,10 @@ async function installFromNpm(packageName, name, targetDir) {
8030
8025
  cpSync2(extractDir, targetDir, { recursive: true, force: true });
8031
8026
  const pkgPath = resolve4(targetDir, "package.json");
8032
8027
  if (existsSync6(pkgPath)) {
8033
- const pkg2 = JSON.parse(readFileSync4(pkgPath, "utf-8"));
8034
- if (!pkg2._npmSource) {
8035
- pkg2._npmSource = { name: packageName, version: latestVersion };
8036
- writeFileSync6(pkgPath, JSON.stringify(pkg2, null, 2));
8028
+ const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
8029
+ if (!pkg._npmSource) {
8030
+ pkg._npmSource = { name: packageName, version: latestVersion };
8031
+ writeFileSync6(pkgPath, JSON.stringify(pkg, null, 2));
8037
8032
  }
8038
8033
  }
8039
8034
  } finally {
@@ -8072,10 +8067,10 @@ async function installFromGit(gitUrl, name, targetDir) {
8072
8067
  rmSync3(resolve5(targetDir, ".git"), { recursive: true, force: true });
8073
8068
  const pkgPath = resolve5(targetDir, "package.json");
8074
8069
  if (existsSync7(pkgPath)) {
8075
- const pkg2 = JSON.parse(readFileSync5(pkgPath, "utf-8"));
8076
- if (!pkg2._gitSource) {
8077
- pkg2._gitSource = { url: gitUrl };
8078
- writeFileSync7(pkgPath, JSON.stringify(pkg2, null, 2));
8070
+ const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
8071
+ if (!pkg._gitSource) {
8072
+ pkg._gitSource = { url: gitUrl };
8073
+ writeFileSync7(pkgPath, JSON.stringify(pkg, null, 2));
8079
8074
  }
8080
8075
  }
8081
8076
  } finally {
@@ -8124,10 +8119,10 @@ async function installFromUrl(url, name, targetDir) {
8124
8119
  cpSync4(extractDir, targetDir, { recursive: true, force: true });
8125
8120
  const pkgPath = resolve6(targetDir, "package.json");
8126
8121
  if (existsSync8(pkgPath)) {
8127
- const pkg2 = JSON.parse(readFileSync6(pkgPath, "utf-8"));
8128
- if (!pkg2._urlSource) {
8129
- pkg2._urlSource = { url };
8130
- writeFileSync8(pkgPath, JSON.stringify(pkg2, null, 2));
8122
+ const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
8123
+ if (!pkg._urlSource) {
8124
+ pkg._urlSource = { url };
8125
+ writeFileSync8(pkgPath, JSON.stringify(pkg, null, 2));
8131
8126
  }
8132
8127
  }
8133
8128
  } finally {
@@ -8537,11 +8532,11 @@ var PluginInstaller = class {
8537
8532
  if (!existsSync10(indexPath) && !existsSync10(indexJsPath)) continue;
8538
8533
  const metadata = PluginMetadataParser.parseFromPackageJson(pluginPath);
8539
8534
  let source = "local";
8540
- const pkg2 = readJsonFile(resolve8(pluginPath, "package.json"), {});
8541
- if (pkg2._marketplace) source = "marketplace";
8542
- else if (pkg2._npmSource) source = "npm";
8543
- else if (pkg2._gitSource) source = "git";
8544
- else if (pkg2._urlSource) source = "url";
8535
+ const pkg = readJsonFile(resolve8(pluginPath, "package.json"), {});
8536
+ if (pkg._marketplace) source = "marketplace";
8537
+ else if (pkg._npmSource) source = "npm";
8538
+ else if (pkg._gitSource) source = "git";
8539
+ else if (pkg._urlSource) source = "url";
8545
8540
  plugins.push({
8546
8541
  id: entry.name,
8547
8542
  name: entry.name,
@@ -8881,8 +8876,8 @@ var NPMSearcher = class {
8881
8876
  }
8882
8877
  return parts.join(" ");
8883
8878
  }
8884
- static parseNPMPackage(pkg2) {
8885
- const data = pkg2;
8879
+ static parseNPMPackage(pkg) {
8880
+ const data = pkg;
8886
8881
  const author = this.parseAuthor(data.author);
8887
8882
  const links = this.parseLinks(data);
8888
8883
  const time = data.time;
@@ -10442,19 +10437,19 @@ async function handlePluginInfo(args, options, mode) {
10442
10437
  const distTags = data["dist-tags"];
10443
10438
  const latest = distTags?.latest;
10444
10439
  const versions = data.versions;
10445
- const pkg2 = latest && versions?.[latest];
10446
- if (pkg2) {
10440
+ const pkg = latest && versions?.[latest];
10441
+ if (pkg) {
10447
10442
  if (mode === "json") {
10448
- outputResult({ source: "npm", name: pkg2.name, version: latest, description: pkg2.description }, mode);
10443
+ outputResult({ source: "npm", name: pkg.name, version: latest, description: pkg.description }, mode);
10449
10444
  return;
10450
10445
  }
10451
- console.log(`\u540D\u79F0: ${pkg2.name || ""}`);
10446
+ console.log(`\u540D\u79F0: ${pkg.name || ""}`);
10452
10447
  console.log(`\u7248\u672C: ${latest}`);
10453
- console.log(`\u63CF\u8FF0: ${pkg2.description || ""}`);
10454
- const author = pkg2.author;
10448
+ console.log(`\u63CF\u8FF0: ${pkg.description || ""}`);
10449
+ const author = pkg.author;
10455
10450
  console.log(`\u4F5C\u8005: ${typeof author === "string" ? author : author?.name || ""}`);
10456
- console.log(`\u5173\u952E\u8BCD: ${(pkg2.keywords || []).join(", ")}`);
10457
- console.log(`\u8BB8\u53EF\u8BC1: ${pkg2.license || ""}`);
10451
+ console.log(`\u5173\u952E\u8BCD: ${(pkg.keywords || []).join(", ")}`);
10452
+ console.log(`\u8BB8\u53EF\u8BC1: ${pkg.license || ""}`);
10458
10453
  return;
10459
10454
  }
10460
10455
  }
@@ -10541,7 +10536,7 @@ async function handlePlugin(args, options, mode) {
10541
10536
  } catch {
10542
10537
  }
10543
10538
  try {
10544
- const { daemonPing } = await import("./daemon-client-S3EUTRC6.js");
10539
+ const { daemonPing } = await import("./daemon-client-TOUDMIY5.js");
10545
10540
  if (await daemonPing()) {
10546
10541
  await fetch("http://localhost:9224/rpc", {
10547
10542
  method: "POST",
@@ -12948,7 +12943,7 @@ Run "xbrowser ${command} ${subCommand} --help" to see available parameters.`
12948
12943
  }
12949
12944
  const needsBrowser = cmdEntry.scope === "page" || cmdEntry.scope === "browser";
12950
12945
  if (needsBrowser && !process.env.XBROWSER_DAEMON_WORKER) {
12951
- const { forwardExec } = await import("./daemon-client-S3EUTRC6.js");
12946
+ const { forwardExec } = await import("./daemon-client-TOUDMIY5.js");
12952
12947
  const userTimeout = typeof params.timeout === "number" && params.timeout > 0 ? params.timeout * 1e3 + 3e4 : void 0;
12953
12948
  const result = await forwardExec(`${command}.${subCommand}`, params, sessionName, cdpEndpoint, userTimeout);
12954
12949
  const resultData = result && typeof result === "object" && "data" in result ? result.data : void 0;
@@ -1,6 +1,8 @@
1
1
  import {
2
- startDaemonProcess
3
- } from "./chunk-O3FLVCUU.js";
2
+ startDaemonProcess,
3
+ stopDaemonProcess,
4
+ version
5
+ } from "./chunk-24SY6PE5.js";
4
6
  import {
5
7
  errMsg
6
8
  } from "./chunk-GDKLH7ZY.js";
@@ -19,8 +21,22 @@ async function ensureDaemonRunning() {
19
21
  _ensurePromise = null;
20
22
  }
21
23
  for (let attempt = 0; attempt < 3; attempt++) {
22
- const healthOk = await fetch(`${DAEMON_BASE}/health`, { signal: AbortSignal.timeout(2e3) }).then((r) => r.ok ? r.json() : null).then((d) => d?.status === "ok").catch(() => false);
23
- if (healthOk) return;
24
+ const healthOk = await fetch(`${DAEMON_BASE}/health`, { signal: AbortSignal.timeout(2e3) }).then((r) => r.ok ? r.json() : null).then((d) => {
25
+ if (d?.status === "ok") {
26
+ if (d.version && d.version !== version) {
27
+ return { needsRestart: true };
28
+ }
29
+ return { needsRestart: false };
30
+ }
31
+ return null;
32
+ }).catch(() => null);
33
+ if (healthOk?.needsRestart === false) return;
34
+ if (healthOk?.needsRestart === true) {
35
+ console.error(`\u26A0\uFE0F Daemon version mismatch. Restarting...`);
36
+ await stopDaemonProcess().catch(() => {
37
+ });
38
+ break;
39
+ }
24
40
  if (attempt < 2) await new Promise((r) => setTimeout(r, 500));
25
41
  }
26
42
  console.error("\u{1F504} Starting daemon...");
@@ -29,7 +29,7 @@ import {
29
29
  forwardSessionList,
30
30
  forwardViewerCheckSelector,
31
31
  isDaemonRunning
32
- } from "./chunk-L35D5DAY.js";
32
+ } from "./chunk-53LRNYPG.js";
33
33
  import "./chunk-GDKLH7ZY.js";
34
34
  import "./chunk-KFQGP6VL.js";
35
35
  export {
@@ -29,8 +29,9 @@ import {
29
29
  } from "./chunk-2QQDTXDL.js";
30
30
  import {
31
31
  getDaemonConfig,
32
- getDaemonProcessStatus
33
- } from "./chunk-O3FLVCUU.js";
32
+ getDaemonProcessStatus,
33
+ version
34
+ } from "./chunk-24SY6PE5.js";
34
35
  import {
35
36
  errMsg
36
37
  } from "./chunk-GDKLH7ZY.js";
@@ -6717,7 +6718,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
6717
6718
  params = result.data;
6718
6719
  }
6719
6720
  if (command.scope !== "cli" && !process.env.XBROWSER_DAEMON_WORKER) {
6720
- const { forwardExec } = await import("./daemon-client-WT7PTGYQ.js");
6721
+ const { forwardExec } = await import("./daemon-client-PZX2KOLQ.js");
6721
6722
  const result = await forwardExec(commandName, params, sessionName, extraOpts?.cdpEndpoint);
6722
6723
  if (result) return result;
6723
6724
  }
@@ -11208,7 +11209,7 @@ async function main() {
11208
11209
  pathname: "/health",
11209
11210
  handler: (_req, res) => {
11210
11211
  res.writeHead(200, { "Content-Type": "application/json" });
11211
- res.end(JSON.stringify({ status: "ok", pid: process.pid }));
11212
+ res.end(JSON.stringify({ status: "ok", pid: process.pid, version }));
11212
11213
  }
11213
11214
  }
11214
11215
  ]
package/dist/index.js CHANGED
@@ -24,8 +24,9 @@ import {
24
24
  getDaemonProcessStatus,
25
25
  killAllDaemonProcesses,
26
26
  startDaemonProcess,
27
- stopDaemonProcess
28
- } from "./chunk-L35D5DAY.js";
27
+ stopDaemonProcess,
28
+ version
29
+ } from "./chunk-53LRNYPG.js";
29
30
  import {
30
31
  CaptchaDetector,
31
32
  HumanInteractionManager,
@@ -105,12 +106,6 @@ import {
105
106
  __require
106
107
  } from "./chunk-KFQGP6VL.js";
107
108
 
108
- // src/version.ts
109
- import { createRequire } from "module";
110
- var require2 = createRequire(import.meta.url);
111
- var pkg = require2("../package.json");
112
- var version = pkg.version;
113
-
114
109
  // src/executor.ts
115
110
  import {
116
111
  ok as ok25,
@@ -6436,14 +6431,14 @@ function ensurePluginDependencies(pluginsDir) {
6436
6431
  if (existsSync3(zodPath)) return;
6437
6432
  mkdirSync4(pluginsDir, { recursive: true });
6438
6433
  const pkgPath = join5(pluginsDir, "package.json");
6439
- let pkg2 = {};
6434
+ let pkg = {};
6440
6435
  if (existsSync3(pkgPath)) {
6441
6436
  try {
6442
- pkg2 = readJsonFile(pkgPath, {});
6437
+ pkg = readJsonFile(pkgPath, {});
6443
6438
  } catch {
6444
6439
  }
6445
6440
  }
6446
- const existingDeps = pkg2.dependencies || {};
6441
+ const existingDeps = pkg.dependencies || {};
6447
6442
  let needsInstall = false;
6448
6443
  for (const [dep, version2] of Object.entries(SHARED_PLUGIN_DEPENDENCIES)) {
6449
6444
  if (!existingDeps[dep]) {
@@ -6452,10 +6447,10 @@ function ensurePluginDependencies(pluginsDir) {
6452
6447
  }
6453
6448
  }
6454
6449
  if (!needsInstall && existsSync3(join5(pluginsDir, "node_modules"))) return;
6455
- pkg2.dependencies = existingDeps;
6456
- pkg2.private = true;
6457
- pkg2.description = pkg2.description || "xbrowser plugins \u2014 shared dependencies";
6458
- writeFileSync5(pkgPath, JSON.stringify(pkg2, null, 2) + "\n", "utf-8");
6450
+ pkg.dependencies = existingDeps;
6451
+ pkg.private = true;
6452
+ pkg.description = pkg.description || "xbrowser plugins \u2014 shared dependencies";
6453
+ writeFileSync5(pkgPath, JSON.stringify(pkg, null, 2) + "\n", "utf-8");
6459
6454
  try {
6460
6455
  execSync("npm install --production --no-package-lock --no-fund --no-audit", {
6461
6456
  cwd: pluginsDir,
@@ -7506,7 +7501,7 @@ async function executeCommand(commandName, params, sessionName = "default", extr
7506
7501
  params = result.data;
7507
7502
  }
7508
7503
  if (command.scope !== "cli" && !process.env.XBROWSER_DAEMON_WORKER) {
7509
- const { forwardExec } = await import("./daemon-client-S3EUTRC6.js");
7504
+ const { forwardExec } = await import("./daemon-client-TOUDMIY5.js");
7510
7505
  const result = await forwardExec(commandName, params, sessionName, extraOpts?.cdpEndpoint);
7511
7506
  if (result) return result;
7512
7507
  }
@@ -8348,10 +8343,10 @@ async function installFromNpm(packageName, name, targetDir) {
8348
8343
  cpSync2(extractDir, targetDir, { recursive: true, force: true });
8349
8344
  const pkgPath = resolve4(targetDir, "package.json");
8350
8345
  if (existsSync6(pkgPath)) {
8351
- const pkg2 = JSON.parse(readFileSync4(pkgPath, "utf-8"));
8352
- if (!pkg2._npmSource) {
8353
- pkg2._npmSource = { name: packageName, version: latestVersion };
8354
- writeFileSync6(pkgPath, JSON.stringify(pkg2, null, 2));
8346
+ const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
8347
+ if (!pkg._npmSource) {
8348
+ pkg._npmSource = { name: packageName, version: latestVersion };
8349
+ writeFileSync6(pkgPath, JSON.stringify(pkg, null, 2));
8355
8350
  }
8356
8351
  }
8357
8352
  } finally {
@@ -8390,10 +8385,10 @@ async function installFromGit(gitUrl, name, targetDir) {
8390
8385
  rmSync3(resolve5(targetDir, ".git"), { recursive: true, force: true });
8391
8386
  const pkgPath = resolve5(targetDir, "package.json");
8392
8387
  if (existsSync7(pkgPath)) {
8393
- const pkg2 = JSON.parse(readFileSync5(pkgPath, "utf-8"));
8394
- if (!pkg2._gitSource) {
8395
- pkg2._gitSource = { url: gitUrl };
8396
- writeFileSync7(pkgPath, JSON.stringify(pkg2, null, 2));
8388
+ const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
8389
+ if (!pkg._gitSource) {
8390
+ pkg._gitSource = { url: gitUrl };
8391
+ writeFileSync7(pkgPath, JSON.stringify(pkg, null, 2));
8397
8392
  }
8398
8393
  }
8399
8394
  } finally {
@@ -8442,10 +8437,10 @@ async function installFromUrl(url, name, targetDir) {
8442
8437
  cpSync4(extractDir, targetDir, { recursive: true, force: true });
8443
8438
  const pkgPath = resolve6(targetDir, "package.json");
8444
8439
  if (existsSync8(pkgPath)) {
8445
- const pkg2 = JSON.parse(readFileSync6(pkgPath, "utf-8"));
8446
- if (!pkg2._urlSource) {
8447
- pkg2._urlSource = { url };
8448
- writeFileSync8(pkgPath, JSON.stringify(pkg2, null, 2));
8440
+ const pkg = JSON.parse(readFileSync6(pkgPath, "utf-8"));
8441
+ if (!pkg._urlSource) {
8442
+ pkg._urlSource = { url };
8443
+ writeFileSync8(pkgPath, JSON.stringify(pkg, null, 2));
8449
8444
  }
8450
8445
  }
8451
8446
  } finally {
@@ -8855,11 +8850,11 @@ var PluginInstaller = class {
8855
8850
  if (!existsSync10(indexPath) && !existsSync10(indexJsPath)) continue;
8856
8851
  const metadata = PluginMetadataParser.parseFromPackageJson(pluginPath);
8857
8852
  let source = "local";
8858
- const pkg2 = readJsonFile(resolve8(pluginPath, "package.json"), {});
8859
- if (pkg2._marketplace) source = "marketplace";
8860
- else if (pkg2._npmSource) source = "npm";
8861
- else if (pkg2._gitSource) source = "git";
8862
- else if (pkg2._urlSource) source = "url";
8853
+ const pkg = readJsonFile(resolve8(pluginPath, "package.json"), {});
8854
+ if (pkg._marketplace) source = "marketplace";
8855
+ else if (pkg._npmSource) source = "npm";
8856
+ else if (pkg._gitSource) source = "git";
8857
+ else if (pkg._urlSource) source = "url";
8863
8858
  plugins.push({
8864
8859
  id: entry.name,
8865
8860
  name: entry.name,
@@ -9199,8 +9194,8 @@ var NPMSearcher = class {
9199
9194
  }
9200
9195
  return parts.join(" ");
9201
9196
  }
9202
- static parseNPMPackage(pkg2) {
9203
- const data = pkg2;
9197
+ static parseNPMPackage(pkg) {
9198
+ const data = pkg;
9204
9199
  const author = this.parseAuthor(data.author);
9205
9200
  const links = this.parseLinks(data);
9206
9201
  const time = data.time;
@@ -10765,19 +10760,19 @@ async function handlePluginInfo(args, options, mode) {
10765
10760
  const distTags = data["dist-tags"];
10766
10761
  const latest = distTags?.latest;
10767
10762
  const versions = data.versions;
10768
- const pkg2 = latest && versions?.[latest];
10769
- if (pkg2) {
10763
+ const pkg = latest && versions?.[latest];
10764
+ if (pkg) {
10770
10765
  if (mode === "json") {
10771
- outputResult({ source: "npm", name: pkg2.name, version: latest, description: pkg2.description }, mode);
10766
+ outputResult({ source: "npm", name: pkg.name, version: latest, description: pkg.description }, mode);
10772
10767
  return;
10773
10768
  }
10774
- console.log(`\u540D\u79F0: ${pkg2.name || ""}`);
10769
+ console.log(`\u540D\u79F0: ${pkg.name || ""}`);
10775
10770
  console.log(`\u7248\u672C: ${latest}`);
10776
- console.log(`\u63CF\u8FF0: ${pkg2.description || ""}`);
10777
- const author = pkg2.author;
10771
+ console.log(`\u63CF\u8FF0: ${pkg.description || ""}`);
10772
+ const author = pkg.author;
10778
10773
  console.log(`\u4F5C\u8005: ${typeof author === "string" ? author : author?.name || ""}`);
10779
- console.log(`\u5173\u952E\u8BCD: ${(pkg2.keywords || []).join(", ")}`);
10780
- console.log(`\u8BB8\u53EF\u8BC1: ${pkg2.license || ""}`);
10774
+ console.log(`\u5173\u952E\u8BCD: ${(pkg.keywords || []).join(", ")}`);
10775
+ console.log(`\u8BB8\u53EF\u8BC1: ${pkg.license || ""}`);
10781
10776
  return;
10782
10777
  }
10783
10778
  }
@@ -10864,7 +10859,7 @@ async function handlePlugin(args, options, mode) {
10864
10859
  } catch {
10865
10860
  }
10866
10861
  try {
10867
- const { daemonPing } = await import("./daemon-client-S3EUTRC6.js");
10862
+ const { daemonPing } = await import("./daemon-client-TOUDMIY5.js");
10868
10863
  if (await daemonPing()) {
10869
10864
  await fetch("http://localhost:9224/rpc", {
10870
10865
  method: "POST",
@@ -13271,7 +13266,7 @@ Run "xbrowser ${command} ${subCommand} --help" to see available parameters.`
13271
13266
  }
13272
13267
  const needsBrowser = cmdEntry.scope === "page" || cmdEntry.scope === "browser";
13273
13268
  if (needsBrowser && !process.env.XBROWSER_DAEMON_WORKER) {
13274
- const { forwardExec } = await import("./daemon-client-S3EUTRC6.js");
13269
+ const { forwardExec } = await import("./daemon-client-TOUDMIY5.js");
13275
13270
  const userTimeout = typeof params.timeout === "number" && params.timeout > 0 ? params.timeout * 1e3 + 3e4 : void 0;
13276
13271
  const result = await forwardExec(`${command}.${subCommand}`, params, sessionName, cdpEndpoint, userTimeout);
13277
13272
  const resultData = result && typeof result === "object" && "data" in result ? result.data : void 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xbrowser/cli",
3
- "version": "1.6.3",
3
+ "version": "1.7.0",
4
4
  "description": "Browser automation CLI for web scraping, headless browsing, SEO analysis, and AI agent workflows. A command-line alternative to Playwright, Puppeteer, and Selenium.",
5
5
  "type": "module",
6
6
  "bin": {