@beeos-ai/cli 1.0.10 → 1.0.11
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 +69 -6
- package/package.json +1 -1
- package/scripts/install.ps1 +41 -23
- package/scripts/install.sh +45 -22
package/dist/index.js
CHANGED
|
@@ -4335,6 +4335,8 @@ var init_state = __esm({
|
|
|
4335
4335
|
});
|
|
4336
4336
|
|
|
4337
4337
|
// src/commands/device/attach.ts
|
|
4338
|
+
import { spawn as spawn2 } from "child_process";
|
|
4339
|
+
import readline from "readline";
|
|
4338
4340
|
async function attach(options) {
|
|
4339
4341
|
const cfg = await loadOrCreateConfig();
|
|
4340
4342
|
const reporter = new CliReporter();
|
|
@@ -4418,7 +4420,7 @@ async function attach(options) {
|
|
|
4418
4420
|
throw e;
|
|
4419
4421
|
}
|
|
4420
4422
|
});
|
|
4421
|
-
await maybeNotifyFleetWithHint();
|
|
4423
|
+
await maybeNotifyFleetWithHint(cfg);
|
|
4422
4424
|
}
|
|
4423
4425
|
async function attachAll(cfg, reporter, withVideo, options) {
|
|
4424
4426
|
const devices = await deviceRuntime.listAdbDevices();
|
|
@@ -4493,7 +4495,7 @@ async function attachAll(cfg, reporter, withVideo, options) {
|
|
|
4493
4495
|
await saveDeviceState(state);
|
|
4494
4496
|
console.log(`Attached ${committed.length} device(s); supervision via device-agent fleet.`);
|
|
4495
4497
|
});
|
|
4496
|
-
await maybeNotifyFleetWithHint();
|
|
4498
|
+
await maybeNotifyFleetWithHint(cfg);
|
|
4497
4499
|
}
|
|
4498
4500
|
function commitAttachResults(state, commits) {
|
|
4499
4501
|
const committed = [];
|
|
@@ -4587,9 +4589,70 @@ async function installService(mgr, spec) {
|
|
|
4587
4589
|
maybePrintFallbackBanner(mgr.kind);
|
|
4588
4590
|
await mgr.install(spec);
|
|
4589
4591
|
}
|
|
4590
|
-
async function maybeNotifyFleetWithHint() {
|
|
4592
|
+
async function maybeNotifyFleetWithHint(cfg) {
|
|
4591
4593
|
const outcome = await notifyFleetReloadBestEffort();
|
|
4592
|
-
if (outcome
|
|
4594
|
+
if (outcome !== "not_running") return;
|
|
4595
|
+
if (!shouldOfferFleetEnable()) {
|
|
4596
|
+
printFleetNotRunningHint();
|
|
4597
|
+
return;
|
|
4598
|
+
}
|
|
4599
|
+
console.log("");
|
|
4600
|
+
console.log("device-agent fleet is not running yet. Until you start");
|
|
4601
|
+
console.log("it, the device is recorded in ~/.beeos/devices.json but");
|
|
4602
|
+
console.log("no process is supervising the per-device agent.");
|
|
4603
|
+
console.log("");
|
|
4604
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
4605
|
+
const answer = await new Promise((resolve) => {
|
|
4606
|
+
rl.question("Enable fleet now (registers a launchd service)? [Y/n]: ", (a) => {
|
|
4607
|
+
rl.close();
|
|
4608
|
+
resolve(a);
|
|
4609
|
+
});
|
|
4610
|
+
});
|
|
4611
|
+
const yes = answer.trim() === "" || /^y(es)?$/i.test(answer.trim());
|
|
4612
|
+
if (!yes) {
|
|
4613
|
+
printFleetNotRunningHint();
|
|
4614
|
+
return;
|
|
4615
|
+
}
|
|
4616
|
+
const ok = await runDeviceAgentFleetEnable(cfg);
|
|
4617
|
+
if (!ok) {
|
|
4618
|
+
console.error("");
|
|
4619
|
+
console.error("fleet enable did not complete cleanly. Re-run manually:");
|
|
4620
|
+
console.error(" device-agent fleet enable --agent-gateway-url <URL>");
|
|
4621
|
+
console.error("");
|
|
4622
|
+
printFleetNotRunningHint();
|
|
4623
|
+
return;
|
|
4624
|
+
}
|
|
4625
|
+
console.log("");
|
|
4626
|
+
console.log("fleet enabled \u2014 supervised processes should come up within a few seconds.");
|
|
4627
|
+
console.log("Check status with: device-agent fleet devices");
|
|
4628
|
+
}
|
|
4629
|
+
function shouldOfferFleetEnable(inputs = {
|
|
4630
|
+
platform: process.platform,
|
|
4631
|
+
stdinIsTTY: process.stdin.isTTY,
|
|
4632
|
+
stdoutIsTTY: process.stdout.isTTY,
|
|
4633
|
+
env: process.env
|
|
4634
|
+
}) {
|
|
4635
|
+
if (inputs.platform !== "darwin") return false;
|
|
4636
|
+
if (inputs.env.BEEOS_NO_FLEET_AUTOSTART === "1") return false;
|
|
4637
|
+
if (!inputs.stdinIsTTY) return false;
|
|
4638
|
+
if (!inputs.stdoutIsTTY) return false;
|
|
4639
|
+
return true;
|
|
4640
|
+
}
|
|
4641
|
+
async function runDeviceAgentFleetEnable(cfg) {
|
|
4642
|
+
const agentGatewayUrl = resolveAgentGatewayUrl(cfg);
|
|
4643
|
+
return new Promise((resolve) => {
|
|
4644
|
+
try {
|
|
4645
|
+
const child = spawn2(
|
|
4646
|
+
"device-agent",
|
|
4647
|
+
["fleet", "enable", "--agent-gateway-url", agentGatewayUrl],
|
|
4648
|
+
{ stdio: "inherit" }
|
|
4649
|
+
);
|
|
4650
|
+
child.once("close", (code) => resolve(code === 0));
|
|
4651
|
+
child.once("error", () => resolve(false));
|
|
4652
|
+
} catch {
|
|
4653
|
+
resolve(false);
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4593
4656
|
}
|
|
4594
4657
|
async function registerVideoBridge(_mgr, reporter, params) {
|
|
4595
4658
|
if (!params.withVideo) return { mode: "none" };
|
|
@@ -5388,7 +5451,7 @@ init_device2();
|
|
|
5388
5451
|
|
|
5389
5452
|
// src/commands/init.ts
|
|
5390
5453
|
init_dist();
|
|
5391
|
-
import
|
|
5454
|
+
import readline2 from "readline";
|
|
5392
5455
|
|
|
5393
5456
|
// src/commands/doctor.ts
|
|
5394
5457
|
init_dist();
|
|
@@ -5833,7 +5896,7 @@ function printNextSteps() {
|
|
|
5833
5896
|
console.log("");
|
|
5834
5897
|
}
|
|
5835
5898
|
function prompt(question) {
|
|
5836
|
-
const rl =
|
|
5899
|
+
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
5837
5900
|
return new Promise((resolve) => {
|
|
5838
5901
|
rl.question(question, (answer) => {
|
|
5839
5902
|
rl.close();
|
package/package.json
CHANGED
package/scripts/install.ps1
CHANGED
|
@@ -24,6 +24,15 @@
|
|
|
24
24
|
$env:BEEOS_DASHBOARD_URL Dashboard base (OAuth + bind redirect).
|
|
25
25
|
$env:BEEOS_DEVICE_AGENT_VERSION Pin @beeos-ai/device-agent semver.
|
|
26
26
|
$env:BEEOS_MCP_SERVER_VERSION Pin @beeos-ai/device-mcp-server semver.
|
|
27
|
+
$env:BEEOS_USE_NPX = "1" Power-user escape hatch: use `npx`
|
|
28
|
+
for a throwaway install. `beeos`
|
|
29
|
+
will NOT persist on PATH after
|
|
30
|
+
the script exits. Default
|
|
31
|
+
behaviour (since CLI 1.0.11) is
|
|
32
|
+
always `npm install -g` so the
|
|
33
|
+
CLI plus the device-agent suite
|
|
34
|
+
are both globally available for
|
|
35
|
+
follow-up commands.
|
|
27
36
|
|
|
28
37
|
.EXAMPLE
|
|
29
38
|
# One-liner (PowerShell 5+):
|
|
@@ -38,11 +47,11 @@
|
|
|
38
47
|
.\install.ps1 -Device
|
|
39
48
|
|
|
40
49
|
.EXAMPLE
|
|
41
|
-
# Bare-metal one-shot staging install (CLI >= 1.0.
|
|
50
|
+
# Bare-metal one-shot staging install (CLI >= 1.0.11):
|
|
42
51
|
$env:BEEOS_API_URL = "https://public-api-staging.beeos.ai"
|
|
43
52
|
$env:BEEOS_AGENT_GATEWAY_URL = "https://agent-gw-staging.beeos.ai"
|
|
44
53
|
$env:BEEOS_DASHBOARD_URL = "https://beeos-staging-web.vercel.app"
|
|
45
|
-
$env:BEEOS_DEVICE_AGENT_VERSION = "0.4.
|
|
54
|
+
$env:BEEOS_DEVICE_AGENT_VERSION = "0.4.2"
|
|
46
55
|
$env:BEEOS_MCP_SERVER_VERSION = "0.2.3"
|
|
47
56
|
irm https://beeos.ai/install.ps1 | iex
|
|
48
57
|
#>
|
|
@@ -333,32 +342,41 @@ function Invoke-BeeosCli {
|
|
|
333
342
|
[string[]]$ExtraArgs
|
|
334
343
|
)
|
|
335
344
|
|
|
336
|
-
$npxPath = Get-Command npx -ErrorAction SilentlyContinue
|
|
337
345
|
$args = @($Subcommand)
|
|
338
346
|
if ($ExtraArgs) { $args += $ExtraArgs }
|
|
339
347
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
348
|
+
# ALWAYS install globally. Pre-1.0.11 we branched into `npx --yes`
|
|
349
|
+
# when available, which gave irm|iex users a throwaway install but
|
|
350
|
+
# silently broke their next step (`beeos device attach`) because
|
|
351
|
+
# `beeos` was not on PATH after the script exited. Power users who
|
|
352
|
+
# explicitly want the old throwaway behaviour can set
|
|
353
|
+
# `$env:BEEOS_USE_NPX = "1"`.
|
|
354
|
+
$npxPath = Get-Command npx -ErrorAction SilentlyContinue
|
|
355
|
+
if ($env:BEEOS_USE_NPX -eq "1" -and $npxPath) {
|
|
356
|
+
Write-BeeWarn "BEEOS_USE_NPX=1 — using throwaway npx install (beeos won't persist on PATH)."
|
|
346
357
|
& npx --yes $CliPackage @args
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
358
|
+
return
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
$npmPath = Get-Command npm -ErrorAction SilentlyContinue
|
|
362
|
+
if (-not $npmPath) {
|
|
363
|
+
Write-BeeError "npm not found — install Node.js first (this script tries that for you)."
|
|
364
|
+
exit 1
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
Write-BeeInfo "Installing $CliPackage globally..."
|
|
368
|
+
& npm install -g $CliPackage
|
|
369
|
+
if ($LASTEXITCODE -ne 0) {
|
|
370
|
+
Write-BeeError "npm install -g $CliPackage failed."
|
|
371
|
+
Write-BeeError ""
|
|
372
|
+
Write-BeeError "Common fixes:"
|
|
373
|
+
Write-BeeError " - EEXIST on beeos from another package:"
|
|
374
|
+
Write-BeeError " npm uninstall -g beeos # then re-run installer"
|
|
375
|
+
Write-BeeError " - EACCES / permission error: run PowerShell as Administrator"
|
|
376
|
+
exit 1
|
|
361
377
|
}
|
|
378
|
+
Install-DeviceAgentSuite
|
|
379
|
+
& beeos @args
|
|
362
380
|
}
|
|
363
381
|
|
|
364
382
|
# ── Main ─────────────────────────────────────────────────────
|
package/scripts/install.sh
CHANGED
|
@@ -30,6 +30,13 @@
|
|
|
30
30
|
# BEEOS_DASHBOARD_URL Dashboard base (OAuth + bind redirect).
|
|
31
31
|
# BEEOS_DEVICE_AGENT_VERSION Pin @beeos-ai/device-agent semver.
|
|
32
32
|
# BEEOS_MCP_SERVER_VERSION Pin @beeos-ai/device-mcp-server semver.
|
|
33
|
+
# BEEOS_USE_NPX=1 (Power-user escape hatch) Use `npx` for a
|
|
34
|
+
# throwaway install. `beeos` will NOT
|
|
35
|
+
# persist on PATH after the script exits.
|
|
36
|
+
# 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.
|
|
33
40
|
#
|
|
34
41
|
# Example: bare-metal one-shot staging install, including device-agent
|
|
35
42
|
# version pin and OAuth landing on the staging dashboard:
|
|
@@ -37,9 +44,9 @@
|
|
|
37
44
|
# BEEOS_API_URL=https://public-api-staging.beeos.ai \
|
|
38
45
|
# BEEOS_AGENT_GATEWAY_URL=https://agent-gw-staging.beeos.ai \
|
|
39
46
|
# BEEOS_DASHBOARD_URL=https://beeos-staging-web.vercel.app \
|
|
40
|
-
# BEEOS_DEVICE_AGENT_VERSION=0.4.
|
|
47
|
+
# BEEOS_DEVICE_AGENT_VERSION=0.4.2 \
|
|
41
48
|
# BEEOS_MCP_SERVER_VERSION=0.2.3 \
|
|
42
|
-
# curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.
|
|
49
|
+
# curl -fsSL https://beeos.ai/install | bash -s -- --version 1.0.11
|
|
43
50
|
|
|
44
51
|
set -euo pipefail
|
|
45
52
|
|
|
@@ -495,28 +502,44 @@ run_cli() {
|
|
|
495
502
|
stdin_src="/dev/tty"
|
|
496
503
|
fi
|
|
497
504
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
505
|
+
# ALWAYS install globally. We previously branched to `npx --yes` when
|
|
506
|
+
# available so curl|bash users got a throwaway install, but that
|
|
507
|
+
# silently broke the post-install UX:
|
|
508
|
+
# - `beeos` was not on PATH after the script exited, so the user's
|
|
509
|
+
# next step (`beeos device attach`) failed with `command not found`
|
|
510
|
+
# and the obvious recovery (re-run the one-liner) hit the
|
|
511
|
+
# "existing install" prompt because some state in ~/.beeos
|
|
512
|
+
# persisted, leaving the user stuck.
|
|
513
|
+
# - The device-agent suite was deliberately skipped on the npx
|
|
514
|
+
# branch, so even if the user re-ran via `npm i -g`, the very
|
|
515
|
+
# next `beeos device attach` had to bootstrap device-agent
|
|
516
|
+
# itself.
|
|
517
|
+
# Power users who explicitly want the old throwaway behaviour can set
|
|
518
|
+
# `BEEOS_USE_NPX=1`. Default is global install.
|
|
519
|
+
if [[ "${BEEOS_USE_NPX:-}" == "1" ]] && command -v npx &>/dev/null; then
|
|
520
|
+
warn "BEEOS_USE_NPX=1 — using throwaway npx install (beeos won't persist on PATH)."
|
|
504
521
|
exec npx --yes "$CLI_PACKAGE" "$subcmd" "$@" <"$stdin_src"
|
|
505
|
-
else
|
|
506
|
-
warn "npx not found, installing globally..."
|
|
507
|
-
if ! npm install -g "$CLI_PACKAGE"; then
|
|
508
|
-
error "npm install -g ${CLI_PACKAGE} failed."
|
|
509
|
-
error ""
|
|
510
|
-
error "Common fixes:"
|
|
511
|
-
error " - EEXIST on /bin/beeos from another package:"
|
|
512
|
-
error " npm uninstall -g beeos # then re-run installer"
|
|
513
|
-
error " - EACCES permission error:"
|
|
514
|
-
error " use a node version manager (nvm / fnm) or sudo"
|
|
515
|
-
exit 1
|
|
516
|
-
fi
|
|
517
|
-
install_device_agent_suite
|
|
518
|
-
exec beeos "$subcmd" "$@" <"$stdin_src"
|
|
519
522
|
fi
|
|
523
|
+
|
|
524
|
+
if ! command -v npm &>/dev/null; then
|
|
525
|
+
error "npm not found — install Node.js first (this script tries that for you;"
|
|
526
|
+
error "see ${BEEOS_INSTALL_LOG} for why auto-install bailed out)."
|
|
527
|
+
exit 1
|
|
528
|
+
fi
|
|
529
|
+
|
|
530
|
+
info "Installing ${CLI_PACKAGE} globally..."
|
|
531
|
+
if ! npm install -g "$CLI_PACKAGE"; then
|
|
532
|
+
error "npm install -g ${CLI_PACKAGE} failed."
|
|
533
|
+
error ""
|
|
534
|
+
error "Common fixes:"
|
|
535
|
+
error " - EEXIST on /bin/beeos from another package:"
|
|
536
|
+
error " npm uninstall -g beeos # then re-run installer"
|
|
537
|
+
error " - EACCES permission error:"
|
|
538
|
+
error " use a node version manager (nvm / fnm) or sudo"
|
|
539
|
+
exit 1
|
|
540
|
+
fi
|
|
541
|
+
install_device_agent_suite
|
|
542
|
+
exec beeos "$subcmd" "$@" <"$stdin_src"
|
|
520
543
|
}
|
|
521
544
|
|
|
522
545
|
main() {
|