@beeos-ai/cli 1.0.14 → 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"() {
@@ -5167,6 +5184,67 @@ var init_fleet_notify = __esm({
5167
5184
  }
5168
5185
  });
5169
5186
 
5187
+ // src/commands/device/upgrade.ts
5188
+ async function upgrade(options = {}) {
5189
+ const reporter = new CliReporter();
5190
+ const outcome = await upgradeBeeosSuite({
5191
+ packages: [NPM_PKGS.DEVICE_AGENT, NPM_PKGS.DEVICE_MCP_SERVER],
5192
+ progress: reporter
5193
+ });
5194
+ reporter.stop();
5195
+ if (outcome.anyFailed) {
5196
+ const failed = outcome.packages.find((p) => p.failed);
5197
+ console.error(
5198
+ `device-agent upgrade had errors: ${failed?.failed ?? "unknown"}
5199
+ Manual fix:
5200
+ npm i -g @beeos-ai/device-agent @beeos-ai/device-mcp-server`
5201
+ );
5202
+ }
5203
+ for (const pkg of outcome.packages) {
5204
+ if (pkg.changed) {
5205
+ console.log(` ${pkg.pkg}: ${pkg.before ?? "(none)"} \u2192 ${pkg.after}`);
5206
+ } else if (!pkg.failed) {
5207
+ console.log(` ${pkg.pkg}: ${pkg.after ?? "(absent)"} (already current)`);
5208
+ }
5209
+ }
5210
+ if (outcome.anyChanged) {
5211
+ const reloadOutcome = await notifyFleetShutdownBestEffort();
5212
+ switch (reloadOutcome) {
5213
+ case "ok":
5214
+ console.log(" Fleet asked to restart \u2014 launchd will bring it up with the new code.");
5215
+ break;
5216
+ case "not_running":
5217
+ console.log(" Fleet is not running \u2014 nothing to restart.");
5218
+ break;
5219
+ case "unknown":
5220
+ console.log(
5221
+ " Fleet restart could not be confirmed; if you see stale behaviour run\n launchctl kickstart -k gui/$(id -u)/ai.beeos.device-fleet # macOS\n or stop & start the fleet manually."
5222
+ );
5223
+ break;
5224
+ }
5225
+ }
5226
+ if (options.bridges !== false) {
5227
+ try {
5228
+ await scrcpyBridgeRuntime.upgrade(reporter);
5229
+ } catch (e) {
5230
+ console.error(`scrcpy-bridge upgrade skipped: ${e}`);
5231
+ }
5232
+ try {
5233
+ await vncBridgeRuntime.upgrade(reporter);
5234
+ } catch (e) {
5235
+ console.error(`vnc-bridge upgrade skipped: ${e}`);
5236
+ }
5237
+ }
5238
+ }
5239
+ var init_upgrade2 = __esm({
5240
+ "src/commands/device/upgrade.ts"() {
5241
+ "use strict";
5242
+ init_dist();
5243
+ init_progress2();
5244
+ init_fleet_notify();
5245
+ }
5246
+ });
5247
+
5170
5248
  // src/commands/device/state.ts
5171
5249
  import lockfile from "proper-lockfile";
5172
5250
  function deviceAgentTargetId(serial) {
@@ -5958,67 +6036,6 @@ var init_exec = __esm({
5958
6036
  }
5959
6037
  });
5960
6038
 
5961
- // src/commands/device/upgrade.ts
5962
- async function upgrade(options = {}) {
5963
- const reporter = new CliReporter();
5964
- const outcome = await upgradeBeeosSuite({
5965
- packages: [NPM_PKGS.DEVICE_AGENT, NPM_PKGS.DEVICE_MCP_SERVER],
5966
- progress: reporter
5967
- });
5968
- reporter.stop();
5969
- if (outcome.anyFailed) {
5970
- const failed = outcome.packages.find((p) => p.failed);
5971
- console.error(
5972
- `device-agent upgrade had errors: ${failed?.failed ?? "unknown"}
5973
- Manual fix:
5974
- npm i -g @beeos-ai/device-agent @beeos-ai/device-mcp-server`
5975
- );
5976
- }
5977
- for (const pkg of outcome.packages) {
5978
- if (pkg.changed) {
5979
- console.log(` ${pkg.pkg}: ${pkg.before ?? "(none)"} \u2192 ${pkg.after}`);
5980
- } else if (!pkg.failed) {
5981
- console.log(` ${pkg.pkg}: ${pkg.after ?? "(absent)"} (already current)`);
5982
- }
5983
- }
5984
- if (outcome.anyChanged) {
5985
- const reloadOutcome = await notifyFleetShutdownBestEffort();
5986
- switch (reloadOutcome) {
5987
- case "ok":
5988
- console.log(" Fleet asked to restart \u2014 launchd will bring it up with the new code.");
5989
- break;
5990
- case "not_running":
5991
- console.log(" Fleet is not running \u2014 nothing to restart.");
5992
- break;
5993
- case "unknown":
5994
- console.log(
5995
- " Fleet restart could not be confirmed; if you see stale behaviour run\n launchctl kickstart -k gui/$(id -u)/ai.beeos.device-fleet # macOS\n or stop & start the fleet manually."
5996
- );
5997
- break;
5998
- }
5999
- }
6000
- if (options.bridges !== false) {
6001
- try {
6002
- await scrcpyBridgeRuntime.upgrade(reporter);
6003
- } catch (e) {
6004
- console.error(`scrcpy-bridge upgrade skipped: ${e}`);
6005
- }
6006
- try {
6007
- await vncBridgeRuntime.upgrade(reporter);
6008
- } catch (e) {
6009
- console.error(`vnc-bridge upgrade skipped: ${e}`);
6010
- }
6011
- }
6012
- }
6013
- var init_upgrade2 = __esm({
6014
- "src/commands/device/upgrade.ts"() {
6015
- "use strict";
6016
- init_dist();
6017
- init_progress2();
6018
- init_fleet_notify();
6019
- }
6020
- });
6021
-
6022
6039
  // src/commands/device/refresh-config.ts
