diff --git a/web/PARITY.md b/web/PARITY.md index 3656e766..45879026 100644 --- a/web/PARITY.md +++ b/web/PARITY.md @@ -168,7 +168,7 @@ to it, but the server never lists it and a reload drops it. | B14 | Run a pipeline from the web | `run_pipeline` | done — the pipeline detail has a Run action that opens a dialog with the prompt, an absolute server working-directory field with recent-directory suggestions, and a per-run notification choice (pipeline default / notify / silent). The request carries `pipeline_id`, the pinned version, a fresh request key, `workspace`, `input.prompt` and `notify_mode` only when overriding. A live probe started a real run from the dialog with `notify_mode=off` and the server stored that mode; the run was canceled. | | B15 | Per-run notification override | `notify_mode` | done — `pipelines run --notify auto\|on\|off` (and the same option on retry) records the override with the run. Off suppresses both stage policies and run-level waiting/failed alerts; auto follows the definition; on keeps run-level attention. The mode is stored in `pipeline_runs`, reloaded after a restart, and inherited by a retry unless overridden. | | B16 | One live status line for tools | — | done — the current tool call now shares the `N tools called` line; the separate bottom per-tool line is gone and the lower indicator appears only while no tool is running. The live reasoning label's duration ticks every second without waiting for a frame. Chat frames for a background session no longer repaint a Runs/Pipelines screen: verified a synthetic stream while opening run 12's detail left the run screen interactive with no per-frame replacements. | -| B17 | Clear list chrome and chat recency | — | done — list pages no longer repeat the destination title/subtitle from the rail/dock, and the manual Refresh controls are gone; the visible list refreshes once when the page regains focus, preserving its scroll position and leaving open menus, dialogs and text fields alone. Chat rows replace the meaningless `Idle`/`Open` status with the server's latest-update recency (`just now`, `15 min ago`, `2 days ago`), keep `Streaming`/`New`/`Closed`, and give each directory a full-width elevated band with centred text that expands/collapses exactly like Closed (square corners, not a rounded chip). `New chat` is now a filled primary control beside the search field. Runs and Pipelines use the same title-free list header. Verified at 390×844 and 1440×900 in a real browser, with no console errors; the web unit suite is 633 tests. | +| B17 | Clear list chrome and chat recency | — | done — list pages no longer repeat the destination title/subtitle from the rail/dock, and the manual Refresh controls are gone; the visible list refreshes once when the page regains focus, preserving its scroll position and leaving open menus, dialogs and text fields alone. Chat rows replace the meaningless `Idle`/`Open` status with the server's latest-update recency (`just now`, `15 min ago`, `2 days ago`), keep `Streaming`/`New`/`Closed`, and give each directory a full-width elevated band with centred text that expands/collapses exactly like Closed (square corners, not a rounded chip), abbreviating the server home prefix to `~` (`~/repos/pipelines`) in both the band and the row meta. `New chat` is now a filled primary control beside the search field. Runs and Pipelines use the same title-free list header. Verified at 390×844 and 1440×900 in a real browser, with no console errors; the web unit suite is 633 tests. | | B18 | Chat attachments in the message and paste | `chat_prompt.attachments` | done — composer files are read into base64 and sent with the prompt (1 MiB total, under the 2 MiB websocket frame), the server writes them to private temporary files and passes `file://` references to OpenCode's prompt `files`, and both the live user turn and reloaded history render a named file chip inside the message. Pasting an image/file into the textarea attaches it with the same picker path; a pasted image without a filename gets a generated name. The optimistic user bubble shows the file immediately, and OpenCode history maps the top-level user `files` envelope (never its base64 data) into the same part. | | B19 | One live chat activity line and immediate Stop | — | done — every in-flight turn now has one square activity row carrying the spinner, `Thinking`/`Reasoning · N steps`, the tool-call chip with its current call, and the elapsed time; the separate reasoning, tool and bottom "thinking" lines are gone. The row stays in place when the turn settles (spinner off), and the elapsed ticks locally each second. The composer's Stop is refreshed on the step frame itself, so it appears for turns started by another client and stays through tool calls. A subscribe that joins a live turn replays a `step started` marker. Cancel now marks the run and its live step canceled immediately before interrupting the runner, so a context-unaware stage cannot leave a "running" row after Stop. | | B20 | Cancel a running run immediately | `cancel_run` | done — `runner.cancel` persists `canceled` on the run and its live step before calling the runner's cancel function; late stage returns cannot overwrite it (`FinishRun` only updates queued/running, and a failed step persistence is reported as canceled, not a failure). This also covers orphaned running rows with no active goroutine and waiting runs. Verified by store tests and the run that had been stuck at run 13 is now interrupted/canceled rather than running. | diff --git a/web/src/chat.js b/web/src/chat.js index 6db2591d..8c883522 100644 --- a/web/src/chat.js +++ b/web/src/chat.js @@ -917,6 +917,32 @@ export function directoryLabel(directory) { return isBlank(directory) ? NO_DIRECTORY_LABEL : str(directory); } +/** + * The home prefix shared by the server's reported directories, or "" when none + * looks like a user home. The server always returns home first in + * chat_directories; session paths are the fallback so the list can abbreviate + * before the create picker has ever been opened. macOS /Users/, Linux + * /home/ and /root are recognised; any other absolute path is left alone. + */ +export function homeDirectoryFor(paths) { + for (const value of paths ?? []) { + const match = str(value).match(/^(\/Users\/[^/]+|\/home\/[^/]+|\/root)(?=\/|$)/); + if (match) return match[1]; + } + return ""; +} + +/** Replace [home] and its descendants with `~` for a compact directory label. */ +export function abbreviateHome(path, home) { + const directory = str(path).trim(); + if (isBlank(directory)) return directory; + const prefix = str(home).trim().replace(/\/+$/, ""); + if (prefix === "" || prefix === "~") return directory; + if (directory === prefix) return "~"; + if (directory.startsWith(prefix + "/")) return `~${directory.slice(prefix.length)}`; + return directory; +} + // --------------------------------------------------------------------------- // The create flow's directory choices (ChatDirectories.kt) // --------------------------------------------------------------------------- diff --git a/web/src/views/chat.js b/web/src/views/chat.js index 9e58fcf8..c19c37af 100644 --- a/web/src/views/chat.js +++ b/web/src/views/chat.js @@ -77,6 +77,7 @@ import { applyChatEvent, applyChatOverrides, applyChatPermission, + abbreviateHome, appendChatNotice, approvalCard, attachmentDisplayName, @@ -114,6 +115,7 @@ import { groupSessionsByDirectory, hideChatOverride, historyResync, + homeDirectoryFor, isChatSessionUnseen, makeChatNotice, markChatUnseen, @@ -1852,6 +1854,16 @@ function renderChatList() { return list; } +/** The home prefix used to shorten directory labels to `~`, when knowable. */ +function chatHomePrefix() { + const reported = String(state.chatDirectories?.[0] ?? "").trim(); + if (reported !== "") return reported; + return homeDirectoryFor([ + ...(state.chatDirectories ?? []), + ...(state.chatSessions ?? []).map((session) => session?.directory), + ]); +} + /** The list body: the loading/error/empty states or the grouped session rows. */ function fillChatRows(rows) { rows.replaceChildren(); @@ -1892,6 +1904,7 @@ function fillChatRows(rows) { return; } + const home = chatHomePrefix(); const starred = filtered.filter( (session) => !session.closed && state.chatStars?.has?.(session.id) === true, ); @@ -1910,18 +1923,19 @@ function fillChatRows(rows) { h("span", { class: "chat-group-title", text: "Starred" }), ), ); - for (const session of starred) rows.append(renderChatRow(session, duplicateTitles)); + for (const session of starred) rows.append(renderChatRow(session, duplicateTitles, home)); } const groups = groupSessionsByDirectory(active); if (groups.length > 1) { for (const group of groups) { - const label = directoryLabel(group.directory); + const fullLabel = directoryLabel(group.directory); + const label = abbreviateHome(fullLabel, home); const key = String(group.directory ?? ""); const collapsed = state.chatCollapsedDirs?.has?.(key) === true; const toggle = h("button", { class: "chat-group-header chat-group-toggle chat-group-directory", type: "button", - title: label, + title: fullLabel, "aria-expanded": collapsed ? "false" : "true", "aria-label": `${collapsed ? "Expand" : "Collapse"} ${label}`, onclick: () => { @@ -1935,11 +1949,11 @@ function fillChatRows(rows) { toggle.append(h("span", { class: "chevron", text: collapsed ? "\u25b8" : "\u25be" })); rows.append(toggle); if (!collapsed) { - for (const session of group.sessions) rows.append(renderChatRow(session, duplicateTitles)); + for (const session of group.sessions) rows.append(renderChatRow(session, duplicateTitles, home)); } } } else { - for (const session of active) rows.append(renderChatRow(session, duplicateTitles)); + for (const session of active) rows.append(renderChatRow(session, duplicateTitles, home)); } if (closed.length > 0) { const open = state.chatClosedOpen === true; @@ -1959,7 +1973,7 @@ function fillChatRows(rows) { }); rows.append(toggle); if (open) { - for (const session of closed) rows.append(renderChatRow(session, duplicateTitles)); + for (const session of closed) rows.append(renderChatRow(session, duplicateTitles, home)); } } if (state.chatError) { @@ -2009,7 +2023,7 @@ async function toggleChatStar(id) { * activity badge word, the work-label meta line and the close/reopen action. * Every server string is set with textContent. */ -function renderChatRow(session, duplicateTitles = new Set()) { +function renderChatRow(session, duplicateTitles = new Set(), home = "") { const open = state.chatActiveId === session.id; const thread = state.chatThreads.get(session.id) ?? null; const unseen = @@ -2060,7 +2074,9 @@ function renderChatRow(session, duplicateTitles = new Set()) { head.append(h("span", { class: `chat-activity ${statusClass}`, text: statusWord })); } sessionButton.append(head); - const meta = [updated, String(session.directory ?? "").trim()].filter(Boolean).join(" \u00b7 "); + const meta = [updated, abbreviateHome(String(session.directory ?? "").trim(), home)] + .filter(Boolean) + .join(" \u00b7 "); if (meta !== "") { sessionButton.append(h("span", { class: "row-meta chat-row-meta", text: meta })); } diff --git a/web/sw.js b/web/sw.js index 95ce6cd3..24834566 100644 --- a/web/sw.js +++ b/web/sw.js @@ -1,7 +1,7 @@ // A shell cache for an installed Pipelines app. The API (the WebSocket proxy and // artifact files) is never cached; static files prefer the network and fall back // to the last good copy so an installed app still opens when the server is away. -const CACHE = "pipelines-shell-v3"; +const CACHE = "pipelines-shell-v4"; const SHELL = ["/", "/index.html", "/manifest.webmanifest", "/favicon.svg"]; self.addEventListener("install", (event) => { diff --git a/web/test/chat.test.mjs b/web/test/chat.test.mjs index 96200d19..974da7e7 100644 --- a/web/test/chat.test.mjs +++ b/web/test/chat.test.mjs @@ -110,6 +110,8 @@ import { deltaPartId, directoryChoices, directoryLabel, + homeDirectoryFor, + abbreviateHome, dismissChatNotice, emptyChatOverrides, emptyChatSeen, @@ -569,6 +571,17 @@ test("groupSessionsByDirectory groups in first-occurrence order and labels a bla assert.equal(directoryLabel("/a"), "/a"); }); +test("directory labels abbreviate the user's home to ~", () => { + const home = homeDirectoryFor(["/Users/alan/repos/pipelines", "/Users/alan/notes"]); + assert.equal(home, "/Users/alan"); + assert.equal(abbreviateHome("/Users/alan", "/Users/alan"), "~"); + assert.equal(abbreviateHome("/Users/alan/repos/pipelines", home), "~/repos/pipelines"); + assert.equal(abbreviateHome("/Users/alanother/x", home), "/Users/alanother/x"); + assert.equal(abbreviateHome("/srv/work", home), "/srv/work"); + assert.equal(homeDirectoryFor(["/srv/work"]), ""); + assert.equal(abbreviateHome("/home/alan/x", homeDirectoryFor(["/home/alan/x"])), "~/x"); +}); + // --- History paging --------------------------------------------------------- test("mergeHistoryPage prepends an older page and dedupes by id", () => {