DSH HUB
HomePlugin StorePlugin PacksCommunityRankingsResourcesPublish Guide
Plugin source
Back to catalog

wodaimnd /

wodaimnd/winpilot

Verified

微信小程序控制台:把 winpilot CLI 暴露成模型工具,并提供连接、项目、截图与诊断的配置面板。

★ 0 Stars0 Forks0 IssuesN/A Community rating0 Confirmed installs
View on GitHub
READMESource: main@ca384236

@local/winpilot — DSH 插件

把 winpilot CLI 注册成一个模型工具 winpilot,用于在 Windows 上驱动微信开发者工具; 同时提供一块微信小程序控制台面板(侧栏入口「小程序」),用于配置、看状态、按需截一张图。

安装

dsh plugin --profile web add G:\AI PGRM\DSH\winpilot\dsh-plugin

或把本目录链接到 DSH 的本地插件目录(本工作区是 G:\AI PGRM\DSH\plugins\)。

工具形态

{
  "operation": "tap",              // 必填,见下
  "params": { "reference": "%2" }  // 操作参数
}

返回固定形状(DSH 会按 output.schema 校验):

{ "ok": true, "exitCode": 0, "data": { ... }, "text": "已点击 %2 <button.submit> \"提交订单\"" }

render() 只把 text 交给模型,data 留给程序消费。

操作与参数

operation params
start projectPath?, cliPath?, appid?, autoPort?, timeoutMs?
connect ws?
disconnect / status / doctor / back / reload —
view full?, depth?, limit?
find query(必填), all?, limit?
wait reference(必填), timeoutMs?
tap / read reference(必填)
type reference, text
scroll reference, direction(up/down)
assert reference, expected, contains?
state path?, full?
shot path?, base64?
peek noShot?, noData?, path?, base64? —— 一次连接取「端点 + 当前页 + 页面数据 + 一张图」,只读:不分配 %N、不写 session.json
goto route(必填)
run / wx js / method + args?(需要 enableJsEval: true)

reference 接受 %3、3、"3" 三种写法。

控制台面板

侧栏入口「小程序」(sidebar.panellist order 32),主区 key: 'winpilot'。正面只留三块:

区块 内容
① 开发者工具 连接状态 + 启动 / 重连 / 断开 +「端口没开」的分步指引
② 项目 项目目录(可浏览 / 最近使用)、AppID 只读回显、%N 新鲜度
③ 截图 按需截一张(不自动刷新),显示宽高与页面路径
④ 高级(默认折叠) 截图/状态目录、run/wx 开关状态、诊断与复制
⑤ 数据说明 存了什么、存在哪、一键清除界面偏好

面板是配置台,不是操作台:tap/type/scroll/assert/goto 等页面操作不在面板白名单里, 全部交给 AI 用工具执行。面板与工具共用同一个串行队列,面板刷新不会打乱模型手里的 %N。

Host 半的路由是 /api/winpilot(loopback-only、POST-only、body ≤ 256 KB、白名单);

配置

- insert:
    - id: winpilot
      name: '@local/winpilot'
      config:
        cliPath: ''        # 默认自动定位 ../bin/winpilot.js
        stateDir: ''       # 空 = 用 CLI 自己的目录(%LOCALAPPDATA%\winpilot)
        shotsDir: ''       # 空 = <状态目录>\shots
        timeoutMs: 120000
        autoPort: 9420
        enableJsEval: false  # run / wx 的总开关,默认关

cordis.patch.yml 里的 config 与 index.js 的 DEFAULTS 必须逐字一致。 不用 !!js 条件修饰开关行 —— 插件管理器启停会把行改写成 disabled: false,覆盖条件并导致安装回滚。

卸载

# 1. 从 profile 清单里去掉依赖与 bundles 条目
#    C:\Users\<你>\.dsh\profiles\desktop\package.json
#    - dependencies["@local/winpilot"]
#    - dsh.profile.bundles 里的 "@local/winpilot"
# 2. 删掉 node_modules 下的链接:
Remove-Item "C:\Users\<你>\.dsh\profiles\desktop\node_modules\@local\winpilot" -Force
# 3. 重启 DSH 后工具与面板消失(侧栏条目、主区、路由、样式全部经 ctx.effect 回收)

插件只是把 CLI 注册成工具 + 挂一块面板,卸载不会删除 G:\AI PGRM\DSH\winpilot 本身,也不会动开发者工具。

设计要点

  • 按功能块各自 inject:工具块 ctx.inject(['tools']),面板块 ctx.inject(['webServer'])。 不写模块级全有列表 —— 那是「缺一个服务,整块一起消失」的闸门。
  • 不 import @deepseek-ai/*:手写 raw JSON Schema 注册工具,link: 方式加载也不会解析失败。
  • 子进程 stdio 指向文件:受限沙箱里管道会 EPERM,文件句柄到处都能用。
  • 所有操作串行:view 分配的 %N 是后续操作的输入,并发会互相踩踏。
  • 重新 apply 先释放旧注册:DSH 配置变更会重新调用 apply,不释放就会 tool already registered。
  • 颜色只用实测存在的 14 个主题 token,缺的角色用 color-mix 派生,零硬编码色值(契约测试把关)。
  • 只做中文:不创建 en.json,不做双语字典。
—/ 5

No ratings yet

Verified DSH bundle

Commit ca3842369cfd

Community comments

No comments yet. Be the first to write one.

DSH HUB

A community index for DSH plugins. Not an official GitHub or DeepSeek AI product.

CommunityResourcesAPIAbout