Skip to content

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

Show DSH's delivery cards and file links in Bot chats

Fei24113bfeda94f238
diff --git a/CHANGELOG.md b/CHANGELOG.md
index be0739b5..1b3aa896 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,10 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change
## [Unreleased]
+### Fixed
+
+- A Bot chat now shows the cards of the files a Bot hands over with DeepSeek Harness's `present` tool, and of the files a turn changed, as DSH's own chat does. A file path in the reply links to the file when the turn made or delivered it.
+
## [0.1.4] - 2026-10-13
### Added
diff --git a/ds-bot/client.js b/ds-bot/client.js
index ea2b7877..6c0724fb 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -2599,6 +2599,10 @@ header[class*="_header"]:has(.bt-head)::before{content:"";position:absolute;inse
header[class*="_header"]:has(.bt-head)>[class*="_headerLeading"]{position:absolute;left:12px;top:10px;pointer-events:auto}
header[class*="_header"] .bt-head{flex:1 1 auto;width:100%}
[class*="_body"]:has(> [class*="_scrollBody"]){--dsh-chat-content-width:min(960px,100%)}
+/* DSH's turn tail keeps what plugins put in it (delivered files, the Bot's separators),
+ without its copy and branch row; a tail with nothing in it takes no room. */
+[data-turn-tail]>:not([data-slot="conversation.chat.turnTail"]){display:none!important}
+[class*="_flowItem"][data-chat-flow-kind="turn-tail"]:not(:has([data-slot="conversation.chat.turnTail"]:not(:empty))){display:none!important}
/* Every team Session belongs to a Bot or a group, so a blank one is an empty chat, not
the shell's new-session hero: no headline, no workspace or mode picker, and the
composer stays docked at the bottom. */
@@ -3729,7 +3733,7 @@ var import_react6 = require("react");
var import_react_dom = require("react-dom");
var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
var mdLabels = () => ({ code: { copyLabel: t("Copy"), copiedLabel: t("Copied") }, footnotes: t("Footnotes") });
-function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId, msgKey, useUi, lead }) {
+function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId, msgKey, useUi, lead, mentions }) {
const onClick = (event) => {
const target = mentionTarget(event);
if (target === null) return;
@@ -3756,7 +3760,7 @@ function Bubbles({ texts: texts2, roster, selfId, actions, streaming, sessionId,
(0, import_react6.createElement)(
"div",
{ className: "bt-bubble" },
- (0, import_react6.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: linkMentions(text, roster.bots, selfId), streaming: live, labels: mdLabels(), variant: "compact" })
+ (0, import_react6.createElement)(import_dsh_client_ui_primitives.MarkdownText, { text: linkMentions(text, roster.bots, selfId), streaming: live, labels: mdLabels(), variant: "compact", fileMentions: mentions })
),
live ? null : (0, import_react6.createElement)(MessageTools, { text, name: roster.byId[selfId]?.name ?? t("Bot"), sessionId, react: key ? (emoji) => actions.toggleReaction(msgKey, index, emoji) : void 0, actions })
),
@@ -3857,11 +3861,22 @@ function ThinkingRow({ text }) {
(0, import_react6.createElement)("div", { className: "bt-think-text" }, text)
);
}
-function AssistantCell({ node, groupPart, sessionId, useRoster, useUi, useTurnSteps, useTurnContext, actions }) {
+function useFileMentions({ node, openFile, fileMentions, useTurnData }) {
+ const tail = useTurnData?.("turn-tail");
+ const location2 = node.location;
+ const turn = location2?.kind === "turn" || location2?.kind === "step" ? location2.turn : void 0;
+ const seq = node.data.finalNode?.seq;
+ return (0, import_react6.useMemo)(() => {
+ if (typeof fileMentions !== "function" || turn?.status !== "closed" || seq === void 0) return void 0;
+ return tail?.closing?.finalNode.seq === seq ? fileMentions({ turn, seq, openFile }) : void 0;
+ }, [fileMentions, openFile, seq, tail, turn]);
+}
+function AssistantCell({ node, groupPart, sessionId, openFile, fileMentions, useTurnData, useRoster, useUi, useTurnSteps, useTurnContext, actions }) {
const roster = useRoster((value) => value);
const data = node.data;
const steps = useTurnSteps(String(data.turn));
const contexts = useTurnContext(String(data.turn));
+ const mentions = useFileMentions({ node, openFile, fileMentions, useTurnData });
const hidden = Boolean(roster.roomsById[sessionId]) || isHiddenTurn(roster, sessionId, data.turn);
const texts2 = groupPart === "reasoning" ? [] : data.blocks.filter((block) => block.kind === "text" && block.text.trim() !== "").map((block) => block.text);
const running = data.status === "running";
@@ -3888,7 +3903,7 @@ function AssistantCell({ node, groupPart, sessionId, useRoster, useUi, useTurnSt
});
}),
reasoning ? (0, import_react6.createElement)(ThinkingRow, { text: reasoning }) : null,
- texts2.length ? (0, import_react6.createElement)(Bubbles, { texts: texts2, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ""}`, useUi }) : null
+ texts2.length ? (0, import_react6.createElement)(Bubbles, { texts: texts2, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ""}`, useUi, mentions }) : null
);
}
function EventLine({ prefix, bots, joiner = t("and"), onOpen, whole = false }) {
@@ -4180,19 +4195,20 @@ function openingTurn(turns, firstTurns, hiddenTurns) {
return listed.includes(turn) && earlier.every((entry) => hiddenTurns?.includes(entry)) ? { turn, start } : null;
}
var unseenSince = (visit, time) => typeof visit?.seen === "number" && time > visit.seen && time <= visit.entered;
-function TurnTailCell({ node, sessionId, useTurnClock, useUi, actions }) {
- const data = node.data;
+function TurnTailCell({ turn: location2, sessionId, useTurnClock, useUi, actions }) {
+ const turn = location2.turn;
+ const time = location2.end.time;
(0, import_react6.useEffect)(() => {
- actions.noteTurnTime(sessionId, data.turn, "end", data.time);
- }, [sessionId, data.turn, data.time]);
+ actions.noteTurnTime(sessionId, turn, "end", time);
+ }, [sessionId, turn, time]);
const label = useTurnClock((state) => {
- const start = nextTurnStart(state[sessionId] ?? {}, data.turn);
- return start !== void 0 && start - data.time >= SEPARATOR_GAP_MS ? clockLabel(start) : "";
+ const start = nextTurnStart(state[sessionId] ?? {}, turn);
+ return start !== void 0 && start - time >= SEPARATOR_GAP_MS ? clockLabel(start) : "";
});
const visit = useUi((state) => state.visits?.[sessionId]);
const fresh = useTurnClock((state) => {
- if (typeof visit?.seen !== "number" || data.time > visit.seen) return false;
- const start = nextTurnStart(state[sessionId] ?? {}, data.turn);
+ if (typeof visit?.seen !== "number" || time > visit.seen) return false;
+ const start = nextTurnStart(state[sessionId] ?? {}, turn);
return start !== void 0 && start > visit.seen && start <= visit.entered;
});
if (!label && !fresh) return null;
@@ -13777,7 +13793,9 @@ function apply(ctx) {
shadow("conversation.chat.node", { key: "turn-trigger", priority: -10, locale: "chat", inject: face }, TriggerCell),
shadow("conversation.chat.node", { key: "tool-call", priority: -10, locale: "chat", inject: face }, ToolCell),
shadow("conversation.chat.node", { key: "turn-process", priority: -10, locale: "chat", inject: face }, TurnProcessCell),
- shadow("conversation.chat.node", { key: "turn-tail", priority: -10, locale: "chat", inject: face }, TurnTailCell),
+ // DSH's own turn tail stays, so what other plugins add there shows, such as the
+ // cards of the files a turn delivered; its copy and branch row is hidden.
+ shadow("conversation.chat.turnTail", { id: "bot-turn-separators", order: 1e3, inject: face }, TurnTailCell),
// A Bot condenses its conversation without telling anyone; the chat keeps showing
// every message.
shadow("conversation.chat.node", { key: "question-reply", priority: -10, locale: "chat" }, AnsweredCell),
diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.js
index fd20cd74..2980a390 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -1,4 +1,4 @@
-import { createElement as h, Fragment, useEffect, useLayoutEffect, useRef, useState } from 'react'
+import { createElement as h, Fragment, useEffect, useLayoutEffect, useMemo, useRef, useState } from 'react'
import { createPortal } from 'react-dom'
import { MarkdownText } from '@deepseek-ai/dsh-client-ui-primitives'
import { inkText } from './inks.js'
@@ -18,7 +18,7 @@ const mdLabels = () => ({ code: { copyLabel: t('Copy'), copiedLabel: t('Copied')
// `lead` (a sender avatar in group chats) sits beside the last bubble, in the same
// row, so it lines up with the bubble whether or not reactions hang below it.
-export function Bubbles({ texts, roster, selfId, actions, streaming, sessionId, msgKey, useUi, lead }) {
+export function Bubbles({ texts, roster, selfId, actions, streaming, sessionId, msgKey, useUi, lead, mentions }) {
const onClick = (event) => {
const target = mentionTarget(event)
if (target === null) return
@@ -37,7 +37,7 @@ export function Bubbles({ texts, roster, selfId, actions, streaming, sessionId,
h('div', { className: 'bt-msg-line' },
lead && last ? lead : null,
h('div', { className: 'bt-bubble' },
- h(MarkdownText, { text: linkMentions(text, roster.bots, selfId), streaming: live, labels: mdLabels(), variant: 'compact' })),
+ h(MarkdownText, { text: linkMentions(text, roster.bots, selfId), streaming: live, labels: mdLabels(), variant: 'compact', fileMentions: mentions })),
live ? null : h(MessageTools, { text, name: roster.byId[selfId]?.name ?? t('Bot'), sessionId, react: key ? emoji => actions.toggleReaction(msgKey, index, emoji) : undefined, actions })),
picked.length ? h('div', { className: 'bt-reacts' }, picked.map(emoji => h('button', {
key: emoji, type: 'button', className: 'bt-react', 'aria-label': t('Remove reaction {emoji}', { emoji }), onClick: () => actions.toggleReaction(msgKey, index, emoji),
@@ -106,11 +106,25 @@ function ThinkingRow({ text }) {
h('div', { className: 'bt-think-text' }, text))
}
-export function AssistantCell({ node, groupPart, sessionId, useRoster, useUi, useTurnSteps, useTurnContext, actions }) {
+// The files a finished turn changed or delivered, linked from inline code in its
+// reply as in DSH's own chat. DSH resolves them for the step that closes the turn.
+function useFileMentions({ node, openFile, fileMentions, useTurnData }) {
+ const tail = useTurnData?.('turn-tail')
+ const location = node.location
+ const turn = location?.kind === 'turn' || location?.kind === 'step' ? location.turn : undefined
+ const seq = node.data.finalNode?.seq
+ return useMemo(() => {
+ if (typeof fileMentions !== 'function' || turn?.status !== 'closed' || seq === undefined) return undefined
+ return tail?.closing?.finalNode.seq === seq ? fileMentions({ turn, seq, openFile }) : undefined
+ }, [fileMentions, openFile, seq, tail, turn])
+}
+
+export function AssistantCell({ node, groupPart, sessionId, openFile, fileMentions, useTurnData, useRoster, useUi, useTurnSteps, useTurnContext, actions }) {
const roster = useRoster(value => value)
const data = node.data
const steps = useTurnSteps(String(data.turn))
const contexts = useTurnContext(String(data.turn))
+ const mentions = useFileMentions({ node, openFile, fileMentions, useTurnData })
const hidden = Boolean(roster.roomsById[sessionId]) || isHiddenTurn(roster, sessionId, data.turn)
const texts = groupPart === 'reasoning' ? [] : data.blocks.filter(block => block.kind === 'text' && block.text.trim() !== '').map(block => block.text)
const running = data.status === 'running'
@@ -137,7 +151,7 @@ export function AssistantCell({ node, groupPart, sessionId, useRoster, useUi, us
})
}),
reasoning ? h(ThinkingRow, { text: reasoning }) : null,
- texts.length ? h(Bubbles, { texts, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ''}`, useUi }) : null)
+ texts.length ? h(Bubbles, { texts, roster, selfId, actions, streaming: running, sessionId, msgKey: `${sessionId}:${data.turn}:${node.key ?? data.seq ?? ''}`, useUi, mentions }) : null)
}
function EventLine({ prefix, bots, joiner = t('and'), onOpen, whole = false }) {
@@ -431,21 +445,24 @@ export function openingTurn(turns, firstTurns, hiddenTurns) {
// Began after the user last left the conversation and before this visit opened it.
export const unseenSince = (visit, time) => typeof visit?.seen === 'number' && time > visit.seen && time <= visit.entered
-// A turn's tail sits right before the next turn's first row, so the separator for a
-// pause between turns renders here.
-export function TurnTailCell({ node, sessionId, useTurnClock, useUi, actions }) {
- const data = node.data
- useEffect(() => { actions.noteTurnTime(sessionId, data.turn, 'end', data.time) }, [sessionId, data.turn, data.time])
+// An entry in DSH's own turn tail, after what other plugins put there (the cards of
+// the files a turn delivered). The tail sits right before the next turn's first row,
+// so the separator for a pause between turns renders here.
+export function TurnTailCell({ turn: location, sessionId, useTurnClock, useUi, actions }) {
+ const turn = location.turn
+ // DSH builds the tail from the turn's end, so it is there.
+ const time = location.end.time
+ useEffect(() => { actions.noteTurnTime(sessionId, turn, 'end', time) }, [sessionId, turn, time])
const label = useTurnClock((state) => {
- const start = nextTurnStart(state[sessionId] ?? {}, data.turn)
- return start !== undefined && start - data.time >= SEPARATOR_GAP_MS ? clockLabel(start) : ''
+ const start = nextTurnStart(state[sessionId] ?? {}, turn)
+ return start !== undefined && start - time >= SEPARATOR_GAP_MS ? clockLabel(start) : ''
})
// The unread divider sits before the first turn that began after the last visit;
// turns that begin while the conversation is open were watched live.
const visit = useUi(state => state.visits?.[sessionId])
const fresh = useTurnClock((state) => {
- if (typeof visit?.seen !== 'number' || data.time > visit.seen) return false
- const start = nextTurnStart(state[sessionId] ?? {}, data.turn)
+ if (typeof visit?.seen !== 'number' || time > visit.seen) return false
+ const start = nextTurnStart(state[sessionId] ?? {}, turn)
return start !== undefined && start > visit.seen && start <= visit.entered
})
if (!label && !fresh) return null
diff --git a/ds-bot/src/client/index.js b/ds-bot/src/client/index.js
index e14e7191..89b8a010 100644
--- a/ds-bot/src/client/index.js
+++ b/ds-bot/src/client/index.js
@@ -800,7 +800,9 @@ export function apply(ctx) {
shadow('conversation.chat.node', { key: 'turn-trigger', priority: -10, locale: 'chat', inject: face }, TriggerCell),
shadow('conversation.chat.node', { key: 'tool-call', priority: -10, locale: 'chat', inject: face }, ToolCell),
shadow('conversation.chat.node', { key: 'turn-process', priority: -10, locale: 'chat', inject: face }, TurnProcessCell),
- shadow('conversation.chat.node', { key: 'turn-tail', priority: -10, locale: 'chat', inject: face }, TurnTailCell),
+ // DSH's own turn tail stays, so what other plugins add there shows, such as the
+ // cards of the files a turn delivered; its copy and branch row is hidden.
+ shadow('conversation.chat.turnTail', { id: 'bot-turn-separators', order: 1000, inject: face }, TurnTailCell),
// A Bot condenses its conversation without telling anyone; the chat keeps showing
// every message.
shadow('conversation.chat.node', { key: 'question-reply', priority: -10, locale: 'chat' }, AnsweredCell),
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index 5b87ae7f..c6058be1 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -810,6 +810,10 @@ header[class*="_header"]:has(.bt-head)::before{content:"";position:absolute;inse
header[class*="_header"]:has(.bt-head)>[class*="_headerLeading"]{position:absolute;left:12px;top:10px;pointer-events:auto}
header[class*="_header"] .bt-head{flex:1 1 auto;width:100%}
[class*="_body"]:has(> [class*="_scrollBody"]){--dsh-chat-content-width:min(960px,100%)}
+/* DSH's turn tail keeps what plugins put in it (delivered files, the Bot's separators),
+ without its copy and branch row; a tail with nothing in it takes no room. */
+[data-turn-tail]>:not([data-slot="conversation.chat.turnTail"]){display:none!important}
+[class*="_flowItem"][data-chat-flow-kind="turn-tail"]:not(:has([data-slot="conversation.chat.turnTail"]:not(:empty))){display:none!important}
/* Every team Session belongs to a Bot or a group, so a blank one is an empty chat, not
the shell's new-session hero: no headline, no workspace or mode picker, and the
composer stays docked at the bottom. */
diff --git a/ds-bot/test/turn-tail.test.js b/ds-bot/test/turn-tail.test.js
new file mode 100644
index 00000000..cb075bd4
--- /dev/null
+++ b/ds-bot/test/turn-tail.test.js
@@ -0,0 +1,103 @@
+import assert from 'node:assert/strict'
+import { test } from 'node:test'
+import { fileURLToPath } from 'node:url'
+import { runInNewContext } from 'node:vm'
+import { build } from 'esbuild'
+
+const bundle = await build({
+ entryPoints: [fileURLToPath(new URL('../src/client/cells.js', import.meta.url))],
+ bundle: true, format: 'cjs', platform: 'node', write: false,
+ external: ['react', 'react-dom', '@deepseek-ai/dsh-client-ui-primitives'],
+})
+function MarkdownText() { return null }
+const effects = []
+const module = { exports: {} }
+runInNewContext(bundle.outputFiles[0].text, {
+ module, exports: module.exports,
+ require: (name) => {
+ const platform = {
+ react: {
+ createElement: (type, props, ...children) => ({ type, props: props ?? {}, children: children.flat(Infinity) }),
+ useState: initial => [initial, () => {}], useEffect: (run) => { effects.push(run) }, useRef: current => ({ current }),
+ useLayoutEffect: () => {}, useMemo: make => make(), Fragment: 'fragment',
+ },
+ 'react-dom': { createPortal: node => node },
+ '@deepseek-ai/dsh-client-ui-primitives': { MarkdownText },
+ }
+ if (!(name in platform)) throw new Error(`no platform module ${name}`)
+ return platform[name]
+ },
+})
+const { AssistantCell, TurnTailCell } = module.exports
+
+// Renders the named components of an element tree, leaving the rest as elements.
+const expand = (node, names) => {
+ if (Array.isArray(node)) return node.flatMap(child => expand(child, names))
+ if (node === null || typeof node !== 'object') return node
+ if (names.includes(node.type?.name)) return expand(node.type({ ...node.props, children: node.children }), names)
+ return { ...node, children: node.children.map(child => expand(child, names)) }
+}
+const find = (node, match) => {
+ if (Array.isArray(node)) return node.flatMap(child => find(child, match))
+ if (node === null || typeof node !== 'object') return []
+ return [...(match(node) ? [node] : []), ...find(node.children, match)]
+}
+
+const roster = { bots: [], byId: { b: { id: 'b', name: 'Writer' } }, roomsById: {}, exchangeTurns: {} }
+const finished = { turn: 3, status: 'closed', end: { time: 2_000 } }
+function cellProps({ closingSeq = 10, turn = finished } = {}) {
+ const asked = []
+ const links = { resolve: () => undefined }
+ const props = {
+ node: {
+ key: 'n10',
+ location: { kind: 'step', turn },
+ data: { turn: 3, step: 1, seq: 10, status: 'done', finalNode: { seq: 10 }, blocks: [{ kind: 'text', text: 'The brief is in `/work/brief.md`.' }] },
+ },
+ sessionId: 'b',
+ openFile: () => {},
+ fileMentions: (owner) => { asked.push(owner); return links },
+ useTurnData: key => (key === 'turn-tail' ? { closing: { finalNode: { seq: closingSeq } } } : undefined),
+ useRoster: select => select(roster),
+ useUi: () => null,
+ useTurnSteps: () => [],
+ useTurnContext: () => [],
+ actions: { noteLive() {} },
+ }
+ return { props, asked, links }
+}
+const markdownOf = props => find(expand(AssistantCell(props), ['Bubbles']), node => node.type === MarkdownText)
+
+test('a reply that closes its turn links the files the turn changed or delivered', () => {
+ const { props, asked, links } = cellProps()
+ const [markdown] = markdownOf(props)
+ assert.equal(markdown.props.fileMentions, links)
+ assert.equal(asked.length, 1)
+ assert.equal(asked[0].turn, finished)
+ assert.equal(asked[0].seq, 10)
+ assert.equal(asked[0].openFile, props.openFile)
+})
+
+test('a reply that does not close its turn, or one still running, links nothing', () => {
+ const earlier = cellProps({ closingSeq: 12 })
+ assert.equal(markdownOf(earlier.props)[0].props.fileMentions, undefined)
+ const running = cellProps({ turn: { turn: 3, status: 'open' } })
+ assert.equal(markdownOf(running.props)[0].props.fileMentions, undefined)
+ assert.equal(earlier.asked.length + running.asked.length, 0)
+})
+
+test('the turn tail entry notes when the turn ended and shows the pause before the next one', () => {
+ effects.length = 0
+ const noted = []
+ const clock = { b: { 3: { first: 1_000, end: 2_000 }, 4: { first: 2_000 + 60 * 60 * 1000 } } }
+ const out = TurnTailCell({
+ turn: finished,
+ sessionId: 'b',
+ useTurnClock: select => select(clock),
+ useUi: () => undefined,
+ actions: { noteTurnTime: (...args) => noted.push(args) },
+ })
+ for (const run of effects) run()
+ assert.deepEqual(noted, [['b', 3, 'end', 2_000]])
+ assert.equal(find(out, node => node.props?.className === 'bt-time-sep').length, 1)
+})