An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: Wait for wireless Android device discovery
Daniel61a62b18c34a
diff --git a/scripts/android-dev-run.mjs b/scripts/android-dev-run.mjsindex d4038fdba3..a7bbaf00fe 100644--- a/scripts/android-dev-run.mjs+++ b/scripts/android-dev-run.mjs@@ -144,13 +144,30 @@ function findTool(name) {fail(`${name} not found. Install it and try again`);}+function wait(milliseconds) {+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, milliseconds);+}+function deviceSerial(adb) {- const lines = capture(adb, ["devices"]).split(/\r?\n/);- const devices = [];- for (const line of lines) {- const parts = line.split(/\t/);- if (parts.length === 2 && parts[1] === "device") {- devices.push(parts[0]);+ const maxAttempts = 11;+ let devices = [];+ for (let attempt = 1; attempt <= maxAttempts; attempt++) {+ const lines = capture(adb, ["devices"]).split(/\r?\n/);+ devices = [];+ for (const line of lines) {+ const parts = line.split(/\t/);+ if (parts.length === 2 && parts[1] === "device") {+ devices.push(parts[0]);+ }+ }+ if (device ? devices.includes(device) : devices.length > 0) {+ break;+ }+ if (attempt === 1) {+ console.log("Waiting up to 10 seconds for an adb device...");+ }+ if (attempt < maxAttempts) {+ wait(1000);}}if (device) {