# Computer Control API SUMMARY: ควบคุม computer ที่ลงทะเบียนจากระยะไกล — จัดคิวคำสั่ง, จับภาพ screenshot, รันสคริปต์บนเครื่องระยะไกล KEY CONTEXT: Two sides: user-facing (Mind Key/JWT) and agent-facing (Computer Token) Register agent: POST /computers/register { install_code } → returns computer_token List: GET /computers/list (Mind Key or JWT) Queue command: POST /computers/:id/commands { type, payload } Command types: screenshot, click, move, type, key, scroll, drag Agent poll: GET /computers/me/poll?wait=5 (Computer Token) Agent result: POST /computers/me/commands/:cid/result (Computer Token) One-shot screenshot: GET /computers/:id/screenshot (waits 30s for result) Pattern: register agent on remote machine → user queues commands → agent polls and executes Computer Control API Computer Control API ช่วยให้คุณควบคุม computer ที่ลงทะเบียนจากระยะไกล agent ตัวเล็ก ๆ () รันบนเครื่องเป้าหมาย, poll หาคำสั่ง, ปฏิบัติตามคำสั่ง, และส่งผลลัพธ์กลับ ทำให้สามารถทำ GUI automation ที่ขับเคลื่อนด้วย LLM ได้ Architecture [CODE BLOCK] User-Facing Endpoints (Mind Key or JWT) GET /computers/list รายการ computer ที่ลงทะเบียนทั้งหมด [CODE BLOCK] GET /computers/:id ดึงรายละเอียดของ computer เครื่องเดียว [CODE BLOCK] POST /computers/install-code สร้าง install code สำหรับลงทะเบียน computer เครื่องใหม่ [CODE BLOCK] Response: POST /computers/:id/commands จัดคิวคำสั่งให้ remote agent ปฏิบัติ [CODE BLOCK] Response: GET /computers/:id/command (via query) จัดคิวคำสั่งผ่าน GET (สำหรับกรณีง่าย ๆ) [CODE BLOCK] GET /computers/:id/commands รายการคำสั่งล่าสุดของ computer [CODE BLOCK] GET /computers/:id/commands/:cid ดึงสถานะ + ผลลัพธ์ของคำสั่งเฉพาะ [CODE BLOCK] GET /computers/:id/screenshot แบบ one-shot: จัดคิวคำสั่ง screenshot และรอผลลัพธ์สูงสุด 30 วินาที [CODE BLOCK] POST /computers/:id/disable ปิดใช้งาน computer (เพิกถอน token แต่เก็บ record ไว้เพื่อ audit) [CODE BLOCK] DELETE /computers/:id ลบ computer อย่างถาวร [CODE BLOCK] Agent-Facing Endpoints (Computer Token) endpoint เหล่านี้ใช้โดย ที่รันอยู่บนเครื่องเป้าหมาย ใช้ Computer Token (ส่งกลับโดย ) ไม่ใช่ Mind Key POST /computers/register แลกรับ install code เพื่อรับ Computer Token [CODE BLOCK] Response: > [!CRITICAL] > บันทึก ไว้ — แสดงเพียงครั้งเดียวและต้องใช้สำหรับ endpoint ฝั่ง agent ทั้งหมด GET /computers/me/poll Long-poll หาคำสั่งใหม่ agent เรียกสิ่งนี้ในลูป [CODE BLOCK] ส่งกลับทันทีหากมีคำสั่งรออยู่ หรือหลังจาก วินาที หากไม่มี POST /computers/me/commands/:cid/result ส่งผลลัพธ์การปฏิบัติคำสั่ง [CODE BLOCK] ประเภทคำสั่ง | Type | Payload | คำอธิบาย | |------|---------|-------------| | | | จับภาพหน้าจอเป็น PNG (base64) | | | | คลิกที่พิกัด | | | | เลื่อนเมาส์ไปยังพิกัด | | | | พิมพ์ข้อความที่ตำแหน่งเคอร์เซอร์ | | | | กดปุ่มผสม | | | | เลื่อน scroll wheel | | | | ลากและวาง | รูปแบบทั่วไป: LLM-Driven GUI Automation [CODE BLOCK] ขั้นตอนถัดไป - Browser Proxy — service แยกต่างหากสำหรับ browser automation - Self-Hosted Agents Guide