Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Derive transcript type sizes from one chat base so multiview panes scale as a unit (#1545)

Joshua France7914cec78608
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 3147244e5..0ac465076 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -1195,6 +1195,7 @@ a.chat-row-open {
container: chat / inline-size;
}
.custom-chat-shell {
+ --chat-font-size: 15px;
flex: 1;
min-height: 0;
min-width: 0;
@@ -1663,7 +1664,7 @@ a.chat-row-open {
padding-bottom: 24px;
}
.welcome-greeting .assistant-body {
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.55;
}
.welcome-greeting h1 {
@@ -1897,7 +1898,7 @@ button.subagent-chip:hover {
.assistant-body {
min-width: 0;
color: var(--foreground);
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.65;
}
.assistant-body :is(markdown-block, qm-markdown),
@@ -2007,7 +2008,7 @@ qm-markdown .tok-in {
max-width: min(72%, 620px);
padding: 10px 14px;
border-radius: 18px;
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.55;
}
.user-bubble {
@@ -2414,7 +2415,7 @@ qm-markdown .tok-in {
border-left: 2px solid var(--border);
padding-left: 10px;
color: var(--muted-foreground);
- font-size: 13px;
+ font-size: calc(var(--chat-font-size) - 2px);
}
.thinking summary {
cursor: pointer;
@@ -2422,7 +2423,7 @@ qm-markdown .tok-in {
}
.work-said {
color: var(--foreground);
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.6;
margin: 10px 0;
}
@@ -2431,7 +2432,7 @@ qm-markdown .tok-in {
}
.work-message {
color: color-mix(in srgb, var(--muted-foreground) 85%, var(--foreground));
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
line-height: 1.6;
}
.sheen-label {
@@ -2495,7 +2496,7 @@ qm-markdown .tok-in {
display: flex;
align-items: center;
gap: 6px;
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.4;
font-weight: 400;
color: var(--muted-foreground);
@@ -2530,7 +2531,7 @@ qm-markdown .tok-in {
align-items: center;
gap: 6px;
min-width: 0;
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
line-height: 1.35;
color: var(--muted-foreground);
}
@@ -2571,7 +2572,7 @@ qm-markdown .tok-in {
list-style: none;
cursor: default;
color: var(--muted-foreground);
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
line-height: 1.35;
}
.thinking-summary::-webkit-details-marker {
@@ -2589,7 +2590,7 @@ qm-markdown .tok-in {
padding-left: 10px;
border-left: 2px solid var(--border);
color: var(--muted-foreground);
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
line-height: 1.55;
}
.thinking-title {
@@ -2651,7 +2652,7 @@ qm-markdown .tok-in {
min-width: 0;
}
.approval-title {
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
font-weight: 600;
color: var(--foreground);
}
@@ -3204,7 +3205,7 @@ qm-markdown .tok-in {
align-items: center;
gap: 8px;
min-width: 0;
- font-size: var(--composer-font-size, 15px);
+ font-size: var(--chat-font-size);
line-height: 1.4;
cursor: pointer;
border-radius: 6px;
@@ -3269,8 +3270,8 @@ qm-markdown .tok-in {
transform: rotate(90deg);
}
-.assistant-body :is(markdown-block, qm-markdown) :not(pre) > code,
-.user-bubble :is(markdown-block, qm-markdown) :not(pre) > code {
+.assistant-body :is(markdown-block, qm-markdown).markdown-content :not(pre) > code,
+.user-bubble :is(markdown-block, qm-markdown).markdown-content :not(pre) > code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.92em;
padding: 1px 5px;
@@ -3288,7 +3289,7 @@ qm-markdown .tok-in {
.assistant-body :is(markdown-block, qm-markdown) pre code,
.user-bubble :is(markdown-block, qm-markdown) pre code {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
- font-size: 15px;
+ font-size: var(--chat-font-size);
line-height: 1.55;
background: none;
padding: 0;
@@ -4496,7 +4497,7 @@ qm-markdown .tok-in {
margin-bottom: 12px;
border-bottom: 1px solid var(--border);
color: var(--muted-foreground);
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
line-height: 1.5;
list-style: none;
}
@@ -8401,10 +8402,8 @@ h3.ambient-field-label {
font-size: 12px;
}
-.split-canvas:not(.single-pane) .split-pane-chat .assistant-body,
-.split-canvas:not(.single-pane) .split-pane-chat .message-bubble,
-.split-canvas:not(.single-pane) .split-pane-chat .message-stack {
- font-size: 12px;
+.split-canvas:not(.single-pane) .split-pane-chat .custom-chat-shell {
+ --chat-font-size: 12px;
}
.split-canvas:not(.single-pane) .split-pane-chat .chat-cta {
@@ -11982,9 +11981,11 @@ body.app-edit-embed .main {
.app-edit-chat {
grid-template-rows: minmax(0, 1fr) auto;
}
+body.app-edit-embed .custom-chat-shell {
+ --chat-font-size: 13px;
+}
body.app-edit-embed .assistant-body,
body.app-edit-embed .user-bubble {
- font-size: 13px;
line-height: 1.6;
}
body.app-edit-embed .message-stack {
@@ -12260,11 +12261,11 @@ body.app-edit-embed .custom-chat-shell.app-edit-chat > .chat-bottom-dock {
}
:is(markdown-block, qm-markdown).markdown-content table {
- font-size: 13px;
+ font-size: calc(var(--chat-font-size) - 2px);
line-height: 1.65;
}
.activity-group > .work-head {
- font-size: 14px;
+ font-size: calc(var(--chat-font-size) - 1px);
}
.stopped-work[open] > .stopped-head > .activity-chevron {
transform: rotate(90deg);
diff --git a/plugins/web-ui/test/pinned-composer-polish.test.ts b/plugins/web-ui/test/pinned-composer-polish.test.ts
index 627aaf958..516cfa392 100644
--- a/plugins/web-ui/test/pinned-composer-polish.test.ts
+++ b/plugins/web-ui/test/pinned-composer-polish.test.ts
@@ -22,7 +22,7 @@ test("background activity shares the queued inset above the composer", () => {
assert.doesNotMatch(css, /\.composer-wrap > \.bg-activity/);
});
-test("thinking shares input sizing while background activity stays compact", () => {
+test("the composer input follows the composer size variable while background activity stays compact", () => {
assert.match(css, /\.chat-bottom-dock > \.bg-activity > \.bg-activity-strip \{[^}]*font-size: 12px;/);
const sizes = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].flatMap((rule) =>
[...rule[2].matchAll(/--composer-font-size: (\d+)px/g)].map((match) => [rule[1].trim(), Number(match[1])]),
@@ -33,13 +33,11 @@ test("thinking shares input sizing while background activity stays compact", ()
[".composer-wrap", 16],
["body.app-edit-embed .composer-wrap", 13],
]);
- for (const selector of [".live-work-line", ".composer-input"]) {
- const blocks = css.matchAll(new RegExp(`${selector.replaceAll(".", "\\.")} \\{([^}]+)\\}`, "g"));
- const declarations = [...blocks].flatMap((match) => [...match[1].matchAll(/font-size: ([^;]+);/g)]);
- assert.ok(declarations.length > 0, selector);
- for (const declaration of declarations) {
- assert.match(declaration[1], /^(?:max\(16px, )?var\(--composer-font-size[,)]/);
- }
+ const blocks = css.matchAll(/\.composer-input \{([^}]+)\}/g);
+ const declarations = [...blocks].flatMap((match) => [...match[1].matchAll(/font-size: ([^;]+);/g)]);
+ assert.ok(declarations.length > 0);
+ for (const declaration of declarations) {
+ assert.match(declaration[1], /^(?:max\(16px, )?var\(--composer-font-size[,)]/);
}
assert.match(
css,
diff --git a/plugins/web-ui/test/transcript-type-scale.test.ts b/plugins/web-ui/test/transcript-type-scale.test.ts
new file mode 100644
index 000000000..4378a8ba9
--- /dev/null
+++ b/plugins/web-ui/test/transcript-type-scale.test.ts
@@ -0,0 +1,49 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
+
+const rules = [...css.matchAll(/([^{}]+)\{([^{}]*)\}/g)].map((m) => [m[1].trim(), m[2]] as const);
+const fontSizes = (selector: string): string[] =>
+ rules
+ .filter(([sel]) => sel === selector)
+ .flatMap(([, body]) => [...body.matchAll(/font-size: ([^;]+);/g)].map((m) => m[1]));
+
+test("every chat context sets one transcript base size on the chat shell", () => {
+ const bases = rules.flatMap(([sel, body]) =>
+ [...body.matchAll(/--chat-font-size: (\d+)px/g)].map((m) => [sel, Number(m[1])]),
+ );
+ assert.deepEqual(bases, [
+ [".custom-chat-shell", 15],
+ [".split-canvas:not(.single-pane) .split-pane-chat .custom-chat-shell", 12],
+ ["body.app-edit-embed .custom-chat-shell", 13],
+ ]);
+ assert.doesNotMatch(css, /\.split-pane-chat \.(?:assistant-body|message-bubble|message-stack) \{[^}]*font-size:/);
+ assert.doesNotMatch(
+ css,
+ /body\.app-edit-embed \.assistant-body,\s*body\.app-edit-embed \.user-bubble \{[^}]*font-size:/,
+ );
+});
+
+test("message text and the work header sit on the base; tool and thinking rows one step below", () => {
+ for (const selector of [".assistant-body", ".message-bubble", ".work-head", ".work-said", ".live-work-line"]) {
+ assert.deepEqual(fontSizes(selector), ["var(--chat-font-size)"], selector);
+ }
+ for (const selector of [
+ ".activity-group > .work-head",
+ ".tool-row,\n.tool-row .tool-summary",
+ ".thinking-summary",
+ ".thinking-body",
+ ".work-message",
+ ".stopped-head",
+ ]) {
+ assert.deepEqual(fontSizes(selector), ["calc(var(--chat-font-size) - 1px)"], selector);
+ }
+});
+
+test("inline code stays relative to the prose it sits in", () => {
+ assert.match(
+ css,
+ /\.assistant-body :is\(markdown-block, qm-markdown\)\.markdown-content :not\(pre\) > code,\s*\.user-bubble :is\(markdown-block, qm-markdown\)\.markdown-content :not\(pre\) > code \{[^}]*font-size: 0\.92em;/,
+ );
+});
diff --git a/plugins/web-ui/test/work-fold-source.test.ts b/plugins/web-ui/test/work-fold-source.test.ts
index ef4f55b25..d17c01758 100644
--- a/plugins/web-ui/test/work-fold-source.test.ts
+++ b/plugins/web-ui/test/work-fold-source.test.ts
@@ -33,7 +33,10 @@ test("the fold chevron rotates when a work-fold is open", () => {
test("expanded tool activity uses a compact log rhythm", () => {
assert.match(css, /\.work-divider \{[\s\S]{0,120}?margin: 8px 0 10px;/);
assert.match(css, /\.work-rows \{[\s\S]{0,120}?gap: 2px;/);
- assert.match(css, /\.tool-row,[\s\S]{0,220}?font-size: 14px;[\s\S]{0,80}?line-height: 1\.35;/);
+ assert.match(
+ css,
+ /\.tool-row,[\s\S]{0,220}?font-size: calc\(var\(--chat-font-size\) - 1px\);[\s\S]{0,80}?line-height: 1\.35;/,
+ );
assert.match(css, /\.tool-row \.tool-summary \{[\s\S]{0,80}?min-height: 26px;/);
assert.match(chat, /icon\(rowIcon, 15\)/);
assert.match(chat, /icon\(Wrench, 13\)/);