Skip to content

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

Let the mock read files in a message and pass on longer messages

Fei241143ba8536db80
diff --git a/ds-bot/dev/mock-llm.mjs b/ds-bot/dev/mock-llm.mjs
index 5a3be0c5..0b1412dd 100644
--- a/ds-bot/dev/mock-llm.mjs
+++ b/ds-bot/dev/mock-llm.mjs
@@ -17,7 +17,7 @@
//
// Commands to a Bot:
// 建群 名: A, B · 群发[回报] 名: 消息 · 改群 名 公告|管理员|模式|加|踢: 值 · 删群 名
-// 看群 名 (read_group_chat) · 转告 名: 消息 (message_bot) · 搜索:查询1 | 查询2 (web_search)
+// 看群 名 (read_group_chat) · 转告 名: 消息, also over several lines (message_bot) · 搜索:查询1 | 查询2 (web_search)
// 插话 名: 消息 (message_bot when "now") · 排队 名: 消息 (message_bot when "queue") · 叫停 名: 原因 (stop_bot)
// 长文 N / long N (N×1000 characters) · 长任务 N [K] (N steps of K×1000, default 4)
// 查记录 词 [词…] · 查锚点 part N #序号 · 查第 N 段 (read_own_chat)
@@ -26,6 +26,8 @@
// 卡片 K (K×1000 characters, then a question card) · 笔记模式 截断一次|缺节一次|总截断|总缺节|失败|正常
// 记住[@话题] 事实 · 团队记住 事实 (remember) · 忘掉 事实 (forget) · 回忆 [词] (recall)
// 查能力 [词] (names the mcp__ tools and catalog skills that contain 词; also in a group)
+// A message with a file (a long Bot message as a file, a file the user sent): the Bot
+// reads the saved path, then says how many lines it read and how the file ends.
// Memory panel: a summary restating the entries; asks 记住|remember X, 团队记住 X,
// 删掉|remove N, 改|edit N: X change entries, anything else gets the entry count.
// Commands in a group:
@@ -247,6 +249,10 @@ function decide(body) {
return [text(`我私聊里聊过 ${hits.length} 条${loose}:${hits.at(-1)?.slice(0, 120) ?? ''}${across}`)]
}
case 'read_group_chat': return [text(`群里最近:\n${resultText}`)]
+ case 'read': {
+ const content = resultText.replace(/<[^>]+>/g, '').replace(/^\s*\d+[\t→|:]/gm, '').trim()
+ return [text(result.is_error ? `附件没读成:${resultText.slice(0, 200)}` : `读了附件(${content.length} 字),结尾是「${content.slice(-24)}」。`)]
+ }
case 'remember':
case 'forget':
return [text(/^(Saved to|Updated in|Removed from) /.test(resultText) ? (used.name === 'remember' ? '记下了。' : '已经忘掉了。') : `没记成:${resultText}`)]
@@ -264,6 +270,10 @@ function decide(body) {
const userText = textOf(last?.content).trim()
// "撑爆": the provider rejects the request as past its window.
if (userText.startsWith('撑爆')) return 'overflow'
+ // A file in the message (a long Bot message, a file the user sent): DSH gives its saved
+ // path, and the Bot reads it first.
+ const saved = /verbatim read-only copy saved at ("(?:[^"\\]|\\.)*")/.exec(userText)
+ if (saved) return [tool('read', { file_path: JSON.parse(saved[1]) })]
// "长任务" keeps stepping when a Bot message splices into its turn (a relayed
// note); only a fresh opener or "[Stopped by" ends it. A spliced "[Message
// from X]" is taken into account there; it is answered in a turn of its own.
@@ -391,7 +401,7 @@ function decide(body) {
return [tool('update_group', { group: order[1], ...field })]
}
if ((order = /^删群\s*(\S+)$/.exec(userText))) return [tool('delete_group', { group: order[1] })]
- if ((order = /^转告\s*(\S+?)\s*[::]\s*(.+)$/.exec(userText))) return [tool('message_bot', { to: order[1], message: order[2] })]
+ if ((order = /^转告\s*(\S+?)\s*[::]\s*([\s\S]+)$/.exec(userText))) return [tool('message_bot', { to: order[1], message: order[2] })]
if ((order = /^插话\s*(\S+?)\s*[::]\s*(.+)$/.exec(userText))) return [tool('message_bot', { to: order[1], message: order[2], when: 'now' })]
if ((order = /^排队\s*(\S+?)\s*[::]\s*(.+)$/.exec(userText))) return [tool('message_bot', { to: order[1], message: order[2], when: 'queue' })]
if ((order = /^叫停\s*(\S+?)\s*[::]\s*(.+)$/.exec(userText))) return [tool('stop_bot', { bot: order[1], reason: order[2] })]