Skip to content

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

Merge branch 'main' into devin/message-bot-steer

Fei24118cb9cdefefa1
diff --cc CHANGELOG.md
index 781292f2,d1f2c166..5473a268
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -12,7 -11,7 +12,8 @@@ All notable changes to DS Bot are liste
### Changed
+- When a Bot messages another Bot that is working, the message reaches it at its next step instead of waiting until its current work is done, and the reply still comes back. A Bot can still queue a separate task behind the current work.
+ - Bots give a brief progress message when starting a multi-step task in their own chat with the user, and at meaningful milestones on long tasks.
- Every Bot can change its own name, role, color, model and instructions; only a Main Bot changes other Bots.
- Updating a copy installed from GitHub uses the repository's current address.
diff --cc ds-bot/dev/mock-llm.mjs
index 56528947,862d4b24..d3586216
--- a/ds-bot/dev/mock-llm.mjs
+++ b/ds-bot/dev/mock-llm.mjs
@@@ -158,9 -158,11 +158,11 @@@ function decide(body)
const call = [...messages].reverse().find(m => m.role === 'assistant' && Array.isArray(m.content) && m.content.some(b => b.type === 'tool_use'))
const used = call?.content.find(b => b.type === 'tool_use' && b.id === result.tool_use_id) ?? call?.content.find(b => b.type === 'tool_use')
// "长任务 N [K]": N steps in one turn, each adding about K thousand characters (default 4).
- const openerAt = messages.findLastIndex(m => m.role === 'user' && !isResults(m) && /^长任务\s*\d+/.test(textOf(m.content)))
+ const openerAt = messages.findLastIndex(m => m.role === 'user' && !isResults(m) && /^长任务\s*\d+/.test(textOf(m.content).trimStart()))
if (openerAt !== -1 && used?.name === 'list_bots') {
- const [, steps, size = 4] = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[openerAt].content).trimStart()).map(Number)
- const task = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[openerAt].content))
++ const task = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[openerAt].content).trimStart())
+ const steps = Number(task[1])
+ const size = Number(task[2] ?? 4)
const done = messages.slice(openerAt + 1).filter(isResults).length
if (done < steps) return [text(filler(size * 1000, `步骤${done + 1}`)), tool('list_bots', {})]
return [text(`长任务做完了,一共 ${done} 步。`)]
@@@ -231,17 -233,15 +233,19 @@@
const userText = textOf(last?.content).trim()
// "撑爆": the provider rejects the request as past its window.
if (userText.startsWith('撑爆')) return 'overflow'
- // "长任务" keeps stepping when a Bot message splices into its turn (an
- // interrupt or a relayed note); only a fresh opener or "[Stopped by" ends it.
- const longOpener = messages.findLastIndex(m => m.role === 'user' && !isResults(m) && /^长任务\s*\d+/.test(textOf(m.content)))
- if (longOpener !== -1 && /^\[(?:Interrupt|Message|Reply) from /.test(userText)) {
- const task = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[longOpener].content))
+ // "长任务" 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]" also gets a one-line acknowledgement, as its joined reply's text.
+ const longOpener = messages.findLastIndex(m => m.role === 'user' && !isResults(m) && /^长任务\s*\d+/.test(textOf(m.content).trimStart()))
+ if (longOpener !== -1 && /^\[(?:Message|Reply) from /.test(userText)) {
- const [, steps, size = 4] = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[longOpener].content).trimStart()).map(Number)
++ const task = /^长任务\s*(\d+)(?:\s+(\d+))?/.exec(textOf(messages[longOpener].content).trimStart())
+ const steps = Number(task[1])
+ const size = Number(task[2] ?? 4)
const done = messages.slice(longOpener + 1).filter(isResults).length
- if (done < steps) return [text(filler(size * 1000, `步骤${done}`)), tool('list_bots', {})]
+ if (done < steps) {
+ const joined = /^\[Message from ([^\]]+)\]/.exec(userText)?.[1]
+ return [text(`${joined ? `${joined} 插进来的话收到了,继续干活。\n` : ''}${filler(size * 1000, `步骤${done}`)}`), tool('list_bots', {})]
+ }
}
// "报错": the provider rejects the key, in the user's chat or in a message from a Bot.
if (/^报错$/.test(userText) || /^(?:\[Message from [^\]]*\]\n报错\n?)+$/.test(userText)) return 'auth'