- Startseite
- Plugins
- Integrationen & Fernzugriff
- dsh-wechat-bot
dsh-wechat-bot
oldfe12138/dsh-wechat-bot
Remote-control a DeepSeek Harness agent from personal WeChat. Pair by QR from inside DSH without a terminal, chat both ways, switch sessions and workspaces, answer approval prompts and multi-select questions from the phone, queue a second message while a turn runs, and receive the files the agent produced. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.
Installation
dsh plugin --profile web add github:oldfe12138/dsh-wechat-botREADME
dsh-wechat-remote
Drive a DeepSeek Harness agent from personal WeChat: scan a QR code, send a message, watch the agent work on the machine at home, answer its approval prompts from your phone, and get the file it produced back in the chat.
Status: M7 — packaged. Transport, pairing, the session bridge, approvals, in-chat queueing, the return leg (long code blocks become files,
/send <path>), inbound attachments,/configand a 设置 → 微信 tab all work on a live host. Pairing and sign-out happen in DSH itself now: the tab shows the QR, the connection state and where the settings file is, so a market install needs no terminal at all (/wechat-pairand/configremain for chat-only setups). Configuration lives in~/.dsh/dsh-wechat/config.jsonc— one commented line per key, see Configuration. See docs/15-设置页.md for the tab, docs/11-配置与设置页.md for why/configcame first, and docs/04-M3-会话桥接.md, docs/05-M4-审批与问答.md, docs/08-并发消息与排队.md, docs/09-产物与文件回传.md, docs/10-入站媒体.md, docs/14-上架插件市场.md for the rest. Slash commands (/new/list/use/status/cancel/send/ws/queue/drop/config/diag/help) answer without spending tokens.
个人自用项目 / A personal tool. 这个插件是作者自己用的工具,顺手开源:没有商业支持、 没有可用性承诺、没有安全审计。请只在你自己的账号和自己的机器上使用;因使用本项目造成的 任何后果(数据、账号、费用、法务……)由使用者自行承担,作者不承担任何责任。完整条款见 DISCLAIMER.md(中英双语,与 LICENSE 的 MIT 条款一起适用)。 This is a personal tool released as-is, with no support obligation and no liability accepted by the author. Use it only with your own accounts on your own machine; see DISCLAIMER.md.
Why another one
There are already 20+ WeChat bridges for DSH. This one is deliberately narrow, and spends its complexity budget in three places the others treat as side effects:
| Concern | Most existing bridges | This plugin |
|---|---|---|
| Approval while away | Push a text prompt, or refuse to support it | First-class: a numbered prompt with tool name + reason, 1 to allow once, 2 to reject, per-conversation queue, fail-closed on timeout. With approvalSurface: both the desktop dialog still opens — whichever side answers first decides, and a phone answer closes the dialog |
| Session ownership | One chat = one session, or a hidden second conversation | The WeChat chat is a DSH session — the same timeline you see in the Web GUI, not a copy |
| Failure visibility | Silent stall | Every silent minute produces one progress line (running: bash, read +2 · 1m05s), and /diag exports the last failure |
| A message sent mid-turn | Sits in the inbox, invisible, until the turn ends | Replies with where the running turn is, asks whether to queue it (1) or drop it (2), queues it on silence, then runs it after the current turn with a ▶ marker |
Scope of v1
In: WeChat iLink (personal account) transport, QR pairing, text/image/file in and out, conversation ↔ session mapping, workspace and model switching, approvals and ask_user_question relayed to the phone, a settings card and /diag.
Out (with interfaces reserved): task orchestration and multi-agent fan-out, group chats, enterprise WeChat / Feishu / DingTalk, proactive scheduled reports.
Install
Two install modes, because a DSH profile is two things at once — a package that
resolves, and a row in dsh.profile.bundles that makes the loader apply its
cordis.patch.yml.
Real install (the plugin inventory lists it). Point the profile at a tarball and let the pnpm that ships inside DSH do the work:
npm install # only needed to build the tarball from a checkout
npm pack # → dsh-wechat-remote-<version>.tgz
node bin/install.mjs --profile desktop --tarball dsh-wechat-remote-0.6.1.tgz
# restart DSH completely (tray included) → Settings → 微信
That writes dependencies["dsh-wechat-remote"] = "file:<abs path>", runs
pnpm install inside the profile, and appends the bundle row. It is the same two
steps dsh plugin add performs, except that command refuses to touch the
desktop profile (profile "desktop" is managed exclusively by the Electron application).
Copy mode (no pnpm, no network). node bin/install.mjs --profile desktop
copies the files into <profile>/node_modules/dsh-wechat-remote (plus the
runtime dependencies that profile does not have) and appends the bundle row. It
mounts and runs exactly the same, but it is not a dependency, so DSH's plugin
inventory shows it as not installed and a later pnpm install in that profile
will not preserve it. Use --tarball when you want it to look installed.
Either way the loader only applies the patch because of the bundle row:
dependencies alone mounts nothing.
/wechat-pair and the settings tab exist because a plugin installed from the
market may never see a terminal: the QR is written to a PNG (8 minutes of
validity), and when the scan lands the transport restarts on the new account by
itself.
After pairing, message the bot from WeChat once. The account that scanned the QR is written into allowedSenders as the only owner, so the first message already works; /config allowedSenders <id> replaces that owner, and an empty list denies everyone.
Uninstall with node bin/install.mjs --uninstall (add --purge to move the
state directory aside, which is what you want before testing pairing from
scratch). Credentials and settings live in ~/.dsh/dsh-wechat/.
Settings tab
With the Web GUI there is a 微信 tab in DSH settings (settings.section, after Plugins). It answers two questions and nothing else:
- Is it connected? — state dot (polling / expired / stalled / unbound), account id, today's send count, current model route. Opening the tab generates the QR by itself and renders it with the time left; an expired one is replaced automatically while nothing is bound. The scan is picked up in the background, the scanner becomes the one owner, and the transport restarts on the new account. Same flow as
/wechat-pair. - How do I switch accounts? —
Sign outdeletes the stored bot credential, clears the owner and shows a fresh QR right away. That is the whole point: one person, one slot, no stale bot left behind. - Where do I change settings? — the page shows the path of
config.jsoncand says so in words; it renders no form. The file carries a comment above every key, and the chat keeps/configfor quick edits.
The page talks to four same-origin routes under /dsh-wechat (status, pair, qr.png, logout); every request must carry an x-dsh-wechat: 1 header, and cross-site callers get 403 because those routes answer no CORS preflight. No bot token is ever returned. In a profile without a web server (headless, tui) the tab simply stays hidden and the slash commands keep working — see docs/15-设置页.md.
Configuration
Settings live in ~/.dsh/dsh-wechat/config.jsonc — JSONC, so every key carries a comment: what it does (Chinese), what the schema says (English) and its default. Edit it and restart DSH; /config reads and writes the same file when you would rather not open an editor. It is never in the loader patch: a patch row that mounts the plugin a second time would run a second long-poll loop over the same account.
The file is written back in schema order, so hand-written notes are replaced by the generated ones while your values survive. A key with a bad type or an unknown name is ignored (one line in the log and /diag) instead of stopping the plugin, and an old config.json is read once then renamed config.json.bak.
| Key | Default | Meaning |
|---|---|---|
enabled | true | Start the long-poll loop on load |
allowedSenders | [] | The one WeChat id allowed to drive the agent (singleOwner: a second id replaces the first — this plugin drives a machine, so two people is two owners too many). Empty denies everyone, including the account that scanned the QR, until you add your own id |
pairingCode | "" | When set, an unknown sender must include this code in their first message |
approvalMode | ask | ask · allow-readonly (read tools pass) · all (never ask; dangerous) |
approvalSurface | both | both shows the prompt in the desktop window and in WeChat, first answer wins — answering on the phone also dismisses the window's card · wechat phone only · desktop the window keeps every prompt |
approvalTimeoutMs | 900000 | A prompt with no answer is rejected after this |
queueAsk | true | When a second message arrives mid-turn: true replies with the progress and asks whether to queue it; false queues it right away |
queueAskTimeoutMs | 30000 | No answer within this window means "queue it" — losing a message is worse than one extra turn |
maxMessageLength | 1500 | Long replies are split; oversized code blocks become files |
codeBlockAsFile | true | A fenced block longer than codeFileMinChars is uploaded as a file and replaced by a one-line placeholder |
codeFileMinChars | 900 | Threshold for that, in characters; shorter blocks stay readable inline |
sendFiles | true | /send <path> may push a local file into the chat |
sendIntervalMs | 1200 | Floor between two sends |
sendJitter | 0.25 | Each gap is stretched by up to 25%, so replies do not arrive on a metronome |
dailyMessageLimit | 400 | Hard ceiling per local day; a reply loop stops instead of flooding. 0 disables |
proactiveWindowMs | 86400000 | A non-reply push (completion notice) is only sent if the user wrote within this window. 0 disables proactive pushes |
quietHours | "" | e.g. 23:00-08:00; approvals still break through |
Commands
/new /list /use <n> /ws [n|path] /status /cancel /send <path> /queue /drop <n> /config [key] [value] /diag /help
Write while a turn is running and the plugin answers with where that turn is (已 2m10s,正在跑 pwsh), then asks whether to queue yours: 1 queues it, 2 drops it, and silence for queueAskTimeoutMs queues it anyway. When the running turn ends, the queue drains one message at a time, each prefixed with ▶ 接着做排队中的这条:…; a queued message keeps the attachment paths its turn was built from. /queue shows what is waiting and /drop 2 removes the second entry. Set queueAsk: false to skip the question.
Code that does not belong on a phone becomes a file: a fenced block over codeFileMinChars is written to <workspace>/.wechat-outbox/ and uploaded, and the chat keeps a 📎 代码已转成文件:… line in its place. /send report.md pushes any local file (relative paths resolve against the chat's workspace, 25 MiB ceiling); ask the agent for a path and then send it back, rather than pasting a table into the chat.
The other direction works too: send an image, a file, a voice note or a video and it is decrypted into <workspace>/.wechat-inbox/ with a sortable name, then handed to the agent as an absolute path ([对方发来一个图片,已保存到 …,需要时用 read 打开]) next to whatever you typed. A download that fails becomes a sentence in the conversation, not a silent drop. Voice needs silk-wasm in the profile to become a .wav; without it the raw .silk is kept and the reply says so.
/ws is how you point one chat at one project: with no argument it lists the workspaces
DSH already knows, ▶ marks the one this chat uses; /ws 2 switches to the second, /ws 0
goes back to the host default, and /ws C:\path\to\repo takes a folder directly. The switch
takes effect on the next message — a session's directory is fixed when the host creates it,
so the current session is dropped and the next one opens in the new folder (the old one stays
reachable through /use).
WeChat is one message at a time: a turn cannot be interrupted by the next line, so the plugin never pretends otherwise — see the paragraph above for what it does instead.
Commands are handled by the plugin and never enter the model's context, so a wrong guess costs nothing.
/config is the settings page, in the chat: no argument lists every key with its value and a * where it differs from the default, /config approvalMode explains one, and /config approvalMode all writes it. Values are validated by the same schema the loader uses, so a typo is refused rather than stored. Keys a running component captured at construction say "restart the app to apply" instead of pretending; allowedSenders and the approval keys apply immediately.
Security and account risk
Read docs/06-安全与防封号.md before pairing. The short version:
- This drives Tencent's iLink bot channel, whose protocol is publicly documented (MIT, official). The identity being automated is the bot (
ilink_bot_id); your personal WeChat is only the client that talks to it. We never log into WeChat, read its database, or drive its UI — that is the pattern with real account risk, and we do not do it. - The token in
~/.dsh/dsh-wechat/accounts/<id>.jsonis a live bot session; the file is0600, the state directory0700. - Session expiry (
errcode -14) is not a ban: the loop stops,/diagsays so, and you re-scan withnode bin/login.mjs. - Everything that could become a flood is capped: per-send interval with jitter, a rolling window, a daily ceiling, exponential backoff that gives up after 8 consecutive failures, and a window on proactive pushes.
- Keep
allowedSendersto your own id. Approval prompts fail closed.
Development
npm test # node:test, no bundler
Layout: src/transport/ (iLink client, pacing, inbound scheduling), src/bridge/ (chat ↔ session, commands, approvals, queue, outbox), src/media/ (inbound attachments), src/state/ (paths, atomic JSON, logger, conversations), src/security/ (allowlist), vendor/openclaw-weixin/ (Tencent's iLink protocol layer), test/.
Design notes live in docs/: 01 the plan, 02 the technology choices, 03 the on-device acceptance sheet, 04 the session bridge, 05 approvals and questions, 06 security and account risk, 07 model routing and transport failures, 08 messages that arrive mid-turn, 09 deliverables and file sending, 10 inbound media, 11 why /config instead of a settings card, 12 the release checklist, 13 the automated probe that runs the real runtime inside a real host with only the WeChat transport stubbed, 14 the plugin-market submission kit (catalog YAML, release commands, PR body), 15 the settings tab, 16 install and uninstall (and how to verify a profile really has it).
License
MIT.
Ähnliche Plugins
dsh-purge
kingcharleslzy-ai/dsh-purge
dsh-web (dsh-ssh)
zhu1090093659/dsh-web
dsh-web (dsh-remote-web-ui)
zhu1090093659/dsh-web
dsh-web-ui (dsh-ssh)
zhu1090093659/dsh-web-ui