个人微信 + 企业微信桥:扫码配对,每个会话各自一个独立 DSH 会话,文字/图片/视频/文档/压缩包双向传输,聊天里支持 /help、/status、/new、/stop、/friends 命令(由桥直接应答,不消耗模型回合),可切换「只处理好友私聊」(群消息静默忽略并计数),敏感操作可在聊天里回 1 或 2 远程审批,并支持双向的企业微信智能机器人长连接(无需公网地址),图片、文件、视频同样能收发。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:wjh-ux/dsh-wechat-media
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本——pnpm 默认拦截,所以安装可能停在 ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED 或 ERR_PNPM_IGNORED_BUILDS;dsh 会打印出需要添加的确切键名,把它加进该 profile 的 pnpm-workspace.yaml 的 allowBuilds 下,重跑一次即可装上。放行构建本身就是一次信任判断:请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
该插件的 README 只有英文版本。
Personal WeChat for DeepSeek Harness (dsh) — scan a QR
code once, then talk to your agent from WeChat: one DSH conversation per contact or group, and two-way
text, images, video, documents and archives. Several WeChat accounts can be paired side by side.
给 DeepSeek Harness 的个人微信桥:扫一次码,之后就能在微信里和 agent 对话 —— 每个联系人/群各自 一个独立会话,文字、图片、视频、文档、压缩包双向互通,支持多个微信号同时在线(小号 + 大号)。
Current release: v1.24.13 · 52 test suites / 832 cases · every capability below has been exercised against a real service or real hardware at least once (see What was actually verified).
What it gives you / 它能做什么
| Capability | Detail |
|---|---|
| QR pairing | Cards in the Plugins panel. The login token is stored under $DSH_HOME, so restarting dsh does not need a new scan; re-pairing is one click. |
| One conversation per chat | Every WeChat contact (and group) gets its own DSH session with its own context, created or resumed automatically. The same holds for a WeCom or Feishu chat. |
| Text both ways | Your message becomes a turn; the answer is chunked back to WeChat. |
| Media both ways | Images, video, documents and archives. Inbound files are downloaded and decrypted to $DSH_HOME/wechat-inbox/<date>/<chat>/; the agent gets the path, so a text model can read images through read_image. Outbound files are uploaded and sent by the agent through its tools. |
| Multiple accounts | Pair a spare account and your main account; each keeps its own token, cursor and session map. |
| WeCom (企业微信) | Group-robot webhook, a self-built app, or the intelligent-robot long connection (receiving without a public address); streaming previews work on this channel. |
| Feishu (飞书 / Lark) | Custom webhook bot or app bot with a long connection; documents, spreadsheets and bitables through tools - and, as you, knowledge bases (知识库) plus the official CLI's whole 200+ command surface (calendar, mail, tasks, meetings, OKR, approval…), because an app is a member of nothing. |
| Editor bridge | A VS Code extension: ask from the panel, stream the answer, let the AI edit the folder you have open (/dsh-vscode/*, with a 可写 switch) - and flash the board from the editor, because the turn runs in that folder and the serial tools take it from there. |
| Automation tools | Browser automation over the DevTools protocol (own profile, your Chrome, or the extension), Office read/write/convert, desktop control, clipboard, SSH, serial flashing (ESP-IDF / esptool / avrdude / STC via stcgal), web search, scheduled tasks, and an RPA-style flow runner. |
| Scraping | Scrapling: browser-shaped TLS fingerprint and headers, so a page that rejects a plain fetch (403, a Cloudflare challenge, a UA check) can still be read - CSS selectors, link extraction, per-call proxy, and a real-browser mode that drives the Chrome you already have (no 1.25 GB download) with Cloudflare solving. |
| Lead collection & outreach | collect_leads turns a goal and a market (de, us, ae…) into a scored, de-duplicated list with contacts, reading the page rather than trusting the search snippet, and telling a buyer from a seller. outreach_plan / outreach_send turn that list into messages over email, WeChat or WeCom - with a cooldown per address, a human confirmation slot, and a stop at the first hard channel failure. |
| Embedded build | Keil uVision5 through the UV4.exe already installed: keil_build runs build / rebuild / clean / flash, and returns every error as file(line): error C141: message plus the Program Size and the .hex - so a failed build says where. The same module also installs a Tools-menu entry, so the same build is one click inside uVision. |
| Firmware: any board | project_build reads the folder and picks the toolchain: .uvprojx → Keil (C51 through UV4, or MDK-ARM), sdkconfig → idf.py, CMakeLists.txt / Makefile → cmake --build / make with arm-none-eabi-gcc. Flashing follows the same logic: stcgal for an STC part, UV4 -f for an MDK project, openocd / st-flash for an ELF, and flasher="uart" (stm32loader) for a board with no debugger at all. toolchain and flasher override the guess. |
| Multi-agent | With one switch, each conversation can mount its own agent preset - its own prompt, tools and model wiring - instead of every chat sharing the host default. Off by default; /multiagent on, then /agent <preset> per chat. |
| Integrations | POST /inbound lets a NAS/CI/monitor speak into a conversation, an outbound webhook posts every finished turn (HMAC-signed), and /dashboard shows sessions, failures and token spend. |
| Persistence | Accounts, receive cursor, per-peer context tokens, chat→session routes, allowlist and preferences all live under $DSH_HOME/dsh-wechat-media/. |
Requirements / 环境要求
- dsh 0.2.0-rc.2 or newer with the standard agent loop and tools (the shipped
dsh web/ desktop profiles qualify), Node.js >= 22 (Node 24 tested), Windows / macOS / Linux. - A WeChat account that can scan a QR code. A spare account is strongly recommended: personal WeChat automation is against WeChat's terms of service and carries a ban risk, whichever library you use.
- Outbound access to
ilinkai.weixin.qq.comandnovac2c.cdn.weixin.qq.com. - Optional, for firmware work: Keil (C51 and/or MDK-ARM) for
.uvprojxprojects; ESP-IDF forsdkconfigones;arm-none-eabi-gcc+cmake+ninjafor CMake/Make projects;openocdorst-flashto download them over SWD; andpythonwithpyserial+stm32loaderfor a board that only has a UART. Each one is detected by path, so a portable install under%USERPROFILE%\tools\<pkg>\binis found even by a long-running process that never re-read the PATH. - Optional, for the "act as you" half of Feishu: the official
lark-cli(npx @larksuite/cli@latest install, thenlark-cli config init --newandlark-cli auth login --recommendonce). Without it the app-identity tools (messaging, docs, sheets, bitables) work normally, and the knowledge-base tools andfeishu_clisay what is missing instead of failing obscurely.
Install
On a fresh Windows machine, one script does the environment and the plugin:
# 先拿脚本。jsDelivr 这条一般最快;GitHub 原地址有时会断流,见 docs/deploy.md 第零节
irm https://cdn.jsdelivr.net/gh/wjh-ux/dsh-wechat-media@v1.24.13/scripts/deploy-windows.ps1 -OutFile deploy.ps1
# 体检:只看缺什么,不改任何东西
.\deploy.ps1 -Version # 先问一句:这是哪一版
.\deploy.ps1 -CheckOnly
# 部署,十一步依次是
# 1 前置(Node.js 缺则装 / DSH profile) 2 Python 本体(winget 或官方安装包)
# 3 Python 包(pyserial / stcgal / stm32loader,并把 pip 的 Scripts 加进 PATH)
# 4 VS Code + ms-python.python 扩展 5 CH340 串口驱动(验签后静默装)
# 6 arduino-cli + 核心 7 arm-none-eabi-gcc / cmake / ninja / openocd
# 8 Keil 与 ESP-IDF(只检测) 9 插件装进 profile
# 10 插件自带的 VS Code 扩展(vsix) 11 自检(真编一个 STM32 固件 + 冒烟测试)
.\deploy.ps1
# 只要插件(环境已就绪)
.\deploy.ps1 -SkipTools -LocalPath D:\src\dsh-wechat-media
# GitHub 慢 / 完全离线:用已经下好的 zip
.\deploy.ps1 -ToolsArchiveDir D:\downloads\tools
It is safe to re-run: installed tools are skipped, an existing package.json is backed up before it is merged, and a
node_modules link that points somewhere else is replaced while a real directory is refused rather than deleted.
Verification is never "the file exists" - every tool is run (--version), and the last step asks the plugin itself
(scripts/probe-tools.mjs calls the same which() / serialSupport() the plugin uses at runtime) what it can actually
reach, then runs the smoke test.
完整说明(先决条件、十步各做什么、虚拟机怎么装、离线模式、卸载、排错):docs/deploy.md。 仓库里直接有 PDF:docs/deploy.pdf。要自己重新生成:
python scripts/md-to-docx.py docs/deploy.md deploy.docx # 需要 python-docx
# 再用 Word / LibreOffice 导出 PDF,或 office_convert deploy.docx
What it cannot install for you, and why:
| 原因 | |
|---|---|
| Keil (C51 / MDK-ARM) | 要注册账号下载,且许可按商业/非商业区分 - 见 docs/keil-arm-install.md(含直链、SHA256、四个坑) |
| ESP-IDF | Espressif 的安装器要选目标芯片与组件;检测已有安装,缺了只提示 |
| DSH 本身 | 插件是 DSH 的扩展,不是独立程序 |
Machine without the script? The three things it does are small enough to do by hand: put the plugin's checkout on disk,
link it as <profile>\node_modules\dsh-wechat-media, and add "dsh-wechat-media": "link:<path>" to the profile's
package.json plus dsh-wechat-media to dsh.profile.bundles.
Install / 安装
# from GitHub
dsh plugin --profile web add github:wjh-ux/dsh-wechat-media
# or from a checkout
dsh plugin --profile web add link:/absolute/path/to/dsh-wechat-media
Restart dsh, then open Plugins → dsh-wechat-media and press Add an account (QR code).
重启 dsh,然后在 插件 → dsh-wechat-media 点「添加账号(扫码)」。
Host key verification failed / Could not read from remote repository on install. pnpm resolves a github: spec
over SSH (git+ssh://git@github.com/...), so a machine without GitHub's host key in known_hosts — and without an
SSH key that can read the repo — cannot install it, even though the repository is public. Two ways out:
# 1. make git rewrite GitHub SSH URLs to HTTPS (no SSH key needed; the repo is public)
git config --global url."https://github.com/".insteadOf "git@github.com:"
# 2. or install a release tarball instead of the shorthand
dsh plugin --profile web add https://codeload.github.com/wjh-ux/dsh-wechat-media/tar.gz/refs/tags/v0.67.3
装不上、报 Host key verification failed?因为 pnpm 把 github: 解析成 SSH 地址,而这台机器既没有 GitHub 的主机密钥
也没有能读这个仓库的 SSH key —— 仓库其实是公开的。两条路:把 GitHub 的 SSH 地址重写成 HTTPS(上面第 1 条),或者直接装
release 的 tarball(第 2 条,把版本号换成你要的那一版)。
Pairing / 配对
- The card shows a QR code (it polls its own status and refreshes an expired code automatically).
- Scan it with WeChat on the phone, confirm on the phone.
- If WeChat asks for digits, type them into the card and submit.
- The account appears with a status dot:
monitoringmeans the long poll is running. - Add an account (QR code) stays available at all times — scanning a different WeChat account adds it as another account, so a spare and your main account can run side by side. Scanning the account you already have simply refreshes its login. Each row also has Pair again and Unpair.
- Opened the QR by mistake? Press Cancel — the attempt disappears immediately instead of waiting for the code to expire. (A QR lives five minutes; an attempt gives up after eight, and at most three QR codes are issued per attempt.)
The QR encodes the landing-page URL the platform hands out — scanning it is what completes the binding.
Each account is stored under its normalized ilink_bot_id (b0f5860fdecb@im.bot → b0f5860fdecb-im-bot),
with 0600 permissions on the files that hold a token; accounts, cursors and conversation routes are keyed
per account, so several can poll at the same time.
Where inbound files go / 收件目录
By default inbound media is decrypted into $DSH_HOME/wechat-inbox/<date>/<chat>/. That directory is
configurable, and the change takes effect without a restart:
- From the card - the field under Inbound files are saved in submits a plain GET form (a navigation, not a fetch), so it works even in browsers where the card's requests never reach the plugin.
- From the control panel -
/dsh-wechat-media/panelhas the same field and a restore default button. - With the system folder dialog - Browse… / 浏览… (card and control panel) or
GET /dsh-wechat-media/pick-folderopens Windows' own picker on the desktop and saves the choice. A browser cannot hand over an absolute path (a directory input only exposes relative names), which is why the dialog is opened by the host (powershell -STA) rather than in the page. - From the plugin config -
inboxDir: "D:\\wechat-files"in the plugin options, used when no runtime preference is set.
The order is preference (card/panel) → config → $DSH_HOME/wechat-inbox. Only an absolute path is accepted: a
relative one is refused with a message instead of being resolved against the process working directory, because a
silently different directory is worse than the documented default. GET /dsh-wechat-media/state reports the
effective value as inboxRoot, with inboxRootDefault and inboxRootConfig for comparison.
Using it / 使用
Just message the bot from WeChat. A few things the agent can do from inside the conversation:
- answer through the normal reply channel (the bridge relays its final text automatically);
- send extra messages or files with its tools:
| Tool | Purpose |
|---|---|
wechat_send_text |
An extra text message, or a message to a different chat (to), pre-empting the automatic relay for that turn. |
wechat_send_file |
Send a local file back to WeChat. Images (.jpg/.png/.webp/.gif) travel as pictures, videos (.mp4/.mov) as videos, everything else (pdf, docx, xlsx, zip, 7z, …) as a file attachment. |
wechat_status |
Which accounts are paired and which conversations exist. |
Every incoming message is prefixed with [微信 <name> <wxid>] so the agent can pass the right to when it
answers a specific chat. Group ids look like 12345678@chatroom.
Remote approval / 微信里远程审批
When a WeChat-driven session asks for approval — a tool call the permission preset wants confirmed — the prompt goes to the same WeChat chat, not only to the GUI:
⚠️ 需要你批准一次操作(远程审批)
工具:pwsh
原因:write outside the workspace
回 1 = 批准一次 · 回 2 = 拒绝
Answer 1 / y / 同意 / 批准 / /approve to allow that one call, or 2 / n / 拒绝 / /reject to
refuse it. The answer is consumed — it never becomes a new turn. If nothing arrives within
approvalTimeoutSec (default 120 s), or the prompt cannot be delivered, or the turn is aborted, the request is
handed back to the GUI, so an approval is never silently dropped. Set approval: "ignore" in the plugin config
to keep approvals in the GUI only.
Contact allowlist / 联系人白名单
Every chat that writes to the bot is remembered, and the card lists them under Contacts & groups / 联系人 / 群, with Allow / Ignore / Clear per row and an Only accept allowlisted chats switch.
- The switch is off by default — otherwise a freshly paired account would look broken to everyone who writes.
- With it on, only chats marked Allow reach the agent; Ignore and undecided chats are dropped and logged.
- A decision takes effect immediately (no restart) and is stored in
peers.jsonbeside the accounts.
Friends only / 只处理好友私聊
Only answer friends (1:1 chats) — the card's second checkbox, or /friends on from a chat. The protocol
carries no "is a friend" flag, so friends means 1:1 chats: when the switch is on, every group message
is dropped, whatever the allowlist says about that group. Direct chats are unaffected.
- Off by default: an upgrade must not change who the bot answers.
- Group messages are ignored silently (that is the point) but never invisibly: each one bumps
counters.groupsSkipped,/statusprints已静默忽略群消息 N 条, and the card shows the same number. - It is one preference (
prefs.json), so the checkbox and/friendscan never disagree, and it applies to personal WeChat and WeCom alike. - Switching it on while a group is waiting answers once in that group to explain the coming silence. Turning it off works from a 1:1 chat or the card — a group message is skipped before it could be read as a command, which is the honest consequence of "silent".
WeCom (企业微信) / 企业微信
WeCom works alongside the personal-WeChat bridge, outbound through two paths and inbound through a third:
| Path | What you need | Direction |
|---|---|---|
| Group robot webhook | one webhook URL from a WeCom group (群设置 → 群机器人 → 添加) | out: text, markdown, images |
| Self-built app | corpid + corpsecret + agentid of an app (应用管理 → 自建) | out: text, markdown, image, file, voice, video |
| Intelligent robot, long connection | the robot's BotID + Secret (智能机器人 → API 模式 → 长连接) | both: messages in, answers back in the same chat |
Configure any of them on the plain page http://127.0.0.1:19387/dsh-wechat-media/wecom (also linked from the card
and the control panel), which is where you send a test message from as well. The long connection needs no public
address: the plugin opens a WebSocket to wss://openws.work.weixin.qq.com and answers each message through the
frame the platform sent, so a WeCom chat becomes an ordinary DSH conversation - the same session machinery,
allowlist, approvals and reply relay as personal WeChat. Approval requests reach a WeCom chat as a proactive
long-connection message and are answered there with 1 (allow once) or 2 (reject); anything else stays in the GUI,
exactly as on the personal-WeChat side. The agent gets two extra tools:
| Tool | Purpose |
|---|---|
wecom_send_text |
Send text or markdown through the configured robot, long connection or app (to overrides the recipients). |
wecom_send_file |
Send a local file as image / file / voice / video. Over the long connection (or through a self-built app) any type works; with only a group-robot webhook, images do. |
Files travel the other way too: a file sent to the robot is uploaded as a temporary WeCom asset over the long
connection (init -> 512 KiB chunks -> finish -> media_id) and then sent, so no app credentials are needed. Uploads
are capped at 100 chunks (~50 MB) and each chunk is retried twice, which is what the platform tolerates; a failure is
reported back instead of being swallowed.
Settings live in $DSH_HOME/dsh-wechat-media/wecom.json with mode 0600 - they contain a webhook key, a corpsecret
and the robot secret, so they never go into prefs.json or a cordis patch. GET /dsh-wechat-media/state reports
whether a secret is set, never its value.
What stays impossible is the callback API. It insists on a public HTTPS URL that the enterprise registers, so a bridge running on your own machine cannot receive that way; the long connection above is what makes two-way WeCom possible without one.
Media arrives too. Images, files and videos sent to the robot are downloaded, decrypted and written to the same
inbox the WeChat side uses ($DSH_HOME/wechat-inbox/<date>/<chat>/), then handed to the model as a path plus a
[企业微信图片] …用 read_image 查看 hint, so a text-only model with a vision plugin can actually look at them. The
scheme is the official one for the long connection (@wecom/aibot-node-sdk): aeskey is base64 of a 32-byte AES-256
key, the bytes are AES-256-CBC with the iv taken from the key's first 16 bytes, PKCS#7 padded to 32 bytes, and the
file name comes from Content-Disposition because the payload carries none. Note this is not the personal-WeChat CDN
scheme (AES-128-ECB). A download that fails says so in the chat instead of dropping the attachment silently, and
/state counts both outcomes (counters.mediaDownloaded / counters.mediaFailed).
Feishu (飞书 / Lark) / 飞书机器人
Two kinds of Feishu bot exist, and both are supported, because they solve different problems.
| Custom webhook bot | App bot | |
|---|---|---|
| Credentials | the webhook URL (and its signing secret, if set) | app_id + app_secret |
| Can send | text and rich text | text, rich text, images, files, audio |
| Can receive | no | yes - over the long connection, with no public URL |
| Config | feishu.webhookUrl, feishu.secret |
feishu.appId, feishu.appSecret |
Feishu shows up in three layers, and the layer decides what a tool can reach:
| Layer | Identity | Reaches |
|---|---|---|
feishu_send_*, feishu_doc_*, feishu_sheet_*, feishu_bitable_* |
the app (tenant_access_token) |
messages, its own documents/sheets/bitables |
feishu_wiki_* |
the person (user_access_token via lark-cli) |
your knowledge bases, written as you |
feishu_cli |
the person | everything else the official CLI can do - 200+ commands, 18 domains |
The first layer needs nothing but an app; the last two need lark-cli authorised once (see Requirements).
Configuring it from the panel / 在面板里配置(不用 setx,不用重启)
The Web UI panel has a Feishu block: App ID, App Secret, the custom-webhook URL and its signing secret, the
platform (feishu / lark), a default receive id, and the long-connection switch. Saving reconnects immediately -
there is no setx and no DSH restart, which used to be the only way in.
Values are resolved in this order, so a field the panel leaves alone keeps whatever config or environment provides:
- what the panel saved (
prefs.feishu), config.feishuin the plugin config,- the environment:
FEISHU_APP_ID/FEISHU_APP_SECRET/FEISHU_WEBHOOK_URL/FEISHU_WEBHOOK_SECRET/FEISHU_DOMAIN/FEISHU_TO/FEISHU_LONG_CONNECTION/FEISHU_VERIFICATION_TOKEN/FEISHU_ENCRYPT_KEY.
Two rules make that safe:
- A blank field is never sent by the panel's Save button, so saving something else cannot wipe a stored secret. Clearing is a separate, deliberate action (the Clear button sends explicit empties).
- Secrets never come back.
/stateand/prefsreport whether a secret is set, never its value - one redaction helper covers every response that carries prefs (a test found the leak that made this rule necessary).
feishu.domain is feishu (mainland China) or lark (international); an explicit URL also works. /state reports
savedFields and, per field, whether the value in force came from the panel, the config or the environment.
Tools, in one place: feishu_send_text (text or markdown, to + toType optional - chat_id by default,
open_id/user_id/email also accepted) and feishu_send_file (path, kind = file/image/audio/video) for talking;
feishu_doc_create / feishu_doc_read / feishu_doc_append for documents; feishu_sheet_create / feishu_sheet_read /
feishu_sheet_write for spreadsheets; feishu_bitable_create / feishu_bitable_write / feishu_bitable_read for
bitables; feishu_wiki_spaces / feishu_wiki_new / feishu_wiki_upload for knowledge bases (see below - those three
speak as you, the rest speak as the app); and feishu_cli / feishu_cli_help, which reach the entire official CLI -
every other Feishu feature, as you. A send always says which channel it used and gives the message_id, so "sent" is
not a guess.
A webhook-only setup cannot send files, and says exactly that rather than reporting a success that never arrived -
the custom bot API has no file message at all. Configure appId/appSecret for that.
/feishu (/飞书, /lark) reports what is configured - never the secret itself, only whether one is set - and
/feishu test [id] [type] sends a self-test.
Knowledge base (知识库): written as you, not as the app / 知识库:以「你本人」的身份写入
Every feishu_* tool speaks with a tenant_access_token, which is the application's identity. Feishu treats an app as a principal of its own: it owns its own cloud space, it is a member of no knowledge base, and nothing of a person's is visible to it. Measured on a real tenant:
- a document created with the app token lands in the app's private drive space, where no person can open it;
- a 知识库 refuses writes from a non-member, so
move_docs_to_wikicannot work at all; - adding an app to a space is an administrator action most individuals cannot perform.
So writes that must land in your space go through the official larksuite/cli instead, which holds a user_access_token - the same calls run as you, with your knowledge bases, folders and permissions already in scope. It is a different principal, not a different API.
| Tool | What it does |
|---|---|
feishu_wiki_spaces |
What this account can write to, and whether the user identity is authorised yet |
feishu_wiki_new |
Create a knowledge base |
feishu_wiki_upload |
One file, or a whole local folder tree: one node per top-level folder, skipping nodes and files already present, so a retry never duplicates |
One-time setup. The plugin stores no Feishu credentials of its own - lark-cli keeps them in the OS keychain, and lark.js only locates the binary, runs one command and parses the JSON it prints:
npx @larksuite/cli@latest install
lark-cli config init --new # creates a CLI-only app in your tenant; two clicks in the browser
lark-cli auth login --recommend # scan once - this is the "as you" identity
Uploads are idempotent by design: re-running feishu_wiki_upload over the same folder adds only what is missing, so a half-finished run is retried rather than duplicated. Lesson folders are flattened into their chapter on purpose - a course download of 5 chapter folders / 14 lessons / 49 documents becomes five nodes you can open, not a three-level tree you have to click through.
These tools complement the rest rather than replace them: sending messages, reading documents and editing sheets work fine as the app. Anything that must be owned by a person goes through the three above.
The whole lark-cli surface / 全部 lark-cli 能力
The dedicated feishu_* tools are the common paths, not the ceiling. The official CLI ships 200+ commands across 18 domains - messaging, docs, base, sheets, slides, calendar, mail, tasks, meetings, minutes, wiki, OKR, approval, attendance, contacts, drive, apps, markdown - and two tools make all of it reachable:
| Tool | What it does |
|---|---|
feishu_cli_help |
Prints the CLI's own help: no argument for the domain list, docs for a domain, wiki +node-create for one command's flags. This is how a command is discovered rather than guessed. |
feishu_cli |
Runs any command as the person who authorised the CLI, e.g. args="calendar +agenda" or args="docs +search --query 周报" or args="task +get-my-tasks". --json is added automatically; raw=true returns text. |
Why a bridge and not 200 tools: 200 schemas would ride in every prompt, and the list would be wrong the first time lark-cli ships a domain. The CLI stays the authority on what exists; the plugin only adds the identity, the error envelope and the guard rails.
Three behaviours worth knowing:
- No shell anywhere. The command line is tokenised in-process and passed as argv, so a title with a space, an
&or an empty string reaches the CLI exactly as typed. - Interactive commands are refused, not run:
auth login,config init/removeand friends wait on a browser round-trip, which inside a tool call is a hang until the timeout. Run those once in a terminal. - Destructive commands need a second word. Anything carrying
--yes(deletes) is refused unlessconfirmDanger: trueis passed, because a model that types--yesis not the same thing as a person who agreed to it.
Every endpoint and algorithm here was read from the official @larksuiteoapi/node-sdk 1.75.0 source, not recalled:
messages are POST /open-apis/im/v1/messages?receive_id_type=…, the token is
POST /open-apis/auth/v3/tenant_access_token/internal, media is POST /open-apis/im/v1/images and /files, an event's
AES key is sha256(encryptKey) with the first 16 bytes of the ciphertext as the IV, and the event signature is
sha256(timestamp + nonce + encryptKey + body) in hex (sha1 with the verification token when the event is
unencrypted). The custom-webhook signature is the trap of that API - HMAC-SHA256(key = timestamp + "\n" + secret, data = ""), base64 - and it is checked against an independent implementation's published test vector.
QQ bot (QQ 开放平台) / QQ 机器人
An official QQ bot, over the open platform's WebSocket gateway - outbound only, so it works from a plugin on your own machine with no public URL, exactly like the WeCom and Feishu long connections.
/qq # switch, credentials presence, connection state, last error
/qq on | off # connect / disconnect
Credentials go in the card's QQ block (or POST /prefs with {"qq":{...}}): appId, clientSecret, and sandbox for a
sandbox bot (which also uses a different API host). The secret is stored, never echoed back.
Three details that decide whether a QQ bot works at all, all handled here:
- The reply must quote the message it answers.
sendMessagesends the inboundidasmsg_id(plus amsg_seq), or the platform treats it as a proactive message - a different permission, usually a rejection. - C2C and group chats are different endpoints:
/v2/users/{user_openid}/messagesvs/v2/groups/{group_openid}/messages, and the openid comes from the event, not from anything you can guess. - The intent matters: group and C2C messages are gated behind
1 << 25; asking for more than the bot was granted is what makes an identify fail with 4014.
Verified against a live bot (appId 1903374412, display name PawDesk): the gateway answered READY, a private
chat message produced an answer through /v2/users/{openid}/messages, and an @ in a real group produced one through
/v2/groups/{group_openid}/messages. The allowlist blocked both the first private message and the first group message until
the chat was allowed - which is what it is for, and it is visible in the counters (blocked) rather than silent.
Multi-agent: one agent per conversation / 多 agent
Every conversation already had its own session and its own agent object; what this switch changes is what that agent mounts. With it on, a chat can mount its own agent preset - its own prompt, tools and model wiring - remembered on the peer record. With it off (the default) every chat mounts the host default, exactly as before.
/multiagent # the switch and this chat's preset
/multiagent on | off # off by default
/agent # the presets the host exposes, and which one this chat uses
/agent <preset id> # set it for this chat
/agent reset # back to the default
/agent model <provider>/<model> pins the model for that one conversation, and /agent model reset clears it.
With nothing set, the chat uses the host's own selection - there is no built-in default override, because one would move
every conversation onto a model nobody chose and show up as a billing surprise rather than a setting. The override obeys the
same switch as the presets, and /state's conversations[].agentModel proves which model a chat actually asked for.
`/agent model` with no argument prints the host's own selection, because that value is known to work - change the model half and keep the provider half. Switching provider is warned about when it is set, since the new route needs its own API key.
/agent model list asks the host's llm service and prints what is actually selectable. On this machine it reports two
providers with the same two models:
deepseek-official deepseek-account · 宿主在用
· deepseek-flash · deepseek-flash ← 宿主默认
· deepseek-v4-pro · deepseek-v4-pro
So the safe edit is a model name inside the provider the host already uses (deepseek-account/deepseek-v4-pro); the other
provider route needs its own DEEPSEEK_API_KEY.
On this machine the host's own selection is deepseek-account/deepseek-flash, and that is the value to copy: the provider
half is the part that carries credentials. Pinning deepseek-official/deepseek-chat instead fails with
no API key for provider route "deepseek-official" - a different provider route is a different account, not a different
model name. /agent model prints the host's value for exactly that reason, and switching provider is warned about when it is
set.
`/agent model list` asks the host's own `llm` service for every provider and its models and marks the one in use, so a model name never has to be copied from the Models page or guessed; `/agent model list ` narrows it.
Three statements the commands make rather than hide:
- A preset change is not a live swap. It applies when the session next creates an agent, and the reply says so.
- With the switch off,
/agent <id>refuses to look like it worked. It names the switch that is off, because storing a value that will never be read is worse than declining. - The preset list is read defensively (
listorall, ids or names). If a host exposes neither, setting by id still works but stays unverified until an agent is built - and the command prints that sentence itself.
The card carries the matching checkbox: 每个会话可挂自己的 agent 预设.
On this machine the host declares four presets - standard, ptc, minimal, cordis - and /agent minimal followed by
/new put "minimal" into GET /state's conversations[].agentPreset once the next message created the agent. That is the
whole point of the switch: two conversations can be running different presets at the same time, and the selection
survives restarts because it lives on the peer record.
Receiving: the long connection / 用长连接接收(不需要公网地址)
An app bot receives events over Feishu's long connection - a WebSocket the bot opens itself - so no public URL, no tunnel and no port forwarding are needed. The event route (POSTing events to a URL Feishu calls) is deliberately not implemented: it is the option that requires a public address.
Turn it on in the Feishu console, then restart DSH:
| Step | Where |
|---|---|
| Enable the bot | 开发者后台 → 你的应用 → 应用功能 → 机器人 → 启用 |
| Subscribe over the long connection | 开发者后台 → 事件与回调 → 订阅方式 → 使用长连接接收事件 |
| Permissions | at least im:message (send and receive); add the receive scopes the console asks for |
| Publish | 创建版本并发布 - changes do not take effect until a version is published |
Configuration: feishu.longConnection (default on; feishu.longConnection = false or FEISHU_LONG_CONNECTION=false
turns it off). It only connects when feishu.appId and feishu.appSecret are configured - a webhook-only setup has
nothing to connect with, and says so.
What happens to an inbound message: text and rich-text messages become a prompt for the model, prefixed like the other
channels; the answer is posted as a reply under the question (message_id), falling back to an ordinary send if the
reply is refused, and long answers are chunked. Two things are refused on purpose: the bot ignores its own messages
(sender_type: "app"), because answering them would wake itself in a loop, and a re-delivered event is answered only
once.
The protocol facts were read from the official SDK, not recalled - the handshake is POST {domain}/callback/ws/endpoint
(request {AppID, AppSecret}, response {code, data:{URL, ClientConfig}}, whose keys are capitalised and whose
intervals are in seconds), the frames are protobuf in the pbbp2 namespace (Frame 1 SeqID / 2 LogID /
3 service / 4 method / 5 headers / 6 payloadEncoding / 7 payloadType / 8 payload / 9 LogIDNew, Header
1 key / 2 value), an event is acknowledged by sending the received frame back with a biz_rt header and
{"code":200}, and a fragmented event is reassembled from message_id/sum/seq/trace_id with malformed metadata
rejected rather than silently corrupting the payload.
GET /state carries a feishu block (configuration, connection state, lastError, lastEventAt and the counters
feishuEvents / feishuAnswered / feishuIgnored / feishuErrors), and /feishu shows the same in a chat, including
why the long connection is not up when it is not.
Scheduled tasks / 定时任务
A task is a sentence plus a chat: it fires on its own and sends its result there. Three actions, four triggers, and one switch for the dangerous action:
/task # list, with next run time and last result
/task rm t3k9m2 # delete
/task off t3k9m2 # pause (/task on ... resumes)
/task command on # allow `command` tasks to run locally (default off)
| Action | What happens at the fire time |
|---|---|
message |
sends fixed text - no model call, no tokens |
prompt |
runs one ordinary agent turn in that chat and delivers the answer |
command |
runs a local command and sends its output (needs /task command on) |
Triggers accept English and Chinese interchangeably: daily 08:30 / 每天 08:30, weekly mon 09:00 / 每周一 09:00,
every 30m / 每 30 分钟, monthly 15 09:00 / 每月15日 09:00 (clamped to short months), once 2026-10-20 09:00. Tasks live in tasks.json under $DSH_HOME/dsh-wechat-media/,
separate from prefs; a task that has run once never fires again for the same window, and a once task switches
itself off afterwards.
Ask for one in a chat - "每天 8 点提醒我喝水" - and the agent creates it with task_add, targeting the chat that
asked. The three tools are the same three operations the /task commands type: task_add (trigger + action + text),
task_list (next run time and last result), task_remove (add disableOnly to pause instead of delete); /state
reports tasks: { count, enabled, nextAt, commandEnabled, ran, failed, items }.
What people actually schedule / 实际用法
| You want | The schedule | Action |
|---|---|---|
| A weather line before work | 每天 07:30 |
prompt: "用一句话说今天厦门天气,再给一句提醒" |
| A digest of a group at noon | daily 12:00 |
prompt: "总结今天群里值得看的消息,五条以内" |
| A weekly report on Monday | 每周一 09:00 |
prompt: "汇总上周完成的事,写成三条" |
| A monthly reminder | 每月1日 10:00 |
message: "该交房租了" |
| A one-off, then again next week | once 2026-10-20 09:00 + [+1周] [再次运行] |
any |
| Watch a folder every half hour | every 30m |
command (needs /task command on) |
prompt is the interesting one: it runs a normal agent turn, so every tool the agent has is available to it -
web search, files, Feishu. A scheduled prompt is therefore "ask me this every morning and do the work", not a
canned message.
The card / 面板
The Web UI card is the management half; creation works both there and in a chat.
| Control | When it appears | What it does |
|---|---|---|
time + action + text + 添加 |
always | create a task targeting the chat that last wrote |
[暂停] / [恢复] |
recurring tasks | stop and restart the schedule |
[+1 天 ▾] [再次运行] |
finished one-offs | move it forward one day / week / month and re-enable |
☐ 完成后再排一次 |
one-offs | re-arm automatically after each run (same clock time, next day) |
[删除] |
always | remove it |
☐ 允许 command 任务执行本机命令 |
always | the switch behind command tasks (default off) |
A finished one-off shows ✅ 已跑完(一次性任务,不能暂停) rather than a pause button that would do nothing: dueTasks
compares the last run against that occurrence's atMs, so re-arming is meaningful and a plain resume is not.
Two more behaviours worth knowing:
- Missed runs are skipped, not replayed. A task more than 60 minutes late (a laptop that slept, a bridge that was
stopped) is recorded as missed and the schedule moves on - the alternative is every missed
prompttask firing in the same second when the machine wakes.taskGraceMinutesin prefs tunes it;0means "always run, however late"./stateshowstasks.skippednext toranandfailed. - Any chat can be targeted.
task_addtakestransport(wechat/wecom/feishu) withto, so a task can be created for a group you have not just spoken to; without it, the default is still "the chat that asked".
Office documents / 办公文档
Four tools read, create and convert .docx / .xlsx / .pptx, and export PDF or page images. They are a thin,
honest surface over two programs already on this machine - the runtime's own Python (python-docx, openpyxl,
python-pptx) and the LibreOffice Kit CLI - so nothing is bundled here and nothing is installed at run time:
| Tool | Does |
|---|---|
office_read |
text and structure: paragraphs, tables, sheets with rows, slide texts |
office_write |
create from a JSON spec (below) |
office_convert |
.docx/.xlsx/.pptx → PDF, source untouched |
office_render |
pages (or a sheet range) → PNG, for a visual check or to send as a picture |
// .docx
{"title": "季度报告", "blocks": [
{"type": "heading", "level": 1, "text": "一、概述"},
{"type": "paragraph", "text": "正文"},
{"type": "bullets", "items": ["要点一", "要点二"]},
{"type": "table", "rows": [["项目", "数值"], ["收入", "120"]], "header": true}
]}
// .xlsx
{"sheets": [{"name": "报表", "rows": [["月份", "收入"], ["1月", 120]], "widths": [12, 10], "header": true}]}
// .pptx
{"slides": [{"title": "第一页", "bullets": ["背景", "结论"]}]}
/office prints which program each capability needs and whether it was found; /state.office carries the same
answer for a script. A missing program is named (找不到 Python(设置 officePython…)) rather than reported as a
broken document - the toolchain and the file are different problems and must not look alike.
Create a file, then send it: the bridge already has send_file for WeChat, WeCom and Feishu, so "做个 Excel 发我"
is office_write then send_file.
Relative paths land in officeDir, printed by /office:
/office # toolchain + the directory relative paths use
/office dir D:\报表\2026 # set it (also /prefs?officeDir=…, or DSH_OFFICE_DIR)
Empty means "the bridge's working directory" - workable, but forgettable, which is why /office always prints the
effective path instead of expecting anyone to remember it.
Desktop control (mouse, keyboard, screen) / 桌面控制
Seven tools can drive this machine's own mouse and keyboard, read the screen and manage windows. They are off by default and every one of them refuses until you arm the switch, because they are the only tools here that act on your screen instead of on the bridge:
/desktop on # arm (also: POST /dsh-wechat-media/prefs?desktopControl=true)
/desktop off # disarm
/desktop # toggle
| Tool | What it does |
|---|---|
desktop_screen |
virtual screen origin/size in physical pixels, monitor count, pointer position - call it first so coordinates are real pixels |
desktop_windows |
visible top-level windows: title, pid, rectangle, minimised |
desktop_focus |
bring the first window whose title contains a string to the front, restoring it if minimised |
desktop_screenshot |
PNG of the whole screen or a region into the shared inbox, path returned so it can be sent to the chat |
desktop_mouse |
move / click / double_click / right_click / middle_click / drag / scroll at physical pixels |
desktop_type |
type literal text (Unicode scan codes, so Chinese arrives as typed) |
desktop_key |
press a chord such as ctrl+s, alt+tab, up |
Three things are deliberate:
- Off unless armed. The switch is checked in one wrapper (
desktopTool) that is the only way to define one of these tools, so a new desktop tool cannot forget it./statereportsdesktop: { enabled, supported, reason }. - Nothing is interpolated into PowerShell. Coordinates are integers; text and window titles travel as
base64 and are decoded by PowerShell, so a window title containing
'; Remove-Item …is data, not code. - Windows only, for now. The scripts use
user32.dll,System.Windows.FormsandSystem.Drawing; on any other platform the tools refuse and say which platform they found.
desktop_screen also reports the size of the INPUT struct the C# compiled, so a wrong layout (which makes
SendInput silently do nothing) is visible rather than guessed at.
Clipboard / 剪贴板
Two tools move things through the clipboard, which is how "我复制了一段…" becomes something the model can read, and how
a result ends up where the next Ctrl+V will find it:
| Tool | What it does |
|---|---|
clipboard_read |
the copied text (capped at 200k characters) and the file list currently on the clipboard |
clipboard_write |
put text on the clipboard, or paths (comma / newline separated) as a file-drop list (Explorer pastes those as files) |
/clipboard on|off|status # on by default; /clip 也行
- On by default, with an off switch. A clipboard can hold a password, so
/clipboard offis one command away and both tools refuse immediately once it is set. The switch is checked in one place, before any script runs. - Files win over text when both are given: a clipboard holds one thing, and a file has no other way to be pasted.
- Windows goes through WinForms on an STA thread (
powershell.exe -STA), which is what makesSetText/GetTextreliable from a service-like process. macOS usespbcopy/pbpaste, Linuxwl-copy/wl-paste; a file list is Windows-only and the other platforms say so instead of silently copying nothing. - The protocol is base64, and that is not decoration. The first version printed JSON straight to stdout and every
Chinese character came back as
?, becausepowershell.exewrites stdout in the console codepage. Each script now emits the base64 of its UTF-8 JSON and the runner decodes it -剪贴板自检round-trips unchanged, and a test drives the fake runner with exactly that string. - The size cap is applied inside the PowerShell script, so a 20 MB clipboard never travels through stdout to then be thrown away.
SSH / 远程命令
Three tools drive the platform's own OpenSSH client - the binaries ship with Windows 10/11, honour ~/.ssh/config and
known_hosts, and keep the private key exactly where it already is. Nothing here reads a key's contents; only its path.
| Tool | What it does |
|---|---|
ssh_exec |
run one command on a host, return exit code + stdout + stderr + timing |
ssh_upload |
copy a local file (or directory, recursive) to the host, via scp |
ssh_download |
copy a file (or directory) from the host |
/ssh # status: switch + host list
/ssh on | off # arm / disarm (off by default)
/ssh add nas root@192.168.1.10:22 [C:\Users\me\.ssh\id_ed25519]
/ssh remove nas
Hosts live in one prefs block (prefs.ssh), so the card, /state and the tools read the same list; a tool also accepts
an ad-hoc user@host[:port] without saving it.
Three decisions, each because the alternative fails silently:
- Key-based only, always
BatchMode=yes. A password cannot be typed into a service-like process, so an auth problem must fail immediately with the client's own message instead of hanging the turn. No password is ever stored. StrictHostKeyChecking=accept-new. A new host key is learned once and a changed one is refused:nowould accept a man-in-the-middle,yeswould make the first connection impossible.- Off until
/ssh on. Running commands on someone's servers is not a default-on capability, and the gate is checked before any process starts.
scp gets -P for the port (its -p means "preserve times"), the command is placed after -- so a remote command
starting with - is not read as an option, and captured output is capped at 40k characters with an explicit
"已截断" marker rather than a silent cut.
Serial: flash a board and read it back / 串口烧录
Three tools drive the toolchain people already have - ESP-IDF's idf.py/esptool, or avrdude for AVR - instead of
reimplementing a bootloader protocol, because that is how a tool ends up bricking a board.
| Tool | What it does |
|---|---|
serial_ports |
the COM ports with the device name behind each (COM3 vs COM4 means nothing without "Silicon Labs CP210x"), plus which flashers were found |
serial_flash |
flash: flasher=idf runs idf.py -p COMx flash in an ESP-IDF project (offsets come from its sdkconfig); esptool writes one .bin at an offset; avrdude flashes a .hex |
serial_monitor |
read what the board prints for N seconds (default 8) and return it |
An STC (8051) board uses flasher=stcgal: STC speaks its own ISP protocol, so esptool cannot touch it. Pass
chip=stc8g (or leave it auto); stcgal passes -A dtr, which cold-starts the MCU over DTR - measured on an STC8H1K08,
it handshakes without unplugging the board. stcgal is found on PATH or inside any ESP-IDF python env, because that is
where pip install stcgal puts it on a machine that already has ESP-IDF. AVR boards use
flasher=avrdude, and an ESP-IDF project uses flasher=idf - which runs inside export.ps1, because idf.py cannot see
cmake otherwise.
/serial # switch, baud, default port, ports, toolchain
/serial on | off # off by default: flashing writes a board's flash
/serial baud 460800
/serial port COM3
Then, from the VS Code panel with the project open: "把这个项目烧到 COM3" - the turn runs in the open f
…
链接
同类插件
xmanrui/dsh-im★ 3919
通过二维码或机器人凭据将 IM 机器人接入 DeepSeek Harness(支持飞书、微信、钉钉、企业微信、QQ、Slack、Telegram、Discord 和 WhatsApp 共 9 种渠道)。
shaobeichen/dsh-pocket★ 3228
手机远程访问 DSH Web 界面:扫码即用局域网或公网(cloudflared 隧道)访问,实时同屏、移动端适配布局,带设置页管理。
c1overzz/dsh-bili-scroll★ 1490
让你的 DSH 自己刷 B站 —— 读字幕原文挑内容、写日报,遇到值得看的会发评论 @ 你。
OpenPetsHQ/openpets#dsh★ 1425
将 DeepSeek Harness 的生命周期状态、错误与审批请求,桥接到本地运行的 OpenPets 桌面伙伴。
inclusionAI/Avernet#deepseek-harness-channel-bcn★ 612
通过 WebSocket V2 将 DeepSeek Harness 接入 Avernet Bot 协作网络,支持自动注册、Agent 会话隔离、工具调用事件和多 Bot 路由工具。
zaofan-make/dsh-qqbot★ 289
QQ 官方机器人通道(tencent-connect/dsh-qqbot 的增强 fork):群/私聊ai陪聊、富媒体收发、表情包打标入库+检索发图、入群审批/禁言/群发、定时唤醒、QQ 远程审批与提问卡、互动按钮卡、多账号多实例、扩展接口、群友记忆注入、按消息价值唤醒省token、上下文自动压缩、悬浮球设置面板。
社区评论
评论公开保存在 GitHub Discussions。加载评论会连接 GitHub 和 Giscus;发表内容需要 GitHub 账号。