Back to home

Culeot

dsh-weixin-bridge

test

Stars
0
Language
JavaScript
Created
Aug 15, 2026
Updated
Aug 15, 2026

Introduction

dsh-weixin-bridge

Chat with your local DeepSeek Harness (DSH) from WeChat. Send a message on your phone; DSH runs it as a real task on your computer (tools, files, commands); the reply comes back to WeChat.

No public IP needed, no desktop WeChat, nothing to install on your phone — it talks through the official WeChat iLink channel (the same API WeChat's own bots use) with a QR-code login.

No API key needed. Replies are produced by your local DSH in agent mode — it reuses the model already configured in DSH. You never paste a DeepSeek/OpenAI key into this tool.

How it works

WeChat message
  → bridge polls the official iLink channel (long-polling)
  → task runs through `dsh --profile headless "message"` (a DSH dialog / agent on your PC)
  → the agent's reply is sent back to WeChat
  • Context kept: the bridge remembers the last 20 turns, so the bot keeps one continuous dialog instead of forgetting everything each message.
  • Progress feedback: you immediately get "⏳ processing…" and periodic updates while a task runs — no silent waiting.
  • Only you: only the WeChat account that scanned the QR code can trigger tasks.

Installation guide (from zero)

  1. Install Node.js >= 20https://nodejs.org
  2. Install DeepSeek Harness (global, so its bin.js lives under Node's node_modules):
    npm install -g @deepseek-ai/dsh
    
    Then verify the one-shot mode works:
    dsh --profile headless "hi"
    # should print a reply; if it errors, check the headless profile / your DSH install
    

    If DSH is installed elsewhere, set DSH_BIN to its dsh/lib/bin.js path before starting the bridge.

  3. Install this tool:
    npm install -g dsh-weixin-bridge
    # or clone https://github.com/Culeot/dsh-weixin-bridge and npm install
    
  4. Log in with WeChat (one time):
    node login.js
    # a QR code appears → scan with WeChat → confirm → the bot is linked
    
  5. Start the bridge:
    node bridge.js
    # logs "bridge started, waiting for WeChat messages"
    
  6. Test: in WeChat, message the bot — "hi", or "list what's in C:\ai项目". You should get "⏳ processing…" then the reply.

Configuration

Edit the top of bridge.js:

ConstantDefaultMeaning
AGENT_CWDC:/ai项目working directory for agent tasks (change to your own)
AGENT_TIMEOUT300sper-task timeout
POLL_INTERVAL5sWeChat poll interval
MAX_HISTORY20conversation turns kept for context

The bot token is saved to account.json after login (git-ignored).

Run at startup (optional)

Register in the registry:

HKCU\Software\Microsoft\Windows\CurrentVersion\Run
WeixinBridge = powershell -WindowStyle Hidden -Command "Start-Process node -ArgumentList 'C:\path\to\bridge.js' -WindowStyle Hidden"

Troubleshooting

  • Bot doesn't reply: check bridge.log in the project folder; most issues are dsh --profile headless failing — run that command manually first.
  • "找不到 DSH / DSH not found": DSH isn't reachable from this Node — install it globally or set DSH_BIN.
  • QR code expired: re-run node login.js.
  • Slow replies: headless starts a fresh DSH process per message (cold start takes a few seconds); progress messages tell you it's working.
  • Model config: the agent uses whatever model DSH is configured with (set it in DSH, e.g. deepseek-v4-flash). No key needed here.

Security notes

  • Only the account that scanned the QR code can trigger tasks — nobody else's messages are acted on.
  • A task can execute commands on the PC. Keep the token private: account.json and bridge.log are git-ignored.
  • Uses the official WeChat iLink API; no third-party WeChat protocol involved.

Files

FilePurpose
bridge.jsthe bridge: poll → headless task → reply (with context & progress)
login.jsQR-code login, saves the bot account

License

MIT