deepseek-harness
deepseek-ai
DeepSeek Harness: Everything is a Plugin.
PROJECT TOPICS
PROJECT README
English | 简体中文
为 DeepSeek Harness (dsh) 提供多 IM 通道接入的网关插件:钉钉 / QQ / 个人微信,支持扫码绑定与流式回复。
ctx.imGateway 核心:会话管理、斜杠命令、流式回复、状态广播。qqbot-nodejs SDK),私聊(c2c)+ 群聊,扫码绑定机器人(免去开放平台手动创建),流式消息(c2c)。/help、/model、/status、/new、/reset、/stop 等(见下文)。需要 DeepSeek Harness (dsh)——本插件是标准 dsh bundle,通过官方插件通道安装。
dsh plugin --profile web add @lijian-ui/dsh-im-gateway
npm 包自带预构建的 lib/ — 无需构建授权(不需要 allowBuilds)。
npm pack @lijian-ui/dsh-im-gateway
dsh plugin --profile web add ./dsh-im-gateway-0.1.0.tgz
dsh plugin --profile web add github:lijian-ui/dsh-im-gateway
Git 安装拉取的是源码,首次安装需要批准包的
prepare构建脚本(pnpm ≥ 10)。按提示把包键加进 profile 的pnpm-workspace.yaml→allowBuilds即可。优先用 npm / tarball 方式可跳过此步。
dsh --profile web --dump-config # 应看到 "# == @lijian-ui/dsh-im-gateway" 配置层
dsh --profile web # 启动后浏览器打开设置 → 「IM 通道」
配置存储在
~/.dsh/settings.yaml(im-gateway.channels)。在 UI 保存配置会热重载通道(无需重启)。
在任何 IM 通道里发给机器人:
| 命令 | 说明 |
|---|---|
/help |
列出可用命令 |
/model |
用 emoji 编号列出模型;/model 1 或 /model <名称> 切换(无会话时 → 设为下次会话默认模型) |
/status |
通道 / cwd / 当前模型 / agent 状态 |
/new /reset /clear |
开启全新会话 |
/stop |
中止当前回复 |
所有配置都可在设置页编辑;底层 schema 在 ~/.dsh/settings.yaml:
im-gateway:
channels:
- id: dingtalk-main
type: dingtalk
name: 主机器人
enabled: true
config:
clientId: "..."
clientSecret: "..."
# callbackBaseUrl, appId, botAppId, baseUrl, botId, cdnBaseUrl, pollIntervalMs...
| 字段 | 适用渠道 | 含义 |
|---|---|---|
clientId / clientSecret |
dingtalk | 钉钉应用 key / secret(Stream 模式) |
appId / clientSecret |
QQ 开放平台凭据(扫码绑定所得) | |
token / botId / baseUrl / cdnBaseUrl |
weixin | iLink 凭据(扫码绑定所得) |
enabled |
全部 | 该实例是否连接 |
IM 客户端 ──► 通道适配器 (dingtalk / qq / weixin)
│ ImInboundMessage
▼
ctx.imGateway(核心)
│ ensureSession → agent.followup
▼
dsh harness agent(LLM 循环)
│ 会话事件 (turn/start, assistant/chunk, tool/call, turn/end)
▼
流式回复 → 适配器 beginStream/streamText/endStream
│ (AI 卡片 / stream_messages / 纯文本回退)
▼
IM 客户端
src/index.ts(apply)、src/gateway/(核心 + 斜杠命令)、src/channels/(dingtalk / qq / weixin + 协议助手)、src/remote.ts(设置页的 Typert RPC)、src/sync.ts(保存配置后热重载通道)。src/client/ — 设置页「IM 通道」(添加/编辑弹窗 + 扫码登录 + 状态点)。channels 是数组,同一 type 可多次出现。第三方可以不 fork 直接注册自己的通道:
import { ImChannelAdapter } from '@lijian-ui/dsh-im-gateway' // peerDependency 引用核心
class MyChannelAdapter implements ImChannelAdapter { /* ... */ }
ctx.imGateway.registerChannel(myAdapter)
git clone https://github.com/lijian-ui/dsh-im-gateway.git
cd dsh-im-gateway
npm install
npm run build # tsdown → lib/
npm run watch # 保存自动重编译
npm run typecheck
本地 link 进 dsh profile:
dsh plugin --profile web add ./ # 从本目录安装(link)
Windows 注意:dsh 子进程从
package.json的main加载lib/index.js— 修改src/后必须npm run build再重启 dsh 进程(它的 require 缓存会保留旧模块)。
ctx.logger.* 缓存进内存。本插件在 apply 时注册了 console exporter,日志会出现在 dsh 子进程 stderr(桌面壳会加 [dsh] 前缀)。turn/end 无条件收流(0.1.x 已修复)。stream_messages;微信本身没有流式概念)。这是设计行为。MIT © lijian-ui
为 DeepSeek Harness 构建 — 独立插件,与 DeepSeek 无隶属或背书关系。
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: desktop-app。