@beeos-ai/cli 1.0.22 → 1.0.23
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 +33 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -761,7 +761,7 @@ function buildBindUrl(dashboardBaseUrl, bindId) {
|
|
|
761
761
|
const base = dashboardBaseUrl.replace(/\/+$/, "");
|
|
762
762
|
return `${base}/bind/${bindId}`;
|
|
763
763
|
}
|
|
764
|
-
async function agentBind(apiUrl, publicKey, fingerprint2, agentFramework, hostname, osType) {
|
|
764
|
+
async function agentBind(apiUrl, publicKey, fingerprint2, agentFramework, hostname, osType, vncPassword) {
|
|
765
765
|
const p = getPlatformAdapter();
|
|
766
766
|
const url = `${apiUrl}/api/v1/agent/bind`;
|
|
767
767
|
const body = {
|
|
@@ -773,6 +773,9 @@ async function agentBind(apiUrl, publicKey, fingerprint2, agentFramework, hostna
|
|
|
773
773
|
if (osType && osType.length > 0) {
|
|
774
774
|
body.os_type = osType;
|
|
775
775
|
}
|
|
776
|
+
if (vncPassword && vncPassword.length > 0) {
|
|
777
|
+
body.vnc_password = vncPassword;
|
|
778
|
+
}
|
|
776
779
|
const resp = await p.fetch(url, {
|
|
777
780
|
method: "POST",
|
|
778
781
|
headers: { "Content-Type": "application/json" },
|
|
@@ -929,7 +932,7 @@ async function bindAgent(opts) {
|
|
|
929
932
|
const pollTimeoutMs = opts.pollTimeoutMs ?? 6e5;
|
|
930
933
|
let resp;
|
|
931
934
|
try {
|
|
932
|
-
resp = await agentBind(opts.apiUrl, opts.publicKey, opts.fingerprint, opts.agentFramework, opts.hostname, opts.osType);
|
|
935
|
+
resp = await agentBind(opts.apiUrl, opts.publicKey, opts.fingerprint, opts.agentFramework, opts.hostname, opts.osType, opts.vncPassword);
|
|
933
936
|
} catch (e) {
|
|
934
937
|
if (isNetworkError(e) && opts.cachedBinding && opts.cachedBinding.fingerprint === opts.fingerprint) {
|
|
935
938
|
return {
|
|
@@ -5748,7 +5751,7 @@ async function attach(options) {
|
|
|
5748
5751
|
await deviceRuntime.ensureAgent(reporter);
|
|
5749
5752
|
reporter.stop();
|
|
5750
5753
|
const pubkeyB64 = await deviceRuntime.ensureKeyAndGetPubkey(serial);
|
|
5751
|
-
const instanceId = await bindDevice(pubkeyB64, name, cfg);
|
|
5754
|
+
const instanceId = await bindDevice(pubkeyB64, name, cfg, options.vncPassword);
|
|
5752
5755
|
if (!instanceId) {
|
|
5753
5756
|
console.error("Bind was not completed \u2014 device-agent will not start without a platform binding.");
|
|
5754
5757
|
console.error("Run `beeos device attach` again to retry.");
|
|
@@ -5904,7 +5907,7 @@ async function attachAll(cfg, reporter, withVideo, options) {
|
|
|
5904
5907
|
for (const device of devices) {
|
|
5905
5908
|
try {
|
|
5906
5909
|
const pubkeyB64 = await deviceRuntime.ensureKeyAndGetPubkey(device.serial);
|
|
5907
|
-
const instanceId = await bindDevice(pubkeyB64, device.serial, cfg);
|
|
5910
|
+
const instanceId = await bindDevice(pubkeyB64, device.serial, cfg, options.vncPassword);
|
|
5908
5911
|
if (!instanceId) {
|
|
5909
5912
|
console.error(` Skipping ${device.serial} \u2014 bind not completed`);
|
|
5910
5913
|
continue;
|
|
@@ -6066,7 +6069,7 @@ async function runAttachStage2(params) {
|
|
|
6066
6069
|
return { ok: false, serial, error: e };
|
|
6067
6070
|
}
|
|
6068
6071
|
}
|
|
6069
|
-
async function bindDevice(pubkeyB64, name, cfg) {
|
|
6072
|
+
async function bindDevice(pubkeyB64, name, cfg, vncPassword) {
|
|
6070
6073
|
const fp = fingerprintFromB64(pubkeyB64);
|
|
6071
6074
|
const outcome = await bindAgent({
|
|
6072
6075
|
apiUrl: cfg.platform.api_url,
|
|
@@ -6075,6 +6078,7 @@ async function bindDevice(pubkeyB64, name, cfg) {
|
|
|
6075
6078
|
fingerprint: fp,
|
|
6076
6079
|
agentFramework: "device",
|
|
6077
6080
|
hostname: name,
|
|
6081
|
+
vncPassword,
|
|
6078
6082
|
// Device bind has no cached fallback — each device has its own
|
|
6079
6083
|
// identity, and we never want to "silently come up offline" on
|
|
6080
6084
|
// first attach.
|
|
@@ -6891,6 +6895,7 @@ async function run(agentFramework, options) {
|
|
|
6891
6895
|
const vncEndpoint = agentFramework === OPENCLAW_ID ? await probeLocalVnc({ ttyHints }) : null;
|
|
6892
6896
|
const hostname = buildHostname();
|
|
6893
6897
|
const cachedBinding = await loadBindingInfo();
|
|
6898
|
+
const bindVncPassword = vncEndpoint ? await readVncPasswordOptional() : void 0;
|
|
6894
6899
|
const outcome = await bindAgent({
|
|
6895
6900
|
apiUrl: cfg.platform.api_url,
|
|
6896
6901
|
dashboardBaseUrl: cfg.platform.dashboard_base_url,
|
|
@@ -6899,6 +6904,7 @@ async function run(agentFramework, options) {
|
|
|
6899
6904
|
agentFramework,
|
|
6900
6905
|
hostname,
|
|
6901
6906
|
osType: vncEndpoint?.osType,
|
|
6907
|
+
vncPassword: bindVncPassword,
|
|
6902
6908
|
headless: options.browser === false,
|
|
6903
6909
|
cachedBinding: cachedBinding ? {
|
|
6904
6910
|
fingerprint: cachedBinding.fingerprint,
|
|
@@ -7007,6 +7013,10 @@ async function run(agentFramework, options) {
|
|
|
7007
7013
|
if (vncEndpoint.kind === "macos" && ttyHints) {
|
|
7008
7014
|
printMacosDesktopHint();
|
|
7009
7015
|
}
|
|
7016
|
+
if (vncEndpoint.kind === "macos") {
|
|
7017
|
+
const ardWarning = await checkMacosARDConflict();
|
|
7018
|
+
if (ardWarning) launchWarnings.push(ardWarning);
|
|
7019
|
+
}
|
|
7010
7020
|
const desktopWarning = await tryAttachOpenclawDesktopBridge({
|
|
7011
7021
|
vncEndpoint,
|
|
7012
7022
|
instanceId: boundInstanceId,
|
|
@@ -7072,6 +7082,24 @@ async function readVncPasswordOptional() {
|
|
|
7072
7082
|
return void 0;
|
|
7073
7083
|
}
|
|
7074
7084
|
}
|
|
7085
|
+
async function checkMacosARDConflict() {
|
|
7086
|
+
if (process.platform !== "darwin") return null;
|
|
7087
|
+
const p = getPlatformAdapter();
|
|
7088
|
+
try {
|
|
7089
|
+
const result = await p.exec("plutil", [
|
|
7090
|
+
"-extract",
|
|
7091
|
+
"ARD_AllLocalUsers",
|
|
7092
|
+
"raw",
|
|
7093
|
+
"/Library/Preferences/com.apple.RemoteManagement.plist"
|
|
7094
|
+
], { timeout: 2e3 });
|
|
7095
|
+
const out = String(result.stdout || "").trim().toLowerCase();
|
|
7096
|
+
if (out === "true" || out === "1") {
|
|
7097
|
+
return "macOS ARD_AllLocalUsers is enabled \u2014 Screen Sharing also advertises RFB scheme 30 (Apple Auth) which noVNC will prefer over scheme 2 (legacy VNC password). The dashboard's device-viewer will then loop on `credentialsrequired` and never paint. Disable ARD to keep only legacy VNC:\n sudo defaults write /Library/Preferences/com.apple.RemoteManagement ARD_AllLocalUsers -bool NO\n sudo launchctl kickstart -k system/com.apple.screensharing";
|
|
7098
|
+
}
|
|
7099
|
+
} catch {
|
|
7100
|
+
}
|
|
7101
|
+
return null;
|
|
7102
|
+
}
|
|
7075
7103
|
function buildHostname() {
|
|
7076
7104
|
const machine = os6.hostname();
|
|
7077
7105
|
const user = process.env.USER || process.env.USERNAME || "";
|