mirror of
https://github.com/trycua/computer.git
synced 2026-02-18 04:19:38 -06:00
Merge branch 'main' into fix/computer-bump-agent
This commit is contained in:
97
.github/workflows/npm-publish-cli.yml
vendored
97
.github/workflows/npm-publish-cli.yml
vendored
@@ -17,27 +17,22 @@ jobs:
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
target: bun-linux-x64
|
||||
ext: ""
|
||||
- target: bun-linux-x64
|
||||
ext: ''
|
||||
binary_name: cua-linux-x64
|
||||
- os: macos-latest
|
||||
target: bun-darwin-x64
|
||||
ext: ""
|
||||
- target: bun-darwin-x64
|
||||
ext: ''
|
||||
binary_name: cua-darwin-x64
|
||||
- os: macos-latest
|
||||
target: bun-darwin-arm64
|
||||
ext: ""
|
||||
- target: bun-darwin-arm64
|
||||
ext: ''
|
||||
binary_name: cua-darwin-arm64
|
||||
- os: windows-latest
|
||||
target: bun-windows-x64
|
||||
ext: ".exe"
|
||||
binary_name: cua-windows-x64.exe
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
- target: bun-windows-x64
|
||||
ext: '.exe'
|
||||
binary_name: cua-windows-x64
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -73,14 +68,14 @@ jobs:
|
||||
- name: Build binary
|
||||
working-directory: ./libs/typescript/cua-cli
|
||||
run: |
|
||||
bun build --compile --minify --sourcemap --target=${{ matrix.target }} index.ts --outfile ${{ matrix.binary_name }}
|
||||
bun build --compile --minify --sourcemap --target=${{ matrix.target }} index.ts --outfile ${{ matrix.binary_name }}${{ matrix.ext }}
|
||||
mkdir -p ../../../dist
|
||||
mv ${{ matrix.binary_name }}${{ matrix.ext }}* ../../../dist/
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: cua-binary-${{ matrix.os }}
|
||||
name: cua-binary-${{ matrix.target }}
|
||||
path: dist/
|
||||
if-no-files-found: error
|
||||
retention-days: 1
|
||||
@@ -106,15 +101,21 @@ jobs:
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: ./libs/typescript/cua-cli
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Publish to npm
|
||||
working-directory: ./libs/typescript/cua-cli
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
|
||||
npm publish --access public
|
||||
env:
|
||||
NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
run: bun publish --production --access public --tolerate-republish
|
||||
|
||||
create-release:
|
||||
needs: [build-and-publish, publish-npm]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
@@ -139,22 +140,24 @@ jobs:
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v2
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ steps.version.outputs.tag }}
|
||||
release_name: CUA CLI ${{ steps.version.outputs.version }}
|
||||
release_name: cua-cli v${{ steps.version.outputs.version }}
|
||||
body: |
|
||||
# CUA CLI ${{ steps.version.outputs.version }}
|
||||
# cua-cli v${{ steps.version.outputs.version }}
|
||||
|
||||
## Installation
|
||||
|
||||
### Using install script (recommended)
|
||||
```bash
|
||||
# For Linux/macOS
|
||||
curl -fsSL https://cua.ai/install.sh | sh
|
||||
|
||||
curl -fsSL https://cua.ai/cli/install.sh | sh
|
||||
|
||||
# For Windows (PowerShell)
|
||||
irm https://cua.ai/install.ps1 | iex
|
||||
irm https://cua.ai/cli/install.ps1 | iex
|
||||
```
|
||||
|
||||
### Using npm/bun
|
||||
@@ -183,12 +186,42 @@ jobs:
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
- name: Upload Release Assets
|
||||
uses: actions/upload-release-asset@v2
|
||||
- name: Upload Linux Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./dist/${{ matrix.binary_name }}
|
||||
asset_name: ${{ matrix.binary_name }}
|
||||
asset_path: ./dist/cua-linux-x64
|
||||
asset_name: cua-linux-x64
|
||||
asset_content_type: application/octet-stream
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload macOS Intel Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./dist/cua-darwin-x64
|
||||
asset_name: cua-darwin-x64
|
||||
asset_content_type: application/octet-stream
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload macOS Apple Silicon Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./dist/cua-darwin-arm64
|
||||
asset_name: cua-darwin-arm64
|
||||
asset_content_type: application/octet-stream
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Upload Windows Binary
|
||||
uses: actions/upload-release-asset@v1
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ./dist/cua-windows-x64.exe
|
||||
asset_name: cua-windows-x64.exe
|
||||
asset_content_type: application/octet-stream
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
@@ -431,15 +431,9 @@ Host: my-vm-abc123.containers.cloud.trycua.com
|
||||
|
||||
You can now interact with your sandbox in multiple ways:
|
||||
|
||||
#### Option 1: Open the AI Playground (Recommended)
|
||||
|
||||
```bash
|
||||
cua chat my-vm-abc123
|
||||
```
|
||||
|
||||
This opens the full CUA playground in your browser where you can chat with AI agents that control your sandbox.
|
||||
|
||||
#### Option 2: Access VNC Desktop
|
||||
#### Option 1: Access VNC Desktop
|
||||
|
||||
```bash
|
||||
cua open my-vm-abc123
|
||||
@@ -447,7 +441,7 @@ cua open my-vm-abc123
|
||||
|
||||
This opens a remote desktop connection to your sandbox.
|
||||
|
||||
#### Option 3: List and Manage Sandboxes
|
||||
#### Option 2: List and Manage Sandboxes
|
||||
|
||||
```bash
|
||||
# List all your sandboxes
|
||||
@@ -463,21 +457,6 @@ cua delete my-vm-abc123
|
||||
|
||||
</Step>
|
||||
|
||||
<Step>
|
||||
|
||||
### Try Some AI Tasks
|
||||
|
||||
Once you have the playground open (`cua chat`), try asking the AI to:
|
||||
|
||||
- "Take a screenshot and tell me what's on the screen"
|
||||
- "Open Firefox and navigate to github.com"
|
||||
- "Create a new text file and write 'Hello World' in it"
|
||||
- "Install Python and run a simple script"
|
||||
- "Take a screenshot of the desktop"
|
||||
|
||||
The AI agent will automatically control your sandbox to complete these tasks!
|
||||
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
### What's Next?
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Callout } from 'fumadocs-ui/components/callout';
|
||||
The CUA CLI provides commands for authentication and sandbox management:
|
||||
|
||||
- **Authentication** - `cua login`, `cua env`, `cua logout`
|
||||
- **Sandbox Management** - `cua list`, `cua create`, `cua start`, `cua stop`, `cua restart`, `cua delete`, `cua open`, `cua chat`
|
||||
- **Sandbox Management** - `cua list`, `cua create`, `cua start`, `cua stop`, `cua restart`, `cua delete`, `cua open`
|
||||
|
||||
## Authentication Commands
|
||||
|
||||
@@ -219,21 +219,6 @@ Opening NoVNC: https://my-dev-sandbox.containers.cloud.trycua.com/vnc.html?autoc
|
||||
|
||||
This command automatically opens your default browser to the VNC interface with the correct password pre-filled.
|
||||
|
||||
### `cua chat`
|
||||
|
||||
Open the CUA playground for a sandbox in your browser.
|
||||
|
||||
```bash
|
||||
cua chat <name>
|
||||
```
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
$ cua chat my-dev-sandbox
|
||||
Opening Playground: https://cua.ai/dashboard/playground?host=...
|
||||
```
|
||||
|
||||
This opens the full CUA playground interface where you can interact with your sandbox using AI agents.
|
||||
|
||||
## Global Options
|
||||
|
||||
@@ -310,7 +295,7 @@ cua env
|
||||
### 3. Quick Sandbox Access
|
||||
```bash
|
||||
# Create aliases for frequently used sandboxes
|
||||
alias dev-sandbox="cua chat my-development-sandbox"
|
||||
alias dev-sandbox="cua open my-development-sandbox"
|
||||
alias prod-sandbox="cua open my-production-sandbox"
|
||||
```
|
||||
|
||||
|
||||
@@ -29,9 +29,6 @@ cua create --os linux --configuration small --region north-america
|
||||
|
||||
# List your sandboxes
|
||||
cua list
|
||||
|
||||
# Open the playground for your sandbox
|
||||
cua chat my-sandbox-name
|
||||
```
|
||||
|
||||
## Use Cases
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@trycua/cli",
|
||||
"version": "0.1.1",
|
||||
"version": "0.1.2",
|
||||
"packageManager": "bun@1.1.38",
|
||||
"description": "Command-line interface for CUA cloud VMs and authentication",
|
||||
"type": "module",
|
||||
|
||||
@@ -281,37 +281,37 @@ export function registerVmCommands(y: Argv) {
|
||||
await openInBrowser(url);
|
||||
}
|
||||
)
|
||||
.command(
|
||||
'chat <name>',
|
||||
'Open CUA playground for a sandbox',
|
||||
(y) => y.positional('name', { type: 'string', describe: 'Sandbox name' }),
|
||||
async (argv: Record<string, unknown>) => {
|
||||
const token = await ensureApiKeyInteractive();
|
||||
const name = String((argv as any).name);
|
||||
const listRes = await http('/v1/vms', { token });
|
||||
if (listRes.status === 401) {
|
||||
clearApiKey();
|
||||
console.error("Unauthorized. Try 'cua login' again.");
|
||||
process.exit(1);
|
||||
}
|
||||
if (!listRes.ok) {
|
||||
console.error(`Request failed: ${listRes.status}`);
|
||||
process.exit(1);
|
||||
}
|
||||
const vms = (await listRes.json()) as VmItem[];
|
||||
const vm = vms.find((v) => v.name === name);
|
||||
if (!vm) {
|
||||
console.error('Sandbox not found');
|
||||
process.exit(1);
|
||||
}
|
||||
const host =
|
||||
vm.host && vm.host.length
|
||||
? vm.host
|
||||
: `${vm.name}.containers.cloud.trycua.com`;
|
||||
const base = WEBSITE_URL.replace(/\/$/, '');
|
||||
const url = `${base}/dashboard/playground?host=${encodeURIComponent(host)}&id=${encodeURIComponent(vm.name)}&name=${encodeURIComponent(vm.name)}&vnc_password=${encodeURIComponent(vm.password)}&fullscreen=true`;
|
||||
console.log(`Opening Playground: ${url}`);
|
||||
await openInBrowser(url);
|
||||
}
|
||||
);
|
||||
// .command(
|
||||
// 'chat <name>',
|
||||
// 'Open CUA playground for a sandbox',
|
||||
// (y) => y.positional('name', { type: 'string', describe: 'Sandbox name' }),
|
||||
// async (argv: Record<string, unknown>) => {
|
||||
// const token = await ensureApiKeyInteractive();
|
||||
// const name = String((argv as any).name);
|
||||
// const listRes = await http('/v1/vms', { token });
|
||||
// if (listRes.status === 401) {
|
||||
// clearApiKey();
|
||||
// console.error("Unauthorized. Try 'cua login' again.");
|
||||
// process.exit(1);
|
||||
// }
|
||||
// if (!listRes.ok) {
|
||||
// console.error(`Request failed: ${listRes.status}`);
|
||||
// process.exit(1);
|
||||
// }
|
||||
// const vms = (await listRes.json()) as VmItem[];
|
||||
// const vm = vms.find((v) => v.name === name);
|
||||
// if (!vm) {
|
||||
// console.error('Sandbox not found');
|
||||
// process.exit(1);
|
||||
// }
|
||||
// const host =
|
||||
// vm.host && vm.host.length
|
||||
// ? vm.host
|
||||
// : `${vm.name}.containers.cloud.trycua.com`;
|
||||
// const base = WEBSITE_URL.replace(/\/$/, '');
|
||||
// const url = `${base}/dashboard/playground?host=${encodeURIComponent(host)}&id=${encodeURIComponent(vm.name)}&name=${encodeURIComponent(vm.name)}&vnc_password=${encodeURIComponent(vm.password)}&fullscreen=true`;
|
||||
// console.log(`Opening Playground: ${url}`);
|
||||
// await openInBrowser(url);
|
||||
// }
|
||||
// );
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ if (Test-Path $binaryPath) {
|
||||
Write-Host "Success: CUA CLI $version installed successfully to $binaryPath" -ForegroundColor Green
|
||||
Write-Host ""
|
||||
Write-Host "Get started with:" -ForegroundColor Cyan
|
||||
Write-Host " cua auth login"
|
||||
Write-Host " cua vm create --os linux --configuration small --region north-america"
|
||||
Write-Host " cua login"
|
||||
Write-Host " cua create --os linux --configuration small --region north-america"
|
||||
Write-Host ""
|
||||
Write-Host "For more help, visit: https://docs.cua.ai/libraries/cua-cli" -ForegroundColor Cyan
|
||||
|
||||
|
||||
Reference in New Issue
Block a user