# autocomputer ๐Ÿฆ€๐Ÿ๐ŸŒ **AI-driven desktop GUI automation โ€” Rust core + Python SDK + MCP Server + HTML5 Dashboard.** > No black box. No subscription. Your computer, your rules. [![Rust](https://img.shields.io/badge/Rust-1.97-orange.svg)](https://www.rust-lang.org/) [![Python](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Tests](https://img.shields.io/badge/Tests-61%2F61-brightgreen.svg)](#) [![Platform](https://img.shields.io/badge/Platform-Windows%2010%2F11-blueviolet.svg)](#) [![Release](https://img.shields.io/badge/Release-v0.10.0-blue.svg)](CHANGELOG.md)
--- ## Why autocomputer? Most GUI automation tools fall into two camps: **proprietary cloud services** that send your screen to remote servers, or **fragile coordinate-based scripts** that break the moment your window moves. autocomputer takes a third path: - ๐Ÿฆ€ **Rust core** for sub-10ms screenshots and reliable system calls - ๐Ÿ **Python SDK** for rapid scripting and AI integration - ๐Ÿ”Œ **MCP Server** so any MCP-capable AI agent can drive the desktop directly - ๐ŸŒ **HTML5 Dashboard** โ€” a zero-build visual console with real data, not mockups - ๐Ÿ›ก๏ธ **Built-in safety** โ€” bounds clamping, loop detection, rate limiting, hotkey blocking, SQLite audit --- ## โœจ Feature Map ### ๐Ÿฆ€ Rust Core (`crates/ac-core/`) | Module | File | What it does | |--------|------|-------------| | **capture** | `capture.rs` | Multi-monitor screenshot via xcap/DXGI, region crop, PNG encode (~8ms) | | **input** | `input.rs` | Mouse move/click/drag/scroll, keyboard type/press, Chinese via clipboard | | **window** | `window.rs` | Windows API: enumerate, focus, move, resize, launch apps | | **security** | `security.rs` | 7-layer defense + SQLite audit (bounds, loop, rate, hotkeys, per-app permissions) | | **image_proc** | `image_proc.rs` | Pixel diff, dHash, Hamming, NCC template matching, change detection | ### ๐Ÿ Python SDK (`python/autocomputer/`) | Package | Purpose | |---------|---------| | `agent/` | CoT context collection, action planning, execution, state tracking | | `perception/` | Multi-backend OCR (PaddleOCR / EasyOCR / Tesseract / LLM Vision) | | `record/` | ActionFlow v1.0 โ€” intent-based recording, smart replay, flow compression | | `llm/` | Playwright-based browser automation via CDP | | `cli/` | typer CLI + plugin registry | | `server.py` | Zero-dependency HTTP API (`/api/status`, `/capture`, `/execute`, `/flows`, `/logs`, `/security`, `/windows`, `/memory`) | ### ๐ŸŒ Dashboard (`gui/`) **Obsidian design system** โ€” near-black layers, brass `#c9a962` accent + cyan, glass cards, jelly press physics, gold particle FX. Pure CSS/JS, **zero build**. 7 pages: | Page | What it shows | |------|--------------| | ๐Ÿ“Š ไปช่กจ็›˜ | Real-time status (dynamic test counts), live screenshot preview, quick actions | | ๐Ÿ–ฅ๏ธ ๆกŒ้ขๆ“ไฝœๅฐ | Real window list, focus, coordinate click/move via `/api/execute` | | โœ๏ธ ๅฝ•ๅˆถ็ผ–่พ‘ๅ™จ | RPA-style 3-column editor: action library ยท step timeline ยท property panel with param forms + simulated-screen preview | | ๐Ÿ“‹ ๆต็จ‹็ฎก็† | Flows persisted to `%APPDATA%/autocomputer/flows.json`, replay, delete, JSON export | | ๐Ÿ‘๏ธ ๅฎžๆ—ถ็›‘ๆŽง | Real operation log from `/api/logs` | | ๐Ÿ›ก๏ธ ๅฎ‰ๅ…จๅฎก่ฎก | Real audit stats from SQLite + hotkey blocklist + CSS bar chart | | ๐Ÿง  ่ฎฐๅฟ†ๆต่งˆ | Learned actions + per-app permissions + MCP audit from `unified_state.db` | **One-click launch:** double-click `scripts/start-dashboard.cmd` โ†’ server starts + browser opens automatically. The frontend shares state with the MCP server (flows / audit / memory). ### ๐Ÿ”Œ MCP Server (`mcp-server/`) 8 tools (`see` / `find` / `act` / `verify_target` / `apps` / `audit` / `permissions` / `memory`) that any MCP-capable agent (Reasonix, Claude Code, Cursorโ€ฆ) can call directly. Pure Python + **Windows built-in OCR** (zero downloads, Chinese `zh-Hans-CN`), independent of the Rust core. See [`mcp-server/README.md`](mcp-server/README.md). --- ## ๐Ÿš€ Quick Start ### Requirements - **Rust** 1.97+ (`rustup default stable`) - **Python** 3.9+ ### One-command setup ```bash make dev # builds Rust core + installs Python package + dashboard launcher ``` ### Verify ```bash # Rust core loaded python -c "from autocomputer.core._bridge import _RUST_AVAILABLE; print('Rust core:', _RUST_AVAILABLE)" # autocomputer v0.10.0 # Rust core: โœ… loaded (5 modules) # 61 passed (29 Rust + 32 Python) ``` ### Launch the Dashboard ```bash # Option 1: double-click scripts/start-dashboard.cmd # Option 2: one command cd autocomputer && PYTHONPATH=python python -c "import threading,webbrowser; from autocomputer.server import run_server; threading.Timer(2.0, lambda: webbrowser.open('http://127.0.0.1:8765')).start(); run_server()" # ๐Ÿฆ€ autocomputer API Server v0.10.0 # ๐ŸŒ GUI: http://127.0.0.1:8765 ``` --- ## ๐Ÿ“– Usage ### Python SDK โ€” Screenshot & Click ```python from autocomputer.core import capture_screen, mouse_click result = capture_screen(0) # ~8ms screenshot mouse_click(500, 300) # click through the Rust engine (security guard enforced) ``` ### Record & Replay ```python from autocomputer.record.engine import FlowRecorder rec = FlowRecorder(name="login") rec.record_click(500, 300, description="็‚นๅ‡ป็™ปๅฝ•ๆŒ‰้’ฎ") rec.record_type("hello", description="่พ“ๅ…ฅ่ดฆๅท") rec.save("flows/login.json") ``` ### HTTP API ```bash curl http://127.0.0.1:8765/api/status # system status curl http://127.0.0.1:8765/api/capture # screenshot (base64 PNG) curl -X POST http://127.0.0.1:8765/api/execute \ -H "Content-Type: application/json" \ -d '{"action":"click","params":{"x":500,"y":300}}' ``` --- ## ๐Ÿ— Architecture ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ ๐Ÿ”Œ MCP Server (mcp-server/) โ€” 8 tools, Windows OCR โ”‚ โ”‚ see ยท find ยท act ยท verify_target ยท apps ยท audit ยท โ”‚ โ”‚ permissions ยท memory โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ ๐ŸŒ HTML5 Dashboard (gui/) โ€” 7 pages, Obsidian design โ”‚ โ”‚ zero build ยท jelly + particles ยท one-click launch โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ ๐Ÿ Python SDK (python/) โ€” agent ยท perception ยท record ยท โ”‚ โ”‚ llm ยท cli ยท server.py (zero-dep HTTP API) โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ ๐Ÿฆ€ Rust Core (crates/ac-core/) โ€” capture ยท input ยท โ”‚ โ”‚ window ยท security(7 layers) ยท image_proc โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€ Runtime data: %APPDATA%/autocomputer/ (workspace/ ยท unified_state.db ยท flows.json ยท autocomputer_audit.db) ``` --- ## ๐Ÿ›ก๏ธ Security Model | Layer | What it does | |-------|-------------| | **Fail-safe corner** | Mouse to (0,0) aborts immediately | | **Bounds clamping** | Clicks clamped to the active monitor | | **Loop detection** | Same-position clicks within 5s are blocked | | **Rate limiting** | 100ms minimum between actions | | **Hotkey blocklist** | alt+f4 / win+l / win+r / ctrl+alt+del blocked | | **Per-app permissions** | allow / deny / prompt per application | | **SQLite audit** | Every action recorded with timestamps (90-day retention) | The MCP server adds a **verify_target hard gate** before any send-class key and per-app policy from its own unified state DB. --- ## ๐Ÿงช Testing | Suite | Framework | Count | |-------|-----------|-------| | Rust unit tests | `cargo test` | 29 | | Python tests | `pytest` | 32 | | **Total** | | **61 โ€” all passing** | ```bash cargo test --workspace # 29 tests, 0 failures pytest python/tests/ -q # 32 tests, 0 failures cargo clippy --workspace # 0 warnings ``` CI (GitHub Actions) runs `cargo build / test / clippy / fmt` plus a Python pytest job on every push. --- ## ๐Ÿ“‚ Project Structure ```text autocomputer/ โ”œโ”€โ”€ crates/ac-core/ # Rust core (capture, input, window, security, image_proc) โ”œโ”€โ”€ python/ โ”‚ โ”œโ”€โ”€ autocomputer/ # Python SDK + server.py (HTTP API) โ”‚ โ””โ”€โ”€ tests/ # 32 pytest tests โ”œโ”€โ”€ gui/ โ”‚ โ”œโ”€โ”€ index.html # Dashboard shell (7 pages) โ”‚ โ”œโ”€โ”€ style.css # Obsidian design system โ”‚ โ””โ”€โ”€ app.js # rendering + API wiring + jelly/particles โ”œโ”€โ”€ mcp-server/ # MCP server (8 tools, Windows OCR) โ”œโ”€โ”€ scripts/ โ”‚ โ””โ”€โ”€ start-dashboard.cmd # one-click launcher โ”œโ”€โ”€ docs/ # design specs & plans โ”œโ”€โ”€ examples/ # security.toml template โ”œโ”€โ”€ CHANGELOG.md # release notes โ”œโ”€โ”€ Cargo.toml # Rust workspace โ”œโ”€โ”€ pyproject.toml # Python package (maturin) โ””โ”€โ”€ README.md # โ† you are here ``` --- ## โš ๏ธ Known Limitations - **Two input implementations**: the MCP server (`mcp-server/`) drives input via `pyautogui`, while the Rust core uses `enigo`. Behavior may differ slightly (speed, modifier handling); new Rust capabilities don't automatically appear in the MCP server. - **`prompt` permissions**: per-app `prompt` policy fails closed (treated as denied) โ€” interactive user confirmation is not yet implemented in the Rust core. It is reported distinctly from a hard `deny` so callers can route it later. - **`verify_target` scope**: only send-class keys (`enter` / `ctrl+enter` / `send` / `submit` / `return`) are gated before sending. Click/type rely on the seeโ†’actโ†’see audit loop + fail-safe corner instead. - **Hotkey blocklist matching**: blocked combos are normalized (sorted + joined), so order swaps are handled; loop detection only counts same-position clicks (drag+click combos are not caught). - **Windows-only**: window management uses Win32; macOS/Linux are stubs. ## ๐Ÿ“„ License MIT โ€” see [LICENSE](LICENSE).