Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: tighten pinned spacing and integrate activity status

Josh Franceea6d4f3d2793
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.ts
index 6362630a9..628d7ab7e 100644
--- a/plugins/web-ui/src/chat.ts
+++ b/plugins/web-ui/src/chat.ts
@@ -1278,8 +1278,8 @@ export function createChatSurface(
</div>
</section>
<div class="chat-bottom-dock">
- ${backgroundActivityStrip()} ${goalStrip(agent)} ${liveWorkDock(agent)} ${ctx.composer.queuedStrip(agent)}
- ${ctx.composer.composerForm(agent)}
+ ${goalStrip(agent)} ${liveWorkDock(agent)} ${ctx.composer.queuedStrip(agent)}
+ ${ctx.composer.composerForm(agent, backgroundActivityStrip())}
</div>
</div>
`,
diff --git a/plugins/web-ui/src/composer.ts b/plugins/web-ui/src/composer.ts
index a93be0d87..8619de53f 100644
--- a/plugins/web-ui/src/composer.ts
+++ b/plugins/web-ui/src/composer.ts
@@ -379,7 +379,7 @@ export function createComposerSurface(ctx: ConvCtx): ComposerSurface {
ctx.chat.drawActiveChat(agent);
}
- function composerForm(agent: Agent): TemplateResult {
+ function composerForm(agent: Agent, header: TemplateResult | typeof nothing = nothing): TemplateResult {
const selectedModel = currentModelOption();
if (!selectedModel) {
const selected =
@@ -516,7 +516,7 @@ export function createComposerSurface(ctx: ConvCtx): ComposerSurface {
`;
return html`
<form class="composer-wrap ${compact ? "compact" : ""}" @submit=${(e: Event) => submitComposer(e, agent)}>
- ${slashMenu(agent)}
+ ${header} ${slashMenu(agent)}
${
activeRuntimeConfig?.upgradeAvailable
? html`<div class="runtime-upgrade">
diff --git a/plugins/web-ui/src/conv-types.ts b/plugins/web-ui/src/conv-types.ts
index ee9b57fae..f5b4a87c6 100644
--- a/plugins/web-ui/src/conv-types.ts
+++ b/plugins/web-ui/src/conv-types.ts
@@ -1,5 +1,5 @@
import type { Agent } from "@earendil-works/pi-agent-core";
-import type { TemplateResult } from "lit";
+import type { TemplateResult, nothing } from "lit";
import type { DensityTier } from "./density";
import type { Attachment } from "@earendil-works/pi-web-ui";
import type {
@@ -119,7 +119,7 @@ interface ComposerState {
export interface ComposerSurface {
restageAttachments(attachments: Attachment[], note: string): void;
state: ComposerState;
- composerForm(agent: Agent): TemplateResult;
+ composerForm(agent: Agent, header?: TemplateResult | typeof nothing): TemplateResult;
queuedStrip(agent: Agent): TemplateResult | typeof import("lit").nothing;
queuedRunsFor(threadRef: string | null): QueuedRun[];
setQueuedRuns(threadRef: string, runs: QueuedRun[]): void;
diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.css
index 71b8c377b..8d57ca611 100644
--- a/plugins/web-ui/src/shell.css
+++ b/plugins/web-ui/src/shell.css
@@ -1310,7 +1310,7 @@ a.chat-row-open {
}
.chat-scroll {
isolation: isolate;
- --chat-scroll-pad-top: 28px;
+ --chat-scroll-pad-top: 8px;
container-type: size;
--chat-edge-space: 24px;
@@ -1381,7 +1381,7 @@ a.chat-row-open {
top: 0;
z-index: 6;
width: min(var(--content-w), 100%);
- margin: 0 auto 10px;
+ margin: 0 auto 8px;
border: 1px solid var(--border, #d0d0d0);
border-radius: 10px;
background: var(--background, #fff);
@@ -1532,9 +1532,9 @@ a.chat-row-open {
position: sticky;
top: var(--chat-sticky-top, 0px);
z-index: 3;
- padding-top: 14px;
- margin-top: -14px;
- margin-bottom: var(--chat-edge-space);
+ padding-top: 8px;
+ margin-top: -8px;
+ margin-bottom: 12px;
background: transparent;
pointer-events: none;
}
@@ -2471,6 +2471,19 @@ a.chat-row-open {
color: var(--muted-foreground);
font-size: 12.5px;
}
+.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));
+}
.readonly-chat .bg-activity {
margin-top: 8px;
}
@@ -2792,11 +2805,14 @@ a.chat-row-open {
}
.composer-wrap {
+ --composer-pad-block: 12px;
+ --composer-pad-inline: 12px;
+ --composer-pad-end: var(--composer-pad-inline);
position: relative;
z-index: 1;
width: min(var(--content-w), calc(100% - 32px));
margin: 0 auto max(18px, calc(10px + env(safe-area-inset-bottom)));
- padding: 12px;
+ padding: var(--composer-pad-block) var(--composer-pad-end) var(--composer-pad-block) var(--composer-pad-inline);
border: 1px solid var(--border);
border-radius: 24px;
background: var(--background);
@@ -3305,7 +3321,7 @@ a.chat-row-open {
text-underline-offset: 2px;
}
.readonly-scroll {
- --chat-scroll-pad-top: 20px;
+ --chat-scroll-pad-top: 8px;
}
.chat-loading {
flex: 1;
@@ -7205,7 +7221,7 @@ h3.ambient-field-label {
}
[data-density="compact"] .chat-scroll {
- --chat-scroll-pad-top: 14px;
+ --chat-scroll-pad-top: 8px;
--chat-edge-space: 14px;
padding: var(--chat-scroll-pad-top) var(--chat-pad) var(--chat-scroll-pad-bottom);
}
@@ -7284,6 +7300,8 @@ h3.ambient-field-label {
}
[data-density] .composer-wrap {
+ --composer-pad-block: 6px;
+ --composer-pad-inline: 8px;
display: flex;
flex-wrap: wrap;
align-items: flex-end;
@@ -7292,7 +7310,7 @@ h3.ambient-field-label {
the surface's own width — a pane that fills a wide window centres the composer on the
transcript column instead of stretching across it, and a narrow one still runs full-bleed. */
margin-bottom: 10px;
- padding: 6px 8px;
+ padding: var(--composer-pad-block) var(--composer-pad-end) var(--composer-pad-block) var(--composer-pad-inline);
border-radius: 16px;
}
[data-density] .composer-input {
@@ -8735,7 +8753,7 @@ h3.ambient-field-label {
min-height: 0;
}
.mini-convo-body .chat-scroll {
- --chat-scroll-pad-top: 12px;
+ --chat-scroll-pad-top: 8px;
--chat-edge-space: 12px;
--chat-pad: 12px;
container-type: normal;
@@ -9358,7 +9376,10 @@ h3.ambient-field-label {
.composer-wrap {
width: calc(100% - 16px);
margin: 0 auto calc(8px + env(safe-area-inset-bottom));
- padding: 8px 8px 8px 10px;
+ --composer-pad-block: 8px;
+ --composer-pad-inline: 10px;
+ --composer-pad-end: 8px;
+ padding: var(--composer-pad-block) var(--composer-pad-end) var(--composer-pad-block) var(--composer-pad-inline);
border-radius: 22px;
}
.composer-input {
diff --git a/plugins/web-ui/test/pinned-composer-polish.test.ts b/plugins/web-ui/test/pinned-composer-polish.test.ts
new file mode 100644
index 000000000..4c78f1b6d
--- /dev/null
+++ b/plugins/web-ui/test/pinned-composer-polish.test.ts
@@ -0,0 +1,24 @@
+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 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]));
+ assert.ok(values.length >= 3 && values.every((v) => v === 8));
+ const prompt = css.match(/\.message-stack \.user-row:not\(:has\(~ \.user-row\)\) \{[^}]*\}/)?.[0] ?? "";
+ assert.match(prompt, /padding-top: 8px;/);
+ assert.match(prompt, /margin-top: -8px;/);
+ assert.match(prompt, /margin-bottom: 12px;/);
+});
+
+test("editable background activity is rendered inside the composer surface", () => {
+ assert.match(chat, /composerForm\(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\)\);/,
+ );
+});
diff --git a/plugins/web-ui/test/queue-by-default.test.ts b/plugins/web-ui/test/queue-by-default.test.ts
index b27cc22f6..077c69f7c 100644
--- a/plugins/web-ui/test/queue-by-default.test.ts
+++ b/plugins/web-ui/test/queue-by-default.test.ts
@@ -184,7 +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\)/);
+ assert.match(
+ chat,
+ /ctx\.composer\.queuedStrip\(agent\)[\s\S]*?ctx\.composer\.composerForm\(agent, backgroundActivityStrip\(\)\)/,
+ );
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] ?? "";