A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Read the Enter preference before the question dock's early returns
klarkxy4cf455e17e71
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 046bcbe1..fb797af2 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -4265,10 +4265,11 @@ function PendingQuestion({ sessionId, question, actions, inline, enterToSend = t}function QuestionDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {const question = useRoster((value) => value.questions?.[sessionId]);+ const enterToSend = useRoster((value) => sendsOnEnter(value.prefs));const drawn = useCards?.((state) => state[sessionId]?.[question?.callId] > 0) === true;const held = useHeldCards?.((state) => state[sessionId]?.[heldCardKey("question", question?.id)] > 0) === true;if (question === void 0 || question.callId && drawn && !held) return null;- return (0, import_react6.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend: useRoster((value) => sendsOnEnter(value.prefs)) });+ return (0, import_react6.createElement)(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend });}function AnsweredCell({ node }) {const data = node.data ?? {};diff --git a/ds-bot/src/client/questions.js b/ds-bot/src/client/questions.jsindex 9345aab3..1832f2a1 100644--- a/ds-bot/src/client/questions.js+++ b/ds-bot/src/client/questions.js@@ -209,10 +209,11 @@ export function PendingQuestion({ sessionId, question, actions, inline, enterToS// loads. A card the user starts editing stays in the dock until it closes.export function QuestionDock({ sessionId, useRoster, useCards, useHeldCards, actions }) {const question = useRoster(value => value.questions?.[sessionId])+ const enterToSend = useRoster(value => sendsOnEnter(value.prefs))const drawn = useCards?.(state => state[sessionId]?.[question?.callId] > 0) === trueconst held = useHeldCards?.(state => state[sessionId]?.[heldCardKey('question', question?.id)] > 0) === trueif (question === undefined || (question.callId && drawn && !held)) return null- return h(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend: useRoster(value => sendsOnEnter(value.prefs)) })+ return h(PendingQuestion, { key: JSON.stringify([sessionId, question.id]), sessionId, question, actions, inline: false, enterToSend })}// An answered card in the transcript: the question stays where it was asked, with thediff --git a/ds-bot/test/tool-cells.test.js b/ds-bot/test/tool-cells.test.jsindex 95790f56..5ac12245 100644--- a/ds-bot/test/tool-cells.test.js+++ b/ds-bot/test/tool-cells.test.js@@ -617,6 +617,32 @@ test('a card whose call is not drawn waits in the dock; a drawn one shows only aassert.match(docks(store, roster), /Which draft\?.*Chief needs a key/)})+// React needs the same hooks on every render: the dock reads the Enter preference+// before its early returns, so a card arriving or moving to the transcript never+// changes the count.+test('the question dock calls the same hooks whether its card shows or not', () => {+ const store = cardStore()+ const render = (roster) => {+ let calls = 0+ const props = dockProps(store, roster)+ props.useRoster = (select) => { calls += 1; return select(roster) }+ const out = expand(QuestionDock(props))+ return { calls, out }+ }+ const empty = render(team({}))+ const roster = team({ questions: { chief: question('program:ptc:1') } })+ const waiting = render(roster)+ assert.equal(empty.out, null)+ assert.notEqual(waiting.out, null)+ assert.equal(waiting.calls, empty.calls)+ // The transcript drew the call: the dock steps back, still on the same hooks.+ store.state = { chief: { 'program:ptc:1': 1 } }+ const drawn = render(roster)+ assert.equal(drawn.out, null)+ assert.equal(drawn.calls, empty.calls)+ effects = []+})+test('the docks keep pending cards through history loading until their calls actually mount', () => {const store = cardStore()const roster = team({ questions: { chief: question('program:ptc:1') }, secretRequests: { chief: [request('program:ptc:2')] } })