A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Open a new Bot with a plain question that gives way to its instructions
Fei24113044e0bcb226
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex be0739b5..cfd3e1c6 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -4,6 +4,10 @@ All notable changes to DS Bot are listed here. The format follows [Keep a Change## [Unreleased]+### Fixed++- A new Bot asks where to start in its first reply instead of on a question card, and follows its own instructions where they say otherwise.+## [0.1.4] - 2026-10-13### Addeddiff --git a/ds-bot/dev/mock-llm.mjs b/ds-bot/dev/mock-llm.mjsindex 21fc30fc..61822cf1 100644--- a/ds-bot/dev/mock-llm.mjs+++ b/ds-bot/dev/mock-llm.mjs@@ -286,14 +286,10 @@ function decide(body) {if (isMain) {return [text(`嘿,我是 ${me}。从今天起我来管你的 Bot 团队,需要拍板的事找我就行。`),- text('现在还只有我一个。我先摸清你每天用的工具,再决定先上谁。'),- tool('ask_user', { question: '先让团队帮你做哪块?', options: ['整理日常事务', '做一次调研', '规划这一周', '先看看再说'] }),+ text('现在还只有我一个。我先摸清你每天用的工具,再决定先上谁。先让团队帮你做哪块?'),]}- return [- text(`Hi, I'm ${me}. Where should I start?`),- tool('ask_user', { question: 'Where should we start?', options: ['Review what exists', 'Plan this week', 'Start a first draft', 'Something else'], allowCustom: true }),- ]+ return [text(`Hi, I'm ${me}. Where should I start?`)]}if (/^\[Group chat "[^"]*" · replies to your post\]/.test(userText)) {const replies = userText.split('\n').filter(line => /^[^:\n]{1,40}: /.test(line)).lengthdiff --git a/ds-bot/dev/smoke.mjs b/ds-bot/dev/smoke.mjsindex 05877dea..cab38529 100644--- a/ds-bot/dev/smoke.mjs+++ b/ds-bot/dev/smoke.mjs@@ -174,11 +174,12 @@ await step('bootstrap: Chief waits for a model', () => api('state'), (value, cal?? expect(models.length > 0, 'no models listed for the model card')})-await step('user picks a model; Chief greets and asks', () => api('update-bot', { id: chief().id, model: models.at(-1).ref }), () => {+await step('user picks a model; Chief greets and asks in its reply', () => api('update-bot', { id: chief().id, model: models.at(-1).ref }), (_value, calls) => {const current = state()return expect(chief().model === models.at(-1).ref, `Chief runs on ${chief().model}`)?? expect(chief().kickoff === undefined, 'the greeting is still held')- ?? expect(current.questions?.[chief().sessionId ?? chief().id], 'expected Chief to leave a question card')+ ?? expect(!current.questions?.[chief().sessionId ?? chief().id], 'the greeting should not leave a question card')+ ?? expect(saidText(calls, /先让团队帮你做哪块/), 'expected Chief to ask in its reply')})await step('Chief creates Writer, who replies', () => send(chief().id, '创建一个叫Writer的bot'), () => {diff --git a/ds-bot/dev/ui-shots.mjs b/ds-bot/dev/ui-shots.mjsindex e25f5438..af9a253c 100644--- a/ds-bot/dev/ui-shots.mjs+++ b/ds-bot/dev/ui-shots.mjs@@ -97,7 +97,7 @@ if (main && !main.model) {await shot('model-card')await card.locator('.bt-model-opt').first().click()check(await card.waitFor({ state: 'detached', timeout: 30_000 }).then(() => true, () => false), 'the model card goes once a model is picked')- check(await page.locator('.bt-q:not(.bt-model-card)').first().waitFor({ timeout: 60_000 }).then(() => true, () => false), `${main.name} greets and asks after the pick`)+ check(await page.getByText('先让团队帮你做哪块', { exact: false }).last().waitFor({ timeout: 60_000 }).then(() => true, () => false), `${main.name} greets and asks after the pick`)await page.waitForTimeout(1500)await shot('main-greets')state = await api('state', {})diff --git a/ds-bot/src/host/roster.js b/ds-bot/src/host/roster.jsindex dbff5db9..21d1f046 100644--- a/ds-bot/src/host/roster.js+++ b/ds-bot/src/host/roster.js@@ -84,16 +84,19 @@ export function install(rt) {const creator = rt.botOf(createdBy)const original = rt.botOf(copyOf)const language = rt.uiLanguage?.()+ // The kickoff arrives as a user message, so it outranks the Bot's instructions+ // unless it gives way to them, and it names no tool those instructions may rule out.const kickoff = main- ? `You were just set up as the user's Main Bot. Greet the user in one or two short messages: say you will run their Bot team and that they can come to you for anything that needs a decision. Then use ask_user to ask what they want the team to help with first (3-4 short options). Write in ${language ?? 'the user\'s language if known; otherwise Chinese'}.`+ ? `You were just set up as the user's Main Bot. Greet the user in one or two short messages: say you will run their Bot team and that they can come to you for anything that needs a decision. Then ask in one short question what they want the team to help with first. Write in ${language ?? 'the user\'s language if known; otherwise Chinese'}.`: original- ? `The user just made you as a copy of ${original.name}: same job, fresh memory. Greet the user in one short message, then use ask_user to ask what this copy should focus on (3-4 short options).`+ ? `The user just made you as a copy of ${original.name}: same job, fresh memory. Greet the user in one short message, then ask in one short question what this copy should focus on.`: creator- ? `${creator.name} just created you for the user.${brief ? ` Why you exist: ${brief}` : ''}\nGreet the user in one short message, then use ask_user to ask where to start (3-4 short options relevant to your role, with allowCustom). Keep it brief.`+ ? `${creator.name} just created you for the user.${brief ? ` Why you exist: ${brief}` : ''}\nGreet the user in one short message, then ask in one short question where to start. Keep it brief.`: brief? `The user just created you and sent this first message:\n\n${brief}\n\nIntroduce yourself in one short line, then help with it.`- : 'The user just created you. Greet the user in one short message, then use ask_user to ask what you should focus on (3-4 short options, with allowCustom).'- const text = !main && language ? `${kickoff}\nWrite in ${language}.` : kickoff+ : 'The user just created you. Greet the user in one short message, then ask in one short question what you should focus on.'+ const opener = `${kickoff}\nWhere your instructions say otherwise, follow them.`+ const text = !main && language ? `${opener}\nWrite in ${language}.` : openerconst bot = state.bots[id]if (modelRef === undefined) {bot.kickoff = { text, from: createdBy ?? null, ...(main ? { main: true } : {}) }diff --git a/ds-bot/test/roster.test.js b/ds-bot/test/roster.test.jsindex f6188921..180b1c6f 100644--- a/ds-bot/test/roster.test.js+++ b/ds-bot/test/roster.test.js@@ -129,6 +129,56 @@ test('a new name must be one "@" can call; a name saved before the rule still saassert.equal((await call('update-bot', { id: writer.id, name: '新 Writer' })).ok, true)})+// The kickoff arrives as a user message, so it must not name a question tool the Bot's+// instructions can rule out, and it gives way to those instructions.+for (const kind of ['main', 'copy', 'made by a Main Bot', 'made by the user']) {+ test(`the ${kind} kickoff asks in plain text and gives way to the Bot's instructions`, async (t) => {+ const { call, stop, sent, ctx } = start(undefined, { models: ['deepseek-v4-flash'] })+ t.after(stop)+ const chief = (await call('state', { locale: 'zh-CN' })).value.mainBotId+ const instructions = 'Use only plain text. Never call ask_user or ask_user_question.'+ let bot+ if (kind === 'main') {+ bot = (await call('update-bot', { id: chief, instructions, model: 'deepseek/deepseek-v4-flash' })).value+ } else if (kind === 'copy') {+ const original = (await call('create-bot', { name: 'Writer', instructions })).value+ await until(() => sent.some(entry => entry.sessionId === original.id))+ bot = (await call('duplicate-bot', { id: original.id })).value+ } else if (kind === 'made by a Main Bot') {+ await ctx.registeredTools.get('create_bot').execute({ name: 'Writer', role: 'Writer', instructions, brief: 'Review the team notes.' }, { agent: { id: chief } })+ bot = (await call('state', {})).value.bots.find(entry => entry.name === 'Writer')+ } else {+ bot = (await call('create-bot', { name: 'Writer', instructions })).value+ }+ await until(() => sent.some(entry => entry.sessionId === bot.id))+ const greetings = sent.filter(entry => entry.sessionId === bot.id)+ assert.equal(greetings.length, 1)+ const { message } = greetings[0]+ const text = message.content[0].text+ assert.equal(message.source.role, 'kickoff')+ assert.equal(bot.instructions, instructions)+ assert.doesNotMatch(text, /\b(?:ask_user(?:_question)?|allowCustom)\b/)+ assert.match(text, /ask in one short question/)+ assert.match(text, /Where your instructions say otherwise, follow them\./)+ assert.match(text, /Write in Chinese \(简体中文\)\./)+ if (kind === 'copy') assert.match(text, /copy of Writer/)+ if (kind === 'made by a Main Bot') assert.match(text, /Why you exist: Review the team notes\./)+ })+}++test('a first message from the user is helped with, not replaced by an opening question', async (t) => {+ const { call, stop, sent } = start(undefined, { models: ['deepseek-v4-flash'] })+ t.after(stop)+ await call('state', {})+ const brief = 'Review the team notes and list the next tasks.'+ const bot = (await call('create-bot', { name: 'Writer', brief })).value+ await until(() => sent.some(entry => entry.sessionId === bot.id))+ const text = sent.find(entry => entry.sessionId === bot.id).message.content[0].text+ assert.ok(text.includes(brief))+ assert.match(text, /then help with it\./)+ assert.doesNotMatch(text, /\b(?:ask_user(?:_question)?|allowCustom)\b/)+})+test('a group the user makes without a first message opens with its admin asking what it is for', async (t) => {const { call, stop, sent, ctx, home } = start(undefined, { models: ['deepseek-v4-flash'] })t.after(stop)