6023
6040
  async function refreshConfig(options = {}) {
6024
6041
  const cfg = await loadOrCreateConfig();
@@ -6629,12 +6646,10 @@ function formatService(s) {
6629
6646
 
6630
6647
  // src/commands/update.ts
6631
6648
  init_dist();
6632
- init_progress2();
6649
+ init_upgrade2();
6633
6650
  async function run4(agentFramework, options = {}) {
6634
6651
  if (agentFramework === "device") {
6635
- const reporter = new CliReporter();
6636
- await deviceRuntime.update(reporter);
6637
- reporter.stop();
6652
+ await upgrade({ bridges: true });
6638
6653
  if (options.json) {
6639
6654
  emitJsonEnvelope(jsonOk({ framework: "device", action: "updated" }));
6640
6655
  } else {
@@ -6756,7 +6771,8 @@ async function run6(options) {
6756
6771
  const resolvedAgentGatewayUrl = resolveAgentGatewayUrl(cfg);
6757
6772
  const agentGatewayHealth = await probeAgentGateway(resolvedAgentGatewayUrl);
6758
6773
  const tools = await collectToolStatus();
6759
- const shimReport = await collectShimReport();
6774
+ const hasBoundDevices = state.devices.entries.length > 0;
6775
+ const shimReport = await collectShimReport(hasBoundDevices);
6760
6776
  const warnings = [];
6761
6777
  const hints = [];
6762
6778
  if (!state.hasIdentity) {
@@ -6822,7 +6838,7 @@ async function run6(options) {
6822
6838
  );
6823
6839
  } else if (e.outcome === "missing") {
6824
6840
  warnings.push(`${e.pkg}: not installed globally \u2014 run 'beeos init' to install.`);
6825
- } else if (e.outcome === "error") {
6841
+ } else if (e.outcome === "error" || e.outcome === "not_installed_yet") {
6826
6842
  }
6827
6843
  }
6828
6844
  if (shimReport.entries.some((e) => e.outcome === "outdated" || e.outcome === "missing")) {
@@ -6923,8 +6939,12 @@ async function collectToolStatus() {
6923
6939
  vncBridge: { path: vncPath }
6924
6940
  };
6925
6941
  }
6926
- async function collectShimReport() {
6942
+ async function collectShimReport(hasBoundDevices) {
6927
6943
  const sources = readPinSourcesFromEnv();
6944
+ const deviceSuite = /* @__PURE__ */ new Set([
6945
+ NPM_PKGS.DEVICE_AGENT,
6946
+ NPM_PKGS.DEVICE_MCP_SERVER
6947
+ ]);
6928
6948
  const entries = await Promise.all(
6929
6949
  ALL_BEEOS_PKGS.map(async (pkg) => {
6930
6950
  const spec = resolveInstallSpec(pkg, sources);
@@ -6934,8 +6954,9 @@ async function collectShimReport() {
6934
6954
  ]);
6935
6955
  let outcome;
6936
6956
  if (latest === null) outcome = "error";
6937
- else if (installed === null) outcome = "missing";
6938
- 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";
6939
6960
  else outcome = "outdated";
6940
6961
  if (pkg === NPM_PKGS.CLI && installed === null) {
6941
6962
  outcome = "missing";
@@ -6953,6 +6974,8 @@ function shimMarker(outcome) {
6953
6974
  return "\u2191";
6954
6975
  case "missing":
6955
6976
  return "\u2717";
6977
+ case "not_installed_yet":
6978
+ return "\xB7";
6956
6979
  case "error":
6957
6980
  return "?";
6958
6981
  }
@@ -7246,19 +7269,22 @@ async function upgradeAndMaybeExit(options) {
7246
7269
  if (options.json) {
7247
7270
  return false;
7248
7271
  }
7249
- 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...");
7250
7274
  const reporter = new CliReporter();
7251
7275
  let outcome;
7252
7276
  try {
7253
7277
  outcome = await upgradeBeeosSuite({
7254
- packages: ALL_BEEOS_PKGS,
7278
+ packages,
7255
7279
  progress: reporter
7256
7280
  });
7257
7281
  } catch (e) {
7258
7282
  reporter.stop();
7259
7283
  console.log(
7260
7284
  ` (upgrade skipped \u2014 ${e instanceof Error ? e.message : String(e)})
7261
- 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\`.`
7262
7288
  );
7263
7289
  return false;
7264
7290
  }
@@ -7267,7 +7293,7 @@ async function upgradeAndMaybeExit(options) {
7267
7293
  const failed = outcome.packages.find((p) => p.failed)?.failed ?? "unknown error";
7268
7294
  console.log(` \u26A0 npm install failed: ${failed}`);
7269
7295
  console.log(
7270
- " 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"
7271
7297
  );
7272
7298
  return false;
7273
7299
  }
@@ -7291,6 +7317,14 @@ async function upgradeAndMaybeExit(options) {
7291
7317
  console.log(" Agents updated. Continuing init...\n");
7292
7318
  return false;
7293
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
+ }
7294
7328
 
7295
7329
  // src/commands/service.ts
7296
7330
  init_dist();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeos-ai/cli",
3
- "version": "1.0.14",
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)