Skip to content

Latest commit

 

History

History
83 lines (61 loc) · 2.7 KB

File metadata and controls

83 lines (61 loc) · 2.7 KB

Antigravity Gateway

This is a small API server that turns your local Antigravity launcher into a guarded remote session service.

It exposes:

  • POST /prompt to run agy --print and return a single result
  • POST /sessions to start a session
  • GET /sessions to list sessions
  • GET /sessions/:id to inspect one session
  • POST /sessions/:id/input to send text to the running CLI
  • GET /sessions/:id/events to stream stdout/stderr/status over Server-Sent Events
  • POST /sessions/:id/terminate to stop a session

Why this shape

The server does not expose your whole shell. It only spawns the configured launcher inside a workspace directory that must live under WORKSPACES_DIR.

Run

  1. Copy .env.example into your shell environment.
  2. Make sure API_TOKEN is set.
  3. Start the server:
npm start

The server binds to 127.0.0.1 by default. Expose it remotely through Tailscale, Cloudflare Tunnel, or another access layer instead of binding it directly to the public network.

Example

Single prompt:

curl -X POST http://localhost:8787/prompt \
  -H "Authorization: Bearer replace-me" \
  -H "Content-Type: application/json" \
  -d '{"friendId":"alice","workspace":"alice","prompt":"Summarize the files in this workspace."}'

Create a session:

curl -X POST http://localhost:8787/sessions \
  -H "Authorization: Bearer replace-me" \
  -H "Content-Type: application/json" \
  -d '{"friendId":"alice","workspace":"alice"}'

Stream session output:

curl -N http://localhost:8787/sessions/<session-id>/events \
  -H "Authorization: Bearer replace-me"

Send input:

curl -X POST http://localhost:8787/sessions/<session-id>/input \
  -H "Authorization: Bearer replace-me" \
  -H "Content-Type: application/json" \
  -d '{"input":"hello from remote"}'

Terminate:

curl -X POST http://localhost:8787/sessions/<session-id>/terminate \
  -H "Authorization: Bearer replace-me"

Notes

  • By default the server runs the configured ANTIGRAVITY_BIN with no extra args inside the selected workspace directory.
  • POST /prompt is the recommended path for remote code-assist style usage because it does not depend on interactive terminal behavior.
  • If your local install needs fixed startup arguments, set ANTIGRAVITY_ARGS.
  • PRINT_TIMEOUT_MS controls the default timeout for POST /prompt.
  • USE_PTY=auto enables node-pty on macOS, which is helpful for interactive CLIs such as agy.
  • If you really need the server to listen on another interface, set HOST.
  • Put this behind Tailscale, Cloudflare Access, or another private access layer before exposing it to the internet.
  • Use a separate macOS user if other people will drive sessions on your machine.