From 9f4ee75c0bfc4cfd7881acc9ad3e63c223906111 Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Sun, 8 Nov 2026 07:56:54 -0800 Subject: [PATCH] Show a spinner on a note that is sent and waiting for Plan2Code AI Assisted --- CHANGELOG.md | 1 + scripts/test-web-console-page-ask.mjs | 1 + src/web-console/public/screens/ask.js | 19 +++++++++++++++++-- src/web-console/public/styles/shell.css | 2 ++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6cce8d9..d7b4c14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to Plan2Code will be documented in this file. - **desktop app**: the agent setup page's **Back** button now sits in the app's top bar instead of floating over the page, where it covered the settings and help icons. - **web console**: the agent setup page's middle pane now scrolls, so the agent options below the fold (the rest of the list and the templates) can be reached. The list used to be cut off with no scrollbar. - **web console**: the **Install page** link on the agent setup page now opens in your default browser inside the desktop app. It did nothing there, because the page was not told it was running in the app. +- **web console**: a note you have sent now shows a small spinner in front of "Sent, waiting for Plan2Code" in the Notes panel, so it is clear Plan2Code is still working on it. The spinner hides when the agent has gone quiet, so a dead session is not mistaken for a slow one. ## v3.0.3 diff --git a/scripts/test-web-console-page-ask.mjs b/scripts/test-web-console-page-ask.mjs index cf70f61..b7d8553 100644 --- a/scripts/test-web-console-page-ask.mjs +++ b/scripts/test-web-console-page-ask.mjs @@ -433,6 +433,7 @@ test("a request for suggestions shows tagged and waiting, and the chip comes bac const mine = s.page.locator("#aside .msg.you.pending"); await mine.locator(".suggest-tag", { hasText: "Asked for suggestions" }).waitFor(); assert.match(await textOf(mine), /Sent, waiting for Plan2Code/i); + assert.equal(await mine.locator(".msg-who .sent-wait .spinner").count(), 1, "a pending note shows the ring"); await s.page.waitForFunction(() => document.getElementById("suggest-c1")?.disabled); s.post({ items: [{ id: "c1", thread: [{ who: "agent", text: "I would pick JSON: your scripts read it directly." }] }], agent: { status: "waiting" } }); diff --git a/src/web-console/public/screens/ask.js b/src/web-console/public/screens/ask.js index 9d47147..ea13de4 100644 --- a/src/web-console/public/screens/ask.js +++ b/src/web-console/public/screens/ask.js @@ -678,7 +678,7 @@ export function renderAside() { const box = el("div", "msg" + (mine ? " you" : "") + (pending ? " pending" : "")); const who = el("div", "msg-who"); who.appendChild(el("span", null, mine ? "You" : "Plan2Code")); - if (pending) who.appendChild(el("span", null, "Sent, waiting for Plan2Code")); + if (pending) who.appendChild(sentWaitingTag()); else if (m.at) who.appendChild(el("span", null, shortTime(m.at))); box.appendChild(who); if (m.suggest === true) box.appendChild(suggestTag()); @@ -693,7 +693,7 @@ export function renderAside() { const box = el("div", "msg you pending"); const who = el("div", "msg-who"); who.appendChild(el("span", null, "You")); - who.appendChild(el("span", null, "Sent, waiting for Plan2Code")); + who.appendChild(sentWaitingTag()); box.appendChild(who); if (waiting.suggest === true) box.appendChild(suggestTag()); if (waiting.text) box.appendChild(md(waiting.text, "md")); @@ -771,6 +771,21 @@ function suggestChip(item) { return chip; } +// The label on a note that is sent and not yet picked up, with the page's small +// ring in front so it is plain Plan2Code is still on it. Like the Ask reply +// line, no ring once the agent has gone quiet: a turning ring would pass a +// dead session for a slow one. +function sentWaitingTag() { + const tag = el("span", "sent-wait"); + if (askState().send.state !== "offline" && !agentAdrift()) { + const spin = el("span", "spinner tiny"); + spin.setAttribute("aria-hidden", "true"); + tag.appendChild(spin); + } + tag.appendChild(el("span", null, "Sent, waiting for Plan2Code")); + return tag; +} + function suggestTag() { return el("span", "pill suggest-tag", "Asked for suggestions"); } diff --git a/src/web-console/public/styles/shell.css b/src/web-console/public/styles/shell.css index 067796f..4bb90e9 100644 --- a/src/web-console/public/styles/shell.css +++ b/src/web-console/public/styles/shell.css @@ -414,6 +414,8 @@ h1 { color: var(--ink-3); margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; } +.msg-who .sent-wait { display: inline-flex; align-items: center; gap: 6px; } + .aside-empty { color: var(--ink-3); font-size: 13px; font-style: italic; } /* The note box takes whatever height the panel has left, never under 160px.