@kadaliao/dsh-bots 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +79 -4
- package/README.zh-CN.md +65 -4
- package/client.js +1372 -43
- package/index.js +894 -22
- package/lib/channels.mjs +32 -0
- package/lib/memory.mjs +508 -0
- package/lib/models.mjs +250 -0
- package/lib/prices.mjs +149 -0
- package/lib/settings.mjs +142 -0
- package/lib/skills.mjs +15 -5
- package/lib/store.mjs +23 -3
- package/lib/topics.mjs +103 -0
- package/lib/usage.mjs +267 -0
- package/locale/en.json +1 -1
- package/locale/zh.json +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
English | [简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
5
|
Grok-style bots inside DeepSeek Harness: a team of bots that work together. Each bot has its own **avatar,
|
|
6
|
-
persona, skills, abilities, apps
|
|
6
|
+
persona, model, skills, abilities, apps, scheduled tasks and memory**, and its own conversation. Bots **message each
|
|
7
7
|
other**, and one of them, the **dispatcher**, splits the work, hands it out, follows up and reports back.
|
|
8
8
|
|
|
9
9
|
It is built for two situations:
|
|
@@ -72,6 +72,8 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
|
|
|
72
72
|
`~/.claude/skills`); linked, not copied, so editing the folder is enough;
|
|
73
73
|
- a skill name is used once per bot: adding one that is already there is skipped, and importing again
|
|
74
74
|
from the same GitHub folder updates it in place;
|
|
75
|
+
- up to 50 skills can be on at once (each one on is in the bot's prompt every turn); a bot keeps up to
|
|
76
|
+
200 in all, so past 50 new ones come in switched off;
|
|
75
77
|
- **Let the bot write it**: describe what you need in a sentence; the bot writes it with skill-creator
|
|
76
78
|
and saves it to itself;
|
|
77
79
|
- writing one by hand is still possible, as the last resort.
|
|
@@ -98,6 +100,65 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
|
|
|
98
100
|
otherwise the logo from the vendor's site or repository). The logos are their owners' trademarks and
|
|
99
101
|
only identify each service.
|
|
100
102
|
|
|
103
|
+
## Each bot on its own model
|
|
104
|
+
|
|
105
|
+
A bot's **Profile → Model** picks the model its conversation runs on, grouped by provider, with the
|
|
106
|
+
model's thinking levels when it has them. Besides the models Harness already has, **Model sources** adds:
|
|
107
|
+
|
|
108
|
+
- **Your own endpoint**: any OpenAI-compatible (Chat Completions or Responses), Anthropic-compatible or
|
|
109
|
+
Gemini base URL, a key and model ids (or **Fetch models** to tick them from the endpoint's list). It
|
|
110
|
+
becomes a Harness provider `bots-<name>`, its key in the Harness credential store, so it also shows up in
|
|
111
|
+
Settings → Models and in every conversation.
|
|
112
|
+
- **A login another agent on this computer already has**: the Codex CLI's ChatGPT login
|
|
113
|
+
(`~/.codex/auth.json`) becomes Harness's `openai-codex` provider. OpenAI rotates the login on every
|
|
114
|
+
refresh, so the two copies are kept in sync both ways — whichever side refreshes, the other gets the new
|
|
115
|
+
tokens, and neither signs the other out. Claude Code's login is shown but not offered: Anthropic allows a
|
|
116
|
+
Claude subscription only in Claude Code and claude.ai, so add Claude with an API key instead.
|
|
117
|
+
|
|
118
|
+
## Topics: conversations that don't grow forever
|
|
119
|
+
|
|
120
|
+
A bot's conversation is a **topic**. A new topic is a fresh conversation (the old one is archived, the
|
|
121
|
+
bot's scheduled tasks move along); what the bot knows carries over in its memory. A new topic starts:
|
|
122
|
+
|
|
123
|
+
- when you send `/new` (or `/clear`, `/新话题`) in the panel or from a chat app — text after it goes to the
|
|
124
|
+
new topic — or click **New topic** under the composer;
|
|
125
|
+
- by itself before the next task, after **6 hours** of quiet, or once the conversation's prompt reached
|
|
126
|
+
**128K tokens** (Settings; 0 turns either off). A big conversation is never cut while a teammate's
|
|
127
|
+
answer may still be coming.
|
|
128
|
+
|
|
129
|
+
Harness still compacts a conversation that nears the model's limit; topics keep every call small and cheap
|
|
130
|
+
long before that.
|
|
131
|
+
|
|
132
|
+
## Memory
|
|
133
|
+
|
|
134
|
+
Every bot keeps **notes** that outlast its topics, and the team shares one more list every bot reads:
|
|
135
|
+
|
|
136
|
+
- **After every task** a short model call writes one line to the bot's **journal** (what was asked, what
|
|
137
|
+
came of it) and adds, corrects or removes notes — preferences, people, decisions, procedures, lessons.
|
|
138
|
+
Facts every bot should know go to the team notes.
|
|
139
|
+
- **The bot itself** saves notes with `memory_save` when you tell it to remember something, removes them
|
|
140
|
+
with `memory_forget`, and looks through notes, the team journal and digests with `memory_search`.
|
|
141
|
+
- **Every night** (03:00 by default) memory is **consolidated**: each bot's notes are merged, corrected
|
|
142
|
+
and trimmed with its recent journal, the shared notes too, and the day's work is written up as the
|
|
143
|
+
team's **daily digest**. **Consolidate now** runs it at once.
|
|
144
|
+
- A bot reads its notes, the team notes, its last few journal lines and the latest digest when a topic
|
|
145
|
+
starts, and again at the next task after you edit memory or the nightly consolidation ran. Within a
|
|
146
|
+
topic the memory part of its prompt stays the same, so the model's prompt cache over the conversation
|
|
147
|
+
keeps working (what it learns in a topic is in that conversation anyway). A short exchange — an
|
|
148
|
+
acknowledgement, a one-line answer to a teammate — gets a journal line without a model call.
|
|
149
|
+
- The **Memory** tab of a bot and **Team memory** in the sidebar show everything; add, edit, pin or
|
|
150
|
+
delete notes there. Pinned notes are never changed by the automatic passes. Text that looks like a key
|
|
151
|
+
or token is never stored.
|
|
152
|
+
- Memory work runs on each bot's own model unless Settings names a cheaper one.
|
|
153
|
+
|
|
154
|
+
## Usage
|
|
155
|
+
|
|
156
|
+
**Usage** in the sidebar counts every model call the bots make — their conversations, the memory work and
|
|
157
|
+
Harness compacting their context — by bot, task, model, kind of work, scheduled task and day (or hour,
|
|
158
|
+
for today), with the change from the period before. A **task** is everything a bot does from one request
|
|
159
|
+
(you, a chat app, a schedule or another bot) until it is idle again. Costs are estimates from your own
|
|
160
|
+
prices or LiteLLM's public price list (**Prices**); a model with no price shows its tokens only.
|
|
161
|
+
|
|
101
162
|
## Message your team from Feishu, Telegram, Slack or Discord
|
|
102
163
|
|
|
103
164
|
Add **Feishu / Lark**, **Telegram**, **Slack** or **Discord** to a bot (normally the dispatcher) in its **Apps** tab, and you can hand out
|
|
@@ -232,7 +293,12 @@ one connection. If you change scopes later, reinstall the app to the workspace a
|
|
|
232
293
|
- `bot_send_message` puts the text into the other bot's inbox and wakes it. Two bots may exchange at
|
|
233
294
|
most 16 messages in 10 minutes, so conversations end.
|
|
234
295
|
- Every conversation gets `bot_list`, `bot_create`, `bot_update`, `bot_delete`, `bot_send_message`
|
|
235
|
-
and `bot_schedule` to manage bots
|
|
296
|
+
and `bot_schedule` to manage bots, and `memory_save`, `memory_forget` and `memory_search`.
|
|
297
|
+
- A bot's memory is a section of its system prompt, read when a topic starts (and at the next task after
|
|
298
|
+
a memory edit in the panel or the nightly consolidation), never in the middle of a task. A task ends when the bot's
|
|
299
|
+
Agent is idle; its transcript (prompts, replies, tool calls, short tool results) is what the memory pass
|
|
300
|
+
reads. Usage comes from the `assistant/message` and `compaction/summary` events of the bots'
|
|
301
|
+
conversations, plus the plugin's own memory calls.
|
|
236
302
|
- A chat app is not an MCP server: the Host keeps one connection per chat app (long polling for Telegram,
|
|
237
303
|
the gateway for Discord, Socket Mode for Slack, the long connection for Feishu), starts and stops it as you add, change, switch off or remove the
|
|
238
304
|
app, and hands paired people's messages to the bot as user prompts headed `[Telegram · Name]`.
|
|
@@ -248,9 +314,15 @@ permission and restart it.
|
|
|
248
314
|
- `~/.dsh/cache/bots/` (`bots.json` and `channels.json` are readable by your user only): `bots.json` (bots,
|
|
249
315
|
including keys and chat bot tokens entered for apps),
|
|
250
316
|
`messages.jsonl` (timeline), `channels.json` (paired people per chat app, and the last message handled
|
|
251
|
-
per chat), `avatars/`, `skills/` (skills imported from GitHub)
|
|
317
|
+
per chat), `avatars/`, `skills/` (skills imported from GitHub), `memory/` (notes, journal, digests),
|
|
318
|
+
`usage.jsonl` and `tasks.jsonl` (token counts per call and task, kept 400 days), `topics.json`,
|
|
319
|
+
`settings.json`, `price-catalog.json`.
|
|
320
|
+
- Custom endpoints and a borrowed Codex login are written to Harness's own model settings (`llm-pi-ai`) and
|
|
321
|
+
credential store. With the Codex login in use, tokens Harness refreshes are written back to
|
|
322
|
+
`~/.codex/auth.json`.
|
|
252
323
|
- Nothing leaves your machine except through the bots' own conversations (your configured model), the
|
|
253
|
-
|
|
324
|
+
memory passes (a task's transcript and the bot's notes, to the bot's model or the memory model), the
|
|
325
|
+
LiteLLM price list (downloaded from GitHub weekly), the apps you connect, the image model when you generate an avatar, GitHub when you import skills, and the
|
|
254
326
|
Feishu / Lark, Telegram, Slack or Discord API when you connect a chat app (the bots' replies to paired
|
|
255
327
|
people, typing indicators, and the one-line note to strangers).
|
|
256
328
|
|
|
@@ -277,5 +349,8 @@ Refresh the page once after installing. For AI avatars, install [Images](../imag
|
|
|
277
349
|
|
|
278
350
|
- Web UI only.
|
|
279
351
|
- Group chats between bots are not there yet; bots collaborate through direct messages.
|
|
352
|
+
- Costs are estimates. Gateways, subscriptions and discounts bill differently; set your own prices.
|
|
353
|
+
- Only the Codex CLI's login can be borrowed so far; other subscriptions sign in from Harness Settings →
|
|
354
|
+
Models where Harness supports them.
|
|
280
355
|
- Harness skills a team template names that you don't have are skipped; import them from GitHub or have
|
|
281
356
|
the bot write them later.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 简体中文
|
|
4
4
|
|
|
5
|
-
把 Grok bot 搬进 DeepSeek Harness:一支能互相协作的 bot 团队。每个 bot
|
|
5
|
+
把 Grok bot 搬进 DeepSeek Harness:一支能互相协作的 bot 团队。每个 bot 有自己的**头像、人设、模型、技能、能力、应用、定时任务和记忆**,
|
|
6
6
|
也有自己的会话;bot 之间**私信协作**,其中一个是**调度员**,负责拆解任务、分派、跟进、汇报。
|
|
7
7
|
|
|
8
8
|
它适合两种场景:
|
|
@@ -61,6 +61,7 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
61
61
|
- **从 GitHub 导入**:一键浏览 Anthropic 官方技能,或粘贴任意 `owner/repo/path`,整个技能文件夹连脚本一起导入;
|
|
62
62
|
- **从本地文件夹添加**:选本机的一个技能文件夹(或装着多个技能的文件夹,如 `~/.claude/skills`),只引用不复制,改了原文件夹就生效;
|
|
63
63
|
- 同一个 bot 里技能不重名:已有的同名技能会跳过;从同一个 GitHub 文件夹再导入一次则原地更新;
|
|
64
|
+
- 最多同时开 50 个技能(开着的每轮都在 bot 的提示里),总共最多放 200 个;超过 50 个时,新加的先关着;
|
|
64
65
|
- **让 Bot 自己写**:一句话描述需求,bot 用 skill-creator 写好并保存到自己身上;
|
|
65
66
|
- 手写仍然可以,但它是最后的选项;
|
|
66
67
|
- **应用**:只补 Harness 本身没有的外部系统;
|
|
@@ -83,6 +84,56 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
83
84
|
- **图标**:应用库里每个应用都用它自己的官方 logo(有 App 的用 App Store 图标,没有的用官网或官方仓库里的 logo)。
|
|
84
85
|
这些 logo 是各自所有者的商标,只用来标明是哪个服务。
|
|
85
86
|
|
|
87
|
+
## 每个 bot 用自己的模型
|
|
88
|
+
|
|
89
|
+
在 bot 的 **资料 → 模型** 里选它的会话用哪个模型:按提供方分组,模型支持思考强度时还能选强度。
|
|
90
|
+
除了 Harness 里已有的模型,**模型来源** 还能添加:
|
|
91
|
+
|
|
92
|
+
- **自定义端点**:任意 OpenAI 兼容(Chat Completions 或 Responses)、Anthropic 兼容或 Gemini 的 Base URL,
|
|
93
|
+
加上 Key 和模型 id(也可以点 **获取模型列表** 从端点勾选)。它会成为 Harness 的提供方 `bots-<名称>`,
|
|
94
|
+
Key 存进 Harness 凭据库,所以在 设置 → 模型 和所有会话里也能用。
|
|
95
|
+
- **本机其他 Agent 已有的登录**:Codex CLI 的 ChatGPT 登录(`~/.codex/auth.json`)会成为 Harness 的
|
|
96
|
+
`openai-codex` 提供方。OpenAI 每次刷新登录都会换新令牌,所以两份登录会双向同步:无论哪一边刷新,
|
|
97
|
+
另一边都会拿到新令牌,谁也不会把谁踢下线。Claude Code 的登录会显示出来但不提供:Anthropic 只允许
|
|
98
|
+
在 Claude Code 和 claude.ai 里使用 Claude 订阅,请改用 API Key 添加 Claude。
|
|
99
|
+
|
|
100
|
+
## 话题:对话不会无限变长
|
|
101
|
+
|
|
102
|
+
bot 的会话就是一个**话题**。新话题是一段全新的会话(旧会话归档,bot 的定时任务一起搬过去),
|
|
103
|
+
bot 知道的事靠记忆延续。下面几种情况会开新话题:
|
|
104
|
+
|
|
105
|
+
- 在面板或聊天应用里发送 `/new`(也可以是 `/clear`、`/新话题`),后面跟的文字会发到新话题里;
|
|
106
|
+
或者点输入框下方的 **新话题**;
|
|
107
|
+
- 在下一个任务开始前自动开:闲置超过 **6 小时**,或对话的提示已经达到 **128K tokens**(可在设置里调,
|
|
108
|
+
0 表示关闭)。如果队友的回复可能还在路上,即使对话很长也不会被切断。
|
|
109
|
+
|
|
110
|
+
对话接近模型上限时,Harness 自己仍会压缩;话题在那之前很久就让每次调用保持小而便宜。
|
|
111
|
+
|
|
112
|
+
## 记忆
|
|
113
|
+
|
|
114
|
+
每个 bot 都有跨话题保留的**笔记**,团队还有一份所有 bot 都会读的共享笔记:
|
|
115
|
+
|
|
116
|
+
- **每个任务结束后**,一次简短的模型调用会在 bot 的**工作日志**里写一行(要做什么、结果如何),
|
|
117
|
+
并增补、更正或删除笔记:偏好、人物、决定、做法、教训。所有 bot 都该知道的事写进团队笔记。
|
|
118
|
+
- **bot 自己**也会记:你让它记住什么时它用 `memory_save` 保存,用 `memory_forget` 删除,
|
|
119
|
+
用 `memory_search` 查笔记、团队工作日志和每日摘要。
|
|
120
|
+
- **每天夜里**(默认 03:00)**整理**一次:结合最近的工作日志,合并、更正、精简每个 bot 的笔记和共享笔记,
|
|
121
|
+
并把当天的工作写成团队的**每日摘要**。**立即整理** 可以马上运行。
|
|
122
|
+
- 话题开始时,bot 会读到自己的笔记、团队笔记、最近几条工作日志和最新的每日摘要;你在面板里改了记忆、
|
|
123
|
+
或每晚整理之后,下一个任务会重新读一次。同一个话题里,提示词中的记忆部分保持不变,模型对整段对话的
|
|
124
|
+
提示缓存照常命中(话题里学到的东西本来就在这段对话里)。很短的往来(一句确认、给队友的一行回复)只记一行
|
|
125
|
+
工作日志,不调用模型。
|
|
126
|
+
- bot 的 **记忆** 标签页和侧栏的 **团队记忆** 能看到全部内容,可以添加、修改、置顶或删除笔记。
|
|
127
|
+
置顶的笔记不会被自动整理改动;看起来像 Key 或 Token 的内容一律不存。
|
|
128
|
+
- 记忆工作默认使用各 bot 自己的模型,也可以在设置里指定一个更便宜的。
|
|
129
|
+
|
|
130
|
+
## 用量
|
|
131
|
+
|
|
132
|
+
侧栏的 **用量** 统计 bot 的每一次模型调用(它们的对话、记忆工作,以及 Harness 压缩它们的上下文),
|
|
133
|
+
可按 bot、任务、模型、用途、定时任务和日期(今天按小时)查看,并和上一期对比。一个**任务**是 bot
|
|
134
|
+
从收到一个请求(来自你、聊天应用、定时任务或其他 bot)到重新空闲为止做的所有事。费用是估算:
|
|
135
|
+
用你填的价格,或 LiteLLM 公开价格表(**价格**);没有价格的模型只显示 tokens。
|
|
136
|
+
|
|
86
137
|
## 在飞书、Telegram、Slack 或 Discord 里给团队发消息
|
|
87
138
|
|
|
88
139
|
在某个 bot(一般是调度员)的**应用**页加上**飞书**、**Telegram**、**Slack** 或 **Discord**,就能用手机派活:你发给聊天 Bot 的话,
|
|
@@ -197,7 +248,11 @@ Slack 走 Socket Mode:由 Harness 主动连到 Slack,电脑不需要公网
|
|
|
197
248
|
- 该会话运行时,bot 的人设和团队名单加入系统提示词;它自己的技能、能力限制和应用只作用于这个会话。
|
|
198
249
|
修改即时生效;新增或修改应用在下次会话启动时连接。
|
|
199
250
|
- `bot_send_message` 把消息放进对方的收件箱并唤醒它;同一对 bot 10 分钟内最多互发 16 条,防止无限对话。
|
|
200
|
-
- 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot
|
|
251
|
+
- 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot,
|
|
252
|
+
以及 `memory_save`、`memory_forget`、`memory_search`。
|
|
253
|
+
- bot 的记忆是它系统提示词里的一段,在话题开始时读取(面板里改了记忆或每晚整理后,在下一个任务开始时重读),任务进行中不会变。bot 的 Agent 空闲时任务结束;记忆总结读的是这个任务的过程
|
|
254
|
+
(提示、回复、工具调用和简短的工具结果)。用量来自 bot 会话的 `assistant/message` 和 `compaction/summary` 事件,
|
|
255
|
+
再加上插件自己的记忆调用。
|
|
201
256
|
- 聊天应用不是 MCP 服务:Host 为每个聊天应用保持一个连接(Telegram 用长轮询,Discord 用 Gateway,Slack 用 Socket Mode,飞书用长连接),
|
|
202
257
|
随你添加、修改、关闭或删除应用而启动和停止,并把配对者的消息作为用户提示交给 bot,开头标着 `[Telegram · 名字]`。
|
|
203
258
|
|
|
@@ -209,8 +264,12 @@ Slack 走 Socket Mode:由 Harness 主动连到 Slack,电脑不需要公网
|
|
|
209
264
|
## 存储与外发
|
|
210
265
|
|
|
211
266
|
- `~/.dsh/cache/bots/`(`bots.json` 和 `channels.json` 只有你自己的账户能读):`bots.json`(bot,含应用里填的 Key 和聊天 Bot Token)、`messages.jsonl`(时间线)、
|
|
212
|
-
`channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub
|
|
213
|
-
|
|
267
|
+
`channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub 导入的技能)、
|
|
268
|
+
`memory/`(笔记、工作日志、每日摘要)、`usage.jsonl` 和 `tasks.jsonl`(每次调用和每个任务的 tokens,保留 400 天)、
|
|
269
|
+
`topics.json`、`settings.json`、`price-catalog.json`。
|
|
270
|
+
- 自定义端点和借用的 Codex 登录写在 Harness 自己的模型设置(`llm-pi-ai`)和凭据库里。使用 Codex 登录时,
|
|
271
|
+
Harness 刷新得到的令牌会写回 `~/.codex/auth.json`。
|
|
272
|
+
- 除了 bot 自身会话(你配置的模型)、记忆整理(把任务过程和 bot 的笔记发给 bot 的模型或记忆模型)、LiteLLM 价格表(每周从 GitHub 下载一次)、你连接的应用、生成头像时的图片模型、导入技能时访问 GitHub,
|
|
214
273
|
以及连接聊天应用后访问飞书 / Lark、Telegram、Slack、Discord 的 API(给配对者的回复、正在输入提示、给陌生人的那一句提示),不向外发送任何内容。
|
|
215
274
|
|
|
216
275
|
## 安装
|
|
@@ -236,4 +295,6 @@ git+https://github.com/kadaliao/dsh-plugins.git#main&path:/plugins/bots
|
|
|
236
295
|
|
|
237
296
|
- 仅 Web 界面。
|
|
238
297
|
- 暂无 bot 群聊,bot 之间通过私信协作。
|
|
298
|
+
- 费用是估算,网关、订阅和折扣的实际计费会不同;可以填自己的价格。
|
|
299
|
+
- 目前只能借用 Codex CLI 的登录;其他订阅请在 Harness 支持的情况下,到 设置 → 模型 里登录。
|
|
239
300
|
- 团队模板引用的 Harness 技能,你没装的会被跳过;可以之后再从 GitHub 导入或让 bot 自己写。
|