Bundle
dsh-channel-weixin
Weixin channel for deepseek-harness (DSH): long-poll transport ported from Tencent/openclaw-weixin (MIT), driving one DSH agent session per WeChat peer.
- Source
- qqmqq
- stars
- 1 stars
- License
- MIT
- Updated
- Updated 23 hours ago
Readme
# deepseek-harness-weixin
把 deepseek-harness(DSH)的 coding agent 接到微信:扫码登录一次,
手机里的私聊消息就会按好友进入 DSH agent 会话执行——工具、文件、
子代理、goal 全部可用,回复带打字指示并自动分块。
> WeChat channel for deepseek-harness. Scan a QR with your phone WeChat, then every
> private message runs as a full DSH agent session (bash/pwsh, filesystem, web search,
> subagents) over the ilink bot protocol. Ported from Tencent/openclaw-weixin; no OpenClaw needed.
MIT License · Node ≥ 22 · Windows PowerShell · 纯 ESM 无构建 · 独立 dsh profile
## 快速开始
四条命令,从装插件到上线:
npm install -g @deepseek-ai/dsh # 1) 没有 dsh 时装一次(已装可跳过)
dsh plugin --profile weixin add https://github.com/qqmqq/deepseek-harness-weixin # 2) 装插件
.\scripts\weixin-login.ps1 # 3) 扫码登录(终端出二维码)
dsh --profile weixin # 4) 启动(保持窗口 = 长轮询中)
看到 `dsh-channel-weixin running: accounts=...` 即在线,手机发 `你好` 或 `/help` 测试。
需要图形界面可另开 `dsh web`。
> 装到一半想一键兜底(旧版 headless 残留、npm 404 等):`powershell -File scripts\install-weixin.ps1`
> 同微信号只能一个长轮询:曾用 OpenClaw 的,先停 `openclaw config set plugins.entries.openclaw-weixin.enabled false` 并 `openclaw gateway restart`。
## 微信内指令
/help 帮助
/new 开启新会话(清空当前好友的上下文)
/stop 取消正在执行的任务
/status 会话状态 / 模型 / 工作目录
## 能力地图
| 能力 | 状态 | 说明 |
| --- | --- | --- |
| 文本对话 | ✅ 支持 | 私聊消息进入 DSH agent 会话执行 |
| 语音消息 | ✅ 支持 | 微信自带转写文本(voice_item.text)直接入模型;无转写文本时明确提示无法解析 |
| 微信内指令 | ✅ 支持 | /help /new /stop /status |
| 每好友持久会话 | ✅ 支持 | cwd 隔离 + 重启续聊 |
| 图片/文件/视频接收 | 🚧 里程碑 1 | 下载解密(CDN AES)并落盘后给模型路径;素材已备(vendor 见下) |
| Agent 回发图片/文件 | 🚧 里程碑 2 | 出站上传工具(send_file),受工作区白名单约束 |
| 工具进度卡片 | 🔜 规划 | 上游 TOOL_CALL_START/RESULT 协议已就绪 |
| 群聊 | 🔜 规划 | @机器人 + 群级隔离 |
| 流式回复 / 每账号并行 | 🔜 规划 | 整轮聚合 → 增量、排队 |
## 媒体与语音
- **语音**:微信已带语音转写文本(`voice_item.text`),该文本会作为用户消息进入 agent;未提供转写时回复明确占位「[语音](微信未提供转写文本,无法解析内容)」,不假装听懂。
- **图片/文件/视频(里程碑 1)**:移植自 Tencent/openclaw-weixin 的 CDN 下载链路(`vendor-openclaw-weixin/src/cdn/*`、`src/media/*`,纯 Node crypto,无第三方依赖):收到媒体 → 下载/解密 → 落盘到 `<workspaceRoot>/wx-work/<peer>/media/` → 消息中附 `[收到文件] <绝对路径>`,agent 可读取/处理。DeepSeek 文本模型无视觉,图片需由 agent 用工具二次处理,README 会如实标注。
- **Agent 回发(里程碑 2)**:注册微信作用域工具 `send_file`(上传走 CDN 预签名 + AES 加密),路径限定在工作区内,防越界/符号链接穿透。
## 特性
- 扫码登录(终端二维码),多账号各一条独立长轮询
- 每好友一个持久 DSH agent 会话:cwd 隔离在 wx-work/<peer>,重启自动续聊
- 打字指示 + 回复分块(1600 字符)发送
- 零外部依赖;二维码渲染器已 vendor
- 无人值守安全:越界/危险操作 fail-closed 拒绝,不卡轮次
## 安全模型
- 消息可在沙箱(workspace-write)内自动执行工具:只对可信账号开放,微信号被盗 ≈ 本机工作区可控
- 登录凭证明文存 ~/.dsh/weixin,请保护该目录
- ilink 为官方生态外通道:登录态可能失效(自动暂停告警),存在平台风控风险,请合规使用
## 配置(可选)
编辑 ~/.dsh/profiles/weixin/cordis.patch.yml,按行 id `dsh-channel-weixin` 整体覆盖:
| 键 | 默认 | 说明 |
| --- | --- | --- |
| workspaceRoot | <启动目录>/wx-work | 各好友工作目录父目录(可换 WEIXIN_WORKSPACE_ROOT) |
| stateDir | ~/.dsh/weixin | 凭证/游标/会话映射(可换 WEIXIN_STATE_DIR) |
| turnTimeoutMs | 1800000 | 单轮看门狗,超时自动取消 |
| chunkMax | 1600 | 单条回复最大字符 |
| typing / queueAck | true | 打字指示 / 忙时排队提示 |
## 已知限制与缺点(坦白说)
- 媒体不可见不可发:只处理文本与语音转写文本,图片/文件/视频不进模型也不能回发
- 单账号消息串行;长任务期间新消息等服务端挂起
- 回复非流式(整轮后聚合发送,30 分钟看门狗兜底)
- 一好友一常驻 agent,好友多时内存随之上升
- 无 Web 管理界面;加账号/改配置/升级都要改文件并重启
- Windows 优先;基于 DSH 0.1.1-rc API,升级可能需适配
## Roadmap(按里程碑推进)
- **里程碑 1 · 媒体接收**:移植上游 CDN 下载/解密(素材:vendor-openclaw-weixin/src/cdn/aes-ecb.ts、pic-decrypt.ts、cdn-url.ts、media/media-download.ts;纯 Node crypto)→ 落盘 + 路径入上下文 → 需要一台真机联调(下载/解密正确性只能对真实 CDN 验证)
- **里程碑 2 · Agent 回发文件**:出站上传工具 send_file(getUploadUrl + AES 加密 PUT + 白名单校验)
- **工具进度卡片**:回复期间发送 TOOL_CALL_START/RESULT 气泡(协议常量已定义)
- **群聊支持**:@机器人触发 + 群级会话隔离与权限
- **回复流式化 / 每账号并行与排队**
## 仓库结构
lib/ 插件代码(纯 ESM;仓库根即 `dsh plugin add` 可装的 bundle)
scripts/ install-weixin / install-dsh / dsh / weixin-login / setup / start / rollback
weixin-profile-example/
.github/workflows/ci.yml CI:语法 + CLI + 单测冒烟
SECURITY.md · THIRD_PARTY_NOTICES.md
## 开发自检
node --check lib/*.js
node scripts/unit-smoke.mjs
## 许可证与致谢
MIT。微信传输代码衍生自 [Tencent/openclaw-weixin](https://github.com/Tencent/openclaw-weixin) (MIT);
二维码渲染器来自 qrcode-terminal (MIT)。详见 LICENSE 与 THIRD_PARTY_NOTICES.md。
本项目为个人/学习用途的集成示例,非 DeepSeek 官方产品。Install
dsh plugin --profile web add github:qqmqq/deepseek-harness-weixin#8a65ddfaefa42a203842ed10fd751917b338e64a
Profile: web
With the hub plugin installed, ask your agent to install it by name — it resolves the same plan shown here.
dsh plugin --profile web add github:stvlynn/dsh.fish#path:packages/dsh-plugin-hub
install dsh-channel-weixin from the hub