Files
nandi 53f3e1b621 feat: auto-sync Antigravity OAuth auth to ephemeral Sprites
- Add server/antigravity-auth.ts to resolve Antigravity OAuth credentials
  from OpenBao (ANTIGRAVITY_OAUTH_TOKEN / AGY_OAUTH_TOKEN), env, local OS
  keyring (secret-tool / macOS security), or local token file and stream
  them over stdin (umask 077, mode 0600, atomic replace) into
  ~/.gemini/antigravity-cli/antigravity-oauth-token on Sprites
- Cache full OpenBao KV secret map in OpenBaoClient and add
  getOptionalSecretKey for zero-extra-request lookup
- Wire sync into SpritesManager.ensureSprite and restart Sprite Paseo
  daemon worker in ensureSpriteHost when credentials change
- Add syncAntigravityAuth setting (default true) with Settings UI toggle
- Add Antigravity to PROVIDER_CHOICES and prioritize it in PREFERRED_PROVIDERS
2026-11-18 19:18:47 -08:00

82 lines
4.7 KiB
Markdown

# 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 managed `fly-sprites` Paseo agents
- `sprite_create` — create or reuse a Sprite and optionally sync the agent's local workspace
- `sprite_spawn_agent` — spawn a managed Paseo agent (`fly-sprites`) inside a Sprite
- `sprite_agent_status` — list or inspect managed Fly Sprite agents and their latest turn output
- `sprite_agent_send` — send a follow-up prompt to a managed Fly Sprite agent
- `sprite_agent_stop` — interrupt or archive a managed Fly Sprite agent
- `sprite_exec` — run a synchronous command on a Sprite and return `stdout`, `stderr`, and `exitCode`
- `sprite_checkpoint` — create, list, or restore Sprite checkpoints
- `sprite_destroy` — delete a Sprite
3. **Paseo UI & Settings**
- **Agents Screen & Workspace Panel (`Fly Sprites`)**: Launch managed Paseo agents on Sprites, open/interrupt/archive agents, sync the active workspace directory, and manage checkpoints.
- **Command Center & Sidebar**: Quick entry (`Open Fly Sprites Agents`).
- **Settings Screen (`Fly Sprites Workers`)**: Host-scoped configuration, OpenBao/Zitadel auth, 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-agent-` | Prefix for auto-generated 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` | `acp` | Default provider mode (`acp` or `shell`) |
| `acpCommand` | `claude-code-acp` | Command run inside the Sprite in `acp` mode |
| `syncWorkspaceOnCreate` | `true` | Sync local workspace files on provider session open |
| `syncAntigravityAuth` | `true` | Sync Antigravity OAuth credentials (from OpenBao `ANTIGRAVITY_OAUTH_TOKEN`/`AGY_OAUTH_TOKEN`, env, local keyring, or local token file) to `~/.gemini/antigravity-cli/antigravity-oauth-token` on Sprites |
| `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/antigravity-auth.ts` — Automated Antigravity OAuth token resolution (OpenBao/env/keyring/file) and stdin sync to Sprites
- `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