高性能
C++ 核心引擎,Lua/Python 脚本执行,毫秒级响应
Wingman 是一个跨平台的游戏自动化工具。
local wingman = require("wingman")
-- hello.lua
-- 截图(capture 返回布尔:是否成功)
local ok = wingman.screen.capture()
-- 查找颜色(返回 {point, found} 两元组;区域用表:{x=, y=, width=, height=})
local pt, found = wingman.screen.findColor(0xFF0000, {x = 0, y = 0, width = 1920, height = 1080}, 10)
if found then
wingman.input.click(pt.x, pt.y)
end
-- 多点查找用 findColors(返回点数组):wingman.screen.findColors(0xFF0000, region, 10, 0)# hello.py
from wingman import screen, input
# 截图(capture 返回布尔:是否成功)
ok = screen.capture()
# 查找颜色(返回 [point, found] 两元组;区域用字典)
pt, found = screen.findColor(0xFF0000, {"x": 0, "y": 0, "width": 1920, "height": 1080}, 10)
if found:
input.click(pt["x"], pt["y"])
# 多点查找用 find_colors(返回点数组):screen.find_colors(0xFF0000, region, 10, 0)Android 端侧 Agent(实验性,arm64 / Android 9.0+):出站 TCP 连 Go 中控, 脚本 API 与桌面 runtime 同名同形(wingman.input / wingman.screen / wingman.vision),Dashboard 统一下发与查看。
能力清单
| 能力 | 说明 |
|---|---|
| 手势注入 | 无障碍服务注入点击/滑动(wingman.input.tap / swipe / delay) |
| 屏幕采集 | MediaProjection 实时投屏采集(亮屏时出帧) |
| 找色找图 | wingman.vision.findColor / findImage(端侧走纯 C++ PatternMatcher;桌面同名 API 走 OpenCV,两条路径分数口径不同) |
| 远程截图 | Dashboard workflow 的 screenshot 步骤直接上屏 |
| token 认证 | server 端 WINGMAN_AGENT_TOKENS 注册 token 白名单(默认关闭可留空) |
| 保活 | 开机自启、崩溃自重启(指数退避)、30s 核心看门狗、机型保活与受限设置引导 |
获取 APK
nightly Release 的 wingman-*-android-arm64.apk(debug 签名): releases/tag/nightly 页 Assets 取最新一组的 wingman-<date>-nightly-<sha>-android-arm64.apk (每日构建仅保留当日最新;直链匿名下载,无需登录 GitHub)。
快速上手
启动 Go server(orchestrator/server,Dashboard 端口 9527、agent 端口 8888)。
手机安装 APK(与 server 同网段)→ 打开 App → 填服务器 IP / 端口 / 设备 ID → 「启动 Agent」。首次启动创建常驻通知(前台服务要求);server 若配置了 WINGMAN_AGENT_TOKENS,需同时填入注册 Token。
Dashboard 的 Agent 列表出现该设备(platform=android),新建脚本 print('hello android') 运行到该设备,实时日志回传。
启用 A2 能力:App 内「无障碍设置」打开注入服务 +「开启投屏」授权 (Android 14+ 每次重开投屏都会再弹授权,系统约束),随后下发找色/手势脚本:
local pt = wingman.vision.findColor(0xE23B3B, 10)
if pt then wingman.input.tap(pt.x, pt.y) end
wingman.input.swipe(540, 1800, 540, 600, 400)远程截图:Dashboard workflow 加 screenshot 步骤选该设备 → 截图上屏。
Android 13+ 侧载无障碍被「受限设置」默认屏蔽:系统设置 → 应用 → Wingman Agent → ⋮ → 允许受限制的设置,或 scripts/android-restricted-settings.sh allow 预授权(App 内也有引导)。
详细验收步骤与已知边界见 apps/android/README.md, 设计与协议见 Android Agent 设计, 机型保活见 Android Agent 保活, 受限设置见 Android Agent 受限设置。
# 克隆仓库
git clone https://github.com/cuihairu/wingman.git
cd wingman
# Windows (MSVC + Ninja + vcpkg)
build-scripts\build-runtime-msvc-ninja.bat
# Linux (GCC/Clang)
cmake -B build -S . -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-linux
# macOS (Intel 用 x64-osx,Apple Silicon 用 arm64-osx)
cmake -B build -S . -G Ninja \
-DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake \
-DVCPKG_TARGET_TRIPLET=x64-osx# CLI 运行时(Python 脚本同理,需启用 WINGMAN_ENABLE_PYTHON)
./build/apps/agent/wingman-agent script examples/lua_scripts/hello.lua