A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Merge remote-tracking branch 'origin/devin/follow-through' into devin/group-tasks
Fei2411764e7ff6e85e
diff --cc CHANGELOG.mdindex 4e65bb48,44907249..06a4ec91--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -6,13 -6,9 +6,14 @@@ All notable changes to DS Bot are liste### Added+ - Settings → **Capabilities**: share MCP servers and skills with the team, group them into packs, and choose which capabilities each Bot can use.- A Bot that was working when DeepSeek Harness closed or restarted picks its work back up when DS Bot starts again. A group chat shows which member was cut off, and a Bot that was answering another Bot still sends its answer.- The sidebar marks a Bot or group chat that waits for your approval. Where the system allows notifications, a notification also names the Bot.+- In a group chat, any Bot can hand work to another with @Name. The Bot does the work without holding up the group, and the group, the sidebar and the Bot's own chat show what it is doing. When it is done, it posts the result in the group. You can stop the work in the group's details.++### Changed++- What a group member posts after its round moved on is answered by the Bot that asked for the work, and no longer by the admin. Work you asked for yourself is left for you to read.### Fixeddiff --cc README.mdindex e9b2a490,dab1da4d..4652d631--- a/README.md+++ b/README.md@@@ -60,10 -60,12 +60,14 @@@ In short: have a question? Ask the maiDS Bot has group chats. A group chat is a great way to get several bots to work together, but it clearly costs more. So DS Bot does this: every group chat has an admin. The admin answers your messages by default and calls in the other bots for you. You can also @ a bot directly, and it answers you directly: type @ and pick the bot from the list. To give the bots another chat as context, use + → Reference a chat in the message box.+Any bot can hand work to another bot with @. That bot does the work on its own, and the group goes on. While it works, the group, the sidebar and the bot's own chat show what it is doing. When it is done, it posts the result in the group, and the bot that asked for the work answers. To stop the work, open the group's details.++ ### 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. While other Bots use a capability, only you or a Main Bot can change or delete it.+### UsageIn **Settings** → **Usage**, you can see token usage by time, by bot and by model.diff --cc README.zh.mdindex eb5f1e65,191f9034..a2acade8--- a/README.zh.md+++ b/README.zh.md@@@ -60,10 -60,12 +60,14 @@@ npx @deepseek-ai/[email protected] weds bot 拥有群聊功能。群聊是非常好的多 bot 协作方式,但它会带来非常明显的费用问题。ds bot 为此特意做了优化:在一个群聊中,你需要设置一个管理员。你的消息默认由管理员回复,它会帮你调用其他 bot。你也可以直接 @ 你需要沟通的 bot,它会直接回应你:输入 @,从列表里选 bot 就行。想让 bot 参考另一段对话,点输入框的 + → 引用对话。+任何 bot 都可以用 @ 把活派给另一个 bot。接活的 bot 自己去做,群聊照常进行。它干活时,群聊、侧边栏和它自己的聊天里都能看到它在做什么。做完后,它把结果发到群里,由派活的 bot 接着回应。要停下它的工作,打开群聊详情。++ ### 能力++ 设置 → **能力** 是团队共享的 MCP 服务、技能和能力包列表。在 Bot 设置中启用能力后,从该 Bot 下一条消息开始生效,也适用于它参与的群聊。Bot 添加的本地 MCP 命令需要你先批准才能运行。有其他 Bot 在用的能力,只有你或主 Bot 能修改、删除。+### 用量在 设置 → 用量 里,可以按时间、按 bot、按模型查看 Token 用量。diff --cc ds-bot/client.jsindex aa5b6389,0076544c..e7a14207--- a/ds-bot/client.js+++ b/ds-bot/client.js@@@ -10522,16 -10751,13 +10768,16 @@@ function migrateStorage(storage = globa}// src/client/member-status.js- var import_react28 = require("react");+ var import_react29 = require("react");-var NO_WORK = { bots: {}, approvals: [] };+var NO_WORK = { bots: {}, rooms: {}, approvals: [] };+var ROWS_MAX = 4;function memberWork(room2, work = NO_WORK) {+ const here = work.rooms?.[room2.id] ?? [];return room2.members.map((id) => {const approvals = (work.approvals ?? []).filter((entry) => entry.botId === id);- const doing = work.bots?.[id];- return { id, approvals, doing, state: approvals.length > 0 ? "ask" : doing ? "work" : "idle" };+ const local = here.find((entry) => entry.botId === id);+ const doing = local ? { ...local, roomId: room2.id } : work.bots?.[id];+ return { id, approvals, doing, here: local !== void 0, state: approvals.length > 0 ? "ask" : doing ? "work" : "idle" };});}function busyMembers(room2, work, roster) {@@@ -10560,91 -10774,36 +10806,91 @@@ function summaryText(busy)return { waiting, doing };}function Face({ entry, size }) {- return (0, import_react28.createElement)(+ return (0, import_react29.createElement)("span",{ className: "bt-mw-face", "data-ask": entry.state === "ask" || void 0 },- (0, import_react28.createElement)(BotMark, { bot: entry.bot, size, state: entry.state === "ask" ? "alert" : toolState(entry.doing?.tool ?? "") })+ (0, import_react29.createElement)(BotMark, { bot: entry.bot, size, state: entry.state === "ask" ? "alert" : toolState(entry.doing?.tool ?? "") }));}-function MemberDock({ sessionId, useRoster, useWork, actions }) {- const roster = useRoster((value) => value);- const work = useWork((value) => value);- const room2 = roster.roomsById[sessionId];- if (!room2) return null;- const busy = busyMembers(room2, work, roster);- if (busy.length === 0) return null;+function WorkRow({ bot, tool, label, at, now, onOpen }) {+ const text = `${label} · ${workPhrase(tool)}…`;+ const elapsed = typeof at === "number" && now - at >= 6e4 ? elapsedLabel(now - at) : "";- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)(+ "button",+ { type: "button", className: "bt-mw-row", "aria-label": [text, elapsed].filter(Boolean).join(" · "), onClick: onOpen },- (0, import_react28.createElement)(BotMark, { bot, size: 22, state: toolState(tool ?? ""), live: true }),- (0, import_react28.createElement)("span", { className: "bt-mw-row-text" }, (0, import_react28.createElement)(Shimmer, null, text)),- elapsed ? (0, import_react28.createElement)("span", { className: "bt-mw-row-time" }, `· ${elapsed}`) : null++ (0, import_react29.createElement)(BotMark, { bot, size: 22, state: toolState(tool ?? ""), live: true }),++ (0, import_react29.createElement)("span", { className: "bt-mw-row-text" }, (0, import_react29.createElement)(Shimmer, null, text)),++ elapsed ? (0, import_react29.createElement)("span", { className: "bt-mw-row-time" }, `· ${elapsed}`) : null+ );+}+function SummaryLine({ busy, onOpen }) {const { waiting, doing } = summaryText(busy);- return (0, import_react28.createElement)(+ return (0, import_react29.createElement)("div",{ className: "bt-event bt-mw-dock" },- (0, import_react28.createElement)(+ (0, import_react29.createElement)("button",- { type: "button", className: "bt-event-whole bt-mw-line", "aria-label": [waiting, doing].filter(Boolean).join(" · "), onClick: () => actions.showDetails(sessionId) },+ { type: "button", className: "bt-event-whole bt-mw-line", "aria-label": [waiting, doing].filter(Boolean).join(" · "), onClick: onOpen },- (0, import_react28.createElement)("span", { className: "bt-mw-stack", "aria-hidden": true }, busy.slice(0, 4).map((entry) => (0, import_react28.createElement)(Face, { key: entry.id, entry, size: 16 }))),- waiting ? (0, import_react28.createElement)("span", { className: "bt-mw-ask" }, waiting) : null,- waiting && doing ? (0, import_react28.createElement)("span", { "aria-hidden": true }, "·") : null,- doing ? (0, import_react28.createElement)("span", { className: "bt-event-name" }, (0, import_react28.createElement)(Shimmer, null, doing)) : null+ (0, import_react29.createElement)("span", { className: "bt-mw-stack", "aria-hidden": true }, busy.slice(0, 4).map((entry) => (0, import_react29.createElement)(Face, { key: entry.id, entry, size: 16 }))),+ waiting ? (0, import_react29.createElement)("span", { className: "bt-mw-ask" }, waiting) : null,+ waiting && doing ? (0, import_react29.createElement)("span", { "aria-hidden": true }, "·") : null,+ doing ? (0, import_react29.createElement)("span", { className: "bt-event-name" }, (0, import_react29.createElement)(Shimmer, null, doing)) : null));}+function MemberDock({ sessionId, useRoster, useWork, actions }) {+ const roster = useRoster((value) => value);+ const work = useWork((value) => value);+ const room2 = roster.roomsById[sessionId];+ const bot = room2 ? void 0 : roster.byId[sessionId];+ const ownChat = bot !== void 0 && work.bots?.[bot.id] !== void 0 && work.bots[bot.id].roomId === void 0;+ const busy = room2 ? busyMembers(room2, work, roster) : [];+ const groups = bot !== void 0 && !ownChat ? botGroupWork(bot.id, work, roster) : [];+ const shown = busy.length > 0 || groups.length > 0;+ const now = useNow2(shown);- const ref = (0, import_react28.useRef)(null);++ const ref = (0, import_react29.useRef)(null);+ useFlowColumn(ref, shown, sessionId);+ if (!shown) return null;+ if (room2) {+ const { rows, rest } = splitBusy(busy);+ const open = () => actions.showDetails(sessionId);- return (0, import_react28.createElement)(++ return (0, import_react29.createElement)(+ "div",+ { ref, className: "bt-mw-dock-stack" },- rows.map((entry) => (0, import_react28.createElement)(WorkRow, { key: entry.id, bot: entry.bot, tool: entry.doing.tool, label: entry.bot.name, at: entry.doing.since, now, onOpen: open })),- rest.length > 0 ? (0, import_react28.createElement)(SummaryLine, { busy: rest, onOpen: open }) : null++ rows.map((entry) => (0, import_react29.createElement)(WorkRow, { key: entry.id, bot: entry.bot, tool: entry.doing.tool, label: entry.bot.name, at: entry.doing.since, now, onOpen: open })),++ rest.length > 0 ? (0, import_react29.createElement)(SummaryLine, { busy: rest, onOpen: open }) : null+ );+ }- return (0, import_react28.createElement)("div", { ref, className: "bt-mw-dock-stack" }, groups.slice(0, ROWS_MAX).map((item) => (0, import_react28.createElement)(WorkRow, {++ return (0, import_react29.createElement)("div", { ref, className: "bt-mw-dock-stack" }, groups.slice(0, ROWS_MAX).map((item) => (0, import_react29.createElement)(WorkRow, {+ key: item.room.id,+ bot,+ tool: item.tool,+ label: t("in {name}", { name: item.room.name }),+ at: item.since,+ now,+ onOpen: () => actions.openSession(item.room.id)+ })));+}+function useFlowColumn(ref, active, key) {- (0, import_react28.useLayoutEffect)(() => {++ (0, import_react29.useLayoutEffect)(() => {+ const node = ref.current;+ const flow = document.querySelector("[data-chat-flow]");+ if (!active || !node || !flow) return void 0;+ const place = () => {+ node.style.marginInlineStart = "0px";+ const column = flow.getBoundingClientRect();+ node.style.marginInlineStart = `${Math.round(column.left - node.getBoundingClientRect().left)}px`;+ node.style.width = `${Math.round(column.width)}px`;+ };+ place();+ const observer = new ResizeObserver(place);+ observer.observe(flow);+ return () => observer.disconnect();+ }, [active, key]);+}function useNow2(active) {- const [now, setNow] = (0, import_react28.useState)(Date.now);- (0, import_react28.useEffect)(() => {+ const [now, setNow] = (0, import_react29.useState)(Date.now);+ (0, import_react29.useEffect)(() => {if (!active) return void 0;const timer = setInterval(() => setNow(Date.now()), 3e4);return () => clearInterval(timer);@@@ -10678,30 -10837,20 +10924,30 @@@ function ApprovalCard({ approval, bot,);}function MemberWork({ entry, bot, room: room2, roster, actions, now }) {- const [stopping, setStopping] = (0, import_react28.useState)(false);++ const [stopping, setStopping] = (0, import_react29.useState)(false);if (entry.state === "ask") {- return (0, import_react28.createElement)(+ return (0, import_react29.createElement)("div",{ className: "bt-mw-member" },- (0, import_react28.createElement)("div", { className: "bt-mw-state bt-mw-ask" }, `${t("Waiting for your approval")}${since(now, entry.approvals[0].at)}`),- entry.approvals.map((approval) => (0, import_react28.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions }))+ (0, import_react29.createElement)("div", { className: "bt-mw-state bt-mw-ask" }, `${t("Waiting for your approval")}${since(now, entry.approvals[0].at)}`),+ entry.approvals.map((approval) => (0, import_react29.createElement)(ApprovalCard, { key: approval.id, approval, bot, actions })));}if (entry.state !== "work") return null;const where = entry.doing.roomId === room2.id ? "" : entry.doing.roomId ? t("in {name}", { name: roster.roomsById[entry.doing.roomId]?.name ?? t("a group chat") }) : t("in its own chat");+ const stop = () => {+ setStopping(true);+ void Promise.resolve(actions.stopMemberWork(room2.id, bot.id)).catch((error) => actions.reportError(error, "stop")).finally(() => setStopping(false));+ };- return (0, import_react28.createElement)(+ return (0, import_react29.createElement)("div",{ className: "bt-mw-member" },- (0, import_react28.createElement)(- (0, import_react29.createElement)("div", { className: "bt-mw-state" }, (0, import_react29.createElement)(Shimmer, null, `${workPhrase(entry.doing.tool)}…`), where ? ` ${where}` : "", since(now, entry.doing.since))++ (0, import_react29.createElement)(+ "div",+ { className: "bt-mw-state bt-mw-work" },- (0, import_react28.createElement)("span", null, (0, import_react28.createElement)(Shimmer, null, `${workPhrase(entry.doing.tool)}…`), where ? ` ${where}` : "", since(now, entry.doing.since)),- entry.here ? (0, import_react28.createElement)("button", { type: "button", className: "bt-mw-stop", disabled: stopping, onClick: stop }, t("Stop")) : null++ (0, import_react29.createElement)("span", null, (0, import_react29.createElement)(Shimmer, null, `${workPhrase(entry.doing.tool)}…`), where ? ` ${where}` : "", since(now, entry.doing.since)),++ entry.here ? (0, import_react29.createElement)("button", { type: "button", className: "bt-mw-stop", disabled: stopping, onClick: stop }, t("Stop")) : null+ ));}function useMemberWork(room2, useWork) {