Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Scale thinking rows with desktop density and label them Thinking (#1723)

Regan Bell1d4e6f016a1c
diff --git a/plugins/web-ui/src/activity-presentation.ts b/plugins/web-ui/src/activity-presentation.ts
index b5fdc2bdb..1f8542ed2 100644
--- a/plugins/web-ui/src/activity-presentation.ts
+++ b/plugins/web-ui/src/activity-presentation.ts
@@ -162,7 +162,7 @@ export function activityGroupSummary(
export function thinkingPresentation(text: string): { title: string; body: string } {
const trimmed = text.trim();
const heading = /^(?:#{1,6} +([^\n]+)|\*\*([^\n]+?)\*\*|__([^\n]+?)__)(?:\r?\n|$)/.exec(trimmed);
- if (!heading) return { title: "Thought process", body: trimmed };
+ if (!heading) return { title: "Thinking", body: trimmed };
const title = (heading[1] ?? heading[2] ?? heading[3]!).replace(/ +#+$/, "").trim();
return { title, body: trimmed.slice(heading[0].length).trim() };
}
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 2d9815081..6ce923897 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -2585,7 +2585,7 @@ qm-markdown .tok-in {
border-left: 2px solid var(--border);
padding-left: 10px;
color: var(--muted-foreground);
- font-size: calc(var(--chat-font-size) - 2px);
+ font-size: max(min(12px, calc(var(--chat-font-size) - 2px)), calc((var(--chat-font-size) - 2px) * var(--text-scale)));
}
.thinking summary {
cursor: pointer;
@@ -2602,7 +2602,7 @@ qm-markdown .tok-in {
}
.work-message {
color: color-mix(in srgb, var(--muted-foreground) 85%, var(--foreground));
- font-size: calc(var(--chat-font-size) - 1px);
+ font-size: max(min(12px, calc(var(--chat-font-size) - 1px)), calc((var(--chat-font-size) - 1px) * var(--text-scale)));
line-height: 1.6;
}
.sheen-label {
@@ -2742,7 +2742,7 @@ qm-markdown .tok-in {
list-style: none;
cursor: default;
color: var(--muted-foreground);
- font-size: calc(var(--chat-font-size) - 1px);
+ font-size: max(min(12px, calc(var(--chat-font-size) - 1px)), calc((var(--chat-font-size) - 1px) * var(--text-scale)));
line-height: 1.35;
}
.thinking-summary::-webkit-details-marker {
@@ -2760,7 +2760,7 @@ qm-markdown .tok-in {
padding-left: 10px;
border-left: 2px solid var(--border);
color: var(--muted-foreground);
- font-size: calc(var(--chat-font-size) - 1px);
+ font-size: max(min(12px, calc(var(--chat-font-size) - 1px)), calc((var(--chat-font-size) - 1px) * var(--text-scale)));
line-height: 1.55;
}
.thinking-title {
diff --git a/plugins/web-ui/test/activity-presentation.test.ts b/plugins/web-ui/test/activity-presentation.test.ts
index f4da6d5bb..e8166a600 100644
--- a/plugins/web-ui/test/activity-presentation.test.ts
+++ b/plugins/web-ui/test/activity-presentation.test.ts
@@ -90,10 +90,10 @@ test("thinking titles become disclosure labels without repeating the heading", (
});
}
assert.deepEqual(thinkingPresentation("A thought without a heading"), {
- title: "Thought process",
+ title: "Thinking",
body: "A thought without a heading",
});
- assert.equal(thinkingPresentation("**Bold** inside a sentence").title, "Thought process");
+ assert.equal(thinkingPresentation("**Bold** inside a sentence").title, "Thinking");
});
test("session actions identify their recipient and retain failure state", () => {
diff --git a/plugins/web-ui/test/css-vars.test.ts b/plugins/web-ui/test/css-vars.test.ts
index 6bd56eb44..0087fe3ba 100644
--- a/plugins/web-ui/test/css-vars.test.ts
+++ b/plugins/web-ui/test/css-vars.test.ts
@@ -196,8 +196,15 @@ test("desktop density tokens keep original touch sizes and a 12px floor", () =>
assert.equal(before.get(name), original);
assert.equal(after.get(name), compact);
}
- assert.match(shellCss, /\.thinking \{[^}]*font-size: calc\(var\(--chat-font-size\) - 2px\);/);
- assert.match(shellCss, /\.thinking-summary \{[^}]*font-size: calc\(var\(--chat-font-size\) - 1px\);/);
- assert.match(shellCss, /\.thinking-body \{[^}]*font-size: calc\(var\(--chat-font-size\) - 1px\);/);
- assert.match(shellCss, /\.work-message \{[^}]*font-size: calc\(var\(--chat-font-size\) - 1px\);/);
+ const scaled = (offset: string) =>
+ `font-size: max(min(12px, calc(var(--chat-font-size) - ${offset})), calc((var(--chat-font-size) - ${offset}) * var(--text-scale)));`;
+ for (const [selector, offset] of [
+ [".thinking", "2px"],
+ [".thinking-summary", "1px"],
+ [".thinking-body", "1px"],
+ [".work-message", "1px"],
+ ]) {
+ const block = shellCss.match(new RegExp(`\\n${selector.replace(".", "\\.")} \\{([^}]*)\\}`))?.[1] ?? "";
+ assert.ok(block.includes(scaled(offset)), selector);
+ }
});
diff --git a/plugins/web-ui/test/transcript-type-scale.test.ts b/plugins/web-ui/test/transcript-type-scale.test.ts
index a2949350f..54b4b2f5e 100644
--- a/plugins/web-ui/test/transcript-type-scale.test.ts
+++ b/plugins/web-ui/test/transcript-type-scale.test.ts
@@ -25,7 +25,7 @@ test("every chat context sets one transcript base size on the chat shell", () =>
);
});
-test("desktop text scales with the chat base while thinking and work messages keep their sizes", () => {
+test("desktop text scales with the chat base, including thinking and work messages", () => {
for (const selector of [".assistant-body", ".message-bubble", ".work-head", ".work-said", ".live-work-line"]) {
assert.deepEqual(
fontSizes(selector),
@@ -33,16 +33,23 @@ test("desktop text scales with the chat base while thinking and work messages ke
selector,
);
}
- for (const selector of [".activity-group > .work-head", ".tool-row,\n.tool-row .tool-summary", ".stopped-head"]) {
+ for (const selector of [
+ ".activity-group > .work-head",
+ ".tool-row,\n.tool-row .tool-summary",
+ ".stopped-head",
+ ".thinking-summary",
+ ".thinking-body",
+ ".work-message",
+ ]) {
assert.deepEqual(
fontSizes(selector),
["max(min(12px, calc(var(--chat-font-size) - 1px)), calc((var(--chat-font-size) - 1px) * var(--text-scale)))"],
selector,
);
}
- for (const selector of [".thinking-summary", ".thinking-body", ".work-message"]) {
- assert.deepEqual(fontSizes(selector), ["calc(var(--chat-font-size) - 1px)"], selector);
- }
+ assert.deepEqual(fontSizes(".thinking"), [
+ "max(min(12px, calc(var(--chat-font-size) - 2px)), calc((var(--chat-font-size) - 2px) * var(--text-scale)))",
+ ]);
});
test("inline code stays relative to the prose it sits in", () => {