A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Merge main into bad-message recovery
lulu feizhu32e8d10a966d
diff --cc CHANGELOG.mdindex da18b063,3e003d94..ee22e247--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -4,14 -4,35 +4,39 @@@ All notable changes to DS Bot are liste## [Unreleased]+ ### Added++ - In a Bot's chat or a group chat, `@` lists the Bots you can mention first: a group's members and **Everyone**, or the other Bots. Picking one writes `@Name`.+ - **Reference a chat** in the composer's **+** menu adds another Bot's chat, or a recent conversation outside the team, to your message as context.+ - A Main Bot can stop another Bot's running turn. The Bot is told why, and its reply goes back to the Main Bot.+### 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. It answers once that work is done, and the reply 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.+ - The Usage page groups its statistics, chart, rankings and activity into one panel.+ - Hover over an Activity day to see its token count.++ ### Fixed++ - When DS Bot cannot save the Bot team, the change now fails with an error instead of being lost silently.+ - A Bot team file that cannot be read is no longer replaced by an empty team; a damaged file is kept as a backup.+ - Warnings in the host log hide keys and tokens.+ - Bots receive the current time on their first model step and refresh it after ten minutes, even when their DSH preset does not supply a clock.+ - In a group chat, a conversation referenced in a message reached none of the members, and a reference whose title started with a member's name called that member. Now the members who answer the message get the referenced conversation.+ - In a group chat, typing `@` and a Bot's name and pressing Enter inserted a conversation reference instead of the Bot's name.+ - Deleting a Bot or group chat also removes its scheduled tasks, including ones left on the Bot's earlier chat parts. Before, armed tasks stayed active and kept running the deleted Session; the archive that would have stopped them was refused and the failure was silent.+ - A long conversation's fresh part keeps the Bot's model and thinking level. Before, the new part fell back to the default model.+ - 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.+### Fixed++- #73: Offload images from completed turns and move on when a model request keeps failing.+## [0.1.2] - 2026-10-11### Addeddiff --cc ds-bot/src/host/parts.jsindex 4666acbf,a2c434ab..d40d2d43--- a/ds-bot/src/host/parts.js+++ b/ds-bot/src/host/parts.js@@@ -585,11 -593,11 +602,12 @@@ export function install(rt)exchangeId: job.info?.exchangeId ?? randomUUID(),handoff: true,...(resume ? { resume: true } : {}),+ ...(resume && job.joined?.length ? { joined: job.joined } : {}),})- /** @type {Map<string, {botId:string, roomId?:string, carry:any[], info?:any, resume:boolean, overflow:boolean, failed?:string, hard:boolean, started?:boolean, moved?:boolean, noteFailed?:boolean}>} */- /** @type {Map<string, {botId:string, roomId?:string, carry:any[], info?:any, joined?:any[], resume:boolean, overflow:boolean, hard:boolean, started?:boolean, moved?:boolean, noteFailed?:boolean}>} */++ /** @type {Map<string, {botId:string, roomId?:string, carry:any[], info?:any, joined?:any[], resume:boolean, overflow:boolean, failed?:string, hard:boolean, started?:boolean, moved?:boolean, noteFailed?:boolean}>} */const switches = new Map()+ const rescued = new Set()// Parts that have not started a turn yet, with their handoff package's size.const freshParts = new Map()// Context size where a part started, or where a checkpoint or a failed switch left@@@ -630,10 -638,10 +648,10 @@@// `hard`: past the hard line or the window, the part moves on even without a note// from the model.- function startSwitch(agent, { resume = false, carry = [], info, overflow = false, failed, hard = overflow } = {}) {- function startSwitch(agent, { resume = false, carry = [], info, joined, overflow = false, hard = overflow } = {}) {++ function startSwitch(agent, { resume = false, carry = [], info, joined, overflow = false, failed, hard = overflow } = {}) {const place = placeOf(agent.id)if (place === undefined || switches.has(agent.id) || readOnly()) return- const job = { ...place, carry: [...carry], info, resume, overflow, failed, hard }- const job = { ...place, carry: [...carry], info, joined, resume, overflow, hard }++ const job = { ...place, carry: [...carry], info, joined, resume, overflow, failed, hard }switches.set(agent.id, job)void runSwitch(agent, job).catch(error => rt.warn('ds-bot: %s did not move on to a fresh part: %s', rt.botOf(job.botId)?.name ?? agent.id, error))@@@ -796,20 -805,6 +816,20 @@@return { kind: 'reject' }}, { prepend: true })+ ctx.on('agent/request-error', async (payload, next) => {+ const failure = payload.failure+ if (!STUCK_CODES.includes(failure?.code)) return next()+ const decided = await next()+ if (decided !== undefined || payload.signal?.aborted) return decided+ await rt.load()+ const { agent } = payload+ if (!rt.isBotSession(agent.id) || switches.has(agent.id) || readOnly() || rescued.has(agent.id)) return decided+ const entry = rt.liveOf(agent.id)+ entry.switched = true- startSwitch(agent, { resume: true, info: entry.info, overflow: true, failed: failure.code })++ startSwitch(agent, { resume: true, info: entry.info, joined: [...(entry.joined ?? [])], overflow: true, failed: failure.code })+ return undefined+ }, { prepend: true })+ctx.on('agent/request-error', async (payload, next) => {if (payload.failure?.code !== OVERFLOW || payload.signal?.aborted) return next()await rt.load()