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/fix/165-group-work-one-place' into feat/262-bot-handoffs

Fei241159e5a0005c1c
diff --cc ds-bot/src/host/tools.js
index 41fa9046,c3152a3e..19af8881
--- a/ds-bot/src/host/tools.js
+++ b/ds-bot/src/host/tools.js
@@@ -2,8 -2,9 +2,9 @@@
// question card. Group rounds and reading chats are in groups.js.
import { randomUUID } from 'node:crypto'
import { defineTool } from '@deepseek-ai/dsh-tools'
-import { COLORS, EXTRA_COLORS, MAX_HOPS, MAX_UNATTENDED_MESSAGES, MAX_UNREAD_REQUESTS, ROOM_BOT_ROUNDS, ROOM_MODES, SOURCE_KIND } from './constants.js'
+import { COLORS, EXTRA_COLORS, MAX_HOPS, MAX_UNATTENDED_MESSAGES, MAX_UNREAD_REQUESTS, MESSAGE_INLINE_MAX, ROOM_BOT_ROUNDS, ROOM_MODES, SOURCE_KIND } from './constants.js'
import { unquote } from './text.js'
+ import { mentionSpans } from '../shared/mentions.js'
export const output = { schema: { type: 'string' }, render: (_args, value) => [{ type: 'text', text: String(value) }] }
export const GROUP_REF = { type: 'string', required: true, description: 'Exact group chat name from list_bots' }
@@@ -126,7 -143,11 +144,12 @@@ export function install(rt)
const target = rt.findBot(args.to)
if (target === undefined) return `No Bot named ${args.to}. Team: ${Object.values(state.bots).map(bot => bot.name).join(', ')}`
if (target.id === sender.id) return 'You cannot message yourself.'
+ if (String(args.message ?? '').trim() === '') return 'Write a message to send.'
+ const room = rt.roomOf(rt.groupOwners.get(exec.agent?.id)?.roomId)
+ if (room !== undefined) return callInGroup(exec, room, sender, target, String(args.message ?? '').trim())
+ const posted = calledInPosts.get(exec.agent?.id)
+ const postedIn = posted !== undefined && posted.turn === turnOf(exec) ? posted.calls.get(target.id) : undefined
+ if (postedIn !== undefined) refuse(`Not sent: you called ${target.name} in "${postedIn}" in this turn, and it works on that there. Send each task one way only; to add to it, post in that group.`)
const hop = nextHop(exec)
if (hop > MAX_HOPS) return CHAIN_TOO_LONG
checkUnattended()
@@@ -140,7 -159,7 +163,7 @@@
const toUser = args.reply_to === 'user'
const working = rt.live.get(chat)?.turn !== undefined
const steer = args.when !== 'queue' && !toUser
- await rt.deliver({ fromId: sender.id, toId: target.id, text: long.text, files: long.files, length: long.length, role: 'request', hop, steer, ...(toUser ? { audience: 'user' } : callerRoom(exec)) })
- await rt.deliver({ fromId: sender.id, toId: target.id, text: args.message, role: 'request', hop, steer, ...(toUser ? { audience: 'user' } : {}) })
++ await rt.deliver({ fromId: sender.id, toId: target.id, text: long.text, files: long.files, length: long.length, role: 'request', hop, steer, ...(toUser ? { audience: 'user' } : {}) })
rt.unattended.sent += 1
const sent = toUser
? `Delivered to ${target.name}. It will answer the user in its own chat; nothing comes back to you, so point the user to ${target.name}'s chat instead of relaying.`