VACT: Vector Agent Context Transport Banner

# VACT: Vector Agent Context Transport ### Native Direct3D 11 GPU Screen Perception & Binary Delta Scene Graph Protocol (`VACT/2.0`) for Windows Desktop Agents **Created by [fy2ne](https://fy2ne.me)** • **Site: [vact.fy2ne.me](https://vact.fy2ne.me)** • **Article: [fy2ne.me/articles/vact-protocol](https://fy2ne.me/articles/vact-protocol)** [![License: Apache-2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Rust 2021](https://img.shields.io/badge/Rust-1.80+-orange.svg?logo=rust)](https://www.rust-lang.org) [![Direct3D 11 CS 5.0](https://img.shields.io/badge/Direct3D-11_CS_5.0_/_DXGI-0078D7?logo=windows)](https://learn.microsoft.com/en-us/windows/win32/direct3d11/direct3d-11-graphics) [![Protocol VACT/2.0](https://img.shields.io/badge/Protocol-VACT%2F2.0-111111)](#protocol-vact20)
Why VACT • Pipeline • VACT/2.0 • Benchmarks • Workspace • Quick Start
--- ## Why VACT Desktop automation today forces a bad tradeoff: - **Screenshot + VLM loops** encode full 1080p/4K bitmaps, upload megabytes per turn, burn ~2,000 vision tokens per step, and guess pixel coordinates at 0.3–1 FPS. - **OS Accessibility APIs** (UIAutomation, MSAA, DOM) break on custom-drawn surfaces: WebGL, Electron canvases, Flutter, games, 3D engines, video players, and remote desktops. **VACT reads the composited display surface directly on the GPU** using native Direct3D 11 Compute Shaders (CS 5.0) on the same `ID3D11Device` that owns DXGI Output Duplication. It extracts bounding geometry, visual states (focus rings, hover, motion, blinking carets, perceptual hashes), and hardware WinRT OCR text into a differential Scene Graph DAG streamed over local IPC. --- ## Pipeline Architecture ``` Windows DWM Compositor │ IDXGIOutputDuplication (ID3D11Device) ▼ vactd (Native Rust Daemon) ├─ Pass 0 (pass0_prep.hlsl) 2x downscale, luma/chroma, temporal delta, Reinhard HDR tone-map ├─ Pass 1 (pass1_edges.hlsl) 16x16 LDS Sobel + Lab color-aware gradient + motion + sat-halo ├─ Pass 2 (pass2_ccl.hlsl) Tile-local CCL → global union-find → slot reduction → 64B GpuBoxDesc ├─ vact-core O(N log N) sweep-line hierarchy, CaretTracker, visual state inference ├─ WinRT OCR Single-pass full-frame OCR (skipped when geometry signature is unchanged) ├─ vact-protocol (VACT/2.0) Generational IDs, multi-cue diffing, binary wire codec (b"VACT" v2) ├─ Local IPC TCP 127.0.0.1:4242 + Win32 Named Pipe (\\.\pipe\VACT) └─ I/O Bus + Safety Direct SendInput / Ghost PostMessageW + global F12 kill-switch ``` All shaders target **Shader Model 5.0 (`cs_5_0`)** compiled via `D3DCompile`, so VACT runs on DX11-class hardware (including older Intel HD 4400 iGPUs) without requiring Vulkan or DX12. --- ## Protocol (`VACT/2.0`) Defined in [`crates/vact-protocol`](crates/vact-protocol): - **Binary Wire Format (`wire.rs`)**: Magic header `b"VACT"`, version `2`, interned string pool, flat node table, `i16` velocity vectors, trit-packed optional booleans, and dirty-masked `NodePatch` updates. - **Generational Node IDs**: Slot `0` is reserved for the virtual root; active nodes carry generation counters (`1..=255`) plus a tombstone cache so stale clicks fail safely instead of hitting recycled IDs. - **Mutations**: `Insert`, `Remove`, `Update` (dirty-masked), `Reparent`, `MoveBatch`, and `Heartbeat` on unchanged frames. - **Visual State Flags (`vact-core`)**: Extracts `focused`, `hovered`, `pressed`, `animating`, `disabled`, blinking caret oscillation (`CaretTracker`), motion energy, dominant color, and 64-bit box-averaged `dHash`. --- ## Benchmarks Full methodology and hardware details live in [`docs/BENCHMARKS.md`](docs/BENCHMARKS.md). Summary measured on **Intel(R) HD Graphics 4400** (1920×1080, release builds): | Benchmark | Command | Result | |---|---|---| | D3D11 3-pass GPU pipeline (1080p, 470 boxes) | `cargo run --release -p vactd -- bench` | **7.82 ms p50** cpu-upload / **25.6 ms** avg GPU (`pass0` 3.8ms · `pass1` 2.6ms · `pass2` 19.2ms) | | Sweep-line hierarchy (500 boxes) | `cargo run --release -p vact-protocol --example bench_protocol` | **283.2 µs p50** (304.0 µs mean) | | `StateTracker` diff (300 nodes, 10 changed) | `bench_protocol` | **1.63 ms p50** (2.32 ms mean) | | VACT/2.0 Binary Snapshot (300 nodes) | `bench_protocol` | **22.5 KB** (45% smaller than JSON), **74.1 µs** encode | | VACT/2.0 Binary Diff (10 mutations) | `bench_protocol` | **288 B** (72.3% smaller than JSON), **0.5 µs** encode | > **Status note:** `pass0 + pass1` run in 6.37 ms and 300-node diffing runs in 1.63 ms on HD 4400; `pass2` (19.2 ms) is the remaining target to lock sustained 60 FPS on decade-old iGPUs. --- ## Workspace - **[`crates/vact-core`](crates/vact-core)**: `GpuBoxDesc` (64-byte aligned), `VisualFlags`, `CaretTracker`, `infer_visual_states`, O(N log N) `build_hierarchy`, box-averaged `dHash`, and color classification. - **[`crates/vact-protocol`](crates/vact-protocol)**: `VACT/2.0` scene graph, generational `StateTracker`, binary wire codec (`wire.rs`), and IPC message types. - **[`crates/vactd`](crates/vactd)**: Windows daemon — DXGI capture (with GDI fallback), native D3D11 CS 5.0 pipeline, WinRT OCR, taskbar & OS metadata enrichment, SQLite spatial memory, transparent debug overlay (`WDA_EXCLUDEFROMCAPTURE`), I/O bus, and F12 kill-switch. - **[`sdks/typescript`](sdks/typescript)** & **[`sdks/python`](sdks/python)**: Client SDKs (VACT/2.0 binary decoder migration in progress). - **[`apps/agent-runner`](apps/agent-runner)**: Autonomous CLI runner with offline local Needle backend. - **[`website`](website)**: Static landing page and machine-readable specs (`llms.txt`, `vact-spec.json`). --- ## Quick Start Requires Rust 1.80+ and the MSVC C++ toolchain on Windows 10/11: ```powershell # Run workspace tests cargo test --workspace # Build release daemon cargo build --release -p vactd # Run GPU perception benchmark (1920x1080 x100) cargo run --release -p vactd -- bench # Run protocol & binary wire benchmark cargo run --release -p vact-protocol --example bench_protocol # Start daemon (optional --overlay for live HUD) cargo run --release -p vactd -- start --overlay # Single-frame capture and JSON dump cargo run --release -p vactd -- once ``` Debug PNG frame dumps are gated behind `--features debug-dump` so production runs never touch disk. --- ## Safety Controls - **Emergency Kill-Switch:** Press F12 anytime to freeze synthetic mouse/keyboard dispatch and release held modifiers. - **Re-Arm:** Press Ctrl + F12. - **Capture Exclusion:** The debug overlay sets `SetWindowDisplayAffinity(WDA_EXCLUDEFROMCAPTURE)` so it never feeds back into DXGI detection. --- ## License Apache License 2.0 — see [`LICENSE`](LICENSE). ---
VACT Logo

VACT: Vector Agent Context Transport
Created by fy2ne • Protocol VACT/2.0 • Apache-2.0