small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
README.md

UI review kit #

Use this kit to inspect the web client through a private daemon, seeded chats, a local fake provider, and an owned Chrome browser. Drive it from an Albedo Python kernel. It is an opt-in manual workflow, outside the test gate.

seed.py owns seed creation. kit.py owns each running review and its browser. perf.py owns memory, trace, count, and interleaved-repetition measurements. Follow the repository's private-daemon and UI review rules and the web client guide.

Prepare a base #

Use the checkout's development shell. Build the CLI before seeding:

nix develop
export ALBEDO_UX=/tmp/albedo-review
export ALBEDO_NO_BROWSER=1
go -C cli build -o bin/ ./cmd/albedo...
python3 test/manual/ux/seed.py

Install Chrome separately if it is unavailable (nix develop provides chrome-headless-shell). Both kit and perf run inside an Albedo Python kernel and in standalone nix develop -c python3. kit resolves ALBEDO_UX dynamically (or via base=), discovers a built albedo CLI across the current worktree, <base>/bin/albedo, the enclosing main checkout, or PATH, and installs web/node_modules automatically when kit.build() runs in a fresh worktree.

Seeding builds a daemon snapshot in daemon/, a web build in dist/, two Git workspaces in ws/, and a home in seed/. It creates chats covering markdown, code, tables, thinking, tools, file edits, and failure. Seeding replaces these builds, workspaces, and the seed home. Repeat it after daemon changes. For a web change alone, use a separate build as shown below.

Seed and review daemons use a private user home and configuration directory. They disable host service-manager access, so an unavailable user bus in CI does not prevent direct daemon startup or shutdown. Failed seed commands retain their captured stdout and stderr in the exception, including cleanup failures.

Reviews hold a shared base lock. Seeding requires an exclusive lock and refuses bases with unfinished .active run markers. Do not reseed while reviews use the base. Workspaces are shared across its runs: a fresh home does not undo file edits. Use separate bases for reviewers who need independent workspace state.

Start, inspect, and stop #

Choose a new run name for every review, or pass unique=True (perf.start enables this by default) to append a numeric suffix when retrying. Existing names are never overwritten, so their screenshots and homes are preserved.

import sys
sys.path.insert(0, "test/manual/ux")
import kit

ui = await kit.start("sections-review-001", width=1440, height=900)
try:
    print(kit.scenarios())
    await ui.load("sections")
    print(await ui.windows())
    print(await ui.layout())
    await ui.shot("sections-wide", show=True)
    print(await ui.errors())
finally:
    await ui.stop()

start() copies the seed home into runs/NAME/home, disables standby daemons, and starts a fake provider, web server, daemon, and browser page. It attempts cleanup if startup fails. Screenshots go in runs/NAME/shots/. shot() returns a path. Use show=True or show_image(path) to inspect the image.

stop() attempts browser closure, both CLI stop commands, every owned job, and a scan for processes carrying this run's ALBEDO_HOME. It waits for observed home-matching processes to exit. It raises if a cleanup step or scan fails, or processes remain. An empty result means those cleanup steps completed. The home scan does not independently discover Chrome; its owned browser handle performs that cleanup.

A failed cleanup leaves the .active marker and retains the base lock while the Review remains alive. Retry await ui.stop() after investigating. If the kernel exited or startup failed without returning a handle, inspect the run's processes and stop them under its environment before removing the marker. Verify browser shutdown separately. Never remove a marker or run directory merely to bypass the guard. Archive or remove old evidence only after verifying its resources have stopped.

To inspect a different web build without replacing the base's build:

from pathlib import Path
candidate = await kit.build(Path("/tmp/albedo-web-candidate"))
ui = await kit.start("candidate-review-001", dist=candidate)
try:
    await ui.load("sections")
    await ui.shot("candidate", show=True)
finally:
    await ui.stop()

kit.build() refuses web/dist, which may be serving another client.

Drive the page #

Windows are named w0, w1, and so on in board insertion order. windows() returns their current header points (head) and rectangles (box) in CSS pixels. Derive gesture coordinates from these values after layout changes:

source = await ui.window("w1")
target = await ui.window("w0")
print(await ui.drag(tuple(source["head"]), tuple(target["head"])))

For a drop preview, use hold(point), probe(x, y), and release(x, y). palette(command) runs a command. say(window, text) sends a chat message. mark() followed by remounted() reports window elements recreated since the mark, which helps inspect whether a move preserved mounted content.

  • key() sends US keyboard events. key("!") and key("1", kit.SHIFT) produce Shift-1. Use type(text) to insert text and key("Backspace") to delete. key("a", kit.META) selects all in an editor. say() targets the contenteditable composer.
  • click() hovers first and waits 80 ms between press and release. This is the kit's gesture timing for controls that ignored a bare CDP click during manual review, rather than a browser-wide timing requirement.
  • Scenario builders check for tiles at least 160 px wide and high at 1440×900. Preserve that scenario constraint. Production docking refuses splits that would squeeze tiles below their minimum. Tab joins are exempt.
  • A floating note dropped over another float targets that float rather than the canvas beneath it.

