Web client #
The Svelte client in web/ uses the daemon through the
local web server. It shares session behavior with the terminal client.
Server and authentication #
albedo web runs the sibling albedo-web
executable, which starts or connects to the web server. The executable accepts
the same options when invoked directly.
webui.Server serves the built client and
uses a launch key to sign a browser in with an HTTP-only, same-site cookie.
--new-link rotates the key. The server checks the request host and checks the
origin of API requests. Hosts and origins compare in the form a browser writes
them (origin.go): lower case, without the
scheme's default port, and an IPv6 literal in the URL Standard's compressed
form, so a --public-url naming [0:0::1] matches the [::1] a browser sends.
The browser calls /api. The server removes that prefix, strips browser
credentials and origin headers, and adds the daemon bearer token before
forwarding. The daemon token is not sent to the browser. A page script with the
web cookie can still make API requests, so the server's content security policy
and the client's handling of untrusted transcript content are security
boundaries. Static files are read from disk on each request, while appPolicy
(including 'wasm-unsafe-eval' in script-src for the WebAssembly Markdown
renderer) lives in the running albedo-web binary.
backgroundWeb reuses a live gateway
instead of replacing it, so updates to albedo-web take effect after
albedo web --stop and restart.
Gateway lifecycle #
albedo web install installs a login service on Linux or macOS and waits for
the gateway to listen. The default is loopback on port 4317. Use --port and
repeatable --allow on the install command to choose its listener. Installing
again writes the definition for its next load and preserves the current process
or stopped state. A refresh from another shell keeps the saved
ALBEDO_WEB_DIST, ALBEDO_DAEMON, and ALBEDO_ROOT overrides when that shell
supplies no replacement. On macOS, stopping and starting the CLI service reloads
the plist. Stop a detached gateway before installing.
On Linux, retrying an install that left the unit disabled enables and starts it. An enabled, stopped unit stays stopped on refresh. The CLI checks for systemd drop-ins before controlling an existing CLI registration and refuses unsupported overrides. Web service discovery owns these checks.
albedo web status and status --json inspect the service registration,
manager state, and live listener without starting a daemon. albedo web --stop
stops the gateway. albedo web uninstall removes the CLI registration. The
older --allow … --save and --save commands still save and forget the
daemon's network preferences. Home Manager owns its own service definition. See
Home Manager web service.
Session navigation #
On phones, the session picker opens the chosen chat and dismisses the drawer even when that chat is already visible. Phone history adds an entry when the selection changes. On desktop, the app palette shows a chosen session in full screen when a full-screen chat is already open.
The session store looks up records that are outside the session list when a chat opens. If the client learns about the session while that lookup is pending, the open uses the record the client already holds.
Session filters #
A session query in the sidebar, the app palette, or the phone picker may carry
filter tokens: is:worktree, is:pinned, is:archived, each negated with a
leading -, and wt for worktree.
parseQuery takes them out and leaves the
text, which the client matches itself.
FilterMenu opens a dropdown from the
funnel at the end of each search field. It opens upward from the phone picker.
FilterChips shows active tokens
separately from the search text. Click a chip to flip a default or clear an
override. FilterSuggest offers token
completions. The tokens become the daemon's worktree, pinned, and archived
list parameters. See HTTP sessions.
The sessionFilter browser preference holds default tokens, -is:worktree
unless changed. The session store lists
under them, and while the default only leaves worktrees out, adds the pinned
sessions it would drop so a pin never disappears. A typed token replaces the
default for its field. When that makes the filter differ from the default,
SessionSearch asks the daemon for
it, fifty at a time, and the sidebar asks for the next page as its end scrolls
into view. Otherwise the shared list serves the query. Do not filter a list in
the client by a field the summary does not carry, since the list holds only the
newest sessions.
New session uses only the saved worktree filter when asking for recent workspaces. It does not filter directories you browse or paths you enter.
Streams and artifacts #
stream.ts validates batches for session and
collection follows on both transports. A session reset applies its snapshot
before any events that follow it in the batch. The client ignores event types it
does not consume and still advances the session cursor after handling the batch.
Each WebSocket attachment has its own key. On resume, the browser keeps the last
consumed cursor and ignores frames for the stopped attachment, including its end
acknowledgement. Terminal failure batches leave that cursor intact. With SSE
fallback, hiding the tab cancels foreground follows waiting for a connection
slot as well as open connections.
The client also renders artifacts, which have a separate /frame/ path in
Server.ServeHTTP. The frame handler applies
sandbox headers and forwards artifact requests separately from authenticated
/api requests. See artifacts for their execution boundary.
DisplayView.svelte,
DisplayNode.svelte, and
display.ts render display trace activities from
display(content, title=, description=) as unified diffs, highlighted code, or
Markdown, opening a window on the canvas or in the zen desk / phone dock when a
live turn produces one (Transcript.displayed, Board.displayShown).
markdown.ts renders Markdown with Words
(@pierre/words), a WebAssembly parser, which is why the page's policy allows
'wasm-unsafe-eval' (appPolicy in
server.go). markdownView patches the DOM
as a streamed reply grows: completed blocks stay and only the open end is parsed
again. Words drops raw HTML, so prepareMarkdown first writes tag-shaped text
outside code and maths as <, and the reply shows Vec<String> or <think>
as written; it also turns \(…\) and \[…\] maths into the dollar delimiters
Words reads. Words draws maths as SVG itself; Mermaid diagrams go to Pele, and
code blocks that name their language to Pierre's highlighter
(@pierre/highlights), each loaded with the first block that needs it.
vite.config.ts stubs that highlighter only for @pierre/diffs. Links keep
only web and mail addresses and open in a new tab, and images become links
rather than loading. HTML hooks turn off Words' fastest streaming path, so a
reply carries only the hooks its text needs, and a streamed one leaves out the
scroll box for display maths until it ends. Do not add raw-HTML options or hooks
that pass text through unescaped.
Unread chats #
notifications.svelte.ts marks pinned
sessions and chats on open boards unread when a turn ends, a blocking reason
changes, or agent mail arrives. One shared session-summary stream covers roots
and child agents, including chats on inactive boards. Records for chats on all
open boards load independently of their windows. Initial loads do not mark old
answers unread.
Dots appear beside chat titles and on their containing tabs and board tabs. A rim light plays once unless the chat's board is visible or the chat is open full-screen or on a phone. The browser window need not have keyboard focus. Hidden chats in a visible board stay quiet too. Leaving the board does not replay a skipped flash. Reduced-motion mode keeps the dots without the rim light.
Selecting a chat in the focused browser window clears only that session. Returning to the browser does not clear other chats. The browser title and favicon count the same unread sessions. These cues need no system-notification permission and reset on page reload.
Chat attachments #
The chat composer attaches images and other files from its picker, from paste,
and from a drop anywhere on the chat. main.ts stops a
file drop outside a chat from navigating the page. Images appear as tiles in the
editor. Other files appear as removable cards with a name and size.
Composer.svelte and
Chat.svelte own this presentation.
On phones, an empty unfocused composer shows one row with the message field, the attachment button, and Send or Stop controls. Focusing the field expands it to show model and reasoning controls. Drafts, attachments, pending reads, notices, and edits keep it expanded. Moving focus into its toolbar or picker does not collapse it. Desktop composers keep their existing layout, unless the browser preferences turn on both compact title bars and the compact composer: then a window's composer rests the same way at any width, with the context meter still in sight. The composer uses the user-message bubble color instead of a persistent outline. Controls in a composer use text and icons without pill backgrounds, including the view openers compact title bars move there. In a title bar, the same controls sit on chips. Every composer keeps the same places: context, model and view openers at the start of its row, and the attachment, pop-out and Send at the end, resting or not.
attachments.ts reads files and checks
the browser limits in attachmentProblem: ten images, ten other files, and 20
MiB of decoded bytes for both kinds together. These limits keep a send inside
what the daemon accepts. They are not authorization. The daemon checks its own
bounds and can still reject a send. See
input admission.
Draft owns the attachments of an unsent
message, by session, so they survive a board switch. It reads files one at a
time and reports the result even if the composer unmounted meanwhile.
Draft.reading and Draft.problem block Send while a read is pending or the
selection is over a limit. The send handler checks again before it clears the
draft. Do not clear a draft before that check, and do not drop files to fit a
limit. Let the user remove or split them. Moving a draft into a canvas note
moves its prose. Image tiles and file cards stay in the chat.
Attachment bytes live only in memory. The draft text is saved to localStorage
without its [Image #n] markers, and a page reload loses its images and files.
Other text is kept as typed. Literal text that looks like a file label, such as
[File #1: notes.txt], stays in the draft and the message.
Generic files require a local workspace, because the daemon saves them on its own host and gives the model their path. For a remote-workspace session, the composer accepts images and refuses other files. The daemon rejects them too.
Transcript keeps a pending send's
payloads in memory. A reload drops that copy, including a failed send that was
waiting for retry. Retry resends the same input ID with the same text and
attachments. Transcript uploads each image or clip as its own bytes through
uploadMedia before the message that names it, keeping one upload ID per
attachment so a retry repeats the same intent. A failed upload fails the send
like a refused message. See media uploads. When a stop
cancels queued sends, Transcript.take returns them and Draft.restore appends
their text and attachments to the draft. A restored selection can exceed the
limits, so Send stays blocked until the user removes some. A committed message
shows file cards only from the history entry's files metadata, never from its
text. Images use the entry's image references. Saved bytes can expire while the
history remains. See
saved pastes and uploads and the
uploaded-file rules.
While a reply streams, Transcript keeps the live text or thinking visible
until a successful history read takes over. History can arrive ahead of the
stream notification. The first remaining live segment’s history boundary
determines which durable replies the chat can already show.
If the first history read fails, a later successful poll can open the
transcript. Transcript uses that newest page's older cursor and clears the
load error.
In the chat list, the reader's current row stays mounted while an older page changes the virtual range. When the reader scrolls up, the chat uses that row's measured position to hold their place. When a chat remounts, it loads pages until it finds the saved row, mounts that row, and returns to the saved fraction of its height.
VirtualList owns the room the undrawn
rows take: padding above and below the drawn rows, and a margin above a row that
follows a gap. It sets that room from the rows in the DOM before it measures
them or the chat reads the reader's place. The markup must not compute it.
Svelte can add and drop rows a flush before it updates the rows it keeps, and
room computed there was a whole chat off when the place was read, which sent the
reader to the end.
QueuePanel.svelte sits above the
composer while anything waits in the session's inbox. It lists what
waits, in the order the session will read it, and drops, reorders, or clears it
through the queue routes. Transcript.queue holds that list and reads it again
when the stream says the queue changed. A send the inbox holds leaves the
transcript's pending rows and shows only in the queue until it is committed.
WorkSteps.svelte also renders images
from tool results, including show_image, using their history image references.
Audio and video clips, in messages and tool results, play in
Clips.svelte instead (see
audio and video input). These previews remain visible when tool
details collapse. Both message attachments and tool strips build thumbnail src
and srcset attributes through thumbnailSource in
transcript.svelte.ts, requesting
?edge=256 at 1x and ?edge=512 at 2x (served as lossy WebP) when an image is
larger, and decode asynchronously so Chrome caches thumbnail bitmaps rather than
full-resolution screenshots. Modified clicks and
ImageGallery.svelte keep the
original full-resolution image URL; the gallery mounts only the active slide and
its immediate neighbors. Selecting an uploaded image or tool preview opens the
shared ImageGallery.svelte
full-screen viewer, modelled on the Bluesky web client's lightbox. It browses
the existing image strip: one message for uploads, or one tool-work stretch for
tool images. The side buttons, Left/Right arrow keys, and a sideways drag page
through it without wrapping. Double-click or double-tap, a pinch, or Ctrl-wheel
zooms, and a zoomed image pans. A vertical swipe, a click beside the image,
Escape, or Close dismisses it and returns focus to the selected preview. A tap
toggles the controls. The options menu opens the original in a new tab,
downloads it, or shares or copies its link. Modified clicks keep the original
image URL available in a new tab.
lightbox.ts holds the gesture and spring
state, a port of the @oomfware/lightbox engine with no DOM. Markdown image
syntax remains a link, not an automatically loaded remote image.
Context controls #
ContextChip.svelte owns the chat's
context popup and undocked context meter. Its strategy menu selects a
compaction strategy and independently toggles the notes layer
for that session. These choices do not change global defaults. Changes made
during a turn queue until the session is idle, then save and reload its
extensions before any queued compaction. Its breakdown splits media into images,
audio and video by the context summary's media_tokens
(context inspector).
Reasoning controls #
ModelPicker.svelte places the model
and reasoning words beside the composer in canvas windows, focused chats, and
phone chats. The title bar keeps view openers. The compact composer preference
moves a window's model and context controls up to its title bar, unless title
bars are compact too. A bar too narrow for its chips folds them into its window
menu. Undocked controls use the same selection and save lane. Bare monochrome
provider marks reuse
ProviderIcon.svelte and its
extension and endpoint mapping beside the selected model and picker group
headings. On phones the model picker opens a native modal sheet that follows the
visual viewport above the keyboard. Opening the sheet focuses its close button;
search opens the keyboard only when tapped. Dialog and menu touches do not start
the phone composer's session-drawer gesture.
EffortBar.svelte opens a level menu
directly above its button. The menu floats out of a canvas window's clipping and
accounts for chat zoom. On phones it is a bottom sheet. The actual default level
carries its source annotation. Choosing that row returns to following the
default. Unknown defaults stay unknown. Arrow keys move focus, Enter selects,
and Escape closes without saving. Model details contain the profile-bypass
action. Changes affect this session. Profile defaults are under settings,
providers, advanced.
During session creation, selecting a model advances to the task. Its reasoning
word opens the same menu. The model lists and composer prefer catalog display
names, with the API ID as a fallback. The model names browser preference picks
IDs, lowercase names, or names as the catalog writes them, everywhere, through
modelName, effortName and nameCase in
modelEffort.ts. Only IDs join the model and
its level with a colon. IDs and catalog names both remain searchable, and IDs
appear in model row tooltips. Models owns
persisted choices and provider resolution.
Menus #
Menu.svelte is the one dropdown: the window
menu, the view openers' lists (through
MenuButton.svelte), the reasoning menu,
the compaction strategy menu and the image viewer's options. It owns the pane,
the row style (.item buttons and links, or buttons straight in a list item), a
row's trailing .note, closing on an outside press or Escape, the arrow keys,
and giving the focus back to its button. Opening one focuses the pane, not a
row, so a click shows no focus ring, unless something inside already took the
focus. wide gives a pane that holds its own content instead of rows, like the
model picker's search on desktop, the same look without the row-sized width and
height. Use it for a new dropdown instead of styling another pane. The fold pane
of a row of controls and the phone's model sheet are not menus.
Scrolling tiles #
On a tiled board, the dock uses the outermost left and right edges of a column for insertion. The insertion line moves a whole column with its width or gives a window taken from a stack or tabs its own column at the width it had before the drag. A half-tile preview still splits the target.
The layout tree keeps the widened row's span in board-width units. BoardView positions that row inside a clipped viewport. The board has no scrollbar or pan gesture. Each open board keeps its strip offset across board switches. Shift with wheel down or up focuses the next or previous column, starting from the selection rather than the pointer. Selecting a fully visible window leaves the view still. Selecting a window outside the viewport reveals it by its hidden edge. Scrolling inside a chat or code view belongs to that window, not the board. Ctrl+Shift with wheel down or up steps through open boards, wrapping at the ends.
The optional Focus on hover browser preference selects a tiled window when the mouse moves into it, without revealing its column. Clicking the same tile still reveals it. An editor keeps its typing focus. Moving the view under a stationary pointer does not take selection back from the wheel.
A Ctrl + right-button grab fixes the
edges from the initial press. The web client reserves
Ctrl + right-click throughout the app and popout documents, even outside a
board. An unmodified right-click keeps its menu.
planResize measures the outer column's width
and the nearest vertical split's height once. Horizontal grabs snap the column
to half the viewport minus half a gutter, or align the moving edge with either
visible board edge. A reachable board edge wins over a half-width stop within
its release distance. Offscreen half-width stops are not offered. The targets
are measured at press time, before a left-edge drag moves the camera. A
left-edge drag offsets the view by the width change to keep the opposite edge
still. The root row can be narrower than the viewport, even with only one
window. Stacked siblings share the remaining height subject to their minimum
sizes. When a grab moves a horizontal divider, it can snap to the height of a
visible divider in the branch immediately to its left or right. Only the grabbed
stack changes. BoardView draws a labeled guide from the snap held by the resize
planner. Both axes use the visible board width at the start of the grab. Snaps
engage within 1.2% of that width (up to 12 CSS pixels) and release past 2% (up
to 20). The guides are part of the drag preview, never the saved layout. Release
records one undo step in Board.finishResize. Escape or lost capture discards
the preview.
Plain drags on a tiled split handle use
the same guides and snap distances. planGutter changes only the two shares
beside the handle. Their total, the strip width, and other shares stay fixed.
Either side can reach half-width. A stop that would squeeze its neighbor under
its minimum is not offered. Arrow keys on a focused separator still nudge it
without snapping, and a double-click still evens the whole split.
For a menu that appears on a physical mouse but not in a browser test, add
?input-trace to the app URL. The local readout
shows the loaded entry bundle, delivered button and modifier events, and whether
the page canceled the menu. It does not send or store the trace.
Window zoom #
A window's own zoom (Alt with the wheel or a pinch on a canvas, ⌥+, ⌥−, ⌥0, or
the window menu) is zoom in its board data: 50% to 200% in 5% steps, left out
at 100%. clampWindowZoom in
board.svelte.ts rounds it on every change
and on load. A pinch keeps its unrounded zoom while it lasts, so its small steps
add up instead of rounding away.
WindowFrame.svelte lays a zoomed
body's view out at the body's size divided by the zoom and scales it up with a
transform, so lines break as they would at that size. Do not zoom a window with
CSS zoom: in Chrome on macOS, every level keeps a new set of font instances,
about 10 MB for each level a chat visits, and never frees them. The body's
--window-zoom and board.zoomOf say what a view is drawn at, for a view that
undoes the scale, like a canvas that would blur under it.
The transform has consequences for what a window holds:
- A
position: fixedelement inside it is placed in the view, not the page. A pane that must leave the window goes in the top layer (a popover or a modal dialog), likeMenu.svelte'sfloat. The top layer is drawn at the page's scale, not the window's. - The wheel scrolls a zoomed window by the same CSS pixels as at 100%, which on screen is the zoom times as far, as on a zoomed canvas.
- Measure with
getBoundingClientRectoveroffsetWidth, aspopover.tsdoes, to find the scale an element is drawn at.
Settings #
In appearance, assistant name sets the sender label above replies across
all web and terminal clients connected to the daemon. Press Enter or leave the
field to save. Clear it to restore albedo.
Settings.svelte owns the settings interface.
The extensions directory lists enabled services and extensions with declared
fields. Choose an entry to configure it, manage extensions to change which
ones are enabled, or all settings to search every declaration. The client
builds settings panes from the global inventory
and field declarations. The
page heading displays them
with the scope. Use the
settings pane for vertical
spacing, panels for related
controls, and the empty state
when a connection needs setup.
In appearance, theme and colour presets come first. Expand custom colours for individual colours and theme import or export. text groups sizes and font families. layout groups controls by canvas and boards, sidebar, and chat windows.
In all settings, expand a category to edit its fields, or filter to see matching fields across categories. Collapsing a category or filtering the form keeps pending edits. Save and revert apply to all edits.
The sidebar icons use Lucide. The extensions directory lists tools by name.
Use the grouped sidebar in a wide window or the section picker in a narrow window. Model accounts live under providers. For a service account, open extensions and choose the tool. See the client conventions for settings labels. Other settings pages include web search, webhooks, and Discord. Their services enforce the corresponding daemon-side rules. A client view is not an authorization boundary.
AccountsSettings.svelte
shows provider accounts grouped by service: Claude, ChatGPT and Gemini first,
other sign-in services, then one API keys group. On first run, the same provider
list offers every model sign-in the browser supports and a separate option for
an API key or endpoint. The service names and model blurbs live in one table,
services in providers.ts. Profiles,
setups, endpoints and protocols stay reachable only under Advanced, which reuses
the per-provider
ProviderCard.svelte and
ConnectProvider.svelte. Do
not show profile or provider wording outside Advanced.
Rotation is set per service, while the daemon stores it per profile.
accounts.ts owns the mapping. It reads
the order and mode from the service's lead profile (the default profile when it
is that service's, else the first that rotates, else the first). A write is one
settings patch that gives every following profile of the service the same
account_ids, rotation and a cleared account_id. Profiles pinned with
account_id, and profiles answering with a key saved on themselves, do not
follow. accounts.test.mjs checks these
choices. Keep the mapping there rather than in the page.
Sign-ins run inline as a row of their service's group through
SignInRow.svelte, which shares
SignInFlow with
SignIn.svelte. The page asks nothing else on a sign-in: when it completes, the
page reloads /auth and the providers group, because the daemon creates or
joins the service's profiles (see authentication). Sign out never
asks the page to repair profiles first. Its confirmation states what happens
next. ToolSignIns.svelte shows
the selected tool’s service accounts (kind: service) alongside its settings. A
saved account remains accessible when its extension stops offering sign-in.
The HTTP API behavior guide defines the browser client's ordering and recovery obligations. OpenAPI owns its wire shapes.
Board parking and catalog cache #
hosts.ts keeps windows of up to
prefs.keptBoards (1–6, default 3: active plus two parked; configured under
Settings → Layout) recently visited open boards parked in its off-screen
#parking container (visibility: hidden, contain: strict) across board
switches instead of unmounting them. Chats, scroll offsets, iframes, and WebGL
terminals survive board switches and reattach with moveBefore; closing a
window, closing a board tab, or deleting a board drops them so #collect
unmounts them on the next frame. The board being left is parked before it goes:
the setter of boards.active calls hosts.shelter(id, false), because Svelte
takes the board view, and every slot in it, out of the page in the same flush,
and Chrome clamps a scroller carried out of the page that way to its top before
release can park it. shelter's back false keeps those windows parked
instead of putting them back into slots that are about to go. A parked host also
carries its own visibility: hidden, cleared after it moves back into a slot.
Without that, Chrome can keep the parking's inherited visibility: hidden on a
host that moveBefore returns to its slot, and the window stays invisible.
Hosted windows read their owning board via windowBoard() in
boards.svelte.ts (BOARD_CONTEXT set in
WindowSlot.svelte) rather than
boards.board, so parked windows stay isolated from the active board.
profiles() and models() in api.ts coalesce
concurrent calls and keep a 10 s cache cleared on providers ETag updates and
/settings, /auth, or /reload writes.
ModelChoice.svelte seeds from
peekProfiles and peekModels so the model picker renders cached rows on its
first frame without a spinner.
Motion and streaming costs #
A busy session's face, LiveFace.svelte,
steps on one shared clock in live.svelte.ts.
Every frame of its animation sits laid out in one grid cell, and a tick only
moves the colour to the next one. Changing the face's text instead lays out the
whole page and makes Chrome hit-test it again for hover; toggling visibility
skips the layout but rebuilds the compositor layers. Both cost the page a frame
of main-thread work twice a second for every streaming session in the rail.
Giving the face its own compositing layer does not help. The animateFaces
browser preference ("animate session faces") and
prefers-reduced-motion: reduce hold every face on its first frame and stop the
clock; offscreen faces and hidden tabs pause it too.
The blinkCursor preference ("blink terminal cursor") is xterm's cursorBlink
in PtyView.svelte, read when a terminal
opens.
A chat that follows the end of a running turn hides an overlay scrollbar, which
otherwise fades in and out on every streamed update.
scrollbars.ts tells overlay scrollbars from
ones with a gutter, as Chrome draws on Linux and Windows. A gutter scrollbar
stays, since hiding it would reflow the chat at the start and end of each turn.
Terminals #
The browser's terminal views attach over the WebSocket route in
http_terminals.gleam.
The socket attaches from its first message, not from Mist's on_init. Mist
closes a socket whose on_init takes over 500 ms, and starting a terminal waits
for its PTY helper, which a loaded host can take longer than that to launch. The
terminal manager is one
registered process that maps terminal ids to workers and allows at most 32
terminals. Each worker owns a python/albedo_pty.py port. It keeps the last 256
KiB of output for reattachment. It serves attach, resize, input, signal and stop
before PTY output. When the shell exits on its own, the
PTY helper waits for output credit and drains pending
bytes before sending the exit frame. A watcher that falls behind gets its output
held, at most 64 KiB, with a marker for skipped bytes. An unwatched terminal is
stopped after 30 minutes, or 5 minutes once its shell exits. Keep terminal
policy in the Gleam module and open the port through
albedo_ports.
PtyView.svelte draws with xterm's WebGL
renderer. Its cursor blinks from a 600 ms timer; the DOM renderer's CSS blink
animation keeps a focused page drawing 60 frames a second. Chrome keeps 16 WebGL
contexts per page and takes the oldest back when another is made. xterm waits 3
seconds for a lost context to come back, then the view drops the addon and the
terminal stays on the DOM renderer, keeping its buffer. A browser without WebGL2
starts on the DOM renderer. Each WebGL terminal holds its own glyph atlas and
canvas, so many open terminals cost more memory than they do on the DOM
renderer.
A canvas scaled with its window is a stretched bitmap, so a terminal on the
board undoes the zoom it is drawn at, zoomOf its window: its box is that many
times larger and scaled back down, and its font that many times bigger. Its text
is then drawn at screen resolution, and pointer events land on the right cells:
xterm divides a pointer's offset on screen by its unscaled cell size. The font
follows 150 ms after the zoom stops changing, so a pinch stretches the old
bitmap and rebuilds the glyph atlas once. This relies on the window's body being
scaled with a transform: a CSS-zoomed ancestor changes the device-pixel size
xterm reads for its canvas, and the text blurs.
A bitmap at a fraction of a pixel is sampled between pixels and blurs too, and a
canvas's pan and zoom leave windows at any position. 150 ms after a pointer,
key, wheel or resize event, or a change of the canvas's view, the terminal
nudges its box by under a device pixel so its canvas starts on the pixel grid.
The window's zoom and the terminal's undoing of it multiply to a hair off 1 at
most zooms, which Chrome smooths as a scaled bitmap, so while the zoom holds
still the canvas is sampled nearest-neighbour (image-rendering: pixelated). A
pinch in progress stays smooth.
Moving a session #
/cd to another host's folder opens the
question dialog. Its state lives in
cd.svelte.ts, which mirrors the
terminal's question box. It asks the daemon's
preflight, then starts and follows the move.
A target that can't take this daemon's data refuses in the preflight or when a
move reaches staging. refusal reads transfer_target_older,
transfer_extension_unavailable and transfer_unsupported in the terminal's
words. Only an older target is asked to update albedo. The target's own words,
which name what it lacks, follow in smaller monospace text for debugging. Other
refusals show their reason as it came. The rules behind the codes are in
moves between versions.
Text sizes and weights #
app.css owns the type scale: eight sizes (--type-2xs
10px through --type-3xl 24px) and three weights (--weight-regular,
--weight-medium, --weight-strong). Write every font size as one step times
the scale of the surface it sits on, calc(var(--type-sm) * var(--ui-scale))
for the chrome or * var(--canvas-scale) inside canvas windows.
type.ts sets both scales from the text size
settings.
Each size and weight of a system font is a font instance the browser keeps for
the life of the page, about a megabyte each on macOS. Do not add sizes between
the steps, em or percentage sizes that multiply a parent's, or fluid sizes
such as clamp() with cqw or vw: each mints instances of its own. Bold
elements (b, strong, th, headings) take --weight-strong instead of the
browser's 700. Phone inputs keep a 16px minimum so iOS does not zoom into them.
Manual web review #
Use the UI review kit for seeded browser reviews, scenario helpers, evidence capture, and private-resource cleanup. These manual checks are separate from the automated gate.