small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo docs web.md
6.3 kB · 147 lines
Markdown
at main

Web client #

The web client is a canvas of chat windows on a desktop and one chat at a time on a phone. It talks to the same daemon and the same agents as the terminal client, so you can start something in one and pick it up in the other.

The web client's canvas: chats, a review with notes tied to its lines, a terminal and an artifact.

Open it #

albedo web

This starts the daemon if none is running, serves the client on 127.0.0.1:4317, opens your browser, and prints a link that signs the browser in. In a terminal it also draws a QR code for your phone.

The server keeps running after the command returns:

albedo web --stop         # stop serving
albedo web --foreground   # serve in this terminal until Ctrl-C
albedo web --no-open      # print the link without opening a browser
albedo web --port 0       # pick a free port

With the Nix package this works straight away. From a checkout, build the client once first:

npm --prefix web ci
npm --prefix web run build

Updating #

Running albedo web when a gateway is already running reuses that process instead of starting a new one. The gateway reads the built client from disk on each request, so a newly built bundle shows up on reload. HTTP headers such as Content-Security-Policy come from the running albedo-web binary.

After upgrading Albedo, restart the gateway so the new albedo-web binary takes over:

albedo web --stop
albedo web

Stopping keeps the sign-in key, so signed-in browsers stay signed in.

From a checkout, rebuild the Go commands together and rebuild the web client before restarting:

go -C cli install -ldflags "-X main.buildRoot=$(pwd)" ./cmd/albedo...
npm --prefix web ci
npm --prefix web run build
albedo web --stop
albedo web

Installing only ./cmd/albedo leaves the separate albedo-web binary on its older build. If the browser shows a Content-Security-Policy error blocking WebAssembly (such as WebAssembly.Module() blocked by script-src), the running albedo-web is older than the built client and does not yet include 'wasm-unsafe-eval'. Update albedo-web and restart it with albedo web --stop followed by albedo web.

Run at login #

albedo web install installs the gateway as a systemd user service on Linux or a LaunchAgent on macOS. It serves loopback by default. To serve a home network, use albedo web install --allow 192.168.1.0/24. If a detached gateway is already running, stop it with albedo web --stop before installing.

Use albedo web status or albedo web status --json to check the listener and service. albedo web --stop stops the gateway until you start it again or log in. albedo web uninstall removes its CLI-installed registration. The daemon continues running. To declare the gateway instead, enable the Home Manager web service.

Use it from your other devices #

Anyone holding a sign-in link controls the daemon, so only open the client to your own devices.

  • Tailscale: on a machine signed in to Tailscale, albedo web also serves your tailnet and prints a link with the machine's tailnet name. Open that link on your phone or another computer. albedo web --local serves this machine only.
  • A home network: --allow serves a network instead of the tailnet. Only devices on an allowed network can connect.
albedo web --allow 192.168.1.0/24
albedo web --allow 10.0.0.0 --allow 100.64.0.0   # trailing zeros mean any: 10.0.0.0/8

A bare 0.0.0.0 or :: is refused. Give 0.0.0.0/0 or ::/0 to allow every client.

  • Every time you log in: --save remembers the allowed networks and installs a login service, so the client is always there. albedo web --save with nothing else forgets them and removes the service.
  • HTTPS on your tailnet: albedo web --tailnet-https serves through tailscale serve on the machine's MagicDNS name. A page needs HTTPS for notifications and the clipboard to work. HTTPS certificates must be turned on for the tailnet.
  • Behind your own proxy: --public-url https://albedo.example names the address the proxy serves, so the printed link and QR code use it.

If a link got somewhere it should not have, albedo web --new-link replaces it and signs every browser out.

Find your way around #

  • New session: pick a folder, a provider, a model, and an effort level. A folder can be on another machine.
  • Chats: live, with images, / commands, and a model picker in the composer.
  • Tiles: drag a window to the far left or right edge of a column. Drop when you see a line to add a column and scroll sideways to it. Move a little farther inside for a regular split, or into the middle for a tab. Moving a whole column keeps its width. Hold Shift and roll the wheel down to focus the next column or up for the previous one. Alt+Left and Alt+Right also focus neighbouring windows. The view moves only far enough to show the selection. Hold Ctrl+Shift and roll the wheel down or up to switch boards. Turn on Focus on hover in browser settings to select a tile under the pointer without moving the view.
  • Resize a tile: hold Ctrl and right-drag from the left or right third of the window. The opposite edge stays put, and neighbouring columns keep their widths. Drag near the board edge to align with it, or near half-width to fit two equal columns and their gutter. Keep dragging to move past a snap. In a stack, grab the top or bottom third to change height, or a corner for both. Drag the horizontal divider near one in the column beside it to line them up. A labeled guide marks the edge or divider while it is snapped. Escape cancels. Drag the ordinary handle between two tiles to snap while trading space only between those two. Double-click the handle to even out the split.
  • Reviews: read a turn's changes as highlighted diffs, tie notes to lines, a message, or a window, and send them back as one message.
  • Artifacts: pages Albedo makes for you open beside the chat that made them.
  • Everything else: press ⌘K for the command palette, or ? for the keys.

The web client tiled: three windows side by side.