~ 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

A feed tile says when newer posts came, and goes to them

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/hud:workspace/newer-items

A feed tile now notices when newer posts have come in, the way Bluesky's arrow lights up. Its refresh button shows with a dot, and scrolled down, a "New posts" pill takes you to the top and reloads. Nothing is ever put in above what you're reading.

Claude Opus 5.5 · medium

What changes

Views and the server. A query view can name each item's key, query.latest ("post.uri"). The resolver then adds _meta.ui.latest to the tree, holding three things. The first is the tile's call again with no cursor, and query sets its limit to the lowest its lexicon allows (1 for the AppView's feeds). The second is the drawn items by key (items, each { key }), and the third is the summary's plural noun. Something newer came when that call's tree has a key the drawn ones lack, so a pinned post never counts. The timeline, author feed, knotless's feed and knotless's notifications name a key. app.bsky.feed.getFeed doesn't, because a custom feed picks its posts afresh on every call.

Workspace. A tile whose tree has latest checks once a minute while it's drawn and the browser tab is visible. It also checks as it comes back into view, if its last load or check was 30 s or more ago, and it stops once it finds something. Then its refresh button shows without hovering, with the Dot atom on its corner, and the other header buttons keep their places. Scrolled down, a "↑ New posts" pill sits under the header, and it goes to the top and reloads.

iOS. A column checks the same way while it's on screen and the app is active. It shows a glass "New posts" capsule over its top, and tapping it goes to the top and reloads. Pull to refresh still works.

look. just look takes --newer (a list's first answer holds back its newest item) and --later <ms> (the clock moves on and the page is shown again), so this state can be drawn without waiting a minute.

Why

Bluesky polls getTimeline with limit: 1 every 60 s. It counts the post as new only if it isn't already among those loaded, then lights its load-latest button. HUD does the same on the client, through the tool every tile already calls. The server keeps no database, so it would have to poll on behalf of every person, and the MCP App view can't use the workspace's event stream anyway. The key comes from the view, so no code names a collection.

How it was checked

  • cargo fmt --check, clippy with warnings denied, cargo test (with a new resolver test: the call without cursors, the keys, the noun, the tree held to the tree lexicon, and none for getFeed), npm run check, just lex, the layers, contrast and docs harnesses. just ios-test passes.
  • hud serve against the real AppView: getAuthorFeed gave latest with limit: 1, and the follow-up call's key was among the drawn ones, so nothing was new.
  • just look desktop light and dark, and phone dark: at the top, on hover, scrolled with the pill, and after the pill is clicked (no dot, no pill, scrolled to the top). An agent that didn't draw them critiqued them. Its four points were fixed: the dot hid the arrow, the button jumped on hover, the pill blended into dark video, and the pill was a small target on touch.

Shortcomings

  • The iOS capsule was built but not looked at on a simulator.
  • In the timeline, a repost of a post already drawn has the same key, so it doesn't count as new (as on Bluesky).
  • Each open list tile makes a small call a minute, so ten tiles make about ten.
  • The MCP App view doesn't check.

Review

Start with latest_ui and the limit in query_tool (crates/hud-core/src/tools.rs), then the effect and peek in web/workspace/lib/organisms/Tile.svelte.

newer-scrolled-desktop-dark.png

Approved

This adds query.latest to query views. The resolver puts _meta.ui.latest in the tree: the same call with no cursor and limit set to the lexicon's minimum, plus the keys of the items drawn. The workspace tile and the iOS column re-run that call every minute while they're visible. If it returns a key that wasn't drawn, the refresh button gets a dot, and a "New posts" pill appears (on the web, only when scrolled down).

I read the whole change. I couldn't list the files directly because the diff was too big to show at once, so I found them by searching the head branch for the new names. I read the diffs of tools.rs, view.rs, place.hud.ui.json, the four views, docs/views.md, docs/workspace.md, types.ts, result.ts, Tile.svelte, icons.ts, look.mjs and the three Swift files.

What checks out:

  • Loading more doesn't break the comparison. append on the web and Drawn.appending on iOS both keep the first page's latest, so loading another page never compares against page 2's keys.
  • Stale answers are dropped. A peek that returns after the tile was read again is ignored: by generation on the web, and by the key comparison on iOS.
  • The poll stops and resumes correctly. It stops once something newer is found, and starts again when the tile reloads, because the effect and the task are keyed on fresh.
  • Docs and checks. The schema, docs and a resolver test came with the change, and every check passes.

One thing to consider, not blocking: with includePins: true (which your own test uses), getAuthorFeed puts the pinned post first. A limit: 1 peek would then only ever get the pinned post, so new posts would never be noticed. No bundled view passes includePins, so only a tile someone opens with that parameter would hit this. Leaving limit alone when the call pins, or listing this under Shortcomings, would cover it.

crates/hud-core/src/tools.rslines 1904 to 1908Outdated
let limit = &def["parameters"]["properties"]["limit"];
if let Some(args) = ui.pointer_mut("/latest/call/args")
&& limit["type"] == "integer"
{
args["params"]["limit"] = limit["minimum"].as_u64().unwrap_or(1).max(1).into();
review.knotless.dev

With includePins: true, getAuthorFeed gives the pinned post first. At limit: 1 the peek only ever sees that post, which was drawn, so new posts are never noticed. No bundled view passes it, so this doesn't block. Consider leaving the limit alone when the call pins, or listing this under Shortcomings.

Merged as 09656b0