@beeos-ai/cli 1.0.2 → 1.0.3

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 (2) hide show
  1. package/dist/index.js +23 -14
  2. package/package.json +6 -5
package/dist/index.js CHANGED
@@ -560,22 +560,14 @@ async function upgradeDeviceAgent(progress) {
560
560
  }
561
561
  async function findExisting() {
562
562
  const p = getPlatformAdapter();
563
+ const whichCmd = p.platform() === "win32" ? "where" : "which";
563
564
  try {
564
- const result = await p.exec("which", ["device-agent"]);
565
+ const result = await p.exec(whichCmd, ["device-agent"]);
565
566
  if (result.code === 0 && result.stdout.trim()) {
566
- return { type: "executable", path: result.stdout.trim() };
567
+ return { type: "executable", path: result.stdout.trim().split("\n")[0].trim() };
567
568
  }
568
569
  } catch {
569
570
  }
570
- if (p.platform() === "win32") {
571
- try {
572
- const result = await p.exec("where", ["device-agent"]);
573
- if (result.code === 0 && result.stdout.trim()) {
574
- return { type: "executable", path: result.stdout.trim().split("\n")[0].trim() };
575
- }
576
- } catch {
577
- }
578
- }
579
571
  const managed = managedBinary();
580
572
  if (await p.exists(managed)) {
581
573
  return { type: "executable", path: managed };
@@ -665,7 +657,7 @@ async function installWithPython(progress, venv, source, python) {
665
657
  async function installSource() {
666
658
  const p = getPlatformAdapter();
667
659
  try {
668
- const cwd = p.env("PWD") || p.homeDir();
660
+ const cwd = p.cwd();
669
661
  let dir = cwd;
670
662
  for (let i = 0; i < 10; i++) {
671
663
  const da = p.joinPath(dir, "agents", "device-agent", "pyproject.toml");
@@ -893,6 +885,11 @@ async function managedBinary2(agentType) {
893
885
  resolved = currentLink;
894
886
  }
895
887
  const binShim = p.joinPath(resolved, "node_modules", ".bin", "openclaw");
888
+ if (p.platform() === "win32") {
889
+ const cmdShim = binShim + ".cmd";
890
+ if (await p.exists(cmdShim))
891
+ return cmdShim;
892
+ }
896
893
  if (await p.exists(binShim))
897
894
  return binShim;
898
895
  const mjs = p.joinPath(resolved, "node_modules", "openclaw", "openclaw.mjs");
@@ -985,7 +982,12 @@ async function extractTarball(data, dest) {
985
982
  const tmpFile = p.joinPath(dest, "__tmp.tgz");
986
983
  await p.writeFileBytes(tmpFile, data);
987
984
  try {
988
- await p.exec("tar", ["-xzf", tmpFile, "--strip-components=1", "-C", dest]);
985
+ try {
986
+ const tar = await import("tar");
987
+ await tar.extract({ file: tmpFile, cwd: dest, strip: 1 });
988
+ } catch {
989
+ await p.exec("tar", ["-xzf", tmpFile, "--strip-components=1", "-C", dest]);
990
+ }
989
991
  } finally {
990
992
  try {
991
993
  await p.rm(tmpFile);
@@ -1361,7 +1363,9 @@ var NodePlatformAdapter = class {
1361
1363
  env,
1362
1364
  timeout: options?.timeout,
1363
1365
  maxBuffer: 10 * 1024 * 1024,
1364
- encoding: "utf-8"
1366
+ encoding: "utf-8",
1367
+ shell: process.platform === "win32",
1368
+ windowsHide: true
1365
1369
  },
1366
1370
  (error, stdout, stderr) => {
1367
1371
  const code = error && "code" in error && typeof error.code === "number" ? error.code : error ? 1 : 0;
@@ -1390,6 +1394,8 @@ var NodePlatformAdapter = class {
1390
1394
  cwd: options?.cwd,
1391
1395
  env,
1392
1396
  detached: options?.detached ?? false,
1397
+ shell: process.platform === "win32",
1398
+ windowsHide: true,
1393
1399
  stdio: [
1394
1400
  "ignore",
1395
1401
  stdoutFd != null ? stdoutFd : "ignore",
@@ -1457,6 +1463,9 @@ var NodePlatformAdapter = class {
1457
1463
  env(key) {
1458
1464
  return process.env[key];
1459
1465
  }
1466
+ cwd() {
1467
+ return process.cwd();
1468
+ }
1460
1469
  // ── UI ──────────────────────────────────────────────────
1461
1470
  async openUrl(url) {
1462
1471
  const open = await import("open");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeos-ai/cli",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "description": "BeeOS CLI — run AI agents from your desktop",
6
6
  "bin": {
@@ -21,15 +21,16 @@
21
21
  "prepublishOnly": "pnpm build"
22
22
  },
23
23
  "dependencies": {
24
+ "@noble/ed25519": "^2.2.0",
25
+ "@noble/hashes": "^1.7.0",
24
26
  "commander": "^13.0.0",
25
27
  "open": "^10.1.0",
26
28
  "ora": "^8.1.0",
27
29
  "proper-lockfile": "^4.1.2",
28
- "which": "^5.0.0",
29
- "@noble/ed25519": "^2.2.0",
30
- "@noble/hashes": "^1.7.0",
30
+ "qrcode": "^1.5.4",
31
31
  "smol-toml": "^1.3.0",
32
- "qrcode": "^1.5.4"
32
+ "tar": "^7.5.13",
33
+ "which": "^5.0.0"
33
34
  },
34
35
  "devDependencies": {
35
36
  "@beeos/core": "workspace:*",