Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
feat(desktop): align the LAN WebUI phone page with the Desktop design system
vastsab8f16e810cdd
diff --git a/apps/desktop/resources/lan-webui/app.js b/apps/desktop/resources/lan-webui/app.jsindex 0765ab097..b7d1b91fb 100644--- a/apps/desktop/resources/lan-webui/app.js+++ b/apps/desktop/resources/lan-webui/app.js@@ -15,6 +15,7 @@const app = document.getElementById("app");const toast = document.getElementById("toast");const offline = document.getElementById("offline");+ const announcer = document.getElementById("announcer");const sheet = document.getElementById("sheet");const state = {@@ -26,7 +27,12 @@refreshTimer: null,renderToken: 0,sending: false,+ syncComposer: null,+ // Scroll offsets per list route, restored when the browser goes back.+ scroll: new Map(),+ forward: false,};+ if ("scrollRestoration" in history) history.scrollRestoration = "manual";// ---------- helpers ----------function el(tag, props = {}, children = []) {@@ -42,8 +48,67 @@for (const child of [].concat(children)) if (child) node.append(child);return node;}++ // Lucide outlines (ISC) on a 24px grid — the icon set Desktop ships.+ const SVG_NS = "http://www.w3.org/2000/svg";+ const ICONS = {+ back: [["path", { d: "m15 18-6-6 6-6" }]],+ more: [["circle", { cx: 12, cy: 12, r: 1 }], ["circle", { cx: 19, cy: 12, r: 1 }], ["circle", { cx: 5, cy: 12, r: 1 }]],+ close: [["path", { d: "M18 6 6 18" }], ["path", { d: "m6 6 12 12" }]],+ search: [["circle", { cx: 11, cy: 11, r: 8 }], ["path", { d: "m21 21-4.3-4.3" }]],+ check: [["path", { d: "M20 6 9 17l-5-5" }]],+ send: [["path", { d: "m5 12 7-7 7 7" }], ["path", { d: "M12 19V5" }]],+ stop: [["rect", { x: 6, y: 6, width: 12, height: 12, rx: 2 }]],+ folder: [["path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }]],+ temporary: [["circle", { cx: 12, cy: 12, r: 10 }], ["path", { d: "M12 6v6l4 2" }]],+ chat: [["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }]],+ newChat: [["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }], ["path", { d: "M12 7v6" }], ["path", { d: "M9 10h6" }]],+ pin: [["path", { d: "M12 17v5" }], ["path", { d: "M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z" }]],+ unpin: [["path", { d: "M12 17v5" }], ["path", { d: "M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89" }], ["path", { d: "m2 2 20 20" }], ["path", { d: "M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11" }]],+ pencil: [["path", { d: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z" }], ["path", { d: "m15 5 4 4" }]],+ archive: [["rect", { width: 20, height: 5, x: 2, y: 3, rx: 1 }], ["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8" }], ["path", { d: "M10 12h4" }]],+ restore: [["rect", { width: 20, height: 5, x: 2, y: 3, rx: 1 }], ["path", { d: "M4 8v11a2 2 0 0 0 2 2h2" }], ["path", { d: "M20 8v11a2 2 0 0 1-2 2h-2" }], ["path", { d: "m9 15 3-3 3 3" }], ["path", { d: "M12 12v9" }]],+ laptop: [["path", { d: "M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16" }]],+ tool: [["path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" }]],+ logout: [["path", { d: "m16 17 5-5-5-5" }], ["path", { d: "M21 12H9" }], ["path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }]],+ pair: [["path", { d: "M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8" }], ["path", { d: "M10 19v-3.96 3.15" }], ["path", { d: "M7 19h5" }], ["rect", { width: 6, height: 10, x: 16, y: 12, rx: 2 }]],+ };+ function icon(name, size = "") {+ const svg = document.createElementNS(SVG_NS, "svg");+ svg.setAttribute("viewBox", "0 0 24 24");+ svg.setAttribute("class", size ? `icon ${size}` : "icon");+ svg.setAttribute("aria-hidden", "true");+ svg.setAttribute("focusable", "false");+ for (const [tag, attrs] of ICONS[name]) {+ const node = document.createElementNS(SVG_NS, tag);+ for (const [key, value] of Object.entries(attrs)) node.setAttribute(key, String(value));+ svg.append(node);+ }+ return svg;+ }+// DOM replaceChildren() turns null into the text "null"; drop empty slots first.- const show = (...nodes) => app.replaceChildren(...nodes.filter(Boolean));+ // Re-rendering the same view keeps the focused field, its caret and its draft.+ function show(view, ...nodes) {+ const same = app.dataset.view === view;+ const active = document.activeElement;+ const keep = same && active instanceof HTMLElement && active.id && app.contains(active) ? active.id : "";+ const range = keep && typeof active.selectionStart === "number" ? [active.selectionStart, active.selectionEnd] : null;+ app.replaceChildren(...nodes.filter(Boolean));+ app.dataset.view = view;+ const next = keep ? document.getElementById(keep) : null;+ if (next) {+ next.focus({ preventScroll: true });+ if (range && typeof next.setSelectionRange === "function") {+ try {+ next.setSelectionRange(range[0], range[1]);+ } catch {+ // Some input types do not expose a selection.+ }+ }+ }+ return !same;+ }let toastTimer = null;function notify(message) {toast.textContent = message;@@ -51,8 +116,33 @@clearTimeout(toastTimer);toastTimer = setTimeout(() => (toast.hidden = true), 4000);}+ const announce = (message) => {+ if (message) announcer.textContent = message;+ };+ function setOffline(lost) {+ if (lost) offline.replaceChildren(el("span", { class: "dot offline" }), el("span", { text: t("offline") }));+ offline.hidden = !lost;+ }const newKey = () => (crypto.randomUUID ? crypto.randomUUID() : `${Date.now()}-${Math.random().toString(36).slice(2)}`).replace(/[^A-Za-z0-9_-]/g, "");+ const clock = {+ time: new Intl.DateTimeFormat(lang, { hour: "numeric", minute: "2-digit" }),+ weekday: new Intl.DateTimeFormat(lang, { weekday: "short" }),+ day: new Intl.DateTimeFormat(lang, { month: "short", day: "numeric" }),+ full: new Intl.DateTimeFormat(lang, { year: "numeric", month: "short", day: "numeric" }),+ };+ /** Compact last-activity label, like the Desktop sidebar: time, weekday or date. */+ function when(value) {+ const date = value ? new Date(value) : null;+ if (!date || Number.isNaN(date.getTime())) return "";+ const now = new Date();+ const today = new Date(now.getFullYear(), now.getMonth(), now.getDate()).getTime();+ if (date.getTime() >= today) return clock.time.format(date);+ if (date.getTime() >= today - 6 * 86_400_000) return clock.weekday.format(date);+ if (date.getFullYear() === now.getFullYear()) return clock.day.format(date);+ return clock.full.format(date);+ }+class ApiError extends Error {constructor(status, code) {super(code);@@ -106,18 +196,25 @@if (kind === "s" && id) return { view: "chat", sessionId: id };return { view: "projects" };}+ const routeKey = (hash) => (hash && hash !== "#" ? hash : "#/projects");const go = (hash) => {if (location.hash === hash) render();- else location.hash = hash;+ else {+ state.forward = true;+ location.hash = hash;+ }};- window.addEventListener("hashchange", () => {+ window.addEventListener("hashchange", (event) => {const prefill = takePairingCode();if (prefill && !state.me) {showPair("", prefill);return;}+ state.scroll.set(routeKey(new URL(event.oldURL).hash), window.scrollY);+ const restoreScroll = !state.forward;+ state.forward = false;state.route = parseRoute();- render();+ render({ restoreScroll });});// ---------- events ----------@@ -131,16 +228,13 @@const me = await api("GET", "/v1/me");if (state.events !== source) return;state.me = me;- offline.hidden = true;+ setOffline(false);scheduleRefresh();} catch (error) {if (state.events === source) fail(error);}});- source.addEventListener("error", () => {- offline.textContent = t("offline");- offline.hidden = false;- });+ source.addEventListener("error", () => setOffline(true));source.addEventListener("change", (event) => {let data = {};try {@@ -170,59 +264,146 @@});// ---------- sheet ----------- function openSheet(title, actions) {- const list = document.getElementById("sheet-actions");+ let sheetReturn = null;+ function presentSheet(title, children, opener) {+ if (opener) sheetReturn = opener;document.getElementById("sheet-title").textContent = title;- list.replaceChildren(- ...actions.map((action) => el("button", { type: "button", class: action.danger ? "danger" : "", text: action.label, onclick: () => { closeSheet(); action.run(); } })),- el("button", { type: "button", text: t("cancel"), onclick: closeSheet }),- );+ document.getElementById("sheet-actions").replaceChildren(...children);sheet.hidden = false;- list.querySelector("button")?.focus();}- function closeSheet() {+ function openSheet(title, actions, opener) {+ presentSheet(title, [+ ...actions.map((action) => el("button", {+ type: "button",+ class: action.danger ? "danger" : "",+ onclick: () => { closeSheet(false); action.run(); },+ }, [icon(action.icon), el("span", { text: action.label })])),+ el("button", { type: "button", class: "cancel", text: t("cancel"), onclick: () => closeSheet() }),+ ], opener || document.activeElement);+ document.querySelector("#sheet-actions button")?.focus();+ }+ function closeSheet(restoreFocus = true) {sheet.hidden = true;+ if (!restoreFocus) return;+ if (sheetReturn?.isConnected) sheetReturn.focus({ preventScroll: true });+ sheetReturn = null;}sheet.addEventListener("click", (event) => { if (event.target === sheet) closeSheet(); });document.addEventListener("keydown", (event) => { if (event.key === "Escape" && !sheet.hidden) closeSheet(); });- function organizeActions(kind, item) {+ function organize(kind, item, patch) {const path = `/v1/${kind}/${encodeURIComponent(item.id)}/organize`;- const send = (patch) => api("POST", path, { revision: item.revision, ...patch }, newKey()).then(() => render({ refresh: true }), (error) => { fail(error); render({ refresh: true }); });+ return api("POST", path, { revision: item.revision, ...patch }, newKey())+ .then(() => render({ refresh: true }), (error) => { fail(error); render({ refresh: true }); });+ }++ function openRename(kind, item, current) {+ const input = el("input", { id: "rename-input", value: current, "aria-label": t("renamePrompt"), enterkeyhint: "done", autocomplete: "off" });+ const form = el("form", { class: "sheet-form" }, [+ input,+ el("div", { class: "sheet-buttons" }, [+ el("button", { type: "button", class: "secondary", text: t("cancel"), onclick: () => closeSheet() }),+ el("button", { type: "submit", class: "primary", text: t("save") }),+ ]),+ ]);+ form.addEventListener("submit", (event) => {+ event.preventDefault();+ const name = input.value.trim();+ closeSheet();+ if (name && name !== current) void organize(kind, item, { name });+ });+ presentSheet(t("rename"), [form]);+ input.focus();+ input.select();+ }++ function organizeActions(kind, item) {const label = kind === "projects" ? item.label : item.title || t("untitled");return [- { label: t("rename"), run: () => { const name = window.prompt(t("renamePrompt"), label); if (name && name.trim() && name.trim() !== label) send({ name: name.trim() }); } },- { label: item.pinned ? t("unpin") : t("pin"), run: () => send({ pinned: !item.pinned }) },- { label: item.archived ? t("restore") : t("archive"), danger: !item.archived, run: () => send({ archived: !item.archived }) },+ { icon: "pencil", label: t("rename"), run: () => openRename(kind, item, label) },+ { icon: item.pinned ? "unpin" : "pin", label: item.pinned ? t("unpin") : t("pin"), run: () => void organize(kind, item, { pinned: !item.pinned }) },+ { icon: item.archived ? "restore" : "archive", label: item.archived ? t("restore") : t("archive"), danger: !item.archived, run: () => void organize(kind, item, { archived: !item.archived }) },];}// ---------- views ----------- function header(title, back) {- return el("header", { class: "header" }, [- back ? el("button", { type: "button", "aria-label": t("back"), text: "‹", onclick: () => (history.length > 1 ? history.back() : go(back)) }) : null,- el("h1", { text: title }),+ /** One status/flag entry: a dot or a small icon, always with its text. */+ function metaItem(entry) {+ return el("span", { class: "meta-item" }, [+ entry.dot ? el("span", { class: `dot ${entry.dot}` }) : entry.icon ? icon(entry.icon, "xs") : null,+ el("span", { class: "meta-text", text: entry.text }),]);}+ function flags(item) {+ return [+ item.pinned ? { icon: "pin", text: t("pinned") } : null,+ item.archived ? { icon: "archive", text: t("archived") } : null,+ ].filter(Boolean);+ }+ function sessionStatus(status) {+ if (status === "running") return { dot: "running", text: t("running") };+ if (status === "waiting") return { dot: "waiting", text: t("waiting") };+ return null;+ }- function toolbar(onSearch, filters) {- const search = el("input", { type: "search", placeholder: t("search"), "aria-label": t("search"), value: filters.q });+ function header({ title, back, subtitle = [], actions = [], root = false }) {+ return el("header", { class: root ? "header root" : "header" }, [+ back+ ? el("button", { type: "button", class: "icon-btn", "aria-label": t("back"), onclick: () => (history.length > 1 ? history.back() : go(back)) }, icon("back"))+ : null,+ el("div", { class: "header-title" }, [+ el("h1", { id: "view-title", tabindex: "-1", text: title }),+ subtitle.length ? el("p", { class: "header-sub" }, subtitle.map(metaItem)) : null,+ ]),+ ...actions,+ ]);+ }+ const moreButton = (name, actions) => el("button", {+ type: "button",+ class: "icon-btn",+ "aria-label": t("more", { name }),+ "aria-haspopup": "dialog",+ onclick: (event) => openSheet(name, actions, event.currentTarget),+ }, icon("more"));++ function toolbar(filters, onChange) {+ const search = el("input", {+ id: "list-search", type: "search", placeholder: t("search"), "aria-label": t("search"),+ value: filters.q, enterkeyhint: "search", autocomplete: "off",+ });let timer = null;- search.addEventListener("input", () => { clearTimeout(timer); timer = setTimeout(() => onSearch({ q: search.value }), 250); });- const archived = el("input", { type: "checkbox", checked: filters.archived });- archived.addEventListener("change", () => onSearch({ archived: archived.checked }));- return el("div", { class: "toolbar" }, [search, el("label", { class: "toggle" }, [archived, document.createTextNode(t("showArchived"))])]);+ search.addEventListener("input", () => {+ // Keep the latest text in the filter so a re-render never drops keystrokes.+ filters.q = search.value;+ clearTimeout(timer);+ timer = setTimeout(onChange, 250);+ });+ const archived = el("button", {+ id: "filter-archived",+ type: "button",+ class: "chip",+ "aria-pressed": filters.archived ? "true" : "false",+ onclick: () => { filters.archived = !filters.archived; onChange(); },+ }, [icon(filters.archived ? "check" : "archive", "sm"), el("span", { text: t("showArchived") })]);+ return el("div", { class: "toolbar" }, [el("div", { class: "search" }, [icon("search", "sm"), search]), archived]);}- function row({ title, meta, onOpen, actions, moreLabel }) {+ function row({ icon: iconName, title, meta = [], time = "", onOpen, actions = [], moreLabel }) {return el("li", { class: "row" }, [el("button", { type: "button", class: "row-main", onclick: onOpen }, [- el("span", { class: "row-title", text: title }),- meta.length ? el("span", { class: "row-meta" }, meta.map((text) => el("span", { text }))) : null,+ iconName ? el("span", { class: "row-icon" }, icon(iconName)) : null,+ el("span", { class: "row-text" }, [+ el("span", { class: "row-title", text: title }),+ meta.length ? el("span", { class: "row-meta" }, meta.map(metaItem)) : null,+ ]),+ time ? el("span", { class: "row-time", text: time }) : null,]),- actions.length ? el("button", { type: "button", class: "row-more", "aria-label": moreLabel, text: "⋯", onclick: () => openSheet(title, actions) }) : null,+ actions.length+ ? el("button", { type: "button", class: "row-more icon-btn", "aria-label": moreLabel, "aria-haspopup": "dialog", onclick: (event) => openSheet(title, actions, event.currentTarget) }, icon("more"))+ : null,]);}+ const emptyState = (text, iconName) => el("div", { class: "empty" }, [icon(iconName, "lg"), el("p", { text })]);const listFilters = { projects: { q: "", archived: false }, sessions: { q: "", archived: false } };@@ -242,28 +423,28 @@const filters = listFilters.projects;const query = `?q=${encodeURIComponent(filters.q)}${filters.archived ? "&archived=1" : ""}`;const items = await loadAll(`/v1/projects${query}`);- if (token !== state.renderToken) return;+ if (token !== state.renderToken) return undefined;for (const item of items) state.projects.set(item.id, item.label);- const list = el("ul", { class: "list" });- if (!filters.archived && !filters.q) {- list.append(row({ title: t("temporary"), meta: [], actions: [], onOpen: () => go(`#/p/${TEMP}`) }));- }- for (const item of items) {- list.append(row({- title: item.label,- meta: [item.pinned ? t("pinned") : "", item.archived ? t("archived") : ""].filter(Boolean),- onOpen: () => go(`#/p/${encodeURIComponent(item.id)}`),- actions: organizeActions("projects", item),- moreLabel: t("more", { name: item.label }),- }));- }- const empty = !list.children.length ? el("p", { class: "empty", text: filters.q ? t("noMatches") : t("noProjects") }) : null;- show(- header(t("projects")),- toolbar((patch) => { Object.assign(filters, patch); render(); }, filters),+ const temporary = !filters.archived && !filters.q+ ? el("ul", { class: "list group" }, row({ icon: "temporary", title: t("temporary"), onOpen: () => go(`#/p/${TEMP}`) }))+ : null;+ const list = items.length+ ? el("ul", { class: "list" }, items.map((item) => row({+ icon: "folder",+ title: item.label,+ meta: flags(item),+ onOpen: () => go(`#/p/${encodeURIComponent(item.id)}`),+ actions: organizeActions("projects", item),+ moreLabel: t("more", { name: item.label }),+ })))+ : emptyState(filters.q ? t("noMatches") : t("noProjects"), filters.q ? "search" : "folder");+ return show(+ "projects",+ header({ title: t("projects"), root: true }),+ toolbar(filters, () => render()),+ temporary,list,- empty,- el("button", { type: "button", class: "link", text: t("signOut"), onclick: signOut }),+ el("button", { type: "button", class: "link signout", onclick: signOut }, [icon("logout", "sm"), el("span", { text: t("signOut") })]),);}@@ -271,23 +452,21 @@const filters = listFilters.sessions;const query = `?projectId=${encodeURIComponent(projectId)}&q=${encodeURIComponent(filters.q)}${filters.archived ? "&archived=1" : ""}`;const items = await loadAll(`/v1/sessions${query}`);- if (token !== state.renderToken) return;+ if (token !== state.renderToken) return undefined;const title = projectId === TEMP ? t("temporary") : state.projects.get(projectId) || t("projects");- const list = el("ul", { class: "list" });- for (const item of items) {- const status = item.status === "running" ? t("running") : item.status === "waiting" ? t("waiting") : "";- list.append(row({- title: item.title || t("untitled"),- meta: [status, item.pinned ? t("pinned") : "", item.archived ? t("archived") : "", item.readOnly ? t("readOnly") : ""].filter(Boolean),- onOpen: () => go(`#/s/${encodeURIComponent(item.id)}`),- actions: organizeActions("sessions", item),- moreLabel: t("more", { name: item.title || t("untitled") }),- }));- }+ const list = items.length+ ? el("ul", { class: "list" }, items.map((item) => row({+ title: item.title || t("untitled"),+ meta: [sessionStatus(item.status), ...flags(item), item.readOnly ? { icon: "laptop", text: t("readOnly") } : null].filter(Boolean),+ time: when(item.updatedAt),+ onOpen: () => go(`#/s/${encodeURIComponent(item.id)}`),+ actions: organizeActions("sessions", item),+ moreLabel: t("more", { name: item.title || t("untitled") }),+ })))+ : emptyState(filters.q ? t("noMatches") : t("noSessions"), filters.q ? "search" : "chat");const create = el("button", {type: "button",- class: "primary",- text: t("newSession"),+ class: "primary fab",onclick: async (event) => {const button = event.currentTarget;button.disabled = true;@@ -299,30 +478,41 @@button.disabled = false;}},- });- show(- header(title, "#/projects"),- toolbar((patch) => { Object.assign(filters, patch); render(); }, filters),+ }, [icon("newChat"), el("span", { text: t("newSession") })]);+ return show(+ `sessions:${projectId}`,+ header({ title, back: "#/projects" }),+ toolbar(filters, () => render()),create,list,- !items.length ? el("p", { class: "empty", text: filters.q ? t("noMatches") : t("noSessions") }) : null,+ el("div", { class: "fab-spacer", "aria-hidden": "true" }),);}const roleLabel = { user: "you", assistant: "assistant", tool: "tool" };function message(item, extraClass = "") {- return el("div", { class: `msg ${item.role} ${extraClass}` }, [- el("span", { class: "msg-role", text: t(roleLabel[item.role] || "assistant") }),- document.createTextNode(item.text),+ const role = roleLabel[item.role] ? item.role : "assistant";+ const body = [el("span", { class: "sr-only", text: `${t(roleLabel[role])}: ` })];+ if (role === "tool") body.push(icon("tool", "sm"), el("span", { text: item.text }));+ else body.push(document.createTextNode(item.text));+ return el("div", { class: extraClass ? `msg ${role} ${extraClass}` : `msg ${role}` }, body);+ }++ function notice({ dot, icon: iconName, text, action }) {+ return el("div", { class: "notice" }, [+ dot ? el("span", { class: `dot ${dot}` }) : icon(iconName, "sm"),+ el("span", { class: "notice-text", text }),+ action ? el("button", { type: "button", class: "secondary", text: action.label, onclick: action.run }) : null,]);}- const chatState = { sessionId: null, older: [], olderCursor: undefined };+ const chatState = { sessionId: null, older: [], olderCursor: undefined, phase: null };+ const phaseText = { running: "running", "waiting-approval": "waitingApproval", "waiting-input": "waitingInput", idle: "replyDone" };async function renderChat(token, sessionId, refresh) {- if (chatState.sessionId !== sessionId) Object.assign(chatState, { sessionId, older: [], olderCursor: undefined });+ if (chatState.sessionId !== sessionId) Object.assign(chatState, { sessionId, older: [], olderCursor: undefined, phase: null });const conversation = await api("GET", `/v1/sessions/${encodeURIComponent(sessionId)}`);- if (token !== state.renderToken) return;+ if (token !== state.renderToken) return undefined;const { session } = conversation;const nextCursor = chatState.olderCursor === undefined ? conversation.messages.nextCursor : chatState.olderCursor;const scroller = document.scrollingElement;@@ -332,7 +522,7 @@if (nextCursor) {messages.append(el("button", {type: "button",- class: "link",+ class: "link load-older",text: t("loadOlder"),onclick: async () => {try {@@ -356,47 +546,69 @@}if (conversation.liveText) messages.append(message({ role: "assistant", text: conversation.liveText }, "live"));+ // Announce actionable state changes, not every streamed token.+ const phase = conversation.waiting ? `waiting-${conversation.waiting}` : conversation.activeTurnId ? "running" : "idle";+ if (chatState.phase && chatState.phase !== phase) announce(t(phaseText[phase]));+ chatState.phase = phase;+const notices = [];- if (conversation.waiting === "approval") notices.push(el("p", { class: "banner", role: "status", text: t("waitingApproval") }));- if (conversation.waiting === "input") notices.push(el("p", { class: "banner", role: "status", text: t("waitingInput") }));- if (session.archived) notices.push(el("p", { class: "banner", text: t("archivedSession") }));- if (session.readOnly) notices.push(el("p", { class: "banner", text: t("readOnlySession") }));+ if (conversation.waiting === "approval") notices.push(notice({ dot: "waiting", text: t("waitingApproval") }));+ if (conversation.waiting === "input") notices.push(notice({ dot: "waiting", text: t("waitingInput") }));+ if (session.archived) {+ notices.push(notice({ icon: "archive", text: t("archivedSession"), action: { label: t("restore"), run: () => void organize("sessions", session, { archived: false }) } }));+ }+ if (session.readOnly) notices.push(notice({ icon: "laptop", text: t("readOnlySession") }));const queue = conversation.queue.length- ? el("div", { class: "queue" }, conversation.queue.map((entry) => el("div", { class: "row" }, [- el("span", { class: "row-main" }, [el("span", { class: "row-meta", text: t("queued") }), el("span", { class: "row-title", text: entry.text })]),- el("button", { type: "button", "aria-label": t("cancelQueued"), text: "×", onclick: () => api("POST", `/v1/turns/${encodeURIComponent(entry.id)}:cancel`, { sessionId }, newKey()).then(() => render({ refresh: true }), fail) }),+ ? el("div", { class: "queue" }, conversation.queue.map((entry) => el("div", { class: "queue-item" }, [+ el("span", { class: "queue-text" }, [el("span", { class: "queue-label", text: t("queued") }), el("span", { class: "queue-body", text: entry.text })]),+ el("button", {+ type: "button",+ class: "icon-btn",+ "aria-label": t("cancelQueued"),+ onclick: () => api("POST", `/v1/turns/${encodeURIComponent(entry.id)}:cancel`, { sessionId }, newKey()).then(() => render({ refresh: true }), fail),+ }, icon("close", "sm")),]))): null;const canChat = !session.readOnly && !session.archived;const composer = canChat ? buildComposer(sessionId, conversation) : null;- const actions = organizeActions("sessions", session);- const head = header(session.title || t("untitled"), session.projectId ? `#/p/${encodeURIComponent(session.projectId)}` : `#/p/${TEMP}`);- if (actions.length) head.append(el("button", { type: "button", "aria-label": t("more", { name: session.title || t("untitled") }), text: "⋯", onclick: () => openSheet(session.title || t("untitled"), actions) }));-- // Preserve focus and the unsent draft across live refreshes.- const focused = document.activeElement?.id === "composer-input";- const selection = focused ? [document.activeElement.selectionStart, document.activeElement.selectionEnd] : null;- show(head, conversation.modelLabel ? el("p", { class: "row-meta", text: conversation.modelLabel }) : null, messages, ...notices, queue, composer);- if (focused) {- const input = document.getElementById("composer-input");- input?.focus();- if (input && selection) input.setSelectionRange(selection[0], selection[1]);- }+ const title = session.title || t("untitled");+ const subtitle = [+ conversation.modelLabel ? { text: conversation.modelLabel } : null,+ sessionStatus(conversation.waiting ? "waiting" : conversation.activeTurnId ? "running" : session.status),+ ].filter(Boolean);+ const head = header({+ title,+ back: session.projectId ? `#/p/${encodeURIComponent(session.projectId)}` : `#/p/${TEMP}`,+ subtitle,+ actions: [moreButton(title, organizeActions("sessions", session))],+ });+ const dockItems = [...notices, queue, composer].filter(Boolean);+ const changed = show(`chat:${sessionId}`, head, messages, dockItems.length ? el("div", { class: "chat-dock" }, dockItems) : null);if (atBottom) scroller.scrollTop = scroller.scrollHeight;+ return changed;}function buildComposer(sessionId, conversation) {const running = Boolean(conversation.activeTurnId);- const input = el("textarea", { id: "composer-input", rows: "2", "aria-label": t("composer"), placeholder: t("composer"), enterkeyhint: "send" });+ const input = el("textarea", { id: "composer-input", rows: "1", "aria-label": t("composer"), placeholder: t("composer"), enterkeyhint: "send" });input.value = state.drafts.get(sessionId) || "";+ const send = el("button", {+ type: "button",+ class: running ? "primary send is-queue" : "primary send",+ "aria-label": running ? null : t("send"),+ onclick: () => void submit(running),+ }, running ? el("span", { text: t("queue") }) : icon("send"));+ const sync = () => { send.disabled = state.sending || !input.value.trim(); };+ state.syncComposer = sync;const fit = () => { input.style.height = "auto"; input.style.height = `${input.scrollHeight}px`; };- input.addEventListener("input", () => { state.drafts.set(sessionId, input.value); fit(); });+ input.addEventListener("input", () => { state.drafts.set(sessionId, input.value); fit(); sync(); });const submit = async (queue) => {const text = input.value.trim();if (!text || state.sending) return;state.sending = true;+ sync();try {await api("POST", `/v1/sessions/${encodeURIComponent(sessionId)}/turns`, { text, queue }, newKey());state.drafts.delete(sessionId);@@ -406,6 +618,7 @@fail(error);} finally {state.sending = false;+ state.syncComposer?.();}};input.addEventListener("keydown", (event) => {@@ -415,13 +628,19 @@void submit(running);});setTimeout(fit, 0);- const buttons = el("div", { class: "actions" }, [+ sync();+ const actions = el("div", { class: "actions" }, [running- ? el("button", { type: "button", text: t("stop"), onclick: () => api("POST", `/v1/turns/${encodeURIComponent(conversation.activeTurnId)}:interrupt`, { sessionId }, newKey()).then(() => render({ refresh: true }), fail) })+ ? el("button", {+ type: "button",+ class: "stop",+ "aria-label": t("stop"),+ onclick: () => api("POST", `/v1/turns/${encodeURIComponent(conversation.activeTurnId)}:interrupt`, { sessionId }, newKey()).then(() => render({ refresh: true }), fail),+ }, icon("stop")): null,- el("button", { type: "button", class: "primary", text: running ? t("queue") : t("send"), onclick: () => void submit(running) }),+ send,]);- return el("div", { class: "composer" }, [input, buttons]);+ return el("div", { class: "composer" }, [input, actions]);}async function render(options = {}) {@@ -429,9 +648,17 @@const token = ++state.renderToken;const route = state.route;try {- if (route.view === "projects") await renderProjects(token);- else if (route.view === "sessions") await renderSessions(token, route.projectId);- else await renderChat(token, route.sessionId, options.refresh === true);+ let changed;+ if (route.view === "projects") changed = await renderProjects(token);+ else if (route.view === "sessions") changed = await renderSessions(token, route.projectId);+ else changed = await renderChat(token, route.sessionId, options.refresh === true);+ if (changed === undefined) return;+ if (route.view !== "chat" && !options.refresh) {+ const saved = options.restoreScroll ? state.scroll.get(routeKey(location.hash)) : undefined;+ window.scrollTo(0, saved ?? 0);+ }+ // Move screen-reader focus to the new page title, never into a field.+ if (changed) document.getElementById("view-title")?.focus({ preventScroll: true });} catch (error) {if (token !== state.renderToken) return;if (error instanceof ApiError && error.code === "NOT_FOUND" && route.view !== "projects") {@@ -453,16 +680,18 @@function showPair(message, prefill = "") {closeEvents();+ setOffline(false);const code = el("input", {id: "pair-code", class: "code", inputmode: "numeric", autocomplete: "one-time-code",maxlength: "32", required: true, value: prefill, "aria-describedby": "pair-status",});- const label = el("input", { id: "pair-label", maxlength: "60", value: /iPhone|iPad|Android/.exec(navigator.userAgent)?.[0] || "Browser" });- const status = el("p", { id: "pair-status", class: "hint", role: "status", text: message || "" });+ const label = el("input", { id: "pair-label", maxlength: "60", autocomplete: "off", value: /iPhone|iPad|Android/.exec(navigator.userAgent)?.[0] || "Browser" });+ const status = el("p", { id: "pair-status", class: "pair-status", role: "status", text: message || "" });const submit = el("button", { type: "submit", class: "primary", text: t("pairSubmit") });const form = el("form", { class: "pair" }, [+ icon("pair", "lg"),el("h1", { text: t("pairTitle") }),- el("p", { text: t("pairHint") }),+ el("p", { class: "pair-hint", text: t("pairHint") }),el("label", { for: "pair-code", text: t("codeLabel") }), code,el("label", { for: "pair-label", text: t("deviceLabel") }), label,submit, status,@@ -493,7 +722,7 @@status.textContent = codeName === "PAIRING_CLOSED" ? t("pairClosed") : codeName === "PAIRING_FAILED" ? t("pairFailed") : errorText(codeName);}});- show(form);+ show("pair", form);if (prefill) submit.focus();else code.focus();}diff --git a/apps/desktop/resources/lan-webui/index.html b/apps/desktop/resources/lan-webui/index.htmlindex 1258181ad..aa2126aa6 100644--- a/apps/desktop/resources/lan-webui/index.html+++ b/apps/desktop/resources/lan-webui/index.html@@ -2,8 +2,10 @@<html lang="en"><head><meta charset="utf-8" />- <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />- <meta name="color-scheme" content="light dark" />+ <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content" />+ <meta name="color-scheme" content="dark light" />+ <meta name="theme-color" content="#181818" media="(prefers-color-scheme: dark)" />+ <meta name="theme-color" content="#ffffff" media="(prefers-color-scheme: light)" /><meta name="referrer" content="no-referrer" /><title>PI-Desktop</title><link rel="stylesheet" href="/styles.css" />@@ -11,8 +13,9 @@<script src="/app.js" defer></script></head><body>- <div id="offline" class="banner" role="status" hidden></div>- <main id="app" aria-live="polite"></main>+ <div id="offline" class="status-pill" role="status" hidden></div>+ <main id="app"></main>+ <div id="announcer" class="sr-only" role="status" aria-live="polite"></div><div id="toast" class="toast" role="alert" hidden></div><div id="sheet" class="sheet" hidden><div class="sheet-panel" role="dialog" aria-modal="true" aria-labelledby="sheet-title">diff --git a/apps/desktop/resources/lan-webui/locale.js b/apps/desktop/resources/lan-webui/locale.jsindex 23b8b5124..8648d81f3 100644--- a/apps/desktop/resources/lan-webui/locale.js+++ b/apps/desktop/resources/lan-webui/locale.js@@ -26,6 +26,7 @@ window.LAN_LOCALES = {more: "More actions for {name}",rename: "Rename",renamePrompt: "New name",+ save: "Save",pin: "Pin",unpin: "Unpin",archive: "Archive",@@ -45,6 +46,7 @@ window.LAN_LOCALES = {queue: "Queue",stop: "Stop",queued: "Queued",+ replyDone: "Reply finished",cancelQueued: "Cancel queued message",waitingApproval: "Waiting for approval on the computer.",waitingInput: "Input needed on the computer.",@@ -93,6 +95,7 @@ window.LAN_LOCALES = {more: "{name} 的更多操作",rename: "重命名",renamePrompt: "新名称",+ save: "保存",pin: "置顶",unpin: "取消置顶",archive: "归档",@@ -112,6 +115,7 @@ window.LAN_LOCALES = {queue: "排队",stop: "停止",queued: "排队中",+ replyDone: "回复已完成",cancelQueued: "取消排队消息",waitingApproval: "等待电脑上审批。",waitingInput: "需要在电脑上输入。",diff --git a/apps/desktop/resources/lan-webui/styles.css b/apps/desktop/resources/lan-webui/styles.cssindex f816656f5..e9a56afbf 100644--- a/apps/desktop/resources/lan-webui/styles.css+++ b/apps/desktop/resources/lan-webui/styles.css@@ -1,80 +1,1012 @@+/*+ LAN WebUI — the phone companion page.++ The visual system mirrors the Desktop renderer (apps/desktop/src/styles/+ tokens.css, docs/spec/04-ux/07-ui-design-system.md): a neutral monochrome+ palette with an inverted-ink accent, divider-free tonal tiles for in-flow+ structure, a hairline stroke plus shadow only on floating layers, Lucide+ icons, and the shared radius / type / motion ramps. The page is served on its+ own (CSP `style-src 'self'`), so the subset of tokens it needs is copied here+ under the same names; keep the values in step with tokens.css.++ Dark is the default, light follows the system preference — the same outcome+ as Desktop's "system" theme. Two phone-only deviations: form fields use+ --text-lg (16px) so iOS Safari does not zoom on focus, and every action keeps+ a 44 × 44 CSS px target (spec W07).+*/+:root {- --bg: #f7f7f8;- --surface: #ffffff;- --text: #17181a;- --muted: #5b5f66;- --border: #dcdee2;- --accent: #2563eb;- --on-accent: #ffffff;- --danger: #b42318;- --user: #e8efff;- --radius: 12px;+ color-scheme: dark;+ --ds-bg-primary: #181818;+ --ds-bg-elevated-opaque: #282828;+ --ds-bg-composer: color-mix(in oklab, #212121 96%, transparent);+ --ds-bg-hover: color-mix(in oklab, #ffffff 6%, transparent);+ --ds-bg-active: color-mix(in oklab, #ffffff 10%, transparent);+ --ds-text-primary: #ffffff;+ --ds-text-secondary: color-mix(in oklab, #ffffff 70%, transparent);+ --ds-text-muted: color-mix(in oklab, #ffffff 52%, transparent);+ --ds-text-faint: color-mix(in oklab, #ffffff 38%, transparent);+ --ds-tile: color-mix(in oklab, #ffffff 3.5%, transparent);+ --ds-tile-hover: color-mix(in oklab, #ffffff 6%, transparent);+ --ds-tile-deep: color-mix(in oklab, #ffffff 8%, transparent);+ --ds-accent: #ffffff;+ --ds-accent-hover: #ededed;+ --ds-on-accent: #181818;+ --ds-field-inset-bg: color-mix(in oklab, #ffffff 5%, transparent);+ --ds-field-inset-focus-bg: color-mix(in oklab, #ffffff 7%, transparent);+ --ds-placeholder-ink: color-mix(in oklab, #ffffff 42%, transparent);+ --ds-tool-row-bg: var(--ds-tile);+ --ds-stop-bg: color-mix(in oklab, #ffffff 16%, transparent);+ --ds-send-disabled-bg: color-mix(in oklab, #ffffff 18%, transparent);+ --ds-send-disabled-fg: color-mix(in oklab, #181818 70%, transparent);+ --ds-scrim: color-mix(in oklab, #000000 45%, transparent);+ --ds-header-bg: color-mix(in oklab, #181818 86%, transparent);+ --ds-success: #40c977;+ --ds-warning: #ff8549;+ --ds-error: #ff6764;+ --ds-purple: #c27aff;+ --ds-elevation-stroke: 0 0 0 0.5px color-mix(in oklab, #ffffff 12%, transparent);+ --ds-shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.55);+ --ds-shadow-composer: 0 3px 7.5px #0000000a, 0 0 20px #0000000d;+ --ds-shadow-fab: 0 6px 20px rgba(0, 0, 0, 0.4);++ --radius-xs: 8px;+ --radius-sm: 10px;+ --radius-md: 12px;+ --radius-md-plus: 14px;+ --radius-lg-plus: 18px;+ --radius-xl: 20px;+ --radius-2xl: 24px;+ --radius-full: 9999px;+ --radius-round: 50%;++ --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;+ --font-mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;+ --text-xs-plus: 11.5px;+ --text-sm: 12px;+ --text-sm-plus: 12.5px;+ --text-md: 13px;+ --text-md-plus: 13.5px;+ --text-base: 14px;+ --text-base-plus: 15px;+ --text-lg: 16px;+ --text-xl: 20px;+ --text-2xl: 28px;+ --font-weight-normal: 400;+ --font-weight-medium: 500;+ --font-weight-strong: 560;+ --font-weight-semibold: 600;+ --leading-tight: 1.25;+ --leading-normal: 1.4;+ --leading-body: 1.45;+ --leading-relaxed: 1.5;+ --leading-chat: 1.55;+ --tracking-tight: -0.02em;+ /* The one wide tracking: six pairing digits read as separate glyphs. */+ --tracking-code: 0.24em;++ --motion-duration-fast: 150ms;+ --motion-duration-normal: 200ms;+ --motion-ease-out: cubic-bezier(0.22, 1, 0.36, 1);+--tap: 44px;- font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;- color: var(--text);- background: var(--bg);+ --pad-left: max(16px, env(safe-area-inset-left));+ --pad-right: max(16px, env(safe-area-inset-right));}-@media (prefers-color-scheme: dark) {++@media (prefers-color-scheme: light) {:root {- --bg: #141416;- --surface: #1e1f22;- --text: #ececee;- --muted: #a3a7ae;- --border: #34363b;- --accent: #6b9bff;- --on-accent: #0b1020;- --danger: #ff8a80;- --user: #233154;+ color-scheme: light;+ --ds-bg-primary: #ffffff;+ --ds-bg-elevated-opaque: #ffffff;+ --ds-bg-composer: #ffffff;+ --ds-bg-hover: color-mix(in oklab, #1a1c1f 5%, transparent);+ --ds-bg-active: color-mix(in oklab, #1a1c1f 8%, transparent);+ --ds-text-primary: #1a1c1f;+ --ds-text-secondary: color-mix(in oklab, #1a1c1f 74%, transparent);+ --ds-text-muted: #5d5d5d;+ --ds-text-faint: #8e8e90;+ --ds-tile: color-mix(in oklab, #1a1c1f 3.5%, transparent);+ --ds-tile-hover: color-mix(in oklab, #1a1c1f 6%, transparent);+ --ds-tile-deep: color-mix(in oklab, #1a1c1f 8%, transparent);+ --ds-accent: #1a1c1f;+ --ds-accent-hover: #303030;+ --ds-on-accent: #ffffff;+ --ds-field-inset-bg: #f3f3f3;+ --ds-field-inset-focus-bg: #ffffff;+ --ds-placeholder-ink: #8e8e90;+ --ds-tool-row-bg: color-mix(in oklab, #1a1c1f 3%, transparent);+ --ds-stop-bg: color-mix(in oklab, #1a1c1f 10%, transparent);+ --ds-send-disabled-bg: #8e8e90;+ --ds-send-disabled-fg: #ffffff;+ --ds-scrim: color-mix(in oklab, #1a1c1f 28%, transparent);+ --ds-header-bg: color-mix(in oklab, #ffffff 86%, transparent);+ --ds-success: #00a240;+ --ds-warning: #e25507;+ --ds-error: #e02e2a;+ --ds-purple: #7c3aed;+ --ds-elevation-stroke: 0 0 0 0.5px color-mix(in oklab, #1a1c1f 12%, transparent);+ --ds-shadow-dialog: 0 16px 48px rgba(0, 0, 0, 0.12);+ --ds-shadow-fab: 0 6px 20px rgba(0, 0, 0, 0.16);}}-* { box-sizing: border-box; }-html, body { margin: 0; min-height: 100%; }-body { overflow-x: hidden; }-main { max-width: 760px; margin: 0 auto; padding: 0 12px calc(16px + env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; }-:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }-button, input, textarea { font: inherit; color: inherit; }-button { min-height: var(--tap); min-width: var(--tap); padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }-button.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }-button.danger { color: var(--danger); }-button:disabled { opacity: .5; cursor: not-allowed; }-button.link { border: none; background: none; color: var(--accent); }-input, textarea { width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); }-label { display: block; font-weight: 600; margin: 12px 0 6px; }-.header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 0 8px; background: var(--bg); }-.header h1 { flex: 1; min-width: 0; margin: 0; font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }-.toolbar { display: flex; gap: 8px; align-items: center; margin: 4px 0 8px; }-.toolbar input[type=search] { flex: 1; }-.toggle { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-weight: 400; margin: 0; white-space: nowrap; }-.toggle input { width: 20px; min-height: 20px; }-.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }-.row { display: flex; align-items: center; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }-.row-main { flex: 1; min-width: 0; text-align: left; border: none; background: none; padding: 10px 12px; display: flex; flex-direction: column; align-items: flex-start; }-.row-title { width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }-.row-meta { color: var(--muted); font-size: 14px; display: flex; gap: 8px; flex-wrap: wrap; }-.row-more { border: none; background: none; font-size: 20px; }-.empty, .hint { color: var(--muted); text-align: center; padding: 24px 8px; }-.messages { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 8px 0 12px; }-.msg { padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }-.msg.user { background: var(--user); align-self: flex-end; max-width: 88%; }-.msg.tool { color: var(--muted); font-size: 14px; padding: 6px 10px; }-.msg.live { border-style: dashed; }-.msg-role { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }-.banner { padding: 10px 12px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); margin: 6px 0; }-#offline { position: sticky; top: 0; z-index: 3; margin: 0; border-radius: 0; text-align: center; }-.queue { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }-.queue .row { padding-left: 12px; }-.composer { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; }-.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; }++/* ---------- base ---------- */+*,+*::before,+*::after {+ box-sizing: border-box;+}+html {+ -webkit-text-size-adjust: 100%;+ text-size-adjust: 100%;+ background: var(--ds-bg-primary);+ caret-color: var(--ds-text-primary);+ accent-color: var(--ds-accent);+}+html,+body {+ margin: 0;+ min-height: 100%;+}+body {+ overflow-x: hidden;+ font-family: var(--font-sans);+ font-size: var(--text-base-plus);+ line-height: var(--leading-body);+ color: var(--ds-text-primary);+ background: var(--ds-bg-primary);+ -webkit-font-smoothing: antialiased;+ -webkit-tap-highlight-color: transparent;+}+main {+ display: flex;+ flex-direction: column;+ width: 100%;+ max-width: 720px;+ min-height: 100dvh;+ margin: 0 auto;+ padding: 0 var(--pad-right) 0 var(--pad-left);+}+h1,+h2,+p {+ margin: 0;+}+::selection {+ background: color-mix(in oklab, var(--ds-text-primary) 18%, transparent);+ color: var(--ds-text-primary);+}+:focus-visible {+ outline: 1.5px solid color-mix(in oklab, var(--ds-accent) 80%, transparent);+ outline-offset: 2px;+}+[tabindex="-1"]:focus {+ outline: none;+}+.sr-only {+ position: absolute;+ width: 1px;+ height: 1px;+ margin: -1px;+ padding: 0;+ overflow: hidden;+ clip: rect(0 0 0 0);+ white-space: nowrap;+ border: 0;+}+/* Chrome is not selectable; transcript text, fields and toasts are. */+.header,+.toolbar,+.row,+button,+.sheet,+.notice,+.status-pill {+ -webkit-user-select: none;+ user-select: none;+}+.msg,+.toast,+input,+textarea {+ -webkit-user-select: text;+ user-select: text;+}++/* Icons are decoration: a tap always lands on the control that owns them. */+.icon {+ flex: none;+ pointer-events: none;+ width: 20px;+ height: 20px;+ fill: none;+ stroke: currentColor;+ stroke-width: 1.75;+ stroke-linecap: round;+ stroke-linejoin: round;+}+.icon.sm {+ width: 16px;+ height: 16px;+}+.icon.xs {+ width: 13px;+ height: 13px;+}+.icon.lg {+ width: 40px;+ height: 40px;+ stroke-width: 1.5;+}++/* ---------- controls ---------- */+button {+ display: inline-flex;+ align-items: center;+ justify-content: center;+ gap: 6px;+ min-width: var(--tap);+ min-height: var(--tap);+ margin: 0;+ padding: 0 14px;+ border: 0;+ border-radius: var(--radius-sm);+ background: transparent;+ color: inherit;+ font: inherit;+ font-size: var(--text-base);+ font-weight: var(--font-weight-medium);+ cursor: pointer;+ touch-action: manipulation;+ transition:+ background-color var(--motion-duration-fast) var(--motion-ease-out),+ color var(--motion-duration-fast) var(--motion-ease-out),+ opacity var(--motion-duration-fast) var(--motion-ease-out),+ scale var(--motion-duration-fast) var(--motion-ease-out);+}+button:active:not(:disabled) {+ background-color: var(--ds-bg-active);+}+@media (hover: hover) {+ button:hover:not(:disabled) {+ background-color: var(--ds-bg-hover);+ }+}+button:disabled {+ opacity: 0.45;+ cursor: not-allowed;+}+button.primary {+ background-color: var(--ds-accent);+ color: var(--ds-on-accent);+ font-weight: var(--font-weight-semibold);+}+@media (hover: hover) {+ button.primary:hover:not(:disabled) {+ background-color: var(--ds-accent-hover);+ }+}+button.primary:active:not(:disabled) {+ background-color: var(--ds-accent-hover);+ scale: 0.98;+}+button.secondary {+ background-color: var(--ds-tile-hover);+ color: var(--ds-text-primary);+}+button.danger {+ color: var(--ds-error);+}+button.link {+ color: var(--ds-text-secondary);+}+button.icon-btn {+ width: var(--tap);+ padding: 0;+ border-radius: var(--radius-round);+ color: var(--ds-text-secondary);+}++input,+textarea {+ width: 100%;+ min-height: var(--tap);+ margin: 0;+ padding: 10px 14px;+ border: 0;+ border-radius: var(--radius-sm);+ outline: none;+ background: var(--ds-field-inset-bg);+ color: var(--ds-text-primary);+ font: inherit;+ font-size: var(--text-lg);+ line-height: var(--leading-body);+ transition:+ background-color var(--motion-duration-fast) var(--motion-ease-out),+ box-shadow var(--motion-duration-fast) var(--motion-ease-out);+}+input:focus,+textarea:focus {+ background: var(--ds-field-inset-focus-bg);+ box-shadow: 0 0 0 2px color-mix(in oklab, var(--ds-accent) 40%, transparent);+}+input::placeholder,+textarea::placeholder {+ color: var(--ds-placeholder-ink);+ opacity: 1;+}+input[type="search"]::-webkit-search-decoration {+ -webkit-appearance: none;+}+label {+ display: block;+ margin: 18px 0 6px;+ color: var(--ds-text-secondary);+ font-size: var(--text-md);+ font-weight: var(--font-weight-medium);+}++/* ---------- header ---------- */+.header {+ position: sticky;+ top: 0;+ z-index: 3;+ display: flex;+ align-items: center;+ gap: 2px;+ min-height: calc(52px + env(safe-area-inset-top));+ margin: 0 calc(-1 * var(--pad-right)) 0 calc(-1 * var(--pad-left));+ padding: env(safe-area-inset-top) max(6px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));+ background: var(--ds-header-bg);+ -webkit-backdrop-filter: saturate(180%) blur(16px);+ backdrop-filter: saturate(180%) blur(16px);+}+.header-title {+ display: flex;+ flex: 1;+ min-width: 0;+ flex-direction: column;+ justify-content: center;+ padding: 0 6px;+}+.header.root .header-title {+ padding-left: 10px;+}+.header h1 {+ overflow: hidden;+ font-size: var(--text-lg);+ font-weight: var(--font-weight-semibold);+ line-height: var(--leading-tight);+ text-overflow: ellipsis;+ white-space: nowrap;+}+.header.root h1 {+ font-size: var(--text-xl);+ font-weight: var(--font-weight-strong);+ letter-spacing: var(--tracking-tight);+}+.header-sub {+ display: flex;+ align-items: center;+ gap: 10px;+ min-width: 0;+ overflow: hidden;+ color: var(--ds-text-muted);+ font-size: var(--text-xs-plus);+ white-space: nowrap;+}+/* The model label gives way first; the status entry keeps its text. */+.header-sub .meta-item {+ min-width: 0;+}+.header-sub .meta-item:has(.dot) {+ flex: none;+}+.header-sub .meta-text {+ overflow: hidden;+ text-overflow: ellipsis;+}++/* ---------- list toolbar ---------- */+.toolbar {+ display: flex;+ align-items: center;+ gap: 8px;+ padding: 4px 0 12px;+}+.search {+ position: relative;+ flex: 1;+ min-width: 0;+}+.search .icon {+ position: absolute;+ top: 50%;+ left: 14px;+ translate: 0 -50%;+ color: var(--ds-text-muted);+ pointer-events: none;+}+.search input {+ padding-left: 40px;+ border-radius: var(--radius-full);+}+.chip {+ flex: none;+ padding: 0 14px 0 12px;+ border-radius: var(--radius-full);+ background-color: var(--ds-tile);+ color: var(--ds-text-secondary);+ font-size: var(--text-md-plus);+}+.chip[aria-pressed="true"] {+ background-color: var(--ds-tile-deep);+ color: var(--ds-text-primary);+}++/* ---------- lists ---------- */+.list {+ display: flex;+ flex-direction: column;+ gap: 2px;+ margin: 0;+ padding: 0;+ list-style: none;+}+.list.group {+ margin-bottom: 12px;+ border-radius: var(--radius-md-plus);+ background: var(--ds-tile);+}+.row {+ position: relative;+ display: flex;+ align-items: center;+ border-radius: var(--radius-md);+ transition: background-color var(--motion-duration-fast) var(--motion-ease-out);+}+.list.group .row {+ border-radius: var(--radius-md-plus);+}+.row:has(.row-main:active) {+ background-color: var(--ds-bg-active);+}+@media (hover: hover) {+ .row:hover {+ background-color: var(--ds-bg-hover);+ }+}+.row-main {+ flex: 1;+ justify-content: flex-start;+ gap: 12px;+ min-width: 0;+ min-height: 56px;+ padding: 8px 6px 8px 12px;+ border-radius: inherit;+ text-align: left;+ font-weight: var(--font-weight-normal);+}+.row-main:active:not(:disabled),+.row-main:hover:not(:disabled) {+ background-color: transparent;+}+.row-icon {+ display: inline-flex;+ color: var(--ds-text-secondary);+}+.row-text {+ display: flex;+ flex: 1;+ min-width: 0;+ flex-direction: column;+ gap: 2px;+}+.row-title {+ overflow: hidden;+ color: var(--ds-text-primary);+ font-size: var(--text-base-plus);+ font-weight: var(--font-weight-medium);+ line-height: var(--leading-tight);+ text-overflow: ellipsis;+ white-space: nowrap;+}+.row-meta {+ display: flex;+ flex-wrap: wrap;+ align-items: center;+ gap: 2px 10px;+ color: var(--ds-text-muted);+ font-size: var(--text-sm);+ line-height: var(--leading-normal);+}+.meta-item {+ display: inline-flex;+ align-items: center;+ gap: 4px;+}+.row-time {+ flex: none;+ color: var(--ds-text-faint);+ font-size: var(--text-sm);+ font-variant-numeric: tabular-nums;+}+.row-more {+ flex: none;+ margin-right: 2px;+ color: var(--ds-text-muted);+}++.dot {+ flex: none;+ width: 7px;+ height: 7px;+ border-radius: var(--radius-round);+ background: var(--ds-text-muted);+}+.dot.running {+ background: var(--ds-warning);+ animation: breathe 1.6s ease-in-out 2;+}+.dot.waiting {+ background: var(--ds-purple);+}+.dot.offline {+ background: var(--ds-warning);+}++.empty {+ display: flex;+ flex-direction: column;+ align-items: center;+ gap: 12px;+ padding: 56px 16px;+ color: var(--ds-text-muted);+ font-size: var(--text-md-plus);+ text-align: center;+}+.empty .icon {+ color: var(--ds-text-faint);+}++main > button.signout {+ align-self: center;+ margin: auto 0 0;+ padding-top: 24px;+ padding-bottom: calc(12px + env(safe-area-inset-bottom));+ min-height: calc(var(--tap) + 36px + env(safe-area-inset-bottom));+ background: transparent;+ color: var(--ds-text-muted);+ font-size: var(--text-md);+ font-weight: var(--font-weight-normal);+}++/* New conversation: a capsule within thumb reach (spec W07). */+main > button.fab {+ position: fixed;+ z-index: 2;+ right: 0;+ bottom: calc(16px + env(safe-area-inset-bottom));+ left: 0;+ width: max-content;+ max-width: calc(100% - 32px);+ min-height: 50px;+ margin: 0 auto;+ padding: 0 22px 0 18px;+ border-radius: var(--radius-full);+ box-shadow: var(--ds-shadow-fab);+ font-size: var(--text-base-plus);+}+.fab-spacer {+ flex: none;+ height: calc(88px + env(safe-area-inset-bottom));+}++/* ---------- conversation ---------- */+.messages {+ display: flex;+ flex: 1;+ flex-direction: column;+ gap: 18px;+ padding: 12px 0 20px;+}+.load-older {+ align-self: center;+ border-radius: var(--radius-full);+ background-color: var(--ds-tile);+ color: var(--ds-text-secondary);+ font-size: var(--text-md);+}+.msg {+ min-width: 0;+ font-size: var(--text-base-plus);+ line-height: var(--leading-chat);+ white-space: pre-wrap;+ overflow-wrap: anywhere;+ word-break: normal;+}+.msg.user {+ align-self: flex-end;+ max-width: 85%;+ padding: 9px 15px;+ border-radius: var(--radius-lg-plus);+ border-bottom-right-radius: var(--radius-xs);+ background: var(--ds-tile-deep);+}+.msg.assistant {+ align-self: stretch;+}+.msg.tool {+ display: flex;+ align-items: flex-start;+ align-self: flex-start;+ gap: 8px;+ max-width: 100%;+ padding: 8px 12px;+ border-radius: var(--radius-sm);+ background: var(--ds-tool-row-bg);+ color: var(--ds-text-secondary);+ font-size: var(--text-sm-plus);+ line-height: var(--leading-normal);+}+.msg.tool .icon {+ margin-top: 1px;+ color: var(--ds-text-muted);+}+/* The streaming caret describes work in flight, so it may keep animating. */+.msg.live::after {+ content: "";+ display: inline-block;+ width: 0.5em;+ height: 1.05em;+ margin-left: 3px;+ vertical-align: text-bottom;+ border-radius: 2px;+ background: currentColor;+ opacity: 0.55;+ animation: caret 1s steps(2, jump-none) infinite;+}++.chat-dock {+ position: sticky;+ bottom: 0;+ z-index: 2;+ display: flex;+ flex-direction: column;+ gap: 8px;+ margin: 0 calc(-1 * var(--pad-right)) 0 calc(-1 * var(--pad-left));+ padding: 10px var(--pad-right) calc(10px + env(safe-area-inset-bottom)) var(--pad-left);+ background: linear-gradient(to top, var(--ds-bg-primary) 72%, transparent);+}+.notice {+ display: flex;+ align-items: center;+ gap: 10px;+ min-height: var(--tap);+ padding: 6px 6px 6px 14px;+ border-radius: var(--radius-md-plus);+ background: var(--ds-bg-elevated-opaque);+ box-shadow: var(--ds-elevation-stroke);+ color: var(--ds-text-secondary);+ font-size: var(--text-md-plus);+ line-height: var(--leading-normal);+}+.notice-text {+ flex: 1;+ min-width: 0;+ padding: 6px 0;+}+.notice .icon {+ color: var(--ds-text-muted);+}+.notice button {+ flex: none;+}+.queue {+ display: flex;+ flex-direction: column;+ gap: 4px;+}+.queue-item {+ display: flex;+ align-items: center;+ gap: 8px;+ padding-left: 14px;+ border-radius: var(--radius-md-plus);+ background: var(--ds-bg-elevated-opaque);+ box-shadow: var(--ds-elevation-stroke);+}+.queue-text {+ display: flex;+ flex: 1;+ min-width: 0;+ flex-direction: column;+}+.queue-label {+ color: var(--ds-text-muted);+ font-size: var(--text-xs-plus);+}+.queue-body {+ overflow: hidden;+ font-size: var(--text-md-plus);+ text-overflow: ellipsis;+ white-space: nowrap;+}++/* The composer is one floating pill; it lifts by shadow, never a stroke. */+.composer {+ display: flex;+ align-items: flex-end;+ gap: 2px;+ padding: 4px 4px 4px 18px;+ border-radius: var(--radius-2xl);+ background: var(--ds-bg-composer);+ box-shadow: var(--ds-elevation-stroke), var(--ds-shadow-composer);+}+.composer textarea {+ flex: 1;+ min-height: var(--tap);+ max-height: 40vh;+ padding: 10px 0;+ border-radius: 0;+ background: transparent;+ resize: none;+}+.composer textarea:focus {+ background: transparent;+ box-shadow: none;+}+.composer .actions {+ display: flex;+ flex: none;+ align-items: center;+}+/* 44px hit target around a 34px disc: the background paints the content box. */+.composer .send,+.composer .stop {+ padding: 5px;+ border-radius: var(--radius-round);+ background-clip: content-box;+}+.composer .send {+ width: var(--tap);+}+.composer .send.is-queue {+ width: auto;+ border-radius: var(--radius-full);+}+.composer .send.is-queue > span {+ padding: 0 12px;+ font-size: var(--text-md-plus);+}+.composer .send:disabled {+ opacity: 1;+ background-color: var(--ds-send-disabled-bg);+ color: var(--ds-send-disabled-fg);+}+.composer .stop {+ width: var(--tap);+ background-color: var(--ds-stop-bg);+ color: var(--ds-text-primary);+}+.composer .stop .icon {+ fill: currentColor;+ stroke: none;+}++/* ---------- floating layers ---------- */+.status-pill:not([hidden]) {+ position: fixed;+ z-index: 8;+ top: calc(60px + env(safe-area-inset-top));+ right: 0;+ left: 0;+ display: flex;+ align-items: center;+ gap: 8px;+ width: max-content;+ max-width: calc(100% - 32px);+ margin: 0 auto;+ padding: 8px 14px;+ border-radius: var(--radius-full);+ background: var(--ds-bg-elevated-opaque);+ box-shadow: var(--ds-elevation-stroke), var(--ds-shadow-dialog);+ color: var(--ds-text-secondary);+ font-size: var(--text-md);+ pointer-events: none;+ animation: drop-in var(--motion-duration-normal) var(--motion-ease-out);+}++.toast:not([hidden]) {+ position: fixed;+ z-index: 7;+ right: var(--pad-right);+ bottom: calc(96px + env(safe-area-inset-bottom));+ left: var(--pad-left);+ max-width: 480px;+ margin: 0 auto;+ padding: 12px 16px;+ border-radius: var(--radius-md-plus);+ background: var(--ds-bg-elevated-opaque);+ box-shadow: var(--ds-elevation-stroke), var(--ds-shadow-dialog);+ color: var(--ds-text-primary);+ font-size: var(--text-md-plus);+ line-height: var(--leading-normal);+ animation: rise-in var(--motion-duration-normal) var(--motion-ease-out);+}+/* 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; }-.sheet-actions button { width: 100%; }-.pair { margin: auto 0; padding: 24px 0; }-.pair h1 { font-size: 22px; }-.pair .code { letter-spacing: .3em; font-size: 22px; text-align: center; }-.pair button { width: 100%; margin-top: 16px; }-@media (prefers-reduced-motion: no-preference) { button { transition: background-color .15s, opacity .15s; } }+.sheet:not([hidden]) {+ position: fixed;+ z-index: 6;+ inset: 0;+ display: flex;+ align-items: flex-end;+ justify-content: center;+ background: var(--ds-scrim);+ animation: fade-in var(--motion-duration-normal) var(--motion-ease-out);+}+.sheet-panel {+ width: 100%;+ max-width: 520px;+ max-height: 85dvh;+ overflow-y: auto;+ padding: 6px 8px calc(8px + env(safe-area-inset-bottom));+ border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;+ background: var(--ds-bg-elevated-opaque);+ box-shadow: var(--ds-elevation-stroke), var(--ds-shadow-dialog);+ animation: rise-in var(--motion-duration-normal) var(--motion-ease-out);+}+.sheet-title {+ overflow: hidden;+ padding: 12px 16px 10px;+ color: var(--ds-text-muted);+ font-size: var(--text-md);+ font-weight: var(--font-weight-medium);+ text-align: center;+ text-overflow: ellipsis;+ white-space: nowrap;+}+.sheet-actions {+ display: flex;+ flex-direction: column;+ gap: 2px;+}+.sheet-actions > button {+ justify-content: flex-start;+ gap: 14px;+ width: 100%;+ min-height: 52px;+ padding: 0 16px;+ border-radius: var(--radius-md-plus);+ font-size: var(--text-base-plus);+ font-weight: var(--font-weight-normal);+}+.sheet-actions > button .icon {+ color: var(--ds-text-secondary);+}+.sheet-actions > button.danger .icon {+ color: currentColor;+}+.sheet-actions > button.cancel {+ justify-content: center;+ margin-top: 6px;+ background-color: var(--ds-tile-hover);+ font-weight: var(--font-weight-medium);+}+.sheet-form {+ display: flex;+ flex-direction: column;+ gap: 12px;+ padding: 0 8px 4px;+}+.sheet-buttons {+ display: flex;+ gap: 8px;+}+.sheet-buttons > button {+ flex: 1;+ min-height: 48px;+ border-radius: var(--radius-md);+}+@media (min-width: 640px) {+ .sheet:not([hidden]) {+ align-items: center;+ padding: 24px;+ }+ .sheet-panel {+ padding-bottom: 8px;+ border-radius: var(--radius-2xl);+ }+}++/* ---------- pairing ---------- */+.pair {+ display: flex;+ flex-direction: column;+ width: 100%;+ max-width: 420px;+ margin: auto;+ padding: calc(32px + env(safe-area-inset-top)) 0 calc(32px + env(safe-area-inset-bottom));+}+.pair .icon.lg {+ margin-bottom: 20px;+ color: var(--ds-text-secondary);+}+.pair h1 {+ font-size: var(--text-2xl);+ font-weight: var(--font-weight-strong);+ line-height: var(--leading-tight);+ letter-spacing: var(--tracking-tight);+}+.pair-hint {+ margin-top: 10px;+ color: var(--ds-text-secondary);+ font-size: var(--text-base);+ line-height: var(--leading-relaxed);+}+.pair .code {+ min-height: 60px;+ border-radius: var(--radius-md);+ font-family: var(--font-mono);+ font-size: var(--text-2xl);+ font-variant-numeric: tabular-nums;+ letter-spacing: var(--tracking-code);+ text-align: center;+}+.pair .code::placeholder {+ color: var(--ds-text-faint);+}+.pair button[type="submit"] {+ width: 100%;+ min-height: 50px;+ margin-top: 28px;+ border-radius: var(--radius-md);+ font-size: var(--text-base-plus);+}+.pair-status {+ min-height: 1.5em;+ margin-top: 14px;+ color: var(--ds-text-secondary);+ font-size: var(--text-md-plus);+ line-height: var(--leading-normal);+ text-align: center;+}++/* ---------- motion ---------- */+@keyframes fade-in {+ from {+ opacity: 0;+ }+}+@keyframes rise-in {+ from {+ opacity: 0;+ translate: 0 12px;+ }+}+@keyframes drop-in {+ from {+ opacity: 0;+ translate: 0 -8px;+ }+}+@keyframes breathe {+ 50% {+ opacity: 0.35;+ }+}+@keyframes caret {+ 50% {+ opacity: 0;+ }+}+@media (prefers-reduced-motion: reduce) {+ *,+ *::before,+ *::after {+ animation: none !important;+ transition: none !important;+ }+}diff --git a/apps/desktop/test/lan-webui-browser-user-path.test.mjs b/apps/desktop/test/lan-webui-browser-user-path.test.mjsindex c3da6d34e..fe9de437e 100644--- a/apps/desktop/test/lan-webui-browser-user-path.test.mjs+++ b/apps/desktop/test/lan-webui-browser-user-path.test.mjs@@ -57,6 +57,17 @@ const journey = String.raw`(async () => {// 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);++ // Searching re-renders the list but keeps the field focused with its text.+ const search = document.getElementById("list-search");+ search.focus();+ search.value = "Al";+ search.dispatchEvent(new Event("input"));+ await wait(() => rowByTitle("Alpha") && !rowByTitle("Beta"), "filtered projects");+ result.searchKept = document.activeElement?.id === "list-search" && document.activeElement.value === "Al";+ document.activeElement.value = "";+ document.activeElement.dispatchEvent(new Event("input"));+ await wait(() => rowByTitle("Beta"), "cleared search");const temporary = await wait(() => rowByTitle("Temporary conversations") ?? rowByTitle("临时会话"), "temporary entry");tap(temporary.querySelector(".row-main"));await wait(() => rowByTitle("Scratch") && document.querySelector("main > button.primary"), "temporary conversations");@@ -77,11 +88,22 @@ const journey = String.raw`(async () => {await wait(() => rowByTitle("Fix login")?.querySelector(".row-meta"), "pinned meta");result.pinnedMeta = rowByTitle("Fix login").querySelector(".row-meta").textContent;+ // Rename inside the action sheet, without a native prompt.+ tap(rowByTitle("Fix login").querySelector(".row-more"));+ await wait(() => !document.getElementById("sheet").hidden, "sheet for rename");+ tap(document.querySelectorAll("#sheet-actions button")[0]);+ const rename = await wait(() => document.getElementById("rename-input"), "rename field");+ result.renameFocused = document.activeElement === rename && rename.value === "Fix login";+ rename.value = "Fix login flow";+ tap(document.querySelector("#sheet-actions button[type=submit]"));+ await wait(() => rowByTitle("Fix login flow"), "renamed row");+ result.sheetClosed = document.getElementById("sheet").hidden;+// Closing the menu must let the next tap reach an existing conversation.- tap(rowByTitle("Fix login").querySelector(".row-main"));+ tap(rowByTitle("Fix login flow").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");+ await wait(() => rowByTitle("Fix login flow"), "back from existing transcript");// Create a new conversation in this project and send a message.tap(document.querySelector("main > button.primary"));@@ -101,7 +123,7 @@ const journey = String.raw`(async () => {// Back returns to the project's session list.history.back();- await wait(() => rowByTitle("Fix login"), "back to sessions");+ await wait(() => rowByTitle("Fix login flow"), "back to sessions");result.backHash = location.hash;history.back();await wait(() => rowByTitle("Alpha"), "back to projects before sign-out");@@ -174,6 +196,10 @@ test("a phone pairs with a formatted paste, uses projects and conversations, andassert.equal(result.projectHash, "#/p/g-a");assert.ok(result.pinnedMeta.length > 0, "the pinned label is shown");assert.equal(fake.meta.sessionMeta["s-a1"].pinned, true);+ assert.equal(result.searchKept, true, "a live search keeps the focused field and its text");+ assert.equal(result.renameFocused, true, "rename opens an in-page field with the current name");+ assert.equal(result.sheetClosed, true);+ assert.equal(fake.sessions.find((session) => session.id === "s-a1").title, "Fix login flow");assert.match(result.chatHash, /^#\/s\/s-new-1$/);assert.equal(fake.turns.length, 1);assert.equal(fake.turns[0].params.input.text, "hello from phone");diff --git a/docs/spec/01-product/03-lan-webui-mvp.md b/docs/spec/01-product/03-lan-webui-mvp.mdindex cb733f706..f983700a8 100644--- a/docs/spec/01-product/03-lan-webui-mvp.md+++ b/docs/spec/01-product/03-lan-webui-mvp.md@@ -240,6 +240,16 @@ and devices (16); never silently truncate input.token. Preserve Chinese IME composition; Enter for candidate selection mustnot submit. Ship localized controls/errors via Desktop's catalog conventions,with English fallback; verify English and Simplified Chinese.+- The page follows the Desktop visual system+ ([UI design system](../04-ux/07-ui-design-system.md)): the neutral+ monochrome palette, divider-free tonal tiles, stroke plus shadow only on+ floating layers (action sheet, toast, status pill), Lucide icons, and the+ shared radius, type and motion ramps, mirrored as tokens in the page's own+ stylesheet. Light or dark follows the phone's system preference. Phone-only+ deviations: 16 px form fields so iOS does not zoom on focus, a New session+ capsule pinned within thumb reach, a floating composer pill, and rename in+ the action sheet instead of a native prompt. A live refresh keeps the+ focused field, caret and draft; Back restores the list scroll position.- Qualification: physical iPhone/Safari and Android/Chrome on the same LAN,plus desktop Chromium; record browser/OS/build versions. Qualify listenerstart, shutdown and restart on every Desktop OS advertised as supported.