Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

fix: keep multiview suggestions out of composer dock (#1570)

Joshua France29b6a0172c83
diff --git a/plugins/web-ui/src/chat.ts b/plugins/web-ui/src/chat.ts
index f2c50925c..de643a46e 100644
--- a/plugins/web-ui/src/chat.ts
+++ b/plugins/web-ui/src/chat.ts
@@ -1406,6 +1406,24 @@ export function createChatSurface(
const tier = ctx.density();
const glanceTier = tier === "card" || tier === "strip" ? tier : null;
const emptyChat = !messages.length && (showWelcome || !chatState.forkSession);
+ const showSuggestions =
+ emptyChat &&
+ !editingApp &&
+ !(isNewUser && appState.me?.welcomeCohort) &&
+ !glanceTier &&
+ (!ctx.pane || tier === "full") &&
+ !chatState.sessionId &&
+ (chatState.scopeId === null || chatState.scopeId === `personal:${appState.me?.user}`) &&
+ !agent.state.isStreaming;
+ const suggestions = showSuggestions
+ ? suggestedActivities(
+ appState.me?.suggestedActivities,
+ (activity) => ctx.composer.fillSuggestedPrompt(activity.prompt, agent),
+ Boolean(
+ ctx.composer.state.draft || ctx.composer.state.attachments.length || ctx.composer.state.processingFiles,
+ ),
+ )
+ : nothing;
render(
html`
<div
@@ -1433,32 +1451,13 @@ export function createChatSurface(
${chatState.earlierCount > 0 ? earlierNotice(agent) : nothing} ${messageContent}
${glanceTier ? nothing : liveWorkStatus(agent)}
${emptyChat && !isNewUser && !editingApp && !showWelcome ? html`<h1 class="chat-cta">${chatCta()}</h1>` : nothing}
+ ${ctx.pane ? suggestions : nothing}
${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)} ${ctx.composer.queuedStrip(agent)} ${backgroundActivityStrip()}
- ${ctx.composer.composerForm(agent)}
- ${
- emptyChat &&
- !editingApp &&
- !(isNewUser && appState.me?.welcomeCohort) &&
- !glanceTier &&
- (!ctx.pane || tier === "full") &&
- !chatState.sessionId &&
- (chatState.scopeId === null || chatState.scopeId === `personal:${appState.me?.user}`) &&
- !agent.state.isStreaming
- ? suggestedActivities(
- appState.me?.suggestedActivities,
- (activity) => ctx.composer.fillSuggestedPrompt(activity.prompt, agent),
- Boolean(
- ctx.composer.state.draft ||
- ctx.composer.state.attachments.length ||
- ctx.composer.state.processingFiles,
- ),
- )
- : nothing
- }
+ ${ctx.composer.composerForm(agent)} ${ctx.pane ? nothing : suggestions}
</div>
</div>
`,
diff --git a/plugins/web-ui/test/suggested-activities-ui.test.ts b/plugins/web-ui/test/suggested-activities-ui.test.ts
index 2fb54c963..d322a9e9f 100644
--- a/plugins/web-ui/test/suggested-activities-ui.test.ts
+++ b/plugins/web-ui/test/suggested-activities-ui.test.ts
@@ -7,14 +7,17 @@ import type { Agent } from "@earendil-works/pi-agent-core";
import type { ComposerSurface, ConvCtx } from "../src/conv-types.ts";
import type { SuggestedActivity } from "../../chassis/src/suggested-activities.ts";
-test("suggested prompts render below the composer", () => {
+test("suggested prompts stay in regular docks but move into multiview chat areas", () => {
const chat = readFileSync(new URL("../src/chat.ts", import.meta.url), "utf8");
+ const activeChat = chat.slice(chat.indexOf("const emptyChat ="));
+ const stack = activeChat.slice(activeChat.indexOf('<div class="message-stack'), activeChat.indexOf("</section>"));
const dock = chat.slice(
chat.indexOf('<div class="chat-bottom-dock">'),
chat.indexOf("transcriptViewport.afterRender()"),
);
+ assert.match(stack, /ctx\.pane \? suggestions : nothing/);
const composerIndex = dock.indexOf("ctx.composer.composerForm(agent)");
- const suggestionsIndex = dock.indexOf("suggestedActivities(");
+ const suggestionsIndex = dock.indexOf("ctx.pane ? nothing : suggestions");
assert.notEqual(composerIndex, -1);
assert.notEqual(suggestionsIndex, -1);
assert.ok(composerIndex < suggestionsIndex);