More refactoring

This commit is contained in:
Morgan Dean
2025-06-13 12:48:28 -04:00
parent 75c7a8bbc1
commit fc41333894
10 changed files with 31 additions and 27 deletions

View File

@@ -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";

View File

@@ -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";

View File

@@ -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.
*/

View File

@@ -1,5 +1,5 @@
export * from "./base";
export * from "./factory";
export * from "./models";
export * from "./types";
export * from "./macos";
export * from "./linux";

View File

@@ -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: [],
};
}
}

View File

@@ -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: [],
};
}
}

View File

@@ -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
}
}