@beeos-ai/cli 0.1.2 → 1.0.2
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/README.md +56 -26
- package/bin/beeos.js +3 -159
- package/dist/index.js +2124 -0
- package/package.json +39 -24
package/README.md
CHANGED
|
@@ -1,49 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @beeos-ai/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
BeeOS Desktop CLI — run AI agents from your terminal.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
+
# Run directly (no install required)
|
|
9
|
+
npx @beeos-ai/cli device attach
|
|
10
|
+
|
|
11
|
+
# Or install globally
|
|
8
12
|
npm install -g @beeos-ai/cli
|
|
9
13
|
```
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
Pure JavaScript — runs on any platform with Node.js 18+. No native compilation needed.
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### Device agent (Android)
|
|
12
20
|
|
|
13
21
|
```bash
|
|
14
|
-
#
|
|
15
|
-
beeos
|
|
22
|
+
# Attach a USB-connected Android device as an AI agent
|
|
23
|
+
beeos device attach
|
|
16
24
|
|
|
17
|
-
#
|
|
18
|
-
beeos
|
|
25
|
+
# Attach a specific device
|
|
26
|
+
beeos device attach --serial SERIAL_NUMBER
|
|
19
27
|
|
|
20
|
-
#
|
|
21
|
-
beeos
|
|
28
|
+
# Attach all connected devices
|
|
29
|
+
beeos device attach --all
|
|
22
30
|
|
|
23
|
-
#
|
|
24
|
-
beeos
|
|
31
|
+
# List attached devices
|
|
32
|
+
beeos device list --local
|
|
33
|
+
|
|
34
|
+
# Detach a device
|
|
35
|
+
beeos device detach --serial SERIAL_NUMBER
|
|
36
|
+
|
|
37
|
+
# Send a command to a device
|
|
38
|
+
beeos device exec "open Chrome"
|
|
39
|
+
|
|
40
|
+
# Upgrade device-agent to latest version
|
|
41
|
+
beeos device upgrade
|
|
25
42
|
```
|
|
26
43
|
|
|
27
|
-
|
|
44
|
+
### OpenClaw agent (local AI assistant)
|
|
28
45
|
|
|
29
|
-
|
|
46
|
+
```bash
|
|
47
|
+
# Download, install and start an OpenClaw agent
|
|
48
|
+
beeos start openclaw
|
|
49
|
+
|
|
50
|
+
# Stop a running agent
|
|
51
|
+
beeos stop openclaw
|
|
30
52
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
53
|
+
# Check agent status
|
|
54
|
+
beeos status
|
|
55
|
+
|
|
56
|
+
# Update to the latest version
|
|
57
|
+
beeos update openclaw
|
|
58
|
+
```
|
|
35
59
|
|
|
36
60
|
## Requirements
|
|
37
61
|
|
|
38
|
-
- **Node.js
|
|
39
|
-
- **
|
|
62
|
+
- **Node.js 18+**
|
|
63
|
+
- **Android devices**: `adb` (Android Debug Bridge) must be in your PATH
|
|
64
|
+
- **device-agent**: Python 3.11+ or [uv](https://astral.sh/uv) (auto-installed on first use)
|
|
40
65
|
|
|
41
|
-
##
|
|
66
|
+
## Configuration
|
|
42
67
|
|
|
43
|
-
|
|
44
|
-
- **Dashboard**: [https://app.beeos.ai](https://app.beeos.ai)
|
|
45
|
-
- **GitHub**: [https://github.com/beeos-ai/beeos](https://github.com/beeos-ai/beeos)
|
|
68
|
+
Config is stored at `~/.beeos/config.toml`:
|
|
46
69
|
|
|
47
|
-
|
|
70
|
+
```toml
|
|
71
|
+
[platform]
|
|
72
|
+
api_url = "https://api.beeos.ai"
|
|
73
|
+
bridge_url = "wss://bridge-sg.beeos.ai"
|
|
74
|
+
dashboard_base_url = "https://beeos.ai"
|
|
48
75
|
|
|
49
|
-
|
|
76
|
+
[device]
|
|
77
|
+
http_enabled = true
|
|
78
|
+
http_port = 9090
|
|
79
|
+
```
|
package/bin/beeos.js
CHANGED
|
@@ -1,161 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const path = require("path");
|
|
5
|
-
const fs = require("fs");
|
|
6
|
-
const os = require("os");
|
|
7
|
-
const zlib = require("zlib");
|
|
8
|
-
|
|
9
|
-
const PLATFORMS = {
|
|
10
|
-
"darwin-arm64": "@beeos-ai/cli-darwin-arm64",
|
|
11
|
-
"darwin-x64": "@beeos-ai/cli-darwin-x64",
|
|
12
|
-
"linux-x64": "@beeos-ai/cli-linux-x64-gnu",
|
|
13
|
-
"linux-arm64": "@beeos-ai/cli-linux-arm64-gnu",
|
|
14
|
-
"win32-x64": "@beeos-ai/cli-win32-x64-msvc",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const VERSION = require("../package.json").version;
|
|
18
|
-
|
|
19
|
-
function getPlatformKey() {
|
|
20
|
-
return process.platform + "-" + process.arch;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function getBinName() {
|
|
24
|
-
return process.platform === "win32" ? "beeos.exe" : "beeos";
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function tryResolve() {
|
|
28
|
-
var key = getPlatformKey();
|
|
29
|
-
var pkg = PLATFORMS[key];
|
|
30
|
-
if (!pkg) return null;
|
|
31
|
-
try {
|
|
32
|
-
return require.resolve(path.join(pkg, "bin", getBinName()));
|
|
33
|
-
} catch (_) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function getCachePath() {
|
|
39
|
-
var cacheDir = path.join(os.homedir(), ".beeos", "bin");
|
|
40
|
-
var name = process.platform === "win32"
|
|
41
|
-
? "beeos-" + VERSION + ".exe"
|
|
42
|
-
: "beeos-" + VERSION;
|
|
43
|
-
return path.join(cacheDir, name);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function extractBinaryFromTarball(tgzBuffer, targetBinName) {
|
|
47
|
-
var tar = zlib.gunzipSync(tgzBuffer);
|
|
48
|
-
var offset = 0;
|
|
49
|
-
while (offset < tar.length) {
|
|
50
|
-
var header = tar.subarray(offset, offset + 512);
|
|
51
|
-
if (header.every(function(b) { return b === 0; })) break;
|
|
52
|
-
|
|
53
|
-
var name = header.subarray(0, 100).toString("utf8").replace(/\0/g, "");
|
|
54
|
-
var sizeOctal = header.subarray(124, 136).toString("utf8").replace(/\0/g, "").trim();
|
|
55
|
-
var size = parseInt(sizeOctal, 8) || 0;
|
|
56
|
-
var dataStart = offset + 512;
|
|
57
|
-
var dataEnd = dataStart + size;
|
|
58
|
-
|
|
59
|
-
if (name === "package/bin/" + targetBinName || name.endsWith("/" + targetBinName)) {
|
|
60
|
-
return tar.subarray(dataStart, dataEnd);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
offset = dataStart + Math.ceil(size / 512) * 512;
|
|
64
|
-
}
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function getTarballUrl(pkg) {
|
|
69
|
-
var parts = pkg.split("/");
|
|
70
|
-
var scope = parts[0];
|
|
71
|
-
var pkgName = parts[1];
|
|
72
|
-
return "https://registry.npmjs.org/" + scope + "/" + pkgName + "/-/" + pkgName + "-" + VERSION + ".tgz";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function downloadBinary() {
|
|
76
|
-
var key = getPlatformKey();
|
|
77
|
-
var pkg = PLATFORMS[key];
|
|
78
|
-
if (!pkg) {
|
|
79
|
-
console.error(
|
|
80
|
-
"beeos: unsupported platform " + key + "\n" +
|
|
81
|
-
"Supported: " + Object.keys(PLATFORMS).join(", ")
|
|
82
|
-
);
|
|
83
|
-
process.exit(1);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var cached = getCachePath();
|
|
87
|
-
if (fs.existsSync(cached)) return cached;
|
|
88
|
-
|
|
89
|
-
var tarballUrl = getTarballUrl(pkg);
|
|
90
|
-
console.error("beeos: downloading binary for " + key + " (v" + VERSION + ")...");
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
var script = [
|
|
94
|
-
'var https = require("https");',
|
|
95
|
-
"function fetch(url) {",
|
|
96
|
-
" return new Promise(function(resolve, reject) {",
|
|
97
|
-
" https.get(url, function(res) {",
|
|
98
|
-
" if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location)",
|
|
99
|
-
" return fetch(res.headers.location).then(resolve, reject);",
|
|
100
|
-
" if (res.statusCode !== 200)",
|
|
101
|
-
' return reject(new Error("HTTP " + res.statusCode));',
|
|
102
|
-
" var c = [];",
|
|
103
|
-
' res.on("data", function(d) { c.push(d); });',
|
|
104
|
-
' res.on("end", function() { resolve(Buffer.concat(c)); });',
|
|
105
|
-
' res.on("error", reject);',
|
|
106
|
-
' }).on("error", reject);',
|
|
107
|
-
" });",
|
|
108
|
-
"}",
|
|
109
|
-
"fetch(" + JSON.stringify(tarballUrl) + ").then(function(b) {",
|
|
110
|
-
" process.stdout.write(b);",
|
|
111
|
-
"}).catch(function(e) {",
|
|
112
|
-
" process.stderr.write(e.message);",
|
|
113
|
-
" process.exit(1);",
|
|
114
|
-
"});"
|
|
115
|
-
].join("\n");
|
|
116
|
-
|
|
117
|
-
var tgz = execFileSync(process.execPath, ["-e", script], {
|
|
118
|
-
maxBuffer: 50 * 1024 * 1024,
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var binName = getBinName();
|
|
122
|
-
var binary = extractBinaryFromTarball(tgz, binName);
|
|
123
|
-
if (!binary) {
|
|
124
|
-
console.error("beeos: could not find bin/" + binName + " in tarball");
|
|
125
|
-
process.exit(1);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
var cacheDir = path.dirname(cached);
|
|
129
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
130
|
-
|
|
131
|
-
var tmp = cached + ".tmp";
|
|
132
|
-
fs.writeFileSync(tmp, binary);
|
|
133
|
-
if (process.platform !== "win32") {
|
|
134
|
-
fs.chmodSync(tmp, 0o755);
|
|
135
|
-
}
|
|
136
|
-
fs.renameSync(tmp, cached);
|
|
137
|
-
|
|
138
|
-
console.error("beeos: binary cached at " + cached);
|
|
139
|
-
return cached;
|
|
140
|
-
} catch (err) {
|
|
141
|
-
console.error(
|
|
142
|
-
"beeos: failed to download binary for " + key + ".\n" +
|
|
143
|
-
" " + err.message + "\n" +
|
|
144
|
-
"Try: npm install -g @beeos-ai/cli@" + VERSION
|
|
145
|
-
);
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
var binaryPath = tryResolve() || downloadBinary();
|
|
151
|
-
var result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
152
|
-
stdio: "inherit",
|
|
153
|
-
env: process.env,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
if (result.error) {
|
|
157
|
-
console.error("beeos: failed to start:", result.error.message);
|
|
2
|
+
import("../dist/index.js").catch((err) => {
|
|
3
|
+
console.error("Failed to start beeos CLI:", err.message);
|
|
158
4
|
process.exit(1);
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
process.exit(result.status != null ? result.status : 1);
|
|
5
|
+
});
|