DeepSeek Harness plugin

dsh-wechat

Bridge WeChat (iLink bot) to DeepSeek Harness (DSH)

Jump to install

Source facts

Repository
pan17/dsh-wechat
Latest update
Aug 22, 2026
Category
Remote & Mobile
GitHub stars
4
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/pan17/dsh-wechat
Plugin: dsh-wechat
Author: pan17

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-wechat

![npm](https://www.npmjs.com/package/dsh-wechat) ![npm downloads](https://www.npmjs.com/package/dsh-wechat) ![License](https://github.com/pan17/dsh-wechat)

让微信成为 DeepSeek Harness (DSH) 的第二客户端:通过腾讯 iLink bot 协议把 微信私聊桥接到 DSH agent——文本/图片/文件/语音消息双向收发、微信内 slash 命令管理会话/工作区/Preset/模型/权限、审批与提问卡与 GUI 双端同卡同决策、 DSH 设置页内扫码登录与连接配置。以静态 Cordis 插件交付,零运行时 @deepseek-ai 依赖,直接调用 DSH 进程内服务。

<img src="./resources/send.jpg" alt="发送" width="32%" /> <img src="./resources/receive.jpg" alt="接收" width="32%" /> <img src="./resources/settings.png" alt="设置页" width="32%" />

功能

  • 发送 — 微信文本/图片/文件/语音消息 → DSH agent(媒体自动下载解密到

~/.dsh-wechat/tempfile/,本地路径作为附件注入)

  • 接收 — agent 回复文本回微信;send_wechat 工具可主动推送文本/文件到微信
  • 微信 slash 命令/workspace/session/preset/model

/perm/silent/notify/next/status/stop/rp/rq 等 由 bridge 直接处理(见下方命令表)

  • 审批/提问卡(双端同卡) — 微信与 GUI 弹一致的原生审批/提问卡,

谁先回复谁生效(原生防双决)

  • 微信渠道提示词(动态注入) — 微信消息进入会话时,agent 的系统提示

自动注入"你正在通过微信(WeChat)与用户聊天"(runtime context,微信会话 才知道要调整回复格式);从 GUI 发消息时该提示词自动消失——按消息来源 动态切换,新旧会话(GUI/微信创建)一视同仁

  • 静默模式/silent on 后每轮只发送最终回复,设置页可切换
  • 繁忙时投递(与 DSH 同源) — agent 运行中收到微信消息时,按 DSH 设置

ui-conversation.busyEnter(GUI 通用设置的「繁忙时 Enter 键行为」)决定 排队(queue,默认)还是插话(steer,立即插入当前轮次);微信

/enter queue|steer 直接读写同一份设置文档,双端实时同步

  • 跨会话通知 — 后台会话的已完成/报错/卡片通过微信提醒,/notify on|off|status 切换,默认关闭(单用户单闸)
  • 二维码登录http://127.0.0.1:3080/wechat/qr 扫码登录,设置页内嵌
  • 设置页 UI — DSH 设置 → WeChat:单卡展示状态、扫码、重连、退出登录、连接配置与通知/静默开关(保存即生效,存储于 ~/.dsh-wechat/config.jsonstate.json
  • 断点续传sync-buf 与微信会话映射持久化,重启 DSH 后自动恢复会话

安装(部署到 DSH profile)

DSH 自带插件管理命令 dsh plugin(在 profile 目录转发 pnpm,并自动把 声明了 dsh.bundle 的依赖加入 bundle 层):

# 安装(自动添加依赖 + 注册 bundle 层)
dsh plugin --profile <profile> add dsh-wechat

# 验证组合配置
dsh --profile <profile> --dump-config   # 应看到 "- id: dsh-wechat" 行

# 重启 DSH(必须),然后:
#   - 浏览器打开 设置 → WeChat:扫码登录、查看状态、重连、改配置
#   - 或直接打开 http://127.0.0.1:3080/wechat/qr 扫码

其他管理命令(同样自动维护 bundle 层):

dsh plugin --profile <profile> update dsh-wechat   # 升级
dsh plugin --profile <profile> remove dsh-wechat   # 卸载(从 bundles 移除)

> 插件从 npm 官方源安装(dsh plugin addpnpm add dsh-wechat)。 > 修改代码后需重启 DSH 才能让改动生效。

微信命令

与 DSH 原生命令同步

<details> <summary>点击展开:bridge 如何接入 DSH 的 <code>ctx.commands</code> 注册中心(计划模式 / 目标 / 压缩 等原生 slash 命令走的就是这条路)</summary>

微信消息进入后,bridge 向 DSH 的 ctx.commands 注册中心查询当前会话 已注册的命令(这是 DSH 内置的人类 slash 命令注册服务,由 @deepseek-ai/dsh-commands 提供;name /plan、name /goal、name /compact 等命令都由各自的 bundle 在那里 注册)。命中即直接交给原生 handler 执行,并把结果回执渲染到微信——和 GUI 走同 一条命令管线。

未注册的命令回落到本仓库硬写的本地命令表(/silent/next/rp/rq、 /workspace、/session 等),命中失败时按 "未知命令" 提示并作为文本转发给 agent。 DSH 的 ctx.commands 服务在某些极简装配下可能不挂载(缺失时会打一次 warn), 这种情形行为完全等同之前的版本。

所以:DSH 加任何新的 /xxx 命令 bundle,微信端无需改动即可识别——只要它是 按 DSH 命令注册契约挂上去的。例如装有 dsh-plan-mode 时微信发 /plan off 收 到原生回执 "Plan mode off.";装有 dsh-command-goal/goal <目标> 收到原生 "Goal created ...";装有 dsh-command-compact/compact 收到 "Compacted N history items (~M tokens)."——与 GUI 同款回执,由原生 handler 自己算、自己发。

/help 在末尾加一段 ── DSH 原生命令(当前 profile 已注册)──,列出当前 profile 实际注册的所有原生命令;本地命令表里已有的名字自动去重,不会重复 出现。

</details>

本地命令表

| 命令 | 说明 | |---|---| | /help/h/?) | 帮助 | | /status | 当前状态:工作区、会话、Agent、Preset、模型、上下文、权限、静默、繁忙投递、跨会话通知;末尾追加 DSH 通过 ctx.sessionProjections 注册的所有会话级状态,分四段显示——[模式](plan / goal / subagent / todos)、[用量与统计](tokenUsage / contextPressure / contextBreakdown / sessionStats / subagentTiming)、[会话](title / sessionListMetadata / permissions / imageLimits)、[其它](未识别 key 自动归类);DSH 加新 plugin 自动出现 | | /workspace (ws) — list \| status \| switch <编号\|路径> \| add <路径> | 工作区管理(list 显示各工作区会话数,不含已归档;switch 恢复该目录最近会话,无则新建) | | /session (s) — list [current] \| switch <编号> \| new \| status | 会话管理(list 最近 20 个,标记当前,不显示 GUI 已归档会话;current 只看当前工作目录;new 复用当前工作区空白会话,与 GUI「新建会话」同款,无空白才新建) | | /preset (p) — list \| switch <名称\|编号> \| status | Preset 管理(默认写入 DSH 设置,与 GUI 同步;当前会话无内容时立即应用) | | /model — list [提供商] \| switch <提供商/模型> \| status | 模型管理(切换立即作用于当前会话 + 设为默认) | | /perm — status \| list \| switch <名称\|编号> \| default [名称\|编号] | 权限管理(switch 实时切当前会话;default 写 DSH 设置,新会话生效) | | /reasoning — [list \| default \| switch <等级>] | 推理等级:查看当前/默认与模型支持的等级;switch <等级> 切换(实时 + 写默认);default 恢复模型默认 | | /enter queue\|steer\|status/busy) | 繁忙时投递:agent 运行中收到微信消息时排队(queue)还是插话进当前轮次(steer);读写 DSH 设置 ui-conversation.busyEnter,与 GUI「繁忙时 Enter 键行为」同源同步;空闲会话始终新开一轮 | | /silent on\|off/sl) | 静默模式:开启后 agent 每轮的中间过程输出(工具调用、思考等)不再逐条推送,只在轮次结束时发送最终回复,避免刷屏;跨重启持久化,设置页可切换 | | /notify on\|off\|status/watch) | 跨会话通知:后台会话的已完成/报错/卡片提醒,默认关闭(单用户单闸,设置页可切换) | | /history [数量] | 查看最近历史消息(默认 5 条,最多 20 条) | | /stop | 中断当前任务 | | /next | 继续发送因微信限制被缓存的消息 | | /rp / /rq | 拒绝所有待处理权限卡 / 提问卡(微信端) |

