Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: keep live thinking in the transcript

Josh France55e1618962af
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.ts
index 628d7ab7e..c21e6a185 100644
--- a/plugins/web-ui/src/chat.ts
+++ b/plugins/web-ui/src/chat.ts
@@ -1273,12 +1273,12 @@ export function createChatSurface(
${pinnedStrip()}
<div class="message-stack ${emptyChat ? "empty-stack" : ""}">
${inheritedHeader()} ${chatState.earlierCount > 0 ? earlierNotice(agent) : nothing} ${messageContent}
- ${emptyChat ? html`<h1 class="chat-cta">${chatCta()}</h1>` : nothing}
+ ${emptyChat ? html`<h1 class="chat-cta">${chatCta()}</h1>` : nothing} ${liveWorkStatus(agent)}
${showStateError(messages, agent.state.errorMessage) ? html`<div class="composer-error inline">${agent.state.errorMessage}</div>` : nothing}
</div>
</section>
<div class="chat-bottom-dock">
- ${goalStrip(agent)} ${liveWorkDock(agent)} ${ctx.composer.queuedStrip(agent)}
+ ${goalStrip(agent)} ${ctx.composer.queuedStrip(agent)}
${ctx.composer.composerForm(agent, backgroundActivityStrip())}
</div>
</div>
@@ -2120,7 +2120,7 @@ export function createChatSurface(
`;
}
- function liveWorkDock(agent: Agent): TemplateResult | typeof nothing {
+ function liveWorkStatus(agent: Agent): TemplateResult | typeof nothing {
if (!agent.state.isStreaming && chatState.resolvingApprovals.size === 0) return nothing;
const work = chatState.liveWork ?? { status: "thinking", activity: [] };
if (work.status !== "thinking" && work.status !== "working") return nothing;
@@ -2130,7 +2130,7 @@ export function createChatSurface(
let title = "";
if (expandable) title = liveWorkExpanded ? "Show less" : "Show more";
return html`
- <section class="live-work-dock ${expanded ? "expanded" : ""}" aria-live="polite">
+ <section class="live-work-status ${expanded ? "expanded" : ""}" aria-live="polite">
<button
type="button"
class="live-work-line ${expandable ? "" : "static"}"
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 8d57ca611..c539ccb1e 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -2611,9 +2611,10 @@ a.chat-row-open {
max-height: 30vh;
}
-.live-work-dock {
- width: min(var(--content-w), calc(100% - 32px));
- margin: 0 auto 8px;
+.live-work-status {
+ width: 100%;
+ min-width: 0;
+ margin: 8px 0 0;
color: var(--muted-foreground);
}
.live-work-line {
@@ -2676,15 +2677,15 @@ a.chat-row-open {
transition: transform 0.15s ease;
}
-.live-work-dock.expanded .live-work-line {
+.live-work-status.expanded .live-work-line {
flex-wrap: wrap;
}
-.live-work-dock.expanded .live-work-label {
+.live-work-status.expanded .live-work-label {
white-space: normal;
overflow: visible;
text-overflow: clip;
}
-.live-work-dock.expanded .live-work-detail {
+.live-work-status.expanded .live-work-detail {
order: 1;
flex-basis: 100%;
margin-top: 4px;
@@ -2693,7 +2694,7 @@ a.chat-row-open {
text-overflow: clip;
max-height: 38vh;
}
-.live-work-dock.expanded .live-work-toggle {
+.live-work-status.expanded .live-work-toggle {
transform: rotate(90deg);
}
@@ -7245,8 +7246,7 @@ h3.ambient-field-label {
/* Mid-width surfaces: the floating composer/dock hug the full-width column with 16px
side margins, but must still clear the device safe areas — the 10px variant below
only kicks in at <=470px, so the insets need a floor here too. */
- .composer-wrap,
- .live-work-dock {
+ .composer-wrap {
width: auto;
margin-right: max(16px, calc(10px + env(safe-area-inset-right)));
margin-left: max(16px, calc(10px + env(safe-area-inset-left)));
@@ -7278,10 +7278,6 @@ h3.ambient-field-label {
margin-right: calc(22px + env(safe-area-inset-right));
margin-left: calc(22px + env(safe-area-inset-left));
}
- .live-work-dock {
- margin-right: calc(10px + env(safe-area-inset-right));
- margin-left: calc(10px + env(safe-area-inset-left));
- }
.goal-strip {
margin-right: calc(18px + env(safe-area-inset-right));
margin-left: calc(18px + env(safe-area-inset-left));
@@ -7289,8 +7285,8 @@ h3.ambient-field-label {
}
[data-density="card"] .context-banner,
[data-density="strip"] .context-banner,
-[data-density="card"] .live-work-dock,
-[data-density="strip"] .live-work-dock,
+[data-density="card"] .live-work-status,
+[data-density="strip"] .live-work-status,
[data-density="card"] .goal-strip,
[data-density="strip"] .goal-strip {
display: none;
diff --git a/plugins/web-ui/test/responsive-source.test.ts b/plugins/web-ui/test/responsive-source.test.ts
index 4233249f2..a814954bc 100644
--- a/plugins/web-ui/test/responsive-source.test.ts
+++ b/plugins/web-ui/test/responsive-source.test.ts
@@ -130,14 +130,10 @@ test("touch layouts expose row actions and preserve readable composer choices",
assert.match(compactCss, /margin: 0 auto max\(18px, calc\(10px \+ env\(safe-area-inset-bottom\)\)\)/);
assert.match(
compactCss,
- /\.composer-wrap,\s*\.live-work-dock \{\s*width: auto;\s*margin-right: max\(16px, calc\(10px \+ env\(safe-area-inset-right\)\)\);\s*margin-left: max\(16px, calc\(10px \+ env\(safe-area-inset-left\)\)\)/,
+ /\.composer-wrap \{\s*width: auto;\s*margin-right: max\(16px, calc\(10px \+ env\(safe-area-inset-right\)\)\);\s*margin-left: max\(16px, calc\(10px \+ env\(safe-area-inset-left\)\)\)/,
);
assert.match(
compactCss,
/\.composer-wrap \{\s*margin-right: calc\(10px \+ env\(safe-area-inset-right\)\);\s*margin-bottom: calc\(10px \+ env\(safe-area-inset-bottom\)\);\s*margin-left: calc\(10px \+ env\(safe-area-inset-left\)\)/,
);
- assert.match(
- compactCss,
- /\.live-work-dock \{\s*margin-right: calc\(10px \+ env\(safe-area-inset-right\)\);\s*margin-left: calc\(10px \+ 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
new file mode 100644
index 000000000..879981bc6
--- /dev/null
+++ b/plugins/web-ui/test/thinking-placement.test.ts
@@ -0,0 +1,27 @@
+import assert from "node:assert/strict";
+import { readFileSync } from "node:fs";
+import test from "node:test";
+const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
+const css = readFileSync(new URL("../src/shell.css", import.meta.url), "utf8");
+
+test("live thinking and tool activity belong to the transcript, not the composer dock", () => {
+ const draw = chat.slice(
+ chat.indexOf(" function drawActiveChat("),
+ chat.indexOf(" function decorateStreamingTail("),
+ );
+ const transcript = draw.slice(
+ draw.indexOf('<section class="chat-scroll">'),
+ draw.indexOf('<div class="chat-bottom-dock">'),
+ );
+ const dock = draw.slice(draw.indexOf('<div class="chat-bottom-dock">'));
+ assert.match(transcript, /\$\{liveWorkStatus\(agent\)\}/);
+ assert.doesNotMatch(dock, /liveWork(?:Dock|Status)\(agent\)/);
+ assert.match(dock, /composerForm\(agent, backgroundActivityStrip\(\)\)/);
+});
+
+test("the live-work row aligns with the message column rather than composer gutters", () => {
+ const rule = css.match(/\.live-work-status \{[^}]*\}/)?.[0] ?? "";
+ assert.match(rule, /width: 100%;/);
+ assert.match(rule, /margin: 8px 0 0;/);
+ assert.doesNotMatch(css, /live-work-dock/);
+});