dsh-agent-chat
Manifest validTurn-injection message channel between DSH agents on two machines: messages land in a log and are injected as context at the next agent step.
dsh-agent-chat
让两台机器上的 DSH agent 互相留言。
DSH 的 agent 不是常驻进程 —— 只在有人给它发消息时才醒着。所以这不是即时通讯, 而是回合注入式:消息先落盘,等 agent 下一次「开步」时再把未读的拼进上下文。
- 插件类型:DSH host plugin(web profile),无客户端半边
- 依赖:仅 node 内置模块
- 状态:自用插件,已在两台机器(Windows 笔记本 ↔ NAS)上跑通
它怎么工作
本机 agent ──发消息──▶ 本地日志 + POST 对端 /agent-chat/send
│
本机 agent ◀──注入上下文──── 拉取对端 /agent-chat/messages(带游标,不重复)
- 本插件把消息落进本地日志(默认
<workspace>/.agent-chat/chat.log.jsonl); - 后台轮询对端的
/agent-chat/messages,把新消息拉进本地日志(带游标,不重复); - 每次 agent 要开新步时(
agent/pre-step),把尚未注入过的消息拼成一块上下文追加进本次对话; - 自己发出的消息同时 POST 给对端的
/agent-chat/send。
HTTP 路由
都挂在 DSH 自己的 webServer 上:
| 方法 | 路径 | 用途 |
|---|---|---|
| GET | /agent-chat/health.json | 探针:游标、待注入数、对端可达性(故意保持开放,方便监控) |
| GET | /agent-chat/messages?since=<id> | 自 since 之后的消息(对端轮询用) |
| POST | /agent-chat/send | 投入一条消息 {from,text,ts} |
| GET | /agent-chat/log?limit=50 | 看最近的消息(人用) |
安装
dsh plugin --profile web add github:harmless0819-dev/dsh-agent-chat
重启 dsh web 后生效。
配置
在 profile 的 cordis.patch.yml 里给该行加 config(整行替换,不是深合并):
- id: dsh-agent-chat
name: dsh-agent-chat
config:
selfLabel: "laptop" # 本机在对话里的名字
peerBase: "http://192.168.1.100:6061" # 对端基础地址
enabled: true
pollMs: 3000
maxInject: 5 # 每次注入最多几条
logFile: "D:/deepseek/logs/agent-chat.jsonl"
tokenFile: "C:/Users/<you>/.agent-chat/token"
| 键 | 默认 | 说明 |
|---|---|---|
selfLabel | 'laptop' | 本机在对话里的名字 |
peerBase | '' | 对端基础地址;空则只收不发 |
enabled | true | 是否启用后台轮询 |
pollMs | 3000 | 轮询间隔(最小 1000) |
maxInject | 5 | 每次注入最多几条 |
logFile | <workspace>/.agent-chat/chat.log.jsonl | 消息日志路径 |
token | — | 共享密钥(优先级最高) |
tokenFile | ~/.agent-chat/token | 密钥文件,每条请求重读 ⇒ 可热轮换 |
⚠️ 安全
/agent-chat/send 会把任意文本注入 agent 的下一回合 —— 也就是说,能连上这个端口的主机
就能给 agent 下指令。如果你的部署把 HTTP 面暴露到 LAN(甚至叠了路由器端口转发),
必须配 token。
取密钥的顺序:cfg.token → 环境变量 DSH_AGENT_CHAT_TOKEN → tokenFile。
三者都空时退回旧行为(开放),但启动日志会告警 auth=open。
health.json 故意保持开放(只用于探活,且已去掉日志路径)。
请求需带 x-agent-chat-token: <token> 或 Authorization: Bearer <token>。
测试
node test-harness.mjs
离线跑(mock ctx),不碰 profile、不启服务。覆盖:无 token/错 token 返回 401、
对 token 返回 200、密钥热轮换无需重启、出站轮询带 token、disposer 注销路由。
License
MIT
Comments
Loading…
From the same category
by awesome-dsh-plugin
A curated list of plugins for DeepSeek Harness (dsh) · DeepSeek Harness 插件精选列表
★ 18.2k
CC0-1.0
Python
Oct 9, 2026
by 0xsline
DeepSeek Harness (DSH) ecosystem: curated plugins, tools, and infrastructure from dsh-external/hub and the public dsh-plugin topic.
★ 1.2k
CC0-1.0
Python
Oct 10, 2026
by pax-beehive
Open-source CLI, schemas, resolver, and DSH agent tools for DSH Plugin Hub
★ 458
MIT
TypeScript
Oct 6, 2026
by xiajiajun516
DeepSeek Harness (DSH) backup & restore plugin — export, import, migrate and sync your complete DSH configuration, plugins, MCP servers, skills and workspace. One-click migration to another machine.
★ 172
MIT
TypeScript
Oct 8, 2026
dsh plugin --profile web add dsh-config-managerby yjh051108
推荐组件(非必须):DeepSeek Harness 运行时注入器;已随 dsh-routing-suite 单仓库化保留,本仓库继续维护/发布。
★ 164
TypeScript
Sep 18, 2026
dsh plugin --profile web add @dsh-external/dsh-super-injectorby jigjoy-ai
A CLI that turns a goal into a pull request - and a sandbox for testing concurrent AI coding agents on the Mozaik runtime.
★ 124
MIT
TypeScript
Oct 2, 2026