Skip to content

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

Merge remote-tracking branch 'origin/dev' into feat/widget-views

Fei2411eb6b4ea16d30
diff --cc ds-bot/README.md
index 72a173b4,671f1d5f..bc385246
--- a/ds-bot/README.md
+++ b/ds-bot/README.md
@@@ -11,7 -11,7 +11,7 @@@ Tested with dsh `0.2.1-rc.2` (Web) and
- **Long-lived Bots**: each Bot is a dsh Session in the "DS Bot" workspace, with its own name, role, instructions and model.
- **Working folders**: a Bot can work in a folder you choose instead of the team workspace, and a group chat can set one folder for all its members there. Pick it in the Bot's settings or details panel or in the group's settings, or ask a Bot (`update_bot`, `update_group`). After a change, the chat goes on in a fresh part that starts in the new folder. When a Bot sets a folder outside the team workspace, or adds a Bot to a group that works in one, it asks for your approval if those Bots can only write in their folder. Folders that hold dsh data (`$DSH_HOME`, the team's data) are refused. The team workspace itself moves in Settings > General > Locations; Bots and groups that work there go on in a fresh part in the new folder, and the old folder keeps its files.
- **Permission presets**: each Bot runs with its own dsh permission preset (Read only, Workspace or Full access), set in its details panel. A group chat can run all its members with one preset there, in place of their own: turn on **Same for every member** under Permissions in the group's settings. Only you set permissions; Bots cannot change them.
- - **Bots work together**: `message_bot` sends a message to another Bot, `create_bot` and `update_bot` add and set up Bots, and `ask_user` asks you a question without blocking the other Bots. `show_view` draws a card in a Bot's own chat — text, metrics, tables, progress, choices, confirmations and short forms; an interactive card waits for your answer.
-- **Bots work together**: `message_bot` sends a message to another Bot, `create_bot` and `update_bot` add and set up Bots (including a profile photo from a local image file or a data URL), and `ask_user` asks you a question without blocking the other Bots.
++- **Bots work together**: `message_bot` sends a message to another Bot, `create_bot` and `update_bot` add and set up Bots (including a profile photo from a local image file or a data URL), and `ask_user` asks you a question without blocking the other Bots. `show_view` draws a card in a Bot's own chat — text, metrics, tables, progress, choices, confirmations and short forms; an interactive card waits for your answer.
- **Group chats**: members speak one at a time, and each one reads the latest messages first. A message can `@Name` a member to pass the turn on; type `@` to pick one from a list. **+ → Reference a chat** adds another Bot's chat to a message as context, and in a group the members who answer get it. A member with nothing new to add stays quiet (`[PASS]`). Each member has its own hidden Session per group, so a group never reads a Bot's private chat.
- **Roles and permissions**:
diff --cc ds-bot/client.js
index a57ad711,514ce480..1d37a03c
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@@ -5178,24 -4570,27 +5197,27 @@@ function EventLine({ prefix, bots, join
bot.name
));
});
- return (0, import_react8.createElement)("div", { className: "bt-event" }, parts);
+ return (0, import_react9.createElement)("div", { className: "bt-event" }, parts);
}
- function GroupMessage({ bot, text, texts: texts2 = [text], room: room2, roster, actions, msgKey, useUi, whole }) {
+ function GroupMessage({ bot, text, texts: texts2 = [text], room: room2, roster, actions, msgKey, useUi, whole, time, duration }) {
- const lead = (0, import_react8.createElement)(
+ const lead = (0, import_react9.createElement)(
"button",
{ type: "button", className: "bt-lead", "aria-label": t("Open {name}'s chat", { name: bot.name }), onClick: () => actions.openSession(bot.id) },
- (0, import_react8.createElement)(BotMark, { bot, size: 22 })
+ (0, import_react9.createElement)(BotMark, { bot, size: 22 })
);
+ const took = Number.isFinite(duration) ? elapsedLabel(duration) : void 0;
- return (0, import_react8.createElement)(
+ return (0, import_react9.createElement)(
"div",
{ className: "bt-group-msg" },
- (0, import_react8.createElement)(
+ (0, import_react9.createElement)(
"span",
{ className: "bt-group-name", style: { color: inkText(colorOf(bot)) } },
bot.name,
- room2?.admin === bot.id ? (0, import_react9.createElement)("span", { className: "bt-group-role" }, t("Admin")) : null
- room2?.admin === bot.id ? (0, import_react8.createElement)("span", { className: "bt-group-role" }, t("Admin")) : null,
- Number.isFinite(time) ? (0, import_react8.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null,
- took ? (0, import_react8.createElement)("span", { className: "bt-group-took", title: t("Ran for {duration}", { duration: took }) }, took) : null
++ room2?.admin === bot.id ? (0, import_react9.createElement)("span", { className: "bt-group-role" }, t("Admin")) : null,
++ Number.isFinite(time) ? (0, import_react9.createElement)("span", { className: "bt-group-time", title: clockLabel(time) }, messageClock(time)) : null,
++ took ? (0, import_react9.createElement)("span", { className: "bt-group-took", title: t("Ran for {duration}", { duration: took }) }, took) : null
),
- (0, import_react8.createElement)(Bubbles, { texts: texts2, roster, selfId: bot.id, actions, sessionId: room2?.id, msgKey, useUi, lead, whole })
+ (0, import_react9.createElement)(Bubbles, { texts: texts2, roster, selfId: bot.id, actions, sessionId: room2?.id, msgKey, useUi, lead, whole })
);
}
function stackReplies(replies) {
@@@ -5638,16 -5027,17 +5654,17 @@@ function GroupReplies({ sessionId, call
const speakerDoing = useWork?.((work) => work.bots?.[live.speaking]?.tool ? workPhrase(work.bots[live.speaking]) : void 0) ?? void 0;
if (replies.length === 0 && pending.length === 0) return null;
const room2 = roster.roomsById[sessionId];
- return (0, import_react8.createElement)(
+ return (0, import_react9.createElement)(
"div",
{ className: "bt-group-replies" },
- stackReplies(replies).map(({ reply, index, texts: texts2 }) => {
+ stackReplies(replies).map(({ reply, index, texts: texts2, time, duration }) => {
const bot = roster.byId[reply.botId] ?? { id: reply.botId, name: reply.name, color: reply.color ?? "gray" };
if (reply.kind === "user") {
- return (0, import_react8.createElement)("div", { key: `user-${index}`, className: "bt-urow" }, (0, import_react8.createElement)(
+ return (0, import_react9.createElement)("div", { key: `user-${index}`, className: "bt-urow" }, (0, import_react9.createElement)(
"div",
{ className: "bt-ububble" },
- (0, import_react9.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: reply.text, labels: mdLabels2(), variant: "compact" })
- (0, import_react8.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: reply.text, labels: mdLabels(), variant: "compact" }),
- Number.isFinite(time) ? (0, import_react8.createElement)("div", { className: "bt-utime", title: clockLabel(time) }, messageClock(time)) : null
++ (0, import_react9.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: reply.text, labels: mdLabels2(), variant: "compact" }),
++ Number.isFinite(time) ? (0, import_react9.createElement)("div", { className: "bt-utime", title: clockLabel(time) }, messageClock(time)) : null
));
}
if (reply.kind === "failed") {
@@@ -5686,12 -5076,12 +5703,12 @@@
);
}
if (reply.kind === "stopped") {
- return (0, import_react8.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("You stopped {name}'s work", { name: bot.name }));
+ return (0, import_react9.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("You stopped {name}'s work", { name: bot.name }));
}
if (reply.kind === "done") {
- return (0, import_react8.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} finished its work", { name: bot.name }));
+ return (0, import_react9.createElement)("div", { key: `${reply.botId}-${index}`, className: "bt-event" }, t("{name} finished its work", { name: bot.name }));
}
- return (0, import_react9.createElement)(GroupMessage, { key: `${reply.botId}-${index}`, bot, texts: texts2, room: room2, roster, actions, msgKey: callId ? `${sessionId}:${callId}:${index}` : void 0, useUi });
- return (0, import_react8.createElement)(GroupMessage, { key: `${reply.botId}-${index}`, bot, texts: texts2, room: room2, roster, actions, msgKey: callId ? `${sessionId}:${callId}:${index}` : void 0, useUi, time, duration });
++ return (0, import_react9.createElement)(GroupMessage, { key: `${reply.botId}-${index}`, bot, texts: texts2, room: room2, roster, actions, msgKey: callId ? `${sessionId}:${callId}:${index}` : void 0, useUi, time, duration });
}),
pending.map((id) => {
const bot = roster.byId[id];
@@@ -15002,25 -14390,27 +15019,27 @@@ function UserMessageCell({ node, sessio
const referenceLabels = data.referenceLabels ?? [];
const references = openFile && openSkill ? { openFile, openSkill } : void 0;
const steering = node.kind === "steering";
+ const groupTime = roster.roomsById?.[sessionId] && Number.isFinite(data.time) ? messageClock(data.time) : void 0;
const { shown, folded, control } = useFold(text, { markdown: false });
- const body = (0, import_react38.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
- return (0, import_react38.createElement)(
+ const body = (0, import_react39.createElement)(UserText, { text: shown, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions });
+ return (0, import_react39.createElement)(
"div",
{ className: "bt-umsg", "data-steering": steering || void 0 },
- (0, import_react38.createElement)(
+ (0, import_react39.createElement)(
"div",
{ className: "bt-ustack" },
- attachments.length > 0 ? (0, import_react38.createElement)(Attachments, { attachments, renderMessageImages }) : null,
- text !== "" || rest.length > 0 ? (0, import_react38.createElement)(
+ attachments.length > 0 ? (0, import_react39.createElement)(Attachments, { attachments, renderMessageImages }) : null,
+ text !== "" || rest.length > 0 ? (0, import_react39.createElement)(
"div",
{ className: "bt-ubody", title: clock3(data.time), "data-folded": folded || void 0 },
- control ? (0, import_react38.createElement)("div", { className: "bt-fold-body" }, body) : body,
+ control ? (0, import_react39.createElement)("div", { className: "bt-fold-body" }, body) : body,
control,
- rest.map((block, index) => ui.JsonBlock ? (0, import_react38.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
+ rest.map((block, index) => ui.JsonBlock ? (0, import_react39.createElement)(ui.JsonBlock, { key: index, label: t("Content"), payload: block }) : null)
) : null,
- referenceLabels.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null
- referenceLabels.length > 0 ? (0, import_react38.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
- groupTime ? (0, import_react38.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
++ referenceLabels.length > 0 ? (0, import_react39.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null,
++ groupTime ? (0, import_react39.createElement)("div", { className: "bt-utime", title: clockLabel(data.time) }, groupTime) : null
),
- text === "" ? null : (0, import_react38.createElement)("div", { className: "bt-utools" }, (0, import_react38.createElement)(CopyButton, { text }))
+ text === "" ? null : (0, import_react39.createElement)("div", { className: "bt-utools" }, (0, import_react39.createElement)(CopyButton, { text }))
);
}
var USER_MESSAGE_CSS = `
diff --cc ds-bot/src/client/cells.js
index 432ab451,d13baed5..47032f88
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@@ -2,13 -2,12 +2,13 @@@ import { createElement as h, Fragment,
import { createPortal } from 'react-dom'
import { MarkdownText } from './dsh-primitives.js'
import { inkText } from './inks.js'
- import { linkMentions, mentionTarget, dayLabel, contentText, stripHeader, isHiddenTurn, isRelayContext, relaysBefore, relayPart, commRunOf, toolName, toolArgs, reminderPrompts, elapsedLabel } from './text.js'
+ import { linkMentions, mentionTarget, dayLabel, contentText, stripHeader, isHiddenTurn, isRelayContext, relaysBefore, relayPart, commRunOf, toolName, toolArgs, reminderPrompts, elapsedLabel, clockLabel, messageClock } from './text.js'
import { SmileIcon, ReplyIcon, DotsIcon, CheckIcon, DownloadIcon, CopyIcon, MemoryIcon } from './icons.js'
import { colorOf, toolState, BotMark, RoomAvatar } from './mark.js'
-import { AnsweredCell, SettledQuestion, PendingQuestion } from './questions.js'
+import { SettledQuestion, PendingQuestion } from './questions.js'
+import { AnsweredReply, WidgetCell } from './widget-cell.js'
import { SecretToolCell } from './secret-card.js'
- import { dateLocale, t } from './i18n.js'
+ import { t } from './i18n.js'
import { call } from './api.js'
import { failureLabel } from './diagnostics.js'
import { turnReasoning, thinkingStep } from './turn-reasoning.js'
diff --cc ds-bot/src/host/tools.js
index e3f13bcc,46b17489..09d71c8e
--- a/ds-bot/src/host/tools.js
+++ b/ds-bot/src/host/tools.js
@@@ -1,7 -1,8 +1,8 @@@
// Team tools: the roster, bot-to-bot messages, group chat settings and posts, and the
-// question card. Group rounds and reading chats are in groups.js.
+// question and view cards. Group rounds and reading chats are in groups.js.
import { randomUUID } from 'node:crypto'
import { defineTool } from '@deepseek-ai/dsh-tools'
+ import { readAvatar } from './avatar.js'
import { COLORS, EXTRA_COLORS, MESSAGE_INLINE_MAX, ROOM_MODES, SOURCE_KIND } from './constants.js'
import { within } from './folders.js'
import { absoluteLinks } from './links.js'