Understand resets and errors #

load() builds or restores a cached scenario by replacing all localStorage and reloading. It can discard unsent board notes and other browser-local state. Messages already sent remain in the daemon. Start a new run for a fresh home. Cookies are separate: a theme chosen in settings or through the palette still wins over media(dark=True) until palette("theme: system").

errors() returns errors, unhandled rejections, console errors, and stale-tether records from the current document load. Listeners are installed on each new document, but the records reset on navigation. Capture them before reloading.

The kit enables the tether audit. At rest, every 500 ms it compares rendered lines with freshly computed geometry and records differences. This checks resting geometry, rather than every frame or every possible tether defect.

Run focused checks #

Use disposable review runs for checks that change settings or boards. Read the helper before using it to understand which state it changes.

  • settings_check.py: await settings_check.check(ui) exercises focus, categories, drafts, saves, resets, stale edits, persistence, and phone fallback.
  • extensions_check.py: run after the settings check. It exercises global extension toggles, saves, stale writes, and dependency refusal without creating a session. It does not check confirmation cancellation.
  • tethers_check.py: runs movement and layout flows and checks new stale-tether records after each board's initial settle. Inspect initial errors and ordinary page errors separately.
  • image_gallery_check.py: exercises uploaded and tool image navigation, dialog focus and teardown, original links, and desktop/phone sizing in light and dark themes. It saves interaction captures and changes the seed's hello chat.
  • artifact_touch_check.py: exercises artifact touch behavior and changes preferences and boards. Use a disposable run.
  • transcript_paging_check.py: checks that the reader's rows hold while older pages load and across chat switches. check_history_arriving scrolls up the seed's brisk chat while replies keep arriving, and fails when the chat reads its place from rows Svelte has not finished updating. It sends messages into that chat, so use a disposable run.
  • perf.py:
    • await perf.start(name, ...) starts a review with Chrome's Accessibility domain disabled before the first navigation (avoiding Blink AX-tree retention and double reloads) and unique=True. Pass dpr=2 to launch Chrome with --force-device-scale-factor=2 so WebGL canvases keep 2x backing buffers instead of emulated DPR.
    • await perf.counts(ui) measures deterministic idle counts (raf_per_s, frames_per_s, layouts_per_s, recalcs_per_s, nodes, listeners, heap_used after forced GC, font_combos, and running infinite animations).
    • await perf.wheel_up(ui, w) sends real wheel-up notches (ui.wheel accepts wait=, default 0.05 s) and checks distance gained, snap_backs, and frame-to-frame scrollHeight oscillating_frames.
    • await perf.trace(ui, seconds) and await perf.allocators(ui) summarize per-thread CPU (tdur), frame rates, live sub-allocators (malloc_live, blink_gc_live, v8_live), and macOS SF font instances.
    • await perf.interleave({"ctl": ..., "var": ...}, reps=3) rotates variant order across repetitions and returns rows plus median [min-max] summaries.
    • await perf.snapshot(ui, path) streams a V8 heap snapshot to disk. Taking a snapshot permanently retains ~9–10 MB of renderer malloc on that page; take snapshots last or call await perf.fresh_browser(ui) afterward.
    • python3 test/manual/ux/perf.py check [--seed] [--base PATH] [--dist PATH] runs the standalone count and wheel-scroll budget gate across huge_chat, tiles-basic (focused and unfocused terminal), and dense, then transcript_paging_check.check_history_arriving. Without --dist, it builds this checkout's web/ into a temporary directory so a stale <base>/dist is never tested by accident; --seed rebuilds this checkout's CLI and seeds a fresh base first (used by perf-web.yml in CI). ALBEDO_UX_CLI selects an explicit prebuilt CLI instead.
    • In an Albedo kernel, run long benchmark loops directly in a cell (which backgrounds at 60 s and wakes the session on completion) rather than via asyncio.ensure_future or asyncio.create_task, which never wake an idle session.

replies.py selects fake responses by message content. Examples include slow or hung replies, failures, tools, jobs, agents, edits, tables, long text, and artifacts. Matching is ordered: the first matching branch wins. Read it when choosing a trigger, especially for messages containing several keywords. It is the canonical response list.

Give a reviewer a bounded brief #

Assign an area, starting scenarios, and interactions to try. Reviewers inspect and report without editing the checkout. Give each reviewer a unique run name and require cleanup in finally.

Write one report artifact and hand back its link. Include:

  • Checkout revision, daemon snapshot and web build used, base and run paths, scenarios, viewport, theme, and time spent.
  • Findings in priority order: exact steps, observed and expected behavior, screenshot paths, and confidence. Distinguish broken behavior, confusing interaction, visual defects, and preference.
  • Reproduction attempts and results. Try to reproduce a finding, but report intermittent failures with the evidence available rather than suppressing them until they happen twice.
  • What worked, what was outside scope, and setup limitations.
  • Cleanup outcome, including errors or remaining resources.

Inspect screenshots before citing them. Preserve them with the run so another reviewer can assess the finding.