chadtmiller.com/hud
A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts
place.hud.hudkit 0.3.1 Latest 5 packages
0
0
// Before the flows: the world (world.mjs), once for the run. Where HUD is,
// who is in the world, and the SPKI hash of the certificate HUD is served
// with, which the browser trusts for it alone, go to the flows in
// E2E_WORLD. Returns the teardown. With HUD_MEMORY set (`just memory`),
// the world is the one memory.spec.mjs measures: the release build,
// reading public data as HUD does in use (DIDs from plc.directory too,
// counts from Constellation, apps' favicons from Bluesky's service, public
// images from Bluesky's CDN).
import { execSync } from 'node:child_process';
import { join } from 'node:path';
import { start } from './world.mjs';
export default async function setup() {
const world = await start(
process.env.HUD_MEMORY
? {
binary: process.env.HUD_MEMORY_BIN || 'target/release/hud',
publicPlc: true,
env: {
HUD_BACKLINKS: 'constellation:https://constellation.microcosm.blue',
HUD_FAVICONS: 'https://cardyb.bsky.app/v1/favicon?url=',
HUD_IMAGE_CDN: 'https://cdn.bsky.app/img',
},
}
: {},
);
// The certificate's public key, as Chromium's
// --ignore-certificate-errors-spki-list takes it.
const spki = execSync(
`openssl x509 -in '${world.cert}' -pubkey -noout | openssl pkey -pubin -outform der | openssl dgst -sha256 -binary | base64`,
)
.toString()
.trim();
process.env.E2E_WORLD = JSON.stringify({
base: world.base,
hudUrl: world.hudUrl,
hudPid: world.hudPid,
host: world.host,
spki,
pds: world.pds,
plc: world.plc,
spaces: world.spaces,
accounts: world.accounts,
posts: world.posts,
avatar: world.avatar,
imageCdn: world.imageCdn,
lexicons: world.lexicons,
dataDir: join(world.dir, 'data'),
});
return () => world.stop();
}