A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Show a Turn's reasoning row on its last reasoning step
Fei2411251aa429da11
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 0bb06dd8..d97cd23c 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -4183,7 +4183,7 @@ var SECRET_CSS = `// src/client/turn-reasoning.jsfunction turnReasoning(steps, current) {const members = steps.length ? steps : [current];- if (members.find((step) => stepReasoning(step) !== "")?.step !== current.step) return "";+ if (members.findLast((step) => stepReasoning(step) !== "")?.step !== current.step) return "";return members.map(stepReasoning).filter(Boolean).join("\n\n");}var thinkingStep = (steps) => steps.find(thinkingLive);diff --git a/ds-bot/src/client/turn-reasoning.js b/ds-bot/src/client/turn-reasoning.jsindex 609af74d..c8a529ff 100644--- a/ds-bot/src/client/turn-reasoning.js+++ b/ds-bot/src/client/turn-reasoning.js@@ -1,8 +1,9 @@-// Settled and live reasoning of every loaded step in a Turn, shown once on the first-// step that has reasoning: only steps with reasoning get a reasoning part to render it.+// Settled and live reasoning of every loaded step in a Turn, shown once on the last+// step that has reasoning: only steps with reasoning get a reasoning part to render+// it. Sitting under the Turn's tool lines keeps the row directly above the reply.export function turnReasoning(steps, current) {const members = steps.length ? steps : [current]- if (members.find(step => stepReasoning(step) !== '')?.step !== current.step) return ''+ if (members.findLast(step => stepReasoning(step) !== '')?.step !== current.step) return ''return members.map(stepReasoning).filter(Boolean).join('\n\n')}diff --git a/ds-bot/test/turn-reasoning.test.js b/ds-bot/test/turn-reasoning.test.jsindex d77556cb..2f514e08 100644--- a/ds-bot/test/turn-reasoning.test.js+++ b/ds-bot/test/turn-reasoning.test.js@@ -6,24 +6,28 @@ const step = (n, blocks, status = 'settled') => ({ turn: 1, step: n, status, bloconst think = text => ({ kind: 'reasoning', text })const tool = { kind: 'tool-call', name: 'read' }-test('a long tool Turn shows its reasoning once, on the first step, in order', () => {+test('a long tool Turn shows its reasoning once, on the last step, in order', () => {const steps = Array.from({ length: 24 }, (_, i) => step(i + 1, [think(`Reasoning ${i + 1}`), tool]))const shown = steps.map(current => turnReasoning(steps, current))assert.equal(shown.filter(Boolean).length, 1)- assert.equal(shown[0], steps.map((_, i) => `Reasoning ${i + 1}`).join('\n\n'))+ assert.equal(shown[23], steps.map((_, i) => `Reasoning ${i + 1}`).join('\n\n'))})-test('the row sits on the first step with reasoning', () => {+test('the row sits on the last step with reasoning, next to the reply', () => {const steps = [step(1, [{ kind: 'text', text: 'Looking' }, tool]), step(2, [think('B'), tool]), step(3, [think('C'), { kind: 'text', text: 'Done' }])]- assert.deepEqual(steps.map(current => turnReasoning(steps, current)), ['', 'B\n\nC', ''])+ assert.deepEqual(steps.map(current => turnReasoning(steps, current)), ['', '', 'B\n\nC'])+ // A Turn whose only reasoning step came first keeps the row there.+ const early = [step(1, [think('B'), tool]), step(2, [tool]), step(3, [{ kind: 'text', text: 'Done' }])]+ assert.deepEqual(early.map(current => turnReasoning(early, current)), ['B', '', ''])})test('reasoning still in progress shows while its step thinks', () => {const steps = [step(1, [think('A'), tool]), step(2, [think('B')], 'running')]- assert.equal(turnReasoning(steps, steps[0]), 'A\n\nB')+ assert.equal(turnReasoning(steps, steps[0]), '')+ assert.equal(turnReasoning(steps, steps[1]), 'A\n\nB')assert.equal(turnReasoning([step(1, [think('A')], 'running')], step(1, [think('A')], 'running')), 'A')steps[1].blocks.push({ kind: 'text', text: 'Reply' })- assert.equal(turnReasoning(steps, steps[0]), 'A\n\nB')+ assert.equal(turnReasoning(steps, steps[1]), 'A\n\nB')})test('the live step is the one still thinking', () => {