dsh-mobilecode 0.10.0 → 0.10.1
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/lib/index.js +15 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -541,13 +541,25 @@ function makeRoutes(engine, config, stream) {
|
|
|
541
541
|
if (name === avd) { writeJson(res, 200, { ok: true, alreadyRunning: true, serial: row.serial, avd }); return }
|
|
542
542
|
}
|
|
543
543
|
if (!DeviceBuild.bootEmulator(avd)) { writeJson(res, 500, { error: `could not launch the emulator for "${avd}"` }); return }
|
|
544
|
-
const
|
|
544
|
+
const startedAt = Date.now()
|
|
545
|
+
const deadline = startedAt + 60_000
|
|
545
546
|
const before = new Set(rows.map((item) => item.serial))
|
|
546
547
|
let serial
|
|
547
548
|
while (Date.now() < deadline) {
|
|
548
549
|
const now = await DeviceBuild.devices()
|
|
549
|
-
|
|
550
|
-
|
|
550
|
+
// Match the fresh serial to THIS avd by name: concurrent boots (the
|
|
551
|
+
// co-op pair) otherwise race and claim each other's emulator.
|
|
552
|
+
const fresh = now.filter((item) => item.state === 'device' && item.serial.startsWith('emulator-') && !before.has(item.serial))
|
|
553
|
+
for (const item of fresh) {
|
|
554
|
+
const name = await DeviceBuild.avdName(item.serial).catch(() => undefined)
|
|
555
|
+
if (name === avd) { serial = item.serial; break }
|
|
556
|
+
}
|
|
557
|
+
if (!serial && fresh.length === 1) {
|
|
558
|
+
// Sole candidate, name never resolved after a grace period.
|
|
559
|
+
const name = await DeviceBuild.avdName(fresh[0].serial).catch(() => undefined)
|
|
560
|
+
if (name === undefined && Date.now() - startedAt > 20_000) serial = fresh[0].serial
|
|
561
|
+
}
|
|
562
|
+
if (serial) break
|
|
551
563
|
await new Promise((resolve) => setTimeout(resolve, 1000))
|
|
552
564
|
}
|
|
553
565
|
if (!serial) { writeJson(res, 504, { error: `emulator for "${avd}" did not come online within 60s` }); return }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mobilecode",
|
|
3
3
|
"description": "MobileCode for the dsh web GUI: detect iOS/Android projects, run preview servers, and drive the simulator/emulator from the session — 37 agent tools (device_run, device_screen, device_ui_tree, device_ui_rows, device_tap_row, device_tap_element, device_wait_for, device_scroll_to, device_input, device_batch, device_intent, device_connect, device_pair_qr, device_perf, device_meminfo, device_backtrace, device_display, device_avd_create, device_pair_capture, device_app_info, device_install, device_uninstall, device_reboot, device_log, live screen stream, multimodal screenshots) plus a host-mediated co-op mesh hub (random callsigns, JSON pub/sub, tunable latency/jitter/drop/dup/throttle) so two virtual devices — and the AI watching them — can talk in real time. One classified adb boundary and a Wi-Fi connect/pair QR flow in the Connection settings tab. Hot-pluggable — mounted via the profile bundle list + cordis.patch.yml, no dsh source changes.",
|
|
4
|
-
"version": "0.10.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@11.22.0",
|
|
7
7
|
"engines": {
|