chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.6.0 Latest 5 packages
0
0
plyr.fm's charts open from its page, and an artist's tracks show
crates/hud-core/src/apps.rs+9−1
| @@ -231,7 +231,15 @@ mod tests { | ||
let yours = &entries("bsky.app", me)[2].call; | ||
assert_eq!(yours["args"]["params"], json!({ "feeds": "saved" })); | ||
assert_eq!(titles("knotless.dev", None), ["Everyone’s activity"]); | ||
assert!(titles("plyr.fm", me).is_empty()); | ||
assert_eq!( | ||
titles("plyr.fm", None), | ||
[ | ||
"Latest", | ||
"Trending this week", | ||
"Top this month", | ||
"Top of all time" | ||
] | ||
); | ||
let mine = entries("bsky.app", me); | ||
assert_eq!( | ||
mine[0].call, | ||
crates/hud-core/src/tools.rs+50−0
| @@ -3669,6 +3669,56 @@ mod tests { | ||
assert!(queries_opened(&items[2]).is_empty()); | ||
} | ||
| ||
/// plyr.fm's charts draw their tracks in the Player, each with its | ||
/// title and audio: the top tracks' inside their `track`, the latest's | ||
/// as they are. | ||
#[test] | ||
fn plyr_charts_draw_their_tracks() { | ||
let track = |n: usize| { | ||
json!({ "uri": format!("at://did:plc:a/fm.plyr.track/{n}"), "cid": "bafyrei", | ||
"artist": { "did": "did:plc:a", "handle": "a.test" }, | ||
"record": { "$type": "fm.plyr.track", "title": format!("Track {n}"), "artist": "A", | ||
"audioUrl": format!("https://audio.plyr.fm/audio/{n}.mp3"), | ||
"fileType": "mp3", "createdAt": "2026-11-17T09:00:00.000Z" }, | ||
"indexedAt": "2026-11-17T09:00:00.000Z" }) | ||
}; | ||
for (method, response) in [ | ||
( | ||
"fm.plyr.unspecced.getTopTracks", | ||
json!({ "tracks": [{ "track": track(1), "likeCount": 3 }, { "track": track(2), "likeCount": 1 }] }), | ||
), | ||
( | ||
"fm.plyr.unspecced.getLatestTracks", | ||
json!({ "tracks": [track(1), track(2)], "cursor": "c" }), | ||
), | ||
] { | ||
let chosen = Args::of(Some(&json!({})), &["view"]) | ||
.unwrap() | ||
.method_view(method) | ||
.unwrap() | ||
.expect("a bundled view"); | ||
let structured = json!({ "method": method, "params": {}, "response": response, | ||
"service": "did:web:api.next.plyr.fm#plyr_appview" }); | ||
let ui = view_ui( | ||
chosen.view(), | ||
true, | ||
"query", | ||
&structured, | ||
None, | ||
None, | ||
(None, None), | ||
) | ||
.unwrap(); | ||
assert_eq!(ui::check(&ui), Ok(()), "{ui:#}"); | ||
let player = &ui["root"]; | ||
assert_eq!(player["c"], "Player", "{ui:#}"); | ||
let items = player["items"].as_array().unwrap(); | ||
assert_eq!(items.len(), 2, "{method}"); | ||
assert_eq!(items[0]["title"], "Track 1"); | ||
assert_eq!(items[1]["src"], "https://audio.plyr.fm/audio/2.mp3"); | ||
} | ||
} | ||
| ||
#[test] | ||
fn a_feed_tree_says_how_to_tell_something_newer_came() { | ||
let bundled = |method| { | ||
crates/hud-core/src/view.rs+1−1
| @@ -4350,7 +4350,7 @@ mod tests { | ||
seen += 1; | ||
} | ||
} | ||
assert_eq!(seen, 15); | ||
assert_eq!(seen, 19); | ||
// Those naming the person need one signed in. | ||
let names_me: Vec<bool> = for_method("dev.knotless.getFeed") | ||
.unwrap() | ||
docs/views.md+4−2
| @@ -223,6 +223,8 @@ one for the collection or method, and otherwise they draw generically. | ||
| `views/bsky-notifications.json`, `views/grain-notifications.json` | Your Bluesky and Grain notifications: who did what, the post, comment or gallery it's about | | ||
| `views/plyr-list.json` | plyr.fm albums and playlists | | ||
| `views/plyr-likes.json` | plyr.fm likes, as a playlist | | ||
| `views/plyr-tracks.json` | plyr.fm tracks an artist uploaded, to play | | ||
| `views/plyr-top-tracks.json`, `views/plyr-latest-tracks.json` | plyr.fm's most liked tracks over a period, and its newest, to play | | ||
| `views/standard-document.json` | Blog posts (standard.site documents) | | ||
| `views/standard-publication.json` | A blog with its posts joined by backlinks | | ||
| `views/knotless-*.json` | [knotless's views](knotless.md) | | ||
| @@ -283,13 +285,13 @@ any collection of the query's domain. | ||
| ||
A collection view's profile section is `{ "title", "limit" }` (1 to 10, 3 by default). It shows | ||
that collection's newest records, drawn by the view's list layout, where the account holds the | ||
collection. standard.site's blog posts ("Blog") and plyr.fm's albums, playlists and likes have one. | ||
collection. standard.site's blog posts ("Blog") and plyr.fm's tracks, albums, playlists and likes have one. | ||
| ||
### Activity | ||
| ||
A collection view may also name its records' activity (`"activity": "Posted"`). That's a short | ||
past-tense verb, 20 characters at most, for where its list's summary labels a record by its own | ||
words. standard.site's documents have "Published" and plyr.fm's playlists have "Made". | ||
words. standard.site's documents have "Published", plyr.fm's playlists "Made" and its tracks "Uploaded". | ||
| ||
## Records | ||
| ||
lexicons/fm.plyr.unspecced.defs.jsonnew+75−0
| @@ -0,0 +1,75 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "fm.plyr.unspecced.defs", | ||
"defs": { | ||
"trackView": { | ||
"type": "object", | ||
"description": "A track as plyr.fm indexes it: the fm.plyr.track record exactly as the artist wrote it, with counts plyr.fm derives.", | ||
"required": [ | ||
"uri", | ||
"cid", | ||
"artist", | ||
"record", | ||
"indexedAt" | ||
], | ||
"properties": { | ||
"uri": { | ||
"type": "string", | ||
"format": "at-uri", | ||
"description": "AT-URI of the fm.plyr.track record." | ||
}, | ||
"cid": { | ||
"type": "string", | ||
"format": "cid", | ||
"description": "CID of that record; record is the record at this CID." | ||
}, | ||
"artist": { | ||
"type": "ref", | ||
"ref": "#artistView" | ||
}, | ||
"record": { | ||
"type": "unknown", | ||
"description": "The fm.plyr.track record at this cid." | ||
}, | ||
"likeCount": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"description": "All-time likes." | ||
}, | ||
"playCount": { | ||
"type": "integer", | ||
"minimum": 0 | ||
}, | ||
"indexedAt": { | ||
"type": "string", | ||
"format": "datetime" | ||
} | ||
} | ||
}, | ||
"artistView": { | ||
"type": "object", | ||
"required": [ | ||
"did", | ||
"handle" | ||
], | ||
"properties": { | ||
"did": { | ||
"type": "string", | ||
"format": "did" | ||
}, | ||
"handle": { | ||
"type": "string", | ||
"format": "handle" | ||
}, | ||
"displayName": { | ||
"type": "string", | ||
"maxLength": 640 | ||
}, | ||
"avatar": { | ||
"type": "string", | ||
"format": "uri" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
lexicons/fm.plyr.unspecced.getLatestTracks.jsonnew+45−0
| @@ -0,0 +1,45 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "fm.plyr.unspecced.getLatestTracks", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "The newest public tracks in discovery, newest first. Tracks tagged as AI-generated are left out, as on the plyr.fm home feed. No auth required; results are not personalized.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 50, | ||
"default": 20 | ||
}, | ||
"cursor": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"tracks" | ||
], | ||
"properties": { | ||
"cursor": { | ||
"type": "string" | ||
}, | ||
"tracks": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "fm.plyr.unspecced.defs#trackView" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
lexicons/fm.plyr.unspecced.getTopTracks.jsonnew+69−0
| @@ -0,0 +1,69 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "fm.plyr.unspecced.getTopTracks", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "The most liked public tracks over a period, most liked in the period first. No auth required; results are not personalized.", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"period": { | ||
"type": "string", | ||
"knownValues": [ | ||
"day", | ||
"week", | ||
"month", | ||
"all" | ||
], | ||
"default": "all", | ||
"maxLength": 32, | ||
"description": "Window for counting likes: the last day, week or month, or all time." | ||
}, | ||
"limit": { | ||
"type": "integer", | ||
"minimum": 1, | ||
"maximum": 50, | ||
"default": 10 | ||
} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": [ | ||
"tracks" | ||
], | ||
"properties": { | ||
"tracks": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "#topTrack" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"topTrack": { | ||
"type": "object", | ||
"required": [ | ||
"track", | ||
"likeCount" | ||
], | ||
"properties": { | ||
"track": { | ||
"type": "ref", | ||
"ref": "fm.plyr.unspecced.defs#trackView" | ||
}, | ||
"likeCount": { | ||
"type": "integer", | ||
"minimum": 0, | ||
"description": "Likes the track received in the period; the ranking key." | ||
} | ||
} | ||
} | ||
} | ||
} | ||
scripts/lexicons.mjs+3−2
| @@ -4,7 +4,8 @@ | ||
// social.grain and the community.lexicon.location defs Grain refers to from | ||
// grainsocial/grain, xyz.statusphere from | ||
// bluesky-social/statusphere-example-app, and fm.plyr from zzstoatzz/plyr.fm | ||
// (its lexicons/ flat, a file per NSID). Only the documents HUD reads are | ||
// (its lexicons/ flat, a file per NSID, and next/backend's appview queries, | ||
// fm.plyr.unspecced.*). Only the documents HUD reads are | ||
// kept: those defining a record or a query (which the query tool calls | ||
// and views draw), those of defs alone, and the procedures a bundled view | ||
// calls (views/*.json: an `Action`'s `call`, a `Messages`' `send`), which | ||
| @@ -22,7 +23,7 @@ const SOURCES = [ | ||
{ repo: 'bluesky-social/bsky', dirs: ['lexicons/app/bsky', 'lexicons/chat/bsky'] }, | ||
{ repo: 'grainsocial/grain', dirs: ['lexicons/social/grain', 'lexicons/community/lexicon/location'] }, | ||
{ repo: 'bluesky-social/statusphere-example-app', dirs: ['lexicons/xyz/statusphere'] }, | ||
{ repo: 'zzstoatzz/plyr.fm', dirs: ['lexicons'] } | ||
{ repo: 'zzstoatzz/plyr.fm', dirs: ['lexicons', 'next/backend/lexicons/unspecced'] } | ||
]; | ||
const SKIP = new Set(['procedure', 'subscription', 'permission-set']); | ||
| ||
views/plyr-latest-tracks.jsonnew+36−0
| @@ -0,0 +1,36 @@ | ||
{ | ||
"$type": "place.hud.view", | ||
"method": "fm.plyr.unspecced.getLatestTracks", | ||
"app": "plyr.fm", | ||
"service": "did:web:api.next.plyr.fm#plyr_appview", | ||
"description": "plyr.fm's newest tracks, to play (params: { limit?: 1 to 50, cursor? })", | ||
"launch": [{ "title": "Latest", "params": { "limit": 25 } }], | ||
"origins": [ | ||
"https://api.plyr.fm", | ||
"https://audio.plyr.fm", | ||
"https://3e9ba01cd687b3c4d29033908177072e.r2.cloudflarestorage.com", | ||
"https://images.plyr.fm", | ||
"https://pub-d4ed8a1e39d44dac85263d86ad5676fd.r2.dev", | ||
"https://pub-7ea7ea9a6f224f4f8c0321a2bb008c5a.r2.dev" | ||
], | ||
"query": { | ||
"items": "tracks", | ||
"cursor": "cursor", | ||
"summary": { | ||
"noun": ["track", "tracks"], | ||
"label": { "$": "record.title" } | ||
}, | ||
"layout": { | ||
"component": "Player", | ||
"props": { | ||
"items": { "$": "items" }, | ||
"src": { "$": ["record.audioBlob", "record.audioUrl"] }, | ||
"title": { "$": "record.title" }, | ||
"subtitle": { "$": ["record.artist", "artist.displayName", "artist.handle"] }, | ||
"subtitleHref": { "$": "artist.did" }, | ||
"duration": { "$": "record.duration" }, | ||
"art": { "$": ["record.imageBlob", "record.imageUrl"] } | ||
} | ||
} | ||
} | ||
} | ||
views/plyr-likes.json+12−20
| @@ -6,7 +6,9 @@ | ||
"description": "plyr.fm likes, as a playlist", | ||
"pageSize": 50, | ||
"origins": [ | ||
"https://api.plyr.fm", | ||
"https://audio.plyr.fm", | ||
"https://3e9ba01cd687b3c4d29033908177072e.r2.cloudflarestorage.com", | ||
"https://images.plyr.fm", | ||
"https://pub-d4ed8a1e39d44dac85263d86ad5676fd.r2.dev", | ||
"https://pub-7ea7ea9a6f224f4f8c0321a2bb008c5a.r2.dev" | ||
| @@ -18,26 +20,16 @@ | ||
"label": { "$": "joins.track.value.title" } | ||
}, | ||
"layout": { | ||
"component": "Stack", | ||
"props": { "gap": "md" }, | ||
"children": [ | ||
{ | ||
"component": "Header", | ||
"props": { "title": "Liked tracks", "meta": [{ "$": ["handle", "did"] }] } | ||
}, | ||
{ | ||
"component": "Player", | ||
"props": { | ||
"items": { "$": "records" }, | ||
"src": { "$": ["joins.track.value.audioBlob", "joins.track.value.audioUrl"] }, | ||
"title": { "$": "joins.track.value.title" }, | ||
"subtitle": { "$": "joins.track.value.artist" }, | ||
"subtitleHref": { "$": "joins.track.did" }, | ||
"duration": { "$": "joins.track.value.duration" }, | ||
"art": { "$": ["joins.track.value.imageBlob", "joins.track.value.imageUrl"] } | ||
} | ||
} | ||
] | ||
"component": "Player", | ||
"props": { | ||
"items": { "$": "records" }, | ||
"src": { "$": ["joins.track.value.audioBlob", "joins.track.value.audioUrl"] }, | ||
"title": { "$": "joins.track.value.title" }, | ||
"subtitle": { "$": "joins.track.value.artist" }, | ||
"subtitleHref": { "$": "joins.track.did" }, | ||
"duration": { "$": "joins.track.value.duration" }, | ||
"art": { "$": ["joins.track.value.imageBlob", "joins.track.value.imageUrl"] } | ||
} | ||
} | ||
}, | ||
"record": { | ||