diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a7c2fd --- /dev/null +++ b/README.md @@ -0,0 +1,78 @@ +# Fly Sprites Workers + +A Paseo plugin (`@getpaseo/plugin >= 0.16.2`) for spawning remote workers and isolated coding agent sessions on [Fly.io Sprites](https://sprites.dev/) microVMs via `@fly/sprites`. + +## Features + +1. **Native Paseo Provider (`fly-sprites`)** + - **`shell` mode**: Executes each prompt inside the Sprite via `bash -lc` and streams stdout/stderr live into Paseo shell tool calls. + - **`acp` mode**: Spawns an ACP-compatible agent binary (default `claude-code-acp`) inside the Sprite over WebSocket stdio using `@agentclientprotocol/sdk`, forwarding messages, tool calls, plans, usage, and permission requests. + - Optional automatic workspace sync into `/workspace` on session open and copy-on-write checkpointing after each turn. + +2. **Injected Agent Tools (`sprite_*`)** + - Automatically injected into Paseo agent sessions via `agent.open.before` (configurable in settings): + - `sprite_list` — list remote Fly Sprites and tracked workers + - `sprite_create` — create or reuse a Sprite and optionally sync the agent's local workspace + - `sprite_spawn_worker` — spawn an asynchronous background worker command on a Sprite + - `sprite_exec` — run a synchronous command on a Sprite and return `stdout`, `stderr`, and `exitCode` + - `sprite_worker_status` — inspect status and buffered output of tracked workers + - `sprite_worker_stop` — stop a running worker + - `sprite_checkpoint` — create, list, or restore Sprite checkpoints + - `sprite_destroy` — delete a Sprite and stop its active tracked workers + +3. **Paseo UI & Settings** + - **Workers Screen & Workspace Panel (`Fly Sprites`)**: Create Sprites, sync the active workspace directory, spawn workers, stream live worker logs, and manage checkpoints. + - **Command Center & Sidebar**: Quick entry (`Open Fly Sprites Workers`). + - **Settings Screen (`Fly Sprites Workers`)**: Host-scoped configuration and connection test. + +## Installation (Local Directory Plugin) + +1. Install dependencies and verify types: + ```bash + npm install + npm run typecheck + ``` +2. Add the plugin directory to `~/.paseo/config.json` under `plugins`: + ```json + { + "plugins": { + "fly-sprites-workers": { + "source": "directory", + "path": "/path/to/fly-sprites-workers", + "enabled": true + } + } + } + ``` +3. Restart or reload the Paseo daemon. + +## Configuration + +Configure settings under **Settings → Fly Sprites Workers** (stored in Paseo host scope) or via environment variables: + +| Setting | Default | Description | +| --- | --- | --- | +| `token` | `""` | Fly Sprites API token (falls back to `SPRITES_TOKEN` in daemon env) | +| `baseUrl` | `https://api.sprites.dev` | Sprites API base URL | +| `spritePrefix` | `paseo-worker-` | Prefix for auto-generated worker Sprites | +| `defaultRegion` | `""` | Optional Fly region slug | +| `defaultRamMB` | `0` | Optional RAM in MB (`0` uses API default) | +| `defaultCpus` | `0` | Optional vCPU count (`0` uses API default) | +| `defaultRemoteCwd` | `/workspace` | Default working directory inside Sprites | +| `defaultProviderMode` | `shell` | Default provider mode (`shell` or `acp`) | +| `acpCommand` | `claude-code-acp` | Command run inside the Sprite in `acp` mode | +| `syncWorkspaceOnCreate` | `true` | Sync local workspace files on provider session open | +| `injectAgentTools` | `true` | Inject `sprite_*` tools into Paseo agent sessions | +| `autoCleanupOnArchive` | `false` | Delete Sprites created by `fly-sprites` sessions on archive | + +## Project Layout + +- `index.server.ts` — Plugin server entrypoint (settings, provider, hooks, RPCs, `sprites.watch` subscription) +- `index.client.tsx` — Plugin client entrypoint (screen, workspace panel, sidebar item, command center, settings) +- `server/sprites-manager.ts` — `@fly/sprites` client wrapper, tar/git workspace sync, worker log streaming, checkpoints +- `server/provider.ts` — Native `fly-sprites` `ProviderRegistration` (`shell` and `acp` modes) +- `server/agent-tools.ts` — `defineAgentTool` definitions for `sprite_*` tools +- `shared/contracts.ts` — Zod RPC and subscription contracts +- `shared/settings.ts` — Host-scoped settings schema +- `client/workers-screen.tsx` — Workers & Sprites management UI +- `client/settings-screen.tsx` — Settings UI