Multiplayer agent harness for work.
Compact the composer in short multiview panes (#1370)
Joshua Franceca4b429b001b
diff --git a/plugins/web-ui/src/composer.ts b/plugins/web-ui/src/composer.tsindex d97224fe2..d8084c198 100644--- a/plugins/web-ui/src/composer.ts+++ b/plugins/web-ui/src/composer.ts@@ -19,6 +19,7 @@ import {FileText,Paperclip,Square,+ Settings,Star,X,Zap,@@ -636,8 +637,17 @@ export function createComposerSurface(ctx: ConvCtx): ComposerSurface {${icon(Paperclip, 18)}</button>${showRuntimeControls ? runtimeControls : nothing}- <button type="button" class="btn" @click=${() => switchView("settings")}>- ${appState.me?.individualModelAuth ? "My account" : "Company access"}+ <button+ type="button"+ class="btn composer-account"+ aria-label=${appState.me?.individualModelAuth ? "My account" : "Company access"}+ ${tip(appState.me?.individualModelAuth ? "My account" : "Company access")}+ @click=${() => switchView("settings")}+ >+ <span class="composer-account-icon" aria-hidden="true">${icon(Settings, 18)}</span>+ <span class="composer-account-label">+ ${appState.me?.individualModelAuth ? "My account" : "Company access"}+ </span></button></div><div class="composer-right">${sendControls(agent)}</div>diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.cssindex 4400632b4..017a7efb4 100644--- a/plugins/web-ui/src/shell.css+++ b/plugins/web-ui/src/shell.css@@ -8246,7 +8246,7 @@ h3.ambient-field-label {}.split-pane-content {- container-type: size;+ container: split-pane / size;position: relative;width: 100%;height: 100%;@@ -12073,3 +12073,86 @@ body.app-edit-embed .custom-chat-shell.app-edit-chat > .chat-bottom-dock {.settings-ai-controls .settings-choice {flex-wrap: wrap;}++.composer-account-icon {+ display: none;+}++@container split-pane (max-height: 480px) {+ .composer-wrap {+ display: grid;+ grid-template-columns: minmax(0, 1fr) auto;+ align-items: center;+ gap: 6px;+ padding: 6px;+ border-radius: 16px;+ }+ .composer-wrap > * {+ grid-column: 1 / -1;+ }+ .composer-wrap .composer-input {+ grid-column: 1;+ min-width: 0;+ min-height: 34px;+ max-height: 120px;+ padding: 6px 8px;+ }+ .composer-wrap .composer-input::placeholder {+ white-space: nowrap;+ }+ .composer-wrap .composer-toolbar {+ grid-column: 2;+ flex-wrap: nowrap;+ gap: 4px;+ }+ .composer-wrap .composer-left,+ .composer-wrap .composer-right {+ width: auto;+ flex-wrap: nowrap;+ gap: 4px;+ }+ .composer-wrap .composer-account {+ width: 34px;+ height: 34px;+ min-height: 34px;+ padding: 0;+ flex: none;+ justify-content: center;+ }+ .composer-wrap .composer-account-label {+ display: none;+ }+ .composer-wrap .composer-account-icon {+ display: inline-flex;+ }+ .composer-wrap .composer-toolbar .menu-button.loadout-button {+ max-width: 180px;+ }+}++@container split-pane (max-height: 480px) and (max-width: 470px) {+ .composer-wrap .loadout-button .menu-label,+ .composer-wrap .loadout-button .menu-suffix {+ display: none;+ }+ .composer-wrap .composer-toolbar .menu-button.loadout-button {+ width: 34px;+ padding: 0;+ justify-content: center;+ }+}++@container split-pane (max-height: 480px) and (max-width: 300px) {+ .composer-wrap .composer-toolbar .icon-btn,+ .composer-wrap .composer-toolbar .menu-button.loadout-button,+ .composer-wrap .composer-toolbar .send-btn,+ .composer-wrap .composer-toolbar .stop-btn,+ .composer-wrap .composer-toolbar .composer-account {+ width: 28px;+ height: 28px;+ min-height: 28px;+ }+ .composer-wrap .composer-attach {+ transform: none;+ }+}diff --git a/plugins/web-ui/test/pane-approval-overflow.test.ts b/plugins/web-ui/test/pane-approval-overflow.test.tsindex 5bae8d9fb..993e45279 100644--- a/plugins/web-ui/test/pane-approval-overflow.test.ts+++ b/plugins/web-ui/test/pane-approval-overflow.test.ts@@ -28,7 +28,7 @@ test("approval panel caps to the pane viewport and scrolls instead of clipping",const panel = css.match(/\.composer-approval-panel \{[^}]*\}/)?.[0] ?? "";assert.match(panel, /max-height: min\(calc\(100dvh - 130px\), calc\(100cqh - 130px\)\);/);const pane = css.match(/\.split-pane-content \{[^}]*\}/)?.[0] ?? "";- assert.match(pane, /container-type: size;/, "approval height must follow the pane, not the whole window");+ assert.match(pane, /container: split-pane \/ size;/, "approval height must follow the pane, not the whole window");assert.match(panel, /overflow-y: auto;/, "panel must scroll once the cap binds");});diff --git a/plugins/web-ui/test/pane-composer-source.test.ts b/plugins/web-ui/test/pane-composer-source.test.tsindex 69fa8e928..9c4a9f5e8 100644--- a/plugins/web-ui/test/pane-composer-source.test.ts+++ b/plugins/web-ui/test/pane-composer-source.test.ts@@ -5,7 +5,7 @@ import test from "node:test";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("pane composers keep the full-width input above a separate toolbar", () => {+test("pane composers default to the full-width input above a separate toolbar", () => {assert.doesNotMatch(css, /\.embed-layout/, "panes are elements now, not framed documents");const wrap = css.match(/^\.composer-wrap \{[^}]*\}/m)?.[0] ?? "";assert.doesNotMatch(wrap, /display: flex;/);@@ -35,3 +35,42 @@ test("pane settings control is visible without hover", () => {const block = css.match(/\.settings-control \.menu-button \{[^}]*\}/)?.[0] ?? "";assert.doesNotMatch(block, /opacity: 0;/);});++test("only short split panes put the textarea and toolbar on the same grid row", () => {+ assert.match(css, /\.split-pane-content \{\s*container: split-pane \/ size;/);+ const short = css.slice(css.indexOf("@container split-pane (max-height: 480px)"));+ assert.match(short, /\.composer-wrap \{[^}]*display: grid;[^}]*grid-template-columns: minmax\(0, 1fr\) auto;/);+ assert.match(short, /\.composer-wrap > \* \{\s*grid-column: 1 \/ -1;/);+ assert.match(short, /\.composer-input \{[^}]*grid-column: 1;[^}]*min-height: 34px;[^}]*max-height: 120px;/);+ assert.match(short, /\.composer-toolbar \{[^}]*grid-column: 2;[^}]*flex-wrap: nowrap;/);+ assert.doesNotMatch(short, /\.composer-input \{[^}]*(?<!-)height:/);+ assert.match(short, /\.composer-input::placeholder \{\s*white-space: nowrap;/);+});++test("narrow short panes hide runtime labels, not the accessible picker", () => {+ const narrow = css.slice(css.indexOf("@container split-pane (max-height: 480px) and (max-width: 470px)"));+ assert.match(narrow, /\.loadout-button \.menu-label,/);+ assert.match(narrow, /\.loadout-button \.menu-suffix \{\s*display: none;/);+ assert.match(narrow, /\.loadout-button \{[^}]*width: 34px;/);+ assert.doesNotMatch(narrow, /\.loadout-(?:button|control) \{[^}]*display: none;/);+ assert.match(composer, /aria-label=\$\{`Model:/);+});++test("short panes preserve the account action with a named icon-only button", () => {+ const account = composer.match(/<button\s+type="button"\s+class="btn composer-account"[^]*?<\/button>/)?.[0] ?? "";+ assert.match(account, /aria-label=\$\{appState\.me\?\.individualModelAuth \? "My account" : "Company access"\}/);+ assert.match(account, /@click=\$\{\(\) => switchView\("settings"\)\}/);+ assert.match(account, /class="composer-account-icon" aria-hidden="true"/);+ assert.match(css, /^\.composer-account-icon \{\s*display: none;/m);+ const short = css.slice(css.indexOf("@container split-pane (max-height: 480px)"));+ assert.match(short, /\.composer-account-label \{\s*display: none;/);+ assert.match(short, /\.composer-account-icon \{\s*display: inline-flex;/);+ assert.doesNotMatch(short, /\.composer-account \{[^}]*display: none;/);+});++test("the smallest short panes leave text space even with stop and account controls", () => {+ const minimum = css.slice(css.indexOf("@container split-pane (max-height: 480px) and (max-width: 300px)"));+ assert.match(minimum, /\.composer-toolbar \.stop-btn,/);+ assert.match(minimum, /\.composer-toolbar \.composer-account \{\s*width: 28px;\s*height: 28px;\s*min-height: 28px;/);+ assert.match(minimum, /\.composer-attach \{\s*transform: none;/);+});