A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.
Start the reasoning row closed again
Fei2411cd483b836e65
diff --git a/ds-bot/client.js b/ds-bot/client.jsindex 74c09e55..2f4be655 100644--- a/ds-bot/client.js+++ b/ds-bot/client.js@@ -2930,6 +2930,8 @@ body[data-ds-dark-theme] .bt-theme-chip i{background:var(--da)}`;var CONVERSATION_CSS = `.bt-think{font-size:13px;line-height:18px;color:var(--bt-ink-2);margin:2px 0 4px;max-width:min(560px,78%)}+.bt-think summary{cursor:pointer;list-style:none;display:inline-flex;align-items:center;gap:6px}+.bt-think summary::-webkit-details-marker{display:none}/* Five lines of the 18px line height; the rest scrolls inside the box. */.bt-think-text{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;padding-left:10px;border-left:2px solid var(--bt-line-2);max-height:90px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;outline:none}.bt-think-text:focus-visible{border-left-color:var(--bt-ink-2)}@@ -4398,6 +4400,7 @@ function MessageTools({ text, name, sessionId, react, actions }) {function ThinkingRow({ text }) {const box = (0, import_react8.useRef)(null);const atEnd = (0, import_react8.useRef)(true);+ const [open, setOpen] = (0, import_react8.useState)(false);const [fade, setFade] = (0, import_react8.useState)(void 0);const measure = () => {const el = box.current;@@ -4405,16 +4408,22 @@ function ThinkingRow({ text }) {const above = el.scrollTop > 0;setFade(above && !atEnd.current ? "both" : above ? "top" : !atEnd.current ? "bottom" : void 0);};+ const toggle = (event) => {+ const next = event.currentTarget.open;+ if (next) atEnd.current = true;+ setOpen(next);+ };(0, import_react8.useLayoutEffect)(() => {+ if (!open) return;const el = box.current;if (atEnd.current) el.scrollTop = el.scrollHeight;measure();- }, [text]);+ }, [text, open]);const title = t("Thought it through");return (0, import_react8.createElement)(- "div",- { className: "bt-think" },- (0, import_react8.createElement)("div", { className: "bt-think-title" }, title),+ "details",+ { className: "bt-think", onToggle: toggle },+ (0, import_react8.createElement)("summary", null, title),(0, import_react8.createElement)("div", { ref: box, className: "bt-think-text", role: "region", "aria-label": title, tabIndex: 0, "data-fade": fade, onScroll: measure }, text));}diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.jsindex 541003d2..9694232f 100644--- a/ds-bot/src/client/cells.js+++ b/ds-bot/src/client/cells.js@@ -115,12 +115,13 @@ function MessageTools({ text, name, sessionId, react, actions }) {item(t('Copy'), CopyIcon, copy), item(t('Download'), DownloadIcon, download)), document.body) : null)}-// Few readers go through a whole chain of thought, so the row opens on its last lines;-// the box scrolls for the rest. It stays at the end as later steps add reasoning,-// unless the reader has scrolled up.-function ThinkingRow({ text }) {+// The row starts closed. Few readers go through a whole chain of thought, so when opened+// it shows the last lines and the box scrolls for the rest. It stays at the end as later+// steps add reasoning, unless the reader has scrolled up.+export function ThinkingRow({ text }) {const box = useRef(null)const atEnd = useRef(true)+ const [open, setOpen] = useState(false)const [fade, setFade] = useState(undefined)const measure = () => {const el = box.current@@ -128,14 +129,20 @@ function ThinkingRow({ text }) {const above = el.scrollTop > 0setFade(above && !atEnd.current ? 'both' : above ? 'top' : !atEnd.current ? 'bottom' : undefined)}+ const toggle = event => {+ const next = event.currentTarget.open+ if (next) atEnd.current = true+ setOpen(next)+ }useLayoutEffect(() => {+ if (!open) returnconst el = box.currentif (atEnd.current) el.scrollTop = el.scrollHeightmeasure()- }, [text])+ }, [text, open])const title = t('Thought it through')- return h('div', { className: 'bt-think' },- h('div', { className: 'bt-think-title' }, title),+ return h('details', { className: 'bt-think', onToggle: toggle },+ h('summary', null, title),h('div', { ref: box, className: 'bt-think-text', role: 'region', 'aria-label': title, tabIndex: 0, 'data-fade': fade, onScroll: measure }, text))}diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.jsindex dceffcf9..cac722c5 100644--- a/ds-bot/src/client/styles.js+++ b/ds-bot/src/client/styles.js@@ -805,6 +805,8 @@ body[data-ds-dark-theme] .bt-theme-chip i{background:var(--da)}export const CONVERSATION_CSS = `.bt-think{font-size:13px;line-height:18px;color:var(--bt-ink-2);margin:2px 0 4px;max-width:min(560px,78%)}+.bt-think summary{cursor:pointer;list-style:none;display:inline-flex;align-items:center;gap:6px}+.bt-think summary::-webkit-details-marker{display:none}/* Five lines of the 18px line height; the rest scrolls inside the box. */.bt-think-text{white-space:pre-wrap;overflow-wrap:anywhere;margin-top:6px;padding-left:10px;border-left:2px solid var(--bt-line-2);max-height:90px;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;outline:none}.bt-think-text:focus-visible{border-left-color:var(--bt-ink-2)}diff --git a/ds-bot/test/chat-rows.test.js b/ds-bot/test/chat-rows.test.jsindex 8a8d6fc5..36f2d7e4 100644--- a/ds-bot/test/chat-rows.test.js+++ b/ds-bot/test/chat-rows.test.js@@ -14,7 +14,11 @@ runInNewContext(bundle.outputFiles[0].text, {module, exports: module.exports, Intl, Date,require: (name) => {const platform = {- react: { createElement: (type, props, ...children) => ({ type, props: props ?? {}, children: children.flat(Infinity) }) },+ react: {+ createElement: (type, props, ...children) => ({ type, props: props ?? {}, children: children.flat(Infinity) }),+ useState: initial => [initial, () => {}], useRef: current => ({ current }),+ useLayoutEffect() {}, useEffect() {}, useMemo: make => make(),+ },'react-dom': {},'@deepseek-ai/dsh-client-ui-primitives': {},}@@ -22,7 +26,7 @@ runInNewContext(bundle.outputFiles[0].text, {return platform[name]},})-const { ChatRows } = module.exports+const { ChatRows, ThinkingRow } = module.exportsconst roster = { byId: { b: { id: 'b', name: 'Writer' } }, roomsById: {} }const MINUTE = 60_000@@ -49,3 +53,15 @@ test('with the clock, a time separator sits above the first entry and after each]assert.deepEqual(shape(ChatRows({ items, sessionId: 'b', roster, actions: {}, clock: true })), ['PartLine', 'clock', 'EarlierUser', 'bot:one+two', 'clock', 'EarlierUser'])})++test('the reasoning row is a closed details that opens to the text', () => {+ const row = ThinkingRow({ text: 'one\ntwo' })+ assert.equal(row.type, 'details')+ assert.equal(row.props.className, 'bt-think')+ assert.equal('open' in row.props, false)+ assert.equal(typeof row.props.onToggle, 'function')+ const [title, box] = row.children+ assert.equal(title.type, 'summary')+ assert.equal(title.children.join(''), 'Thought it through')+ assert.equal(box.props.className, 'bt-think-text')+})