A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Inherit the profile default thinking level for a new Bot
Fei24110f5e6da6fb45
diff --git a/ds-bot/src/host/models.js b/ds-bot/src/host/models.jsindex 3bb8474a..ac06f9f3 100644--- a/ds-bot/src/host/models.js+++ b/ds-bot/src/host/models.js@@ -123,6 +123,15 @@ export function install(rt) {throw new Error(`Thinking level ${wanted} is not available for ${ref}. Available: ${efforts.map(effort => effort.name).join(', ')}`)}+ // The profile default model's thinking level, when the model a Bot starts on+ // serves it. A level the model does not know is ignored, like an inherited+ // `bot.effort` — the model's own default applies instead.+ async function defaultEffort(ref) {+ const wanted = ctx.get?.('agentDefaultModel')?.currentSelection?.()?.reasoningEffort+ if (ref === undefined || wanted === undefined) return undefined+ return resolveEffort(ref, wanted).catch(() => undefined)+ }+// DSH's selectModel also saves the selection as the profile default model, in the// background. A Bot's model is its own, so the user's default is written back after// it. Selections run one at a time and wait for the write-back: profile writes land in@@ -201,7 +210,7 @@ export function install(rt) {Object.assign(rt, {catalog, cachedCatalog: () => catalogCache.value, cachedDefault: () => pickDefault(catalogCache.value),- defaultRef, defaultModel, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,+ defaultRef, defaultModel, defaultEffort, resolveModel, desiredModel, reasoningOf, resolveEffort, desiredEffort,selectSessionModel, applyModel, waitForModel, syncModels,dropCatalog: () => { catalogCache = { at: 0, value: [] } },})diff --git a/ds-bot/src/host/roster.js b/ds-bot/src/host/roster.jsindex b4b79a9d..bd3917e3 100644--- a/ds-bot/src/host/roster.js+++ b/ds-bot/src/host/roster.js@@ -144,7 +144,9 @@ export function install(rt) {// A thinking level needs a model to resolve against; with none it would be dropped// silently, so the create fails before a Session is made.if (effort !== undefined && effort !== '' && modelRef === undefined) throw new Error('Pick a model before choosing a thinking level')- const effortId = modelRef === undefined ? undefined : await rt.resolveEffort(modelRef, effort)+ // An explicit level wins; else the Bot starts on the profile default's level.+ const effortId = modelRef === undefined ? undefined+ : (await rt.resolveEffort(modelRef, effort)) ?? await rt.defaultEffort(modelRef)const dir = workDir === undefined || workDir === null ? undefined : await rt.cleanWorkDir(workDir)const id = await createSession(cleanName, { dir })try {diff --git a/ds-bot/test/roster.test.js b/ds-bot/test/roster.test.jsindex d9e47c6d..c02448ea 100644--- a/ds-bot/test/roster.test.js+++ b/ds-bot/test/roster.test.js@@ -10,10 +10,14 @@ import { apply } from '../index.js'import { fakeContext } from './fake-ctx.js'// Enough of the dsh services for the roster to make Sessions; kickoff messages are dropped.-function start(team, { models = [], reasoning = {}, archiveError } = {}) {+function start(team, { models = [], reasoning = {}, archiveError, selection } = {}) {const home = mkdtempSync(join(tmpdir(), 'ds-bot-roster-'))if (team !== undefined) writeFileSync(join(home, 'state.json'), JSON.stringify(team))const ctx = fakeContext()+ if (selection !== undefined) {+ const baseGet = ctx.get+ ctx.get = name => name === 'agentDefaultModel' ? { currentSelection: () => selection } : baseGet(name)+ }const workspaces = new Map()const sent = []const selected = []@@ -239,6 +243,27 @@ test('a Bot takes a thinking level its model serves, applied with the model', asassert.equal(selected.at(-1).reasoningEffort, 'high')})+test('a new Bot inherits the profile default thinking level', async (t) => {+ const reasoning = { 'deepseek/deepseek-v4-flash': { reasoning: { efforts: [{ id: 'low', name: 'Low' }, { id: 'high', name: 'High' }] } } }+ const selection = { provider: 'deepseek', model: 'deepseek-v4-flash', reasoningEffort: 'high' }+ const { call, stop, selected } = start(undefined, { models: ['deepseek-v4-flash'], reasoning, selection })+ t.after(stop)+ const writer = (await call('create-bot', { name: 'Writer' })).value+ await settle()+ assert.equal(writer.model, 'deepseek/deepseek-v4-flash')+ assert.equal(writer.effort, 'high')+ assert.equal(selected.at(-1).reasoningEffort, 'high')++ // An explicit level still wins, and a level the model does not serve is dropped.+ const coder = (await call('create-bot', { name: 'Coder', effort: 'low' })).value+ assert.equal(coder.effort, 'low')+ const other = { provider: 'deepseek', model: 'other', reasoningEffort: 'max' }+ const { call: call2, stop: stop2 } = start(undefined, { models: ['deepseek/deepseek-v4-flash'], reasoning, selection: other })+ t.after(stop2)+ const tester = (await call2('create-bot', { name: 'Tester' })).value+ assert.equal(tester.effort, undefined)+})+test('the state reports a changed model list without a new revision', async (t) => {const { call, stop } = start(undefined, { models: ['deepseek-v4-flash'] })t.after(stop)