@midscene/computer 1.7.2 → 1.7.3
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/dist/es/cli.mjs +11 -5
- package/dist/es/index.mjs +11 -5
- package/dist/es/mcp-server.mjs +11 -5
- package/dist/lib/cli.js +10 -4
- package/dist/lib/index.js +10 -4
- package/dist/lib/mcp-server.js +10 -4
- package/package.json +3 -3
package/dist/es/cli.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { getDebug } from "@midscene/shared/logger";
|
|
|
4
4
|
import { BaseMidsceneTools } from "@midscene/shared/mcp";
|
|
5
5
|
import { Agent } from "@midscene/core/agent";
|
|
6
6
|
import node_assert from "node:assert";
|
|
7
|
-
import { execSync, spawn } from "node:child_process";
|
|
7
|
+
import { execFileSync, execSync, spawn } from "node:child_process";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { actionHoverParamSchema, defineAction, defineActionClearInput, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionRightClick, defineActionScroll, defineActionTap } from "@midscene/core/device";
|
|
10
10
|
import { sleep } from "@midscene/core/utils";
|
|
@@ -155,13 +155,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
155
155
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
156
156
|
let script;
|
|
157
157
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
158
|
-
else
|
|
158
|
+
else {
|
|
159
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
160
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
161
|
+
}
|
|
159
162
|
debugDevice('sendKeyViaAppleScript', {
|
|
160
163
|
key,
|
|
161
164
|
modifiers,
|
|
162
165
|
script
|
|
163
166
|
});
|
|
164
|
-
|
|
167
|
+
execFileSync("osascript", [
|
|
168
|
+
'-e',
|
|
169
|
+
script
|
|
170
|
+
]);
|
|
165
171
|
}
|
|
166
172
|
let libnut = null;
|
|
167
173
|
let libnutLoadError = null;
|
|
@@ -299,7 +305,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
299
305
|
}
|
|
300
306
|
async healthCheck() {
|
|
301
307
|
console.log('[HealthCheck] Starting health check...');
|
|
302
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
308
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
303
309
|
console.log('[HealthCheck] Taking screenshot...');
|
|
304
310
|
const screenshotTimeout = 15000;
|
|
305
311
|
let timeoutId;
|
|
@@ -781,7 +787,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
|
|
|
781
787
|
const tools = new ComputerMidsceneTools();
|
|
782
788
|
runToolsCLI(tools, 'midscene-computer', {
|
|
783
789
|
stripPrefix: 'computer_',
|
|
784
|
-
version: "1.7.
|
|
790
|
+
version: "1.7.3",
|
|
785
791
|
extraCommands: createReportCliCommands()
|
|
786
792
|
}).catch((e)=>{
|
|
787
793
|
if (!(e instanceof CLIError)) console.error(e);
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import node_assert from "node:assert";
|
|
2
|
-
import { execSync, spawn } from "node:child_process";
|
|
2
|
+
import { execFileSync, execSync, spawn } from "node:child_process";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { getMidsceneLocationSchema, z } from "@midscene/core";
|
|
5
5
|
import { actionHoverParamSchema, defineAction, defineActionClearInput, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionRightClick, defineActionScroll, defineActionTap } from "@midscene/core/device";
|
|
@@ -155,13 +155,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
155
155
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
156
156
|
let script;
|
|
157
157
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
158
|
-
else
|
|
158
|
+
else {
|
|
159
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
160
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
161
|
+
}
|
|
159
162
|
debugDevice('sendKeyViaAppleScript', {
|
|
160
163
|
key,
|
|
161
164
|
modifiers,
|
|
162
165
|
script
|
|
163
166
|
});
|
|
164
|
-
|
|
167
|
+
execFileSync("osascript", [
|
|
168
|
+
'-e',
|
|
169
|
+
script
|
|
170
|
+
]);
|
|
165
171
|
}
|
|
166
172
|
let device_libnut = null;
|
|
167
173
|
let libnutLoadError = null;
|
|
@@ -299,7 +305,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
299
305
|
}
|
|
300
306
|
async healthCheck() {
|
|
301
307
|
console.log('[HealthCheck] Starting health check...');
|
|
302
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
308
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
303
309
|
console.log('[HealthCheck] Taking screenshot...');
|
|
304
310
|
const screenshotTimeout = 15000;
|
|
305
311
|
let timeoutId;
|
|
@@ -779,7 +785,7 @@ class ComputerMidsceneTools extends BaseMidsceneTools {
|
|
|
779
785
|
}
|
|
780
786
|
}
|
|
781
787
|
function version() {
|
|
782
|
-
const currentVersion = "1.7.
|
|
788
|
+
const currentVersion = "1.7.3";
|
|
783
789
|
console.log(`@midscene/computer v${currentVersion}`);
|
|
784
790
|
return currentVersion;
|
|
785
791
|
}
|
package/dist/es/mcp-server.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseMCPServer, BaseMidsceneTools, createMCPServerLauncher } from "@midscene/shared/mcp";
|
|
2
2
|
import { Agent } from "@midscene/core/agent";
|
|
3
3
|
import node_assert from "node:assert";
|
|
4
|
-
import { execSync, spawn } from "node:child_process";
|
|
4
|
+
import { execFileSync, execSync, spawn } from "node:child_process";
|
|
5
5
|
import { createRequire } from "node:module";
|
|
6
6
|
import { getMidsceneLocationSchema, z } from "@midscene/core";
|
|
7
7
|
import { actionHoverParamSchema, defineAction, defineActionClearInput, defineActionDoubleClick, defineActionDragAndDrop, defineActionKeyboardPress, defineActionRightClick, defineActionScroll, defineActionTap } from "@midscene/core/device";
|
|
@@ -154,13 +154,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
154
154
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
155
155
|
let script;
|
|
156
156
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
157
|
-
else
|
|
157
|
+
else {
|
|
158
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
159
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
160
|
+
}
|
|
158
161
|
debugDevice('sendKeyViaAppleScript', {
|
|
159
162
|
key,
|
|
160
163
|
modifiers,
|
|
161
164
|
script
|
|
162
165
|
});
|
|
163
|
-
|
|
166
|
+
execFileSync("osascript", [
|
|
167
|
+
'-e',
|
|
168
|
+
script
|
|
169
|
+
]);
|
|
164
170
|
}
|
|
165
171
|
let libnut = null;
|
|
166
172
|
let libnutLoadError = null;
|
|
@@ -298,7 +304,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
298
304
|
}
|
|
299
305
|
async healthCheck() {
|
|
300
306
|
console.log('[HealthCheck] Starting health check...');
|
|
301
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
307
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
302
308
|
console.log('[HealthCheck] Taking screenshot...');
|
|
303
309
|
const screenshotTimeout = 15000;
|
|
304
310
|
let timeoutId;
|
|
@@ -784,7 +790,7 @@ class ComputerMCPServer extends BaseMCPServer {
|
|
|
784
790
|
constructor(toolsManager){
|
|
785
791
|
super({
|
|
786
792
|
name: '@midscene/computer-mcp',
|
|
787
|
-
version: "1.7.
|
|
793
|
+
version: "1.7.3",
|
|
788
794
|
description: 'Control the computer desktop using natural language commands'
|
|
789
795
|
}, toolsManager);
|
|
790
796
|
}
|
package/dist/lib/cli.js
CHANGED
|
@@ -183,13 +183,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
183
183
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
184
184
|
let script;
|
|
185
185
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
186
|
-
else
|
|
186
|
+
else {
|
|
187
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
188
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
189
|
+
}
|
|
187
190
|
debugDevice('sendKeyViaAppleScript', {
|
|
188
191
|
key,
|
|
189
192
|
modifiers,
|
|
190
193
|
script
|
|
191
194
|
});
|
|
192
|
-
(0, external_node_child_process_namespaceObject.
|
|
195
|
+
(0, external_node_child_process_namespaceObject.execFileSync)("osascript", [
|
|
196
|
+
'-e',
|
|
197
|
+
script
|
|
198
|
+
]);
|
|
193
199
|
}
|
|
194
200
|
let libnut = null;
|
|
195
201
|
let libnutLoadError = null;
|
|
@@ -327,7 +333,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
327
333
|
}
|
|
328
334
|
async healthCheck() {
|
|
329
335
|
console.log('[HealthCheck] Starting health check...');
|
|
330
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
336
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
331
337
|
console.log('[HealthCheck] Taking screenshot...');
|
|
332
338
|
const screenshotTimeout = 15000;
|
|
333
339
|
let timeoutId;
|
|
@@ -809,7 +815,7 @@ class ComputerMidsceneTools extends mcp_namespaceObject.BaseMidsceneTools {
|
|
|
809
815
|
const tools = new ComputerMidsceneTools();
|
|
810
816
|
(0, cli_namespaceObject.runToolsCLI)(tools, 'midscene-computer', {
|
|
811
817
|
stripPrefix: 'computer_',
|
|
812
|
-
version: "1.7.
|
|
818
|
+
version: "1.7.3",
|
|
813
819
|
extraCommands: (0, core_namespaceObject.createReportCliCommands)()
|
|
814
820
|
}).catch((e)=>{
|
|
815
821
|
if (!(e instanceof cli_namespaceObject.CLIError)) console.error(e);
|
package/dist/lib/index.js
CHANGED
|
@@ -204,13 +204,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
204
204
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
205
205
|
let script;
|
|
206
206
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
207
|
-
else
|
|
207
|
+
else {
|
|
208
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
209
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
210
|
+
}
|
|
208
211
|
debugDevice('sendKeyViaAppleScript', {
|
|
209
212
|
key,
|
|
210
213
|
modifiers,
|
|
211
214
|
script
|
|
212
215
|
});
|
|
213
|
-
(0, external_node_child_process_namespaceObject.
|
|
216
|
+
(0, external_node_child_process_namespaceObject.execFileSync)("osascript", [
|
|
217
|
+
'-e',
|
|
218
|
+
script
|
|
219
|
+
]);
|
|
214
220
|
}
|
|
215
221
|
let device_libnut = null;
|
|
216
222
|
let libnutLoadError = null;
|
|
@@ -348,7 +354,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
348
354
|
}
|
|
349
355
|
async healthCheck() {
|
|
350
356
|
console.log('[HealthCheck] Starting health check...');
|
|
351
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
357
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
352
358
|
console.log('[HealthCheck] Taking screenshot...');
|
|
353
359
|
const screenshotTimeout = 15000;
|
|
354
360
|
let timeoutId;
|
|
@@ -831,7 +837,7 @@ class ComputerMidsceneTools extends mcp_namespaceObject.BaseMidsceneTools {
|
|
|
831
837
|
}
|
|
832
838
|
const env_namespaceObject = require("@midscene/shared/env");
|
|
833
839
|
function version() {
|
|
834
|
-
const currentVersion = "1.7.
|
|
840
|
+
const currentVersion = "1.7.3";
|
|
835
841
|
console.log(`@midscene/computer v${currentVersion}`);
|
|
836
842
|
return currentVersion;
|
|
837
843
|
}
|
package/dist/lib/mcp-server.js
CHANGED
|
@@ -198,13 +198,19 @@ function sendKeyViaAppleScript(key, modifiers = []) {
|
|
|
198
198
|
const modifierStr = modifierParts.length > 0 ? ` using {${modifierParts.join(', ')}}` : '';
|
|
199
199
|
let script;
|
|
200
200
|
if (void 0 !== keyCode) script = `tell application "System Events" to key code ${keyCode}${modifierStr}`;
|
|
201
|
-
else
|
|
201
|
+
else {
|
|
202
|
+
const escapedKey = key.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
203
|
+
script = `tell application "System Events" to keystroke "${escapedKey}"${modifierStr}`;
|
|
204
|
+
}
|
|
202
205
|
debugDevice('sendKeyViaAppleScript', {
|
|
203
206
|
key,
|
|
204
207
|
modifiers,
|
|
205
208
|
script
|
|
206
209
|
});
|
|
207
|
-
(0, external_node_child_process_namespaceObject.
|
|
210
|
+
(0, external_node_child_process_namespaceObject.execFileSync)("osascript", [
|
|
211
|
+
'-e',
|
|
212
|
+
script
|
|
213
|
+
]);
|
|
208
214
|
}
|
|
209
215
|
let libnut = null;
|
|
210
216
|
let libnutLoadError = null;
|
|
@@ -342,7 +348,7 @@ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ')
|
|
|
342
348
|
}
|
|
343
349
|
async healthCheck() {
|
|
344
350
|
console.log('[HealthCheck] Starting health check...');
|
|
345
|
-
console.log("[HealthCheck] @midscene/computer v1.7.
|
|
351
|
+
console.log("[HealthCheck] @midscene/computer v1.7.3");
|
|
346
352
|
console.log('[HealthCheck] Taking screenshot...');
|
|
347
353
|
const screenshotTimeout = 15000;
|
|
348
354
|
let timeoutId;
|
|
@@ -828,7 +834,7 @@ class ComputerMCPServer extends mcp_namespaceObject.BaseMCPServer {
|
|
|
828
834
|
constructor(toolsManager){
|
|
829
835
|
super({
|
|
830
836
|
name: '@midscene/computer-mcp',
|
|
831
|
-
version: "1.7.
|
|
837
|
+
version: "1.7.3",
|
|
832
838
|
description: 'Control the computer desktop using natural language commands'
|
|
833
839
|
}, toolsManager);
|
|
834
840
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/computer",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"description": "Midscene.js Computer Desktop Automation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@computer-use/libnut": "^4.2.0",
|
|
37
37
|
"clipboardy": "^4.0.0",
|
|
38
38
|
"screenshot-desktop": "^1.15.3",
|
|
39
|
-
"@midscene/core": "1.7.
|
|
40
|
-
"@midscene/shared": "1.7.
|
|
39
|
+
"@midscene/core": "1.7.3",
|
|
40
|
+
"@midscene/shared": "1.7.3"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
43
|
"node-mac-permissions": "2.5.0"
|