@kadaliao/dsh-bots 0.6.1 → 0.7.1
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 +85 -4
- package/README.zh-CN.md +72 -4
- package/client.js +1319 -37
- package/index.js +878 -18
- 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/store.mjs +4 -1
- 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:
|
|
@@ -100,6 +100,73 @@ A bot is an ordinary Harness conversation, so everything Harness can do, a bot c
|
|
|
100
100
|
otherwise the logo from the vendor's site or repository). The logos are their owners' trademarks and
|
|
101
101
|
only identify each service.
|
|
102
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
|
+

|
|
119
|
+
|
|
120
|
+
## Topics: conversations that don't grow forever
|
|
121
|
+
|
|
122
|
+
A bot's conversation is a **topic**. A new topic is a fresh conversation (the old one is archived, the
|
|
123
|
+
bot's scheduled tasks move along); what the bot knows carries over in its memory. A new topic starts:
|
|
124
|
+
|
|
125
|
+
- when you send `/new` (or `/clear`, `/新话题`) in the panel or from a chat app — text after it goes to the
|
|
126
|
+
new topic — or click **New topic** under the composer;
|
|
127
|
+
- by itself before the next task, after **6 hours** of quiet, or once the conversation's prompt reached
|
|
128
|
+
**128K tokens** (Settings; 0 turns either off). A big conversation is never cut while a teammate's
|
|
129
|
+
answer may still be coming.
|
|
130
|
+
|
|
131
|
+
Harness still compacts a conversation that nears the model's limit; topics keep every call small and cheap
|
|
132
|
+
long before that.
|
|
133
|
+
|
|
134
|
+
## Memory
|
|
135
|
+
|
|
136
|
+
Every bot keeps **notes** that outlast its topics, and the team shares one more list every bot reads:
|
|
137
|
+
|
|
138
|
+
- **After every task** a short model call writes one line to the bot's **journal** (what was asked, what
|
|
139
|
+
came of it) and adds, corrects or removes notes — preferences, people, decisions, procedures, lessons.
|
|
140
|
+
Facts every bot should know go to the team notes.
|
|
141
|
+
- **The bot itself** saves notes with `memory_save` when you tell it to remember something, removes them
|
|
142
|
+
with `memory_forget`, and looks through notes, the team journal and digests with `memory_search`.
|
|
143
|
+
- **Every night** (03:00 by default) memory is **consolidated**: each bot's notes are merged, corrected
|
|
144
|
+
and trimmed with its recent journal, the shared notes too, and the day's work is written up as the
|
|
145
|
+
team's **daily digest**. **Consolidate now** runs it at once.
|
|
146
|
+
- A bot reads its notes, the team notes, its last few journal lines and the latest digest when a topic
|
|
147
|
+
starts, and again at the next task after you edit memory or the nightly consolidation ran. Within a
|
|
148
|
+
topic the memory part of its prompt stays the same, so the model's prompt cache over the conversation
|
|
149
|
+
keeps working (what it learns in a topic is in that conversation anyway). A short exchange — an
|
|
150
|
+
acknowledgement, a one-line answer to a teammate — gets a journal line without a model call.
|
|
151
|
+
- The **Memory** tab of a bot and **Team memory** in the sidebar show everything; add, edit, pin or
|
|
152
|
+
delete notes there. Pinned notes are never changed by the automatic passes. Text that looks like a key
|
|
153
|
+
or token is never stored.
|
|
154
|
+
- Memory work runs on each bot's own model unless Settings names a cheaper one.
|
|
155
|
+
|
|
156
|
+

|
|
157
|
+
|
|
158
|
+

|
|
159
|
+
|
|
160
|
+
## Usage
|
|
161
|
+
|
|
162
|
+
**Usage** in the sidebar counts every model call the bots make — their conversations, the memory work and
|
|
163
|
+
Harness compacting their context — by bot, task, model, kind of work, scheduled task and day (or hour,
|
|
164
|
+
for today), with the change from the period before. A **task** is everything a bot does from one request
|
|
165
|
+
(you, a chat app, a schedule or another bot) until it is idle again. Costs are estimates from your own
|
|
166
|
+
prices or LiteLLM's public price list (**Prices**); a model with no price shows its tokens only.
|
|
167
|
+
|
|
168
|
+

