uwonbot 1.2.7 → 1.2.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/agent.js +9 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uwonbot",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Uwonbot AI Assistant CLI — Your AI controls your computer",
5
5
  "main": "src/index.js",
6
6
  "bin": {
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 { stdout } = await execAsync(`osascript -e 'tell application "Finder" to get bounds of window of desktop' 2>/dev/null || osascript -e 'tell application "System Events" to get {0, 0, 1920, 1080}'`);
110
- const nums = stdout.trim().split(/[,\s]+/).map(Number);
111
- if (nums.length >= 4) return { width: nums[2], height: nums[3] };
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) {