dshbase

插件目录 / Automation / dsh-wecom

dsh-wecom

已验证 · 实测可装 TtTRz

✓ 持续维护 基于 11 个官方 DSH 包 纯 TypeScript

查看 GitHub ↗ ← 返回插件目录

3Stars
0Forks
0未关闭 issue
TypeScript语言
2026-08-14最近推送
跨平台平台

功能简介

dsh-wecom — DSH 插件(编排)

我们的评价
可用 — 实测通过,早期项目

dsh-wecom — DSH 插件(编排) 实测能干净安装、正常启动。早期项目,但功能可用。

「已验证」表示我们的自动化 CI 在干净 profile 里实际执行了 dsh plugin add 并启动成功——仅此而已。功能描述与版本兼容性均为作者声明。这不是安全审计,也不代表对第三方代码的背书。

README

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
license
node
downloads

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 [email protected]   # 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.
Field Default Meaning
cwd ~/.wecom-sessions Agent 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
preset standard Preset mounted into each conversation agent
provider / model unset Fixed 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 / groupPolicy open open / allowlist / disabled
dmAllowlist [] Single-chat userid allowlist
groupAllowlist [] Group-chat chatid allowlist
instructions enterprise-chat guidance Instruction section layered on the persona every turn
imageMode auto auto attaches images when the model can view them; always / never force it
streaming true Stream model text token-by-token; false sends only the ack + final answer
streamFlushMs 250 Cadence (ms) for flushing accumulated streamed text
showReasoning true Wrap model reasoning in WeCom's native <think> card
showToolCalls true Render a compact tool-call activity list inside the <think> card
maxConcurrent 4 Global cap on concurrent turns
turnTimeoutMs 300000 Per-turn timeout (cancels the turn)

💬 Commands

Command What it does
/ping Connectivity check
/help List commands
/status Session status
/stop Cancel the current generation
/compact Summarize older history into a summary to save context
/new Start 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

安装

🧩 让 Agent 自动装(推荐)

装一次目录插件,之后本站所有插件都能让 DeepSeek Harness 自动找、自动装:

dsh plugin add dshbase-catalog

然后对 agent 说「帮我装 dsh-wecom」,它会在目录里找到并自动安装。文档:dshbase-catalog · 已验证场景包

Web profile:

dsh plugin --profile web add dsh-wecom

Headless(CLI)profile:

dsh plugin --profile headless add dsh-wecom

包信息

npm:dsh-wecom · 版本 · 实测环境 dsh 0.1.0-rc.6

实测报告

端到端验证通过:dsh 0.1.0-rc.6 上 L1 安装 + L2 加载 + L3 运行问答。

使用场景

自动化一项重复工作——调度、串联任务或响应事件——不用你亲手启动。

适合谁

有周期性工作、想 cron 式无人值守而非手动触发的人。

二次开发建议

触发器和任务模板是缝——加事件驱动或文件监听触发,以及更丰富的流程编排。

安全:尚未扫描——我们的每日静态扫描将很快覆盖它。

分享徽章

Automation 里更多

浏览全部 7795 个插件 →