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
0
0
Custom Bluesky feeds and Grain's feeds say when newer items came
crates/hud-core/src/tools.rs+52−3
| @@ -3705,11 +3705,60 @@ mod tests { | ||
{ "key": "at://did:plc:alice/app.bsky.feed.post/a" }], | ||
"noun": "posts" }) | ||
); | ||
// A view naming no key says nothing of it (a feed's posts are | ||
// chosen afresh, not newest first). | ||
// A custom feed too, as Bluesky checks one: the feed named again, | ||
// as the call named it. | ||
let feed = json!({ "method": "app.bsky.feed.getFeed", "params": { "feed": "For You" } }); | ||
let answered = json!({ "method": "app.bsky.feed.getFeed", "service": "did:web:api.bsky.app#bsky_appview", | ||
"params": { "feed": "at://did:plc:feeds/app.bsky.feed.generator/for-you" }, | ||
"response": { "feed": [post("b")], "cursor": "c1" } }); | ||
let chosen = bundled("app.bsky.feed.getFeed"); | ||
let v = chosen.view(); | ||
let ui = view_ui(v, true, "query", &structured, Some(&arguments), None, read).unwrap(); | ||
let ui = view_ui(v, true, "query", &answered, Some(&feed), None, read).unwrap(); | ||
assert_eq!(ui::check(&ui), Ok(())); | ||
assert_eq!( | ||
ui["latest"], | ||
json!({ "call": { "name": "query", "args": feed }, | ||
"items": [{ "key": "at://did:plc:alice/app.bsky.feed.post/b" }], | ||
"noun": "posts" }) | ||
); | ||
// Grain's feeds, by each gallery's at-uri. | ||
let recent = json!({ "method": "social.grain.feed.getFeed", | ||
"params": { "feed": "at://did:web:grain.social/social.grain.feed.generator/recent" } }); | ||
let gallery = "at://did:plc:alice/social.grain.gallery/g1"; | ||
let answered = json!({ "method": "social.grain.feed.getFeed", "service": "did:web:grain.social#grain_appview", | ||
"params": recent["params"], | ||
"response": { "items": [{ "uri": gallery, "cid": "bafyrei", | ||
"creator": { "did": "did:plc:alice", "handle": "alice.test" }, | ||
"record": { "title": "g1", "createdAt": "2026-11-17T09:00:00.000Z" }, | ||
"indexedAt": "2026-11-17T09:00:00.000Z" }] } }); | ||
let chosen = bundled("social.grain.feed.getFeed"); | ||
let v = chosen.view(); | ||
let ui = view_ui(v, true, "query", &answered, Some(&recent), None, read).unwrap(); | ||
assert_eq!(ui::check(&ui), Ok(())); | ||
assert_eq!( | ||
ui["latest"], | ||
json!({ "call": { "name": "query", "args": recent }, | ||
"items": [{ "key": gallery }], "noun": "galleries" }) | ||
); | ||
// A view naming no key says nothing of it. | ||
let unkeyed = view::parse( | ||
&json!({ "method": "app.bsky.feed.getAuthorFeed", "description": "Feed", | ||
"service": "did:web:api.bsky.app#bsky_appview", | ||
"query": { "items": "feed", | ||
"layout": { "component": "Text", "props": { "value": "feed" } } } }), | ||
false, | ||
) | ||
.unwrap(); | ||
let ui = view_ui( | ||
&unkeyed, | ||
false, | ||
"query", | ||
&structured, | ||
Some(&arguments), | ||
None, | ||
read, | ||
) | ||
.unwrap(); | ||
assert!(ui.get("latest").is_none()); | ||
// A view with no summary names no noun for them. | ||
let inline = view::parse( | ||
docs/views.md+7−5
| @@ -131,7 +131,7 @@ and, with `children`, the arrays nested in it (`Thread: "…" by alice.example: | ||
| ||
### Newer items | ||
| ||
A list that runs newest first can name each item's key in `latest`, a path within each item | ||
A list whose newest items come first can name each item's key in `latest`, a path within each item | ||
(`"latest": "post.uri"`). HUD then puts `_meta.ui.latest` in the tree. It holds the same call with | ||
no cursor (`call`), the items drawn by their keys (`items`, each `{ key }`), and the summary's | ||
plural noun (`noun`, "posts"). Where the method takes a `limit`, that call asks for 2, within what | ||
| @@ -139,10 +139,12 @@ its lexicon allows and no more than the tile's own `limit`. That's the newest it | ||
a post pinned first (`includePins`) doesn't hide a newer one. | ||
| ||
Something newer came when that call's tree has a key the drawn ones lack. So a pinned post at the | ||
top of an author feed doesn't count, since it was drawn too. The bundled timeline, author feed, and | ||
knotless's feed and notifications name a key. A custom feed (`app.bsky.feed.getFeed`) doesn't, | ||
because it picks its posts afresh on every call and nearly every check would find something. What | ||
the clients do with it is on [the workspace page](workspace.md#newer-items). | ||
top of an author feed doesn't count, since it was drawn too. The bundled timeline, author feed, | ||
custom feed (`app.bsky.feed.getFeed`, For You and Discover among them), Grain's feeds (Recent, For | ||
you, Following and an account's galleries), and knotless's feed and notifications name a key. A | ||
custom feed picks its top posts afresh, so a check often finds one the tile lacks, as it does in | ||
Bluesky's app, which checks its feeds the same way. What the clients do with it is on | ||
[the workspace page](workspace.md#newer-items). | ||
| ||
## Query joins | ||
| ||
views/bsky-feed.json+1−0
| @@ -11,6 +11,7 @@ | ||
"query": { | ||
"items": "feed", | ||
"cursor": "cursor", | ||
"latest": "post.uri", | ||
"summary": { "noun": ["post", "posts"], "label": { "$": "post.record.text" } }, | ||
"layout": { | ||
"component": "List", | ||
views/grain-feed.json+1−0
| @@ -25,6 +25,7 @@ | ||
"query": { | ||
"items": "items", | ||
"cursor": "cursor", | ||
"latest": "uri", | ||
"summary": { | ||
"noun": ["gallery", "galleries"], | ||
"label": { "$": "title" } | ||