Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Show a Bot's reasoning as a five-line box that scrolls

Fei2411bedb7b8ef304
diff --git a/ds-bot/client.js b/ds-bot/client.js
index 9b5e894a..8cda3479 100644
--- a/ds-bot/client.js
+++ b/ds-bot/client.js
@@ -2606,9 +2606,12 @@ 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}
-.bt-think-text{white-space:pre-wrap;margin-top:6px;padding-left:10px;border-left:2px solid var(--bt-line-2)}
+/* 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)}
+.bt-think-text[data-fade=top]{mask-image:linear-gradient(to bottom,transparent,#000 18px)}
+.bt-think-text[data-fade=bottom]{mask-image:linear-gradient(to top,transparent,#000 18px)}
+.bt-think-text[data-fade=both]{mask-image:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}
.bt-event{display:flex;justify-content:center;align-items:center;gap:2px;min-height:24px;margin:2px 0;font-size:12px;line-height:16px;color:var(--bt-ink-2);flex-wrap:wrap}
.bt-event>span{padding:0 2px}
.bt-event button{border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}
@@ -3912,11 +3915,26 @@ function MessageTools({ text, name, sessionId, react, actions }) {
);
}
function ThinkingRow({ text }) {
+ const box = (0, import_react6.useRef)(null);
+ const atEnd = (0, import_react6.useRef)(true);
+ const [fade, setFade] = (0, import_react6.useState)(void 0);
+ const measure = () => {
+ const el = box.current;
+ atEnd.current = el.scrollHeight - el.scrollTop - el.clientHeight < 2;
+ const above = el.scrollTop > 0;
+ setFade(above && !atEnd.current ? "both" : above ? "top" : !atEnd.current ? "bottom" : void 0);
+ };
+ (0, import_react6.useLayoutEffect)(() => {
+ const el = box.current;
+ if (atEnd.current) el.scrollTop = el.scrollHeight;
+ measure();
+ }, [text]);
+ const title = t("Thought it through");
return (0, import_react6.createElement)(
- "details",
+ "div",
{ className: "bt-think" },
- (0, import_react6.createElement)("summary", null, t("Thought it through")),
- (0, import_react6.createElement)("div", { className: "bt-think-text" }, text)
+ (0, import_react6.createElement)("div", { className: "bt-think-title" }, title),
+ (0, import_react6.createElement)("div", { ref: box, className: "bt-think-text", role: "region", "aria-label": title, tabIndex: 0, "data-fade": fade, onScroll: measure }, text)
);
}
function useFileMentions({ node, openFile, fileMentions, useTurnData }) {
diff --git a/ds-bot/src/client/cells.js b/ds-bot/src/client/cells.js
index 2695e45d..461ed299 100644
--- a/ds-bot/src/client/cells.js
+++ b/ds-bot/src/client/cells.js
@@ -100,10 +100,28 @@ 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 }) {
- return h('details', { className: 'bt-think' },
- h('summary', null, t('Thought it through')),
- h('div', { className: 'bt-think-text' }, text))
+ const box = useRef(null)
+ const atEnd = useRef(true)
+ const [fade, setFade] = useState(undefined)
+ const measure = () => {
+ const el = box.current
+ atEnd.current = el.scrollHeight - el.scrollTop - el.clientHeight < 2
+ const above = el.scrollTop > 0
+ setFade(above && !atEnd.current ? 'both' : above ? 'top' : !atEnd.current ? 'bottom' : undefined)
+ }
+ useLayoutEffect(() => {
+ const el = box.current
+ if (atEnd.current) el.scrollTop = el.scrollHeight
+ measure()
+ }, [text])
+ const title = t('Thought it through')
+ return h('div', { className: 'bt-think' },
+ h('div', { className: 'bt-think-title' }, title),
+ h('div', { ref: box, className: 'bt-think-text', role: 'region', 'aria-label': title, tabIndex: 0, 'data-fade': fade, onScroll: measure }, text))
}
// The files a finished turn changed or delivered, linked from inline code in its
diff --git a/ds-bot/src/client/styles.js b/ds-bot/src/client/styles.js
index c800f00d..3ca498db 100644
--- a/ds-bot/src/client/styles.js
+++ b/ds-bot/src/client/styles.js
@@ -786,9 +786,12 @@ 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}
-.bt-think-text{white-space:pre-wrap;margin-top:6px;padding-left:10px;border-left:2px solid var(--bt-line-2)}
+/* 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)}
+.bt-think-text[data-fade=top]{mask-image:linear-gradient(to bottom,transparent,#000 18px)}
+.bt-think-text[data-fade=bottom]{mask-image:linear-gradient(to top,transparent,#000 18px)}
+.bt-think-text[data-fade=both]{mask-image:linear-gradient(to bottom,transparent,#000 18px,#000 calc(100% - 18px),transparent)}
.bt-event{display:flex;justify-content:center;align-items:center;gap:2px;min-height:24px;margin:2px 0;font-size:12px;line-height:16px;color:var(--bt-ink-2);flex-wrap:wrap}
.bt-event>span{padding:0 2px}
.bt-event button{border:0;background:none;color:inherit;font:inherit;display:inline-flex;align-items:center;gap:4px;cursor:pointer;height:24px;padding:4px 6px 4px 4px;border-radius:999px;box-sizing:border-box;transition:background-color .12s ease}