|
|
169
|
+
|
|
103
170
|
## Message your team from Feishu, Telegram, Slack or Discord
|
|
104
171
|
|
|
105
172
|
Add **Feishu / Lark**, **Telegram**, **Slack** or **Discord** to a bot (normally the dispatcher) in its **Apps** tab, and you can hand out
|
|
@@ -234,7 +301,12 @@ one connection. If you change scopes later, reinstall the app to the workspace a
|
|
|
234
301
|
- `bot_send_message` puts the text into the other bot's inbox and wakes it. Two bots may exchange at
|
|
235
302
|
most 16 messages in 10 minutes, so conversations end.
|
|
236
303
|
- Every conversation gets `bot_list`, `bot_create`, `bot_update`, `bot_delete`, `bot_send_message`
|
|
237
|
-
and `bot_schedule` to manage bots
|
|
304
|
+
and `bot_schedule` to manage bots, and `memory_save`, `memory_forget` and `memory_search`.
|
|
305
|
+
- A bot's memory is a section of its system prompt, read when a topic starts (and at the next task after
|
|
306
|
+
a memory edit in the panel or the nightly consolidation), never in the middle of a task. A task ends when the bot's
|
|
307
|
+
Agent is idle; its transcript (prompts, replies, tool calls, short tool results) is what the memory pass
|
|
308
|
+
reads. Usage comes from the `assistant/message` and `compaction/summary` events of the bots'
|
|
309
|
+
conversations, plus the plugin's own memory calls.
|
|
238
310
|
- A chat app is not an MCP server: the Host keeps one connection per chat app (long polling for Telegram,
|
|
239
311
|
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
|
|
240
312
|
app, and hands paired people's messages to the bot as user prompts headed `[Telegram · Name]`.
|
|
@@ -250,9 +322,15 @@ permission and restart it.
|
|
|
250
322
|
- `~/.dsh/cache/bots/` (`bots.json` and `channels.json` are readable by your user only): `bots.json` (bots,
|
|
251
323
|
including keys and chat bot tokens entered for apps),
|
|
252
324
|
`messages.jsonl` (timeline), `channels.json` (paired people per chat app, and the last message handled
|
|
253
|
-
per chat), `avatars/`, `skills/` (skills imported from GitHub)
|
|
325
|
+
per chat), `avatars/`, `skills/` (skills imported from GitHub), `memory/` (notes, journal, digests),
|
|
326
|
+
`usage.jsonl` and `tasks.jsonl` (token counts per call and task, kept 400 days), `topics.json`,
|
|
327
|
+
`settings.json`, `price-catalog.json`.
|
|
328
|
+
- Custom endpoints and a borrowed Codex login are written to Harness's own model settings (`llm-pi-ai`) and
|
|
329
|
+
credential store. With the Codex login in use, tokens Harness refreshes are written back to
|
|
330
|
+
`~/.codex/auth.json`.
|
|
254
331
|
- Nothing leaves your machine except through the bots' own conversations (your configured model), the
|
|
255
|
-
|
|
332
|
+
memory passes (a task's transcript and the bot's notes, to the bot's model or the memory model), the
|
|
333
|
+
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
|
|
256
334
|
Feishu / Lark, Telegram, Slack or Discord API when you connect a chat app (the bots' replies to paired
|
|
257
335
|
people, typing indicators, and the one-line note to strangers).
|
|
258
336
|
|
|
@@ -279,5 +357,8 @@ Refresh the page once after installing. For AI avatars, install [Images](../imag
|
|
|
279
357
|
|
|
280
358
|
- Web UI only.
|
|
281
359
|
- Group chats between bots are not there yet; bots collaborate through direct messages.
|
|
360
|
+
- Costs are estimates. Gateways, subscriptions and discounts bill differently; set your own prices.
|
|
361
|
+
- Only the Codex CLI's login can be borrowed so far; other subscriptions sign in from Harness Settings →
|
|
362
|
+
Models where Harness supports them.
|
|
282
363
|
- Harness skills a team template names that you don't have are skipped; import them from GitHub or have
|
|
283
364
|
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
|
它适合两种场景:
|
|
@@ -84,6 +84,64 @@ Bot 就是一个普通的 Harness 会话,所以 Harness 能做的它都能做
|
|
|
84
84
|
- **图标**:应用库里每个应用都用它自己的官方 logo(有 App 的用 App Store 图标,没有的用官网或官方仓库里的 logo)。
|
|
85
85
|
这些 logo 是各自所有者的商标,只用来标明是哪个服务。
|
|
86
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
|
+
## 话题:对话不会无限变长
|
|
103
|
+
|
|
104
|
+
bot 的会话就是一个**话题**。新话题是一段全新的会话(旧会话归档,bot 的定时任务一起搬过去),
|
|
105
|
+
bot 知道的事靠记忆延续。下面几种情况会开新话题:
|
|
106
|
+
|
|
107
|
+
- 在面板或聊天应用里发送 `/new`(也可以是 `/clear`、`/新话题`),后面跟的文字会发到新话题里;
|
|
108
|
+
或者点输入框下方的 **新话题**;
|
|
109
|
+
- 在下一个任务开始前自动开:闲置超过 **6 小时**,或对话的提示已经达到 **128K tokens**(可在设置里调,
|
|
110
|
+
0 表示关闭)。如果队友的回复可能还在路上,即使对话很长也不会被切断。
|
|
111
|
+
|
|
112
|
+
对话接近模型上限时,Harness 自己仍会压缩;话题在那之前很久就让每次调用保持小而便宜。
|
|
113
|
+
|
|
114
|
+
## 记忆
|
|
115
|
+
|
|
116
|
+
每个 bot 都有跨话题保留的**笔记**,团队还有一份所有 bot 都会读的共享笔记:
|
|
117
|
+
|
|
118
|
+
- **每个任务结束后**,一次简短的模型调用会在 bot 的**工作日志**里写一行(要做什么、结果如何),
|
|
119
|
+
并增补、更正或删除笔记:偏好、人物、决定、做法、教训。所有 bot 都该知道的事写进团队笔记。
|
|
120
|
+
- **bot 自己**也会记:你让它记住什么时它用 `memory_save` 保存,用 `memory_forget` 删除,
|
|
121
|
+
用 `memory_search` 查笔记、团队工作日志和每日摘要。
|
|
122
|
+
- **每天夜里**(默认 03:00)**整理**一次:结合最近的工作日志,合并、更正、精简每个 bot 的笔记和共享笔记,
|
|
123
|
+
并把当天的工作写成团队的**每日摘要**。**立即整理** 可以马上运行。
|
|
124
|
+
- 话题开始时,bot 会读到自己的笔记、团队笔记、最近几条工作日志和最新的每日摘要;你在面板里改了记忆、
|
|
125
|
+
或每晚整理之后,下一个任务会重新读一次。同一个话题里,提示词中的记忆部分保持不变,模型对整段对话的
|
|
126
|
+
提示缓存照常命中(话题里学到的东西本来就在这段对话里)。很短的往来(一句确认、给队友的一行回复)只记一行
|
|
127
|
+
工作日志,不调用模型。
|
|
128
|
+
- bot 的 **记忆** 标签页和侧栏的 **团队记忆** 能看到全部内容,可以添加、修改、置顶或删除笔记。
|
|
129
|
+
置顶的笔记不会被自动整理改动;看起来像 Key 或 Token 的内容一律不存。
|
|
130
|
+
- 记忆工作默认使用各 bot 自己的模型,也可以在设置里指定一个更便宜的。
|
|
131
|
+
|
|
132
|
+

|
|
133
|
+
|
|
134
|
+

|
|
135
|
+
|
|
136
|
+
## 用量
|
|
137
|
+
|
|
138
|
+
侧栏的 **用量** 统计 bot 的每一次模型调用(它们的对话、记忆工作,以及 Harness 压缩它们的上下文),
|
|
139
|
+
可按 bot、任务、模型、用途、定时任务和日期(今天按小时)查看,并和上一期对比。一个**任务**是 bot
|
|
140
|
+
从收到一个请求(来自你、聊天应用、定时任务或其他 bot)到重新空闲为止做的所有事。费用是估算:
|
|
141
|
+
用你填的价格,或 LiteLLM 公开价格表(**价格**);没有价格的模型只显示 tokens。
|
|
142
|
+
|
|
143
|
+

|
|
144
|
+
|
|
87
145
|
## 在飞书、Telegram、Slack 或 Discord 里给团队发消息
|
|
88
146
|
|
|
89
147
|
在某个 bot(一般是调度员)的**应用**页加上**飞书**、**Telegram**、**Slack** 或 **Discord**,就能用手机派活:你发给聊天 Bot 的话,
|
|
@@ -198,7 +256,11 @@ Slack 走 Socket Mode:由 Harness 主动连到 Slack,电脑不需要公网
|
|
|
198
256
|
- 该会话运行时,bot 的人设和团队名单加入系统提示词;它自己的技能、能力限制和应用只作用于这个会话。
|
|
199
257
|
修改即时生效;新增或修改应用在下次会话启动时连接。
|
|
200
258
|
- `bot_send_message` 把消息放进对方的收件箱并唤醒它;同一对 bot 10 分钟内最多互发 16 条,防止无限对话。
|
|
201
|
-
- 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot
|
|
259
|
+
- 所有会话都能用 `bot_list`、`bot_create`、`bot_update`、`bot_delete`、`bot_send_message`、`bot_schedule` 管理 bot,
|
|
260
|
+
以及 `memory_save`、`memory_forget`、`memory_search`。
|
|
261
|
+
- bot 的记忆是它系统提示词里的一段,在话题开始时读取(面板里改了记忆或每晚整理后,在下一个任务开始时重读),任务进行中不会变。bot 的 Agent 空闲时任务结束;记忆总结读的是这个任务的过程
|
|
262
|
+
(提示、回复、工具调用和简短的工具结果)。用量来自 bot 会话的 `assistant/message` 和 `compaction/summary` 事件,
|
|
263
|
+
再加上插件自己的记忆调用。
|
|
202
264
|
- 聊天应用不是 MCP 服务:Host 为每个聊天应用保持一个连接(Telegram 用长轮询,Discord 用 Gateway,Slack 用 Socket Mode,飞书用长连接),
|
|
203
265
|
随你添加、修改、关闭或删除应用而启动和停止,并把配对者的消息作为用户提示交给 bot,开头标着 `[Telegram · 名字]`。
|
|
204
266
|
|
|
@@ -210,8 +272,12 @@ Slack 走 Socket Mode:由 Harness 主动连到 Slack,电脑不需要公网
|
|
|
210
272
|
## 存储与外发
|
|
211
273
|
|
|
212
274
|
- `~/.dsh/cache/bots/`(`bots.json` 和 `channels.json` 只有你自己的账户能读):`bots.json`(bot,含应用里填的 Key 和聊天 Bot Token)、`messages.jsonl`(时间线)、
|
|
213
|
-
`channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub
|
|
214
|
-
|
|
275
|
+
`channels.json`(每个聊天应用的配对者,以及每个聊天处理过的最后一条消息)、`avatars/`、`skills/`(从 GitHub 导入的技能)、
|
|
276
|
+
`memory/`(笔记、工作日志、每日摘要)、`usage.jsonl` 和 `tasks.jsonl`(每次调用和每个任务的 tokens,保留 400 天)、
|
|
277
|
+
`topics.json`、`settings.json`、`price-catalog.json`。
|
|
278
|
+
- 自定义端点和借用的 Codex 登录写在 Harness 自己的模型设置(`llm-pi-ai`)和凭据库里。使用 Codex 登录时,
|
|
279
|
+
Harness 刷新得到的令牌会写回 `~/.codex/auth.json`。
|
|
280
|
+
- 除了 bot 自身会话(你配置的模型)、记忆整理(把任务过程和 bot 的笔记发给 bot 的模型或记忆模型)、LiteLLM 价格表(每周从 GitHub 下载一次)、你连接的应用、生成头像时的图片模型、导入技能时访问 GitHub,
|
|
215
281
|
以及连接聊天应用后访问飞书 / Lark、Telegram、Slack、Discord 的 API(给配对者的回复、正在输入提示、给陌生人的那一句提示),不向外发送任何内容。
|
|
216
282
|
|
|
217
283
|
## 安装
|
|
@@ -237,4 +303,6 @@ git+https://github.com/kadaliao/dsh-plugins.git#main&path:/plugins/bots
|
|
|
237
303
|
|
|
238
304
|
- 仅 Web 界面。
|
|
239
305
|
- 暂无 bot 群聊,bot 之间通过私信协作。
|
|
306
|
+
- 费用是估算,网关、订阅和折扣的实际计费会不同;可以填自己的价格。
|
|
307
|
+
- 目前只能借用 Codex CLI 的登录;其他订阅请在 Harness 支持的情况下,到 设置 → 模型 里登录。
|
|
240
308
|
- 团队模板引用的 Harness 技能,你没装的会被跳过;可以之后再从 GitHub 导入或让 bot 自己写。
|