// The workspace `look` draws: who is signed in, their canvases (open as // tabs, put away, shared with them, an invitation), each canvas's tiles, // and what the stream says. The tiles' content is real, as a HUD server // answered their calls with no one signed in, recorded once in // tools.json by record.mjs; everything else is made here. What the calls // are is here too, for record.mjs to ask. // // A canvas, a tile and an event are written as the appview's lexicons // (schemas/place.hud.*) shape them. /** The calls whose answers the tiles and the launcher draw, by name; `$picked.*` names what record.mjs picked from another answer. */ export const calls = { me: { name: 'describe_repo', args: { actor: '$picked.me' } }, feed: { name: 'query', args: { method: 'app.bsky.feed.getAuthorFeed', params: { actor: 'danabra.mov', limit: 6, filter: 'posts_no_replies' } } }, thread: { name: 'query', args: { method: 'app.bsky.feed.getPostThread', params: { uri: '$picked.post', depth: 2 } } }, profile: { name: 'describe_repo', args: { actor: 'danabra.mov' } }, posts: { name: 'list_records', args: { actor: 'pfrazee.com', collection: 'app.bsky.feed.post', limit: 6 } }, documents: { name: 'list_records', args: { actor: '$picked.writer', collection: '$picked.documents', limit: 5 } }, document: { name: 'get_record', args: { uri: '$picked.document' } }, feeds: { name: 'query', args: { method: 'app.bsky.feed.getFeedGenerators', params: { feeds: 'saved' } } }, likes: { name: 'list_records', args: { actor: 'chadtmiller.com', collection: 'fm.plyr.like', limit: 6 } }, // The landing's picture (the hero state): chadtmiller.com's own content alone, nobody else's. gallery: { name: 'query', args: { method: 'social.grain.gallery.getGallery', params: { gallery: 'at://did:plc:bcgltzqazw5tb6k2g3ttenbj/social.grain.gallery/3mpgwvcrieu2d' } } }, photo: { name: 'query', args: { method: 'app.bsky.feed.getPostThread', params: { uri: 'at://did:plc:bcgltzqazw5tb6k2g3ttenbj/app.bsky.feed.post/3mnd2bjtfas2a', depth: 0, parentHeight: 0 } } }, repos: { name: 'query', args: { method: 'dev.knotless.getActorRepos', params: { actor: 'chadtmiller.com' } } } }; /** The feeds the launcher shows as saved, asked for by URI, as no one has saved feeds. */ export const savedFeeds = [ 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot', 'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/with-friends', 'at://did:plc:wqowuobffl66jv3kpsvo7ak4/app.bsky.feed.generator/the-science-feed' ]; /** The people the canvases are shared with, real accounts whose faces getProfiles answers; and one with no profile, and a long handle. */ export const people = ['danabra.mov', 'pfrazee.com', 'bnewbold.net', 'jay.bsky.team']; const at = '2026-11-14T18:00:00.000Z'; const ids = (n) => `${n}`.padStart(12, 'a').slice(-12); /** The world, given what record.mjs recorded: `dids` by handle, `picked` URIs. */ export function world({ dids, picked }) { const me = { did: dids['chadtmiller.com'], handle: 'chadtmiller.com' }; const person = (handle) => ({ did: dids[handle] ?? `did:plc:${handle.replace(/[^a-z0-9]/g, '').slice(0, 24).padEnd(24, 'x')}`, handle }); const dan = person('danabra.mov'); const paul = person('pfrazee.com'); const bryan = person('bnewbold.net'); const jay = person('jay.bsky.team'); const long = person('someone-with-a-really-long-handle.pds.example-community.social'); let n = 0; const tile = (call, title, extra = {}) => { const { name, args } = calls[call]; return { key: ids(`1${++n}`), author: extra.author ?? me.did, record: { $type: 'place.hud.tile', tool: name, arguments: filled(args, picked), title, order: String(extra.order ?? n), ...(extra.width ? { width: extra.width } : {}), ...(extra.stack ? { stack: extra.stack } : {}), ...(extra.from ? { from: extra.from } : {}), by: extra.by ?? 'person', createdAt: at }, ...(extra.icon ? { icon: extra.icon } : {}) }; }; // One title a person gave (the feed's); the rest as HUD's server makes them where none is given, which the page reads past. const feed = tile('feed', 'danabra.mov’s posts', { icon: '/icon/bsky.app', order: 1 }); const thread = tile('thread', 'query app.bsky.feed.getPostThread', { icon: '/icon/bsky.app', from: feed.key, order: 2 }); const profile = tile('profile', 'danabra.mov', { from: thread.key, order: 3 }); const document = tile('document', `pub.leaflet.document · ${picked.document.split('/')[2]}`, { width: 'half', icon: picked.documentsIcon, order: 4 }); const documents = tile('documents', 'pub.leaflet.document · pfrazee.com', { icon: picked.documentsIcon, order: 5 }); const posts = tile('posts', 'app.bsky.feed.post · pfrazee.com', { icon: '/icon/bsky.app', order: 6 }); const stacked = tile('profile', 'danabra.mov', { stack: posts.key, order: 7, author: paul.did }); const member = (who, role, extra = {}) => ({ did: who.did, handle: who.handle, role, ...extra }); const canvas = (key, name, owner, role, members, tiles, extra = {}) => ({ view: { key, owner: owner.did, record: { $type: 'place.hud.canvas', name, createdAt: at, updatedAt: at }, members, tileCount: tiles.length, storage: { kind: 'file' }, viewer: { role, ...(extra.invitedBy ? { invitedBy: extra.invitedBy } : {}) } }, tiles }); const canvases = [ canvas('c00000000001', 'My canvas', me, 'owner', [member(me, 'owner')], [feed, thread, profile, document]), canvas('c00000000002', 'Coast trip', me, 'owner', [member(me, 'owner'), member(paul, 'editor'), member(bryan, 'viewer', { invitedBy: me.did })], [documents, posts, stacked]), canvas('c00000000003', 'Atproto reading group', dan, 'viewer', [member(dan, 'owner'), member(me, 'viewer', { invitedBy: dan.did }), member(jay, 'editor', { invitedBy: dan.did })], [ tile('profile', '@danabra.mov', { author: dan.did }), tile('feed', 'danabra.mov’s posts', { author: dan.did, icon: '/icon/bsky.app' }) ]), canvas('c00000000004', 'Knotless issues', me, 'owner', [member(me, 'owner')], [tile('posts', 'pfrazee.com’s posts', { icon: '/icon/bsky.app' })]), canvas('c00000000005', 'Film photos', paul, 'viewer', [member(paul, 'owner'), member(me, 'viewer', { invitedBy: paul.did })], [tile('profile', '@pfrazee.com', { author: paul.did })]), canvas('c00000000006', 'Protocol nerds', bryan, 'editor', [member(bryan, 'owner'), member(me, 'editor', { pending: true, invitedBy: bryan.did })], [], { invitedBy: bryan.did }), canvas('c00000000007', 'An empty canvas', me, 'owner', [member(me, 'owner')], []), canvas('c00000000008', 'A canvas with a name long enough to be cut short in its tab, and then some', me, 'owner', [member(me, 'owner'), member(long, 'editor')], [tile('profile', '@danabra.mov')]), canvas('c00000000009', 'Listening', me, 'owner', [member(me, 'owner')], [tile('likes', 'Liked tracks', { icon: '/icon/plyr.fm' }), tile('posts', 'pfrazee.com’s posts', { icon: '/icon/bsky.app' })]), // The landing's picture (the hero state): only chadtmiller.com's own, in a canvas he alone is in: a Grain gallery, a Bluesky post of a photo with his profile stacked under it, his knotless repositories. canvas('c00000000010', 'My atmosphere', me, 'owner', [member(me, 'owner')], (() => { const photo = tile('photo', 'Golden Gate', { icon: '/icon/bsky.app', order: 2 }); return [ tile('gallery', 'TMB Day 6', { icon: '/icon/grain.social', order: 1 }), photo, tile('me', 'chadtmiller.com', { stack: photo.key, order: 1 }), tile('repos', 'My repositories', { icon: '/icon/knotless.dev', order: 3 }) ]; })()) ]; const by = (who, kind = 'person') => ({ did: who.did, handle: who.handle, kind }); const presence = (key, present) => ({ $type: 'place.hud.defs#presenceEvent', canvas: key, present: present.map((p) => ({ did: p.did, handle: p.handle })) }); return { me, canvases, /** The tabs open, in order, and the one on screen. */ open: ['c00000000001', 'c00000000002', 'c00000000003'], current: 'c00000000001', /** What the stream says as it opens: who is on each open canvas. */ presence: [presence('c00000000001', [me]), presence('c00000000002', [me, paul]), presence('c00000000003', [me, dan, jay])], /** What it says after, by name, for `--events`. */ events: { // An agent adds a tile to a tab out of sight, and a member changes another. badges: [ { $type: 'place.hud.defs#tileEvent', canvas: 'c00000000002', op: 'add', key: ids('901'), tile: tile('profile', 'Researched: @danabra.mov', { by: 'agent' }), by: by(me, 'agent') }, { $type: 'place.hud.defs#tileEvent', canvas: 'c00000000002', op: 'add', key: ids('902'), tile: tile('feed', 'Researched: posts', { by: 'agent', icon: '/icon/bsky.app' }), by: by(me, 'agent') }, { $type: 'place.hud.defs#tileEvent', canvas: 'c00000000003', op: 'update', key: canvases[2].tiles[0].key, tile: canvases[2].tiles[0], by: by(dan) } ], // An agent adds a tile to the canvas on screen. arrival: [{ $type: 'place.hud.defs#tileEvent', canvas: 'c00000000001', op: 'add', key: ids('903'), tile: tile('posts', 'Agent: pfrazee.com’s posts', { by: 'agent', icon: '/icon/bsky.app', order: 1.5 }), by: by(me, 'agent') }] } }; } /** `args` with what record.mjs picked put in. */ export function filled(args, picked) { return JSON.parse(JSON.stringify(args), (_, v) => (typeof v === 'string' && v.startsWith('$picked.') ? picked[v.slice(8)] : v)); }