DeepSeek Harness 插件

dsh-wecom

dsh-wecom: a WeCom AI Bot channel for DeepSeek Harness — each chat runs a persistent, preset-backed agent over the official long connection.(英文原文)

跳到安装方式

来源信息

GitHub 仓库
TtTRz/dsh-wecom
最近更新
2026年8月21日
分类
远程与移动
GitHub stars
3
载体类型
plugin
目录证据
上游声明已找到 dsh.bundle
证据路径
package.json#dsh.bundle
核对版本
0.1.0-rc.8
上游核对日期
2026-08-20

该证据由上游目录提供。本站没有安装、运行或安全审核这个插件。

安装

默认先复制一段 Prompt,让 Agent 读 GitHub 仓库和源码;需要自己装时再切到命令。

复制这段 Prompt,发给 DSH、Codex 或其他 Agent,让它先读 GitHub 仓库和源码。

请先不要安装或执行任何命令。阅读这个插件的 GitHub 仓库、README 和关键源码,然后用清楚、直接的方式回答以下问题,帮助我判断它是否适合我的需求:

1. 这个插件是什么,解决什么问题;
2. 适合哪些用户和典型使用场景;
3. 安装后如何使用,并给出一个最小使用示例;
4. 有哪些已知限制,以及隐私、安全、兼容性或维护风险;
5. 给出“推荐 / 有条件推荐 / 不推荐”的明确建议和理由。

请区分仓库明确说明、根据源码推断和未知信息。证据不足时请明确说明,不要猜测或照抄 README。

GitHub:https://github.com/TtTRz/dsh-wecom
插件名:dsh-wecom
作者:TtTRz

检查来源文件

安装前先看这个插件目录里的 README 和其他文件。

文件资源管理器3 个文件
README.md来源说明 · 只读预览

dsh-wecom

> WeCom AI Bot channel for DeepSeek Harness — every single/group chat is a real agent with tools, streaming replies, thinking cards, and a live status panel.

