Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(desktop): let LAN WebUI taps through the closed action sheet
vastsae20ec77ea3cb
diff --git a/apps/desktop/resources/lan-webui/styles.css b/apps/desktop/resources/lan-webui/styles.cssindex 34aaed278..f816656f5 100644--- a/apps/desktop/resources/lan-webui/styles.css+++ b/apps/desktop/resources/lan-webui/styles.css@@ -67,7 +67,8 @@ label { display: block; font-weight: 600; margin: 12px 0 6px; }.composer textarea { flex: 1; resize: none; max-height: 40vh; }.composer .actions { display: flex; flex-direction: column; gap: 6px; }.toast { position: fixed; left: 12px; right: 12px; bottom: calc(88px + env(safe-area-inset-bottom)); margin: 0 auto; max-width: 520px; padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); z-index: 5; }-.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 6; }+/* An author display rule would override the browser's default hidden display. */+.sheet:not([hidden]) { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 6; }.sheet-panel { width: 100%; max-width: 520px; background: var(--surface); border-radius: 16px 16px 0 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }.sheet-title { font-size: 16px; margin: 4px 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.sheet-actions { display: flex; flex-direction: column; gap: 8px; }diff --git a/apps/desktop/test/lan-webui-browser-user-path.test.mjs b/apps/desktop/test/lan-webui-browser-user-path.test.mjsindex e5fb2ecda..c3da6d34e 100644--- a/apps/desktop/test/lan-webui-browser-user-path.test.mjs+++ b/apps/desktop/test/lan-webui-browser-user-path.test.mjs@@ -33,6 +33,14 @@ const journey = String.raw`(async () => {throw new Error("timed out waiting for " + label);};const rowByTitle = (title) => [...document.querySelectorAll(".row")].find((row) => row.querySelector(".row-title")?.textContent === title);+ // A direct control.click() bypasses hit testing and misses full-page interceptors.+ const tap = (control) => {+ control.scrollIntoView({ block: "center" });+ const bounds = control.getBoundingClientRect();+ const hit = document.elementFromPoint(bounds.left + bounds.width / 2, bounds.top + bounds.height / 2);+ if (!hit || !control.contains(hit)) throw new Error("Pointer blocked by " + (hit?.id || hit?.className || "no target"));+ hit.click();+ };const result = {};// Pair with the code shown on Desktop.@@ -40,42 +48,48 @@ const journey = String.raw`(async () => {code.value = "123";const form = document.querySelector(".pair");const submit = form.querySelector("button[type=submit]");- submit.click();+ tap(submit);await wait(() => /six digits|六位数字/.test(document.getElementById("pair-status").textContent), "client input validation");code.value = Array.from(window.__code, (digit) => String.fromCharCode(digit.charCodeAt(0) + 0xfee0)).join(" ");- submit.click();+ tap(submit);form.dispatchEvent(new Event("submit", { bubbles: true, cancelable: true }));// Redeeming the code connects immediately, without a second Desktop action.await wait(() => rowByTitle("Alpha"), "projects");result.projects = [...document.querySelectorAll(".row-title")].map((n) => n.textContent);const temporary = await wait(() => rowByTitle("Temporary conversations") ?? rowByTitle("临时会话"), "temporary entry");- temporary.querySelector(".row-main").click();+ tap(temporary.querySelector(".row-main"));await wait(() => rowByTitle("Scratch") && document.querySelector("main > button.primary"), "temporary conversations");history.back();await wait(() => rowByTitle("Alpha"), "back to projects");// Open a project and see its sessions.- rowByTitle("Alpha").querySelector(".row-main").click();+ tap(rowByTitle("Alpha").querySelector(".row-main"));await wait(() => rowByTitle("Fix login"), "sessions");result.sessions = [...document.querySelectorAll(".row-title")].map((n) => n.textContent);result.projectHash = location.hash;result.strayText = [document.getElementById("app").innerText];// Organize from the row menu: pin.- rowByTitle("Fix login").querySelector(".row-more").click();+ tap(rowByTitle("Fix login").querySelector(".row-more"));await wait(() => !document.getElementById("sheet").hidden, "sheet");- document.querySelectorAll("#sheet-actions button")[1].click();+ tap(document.querySelectorAll("#sheet-actions button")[1]);await wait(() => rowByTitle("Fix login")?.querySelector(".row-meta"), "pinned meta");result.pinnedMeta = rowByTitle("Fix login").querySelector(".row-meta").textContent;+ // Closing the menu must let the next tap reach an existing conversation.+ tap(rowByTitle("Fix login").querySelector(".row-main"));+ await wait(() => document.querySelector(".msg.user")?.textContent.includes("hello"), "existing transcript");+ history.back();+ await wait(() => rowByTitle("Fix login"), "back from existing transcript");+// Create a new conversation in this project and send a message.- document.querySelector("main > button.primary").click();+ tap(document.querySelector("main > button.primary"));const input = await wait(() => document.getElementById("composer-input"), "composer");result.chatHash = location.hash;input.value = "hello from phone";input.dispatchEvent(new Event("input"));- document.querySelector(".composer button.primary").click();+ tap(document.querySelector(".composer button.primary"));await wait(() => document.querySelectorAll(".msg").length >= 2 && input.isConnected === false || document.getElementById("composer-input")?.value === "", "sent");result.messages = [...document.querySelectorAll(".msg")].map((n) => n.className.split(" ")[1]);result.leaked = document.body.textContent.includes("/secret/path");@@ -91,7 +105,7 @@ const journey = String.raw`(async () => {result.backHash = location.hash;history.back();await wait(() => rowByTitle("Alpha"), "back to projects before sign-out");- document.querySelector("main > button.link").click();+ tap(document.querySelector("main > button.link"));await wait(() => document.getElementById("pair-code"), "sign-out returns to pairing");result.polledApproval = performance.getEntriesByType("resource").some((entry) => new URL(entry.name).pathname === "/pair/status");result.pairRequests = performance.getEntriesByType("resource").filter((entry) => new URL(entry.name).pathname === "/pair").length;diff --git a/docs/spec/06-delivery/e2e/live-and-remote.md b/docs/spec/06-delivery/e2e/live-and-remote.mdindex ddd4ff458..19e762e9f 100644--- a/docs/spec/06-delivery/e2e/live-and-remote.md+++ b/docs/spec/06-delivery/e2e/live-and-remote.md@@ -780,13 +780,16 @@ user's running instance.- **Preconditions:** Desktop is editing an unsent draft in A. The phone ispaired. B is a closed multi-root group with existing sessions, one separatelyarchived. Seed a duplicate display name.-- **Steps:** Search for B, open it, pin and rename it; rename/pin/archive/restore- an idle session. Archive and restore B through the archived filter. Make a- competing rename from Desktop and submit the stale edit from the phone.+- **Steps:** Search for B and tap its row. Open a session's action menu, close it,+ then tap that session to read its history. Pin and rename B and rename, pin,+ archive and restore an idle session. Archive and restore B through the+ archived filter. Make a competing Desktop rename and submit the stale edit.- **Expected:** One row per group, stable IDs, correct filtered/recent/pinnedlists; both clients show committed changes without reloading. Archive is notdeletion and does not cascade; restoring B preserves the separately archivedsession. A stale writer sees the latest value instead of overwriting it.+ A closed action menu does not cover the page or intercept taps; test row and+ menu actions with browser hit testing, not direct calls to the controls.Desktop stays in A with draft, focus and scroll intact. Repeating the archiveagainst a busy target fails without stopping work.- **Acceptance:** C, D; W02, W03, W05.