Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Document and smoke-test Bot capabilities

lulu feizhuddd54dcb3c63
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3e003d94..2438d220 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,7 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change
### Added
+- Settings → **Capabilities**: share MCP servers and skills with the team, group them into packs, and choose which capabilities each Bot can use.
- In a Bot's chat or a group chat, `@` lists the Bots you can mention first: a group's members and **Everyone**, or the other Bots. Picking one writes `@Name`.
- **Reference a chat** in the composer's **+** menu adds another Bot's chat, or a recent conversation outside the team, to your message as context.
- A Main Bot can stop another Bot's running turn. The Bot is told why, and its reply goes back to the Main Bot.
diff --git a/README.md b/README.md
index fefa8872..88971f25 100644
--- a/README.md
+++ b/README.md
@@ -62,6 +62,10 @@ DS Bot has group chats. A group chat is a great way to get several bots to work
![Group chat: the admin, Chief, hands the work to Writer and Coder](docs/images/group.png)
+### Capabilities
+
+Settings → **Capabilities** is a shared library of MCP servers, skills and packs. Add a capability to a Bot in its settings; it is available from that Bot's next message in its own chat and group chats. A local MCP command that a Bot adds needs your approval before it can run.
+
### Usage
In **Settings** → **Usage**, you can see token usage by time, by bot and by model.
diff --git a/README.zh.md b/README.zh.md
index 9f9baf69..4ced386c 100644
--- a/README.zh.md
+++ b/README.zh.md
@@ -62,6 +62,10 @@ ds bot 拥有群聊功能。群聊是非常好的多 bot 协作方式,但它
![群聊:管理员 Chief 把活派给写手和程序员](docs/images/group.zh.png)
+### 能力
+
+设置 → **能力** 是团队共享的 MCP 服务、技能和能力包列表。在 Bot 设置中启用能力后,从该 Bot 下一条消息开始生效,也适用于它参与的群聊。Bot 添加的本地 MCP 命令需要你先批准才能运行。
+
### 用量
在 设置 → 用量 里,可以按时间、按 bot、按模型查看 Token 用量。
diff --git a/ds-bot/README.md b/ds-bot/README.md
index 2ceca2bc..66db1801 100644
--- a/ds-bot/README.md
+++ b/ds-bot/README.md
@@ -27,7 +27,7 @@ Tested with dsh `0.2.1-alpha.1` (Web and Desktop) on Linux.
- **Images**: for a model that cannot read images, a vision model first turns the image into text.
- **Secrets**: a Bot asks for an API key or token with a card in its own chat and never sees the value. See [Secrets](#secrets).
- **Usage**: Settings → Usage shows token usage by time (24 hours to 12 months, or days picked on a calendar), by Bot and by model, with a page for each Bot and each model. Calls that a Session logs are read from the logs, so older chats count too. Calls that leave no log (checkpoints, handoff notes, the steward, image readings, dsh titles and compaction) are counted while they stream, from the time the plugin runs. Tokens only, no cost.
-- **Make it yours**: name, role, instructions, model and look (20 characters and 12 colors, or your own photo) for each Bot; a theme, an accent color and an avatar animation level (quiet, normal or lively) for the team. A pinned Bot or group chat shows a small pushpin in the sidebar. Settings has these pages: General (look), Bots (Main Bots and each Bot's settings), Group chats (each group's settings), Connectors, Scheduled tasks, Usage, Secrets, Feedback and About DS Bot (versions, updates and links).
+- **Make it yours**: name, role, instructions, model and look (20 characters and 12 colors, or your own photo) for each Bot; a theme, an accent color and an avatar animation level (quiet, normal or lively) for the team. A pinned Bot or group chat shows a small pushpin in the sidebar. Settings has these pages: General (look), Bots (Main Bots and each Bot's settings), Group chats (each group's settings), Connectors, Capabilities, Scheduled tasks, Usage, Secrets, Feedback and About DS Bot (versions, updates and links).
## Install
diff --git a/ds-bot/dev/mcp-echo-server.mjs b/ds-bot/dev/mcp-echo-server.mjs
new file mode 100644
index 00000000..be2239fe
--- /dev/null
+++ b/ds-bot/dev/mcp-echo-server.mjs
@@ -0,0 +1,41 @@
+import { createInterface } from 'node:readline'
+
+const send = message => process.stdout.write(`${JSON.stringify(message)}\n`)
+const tools = [{
+ name: 'echo',
+ description: 'Return the supplied text.',
+ inputSchema: {
+ type: 'object',
+ properties: { text: { type: 'string' } },
+ required: ['text'],
+ },
+}]
+
+for await (const line of createInterface({ input: process.stdin })) {
+ let request
+ try { request = JSON.parse(line) } catch { continue }
+ if (!request || request.id === undefined) continue
+ let result
+ switch (request.method) {
+ case 'initialize':
+ result = {
+ protocolVersion: request.params?.protocolVersion,
+ capabilities: { tools: {} },
+ serverInfo: { name: 'ds-bot-echo', version: '1.0.0' },
+ }
+ break
+ case 'ping':
+ result = {}
+ break
+ case 'tools/list':
+ result = { tools }
+ break
+ case 'tools/call':
+ result = { content: [{ type: 'text', text: String(request.params?.arguments?.text ?? '') }] }
+ break
+ default:
+ send({ jsonrpc: '2.0', id: request.id, error: { code: -32601, message: 'Method not found' } })
+ continue
+ }
+ send({ jsonrpc: '2.0', id: request.id, result })
+}
diff --git a/ds-bot/dev/smoke.mjs b/ds-bot/dev/smoke.mjs
index dbc021e3..806495c5 100644
--- a/ds-bot/dev/smoke.mjs
+++ b/ds-bot/dev/smoke.mjs
@@ -8,7 +8,7 @@
//
// `--out <file>` writes a normalized transcript (names instead of ids, sorted where the
// order depends on timing), so two runs, before and after a refactor, can be diffed.
-import { readFileSync, writeFileSync } from 'node:fs'
+import { readFileSync, readdirSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { fileURLToPath } from 'node:url'
@@ -34,6 +34,26 @@ const mockLog = () => {
throw error
}
}
+const tapFiles = bot => {
+ try {
+ return readdirSync(join(HOME, 'tap-bodies'))
+ .filter(file => new RegExp(`^\\d+-main-${bot.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}\\.json$`).test(file))
+ .sort((a, b) => Number(a.split('-')[0]) - Number(b.split('-')[0]))
+ } catch (error) {
+ if (error.code === 'ENOENT') return []
+ throw error
+ }
+}
+const tapBody = bot => {
+ const file = tapFiles(bot).at(-1)
+ if (!file) throw new Error(`no llm-tap main request for ${bot}`)
+ return { path: join(HOME, 'tap-bodies', file), body: readJson(join(HOME, 'tap-bodies', file)) }
+}
+const bodyText = body => JSON.stringify(body)
+const latestReminder = body => {
+ const reminders = bodyText(body).match(/<system-reminder>[\s\S]*?<\/system-reminder>/g) ?? []
+ return reminders.at(-1) ?? ''
+}
async function login() {
const log = readFileSync(join(HOME, 'web.log'), 'utf8')
@@ -292,6 +312,43 @@ await step('delete the copy', async () => {
return copy.id
}, id => expect(state().bots[id] === undefined, 'copy still there'))
+const echoName = 'smoke-echo'
+const skillName = 'smoke-guide'
+const skillDescription = 'Smoke test skill'
+const echoServer = join(ROOT, 'ds-bot', 'dev', 'mcp-echo-server.mjs')
+await api('capability-save', { name: echoName, kind: 'mcp', description: 'Smoke test echo server', transport: 'stdio', command: process.execPath, args: [echoServer], env: {} })
+await api('capability-save', { name: skillName, kind: 'skill', description: skillDescription, content: 'Use this skill when asked about capability smoke checks.' })
+await api('bot-capabilities', { botId: chief().id, capabilities: [echoName, skillName] })
+for (let attempt = 0; attempt < 60; attempt += 1) {
+ const live = await api('state')
+ const statuses = live.capabilityStatuses?.[chief().id] ?? {}
+ if (statuses[echoName]?.state === 'ready' && statuses[skillName]?.state === 'ready') break
+ await sleep(250)
+}
+
+await step('Chief sees its attached MCP and skill', () => send(chief().id, 'Check your available capabilities.'), () => {
+ const { body, path } = tapBody('Chief')
+ const tools = (body.tools ?? []).map(tool => tool.name)
+ return expect(tools.includes(`mcp__${echoName}__echo`), `MCP tool missing from ${path}`)
+ ?? expect(latestReminder(body).includes(skillName) && latestReminder(body).includes(skillDescription), `skill catalog entry missing from ${path}`)
+})
+
+await step('Coder does not inherit Chief capabilities', () => send(botNamed('Coder').id, 'Check your available capabilities.'), () => {
+ const { body, path } = tapBody('Coder')
+ const tools = (body.tools ?? []).map(tool => tool.name)
+ return expect(!tools.includes(`mcp__${echoName}__echo`), `MCP tool leaked into ${path}`)
+ ?? expect(!latestReminder(body).includes(skillName), `skill leaked into ${path}`)
+})
+
+await api('bot-capabilities', { botId: chief().id, capabilities: [] })
+await sleep(500)
+await step('detached capabilities disappear from Chief', () => send(chief().id, 'Check your available capabilities.'), () => {
+ const { body, path } = tapBody('Chief')
+ const tools = (body.tools ?? []).map(tool => tool.name)
+ return expect(!tools.includes(`mcp__${echoName}__echo`), `MCP tool remained in ${path}`)
+ ?? expect(!latestReminder(body).includes(skillName), `latest skill reminder still lists the skill in ${path}`)
+})
+
if (outFile) writeFileSync(outFile, `${JSON.stringify(transcript, null, 2)}\n`)
console.log(failures.length === 0 ? `\nsmoke: all ${transcript.length} steps passed` : `\nsmoke: ${failures.length} failed\n${failures.join('\n')}`)
process.exit(failures.length === 0 ? 0 : 1)