chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.5.0 Latest 5 packages
Themes: HUD's own, and anyone's, on the web and iOS
MergedThis 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
#rrggbbon the server (theme::palette), on the web (styleOf) and on iOS (RGB(hex:)), so a stored theme can't inject CSS. - Deleting:
deleteThemerelies ondelete_record_tool'sown_uri, so it only deletes from the person's own repository. - Inline script: the inline script in
workspace.htmlis allowed by the page's CSP, which already has'unsafe-inline'. - Docs: AGENTS.md, README, the env table and
--helpare updated, and the Dockerfile copiesthemes/. - 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,
createThemeanddeleteThemeanswer 400InvalidRequest.callToolanswers 401AuthRequiredin 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.internalby 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()), |
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", | |
] |
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', | |
); |
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.
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:
createThemeanddeleteThemenow answer 401AuthRequired, ascallTooldoes, through the newtheme::Refused::SignInand its mapping inxrpc.rs. - iOS test fixture: the amber palette in
WorkspaceTests.swiftnow matchesthemes/amber.jsonexactly, 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 newconstrainedcheck, 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.
Themes for the workspace, on the web and iOS: HUD's own, and anyone's, like knotless's.
What a person gets
HUD_DATA_DIR/theme/), so every page and app they are signed in to draws in it, told live bycanvasesEvent; the page draws the last theme before it loads, so it never flashes the system's first.place.hud.themerecord to their repository throughcreate_record, and draws the workspace in it.com.atproto.sync.listReposByCollection(HUD_RELAY, by defaulthttps://bsky.network). Choosing one copies its colours, so a theme changed or deleted later leaves those who chose it as they were.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 bygetWorkspace, so neither keeps a copy.setTheme(by key or uri),listThemes,createTheme,deleteTheme,checkTheme; recordplace.hud.theme.getWorkspaceanswers the chosen theme and HUD's.hud_core::theme::problemsholds 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 nowlight-dark(), so light, dark and a palette are all a scheme on the root;harness/contrast.mjsreads 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.just lookin every theme, the menu, editor and browser, and critiqued by a second agent; the iOS gallery drawn in four themes (-themeat launch, debug builds).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.iOS: the system's own screens stay the system's (third commit)
A PDS of HUD's own (second commit)
just local-setuponce (packages, the spaces alpha, the checkout's own certificate authority in.local/tls/,hud.harness.internalin /etc/hosts by macOS's own dialog), thenjust local [--spaces] [--ios]: the PDS with alice, bob and carol (passwordpassword), HUD over it behind https, a Chromium window at the workspace, and with--iosthe app built, trusting the authority, and launched at it on a simulator.HUD_DEV_ENV, as knotless's), HUD_SPACES on over it;just e2e-spaces.Review notes (7d2f765):
createThemeanddeleteThemeanswer a PDS sign-in that ended ascallTooldoes, 401AuthRequired(theme::Refused::SignIn); the local authority may sign forhud.harness.internalalone (a critical name constraint), one made before made again;freePorttakes a host with no IPv6;WorkspaceTests' amber isthemes/amber.json's again. Main merged in (the workflows and templates), and the templates namejust localandjust e2e-spaces, which this pull brings.