본문으로 건너뛰기
M

dsh-agent-desktop

mjnn/dsh-agent-desktop

Wraps the separately installed agent-desktop CLI (`npm i -g agent-desktop`) as nine DSH tools (ad_status, ad_list_windows, ad_snapshot, ad_find, ad_click, ad_type, ad_press, ad_launch, ad_close_app) so an agent can list windows, read an accessibility tree, click a snapshot ref, type text, send keys, launch an app and close it gracefully. The plugin adds no automation logic of its own: it validates arguments, calls the CLI and returns the parsed JSON envelope, and asks the caller to take a fresh snapshot instead of retrying a stale ref, so a click never lands on a shifted target.

설치

dsh plugin --profile web add github:mjnn/dsh-agent-desktop

README

dsh-agent-desktop

把 agent-desktop CLI 封成 DSH 插件,让 Agent 直接调用本机 GUI 工具(不走沙盒子进程)。

插件本身不含 UI 自动化逻辑,只做:参数校验 → 调用 CLI → 解析 JSON 信封 → 返回工具结果。

前置:安装 CLI

npm i -g agent-desktop

Windows 上插件会优先调用 agent-desktop.cmd(避免命中被执行策略拦截的 .ps1)。

工具(9 个)

工具说明
ad_status平台、权限、支持的 surface、CLI 版本
ad_list_windows列出窗口(可选 app 过滤)
ad_snapshot抓无障碍树;返回 snapshotId / refCount / tree
ad_find在窗口内按 name 子串或 role 搜索元素
ad_click点击 @snapshot:eN ref
ad_type向元素输入文本
ad_press发送按键(escape、ctrl+c…)
ad_launch启动应用;activate 可等待窗口
ad_close_app优雅关闭应用

推荐循环

  1. ad_list_windows / ad_snapshot 观察
  2. 用返回的 @s…:eN 调用 ad_click / ad_type
  3. UI 变化后 重新 ad_snapshot(ref 会过期;插件不会自动重试,避免误点)

ad_snapshot 的 render 只打摘要(snapshotId、refCount、前 20 个有名字的元素);完整 tree 在结果的 data 里。

默认不加 --headed,避免抢焦点。需要物理输入时由调用方显式传 headed: true。

安装

dsh plugin add dsh-agent-desktop

本地路径 / tgz:

  1. DSH → 设置 → 插件管理 → 安装
  2. 填本仓库绝对路径,或 node tools/release.mjs 产出的 tgz
  3. 重启 DSH

配置

字段 / 环境变量说明
cliPath(插件配置)agent-desktop 可执行文件绝对路径
AGENT_DESKTOP_CLI同上,环境变量

未配置时自动探测:%APPDATA%\npm\agent-desktop.cmd、常见 Unix 路径、再查 PATH。

Windows 注意

  • 必须走 .cmd;裸 agent-desktop 可能落到 .ps1 被策略拦住
  • PowerShell 里手动测 CLI 时,ref 要加引号:agent-desktop click '@s…:e1'(@ 是 splat)
  • 不提供打开开始菜单等 shell surface 的工具(跨进程易失效)

开发

node --check lib/index.js
node test/selftest.mjs
node tools/release.mjs

版本:0.1.0 · 协议:MIT

관련 플러그인