uwonbot 1.2.7 → 1.2.9
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/package.json +1 -1
- package/src/agent.js +18 -5
package/package.json
CHANGED
package/src/agent.js
CHANGED
|
@@ -106,9 +106,15 @@ async function loadNativeModules() {
|
|
|
106
106
|
async function getScreenSize() {
|
|
107
107
|
if (platform === 'darwin') {
|
|
108
108
|
try {
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
109
|
+
const script = `ObjC.import("CoreGraphics"); var d = $.CGMainDisplayID(); var w = $.CGDisplayPixelsWide(d); var h = $.CGDisplayPixelsHigh(d); JSON.stringify({w:w,h:h})`;
|
|
110
|
+
const { stdout } = await execAsync(`osascript -l JavaScript -e '${script}'`, { timeout: 3000 });
|
|
111
|
+
const parsed = JSON.parse(stdout.trim());
|
|
112
|
+
if (parsed.w && parsed.h) return { width: Number(parsed.w), height: Number(parsed.h) };
|
|
113
|
+
} catch {}
|
|
114
|
+
try {
|
|
115
|
+
const { stdout } = await execAsync(`system_profiler SPDisplaysDataType 2>/dev/null | grep Resolution | head -1`, { timeout: 3000 });
|
|
116
|
+
const m = stdout.match(/(\d+)\s*x\s*(\d+)/);
|
|
117
|
+
if (m) return { width: parseInt(m[1]), height: parseInt(m[2]) };
|
|
112
118
|
} catch {}
|
|
113
119
|
}
|
|
114
120
|
if (robot?.screen?.width) {
|
|
@@ -585,13 +591,20 @@ async function handleCommand(msg) {
|
|
|
585
591
|
|
|
586
592
|
async function openWebAssistant(assistantId) {
|
|
587
593
|
const chatUrl = `${WEB_APP_URL}/assistant/live?id=${assistantId}`;
|
|
594
|
+
const camUrl = `${WEB_APP_URL}/camera-control`;
|
|
588
595
|
try {
|
|
589
596
|
if (platform === 'darwin') {
|
|
590
|
-
await execAsync(`open -na "Google Chrome" --args --new-window --window-size=320,
|
|
597
|
+
await execAsync(`open -na "Google Chrome" --args --new-window --window-size=320,520 --window-position=1000,100 "${chatUrl}" 2>/dev/null || open "${chatUrl}"`);
|
|
598
|
+
await new Promise(r => setTimeout(r, 800));
|
|
599
|
+
await execAsync(`open -na "Google Chrome" --args --new-window --window-size=480,400 --window-position=480,150 "${camUrl}" 2>/dev/null || open "${camUrl}"`);
|
|
591
600
|
} else if (platform === 'win32') {
|
|
592
|
-
await execAsync(`start chrome --new-window --window-size=320,
|
|
601
|
+
await execAsync(`start chrome --new-window --window-size=320,520 --window-position=1000,100 "${chatUrl}" 2>nul || start "" "${chatUrl}"`);
|
|
602
|
+
await new Promise(r => setTimeout(r, 800));
|
|
603
|
+
await execAsync(`start chrome --new-window --window-size=480,400 --window-position=480,150 "${camUrl}" 2>nul || start "" "${camUrl}"`);
|
|
593
604
|
} else {
|
|
594
605
|
await execAsync(`google-chrome --new-window "${chatUrl}" 2>/dev/null || xdg-open "${chatUrl}"`);
|
|
606
|
+
await new Promise(r => setTimeout(r, 800));
|
|
607
|
+
await execAsync(`google-chrome --new-window "${camUrl}" 2>/dev/null || xdg-open "${camUrl}"`);
|
|
595
608
|
}
|
|
596
609
|
return true;
|
|
597
610
|
} catch {
|