@beeos-ai/cli 1.0.15 → 1.0.16

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.
package/dist/index.js CHANGED
@@ -1206,12 +1206,25 @@ function agentBinCommandAndArgs(bin) {
1206
1206
  return { cmd: process.execPath, args: [bin.script] };
1207
1207
  }
1208
1208
  async function ensureDeviceAgent(progress) {
1209
- const ts = await findExistingTs();
1210
- if (ts) {
1211
- describeFound(ts, progress);
1212
- return ts;
1209
+ const found = await findExistingTs();
1210
+ if (found) {
1211
+ describeFound(found, progress);
1212
+ return found;
1213
1213
  }
1214
- throw new Error(tsNotFoundHint());
1214
+ progress.onStatus("device-agent not found \u2014 installing @beeos-ai/device-agent + @beeos-ai/device-mcp-server (one-time, ~20MB)...");
1215
+ const outcome = await upgradeBeeosSuite({
1216
+ packages: [NPM_PKGS.DEVICE_AGENT, NPM_PKGS.DEVICE_MCP_SERVER],
1217
+ progress
1218
+ });
1219
+ if (outcome.anyFailed) {
1220
+ throw new Error(autoInstallFailedHint(outcome));
1221
+ }
1222
+ const after = await findExistingTs();
1223
+ if (!after) {
1224
+ throw new Error(tsNotFoundHint());
1225
+ }
1226
+ describeFound(after, progress);
1227
+ return after;
1215
1228
  }
1216
1229
  function describeFound(bin, progress) {
1217
1230
  if (bin.type === "executable") {
@@ -1286,7 +1299,11 @@ async function pathDeviceAgent() {
1286
1299
  return null;
1287
1300
  }
1288
1301
  function tsNotFoundHint() {
1289
- return "device-agent (TS) not found.\n\nPick one:\n \u2022 dev (recommended): cd agents/device-agent && pnpm install && pnpm -r build\n \u2022 global: npm i -g @beeos-ai/device-agent\n \u2022 explicit: export BEEOS_DEVICE_AGENT_BIN=/abs/path/to/device-agent[.js]";
1302
+ return "device-agent (TS) not found after auto-install.\n\nThis usually means npm install -g succeeded but the binary is on a\ndifferent PATH than this shell sees (common with nvm/fnm).\n\nPick one:\n \u2022 dev (recommended): cd agents/device-agent && pnpm install && pnpm -r build\n \u2022 global re-install: npm i -g @beeos-ai/device-agent @beeos-ai/device-mcp-server\n \u2022 explicit override: export BEEOS_DEVICE_AGENT_BIN=/abs/path/to/device-agent[.js]";
1303
+ }
1304
+ function autoInstallFailedHint(outcome) {
1305
+ const failed = outcome.packages.filter((p) => p.failed).map((p) => ` \u2022 ${p.pkg}: ${p.failed}`).join("\n");
1306
+ return "Auto-install of the device-agent suite failed.\n\nFailed packages:\n" + failed + "\n\nManual fix (run, then retry `beeos device attach`):\n npm i -g @beeos-ai/device-agent @beeos-ai/device-mcp-server\n\nPin a specific version by exporting before retry:\n export BEEOS_DEVICE_AGENT_VERSION=<semver>\n export BEEOS_MCP_SERVER_VERSION=<semver>";
1290
1307
  }
1291
1308
  var init_device_setup = __esm({
1292
1309
  "../core/dist/device-setup.js"() {
@@ -6754,7 +6771,8 @@ async function run6(options) {
6754
6771
  const resolvedAgentGatewayUrl = resolveAgentGatewayUrl(cfg);
6755
6772
  const agentGatewayHealth = await probeAgentGateway(resolvedAgentGatewayUrl);
6756
6773
  const tools = await collectToolStatus();
6757
- const shimReport = await collectShimReport();
6774
+ const hasBoundDevices = state.devices.entries.length > 0;
6775
+ const shimReport = await collectShimReport(hasBoundDevices);
6758
6776
  const warnings = [];
6759
6777
  const hints = [];
6760
6778
  if (!state.hasIdentity) {
@@ -6820,7 +6838,7 @@ async function run6(options) {
6820
6838
  );
6821
6839
  } else if (e.outcome === "missing") {
6822
6840
  warnings.push(`${e.pkg}: not installed globally \u2014 run 'beeos init' to install.`);
6823
- } else if (e.outcome === "error") {
6841
+ } else if (e.outcome === "error" || e.outcome === "not_installed_yet") {
6824
6842
  }
6825
6843
  }
6826
6844
  if (shimReport.entries.some((e) => e.outcome === "outdated" || e.outcome === "missing")) {
@@ -6921,8 +6939,12 @@ async function collectToolStatus() {
6921
6939
  vncBridge: { path: vncPath }
6922
6940
  };
6923
6941
  }
6924
- async function collectShimReport() {
6942
+ async function collectShimReport(hasBoundDevices) {
6925
6943
  const sources = readPinSourcesFromEnv();
6944
+ const deviceSuite = /* @__PURE__ */ new Set([
6945
+ NPM_PKGS.DEVICE_AGENT,
6946
+ NPM_PKGS.DEVICE_MCP_SERVER
6947
+ ]);
6926
6948
  const entries = await Promise.all(
6927
6949
  ALL_BEEOS_PKGS.map(async (pkg) => {
6928
6950
  const spec = resolveInstallSpec(pkg, sources);
@@ -6932,8 +6954,9 @@ async function collectShimReport() {
6932
6954
  ]);
6933
6955
  let outcome;
6934
6956
  if (latest === null) outcome = "error";
6935
- else if (installed === null) outcome = "missing";
6936
- else if (installed === latest) outcome = "ok";
6957
+ else if (installed === null) {
6958
+ outcome = deviceSuite.has(pkg) && !hasBoundDevices ? "not_installed_yet" : "missing";
6959
+ } else if (installed === latest) outcome = "ok";
6937
6960
  else outcome = "outdated";
6938
6961
  if (pkg === NPM_PKGS.CLI && installed === null) {
6939
6962
  outcome = "missing";
@@ -6951,6 +6974,8 @@ function shimMarker(outcome) {
6951
6974
  return "\u2191";
6952
6975
  case "missing":
6953
6976
  return "\u2717";
6977
+ case "not_installed_yet":
6978
+ return "\xB7";
6954
6979
  case "error":
6955
6980
  return "?";
6956
6981
  }
@@ -7244,19 +7269,22 @@ async function upgradeAndMaybeExit(options) {
7244
7269
  if (options.json) {
7245
7270
  return false;
7246
7271
  }
7247
- console.log("Checking for newer @beeos-ai/cli + agents on npm...");
7272
+ const packages = await pickInstalledPackages();
7273
+ console.log("Checking for newer @beeos-ai/cli on npm...");
7248
7274
  const reporter = new CliReporter();
7249
7275
  let outcome;
7250
7276
  try {
7251
7277
  outcome = await upgradeBeeosSuite({
7252
- packages: ALL_BEEOS_PKGS,
7278
+ packages,
7253
7279
  progress: reporter
7254
7280
  });
7255
7281
  } catch (e) {
7256
7282
  reporter.stop();
7257
7283
  console.log(
7258
7284
  ` (upgrade skipped \u2014 ${e instanceof Error ? e.message : String(e)})
7259
- Tip: re-run \`npm install -g @beeos-ai/cli @beeos-ai/device-agent @beeos-ai/device-mcp-server\` manually.`
7285
+ Tip: re-run \`npm install -g @beeos-ai/cli\` manually. The device
7286
+ suite (device-agent + device-mcp-server) will be auto-installed
7287
+ on the next \`beeos device attach\`.`
7260
7288
  );
7261
7289
  return false;
7262
7290
  }
@@ -7265,7 +7293,7 @@ async function upgradeAndMaybeExit(options) {
7265
7293
  const failed = outcome.packages.find((p) => p.failed)?.failed ?? "unknown error";
7266
7294
  console.log(` \u26A0 npm install failed: ${failed}`);
7267
7295
  console.log(
7268
- " Manual fix:\n npm i -g @beeos-ai/cli @beeos-ai/device-agent @beeos-ai/device-mcp-server\n"
7296
+ " Manual fix:\n npm i -g @beeos-ai/cli\n (the device suite is auto-installed on `beeos device attach`)\n"
7269
7297
  );
7270
7298
  return false;
7271
7299
  }
@@ -7289,6 +7317,14 @@ async function upgradeAndMaybeExit(options) {
7289
7317
  console.log(" Agents updated. Continuing init...\n");
7290
7318
  return false;
7291
7319
  }
7320
+ async function pickInstalledPackages() {
7321
+ const packages = [NPM_PKGS.CLI];
7322
+ for (const pkg of [NPM_PKGS.DEVICE_AGENT, NPM_PKGS.DEVICE_MCP_SERVER]) {
7323
+ const installed = await npmGlobalVersion(pkg).catch(() => null);
7324
+ if (installed !== null) packages.push(pkg);
7325
+ }
7326
+ return packages;
7327
+ }
7292
7328
 
7293
7329
  // src/commands/service.ts
7294
7330
  init_dist();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeos-ai/cli",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "type": "module",
5
5
  "description": "BeeOS CLI — run AI agents from your desktop",
6
6
  "bin": {
@@ -29,24 +29,30 @@
29
29
  # bootstrap requests).
30
30
  # BEEOS_DASHBOARD_URL Dashboard base (OAuth + bind redirect).
31
31
  # BEEOS_DEVICE_AGENT_VERSION Pin @beeos-ai/device-agent semver.
32
- # BEEOS_MCP_SERVER_VERSION Pin @beeos-ai/device-mcp-server semver.
32
+ # NOT consumed by this script (CLI ≥ 1.0.16
33
+ # installs the device suite lazily on the
34
+ # first `beeos device attach`); export it
35
+ # in the shell that runs `beeos device
36
+ # attach` instead.
37
+ # BEEOS_MCP_SERVER_VERSION Same as above, for @beeos-ai/device-mcp-server.
33
38
  # BEEOS_USE_NPX=1 (Power-user escape hatch) Use `npx` for a
34
39
  # throwaway install. `beeos` will NOT
35
40
  # persist on PATH after the script exits.
36
41
  # Default behaviour (since CLI 1.0.11) is
37
- # always `npm install -g` so the CLI plus
38
- # the device-agent suite are both globally
39
- # available for follow-up commands.
42
+ # always `npm install -g` so the CLI is
43
+ # globally available for follow-up commands.
44
+ # The device-agent suite is no longer
45
+ # eagerly installed (CLI ≥ 1.0.16); see
46
+ # `web/packages/core/src/device-setup.ts`.
40
47
  #
41
- # Example: bare-metal one-shot staging install, including device-agent
42
- # version pin and OAuth landing on the staging dashboard:
48
+ # Example: bare-metal one-shot staging install (no device-agent pin —
49
+ # add `BEEOS_DEVICE_AGENT_VERSION=...` to the shell when you later run
50
+ # `beeos device attach` if you need to pin a specific build):
43
51
  #
44
52
  # BEEOS_API_URL=https://public-api-staging.beeos.ai \
45
53
  # BEEOS_AGENT_GATEWAY_URL=https://agent-gw-staging.beeos.ai \
46
54
  # BEEOS_DASHBOARD_URL=https://beeos-staging-web.vercel.app \
47
- # BEEOS_DEVICE_AGENT_VERSION=0.4.2 \
48
- # BEEOS_MCP_SERVER_VERSION=0.2.3 \
49
- # curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.11
55
+ # curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.16
50
56
 
51
57
  set -euo pipefail
52
58
 
@@ -59,16 +65,11 @@ RED="\033[31m"
59
65
  CYAN="\033[36m"
60
66
 
61
67
  CLI_PACKAGE="@beeos-ai/cli@latest"
62
- # Sibling packages installed alongside the CLI so that `beeos device attach`
63
- # works on a clean machine without further `npm i -g` steps (a.k.a. the
64
- # "fleet ready" install strategy see agents/device-agent/ARCHITECTURE.md
65
- # for the 0.2.0+ sibling-pair topology between device-agent and
66
- # device-mcp-server). Their versions are independent of `--version` (which
67
- # only pins the CLI) — both packages follow their own semver. Override via
68
- # BEEOS_DEVICE_AGENT_VERSION / BEEOS_MCP_SERVER_VERSION when you need to
69
- # pin a specific build (e.g. for a staging smoke test).
70
- DEVICE_AGENT_PACKAGE="@beeos-ai/device-agent@${BEEOS_DEVICE_AGENT_VERSION:-latest}"
71
- MCP_SERVER_PACKAGE="@beeos-ai/device-mcp-server@${BEEOS_MCP_SERVER_VERSION:-latest}"
68
+ # `@beeos-ai/device-agent` + `@beeos-ai/device-mcp-server` are NOT
69
+ # installed here. CLI 1.0.16 installs them lazily on the first
70
+ # `beeos device attach` via `ensureDeviceAgent` in
71
+ # `web/packages/core/src/device-setup.ts`. OpenClaw-only users never
72
+ # download the device suite at all.
72
73
  MIN_NODE_VERSION=18
73
74
  NVM_VERSION="v0.40.1"
74
75
  FNM_INSTALL_URL="https://fnm.vercel.app/install"
@@ -479,35 +480,6 @@ prompt_existing_install_action() {
479
480
  esac
480
481
  }
481
482
 
482
- # ── Device-agent sibling suite installer ─────────────────────
483
- #
484
- # Installs `@beeos-ai/device-agent` + `@beeos-ai/device-mcp-server` globally
485
- # so the very first `beeos device attach` on a clean machine does not need
486
- # to fetch them separately. `@beeos-ai/device-common` is pulled
487
- # transitively as a `dependencies` entry of both — no separate install
488
- # needed.
489
- #
490
- # Failure here is NEVER fatal: the CLI itself was already installed
491
- # successfully, and `beeos device attach` will prompt to install missing
492
- # pieces via ensureDeviceAgent on first use. We just emit a WARN with the
493
- # manual recovery command.
494
- install_device_agent_suite() {
495
- if ! command -v npm &>/dev/null; then
496
- warn "npm not available — skipping device-agent suite install."
497
- warn "Manual fix: install Node + run \`npm i -g ${DEVICE_AGENT_PACKAGE} ${MCP_SERVER_PACKAGE}\`."
498
- return 0
499
- fi
500
-
501
- info "Installing device-agent suite (${DEVICE_AGENT_PACKAGE}, ${MCP_SERVER_PACKAGE})..."
502
- if npm install -g "$DEVICE_AGENT_PACKAGE" "$MCP_SERVER_PACKAGE"; then
503
- success "device-agent suite installed."
504
- else
505
- warn "Failed to install device-agent suite — \`beeos device attach\` will prompt for it on first use."
506
- warn "Manual fix: npm i -g ${DEVICE_AGENT_PACKAGE} ${MCP_SERVER_PACKAGE}"
507
- fi
508
- return 0
509
- }
510
-
511
483
  # ── Main ─────────────────────────────────────────────────────
512
484
 
513
485
  run_cli() {
@@ -528,16 +500,11 @@ run_cli() {
528
500
 
529
501
  # ALWAYS install globally. We previously branched to `npx --yes` when
530
502
  # available so curl|bash users got a throwaway install, but that
531
- # silently broke the post-install UX:
532
- # - `beeos` was not on PATH after the script exited, so the user's
533
- # next step (`beeos device attach`) failed with `command not found`
534
- # and the obvious recovery (re-run the one-liner) hit the
535
- # "existing install" prompt because some state in ~/.beeos
536
- # persisted, leaving the user stuck.
537
- # - The device-agent suite was deliberately skipped on the npx
538
- # branch, so even if the user re-ran via `npm i -g`, the very
539
- # next `beeos device attach` had to bootstrap device-agent
540
- # itself.
503
+ # silently broke the post-install UX: `beeos` was not on PATH after
504
+ # the script exited, so the user's next step (`beeos device attach`)
505
+ # failed with `command not found` and the obvious recovery (re-run
506
+ # the one-liner) hit the "existing install" prompt because some
507
+ # state in ~/.beeos persisted, leaving the user stuck.
541
508
  # Power users who explicitly want the old throwaway behaviour can set
542
509
  # `BEEOS_USE_NPX=1`. Default is global install.
543
510
  if [[ "${BEEOS_USE_NPX:-}" == "1" ]] && command -v npx &>/dev/null; then
@@ -567,10 +534,13 @@ run_cli() {
567
534
  error " use a node version manager (nvm / fnm) or sudo"
568
535
  exit 1
569
536
  fi
570
- install_device_agent_suite
571
- # NPM succeeded AND device-agent suite either installed or skipped
572
- # with a warning. Fire the "CLI is reachable on PATH" event before
573
- # exec exec replaces our process so this is the last chance.
537
+ # NPM succeeded — CLI is now on PATH. The device-agent suite is
538
+ # deliberately NOT installed here; `beeos device attach` will
539
+ # auto-install it on first use via `ensureDeviceAgent` (see
540
+ # `web/packages/core/src/device-setup.ts`). OpenClaw-only users
541
+ # never download those ~20MB. Fire the "CLI is reachable on PATH"
542
+ # event before exec — exec replaces our process so this is the
543
+ # last chance.
574
544
  send_telemetry "install.bootstrap.cli_installed"
575
545
  exec beeos "$subcmd" "$@" <"$stdin_src"
576
546
  }
@@ -634,7 +604,10 @@ main() {
634
604
  error " use a node version manager (nvm / fnm) or sudo"
635
605
  exit 1
636
606
  fi
637
- install_device_agent_suite
607
+ # Device-agent suite is intentionally NOT upgraded here.
608
+ # `beeos device upgrade` is the canonical refresh path (it
609
+ # also restarts the running fleet); the install-script
610
+ # upgrade prompt only refreshes the CLI itself.
638
611
  fi
639
612
  ;;
640
613
  rerun)