Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
Fix linting
Morgan Dean6401c1281255
diff --git a/libs/typescript/biome.json b/libs/typescript/biome.jsonindex 3251a52d48..a0394eff0e 100644--- a/libs/typescript/biome.json+++ b/libs/typescript/biome.json@@ -7,10 +7,8 @@},"files": {"ignoreUnknown": false,- "ignore": [- "dist",- "node_modules"- ]+ "include": ["core/**/*.ts", "computer/**/*.ts"],+ "ignore": ["dist", "node_modules"]},"formatter": {"enabled": true,@@ -59,12 +57,8 @@"level": "warn","fix": "safe","options": {- "attributes": [- "className"- ],- "functions": [- "cn"- ]+ "attributes": ["className"],+ "functions": ["cn"]}}}@@ -83,4 +77,4 @@"bracketSpacing": true}}-}\ No newline at end of file+}diff --git a/libs/typescript/computer/src/computer/index.ts b/libs/typescript/computer/src/computer/index.tsindex 4a1a7007ef..d7411b6366 100644--- a/libs/typescript/computer/src/computer/index.ts+++ b/libs/typescript/computer/src/computer/index.ts@@ -1 +1 @@-export { BaseComputer, CloudComputer } from "./providers";+export { BaseComputer, CloudComputer } from './providers';diff --git a/libs/typescript/computer/src/computer/providers/base.ts b/libs/typescript/computer/src/computer/providers/base.tsindex d706e72586..6b94021d59 100644--- a/libs/typescript/computer/src/computer/providers/base.ts+++ b/libs/typescript/computer/src/computer/providers/base.ts@@ -1,8 +1,8 @@+import os from 'node:os';import { Telemetry } from '@cua/core';+import pino from 'pino';import type { OSType } from '../../types';import type { BaseComputerConfig, Display, VMProviderType } from '../types';-import pino from 'pino';-import os from 'node:os';const logger = pino({ name: 'computer-base' });diff --git a/libs/typescript/computer/src/computer/providers/cloud.ts b/libs/typescript/computer/src/computer/providers/cloud.tsindex a1e458dc4c..b38541617e 100644--- a/libs/typescript/computer/src/computer/providers/cloud.ts+++ b/libs/typescript/computer/src/computer/providers/cloud.ts@@ -1,12 +1,12 @@-import { BaseComputer } from "./base";-import type { CloudComputerConfig, VMProviderType } from "../types";+import pino from 'pino';import {- InterfaceFactory,type BaseComputerInterface,-} from "../../interface/index";-import pino from "pino";+ InterfaceFactory,+} from '../../interface/index';+import type { CloudComputerConfig, VMProviderType } from '../types';+import { BaseComputer } from './base';-const logger = pino({ name: "computer-cloud" });+const logger = pino({ name: 'computer-cloud' });/*** Cloud-specific computer implementation@@ -31,7 +31,7 @@ export class CloudComputer extends BaseComputer {*/async run(): Promise<void> {if (this.initialized) {- logger.info("Computer already initialized, skipping initialization");+ logger.info('Computer already initialized, skipping initialization');return;}@@ -49,11 +49,11 @@ export class CloudComputer extends BaseComputer {);// Wait for the interface to be ready- logger.info("Waiting for interface to be ready...");+ logger.info('Waiting for interface to be ready...');await this.iface.waitForReady();this.initialized = true;- logger.info("Cloud computer ready");+ logger.info('Cloud computer ready');} catch (error) {logger.error(`Failed to initialize cloud computer: ${error}`);throw new Error(`Failed to initialize cloud computer: ${error}`);@@ -64,7 +64,7 @@ export class CloudComputer extends BaseComputer {* Stop the cloud computer (disconnect interface)*/async stop(): Promise<void> {- logger.info("Disconnecting from cloud computer...");+ logger.info('Disconnecting from cloud computer...');if (this.iface) {this.iface.disconnect();@@ -72,7 +72,7 @@ export class CloudComputer extends BaseComputer {}this.initialized = false;- logger.info("Disconnected from cloud computer");+ logger.info('Disconnected from cloud computer');}/**@@ -80,7 +80,7 @@ export class CloudComputer extends BaseComputer {*/get interface(): BaseComputerInterface {if (!this.iface) {- throw new Error("Computer not initialized. Call run() first.");+ throw new Error('Computer not initialized. Call run() first.');}return this.iface;}diff --git a/libs/typescript/computer/src/computer/providers/index.ts b/libs/typescript/computer/src/computer/providers/index.tsindex d4fd5391cc..27faf7d6db 100644--- a/libs/typescript/computer/src/computer/providers/index.ts+++ b/libs/typescript/computer/src/computer/providers/index.ts@@ -1,2 +1,2 @@-export * from "./base";-export * from "./cloud";\ No newline at end of file+export * from './base';+export * from './cloud';diff --git a/libs/typescript/computer/src/computer/types.ts b/libs/typescript/computer/src/computer/types.tsindex 296302f3f7..7bca918bf8 100644--- a/libs/typescript/computer/src/computer/types.ts+++ b/libs/typescript/computer/src/computer/types.ts@@ -1,4 +1,4 @@-import type { OSType, ScreenSize } from "../types";+import type { OSType, ScreenSize } from '../types';/*** Display configuration for the computer.@@ -32,5 +32,5 @@ export interface CloudComputerConfig extends BaseComputerConfig {}export enum VMProviderType {- CLOUD = "cloud",+ CLOUD = 'cloud',}diff --git a/libs/typescript/computer/src/index.ts b/libs/typescript/computer/src/index.tsindex 9917d55935..44b515fe2d 100644--- a/libs/typescript/computer/src/index.ts+++ b/libs/typescript/computer/src/index.ts@@ -1,6 +1,6 @@// Export classes-export { CloudComputer as Computer } from "./computer";+export { CloudComputer as Computer } from './computer';//todo: figure out what types to export and how to do that//-export { OSType } from "./types";+export { OSType } from './types';diff --git a/libs/typescript/computer/src/interface/base.ts b/libs/typescript/computer/src/interface/base.tsindex a69002d45f..061ce599d8 100644--- a/libs/typescript/computer/src/interface/base.ts+++ b/libs/typescript/computer/src/interface/base.ts@@ -2,11 +2,11 @@* Base interface for computer control.*/-import type { ScreenSize } from "../types";-import WebSocket from "ws";-import pino from "pino";+import pino from 'pino';+import WebSocket from 'ws';+import type { ScreenSize } from '../types';-export type MouseButton = "left" | "middle" | "right";+export type MouseButton = 'left' | 'middle' | 'right';export interface CursorPosition {x: number;@@ -40,12 +40,12 @@ export abstract class BaseComputerInterface {protected apiKey?: string;protected vmName?: string;- protected logger = pino({ name: "interface-base" });+ protected logger = pino({ name: 'interface-base' });constructor(ipAddress: string,- username = "lume",- password = "lume",+ username = 'lume',+ password = 'lume',apiKey?: string,vmName?: string) {@@ -58,8 +58,8 @@ export abstract class BaseComputerInterface {// Initialize WebSocket with headers if neededconst headers: { [key: string]: string } = {};if (this.apiKey && this.vmName) {- headers["X-API-Key"] = this.apiKey;- headers["X-VM-Name"] = this.vmName;+ headers['X-API-Key'] = this.apiKey;+ headers['X-VM-Name'] = this.vmName;}// Create the WebSocket instance@@ -71,15 +71,15 @@ export abstract class BaseComputerInterface {* Subclasses can override this to customize the URI.*/protected get wsUri(): string {- const protocol = this.apiKey ? "wss" : "ws";+ const protocol = this.apiKey ? 'wss' : 'ws';// Check if ipAddress already includes a port- if (this.ipAddress.includes(":")) {+ if (this.ipAddress.includes(':')) {return `${protocol}://${this.ipAddress}/ws`;}// Otherwise, append the default port- const port = this.apiKey ? "8443" : "8000";+ const port = this.apiKey ? '8443' : '8000';return `${protocol}://${this.ipAddress}:${port}/ws`;}@@ -115,9 +115,9 @@ export abstract class BaseComputerInterface {if (this.ws.readyState === WebSocket.OPEN) {// send authentication message if neededif (this.apiKey && this.vmName) {- this.logger.info("Performing authentication handshake...");+ this.logger.info('Performing authentication handshake...');const authMessage = {- command: "authenticate",+ command: 'authenticate',params: {api_key: this.apiKey,container_name: this.vmName,@@ -129,22 +129,22 @@ export abstract class BaseComputerInterface {try {const authResult = JSON.parse(data.toString());if (!authResult.success) {- const errorMsg = authResult.error || "Authentication failed";+ const errorMsg = authResult.error || 'Authentication failed';this.logger.error(`Authentication failed: ${errorMsg}`);this.ws.close();reject(new Error(`Authentication failed: ${errorMsg}`));} else {- this.logger.info("Authentication successful");- this.ws.off("message", authHandler);+ this.logger.info('Authentication successful');+ this.ws.off('message', authHandler);resolve();}} catch (error) {- this.ws.off("message", authHandler);+ this.ws.off('message', authHandler);reject(error);}};- this.ws.on("message", authHandler);+ this.ws.on('message', authHandler);this.ws.send(JSON.stringify(authMessage));});}@@ -159,8 +159,8 @@ export abstract class BaseComputerInterface {) {const headers: { [key: string]: string } = {};if (this.apiKey && this.vmName) {- headers["X-API-Key"] = this.apiKey;- headers["X-VM-Name"] = this.vmName;+ headers['X-API-Key'] = this.apiKey;+ headers['X-VM-Name'] = this.vmName;}this.ws = new WebSocket(this.wsUri, { headers });}@@ -168,23 +168,23 @@ export abstract class BaseComputerInterface {return new Promise((resolve, reject) => {// If already connecting, wait for it to completeif (this.ws.readyState === WebSocket.CONNECTING) {- this.ws.addEventListener("open", () => resolve(), { once: true });- this.ws.addEventListener("error", (error) => reject(error), {+ this.ws.addEventListener('open', () => resolve(), { once: true });+ this.ws.addEventListener('error', (error) => reject(error), {once: true,});return;}// Set up event handlers- this.ws.on("open", () => {+ this.ws.on('open', () => {resolve();});- this.ws.on("error", (error: Error) => {+ this.ws.on('error', (error: Error) => {reject(error);});- this.ws.on("close", () => {+ this.ws.on('close', () => {if (!this.closed) {// Attempt to reconnectsetTimeout(() => this.connect(), 1000);@@ -224,10 +224,10 @@ export abstract class BaseComputerInterface {} catch (error) {innerReject(error);}- this.ws.off("message", messageHandler);+ this.ws.off('message', messageHandler);};- this.ws.on("message", messageHandler);+ this.ws.on('message', messageHandler);const wsCommand = { command, params };this.ws.send(JSON.stringify(wsCommand));}diff --git a/libs/typescript/computer/src/interface/factory.ts b/libs/typescript/computer/src/interface/factory.tsindex 9621d45f36..60864f0eaa 100644--- a/libs/typescript/computer/src/interface/factory.ts+++ b/libs/typescript/computer/src/interface/factory.ts@@ -2,11 +2,11 @@* Factory for creating computer interfaces.*/-import type { BaseComputerInterface } from "./base";-import { MacOSComputerInterface } from "./macos";-import { LinuxComputerInterface } from "./linux";-import { WindowsComputerInterface } from "./windows";-import type { OSType } from "../types";+import type { OSType } from '../types';+import type { BaseComputerInterface } from './base';+import { LinuxComputerInterface } from './linux';+import { MacOSComputerInterface } from './macos';+import { WindowsComputerInterface } from './windows';export const InterfaceFactory = {/**@@ -26,27 +26,27 @@ export const InterfaceFactory = {vmName?: string): BaseComputerInterface {switch (os) {- case "macos":+ case 'macos':return new MacOSComputerInterface(ipAddress,- "lume",- "lume",+ 'lume',+ 'lume',apiKey,vmName);- case "linux":+ case 'linux':return new LinuxComputerInterface(ipAddress,- "lume",- "lume",+ 'lume',+ 'lume',apiKey,vmName);- case "windows":+ case 'windows':return new WindowsComputerInterface(ipAddress,- "lume",- "lume",+ 'lume',+ 'lume',apiKey,vmName);diff --git a/libs/typescript/computer/src/interface/index.ts b/libs/typescript/computer/src/interface/index.tsindex 84141da8d1..285f594b4d 100644--- a/libs/typescript/computer/src/interface/index.ts+++ b/libs/typescript/computer/src/interface/index.ts@@ -1,6 +1,6 @@-export { BaseComputerInterface } from "./base";-export type { MouseButton, CursorPosition, AccessibilityNode } from "./base";-export { InterfaceFactory } from "./factory";-export { MacOSComputerInterface } from "./macos";-export { LinuxComputerInterface } from "./linux";-export { WindowsComputerInterface } from "./windows";+export { BaseComputerInterface } from './base';+export type { MouseButton, CursorPosition, AccessibilityNode } from './base';+export { InterfaceFactory } from './factory';+export { MacOSComputerInterface } from './macos';+export { LinuxComputerInterface } from './linux';+export { WindowsComputerInterface } from './windows';diff --git a/libs/typescript/computer/src/interface/linux.ts b/libs/typescript/computer/src/interface/linux.tsindex 457175882d..5fcf27c364 100644--- a/libs/typescript/computer/src/interface/linux.ts+++ b/libs/typescript/computer/src/interface/linux.ts@@ -2,7 +2,7 @@* Linux computer interface implementation.*/-import { MacOSComputerInterface } from "./macos";+import { MacOSComputerInterface } from './macos';/*** Linux interface implementation.diff --git a/libs/typescript/computer/src/interface/macos.ts b/libs/typescript/computer/src/interface/macos.tsindex d34ed984e4..3c41e03fb1 100644--- a/libs/typescript/computer/src/interface/macos.ts+++ b/libs/typescript/computer/src/interface/macos.ts@@ -2,227 +2,236 @@* macOS computer interface implementation.*/-import { BaseComputerInterface } from "./base";-import type { MouseButton, CursorPosition, AccessibilityNode } from "./base";-import type { ScreenSize } from "../types";+import type { ScreenSize } from '../types';+import { BaseComputerInterface } from './base';+import type { AccessibilityNode, CursorPosition, MouseButton } from './base';export class MacOSComputerInterface extends BaseComputerInterface {// Mouse Actionsasync mouseDown(x?: number,y?: number,- button: MouseButton = "left"+ button: MouseButton = 'left'): Promise<void> {- await this.sendCommand("mouse_down", { x, y, button });+ await this.sendCommand('mouse_down', { x, y, button });}async mouseUp(x?: number,y?: number,- button: MouseButton = "left"+ button: MouseButton = 'left'): Promise<void> {- await this.sendCommand("mouse_up", { x, y, button });+ await this.sendCommand('mouse_up', { x, y, button });}async leftClick(x?: number, y?: number): Promise<void> {- await this.sendCommand("left_click", { x, y });+ await this.sendCommand('left_click', { x, y });}async rightClick(x?: number, y?: number): Promise<void> {- await this.sendCommand("right_click", { x, y });+ await this.sendCommand('right_click', { x, y });}async doubleClick(x?: number, y?: number): Promise<void> {- await this.sendCommand("double_click", { x, y });+ await this.sendCommand('double_click', { x, y });}async moveCursor(x: number, y: number): Promise<void> {- await this.sendCommand("move_cursor", { x, y });+ await this.sendCommand('move_cursor', { x, y });}async dragTo(x: number,y: number,- button: MouseButton = "left",+ button: MouseButton = 'left',duration = 0.5): Promise<void> {- await this.sendCommand("drag_to", { x, y, button, duration });+ await this.sendCommand('drag_to', { x, y, button, duration });}async drag(path: Array<[number, number]>,- button: MouseButton = "left",+ button: MouseButton = 'left',duration = 0.5): Promise<void> {- await this.sendCommand("drag", { path, button, duration });+ await this.sendCommand('drag', { path, button, duration });}// Keyboard Actionsasync keyDown(key: string): Promise<void> {- await this.sendCommand("key_down", { key });+ await this.sendCommand('key_down', { key });}async keyUp(key: string): Promise<void> {- await this.sendCommand("key_up", { key });+ await this.sendCommand('key_up', { key });}async typeText(text: string): Promise<void> {- await this.sendCommand("type_text", { text });+ await this.sendCommand('type_text', { text });}async pressKey(key: string): Promise<void> {- await this.sendCommand("press_key", { key });+ await this.sendCommand('press_key', { key });}async hotkey(...keys: string[]): Promise<void> {- await this.sendCommand("hotkey", { keys });+ await this.sendCommand('hotkey', { keys });}// Scrolling Actionsasync scroll(x: number, y: number): Promise<void> {- await this.sendCommand("scroll", { x, y });+ await this.sendCommand('scroll', { x, y });}async scrollDown(clicks = 1): Promise<void> {- await this.sendCommand("scroll_down", { clicks });+ await this.sendCommand('scroll_down', { clicks });}async scrollUp(clicks = 1): Promise<void> {- await this.sendCommand("scroll_up", { clicks });+ await this.sendCommand('scroll_up', { clicks });}// Screen Actionsasync screenshot(): Promise<Buffer> {- const response = await this.sendCommand("screenshot");+ const response = await this.sendCommand('screenshot');if (!response.image_data) {- throw new Error("Failed to take screenshot");+ throw new Error('Failed to take screenshot');}- return Buffer.from(response.image_data as string, "base64");+ return Buffer.from(response.image_data as string, 'base64');}async getScreenSize(): Promise<ScreenSize> {- const response = await this.sendCommand("get_screen_size");+ const response = await this.sendCommand('get_screen_size');if (!response.success || !response.size) {- throw new Error("Failed to get screen size");+ throw new Error('Failed to get screen size');}return response.size as ScreenSize;}async getCursorPosition(): Promise<CursorPosition> {- const response = await this.sendCommand("get_cursor_position");+ const response = await this.sendCommand('get_cursor_position');if (!response.success || !response.position) {- throw new Error("Failed to get cursor position");+ throw new Error('Failed to get cursor position');}return response.position as CursorPosition;}// Clipboard Actionsasync copyToClipboard(): Promise<string> {- const response = await this.sendCommand("copy_to_clipboard");+ const response = await this.sendCommand('copy_to_clipboard');if (!response.success || !response.content) {- throw new Error("Failed to get clipboard content");+ throw new Error('Failed to get clipboard content');}return response.content as string;}async setClipboard(text: string): Promise<void> {- await this.sendCommand("set_clipboard", { text });+ await this.sendCommand('set_clipboard', { text });}// File System Actionsasync fileExists(path: string): Promise<boolean> {- const response = await this.sendCommand("file_exists", { path });+ const response = await this.sendCommand('file_exists', { path });return (response.exists as boolean) || false;}async directoryExists(path: string): Promise<boolean> {- const response = await this.sendCommand("directory_exists", { path });+ const response = await this.sendCommand('directory_exists', { path });return (response.exists as boolean) || false;}async listDir(path: string): Promise<string[]> {- const response = await this.sendCommand("list_dir", { path });+ const response = await this.sendCommand('list_dir', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to list directory");+ throw new Error((response.error as string) || 'Failed to list directory');}return (response.files as string[]) || [];}async readText(path: string): Promise<string> {- const response = await this.sendCommand("read_text", { path });+ const response = await this.sendCommand('read_text', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to read file");+ throw new Error((response.error as string) || 'Failed to read file');}- return (response.content as string) || "";+ return (response.content as string) || '';}async writeText(path: string, content: string): Promise<void> {- const response = await this.sendCommand("write_text", { path, content });+ const response = await this.sendCommand('write_text', { path, content });if (!response.success) {- throw new Error(response.error as string || "Failed to write file");+ throw new Error((response.error as string) || 'Failed to write file');}}async readBytes(path: string): Promise<Buffer> {- const response = await this.sendCommand("read_bytes", { path });+ const response = await this.sendCommand('read_bytes', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to read file");+ throw new Error((response.error as string) || 'Failed to read file');}- return Buffer.from(response.content_b64 as string, "base64");+ return Buffer.from(response.content_b64 as string, 'base64');}async writeBytes(path: string, content: Buffer): Promise<void> {- const response = await this.sendCommand("write_bytes", {+ const response = await this.sendCommand('write_bytes', {path,- content_b64: content.toString("base64"),+ content_b64: content.toString('base64'),});if (!response.success) {- throw new Error(response.error as string || "Failed to write file");+ throw new Error((response.error as string) || 'Failed to write file');}}async deleteFile(path: string): Promise<void> {- const response = await this.sendCommand("delete_file", { path });+ const response = await this.sendCommand('delete_file', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to delete file");+ throw new Error((response.error as string) || 'Failed to delete file');}}async createDir(path: string): Promise<void> {- const response = await this.sendCommand("create_dir", { path });+ const response = await this.sendCommand('create_dir', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to create directory");+ throw new Error(+ (response.error as string) || 'Failed to create directory'+ );}}async deleteDir(path: string): Promise<void> {- const response = await this.sendCommand("delete_dir", { path });+ const response = await this.sendCommand('delete_dir', { path });if (!response.success) {- throw new Error(response.error as string || "Failed to delete directory");+ throw new Error(+ (response.error as string) || 'Failed to delete directory'+ );}}async runCommand(command: string): Promise<[string, string]> {- const response = await this.sendCommand("run_command", { command });+ const response = await this.sendCommand('run_command', { command });if (!response.success) {- throw new Error(response.error as string || "Failed to run command");+ throw new Error((response.error as string) || 'Failed to run command');}- return [(response.stdout as string) || "", (response.stderr as string) || ""];+ return [+ (response.stdout as string) || '',+ (response.stderr as string) || '',+ ];}// Accessibility Actionsasync getAccessibilityTree(): Promise<AccessibilityNode> {- const response = await this.sendCommand("get_accessibility_tree");+ const response = await this.sendCommand('get_accessibility_tree');if (!response.success) {- throw new Error(response.error as string || "Failed to get accessibility tree");+ throw new Error(+ (response.error as string) || 'Failed to get accessibility tree'+ );}return response as unknown as AccessibilityNode;}async toScreenCoordinates(x: number, y: number): Promise<[number, number]> {- const response = await this.sendCommand("to_screen_coordinates", { x, y });+ const response = await this.sendCommand('to_screen_coordinates', { x, y });if (!response.success || !response.coordinates) {- throw new Error("Failed to convert to screen coordinates");+ throw new Error('Failed to convert to screen coordinates');}return response.coordinates as [number, number];}@@ -231,12 +240,12 @@ export class MacOSComputerInterface extends BaseComputerInterface {x: number,y: number): Promise<[number, number]> {- const response = await this.sendCommand("to_screenshot_coordinates", {+ const response = await this.sendCommand('to_screenshot_coordinates', {x,y,});if (!response.success || !response.coordinates) {- throw new Error("Failed to convert to screenshot coordinates");+ throw new Error('Failed to convert to screenshot coordinates');}return response.coordinates as [number, number];}diff --git a/libs/typescript/computer/src/interface/windows.ts b/libs/typescript/computer/src/interface/windows.tsindex 8fee314745..c9f138d11c 100644--- a/libs/typescript/computer/src/interface/windows.ts+++ b/libs/typescript/computer/src/interface/windows.ts@@ -2,7 +2,7 @@* Windows computer interface implementation.*/-import { MacOSComputerInterface } from "./macos";+import { MacOSComputerInterface } from './macos';/*** Windows interface implementation.diff --git a/libs/typescript/computer/src/types.ts b/libs/typescript/computer/src/types.tsindex b6851b412c..f8a175fe71 100644--- a/libs/typescript/computer/src/types.ts+++ b/libs/typescript/computer/src/types.ts@@ -1,7 +1,7 @@export enum OSType {- MACOS = "macos",- WINDOWS = "windows",- LINUX = "linux",+ MACOS = 'macos',+ WINDOWS = 'windows',+ LINUX = 'linux',}export interface ScreenSize {diff --git a/libs/typescript/computer/tests/computer/cloud.test.ts b/libs/typescript/computer/tests/computer/cloud.test.tsindex f1f7a1b66a..9b927d577a 100644--- a/libs/typescript/computer/tests/computer/cloud.test.ts+++ b/libs/typescript/computer/tests/computer/cloud.test.ts@@ -1,12 +1,12 @@-import { describe, expect, it } from "vitest";-import { OSType } from "../../src/types";-import { Computer } from "../../src";+import { describe, expect, it } from 'vitest';+import { Computer } from '../../src';+import { OSType } from '../../src/types';-describe("Computer Cloud", () => {- it("Should create computer instance", () => {+describe('Computer Cloud', () => {+ it('Should create computer instance', () => {const cloud = new Computer({- apiKey: "asdf",- name: "s-linux-1234",+ apiKey: 'asdf',+ name: 's-linux-1234',osType: OSType.LINUX,});expect(cloud).toBeInstanceOf(Computer);diff --git a/libs/typescript/computer/tests/interface/factory.test.ts b/libs/typescript/computer/tests/interface/factory.test.tsindex 8aa1a1d709..e5f3296a2e 100644--- a/libs/typescript/computer/tests/interface/factory.test.ts+++ b/libs/typescript/computer/tests/interface/factory.test.ts@@ -1,21 +1,21 @@-import { describe, expect, it } from "vitest";-import { InterfaceFactory } from "../../src/interface/factory.ts";-import { MacOSComputerInterface } from "../../src/interface/macos.ts";-import { LinuxComputerInterface } from "../../src/interface/linux.ts";-import { WindowsComputerInterface } from "../../src/interface/windows.ts";-import { OSType } from "../../src/types.ts";+import { describe, expect, it } from 'vitest';+import { InterfaceFactory } from '../../src/interface/factory.ts';+import { LinuxComputerInterface } from '../../src/interface/linux.ts';+import { MacOSComputerInterface } from '../../src/interface/macos.ts';+import { WindowsComputerInterface } from '../../src/interface/windows.ts';+import { OSType } from '../../src/types.ts';-describe("InterfaceFactory", () => {+describe('InterfaceFactory', () => {const testParams = {- ipAddress: "192.168.1.100",- username: "testuser",- password: "testpass",- apiKey: "test-api-key",- vmName: "test-vm",+ ipAddress: '192.168.1.100',+ username: 'testuser',+ password: 'testpass',+ apiKey: 'test-api-key',+ vmName: 'test-vm',};- describe("createInterfaceForOS", () => {- it("should create MacOSComputerInterface for macOS", () => {+ describe('createInterfaceForOS', () => {+ it('should create MacOSComputerInterface for macOS', () => {const interface_ = InterfaceFactory.createInterfaceForOS(OSType.MACOS,testParams.ipAddress,@@ -26,7 +26,7 @@ describe("InterfaceFactory", () => {expect(interface_).toBeInstanceOf(MacOSComputerInterface);});- it("should create LinuxComputerInterface for Linux", () => {+ it('should create LinuxComputerInterface for Linux', () => {const interface_ = InterfaceFactory.createInterfaceForOS(OSType.LINUX,testParams.ipAddress,@@ -37,7 +37,7 @@ describe("InterfaceFactory", () => {expect(interface_).toBeInstanceOf(LinuxComputerInterface);});- it("should create WindowsComputerInterface for Windows", () => {+ it('should create WindowsComputerInterface for Windows', () => {const interface_ = InterfaceFactory.createInterfaceForOS(OSType.WINDOWS,testParams.ipAddress,@@ -48,18 +48,18 @@ describe("InterfaceFactory", () => {expect(interface_).toBeInstanceOf(WindowsComputerInterface);});- it("should throw error for unsupported OS type", () => {+ it('should throw error for unsupported OS type', () => {expect(() => {InterfaceFactory.createInterfaceForOS(- "unsupported" as OSType,+ 'unsupported' as OSType,testParams.ipAddress,testParams.apiKey,testParams.vmName);- }).toThrow("Unsupported OS type: unsupported");+ }).toThrow('Unsupported OS type: unsupported');});- it("should create interface without API key and VM name", () => {+ it('should create interface without API key and VM name', () => {const interface_ = InterfaceFactory.createInterfaceForOS(OSType.MACOS,testParams.ipAddressdiff --git a/libs/typescript/computer/tests/interface/index.test.ts b/libs/typescript/computer/tests/interface/index.test.tsindex 0c8264abc4..1a0cb8ef8d 100644--- a/libs/typescript/computer/tests/interface/index.test.ts+++ b/libs/typescript/computer/tests/interface/index.test.ts@@ -1,35 +1,37 @@-import { describe, expect, it } from "vitest";-import * as InterfaceExports from "../../src/interface/index.ts";+import { describe, expect, it } from 'vitest';+import * as InterfaceExports from '../../src/interface/index.ts';-describe("Interface Module Exports", () => {- it("should export InterfaceFactory", () => {+describe('Interface Module Exports', () => {+ it('should export InterfaceFactory', () => {expect(InterfaceExports.InterfaceFactory).toBeDefined();- expect(InterfaceExports.InterfaceFactory.createInterfaceForOS).toBeDefined();+ expect(+ InterfaceExports.InterfaceFactory.createInterfaceForOS+ ).toBeDefined();});- it("should export BaseComputerInterface", () => {+ it('should export BaseComputerInterface', () => {expect(InterfaceExports.BaseComputerInterface).toBeDefined();});- it("should export MacOSComputerInterface", () => {+ it('should export MacOSComputerInterface', () => {expect(InterfaceExports.MacOSComputerInterface).toBeDefined();});- it("should export LinuxComputerInterface", () => {+ it('should export LinuxComputerInterface', () => {expect(InterfaceExports.LinuxComputerInterface).toBeDefined();});- it("should export WindowsComputerInterface", () => {+ it('should export WindowsComputerInterface', () => {expect(InterfaceExports.WindowsComputerInterface).toBeDefined();});- it("should export all expected interfaces", () => {+ it('should export all expected interfaces', () => {const expectedExports = [- "InterfaceFactory",- "BaseComputerInterface",- "MacOSComputerInterface",- "LinuxComputerInterface",- "WindowsComputerInterface",+ 'InterfaceFactory',+ 'BaseComputerInterface',+ 'MacOSComputerInterface',+ 'LinuxComputerInterface',+ 'WindowsComputerInterface',];const actualExports = Object.keys(InterfaceExports);diff --git a/libs/typescript/computer/tests/interface/linux.test.ts b/libs/typescript/computer/tests/interface/linux.test.tsindex c82627c70d..ae086fcfe9 100644--- a/libs/typescript/computer/tests/interface/linux.test.ts+++ b/libs/typescript/computer/tests/interface/linux.test.ts@@ -1,18 +1,18 @@-import { describe, expect, it } from "vitest";-import { LinuxComputerInterface } from "../../src/interface/linux.ts";-import { MacOSComputerInterface } from "../../src/interface/macos.ts";+import { describe, expect, it } from 'vitest';+import { LinuxComputerInterface } from '../../src/interface/linux.ts';+import { MacOSComputerInterface } from '../../src/interface/macos.ts';-describe("LinuxComputerInterface", () => {+describe('LinuxComputerInterface', () => {const testParams = {- ipAddress: "test.cua.com", // TEST-NET-1 address (RFC 5737) - guaranteed not to be routable- username: "testuser",- password: "testpass",- apiKey: "test-api-key",- vmName: "test-vm",+ ipAddress: 'test.cua.com', // TEST-NET-1 address (RFC 5737) - guaranteed not to be routable+ username: 'testuser',+ password: 'testpass',+ apiKey: 'test-api-key',+ vmName: 'test-vm',};- describe("Inheritance", () => {- it("should extend MacOSComputerInterface", () => {+ describe('Inheritance', () => {+ it('should extend MacOSComputerInterface', () => {const linuxInterface = new LinuxComputerInterface(testParams.ipAddress,testParams.username,diff --git a/libs/typescript/computer/tests/interface/macos.test.ts b/libs/typescript/computer/tests/interface/macos.test.tsindex 72ee07ae2d..e655254f49 100644--- a/libs/typescript/computer/tests/interface/macos.test.ts+++ b/libs/typescript/computer/tests/interface/macos.test.ts@@ -1,15 +1,15 @@-import { describe, expect, it, beforeEach, afterEach } from "vitest";-import { MacOSComputerInterface } from "../../src/interface/macos.ts";-import { WebSocketServer, WebSocket } from "ws";+import { afterEach, beforeEach, describe, expect, it } from 'vitest';+import { WebSocket, WebSocketServer } from 'ws';+import { MacOSComputerInterface } from '../../src/interface/macos.ts';-describe("MacOSComputerInterface", () => {+describe('MacOSComputerInterface', () => {// Define test parametersconst testParams = {- ipAddress: "localhost",- username: "testuser",- password: "testpass",+ ipAddress: 'localhost',+ username: 'testuser',+ password: 'testpass',// apiKey: "test-api-key", No API Key for local testing- vmName: "test-vm",+ vmName: 'test-vm',};// WebSocket server mock@@ -37,28 +37,28 @@ describe("MacOSComputerInterface", () => {testParams.ipAddress = `localhost:${serverPort}`;// Handle WebSocket connections- wss.on("connection", (ws) => {+ wss.on('connection', (ws) => {connectedClients.push(ws);// Handle incoming messages- ws.on("message", (data) => {+ ws.on('message', (data) => {try {const message = JSON.parse(data.toString());receivedMessages.push(message);// Send appropriate responses based on actionswitch (message.command) {- case "screenshot":+ case 'screenshot':ws.send(JSON.stringify({- image_data: Buffer.from("fake-screenshot-data").toString(- "base64"+ image_data: Buffer.from('fake-screenshot-data').toString(+ 'base64'),success: true,}));break;- case "get_screen_size":+ case 'get_screen_size':ws.send(JSON.stringify({size: { width: 1920, height: 1080 },@@ -66,7 +66,7 @@ describe("MacOSComputerInterface", () => {}));break;- case "get_cursor_position":+ case 'get_cursor_position':ws.send(JSON.stringify({position: { x: 100, y: 200 },@@ -74,15 +74,15 @@ describe("MacOSComputerInterface", () => {}));break;- case "copy_to_clipboard":+ case 'copy_to_clipboard':ws.send(JSON.stringify({- content: "clipboard content",+ content: 'clipboard content',success: true,}));break;- case "file_exists":+ case 'file_exists':ws.send(JSON.stringify({exists: true,@@ -90,7 +90,7 @@ describe("MacOSComputerInterface", () => {}));break;- case "directory_exists":+ case 'directory_exists':ws.send(JSON.stringify({exists: true,@@ -98,52 +98,52 @@ describe("MacOSComputerInterface", () => {}));break;- case "list_dir":+ case 'list_dir':ws.send(JSON.stringify({- files: ["file1.txt", "file2.txt"],+ files: ['file1.txt', 'file2.txt'],success: true,}));break;- case "read_text":+ case 'read_text':ws.send(JSON.stringify({- content: "file content",+ content: 'file content',success: true,}));break;- case "read_bytes":+ case 'read_bytes':ws.send(JSON.stringify({- content_b64: Buffer.from("binary content").toString("base64"),+ content_b64: Buffer.from('binary content').toString('base64'),success: true,}));break;- case "run_command":+ case 'run_command':ws.send(JSON.stringify({- stdout: "command output",- stderr: "",+ stdout: 'command output',+ stderr: '',success: true,}));break;- case "get_accessibility_tree":+ case 'get_accessibility_tree':ws.send(JSON.stringify({- role: "window",- title: "Test Window",+ role: 'window',+ title: 'Test Window',bounds: { x: 0, y: 0, width: 1920, height: 1080 },children: [],success: true,}));break;- case "to_screen_coordinates":- case "to_screenshot_coordinates":+ case 'to_screen_coordinates':+ case 'to_screenshot_coordinates':ws.send(JSON.stringify({coordinates: [message.params?.x || 0, message.params?.y || 0],@@ -161,8 +161,8 @@ describe("MacOSComputerInterface", () => {}});- ws.on("error", (error) => {- console.error("WebSocket error:", error);+ ws.on('error', (error) => {+ console.error('WebSocket error:', error);});});});@@ -182,8 +182,8 @@ describe("MacOSComputerInterface", () => {});});- describe("Connection Management", () => {- it("should connect with proper authentication headers", async () => {+ describe('Connection Management', () => {+ it('should connect with proper authentication headers', async () => {const macosInterface = new MacOSComputerInterface(testParams.ipAddress,testParams.username,@@ -201,13 +201,13 @@ describe("MacOSComputerInterface", () => {await macosInterface.disconnect();});- it("should handle connection without API key", async () => {+ it('should handle connection without API key', async () => {// Create a separate server that doesn't check authconst noAuthWss = new WebSocketServer({ port: 0 });const noAuthPort = (noAuthWss.address() as { port: number }).port;- noAuthWss.on("connection", (ws) => {- ws.on("message", () => {+ noAuthWss.on('connection', (ws) => {+ ws.on('message', () => {ws.send(JSON.stringify({ success: true }));});});@@ -230,7 +230,7 @@ describe("MacOSComputerInterface", () => {});});- describe("Mouse Actions", () => {+ describe('Mouse Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -250,40 +250,40 @@ describe("MacOSComputerInterface", () => {}});- it("should send mouse_down command", async () => {- await macosInterface.mouseDown(100, 200, "left");+ it('should send mouse_down command', async () => {+ await macosInterface.mouseDown(100, 200, 'left');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "mouse_down",+ command: 'mouse_down',params: {x: 100,y: 200,- button: "left",+ button: 'left',},});});- it("should send mouse_up command", async () => {- await macosInterface.mouseUp(100, 200, "right");+ it('should send mouse_up command', async () => {+ await macosInterface.mouseUp(100, 200, 'right');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "mouse_up",+ command: 'mouse_up',params: {x: 100,y: 200,- button: "right",+ button: 'right',},});});- it("should send left_click command", async () => {+ it('should send left_click command', async () => {await macosInterface.leftClick(150, 250);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "left_click",+ command: 'left_click',params: {x: 150,y: 250,@@ -291,12 +291,12 @@ describe("MacOSComputerInterface", () => {});});- it("should send right_click command", async () => {+ it('should send right_click command', async () => {await macosInterface.rightClick(200, 300);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "right_click",+ command: 'right_click',params: {x: 200,y: 300,@@ -304,12 +304,12 @@ describe("MacOSComputerInterface", () => {});});- it("should send double_click command", async () => {+ it('should send double_click command', async () => {await macosInterface.doubleClick(250, 350);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "double_click",+ command: 'double_click',params: {x: 250,y: 350,@@ -317,12 +317,12 @@ describe("MacOSComputerInterface", () => {});});- it("should send move_cursor command", async () => {+ it('should send move_cursor command', async () => {await macosInterface.moveCursor(300, 400);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "move_cursor",+ command: 'move_cursor',params: {x: 300,y: 400,@@ -330,42 +330,42 @@ describe("MacOSComputerInterface", () => {});});- it("should send drag_to command", async () => {- await macosInterface.dragTo(400, 500, "left", 1.5);+ it('should send drag_to command', async () => {+ await macosInterface.dragTo(400, 500, 'left', 1.5);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "drag_to",+ command: 'drag_to',params: {x: 400,y: 500,- button: "left",+ button: 'left',duration: 1.5,},});});- it("should send drag command with path", async () => {+ it('should send drag command with path', async () => {const path: Array<[number, number]> = [[100, 100],[200, 200],[300, 300],];- await macosInterface.drag(path, "middle", 2.0);+ await macosInterface.drag(path, 'middle', 2.0);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "drag",+ command: 'drag',params: {path: path,- button: "middle",+ button: 'middle',duration: 2.0,},});});});- describe("Keyboard Actions", () => {+ describe('Keyboard Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -385,68 +385,68 @@ describe("MacOSComputerInterface", () => {}});- it("should send key_down command", async () => {- await macosInterface.keyDown("a");+ it('should send key_down command', async () => {+ await macosInterface.keyDown('a');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "key_down",+ command: 'key_down',params: {- key: "a",+ key: 'a',},});});- it("should send key_up command", async () => {- await macosInterface.keyUp("b");+ it('should send key_up command', async () => {+ await macosInterface.keyUp('b');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "key_up",+ command: 'key_up',params: {- key: "b",+ key: 'b',},});});- it("should send type_text command", async () => {- await macosInterface.typeText("Hello, World!");+ it('should send type_text command', async () => {+ await macosInterface.typeText('Hello, World!');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "type_text",+ command: 'type_text',params: {- text: "Hello, World!",+ text: 'Hello, World!',},});});- it("should send press_key command", async () => {- await macosInterface.pressKey("enter");+ it('should send press_key command', async () => {+ await macosInterface.pressKey('enter');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "press_key",+ command: 'press_key',params: {- key: "enter",+ key: 'enter',},});});- it("should send hotkey command", async () => {- await macosInterface.hotkey("cmd", "c");+ it('should send hotkey command', async () => {+ await macosInterface.hotkey('cmd', 'c');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "hotkey",+ command: 'hotkey',params: {- keys: ["cmd", "c"],+ keys: ['cmd', 'c'],},});});});- describe("Scrolling Actions", () => {+ describe('Scrolling Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -466,12 +466,12 @@ describe("MacOSComputerInterface", () => {}});- it("should send scroll command", async () => {+ it('should send scroll command', async () => {await macosInterface.scroll(10, -5);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "scroll",+ command: 'scroll',params: {x: 10,y: -5,@@ -479,24 +479,24 @@ describe("MacOSComputerInterface", () => {});});- it("should send scroll_down command", async () => {+ it('should send scroll_down command', async () => {await macosInterface.scrollDown(3);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "scroll_down",+ command: 'scroll_down',params: {clicks: 3,},});});- it("should send scroll_up command", async () => {+ it('should send scroll_up command', async () => {await macosInterface.scrollUp(2);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "scroll_up",+ command: 'scroll_up',params: {clicks: 2,},@@ -504,7 +504,7 @@ describe("MacOSComputerInterface", () => {});});- describe("Screen Actions", () => {+ describe('Screen Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -524,45 +524,45 @@ describe("MacOSComputerInterface", () => {}});- it("should get screenshot", async () => {+ it('should get screenshot', async () => {const screenshot = await macosInterface.screenshot();expect(screenshot).toBeInstanceOf(Buffer);- expect(screenshot.toString()).toBe("fake-screenshot-data");+ expect(screenshot.toString()).toBe('fake-screenshot-data');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "screenshot",+ command: 'screenshot',params: {},});});- it("should get screen size", async () => {+ it('should get screen size', async () => {const size = await macosInterface.getScreenSize();expect(size).toEqual({ width: 1920, height: 1080 });const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "get_screen_size",+ command: 'get_screen_size',params: {},});});- it("should get cursor position", async () => {+ it('should get cursor position', async () => {const position = await macosInterface.getCursorPosition();expect(position).toEqual({ x: 100, y: 200 });const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "get_cursor_position",+ command: 'get_cursor_position',params: {},});});});- describe("Clipboard Actions", () => {+ describe('Clipboard Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -582,32 +582,32 @@ describe("MacOSComputerInterface", () => {}});- it("should copy to clipboard", async () => {+ it('should copy to clipboard', async () => {const text = await macosInterface.copyToClipboard();- expect(text).toBe("clipboard content");+ expect(text).toBe('clipboard content');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "copy_to_clipboard",+ command: 'copy_to_clipboard',params: {},});});- it("should set clipboard", async () => {- await macosInterface.setClipboard("new clipboard text");+ it('should set clipboard', async () => {+ await macosInterface.setClipboard('new clipboard text');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "set_clipboard",+ command: 'set_clipboard',params: {- text: "new clipboard text",+ text: 'new clipboard text',},});});});- describe("File System Actions", () => {+ describe('File System Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -627,157 +627,157 @@ describe("MacOSComputerInterface", () => {}});- it("should check file exists", async () => {- const exists = await macosInterface.fileExists("/path/to/file");+ it('should check file exists', async () => {+ const exists = await macosInterface.fileExists('/path/to/file');expect(exists).toBe(true);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "file_exists",+ command: 'file_exists',params: {- path: "/path/to/file",+ path: '/path/to/file',},});});- it("should check directory exists", async () => {- const exists = await macosInterface.directoryExists("/path/to/dir");+ it('should check directory exists', async () => {+ const exists = await macosInterface.directoryExists('/path/to/dir');expect(exists).toBe(true);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "directory_exists",+ command: 'directory_exists',params: {- path: "/path/to/dir",+ path: '/path/to/dir',},});});- it("should list directory", async () => {- const files = await macosInterface.listDir("/path/to/dir");+ it('should list directory', async () => {+ const files = await macosInterface.listDir('/path/to/dir');- expect(files).toEqual(["file1.txt", "file2.txt"]);+ expect(files).toEqual(['file1.txt', 'file2.txt']);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "list_dir",+ command: 'list_dir',params: {- path: "/path/to/dir",+ path: '/path/to/dir',},});});- it("should read text file", async () => {- const content = await macosInterface.readText("/path/to/file.txt");+ it('should read text file', async () => {+ const content = await macosInterface.readText('/path/to/file.txt');- expect(content).toBe("file content");+ expect(content).toBe('file content');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "read_text",+ command: 'read_text',params: {- path: "/path/to/file.txt",+ path: '/path/to/file.txt',},});});- it("should write text file", async () => {- await macosInterface.writeText("/path/to/file.txt", "new content");+ it('should write text file', async () => {+ await macosInterface.writeText('/path/to/file.txt', 'new content');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "write_text",+ command: 'write_text',params: {- path: "/path/to/file.txt",- content: "new content",+ path: '/path/to/file.txt',+ content: 'new content',},});});- it("should read binary file", async () => {- const content = await macosInterface.readBytes("/path/to/file.bin");+ it('should read binary file', async () => {+ const content = await macosInterface.readBytes('/path/to/file.bin');expect(content).toBeInstanceOf(Buffer);- expect(content.toString()).toBe("binary content");+ expect(content.toString()).toBe('binary content');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "read_bytes",+ command: 'read_bytes',params: {- path: "/path/to/file.bin",+ path: '/path/to/file.bin',},});});- it("should write binary file", async () => {- const buffer = Buffer.from("binary data");- await macosInterface.writeBytes("/path/to/file.bin", buffer);+ it('should write binary file', async () => {+ const buffer = Buffer.from('binary data');+ await macosInterface.writeBytes('/path/to/file.bin', buffer);const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "write_bytes",+ command: 'write_bytes',params: {- path: "/path/to/file.bin",- content_b64: buffer.toString("base64"),+ path: '/path/to/file.bin',+ content_b64: buffer.toString('base64'),},});});- it("should delete file", async () => {- await macosInterface.deleteFile("/path/to/file");+ it('should delete file', async () => {+ await macosInterface.deleteFile('/path/to/file');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "delete_file",+ command: 'delete_file',params: {- path: "/path/to/file",+ path: '/path/to/file',},});});- it("should create directory", async () => {- await macosInterface.createDir("/path/to/new/dir");+ it('should create directory', async () => {+ await macosInterface.createDir('/path/to/new/dir');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "create_dir",+ command: 'create_dir',params: {- path: "/path/to/new/dir",+ path: '/path/to/new/dir',},});});- it("should delete directory", async () => {- await macosInterface.deleteDir("/path/to/dir");+ it('should delete directory', async () => {+ await macosInterface.deleteDir('/path/to/dir');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "delete_dir",+ command: 'delete_dir',params: {- path: "/path/to/dir",+ path: '/path/to/dir',},});});- it("should run command", async () => {- const [stdout, stderr] = await macosInterface.runCommand("ls -la");+ it('should run command', async () => {+ const [stdout, stderr] = await macosInterface.runCommand('ls -la');- expect(stdout).toBe("command output");- expect(stderr).toBe("");+ expect(stdout).toBe('command output');+ expect(stderr).toBe('');const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "run_command",+ command: 'run_command',params: {- command: "ls -la",+ command: 'ls -la',},});});});- describe("Accessibility Actions", () => {+ describe('Accessibility Actions', () => {let macosInterface: MacOSComputerInterface;beforeEach(async () => {@@ -797,12 +797,12 @@ describe("MacOSComputerInterface", () => {}});- it("should get accessibility tree", async () => {+ it('should get accessibility tree', async () => {const tree = await macosInterface.getAccessibilityTree();expect(tree).toEqual({- role: "window",- title: "Test Window",+ role: 'window',+ title: 'Test Window',bounds: { x: 0, y: 0, width: 1920, height: 1080 },children: [],success: true,@@ -810,12 +810,12 @@ describe("MacOSComputerInterface", () => {const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "get_accessibility_tree",+ command: 'get_accessibility_tree',params: {},});});- it("should convert to screen coordinates", async () => {+ it('should convert to screen coordinates', async () => {const [x, y] = await macosInterface.toScreenCoordinates(100, 200);expect(x).toBe(100);@@ -823,7 +823,7 @@ describe("MacOSComputerInterface", () => {const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "to_screen_coordinates",+ command: 'to_screen_coordinates',params: {x: 100,y: 200,@@ -831,7 +831,7 @@ describe("MacOSComputerInterface", () => {});});- it("should convert to screenshot coordinates", async () => {+ it('should convert to screenshot coordinates', async () => {const [x, y] = await macosInterface.toScreenshotCoordinates(300, 400);expect(x).toBe(300);@@ -839,7 +839,7 @@ describe("MacOSComputerInterface", () => {const lastMessage = receivedMessages[receivedMessages.length - 1];expect(lastMessage).toEqual({- command: "to_screenshot_coordinates",+ command: 'to_screenshot_coordinates',params: {x: 300,y: 400,@@ -848,11 +848,11 @@ describe("MacOSComputerInterface", () => {});});- describe("Error Handling", () => {- it("should handle WebSocket connection errors", async () => {+ describe('Error Handling', () => {+ it('should handle WebSocket connection errors', async () => {// Use a valid but unreachable IP to avoid DNS errorsconst macosInterface = new MacOSComputerInterface(- "localhost:9999",+ 'localhost:9999',testParams.username,testParams.password,undefined,@@ -863,14 +863,14 @@ describe("MacOSComputerInterface", () => {await expect(macosInterface.connect()).rejects.toThrow();});- it("should handle command errors", async () => {+ it('should handle command errors', async () => {// Create a server that returns errorsconst errorWss = new WebSocketServer({ port: 0 });const errorPort = (errorWss.address() as { port: number }).port;- errorWss.on("connection", (ws) => {- ws.on("message", () => {- ws.send(JSON.stringify({ error: "Command failed", success: false }));+ errorWss.on('connection', (ws) => {+ ws.on('message', () => {+ ws.send(JSON.stringify({ error: 'Command failed', success: false }));});});@@ -886,7 +886,7 @@ describe("MacOSComputerInterface", () => {// Command should throw errorawait expect(macosInterface.leftClick(100, 100)).rejects.toThrow(- "Command failed"+ 'Command failed');await macosInterface.disconnect();@@ -895,7 +895,7 @@ describe("MacOSComputerInterface", () => {});});- it("should handle disconnection gracefully", async () => {+ it('should handle disconnection gracefully', async () => {const macosInterface = new MacOSComputerInterface(testParams.ipAddress,testParams.username,@@ -918,7 +918,7 @@ describe("MacOSComputerInterface", () => {await macosInterface.disconnect();});- it("should handle force close", async () => {+ it('should handle force close', async () => {const macosInterface = new MacOSComputerInterface(testParams.ipAddress,testParams.username,diff --git a/libs/typescript/computer/tests/interface/windows.test.ts b/libs/typescript/computer/tests/interface/windows.test.tsindex cf8fe9e901..68a7490da1 100644--- a/libs/typescript/computer/tests/interface/windows.test.ts+++ b/libs/typescript/computer/tests/interface/windows.test.ts@@ -1,18 +1,18 @@-import { describe, expect, it } from "vitest";-import { WindowsComputerInterface } from "../../src/interface/windows.ts";-import { MacOSComputerInterface } from "../../src/interface/macos.ts";+import { describe, expect, it } from 'vitest';+import { MacOSComputerInterface } from '../../src/interface/macos.ts';+import { WindowsComputerInterface } from '../../src/interface/windows.ts';-describe("WindowsComputerInterface", () => {+describe('WindowsComputerInterface', () => {const testParams = {- ipAddress: "192.0.2.1", // TEST-NET-1 address (RFC 5737) - guaranteed not to be routable- username: "testuser",- password: "testpass",- apiKey: "test-api-key",- vmName: "test-vm",+ ipAddress: '192.0.2.1', // TEST-NET-1 address (RFC 5737) - guaranteed not to be routable+ username: 'testuser',+ password: 'testpass',+ apiKey: 'test-api-key',+ vmName: 'test-vm',};- describe("Inheritance", () => {- it("should extend MacOSComputerInterface", () => {+ describe('Inheritance', () => {+ it('should extend MacOSComputerInterface', () => {const windowsInterface = new WindowsComputerInterface(testParams.ipAddress,testParams.username,diff --git a/libs/typescript/computer/tests/setup.ts b/libs/typescript/computer/tests/setup.tsindex 7dd1ebc769..9425b20fd8 100644--- a/libs/typescript/computer/tests/setup.ts+++ b/libs/typescript/computer/tests/setup.ts@@ -1,4 +1,4 @@-import { afterAll, afterEach, beforeAll } from "vitest";+import { afterAll, afterEach, beforeAll } from 'vitest';beforeAll(() => {});diff --git a/libs/typescript/computer/tsdown.config.ts b/libs/typescript/computer/tsdown.config.tsindex 19e6e5b9ad..b3c70ea9e1 100644--- a/libs/typescript/computer/tsdown.config.ts+++ b/libs/typescript/computer/tsdown.config.ts@@ -1,10 +1,10 @@-import { defineConfig } from "tsdown";+import { defineConfig } from 'tsdown';export default defineConfig([{- entry: ["./src/index.ts"],- platform: "node",+ entry: ['./src/index.ts'],+ platform: 'node',dts: true,- external: ["child_process", "util"],+ external: ['child_process', 'util'],},]);diff --git a/libs/typescript/computer/vitest.config.ts b/libs/typescript/computer/vitest.config.tsindex 4f76f6cc79..53ab43d40d 100644--- a/libs/typescript/computer/vitest.config.ts+++ b/libs/typescript/computer/vitest.config.ts@@ -1,9 +1,9 @@-import { defineConfig } from "vitest/config";+import { defineConfig } from 'vitest/config';export default defineConfig({test: {- setupFiles: ["./tests/setup.ts"],- environment: "node",+ setupFiles: ['./tests/setup.ts'],+ environment: 'node',globals: true,},});diff --git a/libs/typescript/core/src/telemetry/clients/index.ts b/libs/typescript/core/src/telemetry/clients/index.tsindex cbb1c307b4..450fcfbb75 100644--- a/libs/typescript/core/src/telemetry/clients/index.ts+++ b/libs/typescript/core/src/telemetry/clients/index.ts@@ -1 +1 @@-export * from "./posthog";+export * from './posthog';diff --git a/libs/typescript/core/src/telemetry/clients/posthog.ts b/libs/typescript/core/src/telemetry/clients/posthog.tsindex 18216c21cd..0ef9df85b8 100644--- a/libs/typescript/core/src/telemetry/clients/posthog.ts+++ b/libs/typescript/core/src/telemetry/clients/posthog.ts@@ -2,12 +2,12 @@* Telemetry client using PostHog for collecting anonymous usage data.*/-import { PostHog } from 'posthog-node';-import { v4 as uuidv4 } from 'uuid';import * as fs from 'node:fs';-import * as path from 'node:path';import * as os from 'node:os';+import * as path from 'node:path';import { pino } from 'pino';+import { PostHog } from 'posthog-node';+import { v4 as uuidv4 } from 'uuid';const logger = pino({ name: 'core.telemetry' });// Controls how frequently telemetry will be sent (percentage)diff --git a/libs/typescript/core/tests/telemetry.test.ts b/libs/typescript/core/tests/telemetry.test.tsindex f8eb780ba9..4c4d47f604 100644--- a/libs/typescript/core/tests/telemetry.test.ts+++ b/libs/typescript/core/tests/telemetry.test.ts@@ -1,4 +1,4 @@-import { describe, it, expect, beforeEach } from 'vitest';+import { beforeEach, describe, expect, it } from 'vitest';import { Telemetry } from '../src/';describe('Telemetry', () => {diff --git a/libs/typescript/core/tsdown.config.ts b/libs/typescript/core/tsdown.config.tsindex f30bbedd20..21d62816eb 100644--- a/libs/typescript/core/tsdown.config.ts+++ b/libs/typescript/core/tsdown.config.ts@@ -1,4 +1,4 @@-import { defineConfig } from 'tsdown'+import { defineConfig } from 'tsdown';export default defineConfig([{@@ -6,4 +6,4 @@ export default defineConfig([platform: 'neutral',dts: true,},-])+]);diff --git a/libs/typescript/core/vitest.config.ts b/libs/typescript/core/vitest.config.tsindex abed6b2116..94ede10e22 100644--- a/libs/typescript/core/vitest.config.ts+++ b/libs/typescript/core/vitest.config.ts@@ -1,3 +1,3 @@-import { defineConfig } from 'vitest/config'+import { defineConfig } from 'vitest/config';-export default defineConfig({})+export default defineConfig({});diff --git a/libs/typescript/package.json b/libs/typescript/package.jsonindex f14aa59eae..ff69852cad 100644--- a/libs/typescript/package.json+++ b/libs/typescript/package.json@@ -6,8 +6,8 @@"author": "c/ua","license": "MIT","scripts": {- "lint": "biome lint .",- "lint:fix": "biome lint --fix ."+ "lint": "biome check",+ "lint:fix": "biome check --fix"},"packageManager": "[email protected]","devDependencies": {