Winseat
by PsyMoss
README.md
# Winseat
[](#)
[](#linux)
[](#macos)
[](https://github.com/PsyMoss/winseat/actions/workflows/ci.yml)
[](LICENSING.md)

How it works, in one page: [docs/index.html](docs/index.html).
**Give one application its own mouse, keyboard and focus — so an AI agent can work in it
while a person keeps using the same computer.**
Windows has one cursor, one foreground window and one input queue per session. Winseat puts a
small layer inside a chosen process: the app sees a virtual cursor, virtual keys and "always
focused", driven by an agent over a pipe. The person's real mouse and keyboard stay theirs.
Click into the app yourself and it is yours; leave it and the agent takes over again.
Built and maintained together with AI agents. (Formerly VInput: the hook still answers the old
pipe name `\\.\pipe\vinput-<pid>` and the Python client keeps `VInput` as an alias.)
## Install
Winseat is a tool for developers and enthusiasts. Two ways:
**1. From source (recommended).** Needs [Rust](https://rustup.rs). Nothing you build yourself
triggers SmartScreen or Gatekeeper warnings.
```
git clone https://github.com/PsyMoss/winseat && cd winseat
cargo build --release # Windows 64-bit; for 32-bit apps also:
cargo build --release --target i686-pc-windows-msvc
cargo build --release -p winseatd # Linux / macOS
packaging/macos/build.sh # macOS: builds Winseat.app (holds the permissions)
```
Details per OS: [BUILDING.md](BUILDING.md).
**2. Ready-made builds.** Download the zip / tarball for your OS from
[Releases](https://github.com/PsyMoss/winseat/releases) and follow
[QUICKSTART.md](packaging/QUICKSTART.md). These builds are **not code-signed**: Windows may show
SmartScreen ("More info → Run anyway") and macOS Gatekeeper (`xattr -dr com.apple.quarantine
Winseat.app`). Signed builds will be added if enough users want them.
## How it works
```mermaid
flowchart LR
subgraph You["You"]
RM["real mouse + keyboard"]
end
subgraph Agent["AI agent / bot"]
A["decides what to do"]
end
subgraph Win["Windows"]
D["your desktop, your windows"]
end
subgraph App["the app (e.g. a game)"]
H["winseat_hook.dll<br/>virtual cursor · virtual keys · 'always focused'"]
G["app code reads input<br/>(cursor, keys, DirectInput, Raw Input, focus)"]
end
RM --> D
RM -. "you click into the app:<br/>it is yours" .-> H
A -- "move / click / key<br/>(pipe or API)" --> H
H -- "answers every input question<br/>with the virtual state" --> G
App -- "window picture,<br/>taken without focus" --> A
```
* `winseat.exe` puts `winseat_hook.dll` into the chosen app.
* Inside the app the DLL answers every "where is the mouse / is this key down / am I focused?"
question with the agent's virtual state, so the app works in the background and never touches
your real cursor.
* The agent sends simple text commands (`move 320 200`, `click left`, `tap i`) and reads the
window picture back.
## Languages
Winseat types characters, not key codes. Each character reaches the app as itself, in the order
it was written, so the keyboard layout and the language do not matter. Winseat never reverses,
reorders or reshapes text: the app lays it out exactly as it would for a person typing.
| Writing system | Direction | Tested with |
|---|---|---|
| Latin | left to right | English; accents and combining marks (é, ñ) |
| Cyrillic | left to right | Russian |
| Hebrew | right to left | Hebrew, also mixed with English and numbers |
| Arabic | right to left | Arabic with vowel marks, Arabic-Indic digits, Persian with zero-width non-joiner |
| Chinese, Japanese, Korean | left to right | Hanzi, hiragana and katakana, Hangul |
| Thai, Devanagari | left to right | Thai, Hindi |
| Emoji | — | skin tones and joined sequences (👩💻) |
A mixed line such as `abc عربي 123 שלום` arrives in its logical order and the app's own bidi
rendering places each run. On Windows every row above is part of the end-to-end test (32- and
64-bit); Linux (`wtype`) and macOS (Unicode key events) use the same character-based path.
Two limits: a game that reads raw key presses instead of characters only sees what a US keyboard
can type (a hardware keyboard path is planned, see [Open and detectable](#open-and-detectable)), and Chinese, Japanese and Korean text arrives as finished characters, without an input
method (IME) window.
## winseatd — agent API (HTTP + MCP)
`winseatd.exe` attaches to apps (injecting the hook if needed), takes screenshots **without
focusing** the window and sends input. Full tool list and status: [API.md](API.md).
One winseatd serves 32-bit and 64-bit apps: for an app of the other bitness it runs the other
build's `winseat.exe inject` (looked up in `x86\` or `x64\` next to winseatd.exe, the sibling
cargo `target\<triple>\release`, or `--helper <path>`). Put `winseat_hook.dll` next to each exe:
```
cargo build --release --target i686-pc-windows-msvc # 32-bit apps
```
**HTTP/JSON** (binds to 127.0.0.1 only, exclusively — a busy port is an error, exit code 1):
```
winseatd --port 0
winseatd ready http://127.0.0.1:51234 pid=4242 bits=32 token_file=C:\Users\me\AppData\Local\Winseat\token-51234.txt
```
The one stdout line says where it listens; logs go to stderr. A token is **required by
default**: without `--token T` / `--token-file PATH`, winseatd generates one and writes it to
`%LOCALAPPDATA%\Winseat\token-<port>.txt` (named in the ready line; `token_file=` is the last
field and may contain spaces). `--no-token` restores the old open behaviour (with a warning).
`--ready-file PATH` also writes `{"port","pid","bits","token_file"}` as JSON. With a fixed port
and token:
```
winseatd --port 47800 --token s3cret
curl -s -X POST http://127.0.0.1:47800/v1/attach -H "X-Winseat-Token: s3cret" -H "Content-Type: application/json" -d "{\"exe\":\"notepad.exe\"}"
curl -s -X POST http://127.0.0.1:47800/v1/attach -H "X-Winseat-Token: s3cret" -H "Content-Type: application/json" -d "{\"title\":\"Notepad\"}"
curl -s -X POST http://127.0.0.1:47800/v1/click -H "X-Winseat-Token: s3cret" -H "Content-Type: application/json" -d "{\"app_id\":\"app-1234\",\"x\":500,\"y\":500,\"space\":\"grid\"}"
curl -s -X POST http://127.0.0.1:47800/v1/screenshot -H "X-Winseat-Token: s3cret" -H "Content-Type: application/json" -d "{\"app_id\":\"app-1234\",\"max_side\":1024}"
curl -s http://127.0.0.1:47800/v1/tools -H "X-Winseat-Token: s3cret"
```
Every reply is `{"ok":true,...}` or `{"ok":false,"code":"...","error":"..."}` with a stable
`code` (`not_found`, `refused`, `denied`, `timeout`, … — table in [API.md](API.md#error-codes)).
Requests from web pages are refused (any `Origin` header, a `Host` other than
`127.0.0.1`/`localhost` on the port, a POST without `Content-Type: application/json`), so a site
open in your browser cannot drive your apps.
Agents never fight the person: while the human owns an app (owner `auto` and they clicked into
it, or `set_owner human`), input calls fail with `refused` unless they pass `"force": true`;
`wait_idle` waits until the window stops changing and the agent owns it again. `attach` never
touches anti-cheat protected games (EAC, BattlEye, Vanguard, ACE, …), World of Warcraft, UAC and
credential prompts, elevated processes, or anything listed in `%LOCALAPPDATA%\Winseat\deny.txt`
(code `denied`; the list cannot be turned off).
**MCP** (stdio, JSON-RPC 2.0, one message per line): `winseatd mcp`.
### Use it from Claude Code
This repo ships a `.mcp.json`, so Claude Code opened in the repo offers the `winseat` tools after
you approve the server once (run `claude` here and accept it). To have them in every project:
```
claude mcp add --scope user winseat -- C:\path\to\winseatd.exe mcp
```
Then just ask, for example: *"Open Edge with a fresh profile, search YouTube for lofi and tell me
the first title"* — Claude calls `list_windows`, `attach`, `click`, `type_text`, `screenshot` itself.
Use the 64-bit `winseatd.exe`; it serves 32-bit apps too. Your own mouse, keyboard and focus are
never used.
Window titles are passed through as Unicode exactly as Windows reports them (Hebrew and other
RTL titles keep their logical order; nothing is reversed). `type_text` takes any Unicode text
(Hebrew, Russian, emoji, mixed with English and digits) and sends it in logical order: ASCII as
key presses, everything else as `WM_CHAR`. `scroll` drives the mouse wheel.
## Linux
The same winseatd, HTTP/MCP API, error codes and Python package run on Linux (Wayland), so an
agent does not care which OS it drives. Instead of a hook inside the process, every app gets its
**own seat**: winseatd starts a private, invisible sway (headless backend, no screen, no real
input devices) and runs the app fullscreen on it. That sway has its own cursor, keyboard and
focus; the owner's desktop (GNOME, KDE, COSMIC, …) is never touched.
```
winseatd --port 0 # same ready line, token in ~/.local/state/winseat/
curl -s -X POST http://127.0.0.1:<port>/v1/launch -H "X-Winseat-Token: $T" -H "Content-Type: application/json" \
-d '{"command":["foot"],"width":1024,"height":700}'
# → {"ok":true,"app_id":"app-4242","backend":"seat","wayland_display":"wayland-3","size":{...},"window":{...}}
```
Then `screenshot`, `click`, `type_text` (Hebrew/Russian/emoji too), `key`, `scroll`, `drag`,
`wait_idle`, `state`, `detach` work exactly as on Windows. Differences: `attach` →
`unsupported` (use `launch {command: [argv…]}`; no shell is involved); the owner is always the
agent (nobody can reach an invisible seat); `list_windows` lists the seats' windows only; `view`
starts a view-only VNC server on 127.0.0.1 so you can watch a seat. Needs
`sudo apt install sway grim wtype xwayland` (optional `wayvnc` for `view`, `dbus` for a
private D-Bus session per app).
Build: [BUILDING.md](BUILDING.md#linux).
## macOS
The same winseatd, HTTP/MCP API, error codes and Python package run on macOS (Apple silicon and
Intel). Nothing is injected: winseatd posts keyboard and mouse events to the app's process only
(`CGEventPostToPid`), so the real cursor never moves and the frontmost app stays yours. Mouse
events carry the window's own position, so a click lands in the app even while it is in the
background. Screenshots are taken with ScreenCaptureKit (macOS 14+; background windows too, no
focus, no cursor, no shadow) and scaled to points, so screenshot pixels and input coordinates
match on Retina screens.
```
cargo build --release -p winseatd
packaging/macos/build.sh # Winseat.app (with winseatd inside) → ~/Applications
open -a Winseat # once: grant Accessibility + Screen Recording
open -a Winseat --args serve --port 0 --ready-file /tmp/winseatd.json
curl -s -X POST http://127.0.0.1:<port>/v1/launch -H "X-Winseat-Token: $T" -H "Content-Type: application/json" \
-d '{"command":["TextEdit"]}'
# → {"ok":true,"app_id":"app-4242","backend":"cgevent","window_id":812,"size":{...},"launched_pid":4242,...}
```
macOS grants Accessibility (input) and Screen Recording (screenshots, window titles) to an app,
and a program the app starts is covered too — hence the tiny `Winseat.app` that asks for both and
runs winseatd as its child (state in `~/.winseat-status`). Winseat runs nothing else: only the
winseatd sealed inside its own signed bundle (hardened runtime), so swapping it breaks the
signature and macOS withholds the grants; it refuses to start with `DYLD_*`/`LD_*` set. Until
the app is signed with a Developer ID, every new build is a new ad-hoc signature: open Winseat
once after installing it and grant both permissions again.
Without a permission the tools that need it fail with code `permission` (HTTP 403) and a message
saying what to do. An attached app is remembered by pid plus process start time and executable:
if the app exits (even if its pid is reused), its tools answer `not_found`. Differences from
Windows: `attach` takes `pid`, `title` or `exe` (app name such as `TextEdit`, bundle, executable
or path); `launch {command: [app, args…], env?}` opens the app in the background as a new
instance; the owner is always the agent (winseatd cannot see your own clicks in the app);
`focus_faked` is false; use `key "cmd+s"` (`cmd`/`command` = the Command key, `option` = alt).
Build: [BUILDING.md](BUILDING.md#macos).
## Why
* Several agents / developments on one PC, each in its own window, without fighting over the cursor.
* Game and app bots that run in the background.
* Accessibility and testing tools that should not steal the user's input.
## Roadmap
| step | what | status |
|---|---|---|
| M1 | Windows hook: DirectInput, Raw Input, cursor, fake focus; one app driven while the owner works | **done** — verified with a 32-bit DirectInput game and the end-to-end test (1030/1030) |
| M2 | browsers and more apps (Edge/Chromium first) | started — Edge + YouTube in 4 windows at once, no focus stealing |
| M3 | ordinary desktop apps (Win32 messages, UI Automation where possible), per-app profiles | planned |
| M4 | agent API (MCP + HTTP): frames out without focus, input in — see API.md | done for Windows and Linux; macOS in testing |
| M5 | packaging: one exe, tray switch human ↔ agent, signed builds | planned |
Fallbacks when injection is not possible: a Windows Sandbox (`.wsb`) box with its own input
(tested: works, the host cursor is untouched), and a hardware Bluetooth HID device.
Not for games with anti-cheat (injection is forbidden there).
## Open and detectable
Winseat does not hide. It is open source, and every app it drives carries clear marks: the
module `winseat_hook.dll`, the named pipe `\\.\pipe\winseat-<pid>`, and on macOS the app
`dev.winseat.Winseat`. A developer who does not want automated input in their game or app can
detect these and refuse it; one who wants agents and tests to work can support it on purpose.
Winseat itself refuses anti-cheat processes, elevated apps and password or UAC prompts.
For games that read raw key presses, a hardware path is planned: a small USB or Bluetooth device
that the PC sees as a real keyboard, named as a Winseat device, so it is just as easy to recognise.
Use it, build on it, or block it.
See [SPEC.md](SPEC.md) for the M1 design.
## Building
See [BUILDING.md](BUILDING.md). Short version: Rust (stable) + MSVC build tools, then
`cargo build --release --target i686-pc-windows-msvc` for 32-bit apps and
`cargo build --release --target x86_64-pc-windows-msvc` for 64-bit apps. Linux and macOS:
`cargo build --release -p winseatd -p winseat-proto` (macOS also `packaging/macos/build.sh`).
## License
Free for developers and enthusiasts; companies that ship it in a closed product buy a license.
- **Core** (the hook, `winseat`, `winseatd`, the macOS launcher): [AGPL-3.0](LICENSE-AGPL).
- **Everything that talks to it** (protocol, Python client, Claude Code plugin, docs, tests):
[MIT](LICENSE-MIT), so you can embed a Winseat client in any program.
- **Commercial license** for using the core in a closed product without the AGPL terms:
see [COMMERCIAL.md](COMMERCIAL.md).
Details: [LICENSING.md](LICENSING.md). Contributions need a one-time CLA ([CLA.md](CLA.md)).
This server cannot be deployed
Maintenance
ActivityNo data
ResponsivenessOutdated data