其他 /xxx 命令作为文本转发给 agent;审批/提问卡双端同弹,已在其他端 处理的卡会提示。

所有命令均直接映射 DSH 原生服务(workspaceRegistry / sessionQuery / agentPresets / agentDefaultModel / permissionPresets),默认值与 GUI 设置页同源同步。

架构

微信 (iLink) ── long-poll getupdates ──► dsh-wechat (Cordis host plugin)
    ▲                                      │
    │ ◄── sendText/sendMedia ──────────────┤
    │                                      ▼
    │                          DSH 进程内服务(零 @deepseek-ai 运行时依赖)
    │        agents.create/resume ── agent.followup(消息入)
    │        session/event ── assistant/message、turn/end(消息出)
    │        apiProxy.events.mux 帧流 ── approval/question 卡(镜像 GUI)
    │        apiProxy.respond() ── 微信决策注入原生 pending 表
    │        tools.register ── send_wechat 工具
参考项目 wechat-opencode本插件
src/weixin/(iLink 协议)原样移植
src/server/(OpenCode Server HTTP/SSE,240KB+)删除,改用 DSH 服务
bridge.ts 会话映射src/bridge/bridge.ts + src/dsh/sessions.ts
workspace/session/agent/model 等 18+ 命令移植并映射到 DSH 服务
question 卡片apiProxy.events.mux 帧 → 微信卡 → respond() 注入
permission 卡片(OpenCode 规则引擎)无自定义触发;原生 approval.request → 帧流双端同卡
终端二维码webServer 路由 /wechat/qr

