@beeos-ai/cli 1.0.6 → 1.0.8

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
@@ -1881,7 +1881,7 @@ var init_scrcpy_bridge = __esm({
1881
1881
  },
1882
1882
  /**
1883
1883
  * Build the environment map used when launching scrcpy-bridge for a
1884
- * device. Exposed separately so the supervisor target-spec builder
1884
+ * device. Exposed separately so the service target-spec builder
1885
1885
  * can reuse the same logic without duplicating it.
1886
1886
  *
1887
1887
  * scrcpy-bridge authenticates to EMQX exclusively via Agent Gateway
@@ -1911,8 +1911,8 @@ var init_scrcpy_bridge = __esm({
1911
1911
  },
1912
1912
  /**
1913
1913
  * Spawn scrcpy-bridge detached for a single device. Kept for callers
1914
- * that haven't migrated to the supervisor yet — new code should use
1915
- * `buildScrcpyBridgeTargetSpec` + supervisor `upsertTarget` instead.
1914
+ * that haven't migrated to the service manager yet — new code should
1915
+ * use `buildScrcpyBridgeTargetSpec` + `ServiceManager.install`.
1916
1916
  */
1917
1917
  async spawnForDevice(opts, progress) {
1918
1918
  const binary = await this.ensureInstalled(progress);
@@ -1963,7 +1963,7 @@ var init_vnc_bridge = __esm({
1963
1963
  },
1964
1964
  /**
1965
1965
  * Build the environment map used when launching vnc-bridge for a
1966
- * device. Exposed separately so the supervisor target-spec builder
1966
+ * device. Exposed separately so the service target-spec builder
1967
1967
  * can reuse the same logic without duplicating it.
1968
1968
  */
1969
1969
  buildEnv(opts) {
@@ -1989,8 +1989,8 @@ var init_vnc_bridge = __esm({
1989
1989
  },
1990
1990
  /**
1991
1991
  * Spawn vnc-bridge detached for a single device. Kept for callers
1992
- * that haven't migrated to the supervisor yet — new code should use
1993
- * `buildVncBridgeTargetSpec` + supervisor `upsertTarget` instead.
1992
+ * that haven't migrated to the service manager yet — new code should
1993
+ * use `buildVncBridgeTargetSpec` + `ServiceManager.install`.
1994
1994
  */
1995
1995
  async spawnForDevice(opts, progress) {
1996
1996
  const binary = await this.ensureInstalled(progress);
@@ -2091,7 +2091,6 @@ async function detectExistingInstall() {
2091
2091
  try {
2092
2092
  binding = await loadBindingInfo();
2093
2093
  } catch {
2094
- binding = null;
2095
2094
  }
2096
2095
  const openclaw = await detectOpenclaw();
2097
2096
  const devices = await detectDevices();
@@ -2178,7 +2177,6 @@ async function detectSupervisor() {
2178
2177
  try {
2179
2178
  ipcReachable = await p.exists(ipcPath);
2180
2179
  } catch {
2181
- ipcReachable = false;
2182
2180
  }
2183
2181
  let targets = [];
2184
2182
  if (await p.exists(stateFile)) {
@@ -2255,7 +2253,46 @@ var init_detect = __esm({
2255
2253
  }
2256
2254
  });
2257
2255
 
2258
- // ../core/dist/supervisor-spec.js
2256
+ // ../core/dist/framework/registry.js
2257
+ function listFrameworks() {
2258
+ return REGISTRY;
2259
+ }
2260
+ function availableFrameworks() {
2261
+ return REGISTRY.filter((f) => f.status === "available");
2262
+ }
2263
+ function frameworkById(id) {
2264
+ return REGISTRY.find((f) => f.id === id);
2265
+ }
2266
+ function defaultFrameworkId() {
2267
+ return "openclaw";
2268
+ }
2269
+ var REGISTRY;
2270
+ var init_registry2 = __esm({
2271
+ "../core/dist/framework/registry.js"() {
2272
+ "use strict";
2273
+ init_registry();
2274
+ REGISTRY = [
2275
+ {
2276
+ id: "openclaw",
2277
+ displayName: "OpenClaw",
2278
+ description: "Self-hosted autonomous coding agent (default)",
2279
+ status: "available",
2280
+ driver: openClawDriver,
2281
+ npmPackage: openClawDriver.npmPackage()
2282
+ }
2283
+ // Future entries land here. Example (commented to keep the menu
2284
+ // clean until the real driver ships):
2285
+ // {
2286
+ // id: "hermes",
2287
+ // displayName: "Hermes",
2288
+ // description: "Hermes multi-model agent",
2289
+ // status: "coming-soon",
2290
+ // },
2291
+ ];
2292
+ }
2293
+ });
2294
+
2295
+ // ../core/dist/service-target-spec.js
2259
2296
  function buildOpenclawTargetSpec(ctx) {
2260
2297
  const isMjs = ctx.agentBinary.endsWith(".mjs") || ctx.agentBinary.endsWith(".js");
2261
2298
  const command = isMjs ? "node" : ctx.agentBinary;
@@ -2326,8 +2363,8 @@ function buildVncBridgeTargetSpec(binary, opts) {
2326
2363
  label: `vnc-bridge (${opts.deviceId})`
2327
2364
  };
2328
2365
  }
2329
- var init_supervisor_spec = __esm({
2330
- "../core/dist/supervisor-spec.js"() {
2366
+ var init_service_target_spec = __esm({
2367
+ "../core/dist/service-target-spec.js"() {
2331
2368
  "use strict";
2332
2369
  init_scrcpy_bridge();
2333
2370
  init_vnc_bridge();
@@ -2592,7 +2629,7 @@ var init_launchd = __esm({
2592
2629
  }
2593
2630
  }
2594
2631
  async list() {
2595
- let stdout = "";
2632
+ let stdout;
2596
2633
  try {
2597
2634
  ({ stdout } = await execFileP("launchctl", ["list"]));
2598
2635
  } catch {
@@ -2847,7 +2884,7 @@ var init_systemd = __esm({
2847
2884
  }
2848
2885
  async list() {
2849
2886
  const results = [];
2850
- let unitFiles = [];
2887
+ let unitFiles;
2851
2888
  try {
2852
2889
  unitFiles = (await fs2.readdir(this.unitDir)).filter((f) => f.startsWith(SYSTEMD_PREFIX) && f.endsWith(".service"));
2853
2890
  } catch {
@@ -3070,7 +3107,7 @@ var init_task_scheduler = __esm({
3070
3107
  }
3071
3108
  }
3072
3109
  async list() {
3073
- let stdout = "";
3110
+ let stdout;
3074
3111
  try {
3075
3112
  ({ stdout } = await execFileP3("schtasks", ["/Query", "/FO", "CSV"]));
3076
3113
  } catch {
@@ -3235,7 +3272,7 @@ ${spec.id}
3235
3272
  };
3236
3273
  }
3237
3274
  async list() {
3238
- let files = [];
3275
+ let files;
3239
3276
  try {
3240
3277
  files = (await fs4.readdir(this.stateDir)).filter((f) => f.endsWith(".json"));
3241
3278
  } catch {
@@ -3494,7 +3531,8 @@ var init_dist = __esm({
3494
3531
  init_registry();
3495
3532
  init_local_agent();
3496
3533
  init_detect();
3497
- init_supervisor_spec();
3534
+ init_registry2();
3535
+ init_service_target_spec();
3498
3536
  init_services();
3499
3537
  }
3500
3538
  });
@@ -4263,15 +4301,20 @@ async function run(agentFramework, options) {
4263
4301
  await ensureDirs();
4264
4302
  const cfg = await loadOrCreateConfig();
4265
4303
  const reporter = new CliReporter();
4266
- if (agentFramework !== "openclaw") {
4267
- throw new Error(`Agent framework '${agentFramework}' is not yet supported. Use 'openclaw'.`);
4304
+ const descriptor = frameworkById(agentFramework);
4305
+ if (!descriptor || descriptor.status !== "available") {
4306
+ const avail = availableFrameworks().map((f) => f.id).join(", ");
4307
+ throw new Error(
4308
+ `Agent framework '${agentFramework}' is not available. Available: ${avail}.`
4309
+ );
4268
4310
  }
4311
+ const driver = descriptor.driver;
4269
4312
  const identity = await loadOrCreateIdentity();
4270
4313
  const fp = fingerprint(identity);
4271
4314
  const pubkey = publicKeyB64(identity);
4272
4315
  const keyFile = p.joinPath(beeoHome(), "identity", "keypair.json");
4273
4316
  const gwToken = await loadOrCreateGatewayToken();
4274
- const location = await findAgent(openClawDriver);
4317
+ const location = await findAgent(driver);
4275
4318
  let binary;
4276
4319
  let home;
4277
4320
  let isSystemHome = false;
@@ -4314,8 +4357,8 @@ async function run(agentFramework, options) {
4314
4357
  }
4315
4358
  }
4316
4359
  } else {
4317
- reporter.onStatus(`Downloading ${openClawDriver.npmPackage()}...`);
4318
- await downloadAgent(openClawDriver.npmPackage(), options.version ?? void 0, agentFramework, reporter);
4360
+ reporter.onStatus(`Downloading ${driver.npmPackage()}...`);
4361
+ await downloadAgent(driver.npmPackage(), options.version ?? void 0, agentFramework, reporter);
4319
4362
  home = agentHome(agentFramework);
4320
4363
  await p.mkdir(home);
4321
4364
  await ensurePlugin(agentFramework, home, reporter);
@@ -4499,7 +4542,6 @@ async function run3() {
4499
4542
  try {
4500
4543
  services = await mgr.list();
4501
4544
  } catch {
4502
- services = [];
4503
4545
  }
4504
4546
  if (services.length === 0) {
4505
4547
  console.log(" (no services registered)");
@@ -4839,13 +4881,15 @@ async function run7(options) {
4839
4881
  if (decision === "rebind-keep-key" || decision === "rebind-new-key") {
4840
4882
  await removeBindingInfo();
4841
4883
  }
4842
- const framework = options.framework ?? "openclaw";
4843
- if (framework !== "openclaw") {
4884
+ const frameworkId = await decideFramework(state, decision, options);
4885
+ const descriptor = frameworkById(frameworkId);
4886
+ if (!descriptor || descriptor.status !== "available") {
4887
+ const avail = availableFrameworks().map((f) => f.id).join(", ");
4844
4888
  throw new Error(
4845
- `Agent framework '${framework}' is not yet supported. Only 'openclaw' is available today.`
4889
+ `Agent framework '${frameworkId}' is not available. Available: ${avail}.`
4846
4890
  );
4847
4891
  }
4848
- await run(framework, {
4892
+ await run(descriptor.id, {
4849
4893
  force: true,
4850
4894
  json: options.json,
4851
4895
  browser: options.browser !== false
@@ -4883,6 +4927,53 @@ async function decideAction(state, options) {
4883
4927
  }
4884
4928
  return choice.options[idx - 1];
4885
4929
  }
4930
+ async function decideFramework(state, decision, options) {
4931
+ if (options.framework && options.framework.trim()) {
4932
+ return options.framework.trim();
4933
+ }
4934
+ if (state.binding && (decision === "upgrade" || decision === "rebind-keep-key")) {
4935
+ return defaultFrameworkId();
4936
+ }
4937
+ if (options.yes || options.json || !process.stdin.isTTY) {
4938
+ return defaultFrameworkId();
4939
+ }
4940
+ const all = listFrameworks();
4941
+ const avail = availableFrameworks();
4942
+ if (avail.length <= 1) {
4943
+ const only = avail[0];
4944
+ if (only) {
4945
+ console.log(`Installing ${only.displayName} (only available framework).`);
4946
+ return only.id;
4947
+ }
4948
+ return defaultFrameworkId();
4949
+ }
4950
+ console.log("");
4951
+ console.log("Choose agent framework:");
4952
+ const def = defaultFrameworkId();
4953
+ all.forEach((f, i) => {
4954
+ const marker = f.id === def ? "*" : " ";
4955
+ const tag = f.status === "coming-soon" ? " [coming soon]" : "";
4956
+ const padName = f.displayName.padEnd(12);
4957
+ console.log(` ${marker} [${i + 1}] ${padName} ${f.description}${tag}`);
4958
+ });
4959
+ console.log("");
4960
+ const defaultIdx = all.findIndex((f) => f.id === def) + 1;
4961
+ const answer = await prompt(`Choose [1-${all.length}] (default ${defaultIdx}): `);
4962
+ const trimmed = answer.trim();
4963
+ if (!trimmed) return def;
4964
+ const idx = parseInt(trimmed, 10);
4965
+ if (!Number.isFinite(idx) || idx < 1 || idx > all.length) {
4966
+ return def;
4967
+ }
4968
+ const picked = all[idx - 1];
4969
+ if (picked.status !== "available") {
4970
+ console.log(
4971
+ ` ${picked.displayName} is not yet available. Falling back to ${def}.`
4972
+ );
4973
+ return def;
4974
+ }
4975
+ return picked.id;
4976
+ }
4886
4977
  async function maybePromptServiceInstall() {
4887
4978
  try {
4888
4979
  const mgr = await getServiceManager();
@@ -4983,7 +5074,6 @@ async function uninstall(options) {
4983
5074
  try {
4984
5075
  services = await mgr.list();
4985
5076
  } catch {
4986
- services = [];
4987
5077
  }
4988
5078
  const removed = [];
4989
5079
  const errors = [];
@@ -5013,7 +5103,6 @@ async function status(options) {
5013
5103
  try {
5014
5104
  services = await mgr.list();
5015
5105
  } catch {
5016
- services = [];
5017
5106
  }
5018
5107
  if (options.json) {
5019
5108
  console.log(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beeos-ai/cli",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "description": "BeeOS CLI — run AI agents from your desktop",
6
6
  "bin": {
@@ -191,6 +191,15 @@ function Invoke-BeeosCli {
191
191
  } else {
192
192
  Write-BeeWarn "npx not found, installing globally..."
193
193
  & npm install -g $CliPackage
194
+ if ($LASTEXITCODE -ne 0) {
195
+ Write-BeeError "npm install -g $CliPackage failed."
196
+ Write-BeeError ""
197
+ Write-BeeError "Common fixes:"
198
+ Write-BeeError " - EEXIST on beeos from another package:"
199
+ Write-BeeError " npm uninstall -g beeos # then re-run installer"
200
+ Write-BeeError " - EACCES / permission error: run PowerShell as Administrator"
201
+ exit 1
202
+ }
194
203
  & beeos @args
195
204
  }
196
205
  }
@@ -304,7 +304,16 @@ run_cli() {
304
304
  exec npx --yes "$CLI_PACKAGE" "$subcmd" "$@"
305
305
  else
306
306
  warn "npx not found, installing globally..."
307
- npm install -g "$CLI_PACKAGE"
307
+ if ! npm install -g "$CLI_PACKAGE"; then
308
+ error "npm install -g ${CLI_PACKAGE} failed."
309
+ error ""
310
+ error "Common fixes:"
311
+ error " - EEXIST on /bin/beeos from another package:"
312
+ error " npm uninstall -g beeos # then re-run installer"
313
+ error " - EACCES permission error:"
314
+ error " use a node version manager (nvm / fnm) or sudo"
315
+ exit 1
316
+ fi
308
317
  exec beeos "$subcmd" "$@"
309
318
  fi
310
319
  }