Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

More refactoring

Morgan Deanfc4133389487
diff --git a/libs/computer/typescript/src/computer/computer.ts b/libs/computer/typescript/src/computer/computer.ts
index fea5cbb314..eea9e563a9 100644
--- a/libs/computer/typescript/src/computer/computer.ts
+++ b/libs/computer/typescript/src/computer/computer.ts
@@ -1,4 +1,4 @@
-import type { Display, ComputerConfig } from "../models";
+import type { Display, ComputerConfig } from "../types";
import type { BaseComputerInterface } from "../interface/base";
import { InterfaceFactory } from "../interface/factory";
import type { BaseVMProvider } from "../providers/base";
diff --git a/libs/computer/typescript/src/index.ts b/libs/computer/typescript/src/index.ts
index 551181ca1f..79eec2b505 100644
--- a/libs/computer/typescript/src/index.ts
+++ b/libs/computer/typescript/src/index.ts
@@ -3,7 +3,7 @@ export { Computer } from "./computer";
export type { ComputerOptions, OSType } from "./computer";
// Models
-export type { Display, ComputerConfig } from "./models";
+export type { Display, ComputerConfig } from "./types";
// Provider components
export { VMProviderType, BaseVMProviderImpl } from "./providers";
@@ -16,13 +16,15 @@ export type { BaseComputerInterface } from "./interface";
export { InterfaceFactory } from "./interface";
export type { InterfaceOptions } from "./interface";
export { Key } from "./interface";
-export type {
- KeyType,
- MouseButton,
- NavigationKey,
- SpecialKey,
- ModifierKey,
+export type {
+ KeyType,
+ MouseButton,
+ NavigationKey,
+ SpecialKey,
+ ModifierKey,
FunctionKey,
AccessibilityWindow,
- AccessibilityTree
+ AccessibilityTree,
} from "./interface";
+
+export * from "./helpers";
diff --git a/libs/computer/typescript/src/interface/base.ts b/libs/computer/typescript/src/interface/base.ts
index ef4dfe6c65..9ab3fd0eea 100644
--- a/libs/computer/typescript/src/interface/base.ts
+++ b/libs/computer/typescript/src/interface/base.ts
@@ -1,4 +1,4 @@
-import type { KeyType, MouseButton, AccessibilityTree } from './models';
+import type { KeyType, MouseButton, AccessibilityTree } from "./types";
/**
* Base interface for computer control implementations.
@@ -8,32 +8,32 @@ export interface BaseComputerInterface {
* Wait for the interface to be ready.
*/
waitForReady(): Promise<void>;
-
+
/**
* Get a screenshot of the current screen.
*/
getScreenshot(): Promise<Buffer>;
-
+
/**
* Move the mouse to the specified coordinates.
*/
moveMouse(x: number, y: number): Promise<void>;
-
+
/**
* Click the mouse at the current position.
*/
click(button?: MouseButton): Promise<void>;
-
+
/**
* Type text at the current cursor position.
*/
typeText(text: string): Promise<void>;
-
+
/**
* Press a key.
*/
pressKey(key: KeyType): Promise<void>;
-
+
/**
* Get the accessibility tree.
*/
diff --git a/libs/computer/typescript/src/interface/index.ts b/libs/computer/typescript/src/interface/index.ts
index ac96f84e7f..38e3fd048c 100644
--- a/libs/computer/typescript/src/interface/index.ts
+++ b/libs/computer/typescript/src/interface/index.ts
@@ -1,5 +1,5 @@
export * from "./base";
export * from "./factory";
-export * from "./models";
+export * from "./types";
export * from "./macos";
export * from "./linux";
diff --git a/libs/computer/typescript/src/interface/linux.ts b/libs/computer/typescript/src/interface/linux.ts
index 3713cb7b0d..12e67988ff 100644
--- a/libs/computer/typescript/src/interface/linux.ts
+++ b/libs/computer/typescript/src/interface/linux.ts
@@ -1,5 +1,5 @@
-import type { BaseComputerInterface } from './base';
-import type { KeyType, MouseButton, AccessibilityTree } from './models';
+import type { BaseComputerInterface } from "./base";
+import type { KeyType, MouseButton, AccessibilityTree } from "./types";
/**
* Linux-specific implementation of the computer interface.
@@ -24,7 +24,7 @@ export class LinuxComputerInterface implements BaseComputerInterface {
// Implementation will go here
}
- async click(button: MouseButton = 'left'): Promise<void> {
+ async click(button: MouseButton = "left"): Promise<void> {
// Implementation will go here
}
@@ -40,8 +40,8 @@ export class LinuxComputerInterface implements BaseComputerInterface {
// Implementation will go here
return {
success: false,
- frontmost_application: '',
- windows: []
+ frontmost_application: "",
+ windows: [],
};
}
}
diff --git a/libs/computer/typescript/src/interface/macos.ts b/libs/computer/typescript/src/interface/macos.ts
index a031fa4993..93e2688d5d 100644
--- a/libs/computer/typescript/src/interface/macos.ts
+++ b/libs/computer/typescript/src/interface/macos.ts
@@ -1,5 +1,5 @@
-import type { BaseComputerInterface } from './base';
-import type { KeyType, MouseButton, AccessibilityTree } from './models';
+import type { BaseComputerInterface } from "./base";
+import type { KeyType, MouseButton, AccessibilityTree } from "./types";
/**
* macOS-specific implementation of the computer interface.
@@ -24,7 +24,7 @@ export class MacOSComputerInterface implements BaseComputerInterface {
// Implementation will go here
}
- async click(button: MouseButton = 'left'): Promise<void> {
+ async click(button: MouseButton = "left"): Promise<void> {
// Implementation will go here
}
@@ -40,8 +40,8 @@ export class MacOSComputerInterface implements BaseComputerInterface {
// Implementation will go here
return {
success: false,
- frontmost_application: '',
- windows: []
+ frontmost_application: "",
+ windows: [],
};
}
}
diff --git a/libs/computer/typescript/src/interface/models.ts b/libs/computer/typescript/src/interface/types.ts
similarity index 100%
rename from libs/computer/typescript/src/interface/models.ts
rename to libs/computer/typescript/src/interface/types.ts
diff --git a/libs/computer/typescript/src/logger.ts b/libs/computer/typescript/src/logger.ts
deleted file mode 100644
index e69de29bb2..0000000000
diff --git a/libs/computer/typescript/src/telemetry.ts b/libs/computer/typescript/src/telemetry.ts
index 7f5987210b..2cd193deb6 100644
--- a/libs/computer/typescript/src/telemetry.ts
+++ b/libs/computer/typescript/src/telemetry.ts
@@ -37,6 +37,8 @@ export class TelemetryManager {
// For now, just log to debug
if (process.env.NODE_ENV === "development") {
console.debug("[Telemetry]", event, properties);
+ } else {
+ //todo: log telemetry to posthog
}
}
diff --git a/libs/computer/typescript/src/models.ts b/libs/computer/typescript/src/types.ts
similarity index 100%
rename from libs/computer/typescript/src/models.ts
rename to libs/computer/typescript/src/types.ts