Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Move thinking into the transcript and compact background activity (#1353)

Regan Bellbcf982bde92a
diff --git a/docs/qa/chat-activity/after.png b/docs/qa/chat-activity/after.png
new file mode 100644
index 000000000..4ba18c13e
Binary files /dev/null and b/docs/qa/chat-activity/after.png differ
diff --git a/docs/qa/chat-activity/before.png b/docs/qa/chat-activity/before.png
new file mode 100644
index 000000000..0b9b5d12c
Binary files /dev/null and b/docs/qa/chat-activity/before.png differ
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.ts
index df13363dc..39c30878d 100644
--- a/plugins/web-ui/src/chat.ts
+++ b/plugins/web-ui/src/chat.ts
@@ -1407,6 +1407,7 @@ export function createChatSurface(
<div class="message-stack ${emptyChat ? "empty-stack" : ""}">
${showWelcome ? welcomeGreeting(!messages.length) : nothing} ${inheritedHeader()}
${chatState.earlierCount > 0 ? earlierNotice(agent) : nothing} ${messageContent}
+ ${glanceTier ? nothing : liveWorkStatus(agent)}
${emptyChat && !isNewUser && !editingApp && !showWelcome ? html`<h1 class="chat-cta">${chatCta()}</h1>` : nothing}
${showStateError(messages, agent.state.errorMessage) ? html`<div class="composer-error inline">${agent.state.errorMessage}</div>` : nothing}
</div>
@@ -1432,8 +1433,8 @@ export function createChatSurface(
)
: nothing
}
- ${goalStrip(agent)} ${ctx.composer.queuedStrip(agent)}
- ${ctx.composer.composerForm(agent, html`${glanceTier ? nothing : liveWorkStatus(agent)} ${backgroundActivityStrip()}`)}
+ ${goalStrip(agent)} ${ctx.composer.queuedStrip(agent)} ${backgroundActivityStrip()}
+ ${ctx.composer.composerForm(agent)}
</div>
</div>
`,
@@ -1904,14 +1905,6 @@ export function createChatSurface(
);
}
}
- if (
- parts.length === 0 &&
- message.stopReason !== "error" &&
- message.stopReason !== "aborted" &&
- !hasWork &&
- !(message as AssistantWork).deliveredFiles?.length
- )
- parts.push(typingRow());
for (const playground of playgroundsIn((message as AssistantWork).work?.activity)) {
parts.push(playgroundCard(playground));
}
@@ -1937,12 +1930,6 @@ export function createChatSurface(
return "";
}
- function typingRow(): TemplateResult {
- return html`<div class="thinking-placeholder">
- ${waveLoader({ width: 14.1, label: "Thinking" })}${sheenLabel("Thinking", true)}
- </div>`;
- }
-
function syncWorkTicker(): void {
const goalTicking = Boolean(
chatState.agent?.state.isStreaming && latestGoal(visibleMessages(chatState.agent))?.status === "active",
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index a1b84835a..be72b5595 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -1123,6 +1123,7 @@ a.chat-row-open {
min-height: 0;
min-width: 0;
display: grid;
+ grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto minmax(0, 1fr) auto;
position: relative;
}
@@ -1982,7 +1983,8 @@ qm-markdown .tok-in {
gap: 6px;
margin-top: 9px;
}
-.queued-strip {
+.queued-strip,
+.chat-bottom-dock > .bg-activity {
position: relative;
z-index: 0;
display: flex;
@@ -2212,19 +2214,6 @@ qm-markdown .tok-in {
cursor: pointer;
font-weight: 600;
}
-.thinking-placeholder {
- display: flex;
- align-items: center;
- gap: 6px;
- min-height: 24px;
- color: var(--muted-foreground);
- font-size: 13px;
- line-height: 1.65;
-}
-.thinking-placeholder .wl-swell {
- flex: 0 0 auto;
- color: inherit;
-}
.work-said {
color: var(--foreground);
font-size: 15px;
@@ -2289,9 +2278,6 @@ qm-markdown .tok-in {
.work {
margin: 2px 0 10px;
}
-.work-thinking {
- margin-bottom: 0;
-}
.work summary.work-head {
list-style: none;
cursor: pointer;
@@ -2794,34 +2780,23 @@ qm-markdown .tok-in {
}
.bg-activity {
- width: min(var(--content-w), calc(100% - 32px));
- margin: 0 auto 8px;
color: var(--muted-foreground);
font-size: 12.5px;
}
-.composer-wrap > .live-work-status,
-.composer-wrap > .bg-activity {
- flex: 0 0 calc(100% + var(--composer-pad-inline) + var(--composer-pad-end));
- width: auto;
- min-width: 0;
- margin: calc(-1 * var(--composer-pad-block)) calc(-1 * var(--composer-pad-end)) 8px
- calc(-1 * var(--composer-pad-inline));
- padding: 8px var(--composer-pad-end) 8px var(--composer-pad-inline);
- border-radius: inherit;
- border-bottom-left-radius: 0;
- border-bottom-right-radius: 0;
- border-bottom: 1px solid var(--border);
- background: color-mix(in srgb, var(--secondary) 40%, var(--background));
-}
-.composer-wrap > .live-work-status:has(+ .bg-activity) {
- margin-bottom: 0;
+.chat-bottom-dock > .bg-activity {
+ padding: 6px 10px 13px;
+ border: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
+ border-radius: 14px 14px 10px 10px;
+ background: color-mix(in srgb, var(--background) 88%, var(--secondary));
}
-.composer-wrap > .live-work-status + .bg-activity {
- margin-top: 0;
- border-radius: 0;
+.chat-bottom-dock > .bg-activity > .bg-activity-strip {
+ min-height: 20px;
+ padding: 0;
+ font-size: 12px;
}
.readonly-chat .bg-activity {
- margin-top: 8px;
+ width: min(var(--content-w), calc(100% - 32px));
+ margin: 8px auto;
}
.bg-activity-strip {
appearance: none;
@@ -8388,7 +8363,8 @@ h3.ambient-field-label {
margin-right: max(16px, calc(10px + env(safe-area-inset-right)));
margin-left: max(16px, calc(10px + env(safe-area-inset-left)));
}
- .queued-strip {
+ .queued-strip,
+ .chat-bottom-dock > .bg-activity {
width: auto;
margin-right: max(28px, calc(22px + env(safe-area-inset-right)));
margin-left: max(28px, calc(22px + env(safe-area-inset-left)));
@@ -8411,7 +8387,8 @@ h3.ambient-field-label {
margin-left: calc(10px + env(safe-area-inset-left));
border-radius: 18px;
}
- .queued-strip {
+ .queued-strip,
+ .chat-bottom-dock > .bg-activity {
margin-right: calc(22px + env(safe-area-inset-right));
margin-left: calc(22px + env(safe-area-inset-left));
}
diff --git a/plugins/web-ui/test/pinned-composer-polish.test.ts b/plugins/web-ui/test/pinned-composer-polish.test.ts
index 6cb31f230..815eb9d9a 100644
--- a/plugins/web-ui/test/pinned-composer-polish.test.ts
+++ b/plugins/web-ui/test/pinned-composer-polish.test.ts
@@ -3,7 +3,6 @@ import { readFileSync } from "node:fs";
import test from "node:test";
const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
-const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
test("transcript top spacing and prompt gap stay compact at every density", () => {
const values = [...css.matchAll(/--chat-scroll-pad-top: (\d+)px/g)].map((m) => Number(m[1]));
@@ -14,19 +13,17 @@ test("transcript top spacing and prompt gap stay compact at every density", () =
assert.match(prompt, /margin-bottom: 12px;/);
});
-test("editable background activity is rendered inside the composer surface", () => {
+test("background activity shares the queued inset above the composer", () => {
assert.match(
chat,
- /composerForm\(agent, html`\$\{glanceTier \? nothing : liveWorkStatus\(agent\)\} \$\{backgroundActivityStrip\(\)\}`\)/,
- );
- assert.match(composer, /<form[^]*?class="composer-wrap[^]*?\$\{header\}/);
- assert.match(
- css,
- /\.composer-wrap > \.bg-activity \{[^}]*background: color-mix\(in srgb, var\(--secondary\) 40%, var\(--background\)\);/,
+ /ctx\.composer\.queuedStrip\(agent\)\} \$\{backgroundActivityStrip\(\)\}\s*\$\{ctx\.composer\.composerForm\(agent\)\}/,
);
+ assert.match(css, /\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{/);
+ assert.doesNotMatch(css, /\.composer-wrap > \.bg-activity/);
});
-test("composer status rows share the responsive input font size", () => {
+test("thinking shares input sizing 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])]),
);
@@ -35,7 +32,7 @@ test("composer status rows share the responsive input font size", () => {
[".composer-wrap", 16],
["body.app-edit-embed .composer-wrap", 13],
]);
- for (const selector of [".live-work-line", ".bg-activity-strip", ".composer-input"]) {
+ 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);
@@ -44,7 +41,7 @@ test("composer status rows share the responsive input font size", () => {
});
test("queued cards tuck beneath the next card just as the queue tucks beneath the composer", () => {
- const strip = css.match(/\.queued-strip \{([^}]+)\}/)?.[1] ?? "";
+ const strip = css.match(/\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{([^}]+)\}/)?.[1] ?? "";
const stacked = css.match(/\.queued-chip \+ \.queued-chip \{([^}]+)\}/)?.[1] ?? "";
assert.doesNotMatch(strip, /gap:/);
assert.match(strip, /margin: 0 auto -10px;/);
diff --git a/plugins/web-ui/test/queue-by-default.test.ts b/plugins/web-ui/test/queue-by-default.test.ts
index 50f5a8309..2ef8132c4 100644
--- a/plugins/web-ui/test/queue-by-default.test.ts
+++ b/plugins/web-ui/test/queue-by-default.test.ts
@@ -184,13 +184,10 @@ test("the strip renders core's queue, refreshed from the same read that names th
});
test("the queued strip sits behind and outside the composer form", () => {
- assert.match(
- chat,
- /ctx\.composer\.queuedStrip\(agent\)[\s\S]*?ctx\.composer\.composerForm\(agent, html`\$\{glanceTier \? nothing : liveWorkStatus\(agent\)\} \$\{backgroundActivityStrip\(\)\}`\)/,
- );
+ assert.match(chat, /ctx\.composer\.queuedStrip\(agent\)[\s\S]*?ctx\.composer\.composerForm\(agent\)/);
const composerMarkup = composer.slice(composer.indexOf('<form class="composer-wrap"'), composer.indexOf("</form>"));
assert.doesNotMatch(composerMarkup, /queuedStrip\(agent\)/);
- const queuedRule = shell.match(/(?:^|\n)\.queued-strip \{[^}]*\}/)?.[0] ?? "";
+ const queuedRule = shell.match(/(?:^|\n)\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{[^}]*\}/)?.[0] ?? "";
const composerRule = shell.match(/(?:^|\n)\.composer-wrap \{[^}]*\}/)?.[0] ?? "";
assert.match(queuedRule, /z-index: 0;/);
assert.match(queuedRule, /width: min\(calc\(var\(--content-w\) - 24px\), calc\(100% - 56px\)\);/);
@@ -202,11 +199,11 @@ test("the queued strip sits behind and outside the composer form", () => {
const narrow = shell.slice(narrowStart, shell.indexOf('[data-density="card"]', narrowStart));
assert.match(
midWidth,
- /\.queued-strip \{[^}]*margin-right: max\(28px, calc\(22px \+ env\(safe-area-inset-right\)\)\);[^}]*margin-left: max\(28px, calc\(22px \+ env\(safe-area-inset-left\)\)\);[^}]*\}/,
+ /\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{[^}]*margin-right: max\(28px, calc\(22px \+ env\(safe-area-inset-right\)\)\);[^}]*margin-left: max\(28px, calc\(22px \+ env\(safe-area-inset-left\)\)\);[^}]*\}/,
);
assert.match(
narrow,
- /\.queued-strip \{[^}]*margin-right: calc\(22px \+ env\(safe-area-inset-right\)\);[^}]*margin-left: calc\(22px \+ env\(safe-area-inset-left\)\);[^}]*\}/,
+ /\.queued-strip,\s*\.chat-bottom-dock > \.bg-activity \{[^}]*margin-right: calc\(22px \+ env\(safe-area-inset-right\)\);[^}]*margin-left: calc\(22px \+ env\(safe-area-inset-left\)\);[^}]*\}/,
);
});
diff --git a/plugins/web-ui/test/thinking-placement.test.ts b/plugins/web-ui/test/thinking-placement.test.ts
index c696bb07e..1acc13b66 100644
--- a/plugins/web-ui/test/thinking-placement.test.ts
+++ b/plugins/web-ui/test/thinking-placement.test.ts
@@ -5,25 +5,17 @@ const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
const composer = readFileSync(new URL("../src/composer.ts", import.meta.url), "utf8");
-test("thinking is the composer header above background activity, not a transparent dock sibling", () => {
- const dock = chat.slice(chat.indexOf('<div class="chat-bottom-dock">'));
- assert.match(
- dock,
- /composerForm\(agent, html`\$\{glanceTier \? nothing : liveWorkStatus\(agent\)\} \$\{backgroundActivityStrip\(\)\}`\)/,
+test("thinking follows the transcript outside the composer", () => {
+ const stack = chat.slice(chat.indexOf('<div class="message-stack'), chat.indexOf('<div class="chat-bottom-dock">'));
+ assert.match(stack, /liveWorkStatus\(agent\)/);
+ assert.ok(stack.indexOf("messageContent") < stack.indexOf("liveWorkStatus(agent)"));
+ const dock = chat.slice(
+ chat.indexOf('<div class="chat-bottom-dock">'),
+ chat.indexOf("transcriptViewport.afterRender();"),
);
- assert.ok(dock.indexOf("goalStrip(agent)") < dock.indexOf("ctx.composer.queuedStrip(agent)"));
- assert.ok(dock.indexOf("ctx.composer.queuedStrip(agent)") < dock.indexOf("composerForm(agent"));
- assert.doesNotMatch(css, /\.queued-strip:has\(\+ \.live-work-status\)/);
-});
-
-test("stacked composer headers share a solid surface without double negative margins", () => {
- assert.match(
- css,
- /\.composer-wrap > \.live-work-status,\s*\.composer-wrap > \.bg-activity \{[^}]*background: color-mix/,
- );
- assert.match(css, /\.composer-wrap > \.live-work-status:has\(\+ \.bg-activity\) \{\s*margin-bottom: 0;/);
- assert.match(css, /\.composer-wrap > \.live-work-status \+ \.bg-activity \{\s*margin-top: 0;\s*border-radius: 0;/);
- assert.doesNotMatch(css, /\.live-work-status \{[^}]*width: min/);
+ assert.doesNotMatch(dock, /liveWorkStatus/);
+ assert.doesNotMatch(chat, /typingRow|work-thinking/);
+ assert.doesNotMatch(css, /\.composer-wrap > \.live-work-status/);
});
test("model-unavailable composer retains the activity header and approvals", () => {