~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0

Themes: HUD's own, and anyone's, on the web and iOS

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:workspace/themes

Themes for the workspace, on the web and iOS: HUD's own, and anyone's, like knotless's.

What a person gets

  • A theme menu in the tab bar (also "Choose a theme" in the palette): System, HUD's Light and Dark, and six palettes (Frost and Paper, light; Amber, Blueprint, Dusk and Phosphor, dark), then their own themes, then "New theme" and "Browse everyone's themes".
  • Kept on the server (HUD_DATA_DIR/theme/), so every page and app they are signed in to draws in it, told live by canvasesEvent; the page draws the last theme before it loads, so it never flashes the system's first.
  • Their own themes, as knotless's are made: the editor starts from a palette, changes its 21 colours (named for what each colours) and draws itself in them as they change, naming each text that reads at under 4.5:1. Publishing writes a place.hud.theme record to their repository through create_record, and draws the workspace in it.
  • Everyone's themes: one account's by handle, or everyone's, the repositories holding them found by the relay's com.atproto.sync.listReposByCollection (HUD_RELAY, by default https://bsky.network). Choosing one copies its colours, so a theme changed or deleted later leaves those who chose it as they were.
  • iOS: Home → You → Theme picks HUD's, yours and everyone's; the palette reaches HUDKit's views through Surface.swift (.hudTheme, HUDColor). Themes are made on the web.

Shape

  • themes/<key>.json, HUD's themes as data (place.hud.defs#theme, #palette), embedded by hud-core (theme.rs) and handed to both clients by getWorkspace, so neither keeps a copy.
  • Methods: setTheme (by key or uri), listThemes, createTheme, deleteTheme, checkTheme; record place.hud.theme. getWorkspace answers the chosen theme and HUD's.
  • Contrast: hud_core::theme::problems holds every palette to 4.5:1 for each text on what it is drawn on: HUD's in the tests, a person's to be made, chosen or listed. tokens.css's colours are now light-dark(), so light, dark and a palette are all a scheme on the root; harness/contrast.mjs reads them.

Checked

  • cargo fmt, clippy, every test (new: theme module tests, a_theme_chosen_follows_the_person, peoples_themes_listed_checked_and_chosen), just lex (every answer held to its lexicon), just lint, svelte-check, just ios-test, the app built for the simulator.
  • Looked at with just look in every theme, the menu, editor and browser, and critiqued by a second agent; the iOS gallery drawn in four themes (-theme at launch, debug builds).
  • Against a real PDS (harness/e2e/themes.spec.mjs, on the reference PDS and the spaces alpha): alice makes a theme, refused while a text is faint, publishes it to her repository and draws in it; bob finds it by her handle and uses it; she deletes it and his keeps its colours. The iOS app signed in on a simulator against the same stack.
  • The other e2e flows pass but two launcher flows, already failing before this (they look for "All collections" and a knotless heading the launcher no longer has).

iOS: the system's own screens stay the system's (third commit)

  • A theme sets the scheme and the palette, never the tint: menus, sheets and alerts keep the system's blue. Home, its theme picker and sharing draw with no palette.
  • What in a tile takes the accent says so: its bordered buttons, the player's seek bar, the mini player's progress.

A PDS of HUD's own (second commit)

  • just local-setup once (packages, the spaces alpha, the checkout's own certificate authority in .local/tls/, hud.harness.internal in /etc/hosts by macOS's own dialog), then just local [--spaces] [--ios]: the PDS with alice, bob and carol (password password), HUD over it behind https, a Chromium window at the workspace, and with --ios the app built, trusting the authority, and launched at it on a simulator.
  • The spaces alpha (HUD_DEV_ENV, as knotless's), HUD_SPACES on over it; just e2e-spaces.
  • The PDS's plain-http cookies go without Secure, which WebKit drops from http://localhost: Safari and iOS's sign-in sheet keep its CSRF token, as grain's local PDS does.

The workspace in each theme: Light, Dark, Frost, Paper, Amber, Blueprint, Dusk, Phosphor

The theme menu: HUD's themes, yours, New theme and Browse everyone's themes

The theme editor, drawn in the palette it makes, with a sample tile

Browsing everyone's themes, each card drawn in its own colours

The iOS app's gallery in Paper, Blueprint, Phosphor and Dusk

Review notes (7d2f765): createTheme and deleteTheme answer a PDS sign-in that ended as callTool does, 401 AuthRequired (theme::Refused::SignIn); the local authority may sign for hud.harness.internal alone (a critical name constraint), one made before made again; freePort takes a host with no IPv6; WorkspaceTests' amber is themes/amber.json's again. Main merged in (the workflows and templates), and the templates name just local and just e2e-spaces, which this pull brings.

Approved

This pull adds workspace themes. HUD's own themes are data in themes/, embedded and served by getWorkspace. People's themes are place.hud.theme records, created with create_record, deleted with delete_record, and listed per account or through the relay. Each person's choice is kept under HUD_DATA_DIR/theme/, with a person's theme copied when chosen, and both clients draw from the server's copy. The pull also adds the local PDS, TLS and spaces harness.

What I checked:

  • Palettes: a palette is checked against its lexicon and for contrast wherever it comes from. Each colour is checked as strict #rrggbb on the server (theme::palette), on the web (styleOf) and on iOS (RGB(hex:)), so a stored theme can't inject CSS.
  • Deleting: deleteTheme relies on delete_record_tool's own_uri, so it only deletes from the person's own repository.
  • Inline script: the inline script in workspace.html is allowed by the page's CSP, which already has 'unsafe-inline'.
  • Docs: AGENTS.md, README, the env table and --help are updated, and the Dockerfile copies themes/.
  • Tests: they cover choosing, listing, contrast refusal and copy-on-choose through the router.
  • Checks: none are recorded for this pull.

Nothing blocks merging. Three small things, noted on the lines:

  • When the PDS session has ended, createTheme and deleteTheme answer 400 InvalidRequest. callTool answers 401 AuthRequired in that case, which the page treats as signed out.
  • The iOS test fixture's comment says it is themes/amber.json, but its colours don't match that file.
  • The harness's certificate authority could be limited to hud.harness.internal by a name constraint.

I didn't review harness/spaces/package-lock.json line by line, since it is a generated lockfile. I read every other file.

crates/hud-core/src/theme.rsline 466Outdated
/// A write's refusal, as a theme's.
fn refused(r: Refusal) -> Refused {
match r {
Refusal::SignIn => Refused::Invalid("Your sign-in at your PDS ended: sign in again".into()),
review.knotless.dev

When the PDS sign-in has ended, createTheme and deleteTheme answer 400 InvalidRequest. callTool answers that case as 401 AuthRequired (xrpc.rs, its Refusal::SignIn arm), which the page and the app treat as signed out, and both new lexicons list AuthRequired. A Refused::SignIn variant mapped to the same 401 would keep them consistent. Not blocking.

ios/HUDKit/Tests/HUDKitTests/WorkspaceTests.swiftlines 116 to 124Outdated
/// themes/amber.json's palette, as getWorkspace lists it.
private let amber: [String: JSON] = [
"canvas": "#0c0804", "background": "#151009", "panel": "#1b150c", "soft": "#221a0f",
"border": "#342819", "borderStrong": "#4c3b25", "text": "#ffdaa3", "textMuted": "#d8aa68",
"textFaint": "#ba8c51", "primary": "#ffb238", "onPrimary": "#1a1006", "accent": "#ffbf5a",
"accentSoft": "#3a2a11", "success": "#acd876", "danger": "#ff6d50", "done": "#e79ddb",
"attention": "#ffd166", "neutral": "#a68f71", "onSolid": "#151009", "notice": "#33270d",
"onNotice": "#ffd166",
]
review.knotless.dev

Nit: the comment says this is themes/amber.json's palette, but the colours differ (canvas is #0c0804 here and #050301 in the file; background, panel, soft and onSolid differ too). Either sync it with the file or drop the claim.

harness/tls.mjslines 46 to 52Outdated
openssl(
'req', '-x509', '-newkey', 'ec', '-pkeyopt', 'ec_paramgen_curve:prime256v1', '-nodes',
'-keyout', caKey, '-out', ca, '-days', '3650',
'-subj', '/CN=HUD harness local authority',
'-addext', 'basicConstraints=critical,CA:TRUE',
'-addext', 'keyUsage=critical,keyCertSign,cRLSign',
);
review.knotless.dev

Optional hardening: this authority goes into simulators' keychains, and its key sits unencrypted in .local/tls/. Adding -addext 'nameConstraints=critical,permitted;DNS:hud.harness.internal' would mean that key can't mint a certificate a simulator trusts for any other name.

Approved

I approved this at aa4049b, and the pull's own changes since then are 7d2f765 and f7da3b9. The merge of main in between brings the workflows, the templates and the e2e updates, which are main's changes, not this pull's. All three things my last review noted are fixed:

  • Expired PDS sign-in: createTheme and deleteTheme now answer 401 AuthRequired, as callTool does, through the new theme::Refused::SignIn and its mapping in xrpc.rs.
  • iOS test fixture: the amber palette in WorkspaceTests.swift now matches themes/amber.json exactly, and so do the assertions that use it.
  • Harness certificate authority: it now carries a critical nameConstraints=permitted;DNS:hud.harness.internal. An authority made before this change fails the new constrained check, so it is made again, and the leaf certificate with it.

The change to freePort is also fine: a host with no IPv6 answers EAFNOSUPPORT, and that now counts as the port being free.

f7da3b9 adds just local and just e2e-spaces to the new templates, and this pull brings both of them.

All five checks pass at this head (check, test, web, lexicons, e2e), and nothing that came since my last approval breaks what I approved.

Merged as 93876cc