@midscene/computer 1.8.0 → 1.8.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/dist/es/cli.mjs +898 -274
- package/dist/es/index.mjs +450 -395
- package/dist/es/mcp-server.mjs +898 -274
- package/dist/lib/cli.js +879 -256
- package/dist/lib/index.js +452 -394
- package/dist/lib/mcp-server.js +880 -257
- package/dist/types/index.d.ts +34 -5
- package/dist/types/mcp-server.d.ts +25 -5
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ import { Agent } from '@midscene/core/agent';
|
|
|
3
3
|
import { AgentOpt } from '@midscene/core/agent';
|
|
4
4
|
import { BaseMidsceneTools } from '@midscene/shared/mcp/base-tools';
|
|
5
5
|
import { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
6
|
-
import {
|
|
6
|
+
import { ComputerInputPrimitives } from '@midscene/core/device';
|
|
7
|
+
import type { DeviceAction } from '@midscene/core';
|
|
7
8
|
import { InitArgSpec } from '@midscene/shared/mcp/base-tools';
|
|
8
|
-
import { InterfaceType } from '@midscene/core';
|
|
9
|
+
import type { InterfaceType } from '@midscene/core';
|
|
9
10
|
import { overrideAIConfig } from '@midscene/shared/env';
|
|
10
|
-
import { Size } from '@midscene/core';
|
|
11
|
+
import type { Size } from '@midscene/core';
|
|
11
12
|
import { SpawnOptionsWithoutStdio } from 'node:child_process';
|
|
12
13
|
import type { ToolDefinition } from '@midscene/shared/mcp/types';
|
|
13
14
|
|
|
@@ -41,6 +42,15 @@ export declare function checkAccessibilityPermission(promptIfNeeded?: boolean):
|
|
|
41
42
|
*/
|
|
42
43
|
export declare function checkComputerEnvironment(): Promise<EnvironmentCheck>;
|
|
43
44
|
|
|
45
|
+
/**
|
|
46
|
+
* Check if macOS Screen Recording permission is granted (required for screencapture).
|
|
47
|
+
* Accessibility and Screen Recording are independent TCC permissions — granting
|
|
48
|
+
* one does not grant the other. On non-macOS platforms, always returns true.
|
|
49
|
+
*
|
|
50
|
+
* @param promptIfNeeded - If true, will trigger system prompt and open settings when permission is not granted (macOS only)
|
|
51
|
+
*/
|
|
52
|
+
export declare function checkScreenRecordingPermission(promptIfNeeded?: boolean): AccessibilityCheckResult;
|
|
53
|
+
|
|
44
54
|
/**
|
|
45
55
|
* Check if Xvfb is installed on the system
|
|
46
56
|
*/
|
|
@@ -67,6 +77,7 @@ export declare class ComputerDevice implements AbstractInterface {
|
|
|
67
77
|
*/
|
|
68
78
|
private useAppleScript;
|
|
69
79
|
uri?: string;
|
|
80
|
+
readonly inputPrimitives: ComputerInputPrimitives;
|
|
70
81
|
constructor(options?: ComputerDeviceOpt);
|
|
71
82
|
describe(): string;
|
|
72
83
|
/**
|
|
@@ -97,6 +108,9 @@ export declare class ComputerDevice implements AbstractInterface {
|
|
|
97
108
|
* which can swallow characters or convert them when a non-English IME is active.
|
|
98
109
|
*/
|
|
99
110
|
private smartTypeString;
|
|
111
|
+
private selectAllAndDelete;
|
|
112
|
+
private pressKeyboardShortcut;
|
|
113
|
+
private performScroll;
|
|
100
114
|
actionSpace(): DeviceAction<any>[];
|
|
101
115
|
destroy(): Promise<void>;
|
|
102
116
|
url(): Promise<string>;
|
|
@@ -124,10 +138,20 @@ export declare interface ComputerDeviceOpt {
|
|
|
124
138
|
xvfbResolution?: string;
|
|
125
139
|
}
|
|
126
140
|
|
|
127
|
-
|
|
141
|
+
/**
|
|
142
|
+
* Discriminated union describing the two ways `computer_*` tools can spawn an
|
|
143
|
+
* agent. `mode` is filled in by `initArgSpec.adapt` based on whether `host` is
|
|
144
|
+
* set, so callers (CLI/MCP/YAML) never have to provide it explicitly.
|
|
145
|
+
*/
|
|
146
|
+
declare type ComputerInitArgs = ComputerLocalInitArgs | ComputerRDPInitArgs;
|
|
128
147
|
|
|
129
148
|
export declare type ComputerInterface = ComputerDevice | RDPDevice;
|
|
130
149
|
|
|
150
|
+
/** Init args for the local desktop agent (macOS/Windows/Linux). */
|
|
151
|
+
declare type ComputerLocalInitArgs = {
|
|
152
|
+
mode: 'local';
|
|
153
|
+
} & Pick<ComputerDeviceOpt, 'displayId' | 'headless'>;
|
|
154
|
+
|
|
131
155
|
/**
|
|
132
156
|
* Computer-specific tools manager
|
|
133
157
|
* Extends BaseMidsceneTools to provide desktop automation tools
|
|
@@ -143,6 +167,11 @@ export declare class ComputerMidsceneTools extends BaseMidsceneTools<ComputerAge
|
|
|
143
167
|
protected preparePlatformTools(): ToolDefinition[];
|
|
144
168
|
}
|
|
145
169
|
|
|
170
|
+
/** Init args for the RDP remote-desktop agent. */
|
|
171
|
+
declare type ComputerRDPInitArgs = {
|
|
172
|
+
mode: 'rdp';
|
|
173
|
+
} & RDPConnectionConfig;
|
|
174
|
+
|
|
146
175
|
export declare function createDefaultRDPBackendClient(): RDPBackendClient;
|
|
147
176
|
|
|
148
177
|
export declare interface DisplayInfo {
|
|
@@ -252,6 +281,7 @@ export declare class RDPDevice implements AbstractInterface {
|
|
|
252
281
|
private destroyed;
|
|
253
282
|
private cursorPosition?;
|
|
254
283
|
uri?: string;
|
|
284
|
+
readonly inputPrimitives: ComputerInputPrimitives;
|
|
255
285
|
constructor(options: RDPDeviceOpt);
|
|
256
286
|
describe(): string;
|
|
257
287
|
connect(): Promise<void>;
|
|
@@ -261,7 +291,6 @@ export declare class RDPDevice implements AbstractInterface {
|
|
|
261
291
|
actionSpace(): DeviceAction<any>[];
|
|
262
292
|
private assertConnected;
|
|
263
293
|
private throwIfDestroyed;
|
|
264
|
-
private requireLocate;
|
|
265
294
|
private moveToElement;
|
|
266
295
|
private clearInput;
|
|
267
296
|
private edgeScrollDirection;
|
|
@@ -2,12 +2,13 @@ import { AbstractInterface } from '@midscene/core/device';
|
|
|
2
2
|
import { Agent } from '@midscene/core/agent';
|
|
3
3
|
import { BaseMCPServer } from '@midscene/shared/mcp';
|
|
4
4
|
import { BaseMidsceneTools } from '@midscene/shared/mcp/base-tools';
|
|
5
|
-
import {
|
|
5
|
+
import { ComputerInputPrimitives } from '@midscene/core/device';
|
|
6
|
+
import type { DeviceAction } from '@midscene/core';
|
|
6
7
|
import { InitArgSpec } from '@midscene/shared/mcp/base-tools';
|
|
7
|
-
import { InterfaceType } from '@midscene/core';
|
|
8
|
+
import type { InterfaceType } from '@midscene/core';
|
|
8
9
|
import { LaunchMCPServerOptions } from '@midscene/shared/mcp';
|
|
9
10
|
import { LaunchMCPServerResult } from '@midscene/shared/mcp';
|
|
10
|
-
import { Size } from '@midscene/core';
|
|
11
|
+
import type { Size } from '@midscene/core';
|
|
11
12
|
import { Tool } from '@midscene/shared/mcp';
|
|
12
13
|
import type { ToolDefinition } from '@midscene/shared/mcp/types';
|
|
13
14
|
|
|
@@ -28,6 +29,7 @@ declare class ComputerDevice implements AbstractInterface {
|
|
|
28
29
|
*/
|
|
29
30
|
private useAppleScript;
|
|
30
31
|
uri?: string;
|
|
32
|
+
readonly inputPrimitives: ComputerInputPrimitives;
|
|
31
33
|
constructor(options?: ComputerDeviceOpt);
|
|
32
34
|
describe(): string;
|
|
33
35
|
/**
|
|
@@ -58,6 +60,9 @@ declare class ComputerDevice implements AbstractInterface {
|
|
|
58
60
|
* which can swallow characters or convert them when a non-English IME is active.
|
|
59
61
|
*/
|
|
60
62
|
private smartTypeString;
|
|
63
|
+
private selectAllAndDelete;
|
|
64
|
+
private pressKeyboardShortcut;
|
|
65
|
+
private performScroll;
|
|
61
66
|
actionSpace(): DeviceAction<any>[];
|
|
62
67
|
destroy(): Promise<void>;
|
|
63
68
|
url(): Promise<string>;
|
|
@@ -85,10 +90,20 @@ declare interface ComputerDeviceOpt {
|
|
|
85
90
|
xvfbResolution?: string;
|
|
86
91
|
}
|
|
87
92
|
|
|
88
|
-
|
|
93
|
+
/**
|
|
94
|
+
* Discriminated union describing the two ways `computer_*` tools can spawn an
|
|
95
|
+
* agent. `mode` is filled in by `initArgSpec.adapt` based on whether `host` is
|
|
96
|
+
* set, so callers (CLI/MCP/YAML) never have to provide it explicitly.
|
|
97
|
+
*/
|
|
98
|
+
declare type ComputerInitArgs = ComputerLocalInitArgs | ComputerRDPInitArgs;
|
|
89
99
|
|
|
90
100
|
declare type ComputerInterface = ComputerDevice | RDPDevice;
|
|
91
101
|
|
|
102
|
+
/** Init args for the local desktop agent (macOS/Windows/Linux). */
|
|
103
|
+
declare type ComputerLocalInitArgs = {
|
|
104
|
+
mode: 'local';
|
|
105
|
+
} & Pick<ComputerDeviceOpt, 'displayId' | 'headless'>;
|
|
106
|
+
|
|
92
107
|
/**
|
|
93
108
|
* Computer MCP Server
|
|
94
109
|
* Provides MCP tools for computer desktop automation
|
|
@@ -113,6 +128,11 @@ declare class ComputerMidsceneTools extends BaseMidsceneTools<ComputerAgent, Com
|
|
|
113
128
|
protected preparePlatformTools(): ToolDefinition[];
|
|
114
129
|
}
|
|
115
130
|
|
|
131
|
+
/** Init args for the RDP remote-desktop agent. */
|
|
132
|
+
declare type ComputerRDPInitArgs = {
|
|
133
|
+
mode: 'rdp';
|
|
134
|
+
} & RDPConnectionConfig;
|
|
135
|
+
|
|
116
136
|
declare interface DisplayInfo {
|
|
117
137
|
id: string;
|
|
118
138
|
name: string;
|
|
@@ -177,6 +197,7 @@ declare class RDPDevice implements AbstractInterface {
|
|
|
177
197
|
private destroyed;
|
|
178
198
|
private cursorPosition?;
|
|
179
199
|
uri?: string;
|
|
200
|
+
readonly inputPrimitives: ComputerInputPrimitives;
|
|
180
201
|
constructor(options: RDPDeviceOpt);
|
|
181
202
|
describe(): string;
|
|
182
203
|
connect(): Promise<void>;
|
|
@@ -186,7 +207,6 @@ declare class RDPDevice implements AbstractInterface {
|
|
|
186
207
|
actionSpace(): DeviceAction<any>[];
|
|
187
208
|
private assertConnected;
|
|
188
209
|
private throwIfDestroyed;
|
|
189
|
-
private requireLocate;
|
|
190
210
|
private moveToElement;
|
|
191
211
|
private clearInput;
|
|
192
212
|
private edgeScrollDirection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/computer",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Midscene.js Computer Desktop Automation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@computer-use/libnut": "^4.2.0",
|
|
39
39
|
"clipboardy": "^4.0.0",
|
|
40
40
|
"screenshot-desktop": "^1.15.3",
|
|
41
|
-
"@midscene/
|
|
42
|
-
"@midscene/
|
|
41
|
+
"@midscene/core": "1.8.1",
|
|
42
|
+
"@midscene/shared": "1.8.1"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
45
|
"node-mac-permissions": "2.5.0"
|