From ce3bacb4af5cf83db5a0765b317dbcfcaae23a6e Mon Sep 17 00:00:00 2001 From: "nekomimi.pet" Date: Mon, 19 Oct 2026 18:46:23 -0400 Subject: [PATCH] web: albedo's faces and voice, as in the terminal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The web client now speaks like the TUI. moods.ts ports moods.go exactly (the pools, their order and the seeded FNV-1a pick), so a finished turn signs off with the same kaomoji in both clients, and a running session shows an animated face for what it is doing, on one shared clock for the whole page. A turn's thinking and tool calls read as the terminal's one past-tense line, written from each call's trace (thought 12s · read tui/{chat,moods}.go · ran go test ×2, +12 −3). Speakers are named albedo and you, with a note after a long pause; sessions group as pinned, today and this week; copy is lowercase. Albedo's mauve becomes the default accent, with the earlier accents still in settings; saved theme and dots carry over to the new preferences key. --- robot-docs/web.md | 4 +- web/index.html | 4 +- web/src/App.svelte | 49 +++++---- web/src/app.css | 51 ++++++--- web/src/lib/Canvas.svelte | 12 +- web/src/lib/LiveFace.svelte | 34 ++++++ web/src/lib/Rail.svelte | 54 ++++++--- web/src/lib/Settings.svelte | 18 +-- web/src/lib/boards.svelte.ts | 4 +- web/src/lib/burst.ts | 157 +++++++++++++++++++++++++++ web/src/lib/chat/Chat.svelte | 94 +++++++++++++--- web/src/lib/chat/Composer.svelte | 6 +- web/src/lib/chat/WorkSteps.svelte | 83 ++++++++++---- web/src/lib/live.svelte.ts | 37 +++++++ web/src/lib/moods.ts | 113 +++++++++++++++++++ web/src/lib/nodes/SessionNode.svelte | 7 +- web/src/lib/prefs.svelte.ts | 24 ++-- web/src/lib/transcript.svelte.ts | 84 ++++++++++++-- 18 files changed, 704 insertions(+), 131 deletions(-) create mode 100644 web/src/lib/LiveFace.svelte create mode 100644 web/src/lib/burst.ts create mode 100644 web/src/lib/live.svelte.ts create mode 100644 web/src/lib/moods.ts diff --git a/robot-docs/web.md b/robot-docs/web.md index 64b8e167e..d7a37f643 100644 --- a/robot-docs/web.md +++ b/robot-docs/web.md @@ -16,7 +16,9 @@ Words: a **board** is a named canvas of panels, and the open boards are the tabs A board is an open canvas. **Windows** sit anywhere on it; the view pans freely and zooms out to an overview. Svelte Flow draws, drags and resizes the windows; `board.svelte.ts` places new ones (right of the selected window, top-aligned, stepping past overlaps) and owns the viewport. The wheel is handled in `Canvas.svelte` rather than by Svelte Flow, because windows and canvas share the trackpad: a pinch (ctrl-wheel) zooms around the pointer anywhere, an up-down scroll over a window that can scroll scrolls it while the zoom is readable (60% and up), and every other scroll pans. ⇧1 fits all windows, ⇧0 returns to 100%, M shows an overview map, ⌥←/⌥→ moves between windows. What a window shows is a **view**: today a session's chat; files, diffs, terminals and agent-made pages are meant to be further views beside it, each framed by `nodes/WindowFrame.svelte`. -Design rules the client keeps (from the design pass): surfaces separate by a step in tone, not by lines; only what floats (windows, the palette, the view controls, the overview map) casts a shadow; one accent (pine), used for focus and for work in progress; no status dots: a running session says "working" in words that breathe (`.working` in `app.css`); monospace only for code and tool commands. The canvas has sparse, faint dots that fade out below 75% zoom, before they can crowd into a texture. +Design rules the client keeps (from the design pass): surfaces separate by a step in tone, not by lines; only what floats (windows, the palette, the view controls, the overview map) casts a shadow; one accent, albedo's mauve by default, used for focus and selection; no status dots; monospace only for code and tool commands. + +The client shares the terminal's voice. `moods.ts` is a port of `cli/internal/tui/moods.go` (its pools, their order and the seeded FNV-1a pick), so a finished turn signs off with the same kaomoji in both clients: its seed is the turn's last entry time in milliseconds, and its class comes from how long it took. A running session shows an animated face for what its activity says (thinking, working, responding), one shared 500 ms clock for every face on the page (`live.svelte.ts`). `burst.ts` writes a turn's thinking and tool calls as the terminal's one past-tense line (`thought 12s · read tui/{chat,moods}.go · ran go test ×2 +12 −3`), from each call's trace, fetched when the line scrolls into view. Speakers are named as in the terminal: "albedo" in mauve, "you" in teal, with "2h later" after a pause of 30 minutes or more. Copy is lowercase, and empty and error states carry a face. The canvas has sparse, faint dots that fade out below 75% zoom, before they can crowd into a texture. Settings (the sliders button at the top right, or ⌘,) is a non-modal pane over the board: theme (follow the system, the default; light; dark), accent (pine, lake, clay, graphite) and the canvas dots. They live in this browser (`prefs.svelte.ts`, `albedo.prefs.v1`). The resolved theme and accent are attributes on `` (`data-theme`, `data-accent`) that `app.css` keys every token on; a small script in `index.html` sets them before the first paint so a saved dark theme never flashes light, and `prefs` follows system changes while the theme is `system`. diff --git a/web/index.html b/web/index.html index 0f95031cc..f2ea98a12 100644 --- a/web/index.html +++ b/web/index.html @@ -9,10 +9,10 @@ // Apply the saved theme before the first paint, so a dark choice never flashes light. (() => { let prefs = {}; - try { prefs = JSON.parse(localStorage.getItem('albedo.prefs.v1') || '{}'); } catch {} + try { prefs = JSON.parse(localStorage.getItem('albedo.prefs.v2') || localStorage.getItem('albedo.prefs.v1') || '{}'); } catch {} const theme = prefs.theme === 'light' || prefs.theme === 'dark' ? prefs.theme : matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; document.documentElement.dataset.theme = theme; - document.documentElement.dataset.accent = prefs.accent || 'pine'; + document.documentElement.dataset.accent = localStorage.getItem('albedo.prefs.v2') ? prefs.accent || 'albedo' : 'albedo'; })(); diff --git a/web/src/lib/Rail.svelte b/web/src/lib/Rail.svelte index 9b122673d..7676ac0a1 100644 --- a/web/src/lib/Rail.svelte +++ b/web/src/lib/Rail.svelte @@ -2,6 +2,7 @@ import type { Session } from './api'; import { boards } from './boards.svelte'; import { ago, homePath, matches, place } from './format'; + import LiveFace from './LiveFace.svelte'; import { sessions } from './sessions.svelte'; let { search = $bindable() }: { search?: HTMLInputElement } = $props(); @@ -10,8 +11,26 @@ const visible = $derived( sessions.list.filter((session) => !session.preferences.archived && (!query || matches(query, `${session.name} ${place(session.workspace)}`))), ); - const pinned = $derived(visible.filter((session) => session.preferences.pinned)); - const recent = $derived(visible.filter((session) => !session.preferences.pinned)); + // Grouped as the terminal groups them: pinned, then by when they last moved. + const DAY = 86_400_000; + const sections = $derived.by(() => { + const midnight = new Date().setHours(0, 0, 0, 0); + const when = (session: Session) => Date.parse(session.activity_at ?? '') || 0; + const named: [string, (session: Session) => boolean][] = [ + ['pinned', (session) => session.preferences.pinned], + ['today', (session) => when(session) >= midnight], + ['this week', (session) => when(session) >= midnight - 6 * DAY], + ['earlier', () => true], + ]; + const left = [...visible]; + return named + .map(([label, belongs]) => { + const rows = left.filter(belongs); + for (const row of rows) left.splice(left.indexOf(row), 1); + return { label, rows }; + }) + .filter((section) => section.rows.length); + }); const onBoard = $derived(new Set(boards.board?.nodes.map((node) => node.data.sessionId))); function submit(event: SubmitEvent) { @@ -23,21 +42,17 @@