copilot-liku-cli 0.0.3 → 0.0.4
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/main/index.js +22 -3
- package/src/main/system-automation.js +27 -0
package/package.json
CHANGED
package/src/main/index.js
CHANGED
|
@@ -118,9 +118,12 @@ function createOverlayWindow() {
|
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
// Pipe renderer console to main for debugging without DevTools
|
|
121
|
-
overlayWindow.webContents.on('console-message', (event) => {
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
overlayWindow.webContents.on('console-message', (event, level, message, line, sourceId) => {
|
|
122
|
+
const levelNames = ['verbose', 'info', 'warn', 'error'];
|
|
123
|
+
const levelStr = levelNames[level] || `level-${level}`;
|
|
124
|
+
const lineStr = line !== undefined ? `:${line}` : '';
|
|
125
|
+
const source = sourceId ? sourceId.split('/').pop() : 'overlay';
|
|
126
|
+
console.log(`[overlay console] (${levelStr}) ${source}${lineStr} - ${message}`);
|
|
124
127
|
});
|
|
125
128
|
|
|
126
129
|
// Prevent overlay from appearing in Dock/Taskbar
|
|
@@ -1074,6 +1077,17 @@ function setupIPC() {
|
|
|
1074
1077
|
total: actionData.actions.length
|
|
1075
1078
|
});
|
|
1076
1079
|
|
|
1080
|
+
// CRITICAL: Blur chat window before executing actions so keyboard/mouse
|
|
1081
|
+
// input reaches the desktop instead of staying within Electron
|
|
1082
|
+
if (chatWindow && !chatWindow.isDestroyed()) {
|
|
1083
|
+
chatWindow.blur();
|
|
1084
|
+
}
|
|
1085
|
+
if (overlayWindow && !overlayWindow.isDestroyed()) {
|
|
1086
|
+
overlayWindow.blur();
|
|
1087
|
+
// Temporarily lower overlay z-index so popups (like Run dialog) appear above
|
|
1088
|
+
overlayWindow.setAlwaysOnTop(true, 'pop-up-menu');
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1077
1091
|
try {
|
|
1078
1092
|
const results = await aiService.executeActions(
|
|
1079
1093
|
actionData,
|
|
@@ -1173,6 +1187,11 @@ function setupIPC() {
|
|
|
1173
1187
|
actionsCount: actionData.actions ? actionData.actions.length : 0,
|
|
1174
1188
|
error: error.message
|
|
1175
1189
|
});
|
|
1190
|
+
} finally {
|
|
1191
|
+
// Restore overlay z-index after action execution
|
|
1192
|
+
if (overlayWindow && !overlayWindow.isDestroyed()) {
|
|
1193
|
+
overlayWindow.setAlwaysOnTop(true, 'screen-saver');
|
|
1194
|
+
}
|
|
1176
1195
|
}
|
|
1177
1196
|
|
|
1178
1197
|
pendingActions = null;
|
|
@@ -88,6 +88,33 @@ function executePowerShell(command) {
|
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Focus the desktop / unfocus Electron windows before sending keyboard input
|
|
93
|
+
* This is critical for SendKeys/SendInput to reach the correct target
|
|
94
|
+
*/
|
|
95
|
+
async function focusDesktop() {
|
|
96
|
+
const script = `
|
|
97
|
+
Add-Type @"
|
|
98
|
+
using System;
|
|
99
|
+
using System.Runtime.InteropServices;
|
|
100
|
+
public class FocusHelper {
|
|
101
|
+
[DllImport("user32.dll")]
|
|
102
|
+
public static extern IntPtr GetDesktopWindow();
|
|
103
|
+
[DllImport("user32.dll")]
|
|
104
|
+
public static extern bool SetForegroundWindow(IntPtr hWnd);
|
|
105
|
+
[DllImport("user32.dll")]
|
|
106
|
+
public static extern IntPtr GetShellWindow();
|
|
107
|
+
}
|
|
108
|
+
"@
|
|
109
|
+
# Focus shell window (explorer desktop)
|
|
110
|
+
$shell = [FocusHelper]::GetShellWindow()
|
|
111
|
+
[FocusHelper]::SetForegroundWindow($shell)
|
|
112
|
+
Start-Sleep -Milliseconds 50
|
|
113
|
+
`;
|
|
114
|
+
await executePowerShell(script);
|
|
115
|
+
console.log('[AUTOMATION] Focused desktop before input');
|
|
116
|
+
}
|
|
117
|
+
|
|
91
118
|
/**
|
|
92
119
|
* Move mouse to coordinates (Windows)
|
|
93
120
|
*/
|