SuperAPI AI 工具集

tauri-agent-control

智能体与模型

查看项目

更新于 10-15 19:58

技能介绍

用途:通过 HTTP 观察并控制正在运行的 Tauri 2.0 桌面应用,用 curl 即可完成界面交互、截图、点击、填表与元素检查,无需 Playwright 或 Puppeteer。

安装:在 Cargo.toml 添加依赖 tauri-plugin-agent-control = "0.1";在 src-tauri/src/lib.rs 中注册 .plugin(tauri_plugin_agent_control::init());在 src-tauri/capabilities/default.json 加入权限 { "permissions": ["agent-control:default"] }。

主要能力:snapshot 获取界面快照(推荐 format=compact,并支持 scope/depth 限定);click、fill、press、type 交互;find 按 text/label/role/testid 语义定位;get/title、get/url、get/text、get/value 读取信息;is/visible、is/enabled、is/checked 检查状态;wait 等待 selector、text、url 或 fn;screenshot 截图返回路径;eval 在 webview 执行 JS。

使用方式:核心流程为 snapshot → interact → re-snapshot。先 curl -s 'http://localhost:9876/snapshot?format=compact' 获取形如 @e1 的引用,再 curl -s -X POST http://localhost:9876/click -d '{"ref":"@e1"}' 操作。ref 每次新快照都会失效,点击链接、提交表单或触发动态内容后必须重新快照。可用 curl -s http://localhost:9876/health 确认桥接运行。

限制:截图使用 macOS screencapture,应用须显示在屏幕且非最小化,仅限 macOS;网络拦截对 Tauri IPC 调用不生效且需提前调用;eval 中的 void 表达式返回 null,超时需先检查 /health;虚拟化列表仅渲染可见项;快照 ref 会随 DOM 变化重置。文档另提供命令参考、快照与 ref、网络、存储状态、进阶说明及表单自动化、应用测试、网络模拟等模板。