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.

Restructure API reference for clarity

James Murdza4eac69285dd3
diff --git a/docs/content/docs/libraries/lume/http-api.mdx b/docs/content/docs/libraries/lume/http-api.mdx
index 079a134a08..04792f263d 100644
--- a/docs/content/docs/libraries/lume/http-api.mdx
+++ b/docs/content/docs/libraries/lume/http-api.mdx
@@ -1,9 +1,10 @@
---
title: HTTP Server API
-description: Lume exposes a local HTTP API server that listens at localhost for programatic management of VMs.
+description: Lume exposes a local HTTP API server that listens at localhost for programmatic management of VMs.
---
import { Tabs, Tab } from 'fumadocs-ui/components/tabs';
+import { Callout } from 'fumadocs-ui/components/callout';
## Default URL
@@ -19,11 +20,13 @@ http://localhost:7777
## Endpoints
+---
+
### Create VM
Create a new virtual machine.
-`POST: /vms`
+`POST: /lume/vms`
#### Parameters
@@ -49,126 +52,6 @@ curl --connect-timeout 6000 \
-X POST \
-H "Content-Type: application/json" \
-d '{
- "name": "ssd",
- "path": "/Volumes/SSD/lume/vms"
- }' \
- http://localhost:7777/lume/config/locations
-```
-
- </Tab>
- <Tab value="Python">
-
-```python
-import requests
-
-payload = {
- "name": "ssd",
- "path": "/Volumes/SSD/lume/vms"
-}
-r = requests.post("http://localhost:7777/lume/config/locations", json=payload, timeout=50)
-print(r.json())
-```
-
- </Tab>
- <Tab value="TypeScript">
-
-```typescript
-const payload = {
- name: 'ssd',
- path: '/Volumes/SSD/lume/vms',
-};
-const res = await fetch('http://localhost:7777/lume/config/locations', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(payload),
-});
-console.log(await res.json());
-```
-
- </Tab>
-</Tabs>
-
-### Remove VM Storage Location
-
-Remove a VM storage location.
-
-`DELETE: /lume/config/locations/:name`
-
-#### Example Request
-
-<Tabs groupId="language" persist items={['Curl', 'Python', 'TypeScript']}>
- <Tab value="Curl">
-
-```bash
-curl --connect-timeout 6000 \
- --max-time 5000 \
- -X DELETE \
- http://localhost:7777/lume/config/locations/ssd
-```
-
- </Tab>
- <Tab value="Python">
-
-```python
-import requests
-
-r = requests.delete("http://localhost:7777/lume/config/locations/ssd", timeout=50)
-print(r.status_code)
-```
-
- </Tab>
- <Tab value="TypeScript">
-
-```typescript
-const res = await fetch('http://localhost:7777/lume/config/locations/ssd', {
- method: 'DELETE',
-});
-console.log(res.status);
-```
-
- </Tab>
-</Tabs>
-
-### Set Default VM Storage Location
-
-Set a storage location as the default.
-
-`POST: /lume/config/locations/default/:name`
-
-#### Example Request
-
-<Tabs groupId="language" persist items={['Curl', 'Python', 'TypeScript']}>
- <Tab value="Curl">
-
-```bash
-curl --connect-timeout 6000 \
- --max-time 5000 \
- -X POST \
- http://localhost:7777/lume/config/locations/default/ssd
-```
-
- </Tab>
- <Tab value="Python">
-
-```python
-import requests
-
-r = requests.post("http://localhost:7777/lume/config/locations/default/ssd", timeout=50)
-print(r.json())
-```
-
- </Tab>
- <Tab value="TypeScript">
-
-```typescript
-const res = await fetch('http://localhost:7777/lume/config/locations/default/ssd', {
- method: 'POST',
-});
-console.log(await res.json());
-```
-
- </Tab>
-</Tabs>
"name": "lume_vm",
"os": "macOS",
"cpu": 2,
@@ -206,32 +89,34 @@ print(r.json())
```typescript
const payload = {
- name: "lume_vm",
- os: "macOS",
+ name: 'lume_vm',
+ os: 'macOS',
cpu: 2,
- memory: "4GB",
- diskSize: "64GB",
- display: "1024x768",
- ipsw: "latest",
- storage: "ssd"
-}
+ memory: '4GB',
+ diskSize: '64GB',
+ display: '1024x768',
+ ipsw: 'latest',
+ storage: 'ssd',
+};
const res = await fetch('http://localhost:7777/lume/vms', {
- method: 'POST',
- headers: { 'Content-Type': 'application/json' },
- body: JSON.stringify(payload),
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(payload),
});
-console.log(await res.json())
+console.log(await res.json());
```
</Tab>
</Tabs>
+---
+
### Run VM
Run a virtual machine instance.
-`POST: /vms/:name/run`
+`POST: /lume/vms/:name/run`
#### Parameters
@@ -301,7 +186,7 @@ print(r.json())
```typescript
// Basic run
-const res = await fetch('http://localhost:7777/lume/vms/my-vm-name/run', {
+let res = await fetch('http://localhost:7777/lume/vms/my-vm-name/run', {
method: 'POST',
});
console.log(await res.json());
@@ -313,22 +198,24 @@ const payload = {
recoveryMode: false,
storage: 'ssd',
};
-const res2 = await fetch('http://localhost:7777/lume/vms/lume_vm/run', {
+res = await fetch('http://localhost:7777/lume/vms/lume_vm/run', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
-console.log(await res2.json());
+console.log(await res.json());
```
</Tab>
</Tabs>
+---
+
### List VMs
List all virtual machines.
-`GET: /vms`
+`GET: /lume/vms`
#### Example Request
@@ -383,11 +270,13 @@ console.log(await res.json());
]
```
+---
+
### Get VM Details
Get details for a specific virtual machine.
-`GET: /vms/:name`
+`GET: /lume/vms/:name`
#### Parameters
@@ -432,12 +321,12 @@ print(details.json())
```typescript
// Basic get
-const res = await fetch('http://localhost:7777/lume/vms/lume_vm');
+let res = await fetch('http://localhost:7777/lume/vms/lume_vm');
console.log(await res.json());
// Get with specific storage
-const res2 = await fetch('http://localhost:7777/lume/vms/lume_vm?storage=ssd');
-console.log(await res2.json());
+res = await fetch('http://localhost:7777/lume/vms/lume_vm?storage=ssd');
+console.log(await res.json());
```
</Tab>
@@ -464,11 +353,13 @@ console.log(await res2.json());
}
```
+---
+
### Update VM Configuration
Update the configuration of a virtual machine.
-`PATCH: /vms/:name`
+`PATCH: /lume/vms/:name`
#### Parameters
@@ -539,11 +430,13 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
### Stop VM
Stop a running virtual machine.
-`POST: /vms/:name/stop`
+`POST: /lume/vms/:name/stop`
#### Parameters
@@ -590,26 +483,28 @@ print(r.json())
```typescript
// Basic stop
-const res = await fetch('http://localhost:7777/lume/vms/lume_vm/stop', {
+let res = await fetch('http://localhost:7777/lume/vms/lume_vm/stop', {
method: 'POST',
});
console.log(await res.json());
// Stop with storage location specified
-const res2 = await fetch('http://localhost:7777/lume/vms/lume_vm/stop?storage=ssd', {
+res = await fetch('http://localhost:7777/lume/vms/lume_vm/stop?storage=ssd', {
method: 'POST',
});
-console.log(await res2.json());
+console.log(await res.json());
```
</Tab>
</Tabs>
+---
+
### Delete VM
Delete a virtual machine instance.
-`DELETE: /vms/:name`
+`DELETE: /lume/vms/:name`
#### Parameters
@@ -656,26 +551,28 @@ print(r.status_code)
```typescript
// Basic delete
-const res = await fetch('http://localhost:7777/lume/vms/lume_vm', {
+let res = await fetch('http://localhost:7777/lume/vms/lume_vm', {
method: 'DELETE',
});
console.log(res.status);
// Delete with specific storage
-const res2 = await fetch('http://localhost:7777/lume/vms/lume_vm?storage=ssd', {
+res = await fetch('http://localhost:7777/lume/vms/lume_vm?storage=ssd', {
method: 'DELETE',
});
-console.log(res2.status);
+console.log(res.status);
```
</Tab>
</Tabs>
+---
+
### Clone VM
Clone an existing virtual machine.
-`POST: /vms/:name/clone`
+`POST: /lume/vms/clone`
#### Parameters
@@ -742,11 +639,13 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
### Pull VM Image
Pull a VM image from a registry.
-`POST: /pull`
+`POST: /lume/pull`
#### Parameters
@@ -817,11 +716,13 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
### Push VM Image
Push a VM to a registry as an image (asynchronous operation).
-`POST: /vms/push`
+`POST: /lume/vms/push`
#### Parameters
@@ -914,11 +815,13 @@ console.log(await res.json());
}
```
+---
+
### List Images
List available VM images.
-`GET: /images`
+`GET: /lume/images`
#### Example Request
@@ -961,6 +864,8 @@ console.log(await res.json());
}
```
+---
+
### Prune Images
Remove unused VM images to free up disk space.
@@ -1002,11 +907,13 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
### Get Latest IPSW URL
Get the URL for the latest macOS IPSW file.
-`GET: /ipsw`
+`GET: /lume/ipsw`
#### Example Request
@@ -1040,6 +947,8 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
## Configuration Management
### Get Configuration
@@ -1155,6 +1064,8 @@ console.log(await res.json());
</Tab>
</Tabs>
+---
+
## Storage Location Management
### Get VM Storage Locations
@@ -1218,10 +1129,10 @@ Add a new VM storage location.
#### Parameters
-| Name | Type | Required | Description |
-| ---- | ------ | -------- | ------------------------------ |
-| name | string | Yes | Storage location name |
-| path | string | Yes | File system path for storage |
+| Name | Type | Required | Description |
+| ---- | ------ | -------- | ---------------------------- |
+| name | string | Yes | Storage location name |
+| path | string | Yes | File system path for storage |
#### Example Request
@@ -1233,4 +1144,124 @@ curl --connect-timeout 6000 \
--max-time 5000 \
-X POST \
-H "Content-Type: application/json" \
- -d '{
\ No newline at end of file
+ -d '{
+ "name": "ssd",
+ "path": "/Volumes/SSD/lume/vms"
+ }' \
+ http://localhost:7777/lume/config/locations
+```
+
+ </Tab>
+ <Tab value="Python">
+
+```python
+import requests
+
+payload = {
+ "name": "ssd",
+ "path": "/Volumes/SSD/lume/vms"
+}
+r = requests.post("http://localhost:7777/lume/config/locations", json=payload, timeout=50)
+print(r.json())
+```
+
+ </Tab>
+ <Tab value="TypeScript">
+
+```typescript
+const payload = {
+ name: 'ssd',
+ path: '/Volumes/SSD/lume/vms',
+};
+const res = await fetch('http://localhost:7777/lume/config/locations', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(payload),
+});
+console.log(await res.json());
+```
+
+ </Tab>
+</Tabs>
+
+### Remove VM Storage Location
+
+Remove a VM storage location.
+
+`DELETE: /lume/config/locations/:name`
+
+#### Example Request
+
+<Tabs groupId="language" persist items={['Curl', 'Python', 'TypeScript']}>
+ <Tab value="Curl">
+
+```bash
+curl --connect-timeout 6000 \
+ --max-time 5000 \
+ -X DELETE \
+ http://localhost:7777/lume/config/locations/ssd
+```
+
+ </Tab>
+ <Tab value="Python">
+
+```python
+import requests
+
+r = requests.delete("http://localhost:7777/lume/config/locations/ssd", timeout=50)
+print(r.status_code)
+```
+
+ </Tab>
+ <Tab value="TypeScript">
+
+```typescript
+const res = await fetch('http://localhost:7777/lume/config/locations/ssd', {
+ method: 'DELETE',
+});
+console.log(res.status);
+```
+
+ </Tab>
+</Tabs>
+
+### Set Default VM Storage Location
+
+Set a storage location as the default.
+
+`POST: /lume/config/locations/default/:name`
+
+#### Example Request
+
+<Tabs groupId="language" persist items={['Curl', 'Python', 'TypeScript']}>
+ <Tab value="Curl">
+
+```bash
+curl --connect-timeout 6000 \
+ --max-time 5000 \
+ -X POST \
+ http://localhost:7777/lume/config/locations/default/ssd
+```
+
+ </Tab>
+ <Tab value="Python">
+
+```python
+import requests
+
+r = requests.post("http://localhost:7777/lume/config/locations/default/ssd", timeout=50)
+print(r.json())
+```
+
+ </Tab>
+ <Tab value="TypeScript">
+
+```typescript
+const res = await fetch('http://localhost:7777/lume/config/locations/default/ssd', {
+ method: 'POST',
+});
+console.log(await res.json());
+```
+
+ </Tab>
+</Tabs>