Multiplayer agent harness for work.
feat(inbox): move draft actions into composer suggestions
16francej979ccab301c4
diff --git a/docs/images/inbox-composer-actions.png b/docs/images/inbox-composer-actions.pngnew file mode 100644index 000000000..d81f54afcBinary files /dev/null and b/docs/images/inbox-composer-actions.png differdiff --git a/plugins/web-ui/src/inbox.ts b/plugins/web-ui/src/inbox.tsindex 6c074bd3c..00a438a2d 100644--- a/plugins/web-ui/src/inbox.ts+++ b/plugins/web-ui/src/inbox.ts@@ -752,14 +752,11 @@ export function contextTpl(item: InboxItem): TemplateResult | typeof nothing {</div>`;}-function sendLabel(item: InboxItem, busy: boolean): string {- if (busy) return "Sending…";- return item.source === "gmail" ? "Send reply" : "Send to Slack";-}-function syncAskEnabled(box: HTMLTextAreaElement): void {- const send = box.closest(".inbox-chat-composer")?.querySelector<HTMLButtonElement>(".inbox-chat-send");+ const composer = box.closest(".inbox-chat-composer");+ const send = composer?.querySelector<HTMLButtonElement>(".inbox-chat-send");if (send) send.disabled = !box.value.trim();+ composer?.classList.toggle("has-text", !!box.value.trim());}export function chatTpl(item: InboxItem): TemplateResult {@@ -786,7 +783,7 @@ export function chatTpl(item: InboxItem): TemplateResult {</div>`}${busy ? html`<div class="inbox-chat-working">Thinking…</div>` : nothing}- <div class="inbox-chat-composer">+ <div class="inbox-chat-composer ${pending.trim() ? "has-text" : ""}"><textareaclass="inbox-chat-input"rows="1"@@ -806,6 +803,30 @@ export function chatTpl(item: InboxItem): TemplateResult {}}></textarea><div class="inbox-chat-actions">+ <div class="inbox-chat-suggest">+ ${+ item.status === "open"+ ? html`+ <button+ class="inbox-suggest-chip primary"+ type="button"+ ?disabled=${sending.has(item.id)}+ ${tip(item.source === "gmail" ? "Send the drafted reply in Gmail" : "Send the drafted reply to Slack")}+ @click=${() => void sendItem(item)}+ >+ ${icon(Send, 12)}<span>${sending.has(item.id) ? "Sending…" : "Send it"}</span>+ </button>+ <button+ class="inbox-suggest-chip"+ type="button"+ @click=${() => void setItemStatus(item, "dismissed")}+ >+ ${icon(X, 12)}<span>Dismiss</span>+ </button>+ `+ : nothing+ }+ </div><buttonclass="btn inbox-chat-send"type="button"@@ -829,7 +850,6 @@ export function chatTpl(item: InboxItem): TemplateResult {export function draftEditorTpl(item: InboxItem, opts: { chat?: boolean } = {}): TemplateResult {const draft = effectiveDraft(item);- const busy = sending.has(item.id);const gmail = item.source === "gmail";const showCc = gmail && ((draft.cc?.length ?? 0) > 0 || (item.gmail?.cc?.length ?? 0) > 0);return html`@@ -848,6 +868,13 @@ export function draftEditorTpl(item: InboxItem, opts: { chat?: boolean } = {}):</a>`: nothing}+ ${+ item.externalUrl+ ? html`<a class="inbox-external-link" href=${item.externalUrl} target="_blank" rel="noreferrer noopener">+ ${icon(ArrowUpRight, 12)}<span>Open in ${gmail ? "Gmail" : "Slack"}</span>+ </a>`+ : nothing+ }</div>${gmail@@ -897,22 +924,6 @@ export function draftEditorTpl(item: InboxItem, opts: { chat?: boolean } = {}):@blur=${() => void persistDraft(item)}></textarea></div>- <div class="inbox-draft-actions">- <button class="btn primary inbox-send-btn" type="button" ?disabled=${busy} @click=${() => void sendItem(item)}>- ${icon(Send, 13)}<span>${sendLabel(item, busy)}</span>- </button>- <button class="btn" type="button" @click=${() => void setItemStatus(item, "dismissed")}>- ${icon(X, 13)}<span>Dismiss</span>- </button>- <span class="inbox-draft-spacer"></span>- ${- item.externalUrl- ? html`<a class="inbox-external-link" href=${item.externalUrl} target="_blank" rel="noreferrer noopener">- ${icon(ArrowUpRight, 13)}<span>Open in ${gmail ? "Gmail" : "Slack"}</span>- </a>`- : nothing- }- </div>${!gmail && item.reactions?.length? html`<div class="inbox-reactions">${item.reactions.map((name) => reactionChipTpl(name))}</div>`diff --git a/plugins/web-ui/src/shell.css b/plugins/web-ui/src/shell.cssindex 33c5f77e9..20f48e702 100644--- a/plugins/web-ui/src/shell.css+++ b/plugins/web-ui/src/shell.css@@ -7747,8 +7747,7 @@ h3.ambient-field-label {border-bottom: 1px solid var(--border);flex-wrap: wrap;}-.inbox-toolbar-spacer,-.inbox-draft-spacer {+.inbox-toolbar-spacer {flex: 1;}.inbox-chips {@@ -8129,6 +8128,7 @@ h3.ambient-field-label {gap: 8px;}.inbox-draft-label {+ margin-right: auto;font-size: 11px;color: var(--muted-foreground);}@@ -8147,7 +8147,6 @@ h3.ambient-field-label {text-decoration: underline;}.inbox-session-link {- margin-left: auto;font-size: 11px;}.inbox-field {@@ -8191,17 +8190,6 @@ h3.ambient-field-label {outline: none;border-color: var(--accent);}-.inbox-draft-actions {- display: flex;- align-items: center;- gap: 8px;- flex-wrap: wrap;-}-.inbox-draft-actions .btn {- display: inline-flex;- align-items: center;- gap: 5px;-}.inbox-chat {display: flex;flex-direction: column;@@ -8319,7 +8307,53 @@ h3.ambient-field-label {}.inbox-chat-actions {display: flex;- justify-content: flex-end;+ align-items: center;+ justify-content: space-between;+ gap: 8px;+}+.inbox-chat-suggest {+ display: flex;+ align-items: center;+ gap: 6px;+ flex-wrap: wrap;+ min-width: 0;+}+.inbox-chat-composer.has-text .inbox-chat-suggest {+ visibility: hidden;+}+.inbox-suggest-chip {+ display: inline-flex;+ align-items: center;+ gap: 5px;+ padding: 4px 11px;+ border: 1px solid var(--border);+ border-radius: 999px;+ background: transparent;+ color: var(--muted-foreground);+ font: inherit;+ font-size: 12.5px;+ cursor: pointer;+ transition:+ background 0.12s ease,+ color 0.12s ease,+ border-color 0.12s ease;+}+.inbox-suggest-chip:hover:not(:disabled) {+ border-color: var(--accent);+ color: var(--foreground);+}+.inbox-suggest-chip.primary {+ border-color: color-mix(in srgb, var(--cta) 45%, var(--border));+ color: var(--cta);+ background: color-mix(in srgb, var(--cta) 7%, transparent);+}+.inbox-suggest-chip.primary:hover:not(:disabled) {+ border-color: var(--cta);+ background: color-mix(in srgb, var(--cta) 14%, transparent);+}+.inbox-suggest-chip:disabled {+ opacity: 0.5;+ cursor: default;}.inbox-chat-send {display: inline-flex;diff --git a/plugins/web-ui/test/inbox-source.test.ts b/plugins/web-ui/test/inbox-source.test.tsindex 3c5bb3369..42e8c167f 100644--- a/plugins/web-ui/test/inbox-source.test.ts+++ b/plugins/web-ui/test/inbox-source.test.ts@@ -61,8 +61,10 @@ test("an inbox drag paints drop zones on every existing pane", () => {test("email items edit like an email; slack items like slack", () => {assert.match(inbox, /<span>To<\/span>/);assert.match(inbox, /<span>Subject<\/span>/);- assert.match(inbox, /Send reply/);- assert.match(inbox, /Send to Slack/);+ assert.match(inbox, /Send it/, "send lives in the composer as a suggested action");+ assert.match(inbox, /inbox-chat-suggest/, "suggested actions render inside the ask composer");+ assert.match(inbox, /Send the drafted reply in Gmail/);+ assert.match(inbox, /Send the drafted reply to Slack/);assert.match(inbox, /rows=\$\{gmail \? 7 : 3\}/, "email drafts get a taller editor than slack replies");});@@ -198,3 +200,16 @@ test("an edit remembers the draft version it started from, and both edit and senassert.match(inbox, /const basedOnAt = edited\?\.basedOnAt \?\? item\.draftAt;/);assert.match(inbox, /if \(isDraftConflict\(e\)\) return explainDraftConflict\(item, true\);/);});++test("draft header links stay together after the label", () => {+ assert.match(css, /\.inbox-draft-label \{[^}]*margin-right: auto;/);+ assert.doesNotMatch(css, /\.inbox-session-link \{[^}]*margin-left: auto;/);+ assert.doesNotMatch(css, /\.inbox-draft-head \.inbox-external-link \{[^}]*margin-left: auto;/);+});++test("suggested draft actions yield to typed instructions without reflow", () => {+ assert.match(inbox, /composer\?\.classList\.toggle\("has-text", !!box\.value\.trim\(\)\)/);+ assert.match(inbox, /inbox-chat-composer \$\{pending\.trim\(\) \? "has-text" : ""\}/);+ assert.match(css, /\.inbox-chat-composer\.has-text \.inbox-chat-suggest \{\s*visibility: hidden;/);+ assert.doesNotMatch(inbox, /inbox-draft-actions|function sendLabel/);+});