@midscene/computer 1.2.1-beta-20260112081017.0

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.
@@ -0,0 +1,559 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ mcpKitForAgent: ()=>mcpKitForAgent,
37
+ mcpServerForAgent: ()=>mcpServerForAgent,
38
+ ComputerMCPServer: ()=>ComputerMCPServer
39
+ });
40
+ const mcp_namespaceObject = require("@midscene/shared/mcp");
41
+ const agent_namespaceObject = require("@midscene/core/agent");
42
+ const external_node_assert_namespaceObject = require("node:assert");
43
+ var external_node_assert_default = /*#__PURE__*/ __webpack_require__.n(external_node_assert_namespaceObject);
44
+ const core_namespaceObject = require("@midscene/core");
45
+ const device_namespaceObject = require("@midscene/core/device");
46
+ const utils_namespaceObject = require("@midscene/core/utils");
47
+ const img_namespaceObject = require("@midscene/shared/img");
48
+ const logger_namespaceObject = require("@midscene/shared/logger");
49
+ const external_screenshot_desktop_namespaceObject = require("screenshot-desktop");
50
+ var external_screenshot_desktop_default = /*#__PURE__*/ __webpack_require__.n(external_screenshot_desktop_namespaceObject);
51
+ function _define_property(obj, key, value) {
52
+ if (key in obj) Object.defineProperty(obj, key, {
53
+ value: value,
54
+ enumerable: true,
55
+ configurable: true,
56
+ writable: true
57
+ });
58
+ else obj[key] = value;
59
+ return obj;
60
+ }
61
+ const SMOOTH_MOVE_STEPS_TAP = 8;
62
+ const SMOOTH_MOVE_STEPS_HOVER = 10;
63
+ const SMOOTH_MOVE_DELAY_TAP = 8;
64
+ const SMOOTH_MOVE_DELAY_HOVER = 10;
65
+ const HOVER_EFFECT_WAIT = 300;
66
+ const CLICK_HOLD_DURATION = 50;
67
+ const INPUT_FOCUS_DELAY = 300;
68
+ const INPUT_CLEAR_DELAY = 150;
69
+ const SCROLL_REPEAT_COUNT = 10;
70
+ const SCROLL_STEP_DELAY = 100;
71
+ const SCROLL_COMPLETE_DELAY = 500;
72
+ let libnut = null;
73
+ let libnutLoadError = null;
74
+ async function getLibnut() {
75
+ if (libnut) return libnut;
76
+ if (libnutLoadError) throw libnutLoadError;
77
+ try {
78
+ const libnutModule = await import("@computer-use/libnut/dist/import_libnut");
79
+ libnut = libnutModule.libnut;
80
+ if (!libnut) throw new Error('libnut module loaded but libnut object is undefined');
81
+ return libnut;
82
+ } catch (error) {
83
+ libnutLoadError = error;
84
+ throw new Error(`Failed to load @computer-use/libnut. Make sure it is properly installed and compiled for your platform. Error: ${error}`);
85
+ }
86
+ }
87
+ const debugDevice = (0, logger_namespaceObject.getDebug)('computer:device');
88
+ async function smoothMoveMouse(targetX, targetY, steps, stepDelay) {
89
+ external_node_assert_default()(libnut, 'libnut not initialized');
90
+ const currentPos = libnut.getMousePos();
91
+ for(let i = 1; i <= steps; i++){
92
+ const stepX = Math.round(currentPos.x + (targetX - currentPos.x) * i / steps);
93
+ const stepY = Math.round(currentPos.y + (targetY - currentPos.y) * i / steps);
94
+ libnut.moveMouse(stepX, stepY);
95
+ await (0, utils_namespaceObject.sleep)(stepDelay);
96
+ }
97
+ }
98
+ const KEY_NAME_MAP = {
99
+ windows: 'win',
100
+ win: 'win',
101
+ ctrl: 'control',
102
+ esc: 'escape',
103
+ del: 'delete',
104
+ ins: 'insert',
105
+ pgup: 'pageup',
106
+ pgdn: 'pagedown',
107
+ arrowup: 'up',
108
+ arrowdown: 'down',
109
+ arrowleft: 'left',
110
+ arrowright: 'right',
111
+ volumedown: 'audio_vol_down',
112
+ volumeup: 'audio_vol_up',
113
+ mediavolumedown: 'audio_vol_down',
114
+ mediavolumeup: 'audio_vol_up',
115
+ mute: 'audio_mute',
116
+ mediamute: 'audio_mute',
117
+ mediaplay: 'audio_play',
118
+ mediapause: 'audio_pause',
119
+ mediaplaypause: 'audio_play',
120
+ mediastop: 'audio_stop',
121
+ medianexttrack: 'audio_next',
122
+ mediaprevioustrack: 'audio_prev',
123
+ medianext: 'audio_next',
124
+ mediaprev: 'audio_prev'
125
+ };
126
+ const PRIMARY_KEY_MAP = {
127
+ command: 'cmd',
128
+ cmd: 'cmd',
129
+ meta: 'meta',
130
+ control: 'control',
131
+ ctrl: 'control',
132
+ shift: 'shift',
133
+ alt: 'alt',
134
+ option: 'alt'
135
+ };
136
+ function normalizeKeyName(key) {
137
+ const lowerKey = key.toLowerCase();
138
+ return KEY_NAME_MAP[lowerKey] || lowerKey;
139
+ }
140
+ function normalizePrimaryKey(key) {
141
+ const lowerKey = key.toLowerCase();
142
+ if (PRIMARY_KEY_MAP[lowerKey]) return PRIMARY_KEY_MAP[lowerKey];
143
+ return KEY_NAME_MAP[lowerKey] || lowerKey;
144
+ }
145
+ class ComputerDevice {
146
+ describe() {
147
+ return this.description || 'Computer Device';
148
+ }
149
+ static async listDisplays() {
150
+ try {
151
+ const displays = await external_screenshot_desktop_default().listDisplays();
152
+ return displays.map((d)=>({
153
+ id: String(d.id),
154
+ name: d.name || `Display ${d.id}`,
155
+ primary: d.primary || false
156
+ }));
157
+ } catch (error) {
158
+ debugDevice(`Failed to list displays: ${error}`);
159
+ return [];
160
+ }
161
+ }
162
+ async connect() {
163
+ debugDevice('Connecting to computer device');
164
+ try {
165
+ libnut = await getLibnut();
166
+ const size = await this.size();
167
+ const displays = await ComputerDevice.listDisplays();
168
+ this.description = `
169
+ Type: Computer
170
+ Platform: ${process.platform}
171
+ Display: ${this.displayId || 'Primary'}
172
+ Screen Size: ${size.width}x${size.height}
173
+ Available Displays: ${displays.length > 0 ? displays.map((d)=>d.name).join(', ') : 'Unknown'}
174
+ `;
175
+ debugDevice('Computer device connected', this.description);
176
+ } catch (error) {
177
+ debugDevice(`Failed to connect: ${error}`);
178
+ throw new Error(`Unable to connect to computer device: ${error}`);
179
+ }
180
+ }
181
+ async screenshotBase64() {
182
+ debugDevice('Taking screenshot', {
183
+ displayId: this.displayId
184
+ });
185
+ try {
186
+ const options = {
187
+ format: 'png'
188
+ };
189
+ if (void 0 !== this.displayId) if ('darwin' === process.platform) {
190
+ const screenIndex = Number(this.displayId);
191
+ if (!Number.isNaN(screenIndex)) options.screen = screenIndex;
192
+ } else options.screen = this.displayId;
193
+ debugDevice('Screenshot options', options);
194
+ const buffer = await external_screenshot_desktop_default()(options);
195
+ return (0, img_namespaceObject.createImgBase64ByFormat)('png', buffer.toString('base64'));
196
+ } catch (error) {
197
+ debugDevice(`Screenshot failed: ${error}`);
198
+ throw new Error(`Failed to take screenshot: ${error}`);
199
+ }
200
+ }
201
+ async size() {
202
+ external_node_assert_default()(libnut, 'libnut not initialized');
203
+ try {
204
+ const screenSize = libnut.getScreenSize();
205
+ return {
206
+ width: screenSize.width,
207
+ height: screenSize.height,
208
+ dpr: 1
209
+ };
210
+ } catch (error) {
211
+ debugDevice(`Failed to get screen size: ${error}`);
212
+ throw new Error(`Failed to get screen size: ${error}`);
213
+ }
214
+ }
215
+ actionSpace() {
216
+ const defaultActions = [
217
+ (0, device_namespaceObject.defineActionTap)(async (param)=>{
218
+ external_node_assert_default()(libnut, 'libnut not initialized');
219
+ const element = param.locate;
220
+ external_node_assert_default()(element, 'Element not found, cannot tap');
221
+ const [x, y] = element.center;
222
+ const targetX = Math.round(x);
223
+ const targetY = Math.round(y);
224
+ await smoothMoveMouse(targetX, targetY, SMOOTH_MOVE_STEPS_TAP, SMOOTH_MOVE_DELAY_TAP);
225
+ libnut.mouseToggle('down', 'left');
226
+ await (0, utils_namespaceObject.sleep)(CLICK_HOLD_DURATION);
227
+ libnut.mouseToggle('up', 'left');
228
+ }),
229
+ (0, device_namespaceObject.defineActionDoubleClick)(async (param)=>{
230
+ external_node_assert_default()(libnut, 'libnut not initialized');
231
+ const element = param.locate;
232
+ external_node_assert_default()(element, 'Element not found, cannot double click');
233
+ const [x, y] = element.center;
234
+ libnut.moveMouse(Math.round(x), Math.round(y));
235
+ libnut.mouseClick('left', true);
236
+ }),
237
+ (0, device_namespaceObject.defineActionRightClick)(async (param)=>{
238
+ external_node_assert_default()(libnut, 'libnut not initialized');
239
+ const element = param.locate;
240
+ external_node_assert_default()(element, 'Element not found, cannot right click');
241
+ const [x, y] = element.center;
242
+ libnut.moveMouse(Math.round(x), Math.round(y));
243
+ libnut.mouseClick('right');
244
+ }),
245
+ (0, device_namespaceObject.defineActionHover)(async (param)=>{
246
+ external_node_assert_default()(libnut, 'libnut not initialized');
247
+ const element = param.locate;
248
+ external_node_assert_default()(element, 'Element not found, cannot hover');
249
+ const [x, y] = element.center;
250
+ const targetX = Math.round(x);
251
+ const targetY = Math.round(y);
252
+ await smoothMoveMouse(targetX, targetY, SMOOTH_MOVE_STEPS_HOVER, SMOOTH_MOVE_DELAY_HOVER);
253
+ await (0, utils_namespaceObject.sleep)(HOVER_EFFECT_WAIT);
254
+ }),
255
+ (0, device_namespaceObject.defineAction)({
256
+ name: 'Input',
257
+ description: 'Input text into the input field',
258
+ interfaceAlias: 'aiInput',
259
+ paramSchema: core_namespaceObject.z.object({
260
+ value: core_namespaceObject.z.string().describe('The text to input'),
261
+ mode: core_namespaceObject.z["enum"]([
262
+ 'replace',
263
+ 'clear',
264
+ 'append'
265
+ ]).default('replace').optional().describe('Input mode: replace, clear, or append'),
266
+ locate: (0, core_namespaceObject.getMidsceneLocationSchema)().describe('The input field to be filled').optional()
267
+ }),
268
+ call: async (param)=>{
269
+ external_node_assert_default()(libnut, 'libnut not initialized');
270
+ const element = param.locate;
271
+ if (element && 'append' !== param.mode) {
272
+ const [x, y] = element.center;
273
+ libnut.moveMouse(Math.round(x), Math.round(y));
274
+ libnut.mouseClick('left');
275
+ await (0, utils_namespaceObject.sleep)(INPUT_FOCUS_DELAY);
276
+ const modifier = 'darwin' === process.platform ? 'command' : 'control';
277
+ libnut.keyTap('a', [
278
+ modifier
279
+ ]);
280
+ await (0, utils_namespaceObject.sleep)(50);
281
+ libnut.keyTap('backspace');
282
+ await (0, utils_namespaceObject.sleep)(INPUT_CLEAR_DELAY);
283
+ }
284
+ if ('clear' === param.mode) return;
285
+ if (!param.value) return;
286
+ libnut.typeString(param.value);
287
+ }
288
+ }),
289
+ (0, device_namespaceObject.defineActionScroll)(async (param)=>{
290
+ external_node_assert_default()(libnut, 'libnut not initialized');
291
+ if (param.locate) {
292
+ const element = param.locate;
293
+ const [x, y] = element.center;
294
+ libnut.moveMouse(Math.round(x), Math.round(y));
295
+ }
296
+ const scrollType = param?.scrollType;
297
+ const scrollToEdgeActions = {
298
+ scrollToTop: [
299
+ 0,
300
+ 10
301
+ ],
302
+ scrollToBottom: [
303
+ 0,
304
+ -10
305
+ ],
306
+ scrollToLeft: [
307
+ -10,
308
+ 0
309
+ ],
310
+ scrollToRight: [
311
+ 10,
312
+ 0
313
+ ]
314
+ };
315
+ const edgeAction = scrollToEdgeActions[scrollType || ''];
316
+ if (edgeAction) {
317
+ const [dx, dy] = edgeAction;
318
+ for(let i = 0; i < SCROLL_REPEAT_COUNT; i++){
319
+ libnut.scrollMouse(dx, dy);
320
+ await (0, utils_namespaceObject.sleep)(SCROLL_STEP_DELAY);
321
+ }
322
+ return;
323
+ }
324
+ if ('singleAction' === scrollType || !scrollType) {
325
+ const distance = param?.distance || 500;
326
+ const ticks = Math.ceil(distance / 100);
327
+ const direction = param?.direction || 'down';
328
+ const directionMap = {
329
+ up: [
330
+ 0,
331
+ ticks
332
+ ],
333
+ down: [
334
+ 0,
335
+ -ticks
336
+ ],
337
+ left: [
338
+ -ticks,
339
+ 0
340
+ ],
341
+ right: [
342
+ ticks,
343
+ 0
344
+ ]
345
+ };
346
+ const [dx, dy] = directionMap[direction] || [
347
+ 0,
348
+ -ticks
349
+ ];
350
+ libnut.scrollMouse(dx, dy);
351
+ await (0, utils_namespaceObject.sleep)(SCROLL_COMPLETE_DELAY);
352
+ return;
353
+ }
354
+ throw new Error(`Unknown scroll type: ${scrollType}, param: ${JSON.stringify(param)}`);
355
+ }),
356
+ (0, device_namespaceObject.defineActionKeyboardPress)(async (param)=>{
357
+ external_node_assert_default()(libnut, 'libnut not initialized');
358
+ if (param.locate) {
359
+ const [x, y] = param.locate.center;
360
+ libnut.moveMouse(Math.round(x), Math.round(y));
361
+ libnut.mouseClick('left');
362
+ await (0, utils_namespaceObject.sleep)(50);
363
+ }
364
+ const keys = param.keyName.split('+');
365
+ const modifiers = keys.slice(0, -1).map(normalizeKeyName);
366
+ const key = normalizePrimaryKey(keys[keys.length - 1]);
367
+ debugDevice('KeyboardPress', {
368
+ original: param.keyName,
369
+ key,
370
+ modifiers
371
+ });
372
+ if (modifiers.length > 0) libnut.keyTap(key, modifiers);
373
+ else libnut.keyTap(key);
374
+ }),
375
+ (0, device_namespaceObject.defineActionDragAndDrop)(async (param)=>{
376
+ external_node_assert_default()(libnut, 'libnut not initialized');
377
+ const from = param.from;
378
+ const to = param.to;
379
+ external_node_assert_default()(from, 'missing "from" param for drag and drop');
380
+ external_node_assert_default()(to, 'missing "to" param for drag and drop');
381
+ const [fromX, fromY] = from.center;
382
+ const [toX, toY] = to.center;
383
+ libnut.moveMouse(Math.round(fromX), Math.round(fromY));
384
+ libnut.mouseToggle('down', 'left');
385
+ await (0, utils_namespaceObject.sleep)(100);
386
+ libnut.moveMouse(Math.round(toX), Math.round(toY));
387
+ await (0, utils_namespaceObject.sleep)(100);
388
+ libnut.mouseToggle('up', 'left');
389
+ }),
390
+ (0, device_namespaceObject.defineActionClearInput)(async (param)=>{
391
+ external_node_assert_default()(libnut, 'libnut not initialized');
392
+ const element = param.locate;
393
+ external_node_assert_default()(element, 'Element not found, cannot clear input');
394
+ const [x, y] = element.center;
395
+ libnut.moveMouse(Math.round(x), Math.round(y));
396
+ libnut.mouseClick('left');
397
+ await (0, utils_namespaceObject.sleep)(100);
398
+ const modifier = 'darwin' === process.platform ? 'command' : 'control';
399
+ libnut.keyTap('a', [
400
+ modifier
401
+ ]);
402
+ libnut.keyTap('backspace');
403
+ await (0, utils_namespaceObject.sleep)(50);
404
+ })
405
+ ];
406
+ const platformActions = Object.values(createPlatformActions());
407
+ const customActions = this.options?.customActions || [];
408
+ return [
409
+ ...defaultActions,
410
+ ...platformActions,
411
+ ...customActions
412
+ ];
413
+ }
414
+ async destroy() {
415
+ if (this.destroyed) return;
416
+ this.destroyed = true;
417
+ debugDevice('Computer device destroyed');
418
+ }
419
+ async url() {
420
+ return '';
421
+ }
422
+ constructor(options){
423
+ _define_property(this, "interfaceType", 'computer');
424
+ _define_property(this, "options", void 0);
425
+ _define_property(this, "displayId", void 0);
426
+ _define_property(this, "description", void 0);
427
+ _define_property(this, "destroyed", false);
428
+ _define_property(this, "uri", void 0);
429
+ this.options = options;
430
+ this.displayId = options?.displayId;
431
+ }
432
+ }
433
+ function createPlatformActions() {
434
+ return {
435
+ ListDisplays: (0, device_namespaceObject.defineAction)({
436
+ name: 'ListDisplays',
437
+ description: 'List all available displays/monitors',
438
+ call: async ()=>await ComputerDevice.listDisplays()
439
+ })
440
+ };
441
+ }
442
+ class ComputerAgent extends agent_namespaceObject.Agent {
443
+ }
444
+ async function agentFromComputer(opts) {
445
+ const device = new ComputerDevice(opts || {});
446
+ await device.connect();
447
+ return new ComputerAgent(device, opts);
448
+ }
449
+ const debug = (0, logger_namespaceObject.getDebug)('mcp:computer-tools');
450
+ class ComputerMidsceneTools extends mcp_namespaceObject.BaseMidsceneTools {
451
+ createTemporaryDevice() {
452
+ return new ComputerDevice({});
453
+ }
454
+ async ensureAgent(displayId) {
455
+ if (this.agent && displayId) {
456
+ try {
457
+ await this.agent.destroy?.();
458
+ } catch (error) {
459
+ debug('Failed to destroy agent during cleanup:', error);
460
+ }
461
+ this.agent = void 0;
462
+ }
463
+ if (this.agent) return this.agent;
464
+ debug('Creating Computer agent with displayId:', displayId || 'primary');
465
+ const opts = displayId ? {
466
+ displayId
467
+ } : void 0;
468
+ const agent = await agentFromComputer(opts);
469
+ this.agent = agent;
470
+ return agent;
471
+ }
472
+ preparePlatformTools() {
473
+ return [
474
+ {
475
+ name: 'computer_connect',
476
+ description: 'Connect to computer desktop. If displayId not provided, uses the primary display.',
477
+ schema: {
478
+ displayId: core_namespaceObject.z.string().optional().describe('Display ID (from list_displays)')
479
+ },
480
+ handler: async ({ displayId })=>{
481
+ const agent = await this.ensureAgent(displayId);
482
+ const screenshot = await agent.interface.screenshotBase64();
483
+ return {
484
+ content: [
485
+ {
486
+ type: 'text',
487
+ text: `Connected to computer${displayId ? ` (Display: ${displayId})` : ' (Primary display)'}`
488
+ },
489
+ ...this.buildScreenshotContent(screenshot)
490
+ ]
491
+ };
492
+ }
493
+ },
494
+ {
495
+ name: 'computer_disconnect',
496
+ description: 'Disconnect from computer and release resources',
497
+ schema: {},
498
+ handler: this.createDisconnectHandler('computer')
499
+ },
500
+ {
501
+ name: 'computer_list_displays',
502
+ description: 'List all available displays/monitors',
503
+ schema: {},
504
+ handler: async ()=>{
505
+ const displays = await ComputerDevice.listDisplays();
506
+ return {
507
+ content: [
508
+ {
509
+ type: 'text',
510
+ text: `Available displays:\n${displays.map((d)=>`- ${d.name} (ID: ${d.id})${d.primary ? ' [PRIMARY]' : ''}`).join('\n')}`
511
+ }
512
+ ]
513
+ };
514
+ }
515
+ }
516
+ ];
517
+ }
518
+ }
519
+ class ComputerMCPServer extends mcp_namespaceObject.BaseMCPServer {
520
+ createToolsManager() {
521
+ return new ComputerMidsceneTools();
522
+ }
523
+ constructor(toolsManager){
524
+ super({
525
+ name: '@midscene/computer-mcp',
526
+ version: __VERSION__,
527
+ description: 'Control the computer desktop using natural language commands'
528
+ }, toolsManager);
529
+ }
530
+ }
531
+ function mcpServerForAgent(agent) {
532
+ return (0, mcp_namespaceObject.createMCPServerLauncher)({
533
+ agent,
534
+ platformName: 'Computer',
535
+ ToolsManagerClass: ComputerMidsceneTools,
536
+ MCPServerClass: ComputerMCPServer
537
+ });
538
+ }
539
+ async function mcpKitForAgent(agent) {
540
+ const toolsManager = new ComputerMidsceneTools();
541
+ const computerAgent = agent instanceof ComputerAgent ? agent : agent;
542
+ toolsManager.setAgent(computerAgent);
543
+ await toolsManager.initTools();
544
+ return {
545
+ description: 'Midscene MCP Kit for computer desktop automation',
546
+ tools: toolsManager.getToolDefinitions()
547
+ };
548
+ }
549
+ exports.ComputerMCPServer = __webpack_exports__.ComputerMCPServer;
550
+ exports.mcpKitForAgent = __webpack_exports__.mcpKitForAgent;
551
+ exports.mcpServerForAgent = __webpack_exports__.mcpServerForAgent;
552
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
553
+ "ComputerMCPServer",
554
+ "mcpKitForAgent",
555
+ "mcpServerForAgent"
556
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
557
+ Object.defineProperty(exports, '__esModule', {
558
+ value: true
559
+ });
@@ -0,0 +1,70 @@
1
+ import { AbstractInterface } from '@midscene/core/device';
2
+ import { Agent } from '@midscene/core/agent';
3
+ import { AgentOpt } from '@midscene/core/agent';
4
+ import { DeviceAction } from '@midscene/core';
5
+ import { InterfaceType } from '@midscene/core';
6
+ import { overrideAIConfig } from '@midscene/shared/env';
7
+ import { Size } from '@midscene/core';
8
+
9
+ /**
10
+ * Create an Agent from computer
11
+ */
12
+ export declare function agentFromComputer(opts?: ComputerAgentOpt): Promise<ComputerAgent>;
13
+
14
+ /**
15
+ * Check if the computer environment is available
16
+ */
17
+ export declare function checkComputerEnvironment(): Promise<EnvironmentCheck>;
18
+
19
+ export declare class ComputerAgent extends Agent<ComputerDevice> {
20
+ }
21
+
22
+ export declare type ComputerAgentOpt = AgentOpt & ComputerDeviceOpt;
23
+
24
+ export declare class ComputerDevice implements AbstractInterface {
25
+ interfaceType: InterfaceType;
26
+ private options?;
27
+ private displayId?;
28
+ private description?;
29
+ private destroyed;
30
+ uri?: string;
31
+ constructor(options?: ComputerDeviceOpt);
32
+ describe(): string;
33
+ /**
34
+ * Get all available displays
35
+ */
36
+ static listDisplays(): Promise<DisplayInfo[]>;
37
+ connect(): Promise<void>;
38
+ screenshotBase64(): Promise<string>;
39
+ size(): Promise<Size>;
40
+ actionSpace(): DeviceAction<any>[];
41
+ destroy(): Promise<void>;
42
+ url(): Promise<string>;
43
+ }
44
+
45
+ export declare interface ComputerDeviceOpt {
46
+ displayId?: string;
47
+ customActions?: DeviceAction<any>[];
48
+ }
49
+
50
+ export declare interface DisplayInfo {
51
+ id: string;
52
+ name: string;
53
+ primary?: boolean;
54
+ }
55
+
56
+ declare interface EnvironmentCheck {
57
+ available: boolean;
58
+ error?: string;
59
+ platform: string;
60
+ displays: number;
61
+ }
62
+
63
+ /**
64
+ * Get all connected displays
65
+ */
66
+ export declare function getConnectedDisplays(): Promise<DisplayInfo[]>;
67
+
68
+ export { overrideAIConfig }
69
+
70
+ export { }