A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Keep file references, titled links and web addresses out of "@Name"
Fei2411709a12e6647c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 3e003d94..4ddf3026 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,6 +32,7 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change- A provider adapter that cannot measure tokens no longer fails every turn. The context size is estimated instead, with one warning in the log.- The memory panel's summary works on models that think by default. The call asks for the model's lowest thinking level, and when the answer is cut off at the output limit it is written once more with a larger budget instead of failing or being saved half-written.- A message sent to a group chat while a round is running joins that round before the next member speaks. Everyone still to speak sees it, and the members it is for answer it in the same round. Before, it waited for the whole round to end. A message with images or a referenced conversation still waits for its own round.+- In your own messages, `@Name` of a Bot shows as that Bot and opens its chat, instead of a file named after the first word. A group chat calls exactly the Bots a message shows as called: code, links, web addresses and file references such as `@docs/guide.md` call nobody.## [0.1.2] - 2026-10-11diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 8c7ad5ec..5525738c 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -1324,9 +1324,9 @@ var allThemes = () => ({ ...THEMES, ...customThemes });// src/shared/mentions.jsvar ALL_WORDS = ["all", "everyone", "所有人", "全体"];-var NAME_GOES_ON = /^[a-z0-9_-]/i;-var ADDRESS_BEFORE = /[a-z0-9_.]/i;-var LITERAL = /```[\s\S]*?(?:```|$)|`[^`\n]*`|\[[^\]\n]*\]\([^)\s]*\)/g;+var NAME_GOES_ON = /^(?:[a-z0-9_\-/\\]|\.[a-z0-9_-])/i;+var ADDRESS_BEFORE = /[a-z0-9_./]/i;+var LITERAL = /```[\s\S]*?(?:```|$)|`[^`\n]*`|\[[^\]\n]*\]\([^)\s]*(?:\s+(?:"[^"\n]*"|'[^'\n]*'))?\)/g;var fitsAt = (text, at, word) => text.slice(at, at + word.length).toLowerCase() === word.toLowerCase() && !NAME_GOES_ON.test(text.slice(at + word.length));var overlaps = (spans, start, end) => spans.some((span) => start < span.end && span.start < end);function nameProblem(name) {@@ -12272,7 +12272,7 @@ function contentParts(content) {else if ((block?.type === "image" || block?.type === "file") && block.attachment !== void 0) attachments.push(block);else rest.push(block);}- return { text: texts2.join(""), attachments, rest };+ return { text: texts2.join("\n"), attachments, rest };}function mentionableBots(roster, sessionId) {const room2 = roster.roomsById[sessionId];@@ -12348,7 +12348,7 @@ function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageIma) : null,referenceLabels.length > 0 ? (0, import_react31.createElement)("div", { className: "bt-urefs" }, t("Referenced {labels}", { labels: referenceLabels.join(t(", ")) })) : null),- steering || text === "" ? null : (0, import_react31.createElement)("div", { className: "bt-utools" }, (0, import_react31.createElement)(CopyButton, { text }))+ text === "" ? null : (0, import_react31.createElement)("div", { className: "bt-utools" }, (0, import_react31.createElement)(CopyButton, { text })));}var USER_MESSAGE_CSS = `diff --git a/ds-bot/src/client/user-message.js b/ds-bot/src/client/user-message.jsindex 595a3343..8ccc06e2 100644--- a/ds-bot/src/client/user-message.js+++ b/ds-bot/src/client/user-message.js@@ -23,7 +23,8 @@ export function contentParts(content) {else if ((block?.type === 'image' || block?.type === 'file') && block.attachment !== undefined) attachments.push(block)else rest.push(block)}- return { text: texts.join(''), attachments, rest }+ // Joined as the group host joins them, so a mention never spans two blocks here only.+ return { text: texts.join('\n'), attachments, rest }}// In a group only its members are called; elsewhere a mention opens that Bot's chat.@@ -78,7 +79,7 @@ function CopyButton({ text }) {const clock = time => (typeof time === 'number' ? new Date(time).toLocaleTimeString(dateLocale(), { hour: 'numeric', minute: '2-digit' }) : undefined)-// A sent message, or one that joined a running turn ("steering"), which has no tools.+// A sent message, or one that joined a running turn ("steering").export function UserMessageCell({ node, sessionId, useRoster, actions, renderMessageImages, openFile, openSkill }) {const roster = useRoster(value => value)const data = node.data ?? {}@@ -93,7 +94,7 @@ export function UserMessageCell({ node, sessionId, useRoster, actions, renderMesh(UserText, { text, bots: mentionableBots(roster, sessionId), referenceLabels, skillNames: data.skillNames ?? [], references, actions }),rest.map((block, index) => (ui.JsonBlock ? h(ui.JsonBlock, { key: index, label: t('Content'), payload: block }) : null))) : null,referenceLabels.length > 0 ? h('div', { className: 'bt-urefs' }, t('Referenced {labels}', { labels: referenceLabels.join(t(', ')) })) : null),- steering || text === '' ? null : h('div', { className: 'bt-utools' }, h(CopyButton, { text })))+ text === '' ? null : h('div', { className: 'bt-utools' }, h(CopyButton, { text })))}export const USER_MESSAGE_CSS = `diff --git a/ds-bot/src/shared/mentions.js b/ds-bot/src/shared/mentions.jsindex 6085d13e..54ef4747 100644--- a/ds-bot/src/shared/mentions.js+++ b/ds-bot/src/shared/mentions.js@@ -3,12 +3,14 @@// is what gets called. Pure, so both sides import it.export const ALL_WORDS = ['all', 'everyone', '所有人', '全体']-// A letter, digit, "_" or "-" after a name means a longer word ("@Mi" in "@MiniMax");-// a letter, digit, "_" or "." before "@" means an address ("a@b").-const NAME_GOES_ON = /^[a-z0-9_-]/i-const ADDRESS_BEFORE = /[a-z0-9_.]/i-// Code and Markdown links are literal text.-const LITERAL = /```[\s\S]*?(?:```|$)|`[^`\n]*`|\[[^\]\n]*\]\([^)\s]*\)/g+// A letter, digit, "_" or "-" after a name means a longer word ("@Mi" in "@MiniMax"),+// and "/", "\" or a "." that goes on into a word mean a path: DSH writes a file+// reference as "@docs/guide.md", which must not call a Bot named Docs. A letter,+// digit, "_", "." or "/" before "@" means an address ("a@b", "medium.com/@Writer").+const NAME_GOES_ON = /^(?:[a-z0-9_\-/\\]|\.[a-z0-9_-])/i+const ADDRESS_BEFORE = /[a-z0-9_./]/i+// Code and Markdown links, with or without a title, are literal text.+const LITERAL = /```[\s\S]*?(?:```|$)|`[^`\n]*`|\[[^\]\n]*\]\([^)\s]*(?:\s+(?:"[^"\n]*"|'[^'\n]*'))?\)/gconst fitsAt = (text, at, word) => text.slice(at, at + word.length).toLowerCase() === word.toLowerCase()&& !NAME_GOES_ON.test(text.slice(at + word.length))diff --git a/ds-bot/test/mention-rule.test.js b/ds-bot/test/mention-rule.test.jsindex 74370dda..0e0a1a22 100644--- a/ds-bot/test/mention-rule.test.js+++ b/ds-bot/test/mention-rule.test.js@@ -24,7 +24,7 @@ runInNewContext(bundle.outputFiles[0].text, {return platform[name]},})-const { userTextParts, mentionableBots, canDrawUserMessages } = module.exports+const { userTextParts, mentionableBots, canDrawUserMessages, contentParts } = module.exportsconst plain = value => JSON.parse(JSON.stringify(value))const called = text => mentionSpans(text, bots).map(span => (span.all ? '@all' : span.bot.name))@@ -41,6 +41,14 @@ test('addresses, code and links never call', () => {assert.deepEqual(called('run `@Chief` now'), [])assert.deepEqual(called('```\n@Chief\n```\n@K'), ['K'])assert.deepEqual(called('[@Chief](https://example.com) @K'), ['K'])+ assert.deepEqual(called('[read @Chief](https://example.com "docs") @K'), ['K'])+ assert.deepEqual(called("[read @Chief](https://example.com 'docs')"), [])+ assert.deepEqual(called('https://medium.com/@Chief'), [])+})++test('a file or folder reference that starts with a Bot name is not a call', () => {+ assert.deepEqual(called('看 @Chief.md 和 @chief/notes.md、@Chief\\a.txt'), [])+ assert.deepEqual(called('@Chief. @K。@Chief...'), ['Chief', 'K', 'Chief'])})test('a referenced conversation\'s "@label" is a reference, once per label', () => {@@ -49,7 +57,7 @@ test('a referenced conversation\'s "@label" is a reference, once per label', ()})test('the group host and the bubbles call the same Bots', () => {- const texts = ['@新 Bot 提权', '@新 Bot 2 来一下', '[email protected] @K', '`@Chief` @新 Bot', '@Chief,@K。']+ const texts = ['@新 Bot 提权', '@新 Bot 2 来一下', '[email protected] @K', '`@Chief` @新 Bot', '@Chief,@K。', '@Chief.md @K', '[see @K](https://x.dev "t") @Chief']for (const text of texts) {const host = mentionsIn(text, bots).found.map(bot => bot.id)const linked = [...linkMentions(text, bots, undefined).matchAll(new RegExp(`\\]\\(${MENTION_ORIGIN}([^)]+)\\)`, 'g'))].map(match => match[1])@@ -62,6 +70,11 @@ test('the group host and the bubbles call the same Bots', () => {test('the user bubble keeps the text around a mention, and a group only calls its members', () => {assert.deepEqual(plain(userTextParts('@新 Bot 提权', bots)), [{ bot: bots[0], label: '新 Bot' }, { text: ' 提权' }])assert.deepEqual(plain(userTextParts('看 @a/b.md', bots)), [{ text: '看 @a/b.md' }])+ assert.deepEqual(plain(userTextParts('打开 @K.md', bots)), [{ text: '打开 @K.md' }])+ // Text blocks join as the group host joins them, so "@新" + " Bot" is not "@新 Bot".+ const { text } = contentParts([{ type: 'text', text: 'hi @新' }, { type: 'text', text: ' Bot' }])+ assert.equal(text, 'hi @新\n Bot')+ assert.deepEqual(plain(userTextParts(text, bots).filter(part => part.bot)), [])const roster = { bots, byId: Object.fromEntries(bots.map(bot => [bot.id, bot])), roomsById: { r: { members: ['c', 'k'] } } }assert.deepEqual(plain(mentionableBots(roster, 'r').map(bot => bot.id)), ['c', 'k'])assert.equal(mentionableBots(roster, 'a').length, 4)