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.

Add warnings to lume implementation, get set up for cloud implementation of computer

Morgan Deanaffe9d587851
diff --git a/libs/computer/typescript/src/computer/defaults.ts b/libs/computer/typescript/src/computer/defaults.ts
index 26e6d3c4b7..adf0a5c1e3 100644
--- a/libs/computer/typescript/src/computer/defaults.ts
+++ b/libs/computer/typescript/src/computer/defaults.ts
@@ -7,7 +7,7 @@ import type { BaseComputerConfig, Display } from "./types";
export const DEFAULT_CONFIG: Partial<BaseComputerConfig> = {
name: "",
osType: OSType.MACOS,
- vmProvider: VMProviderType.LUME,
+ vmProvider: VMProviderType.CLOUD,
display: "1024x768",
memory: "8GB",
cpu: 4,
diff --git a/libs/computer/typescript/src/computer/index.ts b/libs/computer/typescript/src/computer/index.ts
index e8fde0e594..bbf1522461 100644
--- a/libs/computer/typescript/src/computer/index.ts
+++ b/libs/computer/typescript/src/computer/index.ts
@@ -1,4 +1,3 @@
-import { LumierComputer } from "./providers/lumier";
import type { BaseComputer } from "./providers/base";
import { CloudComputer } from "./providers/cloud";
import { LumeComputer } from "./providers/lume";
@@ -7,7 +6,6 @@ import {
type BaseComputerConfig,
type CloudComputerConfig,
type LumeComputerConfig,
- type LumierComputerConfig,
} from "./types";
import { applyDefaults } from "./defaults";
@@ -25,7 +23,6 @@ export class Computer {
| Partial<BaseComputerConfig>
| Partial<CloudComputerConfig>
| Partial<LumeComputerConfig>
- | Partial<LumierComputerConfig>
): BaseComputer {
// Apply defaults to the configuration
const fullConfig = applyDefaults(config);
@@ -36,8 +33,6 @@ export class Computer {
return new CloudComputer(fullConfig as CloudComputerConfig);
case VMProviderType.LUME:
return new LumeComputer(fullConfig as LumeComputerConfig);
- case VMProviderType.LUMIER:
- return new LumierComputer(fullConfig as LumierComputerConfig);
default:
throw new Error(
`Unsupported VM provider type: ${fullConfig.vmProvider}`
diff --git a/libs/computer/typescript/src/computer/providers/cloud.ts b/libs/computer/typescript/src/computer/providers/cloud.ts
index be318aa831..3a94543593 100644
--- a/libs/computer/typescript/src/computer/providers/cloud.ts
+++ b/libs/computer/typescript/src/computer/providers/cloud.ts
@@ -1,6 +1,8 @@
import { BaseComputer } from "./base";
import type { CloudComputerConfig } from "../types";
-import { computerLogger } from "../../util/logger";
+import pino from "pino";
+
+const logger = pino({ name: "cloud" });
/**
* Cloud-specific computer implementation
@@ -14,7 +16,7 @@ export class CloudComputer extends BaseComputer {
* Cloud-specific method to deploy the computer
*/
async deploy(): Promise<void> {
- computerLogger.info(`Deploying cloud computer ${this.name}`);
+ logger.info(`Deploying cloud computer ${this.name}`);
// Cloud-specific implementation
}
diff --git a/libs/computer/typescript/src/computer/providers/lume.ts b/libs/computer/typescript/src/computer/providers/lume.ts
index 9b2d3674bd..ee95d47b52 100644
--- a/libs/computer/typescript/src/computer/providers/lume.ts
+++ b/libs/computer/typescript/src/computer/providers/lume.ts
@@ -1,3 +1,8 @@
+/**
+ * WARNING: This file was created as a test/example implementation and is not maintained or expected to work.
+ * It serves as a reference for how a provider might be implemented but should not be used in production.
+ */
+
import type { Display, LumeComputerConfig } from "../types";
import { BaseComputer } from "./base";
import { applyDefaults } from "../defaults";
diff --git a/libs/computer/typescript/src/computer/providers/lumier.ts b/libs/computer/typescript/src/computer/providers/lumier.ts
deleted file mode 100644
index ae18be7678..0000000000
--- a/libs/computer/typescript/src/computer/providers/lumier.ts
+++ /dev/null
@@ -1,60 +0,0 @@
-import { BaseComputer } from "./base";
-import { applyDefaults } from "../defaults";
-import type { Display, LumierComputerConfig } from "../types";
-import { computerLogger } from "../../util/logger";
-
-/**
- * Lumier-specific computer implementation
- */
-export class LumierComputer extends BaseComputer {
- private display: string | Display;
- private memory: string;
- private cpu: number;
- private image: string;
- private sharedDirectories?: string[];
- private noVNCPort?: number;
- private storage?: string;
- private ephemeral: boolean;
-
- constructor(config: LumierComputerConfig) {
- super(config);
-
- const defaultConfig = applyDefaults(config);
-
- this.display = defaultConfig.display;
- this.memory = defaultConfig.memory;
- this.cpu = defaultConfig.cpu;
- this.image = defaultConfig.image;
- this.sharedDirectories = defaultConfig.sharedDirectories;
- this.noVNCPort = defaultConfig.noVNCPort;
- this.storage = defaultConfig.storage;
- this.ephemeral = defaultConfig.ephemeral;
- }
-
- /**
- * Lumier-specific method to start the container
- */
- async startContainer(): Promise<void> {
- computerLogger.info(
- `Starting Lumier container ${this.name} with ${this.memory} memory and ${this.cpu} CPUs`
- );
- computerLogger.info(
- `Using image ${this.image} with display ${
- typeof this.display === "string"
- ? this.display
- : `${this.display.width}x${this.display.height}`
- }`
- );
- // Lumier-specific implementation
- }
-
- /**
- * Lumier-specific method to execute a command in the container
- */
- async execCommand(command: string): Promise<string> {
- computerLogger.info(
- `Executing command in Lumier container ${this.name}: ${command}`
- );
- return "command output"; // Example implementation
- }
-}
diff --git a/libs/computer/typescript/src/computer/types.ts b/libs/computer/typescript/src/computer/types.ts
index ed2bd02ced..27c287e8b9 100644
--- a/libs/computer/typescript/src/computer/types.ts
+++ b/libs/computer/typescript/src/computer/types.ts
@@ -24,7 +24,7 @@ export interface BaseComputerConfig {
osType: OSType;
/**
- * The VM provider type to use (lume, lumier, cloud)
+ * The VM provider type to use (lume, cloud)
* @default VMProviderType.LUME
*/
vmProvider: VMProviderType;
@@ -80,7 +80,7 @@ export interface BaseComputerConfig {
port?: number;
/**
- * Optional port for the noVNC web interface (Lumier provider)
+ * Optional port for the noVNC web interface
* @default 8006
*/
noVNCPort?: number;
@@ -92,7 +92,7 @@ export interface BaseComputerConfig {
host?: string;
/**
- * Optional path for persistent VM storage (Lumier provider)
+ * Optional path for persistent VM storage
*/
storage?: string;
@@ -132,17 +132,9 @@ export interface LumeComputerConfig extends BaseComputerConfig {
vmProvider: VMProviderType.LUME;
}
-/**
- * The Lumier VM provider type
- */
-export interface LumierComputerConfig extends BaseComputerConfig {
- vmProvider: VMProviderType.LUMIER;
-}
-
export enum VMProviderType {
CLOUD = "cloud",
LUME = "lume",
- LUMIER = "lumier",
}
export enum OSType {
diff --git a/libs/computer/typescript/src/util/logger.ts b/libs/computer/typescript/src/util/logger.ts
deleted file mode 100644
index a3ab86cf91..0000000000
--- a/libs/computer/typescript/src/util/logger.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * Shared logger module for the computer library
- */
-import pino from "pino";
-
-// Create and export default loggers for common components
-export const computerLogger = pino({ name: "computer" });
diff --git a/libs/computer/typescript/src/util/lume.ts b/libs/computer/typescript/src/util/lume.ts
index cd42e6ba8a..42da321ffb 100644
--- a/libs/computer/typescript/src/util/lume.ts
+++ b/libs/computer/typescript/src/util/lume.ts
@@ -1,8 +1,11 @@
/**
- * Shared API utilities for Lume and Lumier providers.
+ * Shared API utilities for Lume providers.
*
* This module contains shared functions for interacting with the Lume API,
- * used by both the LumeProvider and LumierProvider classes.
+ * used by LumeProvider.
+ *
+ * WARNING: This file was created as a test/example implementation and is not maintained or expected to work.
+ * It serves as a reference for how a provider might be implemented but should not be used in production.
*/
import pino from "pino";
@@ -73,7 +76,9 @@ export async function lumeApiGet(
}
// Construct API URL with encoded storage parameter if needed
- const apiUrl = `http://${host}:${port}/lume/vms${vmName ? `/${vmName}` : ""}${storageParam}`;
+ const apiUrl = `http://${host}:${port}/lume/vms${
+ vmName ? `/${vmName}` : ""
+ }${storageParam}`;
// Only print the fetch URL when debug is enabled
logger.info(`Executing API request: ${apiUrl}`);
diff --git a/libs/computer/typescript/tests/index.test.ts b/libs/computer/typescript/tests/index.test.ts
index 36e38c87af..c8b56d7403 100644
--- a/libs/computer/typescript/tests/index.test.ts
+++ b/libs/computer/typescript/tests/index.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { Computer, OSType, VMProviderType } from "../src/index";
-describe("Create Computer Instances", () => {
+describe("Cloud Interface", () => {
it("should create a cloud computer", () => {
const computer = Computer.create({
vmProvider: VMProviderType.CLOUD,
@@ -11,26 +11,4 @@ describe("Create Computer Instances", () => {
apiKey: "asdf",
});
});
- it("should create a lume computer", () => {
- const computer = Computer.create({
- vmProvider: VMProviderType.LUME,
- display: { width: 1000, height: 1000, scale_factor: 1 },
- image: "computer-image",
- memory: "5GB",
- cpu: 2,
- name: "computer-name",
- osType: OSType.MACOS,
- });
- });
- it("should create a lumier computer", () => {
- const computer = Computer.create({
- vmProvider: VMProviderType.LUMIER,
- display: { width: 1000, height: 1000, scale_factor: 1 },
- image: "computer-image",
- memory: "5GB",
- cpu: 2,
- name: "computer-name",
- osType: OSType.MACOS,
- });
- });
});