Skip to main content

Computer Control API

पंजीकृत कंप्यूटरों का रिमोट नियंत्रण — कमांड कतारबद्ध करें, स्क्रीनशॉट लें, रिमोट मशीनों पर स्क्रिप्ट चलाएँ।


Computer Control API

Computer Control API आपको पंजीकृत कंप्यूटरों को रिमोट-कंट्रोल करने की सुविधा देता है। एक छोटा एजेंट (screen-remote-agent) लक्षित मशीन पर चलता है, कमांड के लिए poll करता है, उन्हें निष्पादित करता है, और परिणाम वापस पोस्ट करता है। यह LLM-चालित GUI ऑटोमेशन सक्षम बनाता है।

आर्किटेक्चर

┌─────────────┐  queue cmd   ┌──────────┐  poll   ┌─────────────────┐
│ LLM Agent   │ ───────────▶ │ Synapse  │ ◀───── │ screen-remote   │
│ (user-side) │              │  Server  │ ──────▶│ (on target PC)  │
└─────────────┘              └──────────┘ result  └─────────────────┘
                                     ▲
                                     │
                              ┌─────────────┐
                              │  Human UI   │
                              │ (browser)   │
                              └─────────────┘

उपयोगकर्ता-सामने के एंडपॉइंट्स (Mind Key या JWT)

GET /computers/list

सभी पंजीकृत कंप्यूटरों की सूची बनाएँ।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/list

GET /computers/:id

एक कंप्यूटर का विवरण प्राप्त करें।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001

POST /computers/install-code

नया कंप्यूटर पंजीकृत करने के लिए इंस्टॉल कोड जनरेट करें।

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"}'

प्रतिक्रिया: { "install_code": "ic_xyz789", "expires_at": "..." }

POST /computers/:id/commands

रिमोट एजेंट द्वारा निष्पादित करने के लिए कमांड कतारबद्ध करें।

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": {}
  }'

प्रतिक्रिया: { "command_id": "cmd_001", "status": "queued" }

GET /computers/:id/command (query के माध्यम से)

GET के माध्यम से कमांड कतारबद्ध करें (सरल मामलों के लिए)।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     "https://synapse.schaefer.zone/computers/comp_001/command?type=screenshot"

GET /computers/:id/commands

किसी कंप्यूटर के हाल के कमांड्स की सूची बनाएँ।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     "https://synapse.schaefer.zone/computers/comp_001/commands?limit=50"

GET /computers/:id/commands/:cid

किसी विशिष्ट कमांड की स्थिति + परिणाम प्राप्त करें।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/commands/cmd_001

GET /computers/:id/screenshot

वन-शॉट: स्क्रीनशॉट कमांड कतारबद्ध करें और परिणाम के लिए अधिकतम 30 सेकंड प्रतीक्षा करें।

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/screenshot > screenshot.png

POST /computers/:id/disable

कंप्यूटर को अक्षम करें (इसका टोकन रद्द करता है, ऑडिट के लिए रिकॉर्ड रखता है)।

curl -X POST -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/disable

DELETE /computers/:id

कंप्यूटर को स्थायी रूप से हटाएँ।

curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001

एजेंट-सामने के एंडपॉइंट्स (Computer Token)

इन एंडपॉइंट्स का उपयोग लक्षित मशीन पर चलने वाले screen-remote-agent द्वारा किया जाता है। ये Mind Key नहीं, बल्कि Computer Token (/computers/register से लौटाया गया) का उपयोग करते हैं।

POST /computers/register

इंस्टॉल कोड को रिडीम करें और 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"
  }'

प्रतिक्रिया: { "computer_id": "comp_001", "computer_token": "ct_..." }

`computer_token` को सहेजें — यह केवल एक बार दिखाया जाता है और सभी एजेंट-साइड एंडपॉइंट्स के लिए आवश्यक है।

GET /computers/me/poll

नए कमांड्स के लिए लॉन्ग-पोल। एजेंट इसे लूप में कॉल करता है।

curl -H "Authorization: Bearer ct_YOUR_COMPUTER_TOKEN" \
     "https://synapse.schaefer.zone/computers/me/poll?wait=30"

यदि कमांड्स लंबित हैं तो तुरंत लौटाता है, अन्यथा wait सेकंड के बाद।

POST /computers/me/commands/:cid/result

कमांड निष्पादन का परिणाम पोस्ट करें।

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..." }
  }'

कमांड प्रकार

प्रकार Payload विवरण
screenshot {} स्क्रीन को PNG के रूप में कैप्चर करें (base64)
click {x, y} निर्देशांक पर क्लिक करें
move {x, y} माउस को निर्देशांक पर ले जाएँ
type {text} कर्सर पर टेक्स्ट टाइप करें
key {keys: ["Ctrl","c"]} की कॉम्बो दबाएँ
scroll {deltaX, deltaY} स्क्रॉल व्हील
drag {fromX, fromY, toX, toY} ड्रैग और ड्रॉप

सामान्य पैटर्न: LLM-चालित GUI ऑटोमेशन

# 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 done

अगले कदम