Computer Control API
Controllo remoto di computer registrati — accoda comandi, cattura schermate, esegue script su macchine remote.
Computer Control API
La Computer Control API permette di controllare da remoto computer registrati.
Un piccolo agente (screen-remote-agent) viene eseguito sulla macchina di
destinazione, esegue il polling dei comandi, li esegue e pubblica i risultati.
Questo abilita l'automazione GUI guidata da LLM.
Architettura
┌─────────────┐ queue cmd ┌──────────┐ poll ┌─────────────────┐
│ LLM Agent │ ───────────▶ │ Synapse │ ◀───── │ screen-remote │
│ (user-side) │ │ Server │ ──────▶│ (on target PC) │
└─────────────┘ └──────────┘ result └─────────────────┘
▲
│
┌─────────────┐
│ Human UI │
│ (browser) │
└─────────────┘Endpoint lato utente (Mind Key o JWT)
GET /computers/list
Elenca tutti i computer registrati.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/listGET /computers/:id
Ottiene i dettagli di un singolo computer.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/comp_001POST /computers/install-code
Genera un codice di installazione per registrare un nuovo computer.
curl -X POST https://synapse.schaefer.zone/computers/install-code \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-H "Content-Type: application/json" \
-d '{"computer_name": "office-mac"}'Risposta: { "install_code": "ic_xyz789", "expires_at": "..." }
POST /computers/:id/commands
Accoda un comando che l'agente remoto eseguirà.
curl -X POST https://synapse.schaefer.zone/computers/comp_001/commands \
-H "Authorization: Bearer YOUR_MIND_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "screenshot",
"payload": {}
}'Risposta: { "command_id": "cmd_001", "status": "queued" }
GET /computers/:id/command (via query)
Accoda un comando tramite GET (per casi semplici).
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
"https://synapse.schaefer.zone/computers/comp_001/command?type=screenshot"GET /computers/:id/commands
Elenca i comandi recenti di un computer.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
"https://synapse.schaefer.zone/computers/comp_001/commands?limit=50"GET /computers/:id/commands/:cid
Ottiene stato + risultato di uno specifico comando.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/comp_001/commands/cmd_001GET /computers/:id/screenshot
One-shot: accoda un comando screenshot e attende fino a 30s per il risultato.
curl -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/comp_001/screenshot > screenshot.pngPOST /computers/:id/disable
Disabilita un computer (revoca il token, mantiene il record per audit).
curl -X POST -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/comp_001/disableDELETE /computers/:id
Elimina definitivamente un computer.
curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
https://synapse.schaefer.zone/computers/comp_001Endpoint lato agente (Computer Token)
Questi endpoint sono utilizzati dal screen-remote-agent in esecuzione sulla
macchina di destinazione. Usano un Computer Token (restituito da
/computers/register), non una Mind Key.
POST /computers/register
Riscatta un codice di installazione e ottiene un Computer Token.
curl -X POST https://synapse.schaefer.zone/computers/register \
-H "Content-Type: application/json" \
-d '{
"code": "ic_xyz789",
"computer_name": "office-mac",
"platform": "darwin",
"platform_release": "14.5.0",
"python": "3.12.4"
}'Risposta: { "computer_id": "comp_001", "computer_token": "ct_..." }
GET /computers/me/poll
Long-polling per nuovi comandi. L'agente lo chiama in un ciclo.
curl -H "Authorization: Bearer ct_YOUR_COMPUTER_TOKEN" \
"https://synapse.schaefer.zone/computers/me/poll?wait=30"Ritorna immediatamente se ci sono comandi in attesa, o dopo wait secondi in caso contrario.
POST /computers/me/commands/:cid/result
Pubblica il risultato dell'esecuzione di un comando.
curl -X POST https://synapse.schaefer.zone/computers/me/commands/cmd_001/result \
-H "Authorization: Bearer ct_YOUR_COMPUTER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "done",
"result": { "screenshot_b64": "iVBORw0KG..." }
}'Tipi di comando
| Tipo | Payload | Descrizione |
|---|---|---|
screenshot |
{} |
Cattura schermo come PNG (base64) |
click |
{x, y} |
Clic alle coordinate |
move |
{x, y} |
Sposta il mouse alle coordinate |
type |
{text} |
Digita testo al cursore |
key |
{keys: ["Ctrl","c"]} |
Preme una combinazione di tasti |
scroll |
{deltaX, deltaY} |
Rotella di scorrimento |
drag |
{fromX, fromY, toX, toY} |
Trascina e rilascia |
Modello comune: automazione GUI guidata da LLM
# LLM agent workflow
1. List computers: GET /computers/list
2. Take screenshot: GET /computers/:id/screenshot
3. Analyze screenshot (vision model)
4. Queue click: POST /computers/:id/commands {type:"click", payload:{x,y}}
5. Wait for result: GET /computers/:id/commands/:cid
6. Take new screenshot to verify
7. Repeat until task doneProssimi passi
- Browser Proxy — servizio separato per automazione browser
- Guida Self-Hosted Agents