From 84e136436ced88720025b8ae0b4aec85bcfd2e2c Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Mon, 19 Oct 2026 20:03:56 +0100 Subject: [PATCH 1/3] =?UTF-8?q?web:=20app=20shell=20=E2=80=94=20left=20des?= =?UTF-8?q?tination=20rail,=20settings-hosted=20connection,=20viewport=20p?= =?UTF-8?q?anes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The layout item's work plus the two defects its review found: - the wide grid sized the list track from its MAX, so at 600-759px the detail pane was clipped to 40-199px; cap the list below 900px and narrow the rail there (measured now: detail 232px at 600, 332 at 700, 340 at 900, 880 at 1440); - the shell said 'Not connected' on a fresh page because the prefilled proxy URL validated; the status now reflects a SAVED endpoint ('Not configured' until then) and refreshes as the draft changes. Includes the rail + bottom dock, connection moved into Settings, viewport-only scrolling with panes that scroll themselves, tab semantics, skip link, h1 per route, and the design tokens. --- web/AGENTS.md | 5 +- web/PARITY.md | 22 +- web/README.md | 9 +- web/base.css | 345 ++++++----- web/chat.css | 33 +- web/design/tokens/tokens.css | 1 + web/index.html | 34 +- web/lists.css | 22 +- web/run-detail.css | 3 +- web/settings.css | 25 +- web/shell.css | 561 ++++++++++++++++++ web/src/app.js | 880 +++++++++++++++++++++------- web/src/connection.js | 11 +- web/src/graph.js | 19 +- web/src/shell.js | 107 ++++ web/src/views/attention.js | 37 +- web/src/views/chat.js | 26 +- web/src/views/pipelines.js | 26 +- web/src/views/runDetail.js | 25 +- web/src/views/runs.js | 3 +- web/src/views/search.js | 51 +- web/src/views/settings.js | 12 +- web/src/views/templates.js | 35 +- web/test/browser.mjs | 9 + web/test/shell.test.mjs | 96 ++++ web/test/ui-smoke.mjs | 1052 +++++++++++++++++++++++++--------- 26 files changed, 2619 insertions(+), 830 deletions(-) create mode 100644 web/shell.css create mode 100644 web/src/shell.js create mode 100644 web/test/shell.test.mjs diff --git a/web/AGENTS.md b/web/AGENTS.md index 3027b45a..5020ae65 100644 --- a/web/AGENTS.md +++ b/web/AGENTS.md @@ -28,13 +28,14 @@ not this one, decides whether a feature is done. | `src/serverUrl.js` | `data/transport/ServerUrl.kt` | `validateServerUrl`, `resolveArtifactUrl` | | `src/client.js` | `data/transport/PipelinesClient.kt` | one reused socket, id matching, timeout, backoff. **DOM-free** | | `src/repository.js` | `data/PipelinesRepository.kt` | typed request builders | -| `src/app.js` | `ui/**` | page shell: boot, state, client wiring, connection/banner, navigation/routes, render dispatch, header | +| `src/app.js` | `ui/**` | page shell: boot, state, client wiring, navigation/routes, render dispatch, persistent rail/workspace/dock | +| `src/shell.js` | `ui/WindowSize.kt`, `ui/components/DetailTabs.kt` | pure shell model: destinations, view/route mapping, roving-tabindex arithmetic, status words | | `src/dom.js` | — | `h()`, shared DOM helpers and clipboard/share actions | | `src/format.js` | `ui/Format.kt` (DOM-facing bits) | status tone and error-text helpers | | `src/views/*.js` | `ui/**` | one module per destination/dialog surface: attention, settings, pipelines, templates, runs, runDetail, chat, search, dialogs | | `index.html`, `*.css` | — | shell + area styles linked in a fixed order | | `serve.mjs` | — | static server + `/connect` proxy | -| `test/*.test.mjs` | `app/src/test/**` | `node --test`, no server needed | +| `test/*.test.mjs` | `app/src/test/**` | `node --test`, no server needed (including the shell/tab helpers) | | `test/smoke.mjs` | — | protocol smoke against a live server | | `test/browser.mjs` | — | zero-dep Chrome DevTools driver | | `test/ui-smoke.mjs` | UI review captures | live browser check + screenshots | diff --git a/web/PARITY.md b/web/PARITY.md index 3274dbb8..3d0150e9 100644 --- a/web/PARITY.md +++ b/web/PARITY.md @@ -13,9 +13,9 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu | --- | --- | --- | --- | | T1 | Server-URL entry + validation rules (`data/transport/ServerUrl.kt`) | — | done | | T2 | One reused socket, id matching, request timeout, not-connected guard (`PipelinesClient.kt`) | — | done | -| T3 | Connect / disconnect / manual reconnect | `ping` | done — connect/disconnect captured (`captures/28-connected-banner.png`, the header control reading `Disconnect` while connected); the `Reconnect` control appears beside the URL field while idle/disconnected with a configured endpoint and calls `client.connect`, which resets the attempt/backoff for an immediate re-open (`captures/29-disconnected-banner.png`). `Disconnect` stays available while connected | -| T4 | Backoff recovery + foreground reconnect after sleep/blur (`ConnectionRecovery.kt`, `ForegroundReconnector.kt`) | — | done — the client's capped backoff is surfaced honestly rather than rewritten: `captures/29-disconnected-banner.png` shows the banner `Disconnected: Connection closed (1006) · retrying with backoff` and the header state badge `disconnected — Connection closed (1006) (attempt N, retrying)`. The attempt number is deliberately **not** in the banner text — `ConnectionBanner.kt`'s own disconnected copy omits it (Android names the attempt only while Connecting) — so the page's badge carries it instead of diverging from the Android wording. The foreground-reconnect **decision** (`foregroundAction`) is unit-tested in `test/connection.test.mjs` (Idle→LeaveAlone; Connecting/Disconnected→Reconnect; Connected→`confirmedAlive ? LeaveAlone : Reconnect`); the **rendered recovery** is captured in `captures/30-reconnect-recovered.png`, where the page (asserted still `Disconnected:`) is pointed back at the live server and the browser's own `online` event drives it to a green Connected. The browser uses its `online`/`visibilitychange` event as the liveness signal, so a still-Connected socket is left alone (no in-page positive ping probe is needed; a documented deviation from `ForegroundReconnector`'s positive ping) | -| T5 | Connection banner + live badge; build/protocol mismatch warning | `pong` build/protocol | done — a persistent banner in normal document flow under the header (never overlaying content): green `Connected` + `Server build …` (`captures/28-connected-banner.png`) and `Disconnected: … · retrying with backoff` (`captures/29-disconnected-banner.png`); a minimal dot+word live badge in the runs list/detail (`live` / `reconnecting` / `not live`, per `LiveBadge.kt`/`RunStream.kt`, `captures/28-connected-banner.png`). The build line comes from the `pong` in `SettingsScreen.kt`'s own shape, `Server build {version} ({commit})`; a dirty tree is already marked in `version` by `internal/buildinfo` (`-dirty`), so no duplicate `+dirty` marker is added. The protocol-mismatch warning (shown only when both values are present and differ, naming both) is unit-tested (`protocolMismatch`) and not captured because the live server reports `protocol` 1, matching `PROTOCOL_VERSION` | +| T3 | Connect / disconnect / manual reconnect | `ping` | done — connection now lives only in the Settings Connection section (L2–L4 moved it out of the chrome). `Connect` is connect-only, `Disconnect` closes the shared socket, and `Reconnect` re-opens the validated endpoint immediately, resetting the client's attempt/backoff; all three drive the page's one client. Captured 2026-10-19: `captures/84-shell-settings-connection-1440x900.png` (the connected status card and the Disconnect/Connect pair) and `captures/L1-settings-idle.png` (idle: Connect + Reconnect). The shell's rail/dock dot+word control mirrors the state and is a Settings shortcut (`captures/85-shell-status-indicator-1440x900.png`); the old header URL field, Connect/Disconnect button and state badge are gone | +| T4 | Backoff recovery + foreground reconnect after sleep/blur (`ConnectionRecovery.kt`, `ForegroundReconnector.kt`) | — | done — the client's capped backoff is surfaced honestly rather than rewritten: `captures/29-disconnected-banner.png` shows the Settings status card `Disconnected` / `Connection closed (1006)` / `Retrying with backoff…`, while the shell's compact indicator reads `Disconnected`. The attempt number is named only while Connecting (`Connecting (attempt N)…`), matching `ConnectionBanner.kt`; the disconnected card deliberately omits it rather than diverging from Android's wording. The foreground-reconnect **decision** (`foregroundAction`) is unit-tested in `test/connection.test.mjs` (Idle→LeaveAlone; Connecting/Disconnected→Reconnect; Connected→`confirmedAlive ? LeaveAlone : Reconnect`); the **rendered recovery** is captured in `captures/30-reconnect-recovered.png`, where the page (asserted still `Disconnected`) is pointed back at the live server and the browser's own `online` event drives it to a green Connected. The browser uses its `online`/`visibilitychange` event as the liveness signal, so a still-Connected socket is left alone (no in-page positive ping probe is needed; a documented deviation from `ForegroundReconnector`'s positive ping) | +| T5 | Connection status + live badge; build/protocol mismatch warning | `pong` build/protocol | done — the full status card lives in Settings (never overlaying content): green `Connected` + `Server build …` + `Server time …` (`captures/84-shell-settings-connection-1440x900.png`), `Disconnected` + the server's message + `Retrying with backoff…` (`captures/L1-settings-disconnected.png`), `Connecting (attempt N)…` (`captures/L1-settings-connecting.png`) and idle `Not connected` (`captures/L1-settings-idle.png`). The shell keeps only a compact dot+word indicator (connected / connecting / disconnected / not connected / not configured) in the rail footer and the narrow bar; it is never colour-only. The protocol-mismatch warning is rendered in the same Settings Connection section (and remains unit-tested via `protocolMismatch`); no live mismatch is expected because the server reports protocol 1. A minimal dot+word live badge still marks the run stream in the runs list/detail (`live` / `reconnecting` / `not live`, per `LiveBadge.kt`/`RunStream.kt`). The build line comes from the `pong` in `SettingsScreen.kt`'s own shape, `Server build {version} ({commit})`; a dirty tree is already marked in `version` by `internal/buildinfo` (`-dirty`), so no duplicate `+dirty` marker is added | | T6 | Artifact URL resolution against the configured server (`resolveArtifactUrl`) | `GET /artifacts/…` | done (URL only) | ## Pipelines @@ -45,7 +45,7 @@ Status legend: `todo` · `partial` (some of it works) · `done` (working + captu | R12 | Cancel run | `cancel_run` | done — `src/actions.js` `canCancel` offers a `Cancel run` action only while the run is `executing`; the confirm dialog is the Android copy verbatim (title `Cancel run {id}?`, `This asks the server to stop the active run.`, confirm `Cancel run`, dismiss `Keep`), and the request is exactly `{type:'cancel_run',run_id}` followed by a silent `get_run` refresh (unit-tested in `test/repository.test.mjs`). Captured `captures/40-run-459-cancel-confirm.png` on the executing run present at capture time. **Shown, not executed**: the only candidate was another live pipeline's executing run, so the dialog was shown and dismissed with `Keep` — no `cancel_run` was sent (a real cancel is only safe against a run started in a scratch workspace, which this stage did not do) | | R13 | Retry failed stage (resume) / restart from start | `retry_run` | done — `canRetry` is true only for a loaded, non-executing, `failed` run; the Retry confirm is the Android copy verbatim (title `Retry run {id}?`, `Only failed runs can be retried. The server starts a new run from the same input.`, confirm `Retry`, dismiss `Keep`) and the default send carries only `run_id` + a fresh `request_key` (**no** `retry_mode`, so the server's `resume` default applies exactly like the Android client's mode-less call; unit-tested). Captured `captures/35-run-440-run-actions.png` (failed run 440 offers Retry and no Cancel) and `captures/36-run-440-retry-confirm.png`. **Divergence from the Android UI, stated here**: Android exposes resume only while the protocol has both modes, so the browser adds a clearly-labelled secondary `Restart from start` confirm that states it `replays the whole pipeline from the start instead of resuming the failed stage` and sends `retry_mode:"restart"` (`captures/37-run-440-restart-confirm.png`). Both dialogs were shown and dismissed with `Keep`; no run was started | | R14 | Rename a run | `set_run_title` | done — an inline field on the Summary title row (pre-filled with the current title, `Rename` / `Save` / `Cancel`) sending exactly `{type:'set_run_title',run_id,title}` and then refreshing the run and the runs-list row (unit-tested). Captured `captures/38-run-440-rename-field.png`. The one shared `Action failed` dialog was exercised by a real refused rename: `captures/39-run-440-action-failed.png` shows the live server's exact reason `a title with usable text is required` (a blank title mutates nothing). **Divergence from the Android UI, stated here**: Android does not surface `set_run_title` at all (its README records the deliberate omission), so this control is browser-only | -| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | done — the pure `src/attention.js` model mirrors `ui/Attention.kt` and feeds a bell action in the top bar (badge only when non-empty; accessible name `Notifications` / `Notifications, {n} needing attention`) and a bottom sheet titled `Needs you` in `src/app.js`. Only a `waiting` run (kind Decision, rank 0) and a `failed` run (kind Failed, rank 1) qualify; order is kind rank, then recency descending (`finished_at` else `created_at`), then run id descending. Rows carry a status icon, the trimmed-title-else-pipeline label, the exact `{pipeline} · {detail}` line (`Waiting for your decision`, or the trimmed diagnostic else `Run failed`) and a trailing `Dismiss`; tapping a row opens the run, dismissing a Failed row first while a Decision row is left for its answer. Clear all acts only on the snapshot taken when the sheet opened; dismissals persist as one JSON array of `{runId}:{kind}` identities under `pipelines.web.attention.v1` with no expiry (blank/unreadable storage decodes to empty and never throws). Entries are derived from `list_runs` here; R10 will feed the same pure model the pushed `run_event` summaries, with no wording or ordering change. Captured 2026-10-19: `captures/35-attention-bell.png` (bell + badge on the Runs list), `captures/36-attention-sheet.png` (the open sheet), `captures/37-attention-dismissed.png` (one entry individually dismissed, badge 171→170), `captures/38-attention-cleared.png` (Clear all: the empty copy, no Clear all, badge gone). No run was parked in `waiting` on the live server at capture time, so the sheet is exercised with real failed runs and the decision-open path is unit-tested | +| R15 | Attention / "Needs you" surface: counts, open, individual dismiss, clear all | derived from `list_runs` + run events | done — the pure `src/attention.js` model mirrors `ui/Attention.kt` and feeds a bell action in the Runs list heading (badge only when non-empty; accessible name `Notifications` / `Notifications, {n} needing attention`) and a bottom sheet titled `Needs you` in `src/app.js`. Because the shell has no global top bar, the same count is mirrored as a badge on the Runs destination in the rail/dock, so an operator on Pipelines, Chat or Settings can still see that something needs attention without opening Runs; the bell itself stays the Runs-local entry point. Only a `waiting` run (kind Decision, rank 0) and a `failed` run (kind Failed, rank 1) qualify; order is kind rank, then recency descending (`finished_at` else `created_at`), then run id descending. Rows carry a status icon, the trimmed-title-else-pipeline label, the exact `{pipeline} · {detail}` line (`Waiting for your decision`, or the trimmed diagnostic else `Run failed`) and a trailing `Dismiss`; tapping a row opens the run, dismissing a Failed row first while a Decision row is left for its answer. Clear all acts only on the snapshot taken when the sheet opened; dismissals persist as one JSON array of `{runId}:{kind}` identities under `pipelines.web.attention.v1` with no expiry (blank/unreadable storage decodes to empty and never throws). Entries are derived from `list_runs` here; R10 will feed the same pure model the pushed `run_event` summaries, with no wording or ordering change. Captured 2026-10-19: `captures/35-attention-bell.png` (bell + badge on the Runs list), `captures/36-attention-sheet.png` (the open sheet), `captures/37-attention-dismissed.png` (one entry individually dismissed, badge 171→170), `captures/38-attention-cleared.png` (Clear all: the empty copy, no Clear all, badge gone). No run was parked in `waiting` on the live server at capture time, so the sheet is exercised with real failed runs and the decision-open path is unit-tested | Two wording decisions in R3's stage pane, recorded here as the app-authoritative choice: the visit's exported session is titled **Session** (the item text said @@ -76,7 +76,7 @@ rename's exact server reason and, under `--decide`, the full live decision flow. ## Search | # | Feature | Protocol | Status | | --- | --- | --- | --- | -| S1 | Omni-search across pipelines, versions, runs, steps, fields, artifacts | `search` | done — the top bar's `Search` control opens a full-width panel under it (field autofocused, placeholder `Search pipelines, runs and artifacts`, a `Close search` control; opening and closing leave the current view, selection and loaded data untouched, and Escape closes the field). One flat result list with no kind grouping, over a controls row: the kind select (`All kinds`/`Pipelines`/`Runs`/`Steps`/`Fields`/`Artifacts`/`Versions`), the sort select (`Relevance`/`Newest first`/`Name`), the one-line `{Kind} · {Sort}` summary and a `Clear filter` reset. The request is exactly `{type:"search",search:{query,kind,limit:0}}` — the server's own default cap, never above `SearchMaxLimit` 200 — debounced 250 ms after the last keystroke with Enter sending at once; a blank query clears locally with no request; the previous results stay visible (a thin progress bar above them) while a newer query loads and a stale reply is dropped by token; the first load shows the spinner and `Searching…`; an error takes precedence over the results. Failure copy is `AppViewModel`'s: a rejection naming an unknown command, or an older server's reply without `search_results`, reads `This server does not support search. Update the Pipelines server, then try again.` and any other failure carries the server's own text. Row text and blank fallbacks mirror `OmniSearchResults.searchRow` (a field hit's snippet emphasises the first case-insensitive query occurrence, never via `innerHTML`) and the empty state keeps Android's `No matches for "{query}".` / `No {kind} match "{query}".`. Captured 2026-10-19: `captures/01-search-results.png` (flat mixed list for the query `plan`, the controls row and summary `All kinds · Relevance`), `captures/02-search-kind-filter.png` (the `Pipelines` filter narrowing the list and the summary to `Pipelines · Relevance`) | +| S1 | Omni-search across pipelines, versions, runs, steps, fields, artifacts | `search` | done — the shell's `Search` control (rail on wide, dock on narrow) opens a full-width panel in the workspace flow (field autofocused, placeholder `Search pipelines, runs and artifacts`, a `Close search` control; opening and closing leave the current view, selection and loaded data untouched, Escape closes the field and returns focus to the Search control). One flat result list with no kind grouping, over a controls row: the kind select (`All kinds`/`Pipelines`/`Runs`/`Steps`/`Fields`/`Artifacts`/`Versions`), the sort select (`Relevance`/`Newest first`/`Name`), the one-line `{Kind} · {Sort}` summary and a `Clear filter` reset. The request is exactly `{type:"search",search:{query,kind,limit:0}}` — the server's own default cap, never above `SearchMaxLimit` 200 — debounced 250 ms after the last keystroke with Enter sending at once; a blank query clears locally with no request; the previous results stay visible (a thin progress bar above them) while a newer query loads and a stale reply is dropped by token; the first load shows the spinner and `Searching…`; an error takes precedence over the results. Failure copy is `AppViewModel`'s: a rejection naming an unknown command, or an older server's reply without `search_results`, reads `This server does not support search. Update the Pipelines server, then try again.` and any other failure carries the server's own text. Row text and blank fallbacks mirror `OmniSearchResults.searchRow` (a field hit's snippet emphasises the first case-insensitive query occurrence, never via `innerHTML`) and the empty state keeps Android's `No matches for "{query}".` / `No {kind} match "{query}".`. Captured 2026-10-19: `captures/01-search-results.png` (flat mixed list for the query `plan`, the controls row and summary `All kinds · Relevance`), `captures/02-search-kind-filter.png` (the `Pipelines` filter narrowing the list and the summary to `Pipelines · Relevance`) | | S2 | Result routing (open the pipeline, run, stage, artifact) | — | done — every selection closes and clears the search first, then routes through the page's existing navigation: a pipeline/version hit opens the pipeline detail at the result version (version 0 = latest); a run hit opens the run detail; a text hit opens the run-detail tab holding the match, resolved from the hit's `matched_field` (`input` → Input, `output` → Output, else Summary — the browser item's deliberate rule, not the recorded field name); a step or artifact hit opens the recorded visit's stage pane (the zero-based visit index within the stage, falling back to the plain run detail when the visit cannot be located); an unknown/absent payload is read-only and never navigates. Captured 2026-10-19, each with the routed destination asserted in the smoke run: `captures/03-search-route-pipeline.png` (`pipeline:24:v5` → `Plan and land` detail), `captures/04-search-route-run.png` (`run:457` → Runs detail), `captures/05-search-route-field.png` (`run:458:3`, `matched_field input` → the Input tab active), `captures/06-search-route-step.png` (`run:457:1` → the `planner` visit stage pane), `captures/07-search-route-artifact.png` (`/artifacts/355/2/…` → the `implementer` visit pane), `captures/08-search-route-version.png` (`pipeline:22:v6` → the `Server` detail) | Two wording decisions in Search, recorded here as the app-authoritative choices: @@ -97,7 +97,7 @@ the pipeline list already carries — rather than a pluralised verb. | C7 | Markdown rendering + code blocks | — | done — captured 2026-10-19: `captures/45-chat-transcript-newest.png` (opened at the newest content: bold, bullet lists, a `|` table with its `---` delimiter row and inline code spans from the live assistant answer), `captures/47b-chat-markdown-code.png` (a rendered fenced code block — label `js`, the pre body `const answer = 42;` — drawn in the live browser by the page's own `renderMarkdown`, the same function that renders the answer) and `captures/47-chat-reasoning-code.png`. The subset is exactly `Markdown.kt`: paragraphs, `#`–`######` headings, fenced code (```/~~~, the language label else `code`), block quotes, bullet/ordered lists, `|` tables with a `---` delimiter row, thematic rules, inline code, bold, italic (underscore only at word boundaries, so `snake_case` stays plain), `[label](url)` links and bare http(s) autolinks; HTML entities are decoded first in one pass, and HTML, reference links, strikethrough and nested lists render as plain text and are never dropped. **Code-block caveat, stated plainly**: the live assistant answer carries **no** fenced block — its four fences live in the reasoning transcript, which the app draws as plain text, not as markdown (`captures/47-chat-reasoning-code.png` shows one such fence as muted plain text; that is C6 material, not the markdown path). So the rendered `
` code block is captured from a labelled sample through the page's real renderer (`47b`), and the same path plus its `code`-else-language label is unit-tested in `test/markdown.test.mjs`. Only `http(s)` link targets become clickable — the transcript is untrusted model output, so a `javascript:`/`data:` target renders as its label, never as a live link |
 | C8 | Composer: send, stop, attachments, draft | `chat_prompt`, `chat_interrupt` | done — the composer at the foot of an open conversation: a growing 1–6-row `