> 设计说明:微信端是 GUI 的第二客户端,功能不多也不少。审批/提问的 > 决策点始终在 apiproxy 的原生 pending 表(审计、ApprovalPolicy 策略、 > GUI 卡全部原生),插件只做两件事——订阅 events.mux 帧流把同样的卡 > 渲染到微信,以及把微信回复通过 respond() 注入(与浏览器客户端同一 > 协议)。审批触发也完全原生:不设自定义敏感工具名单、无自动放行 > 模式,沙箱升级等原生触发产生什么卡,微信就镜像什么卡。 > "谁先回复谁生效"由原生 settle 防双决保证;respond 返回 not-pending > 时微信提示"已在其他端处理"。微信卡 30 分钟软超时是唯一工程差异 > (GUI 卡无超时、可继续处理)。

设置页(DSH 设置 → WeChat)

客户端半部通过 dsh.client + exports["./client"] 声明(与 dsh-mcp-manager 同款交付),挂载到 settings.section slot(nav 顺序 40):

  • 状态卡 — 登录阶段(未登录/等待扫码/已扫码/已登录/失败)、Bot ID、

监控运行状态、已绑定用户数,与 跨会话通知 / 静默 开关同卡展示

  • 扫码 — 未登录时页面内直接显示二维码,扫码确认后自动进入已登录
  • 操作按钮重新扫码(清除 token 重新登录)、重连(重启长轮询

监控,token 失效时自动回到扫码)、退出登录,与保存配置同行

  • 连接配置 — baseUrl / cdnBaseUrl / botType / cwd /

textChunkLimit / cardTimeoutMs / 跨会话通知(全局)/ 静默;保存即生效, 网关参数变更自动重连;存储于 ~/.dsh-wechat/config.jsonstate.json

与宿主通信走插件自己的 HTTP API(/wechat/api/status|config|relogin| reconnect|logout),客户端零 @deepseek-ai 依赖。

配置

优先级:内置默认 ← 插件行 config:~/.dsh-wechat/config.json (设置页写入,覆盖前两者)。插件行可带 config:

# 例:追加到 profile 的 cordis.patch.yml
- id: dsh-wechat
  config:
    cwd: 'C:\projects\my-project'
默认值说明
baseUrlhttps://ilinkai.weixin.qq.comiLink 网关
cdnBaseUrlhttps://novac2c.cdn.weixin.qq.com/c2c媒体 CDN
botType"3"iLink bot 类型
storageDir~/.dsh-wechattoken/sync-buf/会话映射/临时文件
cwdprocess.cwd()新会话工作目录
textChunkLimit4000微信单条消息长度上限
cardTimeoutMs1800000提问/权限卡软超时(30 分钟)
crossSessionNotifyfalse跨会话通知总闸(已完成/报错/卡片,单用户)

> 新会话的 agent preset 由 DSH 设置文档(agent-presets namespace,GUI > 设置页或微信 /preset switch 修改)决定,插件不再提供 agentPreset > 配置键。

开发

npm install
npm run build    # tsc → dist/
npm test         # vitest(64 个用例:splitText/格式化/解析/帧处理/状态存储/命令解析)

与参考项目的差异与已知边界

  • 审批/提问双端同卡:微信通过 apiProxy.events.mux 帧流渲染与 GUI

相同的卡,决策经 apiProxy.respond() 注入原生 pending 表(浏览器 客户端同款协议)——不是自建第二套审批,触发也完全原生(无自定义 敏感工具名单、无自动放行模式)。

  • 微信卡 30 分钟软超时本地移除(不发 respond),GUI 卡无超时、可继续

处理——这是唯一工程差异。

  • 帧流 events.mux/respond 是 ApiProxy 正式契约;若 DSH 版本调整帧

结构,按契约适配即可。

  • send_wechat 工具对所有 agent 可见;任何会话的 agent 都能调用——绑定会话发送到绑定用户,未绑定会话回退到首个已知微信用户(单用户部署默认行为)。

工具推送与 assistant 回复共享同一份微信 10 条/窗口限流预算:超限或发送失败自动进入 /next 缓存队列(与回复同一套恢复流程),不会丢失。

  • /preset switch 遵循 DSH 约束:只有未产生任何内容的会话才能当场

recompose;已有内容的会话会提示 Preset 应用于下一个新会话。默认 Preset 本身写入 DSH 设置文档(agent-presets namespace),GUI 设置 页与微信双端读写同一事实源。

  • iLink 通道是腾讯官方 bot 协议,接口可能随官方调整;跟随 wechat-opencode

上游的 src/weixin/ 修复即可。

许可

MIT。src/weixin/src/adapter/ 移植自 wechat-opencode(MIT, 原始来源 @tencent-weixin/openclaw-weixin),文件头保留出处注释。

免责声明

本项目与 DeepSeek Harness、腾讯微信官方互不隶属,非官方项目, 纯属个人学习用途。使用本项目即表示你自行承担由此产生的一切后果。