The hub (`tcm hub` runs it): what's been released lately, every library, search across them, a page for each library and person, and each library's code, shown by the forge's pages. Its jobs (`ingest`, and `mirror` as releases arrive) run beside it. `tcm dev tcmts.hub.App` serves it while you work on it.
What a search finds in one library: its newest mirrored version, and its definitions that match, best first, each with where it runs (a term's), whether it's a type's near match (`close`), and whether it reaches outside the codebase.
Someone the hub knows (they've announced a release, or said something of one): their DID, their handle as their DID document last named it (checked both ways), and their Bluesky profile as their repository signs it, read again daily (`profileAt`).
Read Jetstream every minute, from where it was left, until caught up; then work out again the facts of releases mirrored before they were all kept (renewFacts), and read again the profiles due (renewProfiles).
Catch up without Jetstream's archive: ask the relay which accounts have records of each collection the hub keeps (`com.atproto.sync.listReposByCollection`), and read each one's from its PDS, as Jetstream would have sent them. Each is given to `take` as a commit event (seq 0: it moves no cursor). An account that can't be read is said, and skipped.
Check an attestation against its writer's signed repository (a job, queued as it arrives): only then is it shown as theirs, saying what the signed record says (not what the event did). One that doesn't check out is failed; a PDS that doesn't answer is retried, as a job is.
Check a star against its writer's signed repository (a job, or when they've just starred): verified, or gone if their repository doesn't hold it (they took it back). Returns whether it's theirs now. Only a star at its own place counts: `at://<DID>/codes.tcm.star/<its library's key>`, so one person's star of a library is one row.
Set up the forge's pages to show the hub's codebase, read-only, in the hub's frame: what every page does first. Everyone is a reader (a token no one has, so no one is the maintainer).
Keep a star's row: the one at its URI replaced, else a new one, in one transaction. Jetstream's event and the visitor's own restar can both be keeping the same star at once, and the URI is unique.
The libraries the hub shows: releases that mirrored (their authors checked), and ones withdrawn since, by package and author, without the versions their authors yanked (yanksOf). One that failed isn't shown as anyone's, and one whose every version is yanked isn't shown, unless `yanked` (for its own page, and the codebases using it).
The libraries a codebase's main branch holds, by `libraryKey`, from its library records (outermost only, as `tcm lib` lists them): each by its author's DID and package where it was added as an announced release, else by its namespace, if the hub has a release of it.
The libraries someone uses, by `libraryKey`: those the releases they've announced hold (the hub knows them by hash), and those a codebase they named holds (`codebase`, a `tcm serve` URL: its main branch's library records).
What matches `q` in each of `shown` (libraries mirrored in `s`'s codebase): by name, words in docs, or a type, as `tcm find` does, but each name as its library shows it (`geo.area`, not where the hub mounts it). `by` says which (`name`: names, then docs where no name matches; `docs`: docs alone; `type`); without it, a type if `q` looks like one, names otherwise. Its own definitions only: not what it holds, nor its tests. Each library with what matches in it, best match first; the libraries by their best match, then most used. A type's near matches (more general, or more specific) are `close`; a definition whose code, or what it uses, reaches outside the codebase (or that uses a package that does) `reaches`.
Mirror a release (a job, queued as it's announced): check its record against its author's signed repository, then fetch its namespace by hash from its sources (re-hashed as it arrives) into the hub's codebase, mounted read-only at mountFor, and note the libraries it holds (and, if the version after it mirrored first, say that one's changes since it). A record that doesn't check out fails it, and it never shows as that author's; a source that doesn't answer is retried, as a job is.
Someone's Bluesky profile (`app.bsky.actor.profile/self`), as their repository signs it (signedRecord): their display name, bio and picture. Nothing, if they have none.
readJetstream(o?: { idleMs?: number | undefined; mostMs?: number | undefined; }) => Promise<{ events: number; }>
Read Jetstream's `codes.tcm.*` commits from the stored cursor until caught up (nothing new for a few seconds, or at most `mostMs`): each event's rows and the new cursor written in one transaction. With no cursor, it starts from the archive's beginning when there's an API key (`$JETSTREAM_API_KEY`, for Jetstream's archive); without one, it reads every account's records as the relay lists them (catchUpFromRelay), then the live stream from 36 hours back, as far as it reaches. A cursor the live stream no longer reaches (the hub was down for longer) is replayed the same way: from the archive, or the relay.
When Jetstream says a review, advisory or yank was deleted (a job): gone, if its writer's repository no longer holds it; kept, if it does (an event alone removes nothing).
Check a release again against its author's repository, when Jetstream says its record changed or went (a job): a hub keeps only what the repository signs, so an event alone changes nothing. A record that's gone withdraws a release the hub checked (its code stays) and drops one it never did; one that's changed is taken as it's signed now (another namespace under its version fails it); one not checked yet is mirrored.
A mirrored release's facts: its manifest's description and licence, where its code runs, what it reaches, and how its API changed since `before` (the version before it, mirrored too).
Work out again the facts of mirrored releases whose facts are older than what the hub keeps now (no `effects`): each once, against the version they were compared with. How many it did.
Read again the profiles of people the hub knows whose profile it read a day ago or more, or never: `most` at a time. One whose repository doesn't answer keeps what it had, until the next day. How many it read.
Called by a visitor's browser once it's starred a library, or taken a star back: checked against their repository at once, rather than when Jetstream says so. The library's stars now, and whether theirs is among them. Anyone can call it, so it takes DIDs alone (no star elsewhere can be made to count), and a few calls a minute from each address.
Search every library's newest mirrored version: by name, words in docs, or a type (`:(s: Shape) => number`), as `tcm find` does, or as `by` says (matchLibraries).
What the hub shows of what people say: reviews and advisories checked against their writers' repositories, and yanks only from the release's own author: someone with a release of that namespace the hub checked (`shownRelease`), saying it's theirs.
A review, advisory or yank Jetstream sent: kept, to be checked against its writer's repository; or, deleted, gone once its repository no longer holds it (`recheckAttestation`).
One Jetstream event, into the tables: a release record announced (a new row, not shown until it's checked and mirrored), changed or deleted (checked again against its author's repository first, `recheckRelease`: an event alone changes nothing the hub has checked); or a review, advisory, yank or star (its check queued), or one deleted.
Who the page is for: the DID the visitor's browser says it's signed in as. Only what they're shown depends on it (whose releases they follow, which libraries they use); what anyone can write is checked against their repository.
How much a hub takes from anyone, so no one can make it hold, fetch or remember without end: releases mirrored per account, definitions a release's namespace may name, pages of a listing read (of 100 records each, or 500 accounts), and visitors' follows and codebases remembered.
The `tcm lib add` line for a library's version, by its author's handle (or DID), called after its package: quoted as a shell needs it, so a line copied from a page runs `tcm` and nothing else.
A library's latest version, of its versions (newest first): the newest mirrored one its author didn't yank, else the newest they didn't yank (withdrawn, say), else, every one yanked, the newest mirrored, else the newest.
The libraries a served codebase holds, by `libraryKey` (`librariesOfRemote`): an http(s) address alone, at a public address, asked with no credentials (`publicRemote`: never a path, or a remote's name). A codebase that can't be read holds none.
Where a release is mounted in the hub's codebase: by its author's DID (a handle can change, a DID can't), its package and its version, each made a name: `plc_ewvi7nxz….geo.v1_3_0`.
A mirrored release's own names, as its library page lists them: everything mounted at `mount`, files kept with its code included (its README), but not the libraries it holds, nor their record.
What a Bluesky profile record says, as the hub shows it: its display name and bio (trimmed, and cut short), and its picture, served by its owner's PDS (`com.atproto.sync.getBlob`). What isn't a string, or a blob's CID, isn't taken.
What a release reaches outside itself, said in a line, its names in backticks: "reaches nothing outside itself", "only `fetchTiles` reaches the network", "`Pages`, `Stylesheet` and `createRouter` reach the environment, the clock and 2 more, through react" (what they reach is the package's doing). Facts worked out before effects were kept say it as they did.
Whether a release is one the hub shows, and attributes anything by: mirrored (checked against its author's signed record), or withdrawn after it was. A pending or failed one names nobody's code: anyone can announce someone else's namespace hash, and theirs fails.
The releases their authors yanked, by URI, each with its yank: one of its namespace, written by the release's own author, of what the hub shows (shownAttestations). Anyone else's yank of it yanks nothing.