![npm version](https://www.npmjs.com/package/dsh-wecom) ![license](LICENSE) ![node](https://nodejs.org) ![downloads](https://www.npmjs.com/package/dsh-wecom)

Wire a WeCom AI Bot to DeepSeek Harness over the official long connection. Each conversation is backed by a persistent Harness agent with tools — not a bare chat loop.

✨ Features

  • 🤖 One conversation = one agent — mounts a preset (default standard) in its scoped setup, so it has the preset's tools (bash, read, edit, skills, …) and persona. Session ids are derived deterministically (sha256(namespace · scope · peer), no raw userid) and survive restarts via sessionPersistence.
  • 🖼️ Media support — images are downloaded, decrypted with the official SDK, and attached when the model can view them; files and videos land in the agent's workspace for its tools.
  • Streaming replies — token-level text streaming, native <think> reasoning card ("思考过程"), and a compact tool-call activity list inside the card.
  • 🛡️ Access policyopen / allowlist / disabled per channel (dm and group, gated by chatid for groups).
  • 🧹 Housekeeping — msgid dedup, per-conversation queues, a global concurrency cap, and per-turn timeouts that cancel the turn instead of leaving zombies.
  • 📡 Self-healing — when the long connection dies (kicked, auth failure, replaced client), the channel restarts itself after restartIntervalMs (default 10s).
  • 🩺 Observability — a host-wide wecomChannelStatus service, a JSON route GET /api/wecom/status, a sidebar action with a live connection dot, and a floating status panel.
  • 💬 Bot commands/ping /help /status /stop /compact /new.

🚀 Quick Start

dsh plugin --profile web add dsh-wecom

export WECOM_BOT_ID='your-bot-id'
export WECOM_BOT_SECRET='your-bot-secret'   # dev only — in production use the credential service

dsh web

Once the log prints WeCom AI Bot authenticated, send /ping and expect pong.

To persist across restarts: write WECOM_BOT_ID into ~/.dsh/.env and WECOM_BOT_SECRET into ~/.dsh/.credentials.yaml (reference WECOM_BOT_SECRET). DSH_WECOM_CWD overrides the agent working directory.

📦 Install from npm

The published package ships prebuilt dist/ — no build scripts run on install:

dsh plugin --profile web add dsh-wecom          # latest
dsh plugin --profile web add dsh-wecom@0.1.17   # pin a version

Upgrade a pinned install the same way (dsh-wecom@<newer version>). After installing, set WECOM_BOT_ID / WECOM_BOT_SECRET (see Quick Start) and restart dsh web.

📦 Install from source

Git install (pin the commit — build scripts run on your machine):

dsh plugin --profile web add github:TtTRz/dsh-wecom#<sha>

> pnpm ≥10 refuses build scripts of git dependencies (ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED): add the package key pnpm prints to that profile's pnpm-workspace.yaml, then re-run. Prefer the prebuilt tarball to avoid authorization entirely:

git clone https://github.com/TtTRz/dsh-wecom && cd dsh-wecom
npm install && npm pack                # produces dsh-wecom-0.1.5.tgz
dsh plugin --profile web add ./dsh-wecom-0.1.5.tgz

Local checkout: dsh plugin --profile web add /absolute/path/to/dsh-wecom (links the source, no build scripts — run npm install && npm run build first).

⚙️ Configuration

Tune the mounted row in ~/.dsh/profiles/web/cordis.patch.yml:

- id: wecom-channel
  name: dsh-wecom
  config:
    botId: !!js process.env.WECOM_BOT_ID
    credentialName: WECOM_BOT_SECRET
    namespace: default
    # cwd is optional: defaults to ~/.wecom-sessions (DSH_WECOM_CWD overrides)
    cwd: /data/wecom
    preset: standard
    dmPolicy: open
    dmAllowlist: []
    groupPolicy: allowlist
    groupAllowlist: [wr_your_group_chatid]
    greeting: Hello, I am an assistant.
FieldDefaultMeaning
cwd~/.wecom-sessionsAgent working directory: WeCom sessions, uploads (.wecom-uploads/), and .dsh-wecom-state.json live here; the sidebar workspace "WeCom" is claimed on it. DSH_WECOM_CWD overrides it. Must be absolute
presetstandardPreset mounted into each conversation agent
provider / modelunsetFixed model route for every WeCom conversation; both must be set together. When unset, new conversations use the harness default selection and resumed conversations inherit their last logged model
dmPolicy / groupPolicyopenopen / allowlist / disabled
dmAllowlist[]Single-chat userid allowlist
groupAllowlist[]Group-chat chatid allowlist
instructionsenterprise-chat guidanceInstruction section layered on the persona every turn
imageModeautoauto attaches images when the model can view them; always / never force it
streamingtrueStream model text token-by-token; false sends only the ack + final answer
streamFlushMs250Cadence (ms) for flushing accumulated streamed text
showReasoningtrueWrap model reasoning in WeCom's native <think> card
showToolCallstrueRender a compact tool-call activity list inside the <think> card
maxConcurrent4Global cap on concurrent turns
turnTimeoutMs300000Per-turn timeout (cancels the turn)

💬 Commands

CommandWhat it does
/pingConnectivity check
/helpList commands
/statusSession status
/stopCancel the current generation
/compactSummarize older history into a summary to save context
/newStart a fresh conversation (history kept; next message opens a new session)

🏗️ How it works

WeCom AI Bot
   │  WebSocket long connection (wss://openws.work.weixin.qq.com)
   ▼
dsh-wecom (host plugin)
   │  msgid dedup → access policy → per-conversation queue → global concurrency cap
   │  create/resume agent (setup mounts the preset + a persistent instruction section)
   │  agent.followup(userMessage) → await agent.whenIdle()
   │  on timeout → agent.cancel(), no zombie turn left behind
   ▼
persistent per-conversation Harness agent (sessionPersistence)

Why not a bare agents.create: the preset is mounted in setup (a bare agent has no tools), instructions ride systemPrompt.section() every turn, timeouts cancel so the next message is never stuck, and groups are gated by chatid allowlist with a global maxConcurrent bound.

🧩 Integrations

  • Status servicectx.get('wecomChannelStatus').snapshot() returns plain scalars (connected, stopping, conversations, authenticatedAt, lastError) for dashboards and UI plugins.
  • REST routeGET /api/wecom/status (JSON, registered when a web server is present); POST /api/wecom/restart reconnects the channel.
  • Browser UI — the bundled client half (served as /plugins/dsh-wecom/client.js, no frontend rebuild) adds a sidebar action with a live connection dot and a floating status panel that polls every five seconds.

🧪 Development

npm install --legacy-peer-deps
npm run check   # biome + typecheck + test + build

📄 License

[MIT](LICENSE)