Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 94d5e21dfd7e4d5afbd335d005c277bf4ec1bdcb
parent 5bf0e2440811003510d71637d5cc90bbea76a0b2
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 11 Nov 2026 06:45:07 -0500

corpus: spec 6 -- each channel names its platform and its page there; the resolver falls back to a record's webpageUrl for an older archive (demo epic D1 item 4)

A PUBLISHED-CONTRACT CHANGE. corpus.json `spec` 5 -> 6 (CONTRACT.corpusSpec).
A channel entry, before and after:

  spec 5: { "slug", "name", "videoCount", "groupId"?, "digestCount"?, "manifests": {…} }
  spec 6: { "slug", "name", "videoCount", "groupId"?, "platform"?, "url"?, "digestCount"?, "manifests": {…} }

`platform` is the channel's configured platform, else the one its URL names;
`url` its page on that platform, only a public http(s) URL; each present only
when known (a curated mix has neither). compose-site reads them from each
channel's config (channelFactsOf). llms.txt shows them beside the channel's
name and its corpus line says what they are for. Additive: an older reader
ignores them; the archive readers (remote and local) carry them on the
ChannelRef (channelPlace drops junk), and read a spec 3-5 corpus.json as
before.

The resolver (lib/remoteArchives-server.ts archiveChannelFacts): a channel's
name, platform and url from corpus.json; for an older archive whose entry has
no platform, the transcripts manifest's lowest page and its first record with
a webpageUrl give the platform (the record's own, else its host). At most
three documents, read one after another; a slug the archive does not list is
refused. Tests: the spec bump with its reason, the entry with and without
facts, llms.txt, compose's facts from configs, the readers, the fallback walk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Diffstat:
Acommon/bin/compose-site.channelFacts.test.ts | 29+++++++++++++++++++++++++++++
Mcommon/bin/compose-site.ts | 26++++++++++++++++++++++++++
Mcommon/lib/archive/contract.test.ts | 2+-
Mcommon/lib/archive/contract.ts | 6++++--
Mcommon/lib/archive/reader-fs.ts | 2++
Mcommon/lib/archive/reader.test.ts | 34++++++++++++++++++++++++++++++++++
Mcommon/lib/archive/reader.ts | 16++++++++++++++++
Mcommon/lib/corpus.test.ts | 39++++++++++++++++++++++++++++++---------
Mcommon/lib/corpus.ts | 25+++++++++++++++++++++++--
Mcommon/lib/remoteArchives-server.ts | 78++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/lib/remoteArchives.test.ts | 34+++++++++++++++++++++++++++++++++-
Mexport/CHANGELOG.md | 3+++
Mumtool/app/api/articles/channels/route.ts | 2+-
13 files changed, 280 insertions(+), 16 deletions(-)

diff --git a/common/bin/compose-site.channelFacts.test.ts b/common/bin/compose-site.channelFacts.test.ts @@ -0,0 +1,29 @@ +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import path from "node:path"; +import { channelFactsOf } from "./compose-site"; + +// corpus.json spec 6 (demo epic D1): each channel's platform and its page, +// read from its config. +test("channel facts: the configured platform, else the URL's; the URL only when public http(s)", async () => { + const root = mkdtempSync(path.join(tmpdir(), "compose-facts-")); + try { + const put = (slug: string, config: Record<string, unknown>) => { + mkdirSync(path.join(root, slug), { recursive: true }); + writeFileSync(path.join(root, slug, "config.json"), JSON.stringify({ name: slug, handling: "youtube", ...config })); + }; + put("yt", { url: "https://www.youtube.com/@alpha" }); + put("rum", { url: "https://rumble.com/c/beta", platform: "rumble" }); + put("mix", {}); // a curated mix: no url, no platform + put("odd", { url: "file:///x" }); + const facts = await channelFactsOf({ channelsDir: root } as Parameters<typeof channelFactsOf>[0], ["yt", "rum", "mix", "odd", "missing"]); + assert.deepEqual(facts, { + yt: { platform: "youtube", url: "https://www.youtube.com/@alpha" }, + rum: { platform: "rumble", url: "https://rumble.com/c/beta" }, + }); + } finally { + rmSync(root, { recursive: true, force: true }); + } +}); diff --git a/common/bin/compose-site.ts b/common/bin/compose-site.ts @@ -69,6 +69,7 @@ import { type ArchiveManifestEntry, } from "../lib/archiveOptions"; import { readChannelConfig } from "../controller/channels"; +import { detectPlatform } from "../lib/platform"; import { isWaybackPagesChannel } from "../lib/waybackPages/config"; import { builtSiteIdIn } from "../lib/builtExport"; import { publishedMemberSlugs } from "../lib/postsVisibility"; @@ -218,6 +219,25 @@ async function composeCitedSite( // environment variable the build passes it to compose as. export const ALLOW_MISSING_MEDIA_ENV = "REPORTS_ALLOW_MISSING_MEDIA"; +// corpus.json's per-channel `platform` and `url` (spec 6): the configured +// platform, else the one its URL names; the URL only when it is a public +// http(s) page. Read from each channel's config.json; an unreadable one is +// simply unknown. +export async function channelFactsOf( + paths: Parameters<typeof readChannelConfig>[0], + slugs: readonly string[], +): Promise<Record<string, { platform?: string; url?: string }>> { + const out: Record<string, { platform?: string; url?: string }> = {}; + for (const slug of slugs) { + const config = await readChannelConfig(paths, slug).catch(() => null); + if (!config) continue; + const url = typeof config.url === "string" && /^https?:\/\//i.test(config.url.trim()) ? config.url.trim() : undefined; + const platform = config.platform ?? detectPlatform(url) ?? undefined; + if (platform || url) out[slug] = { ...(platform ? { platform } : {}), ...(url ? { url } : {}) }; + } + return out; +} + // Emit the AI-discovery surface — a small FIXED set of site-root files // (llms.txt, corpus.json, robots.txt, sitemap.xml). These document how to // navigate the already-served paginated shards; they never enumerate per-video @@ -288,6 +308,11 @@ export async function emitAiFiles( if (config && isWaybackPagesChannel(config)) channelKinds[slug] = "wayback-pages"; } + // Where each channel is (spec 6, demo epic D1): its platform and its page + // there, from its config — what a machine with no copy of the channel needs + // to fetch a cited moment's media. A channel with neither says nothing. + const channelFacts = await channelFactsOf(paths, descriptor.channels.map((c) => c.slug)); + // Whether this site published a curated vocabulary. Presence of the file is // the fact — it was written (or removed) just above, by the same rule that // decides whether any tag means anything on this site. @@ -304,6 +329,7 @@ export async function emitAiFiles( private: isPrivateSite(site), reportCount: composed.reports.length, cited: isCitedSite(site), + channelFacts, }); await writePublicFile( path.join(paths.exportPublicDir, "corpus.json"), diff --git a/common/lib/archive/contract.test.ts b/common/lib/archive/contract.test.ts @@ -164,7 +164,7 @@ test("shipsPwa: the site flag, or hub mode", () => { test("CONTRACT is frozen where it is published", () => { // These are on the wire. A change here is a change to every deployed archive's // machine contract, so it belongs in a slice that says so, not in a refactor. - assert.equal(CONTRACT.corpusSpec, 5); + assert.equal(CONTRACT.corpusSpec, 6); assert.equal(CONTRACT.siteDescriptor, 1); assert.equal(CONTRACT.manifest, 3); assert.equal(CONTRACT.transcriptsManifest, 1); diff --git a/common/lib/archive/contract.ts b/common/lib/archive/contract.ts @@ -33,8 +33,10 @@ export const CONTRACT = { // /corpus.json's own `spec`. `generator` is deliberately unversioned; see the // note in lib/corpus.ts for why a credit line did not bump the spec. 5: a // site may publish reports (`reports`), and a CITED site (`site.scope: - // "cited"`) publishes only them — no channels, no shards. - corpusSpec: 5, + // "cited"`) publishes only them — no channels, no shards. 6: each channel + // names its `platform` and its `url` on that platform (demo epic D1), so a + // client with no local copy of the channel can fetch its recordings' media. + corpusSpec: 6, // /site.json's `contract` (siteDescriptor.ts). siteDescriptor: 1, // The four manifest versions (manifest.ts). Each is the version field of one diff --git a/common/lib/archive/reader-fs.ts b/common/lib/archive/reader-fs.ts @@ -43,6 +43,7 @@ import { PageCache, PromiseMap, buildDuplicateIndex, + channelPlace, buildStatsIndex, buildVideoIndex, coerceReportIndex, @@ -295,6 +296,7 @@ export class LocalSource implements ArchiveReader { name: c.name ?? c.slug, videoCount: c.videoCount, groupId: c.groupId, + ...channelPlace(c), })); } } catch { diff --git a/common/lib/archive/reader.test.ts b/common/lib/archive/reader.test.ts @@ -452,3 +452,37 @@ test("PageCache coalesces concurrent callers and drops a rejection", async () => await assert.rejects(() => cache.take("bad", boom)); assert.equal(fails, 2); }); + +test("spec 6: a channel's platform and page ride on its ref; an older corpus.json is read as before", async () => { + const a = makeArchive({ + [`${ORIGIN}/corpus.json`]: { + ...CORPUS, + spec: 6, + channels: [ + { slug: "alpha", name: "Alpha", videoCount: 3, platform: "youtube", url: "https://www.youtube.com/@alpha" }, + { slug: "beta", name: "Beta", videoCount: 1, platform: "", url: "javascript:alert(1)" }, + ], + }, + }); + const restore = installFetch(a); + try { + const channels = await new RemoteSource(ORIGIN).listChannels(); + assert.equal(channels[0].platform, "youtube"); + assert.equal(channels[0].url, "https://www.youtube.com/@alpha"); + // Junk is not carried. + assert.equal("platform" in channels[1], false); + assert.equal("url" in channels[1], false); + } finally { + restore(); + } + // spec 3 (the CORPUS fixture): no platform, no url, nothing else changes. + const old = fullArchive(); + const restoreOld = installFetch(old); + try { + const [alpha] = await new RemoteSource(ORIGIN).listChannels(); + assert.equal(alpha.slug, "alpha"); + assert.equal("platform" in alpha, false); + } finally { + restoreOld(); + } +}); diff --git a/common/lib/archive/reader.ts b/common/lib/archive/reader.ts @@ -73,6 +73,10 @@ export type ChannelRef = { siteId?: string; siteTitle?: string; siteUrl?: string; + // Spec 6 (corpus.json): the channel's platform and its page there, when the + // archive names them. + platform?: string; + url?: string; }; // The site's channel-group definitions, as read from summaries/manifest.json — @@ -492,7 +496,18 @@ export type CorpusJsonChannel = { name?: string; videoCount?: number; groupId?: string; + // Spec 6. + platform?: string; + url?: string; }; + +// A corpus.json channel's spec-6 facts as a ChannelRef carries them: each +// only when it is a non-empty string. +export function channelPlace(c: CorpusJsonChannel): { platform?: string; url?: string } { + const platform = typeof c.platform === "string" && c.platform.trim() ? c.platform.trim() : undefined; + const url = typeof c.url === "string" && /^https?:\/\//i.test(c.url.trim()) ? c.url.trim() : undefined; + return { ...(platform ? { platform } : {}), ...(url ? { url } : {}) }; +} export type SiteCorpusJson = { channels?: CorpusJsonChannel[]; // The composed site's own declared public origin — the deployed archilyzer @@ -989,6 +1004,7 @@ export class RemoteSource implements ArchiveReader { videoCount: c.videoCount, groupId: c.groupId, siteUrl: this.base, + ...channelPlace(c), })); } diff --git a/common/lib/corpus.test.ts b/common/lib/corpus.test.ts @@ -190,15 +190,36 @@ test("Use with AI is the homepage's AI and MCP doc; the chat is the instance's / } }); -test("the spec is 5, and `generator` is still not why", () => { - // Guard on the reasoning, not just the number: a bump announces a new - // FETCHABLE document. spec 4 is /tags.json, spec 5 the reports index (and a - // cited site that publishes only reports). The informational credit string - // added at spec 3's time breaks no reader and did not bump anything — if - // either assertion is ever updated, the version-history comment in corpus.ts - // must justify why. - assert.equal(CORPUS_SPEC_VERSION, 5); - assert.equal(buildSiteCorpus(descriptor(), { hasArchives: false }).spec, 5); +test("the spec is 6, and `generator` is still not why", () => { + // Guard on the reasoning, not just the number: a bump announces something a + // reader can FETCH that it could not before. spec 4 is /tags.json, spec 5 the + // reports index (and a cited site that publishes only reports), spec 6 each + // channel's platform and page — where a cited moment's MEDIA is fetched from, + // which a machine with no copy of the channel had no way to learn (demo epic + // D1). The informational credit string added at spec 3's time breaks no + // reader and did not bump anything — if either assertion is ever updated, + // the version-history comment in corpus.ts must justify why. + assert.equal(CORPUS_SPEC_VERSION, 6); + assert.equal(buildSiteCorpus(descriptor(), { hasArchives: false }).spec, 6); +}); + +test("spec 6: a channel names its platform and its page there, only when known; llms.txt says so", () => { + const corpus = buildSiteCorpus(descriptor({ siteUrl: "https://demo.example" }), { + hasArchives: false, + channelFacts: { [descriptor().channels[0].slug]: { platform: "youtube", url: "https://www.youtube.com/@demo" } }, + }); + const [first, ...rest] = corpus.channels; + assert.equal(first.platform, "youtube"); + assert.equal(first.url, "https://www.youtube.com/@demo"); + for (const c of rest) { + assert.equal("platform" in c, false); + assert.equal("url" in c, false); + } + // Without facts the entries are shaped as at spec 5. + for (const c of buildSiteCorpus(descriptor(), { hasArchives: false }).channels) assert.deepEqual(Object.keys(c).filter((k) => k === "platform" || k === "url"), []); + const llms = renderSiteLlmsTxt(corpus); + assert.match(llms, new RegExp(`- ${first.name} \\(youtube: https://www\\.youtube\\.com/@demo\\) — `)); + assert.match(llms, /Each channel names its `platform` and its `url` there when known \(spec 6\)/); }); test("the tags pointer is present only when the site published one", () => { diff --git a/common/lib/corpus.ts b/common/lib/corpus.ts @@ -43,6 +43,15 @@ import { // An older reader sees an empty corpus there, which is the safe reading: there // is no shard to fetch. // +// v6: each channel names WHERE IT IS — `platform` (youtube, rumble, …) and +// `url`, the channel's own page on that platform, when the archive's operator +// configured one (demo epic D1). A machine with no copy of the channel (a +// fresh clone pointed at this archive) needs both to fetch a cited moment's +// media: the platform decides the pacing and whether a window is a seek or a +// whole recording. Additive: an older reader ignores both; a reader of an +// older archive falls back to a shard record's `webpageUrl` / `platform` +// (common/lib/remoteArchives-server.ts channelFactsOf). +// // NOT a v4: the `generator` field added below is deliberately unversioned. Every // prior bump announced a new FETCHABLE LAYER — a reader that ignored it would // miss data it could otherwise have retrieved. `generator` is an informational @@ -166,6 +175,10 @@ export type CorpusChannel = { name: string; videoCount: number; groupId?: string; + // Spec 6: the channel's platform and its page there. Each present only when + // known: a curated mix of several platforms' videos has no url. + platform?: string; + url?: string; manifests: { transcripts: string; subs: string; @@ -279,6 +292,9 @@ export function buildSiteCorpus( // A CITED site's build: `site.scope: "cited"` and `site.audience` always. // Its descriptor carries no channels, so the corpus has none. cited?: boolean; + // slug -> where the channel is (spec 6): its platform and its page there, + // from its config. A channel absent here, or a field left out, is unknown. + channelFacts?: Record<string, { platform?: string; url?: string }>; }, ): SiteCorpus { const base = descriptor.siteUrl; @@ -292,6 +308,8 @@ export function buildSiteCorpus( name: c.name, videoCount: c.count, ...(c.groupId ? { groupId: c.groupId } : {}), + ...(opts.channelFacts?.[c.slug]?.platform ? { platform: opts.channelFacts[c.slug].platform } : {}), + ...(opts.channelFacts?.[c.slug]?.url ? { url: opts.channelFacts[c.slug].url } : {}), ...(postCount ? { postCount } : {}), ...(opts.channelKinds?.[c.slug] ? { kind: opts.channelKinds[c.slug] } : {}), ...(digestCount ? { digestCount } : {}), @@ -459,7 +477,9 @@ export function renderSiteLlmsTxt( out.push("## Corpus"); out.push( `- [corpus.json](${corpusUrl(base)}): machine-readable index — ` + - `channels and how to fetch any transcript from the paginated JSON shards.`, + `channels and how to fetch any transcript from the paginated JSON shards. ` + + `Each channel names its \`platform\` and its \`url\` there when known (spec 6): ` + + `where a cited moment's media is fetched from.`, ); if (corpus.digestScheme) { const digested = corpus.channels.reduce( @@ -499,7 +519,8 @@ export function renderSiteLlmsTxt( out.push("## Channels"); const shown = corpus.channels.slice(0, LLMS_INLINE_LIMIT); for (const c of shown) { - out.push(`- ${c.name} — ${c.videoCount} transcripts: ${c.manifests.transcripts}`); + const where = c.url ? ` (${c.platform ? `${c.platform}: ` : ""}${c.url})` : c.platform ? ` (${c.platform})` : ""; + out.push(`- ${c.name}${where} — ${c.videoCount} transcripts: ${c.manifests.transcripts}`); } if (corpus.channels.length > shown.length) { out.push( diff --git a/common/lib/remoteArchives-server.ts b/common/lib/remoteArchives-server.ts @@ -7,6 +7,8 @@ // (every test passes a fake; no test calls a real site). import { archiveOriginOf } from "./remoteArchives"; +import { corpusUrl, manifestUrl, pageUrl } from "./archive/contract"; +import { detectPlatform } from "./detectPlatform.mjs"; export type FetchLike = (url: string, init?: { signal?: AbortSignal; headers?: Record<string, string> }) => Promise<Response>; @@ -116,3 +118,79 @@ export async function probeArchive(rawOrigin: string, opts: { fetch?: FetchLike; channels, }; } + +// ─── A channel's facts: where it is (demo epic D1 item 4) ─── + +export type ArchiveChannelFacts = { + slug: string; + name: string; + // The platform its recordings are on, or null when the archive does not say + // and no record names one. + platform: string | null; + // Its page on that platform (corpus.json spec 6), or null. + url: string | null; + // Where the facts came from: corpus.json's channel entry (spec 6), the + // channel's first shard record (an older archive), or nowhere. + from: "corpus" | "record" | "none"; + // A record's own page (the fallback's evidence), when one was read. + sampleVideoUrl?: string; +}; + +export class ArchiveChannelError extends Error { + constructor( + message: string, + readonly status = 404, + ) { + super(message); + this.name = "ArchiveChannelError"; + } +} + +// One JSON document over HTTP: a throw on anything but a 200. Injectable as +// `getJson` so the cached reader (item 6) is the one every lookup goes through. +export type GetJson = (url: string) => Promise<unknown>; + +export function plainGetJson(doFetch: FetchLike = fetch as unknown as FetchLike): GetJson { + return async (url) => { + const res = await doFetch(url, { signal: AbortSignal.timeout(PROBE_TIMEOUT_MS), headers: { accept: "application/json" } }); + if (!res.ok) throw new ArchiveChannelError(`${url} answered HTTP ${res.status}`, res.status === 404 ? 404 : 502); + return res.json(); + }; +} + +/** + * Where an archive's channel is: corpus.json's `platform` and `url` (spec 6); + * for an OLDER archive whose entry has no platform, the channel's first shard + * record — the transcripts manifest's lowest page, its first record with a + * `webpageUrl` — gives the platform (the record's own, else its page's host). + * Sequential: at most three documents, one after another. A slug the archive + * does not list is refused. + */ +export async function archiveChannelFacts(origin: string, slug: string, opts: { getJson?: GetJson; fetch?: FetchLike } = {}): Promise<ArchiveChannelFacts> { + const base = archiveOriginOf(origin); + if (!base) throw new ArchiveChannelError(`"${origin}" is not an archive's address`, 400); + const getJson = opts.getJson ?? plainGetJson(opts.fetch); + const corpus = (await getJson(corpusUrl(base))) as { channels?: Record<string, unknown>[] } | null; + const entry = (Array.isArray(corpus?.channels) ? corpus!.channels : []).find((c) => c?.slug === slug); + if (!entry) throw new ArchiveChannelError(`${base} lists no channel "${slug}"`); + const name = str(entry.name) ?? slug; + const platform = str(entry.platform); + const url = str(entry.url); + if (platform) return { slug, name, platform, url: url && /^https?:\/\//i.test(url) ? url : null, from: "corpus" }; + // An older archive: the first record's page. + const manifests = (entry.manifests && typeof entry.manifests === "object" ? entry.manifests : {}) as Record<string, unknown>; + const manifestAt = str(manifests.transcripts) ?? manifestUrl("transcripts", slug, base); + const manifest = (await getJson(manifestAt).catch(() => null)) as { slugToPage?: Record<string, unknown> } | null; + const pages = Object.values(manifest?.slugToPage ?? {}).filter((n): n is number => typeof n === "number" && Number.isInteger(n) && n >= 0); + if (pages.length > 0) { + const first = Math.min(...pages); + const records = (await getJson(pageUrl("transcripts", slug, first, base)).catch(() => null)) as Record<string, unknown>[] | null; + for (const r of Array.isArray(records) ? records : []) { + const page = str(r?.webpageUrl); + if (!page) continue; + const p = str(r.platform) ?? detectPlatform(page); + return { slug, name, platform: p, url: url && /^https?:\/\//i.test(url) ? url : null, from: p ? "record" : "none", sampleVideoUrl: page }; + } + } + return { slug, name, platform: null, url: url && /^https?:\/\//i.test(url) ? url : null, from: "none" }; +} diff --git a/common/lib/remoteArchives.test.ts b/common/lib/remoteArchives.test.ts @@ -9,7 +9,7 @@ import { originOfHandle, sanitizeRemoteArchives, } from "./remoteArchives"; -import { ArchiveProbeError, probeArchive, type FetchLike } from "./remoteArchives-server"; +import { ArchiveChannelError, ArchiveProbeError, archiveChannelFacts, probeArchive, type FetchLike } from "./remoteArchives-server"; import { defaults } from "./settingsSchema"; test("an archive origin is normalized: https assumed, trailing slash and /corpus.json dropped", () => { @@ -131,3 +131,35 @@ test("a probe refuses what is not one searchable archive, with a sentence", asyn }) as FetchLike; await assert.rejects(probeArchive("https://f.test", { fetch: down }), /did not answer: ECONNREFUSED/); }); + +// ─── archiveChannelFacts (item 4): where a channel is, from corpus.json or its first record ─── + +test("a spec-6 archive names a channel's platform and page in corpus.json: one read", async () => { + const f = fakeFetch({ "https://stub.test/corpus.json": () => respond(CORPUS) }); + const facts = await archiveChannelFacts("https://stub.test", "alpha", { fetch: f }); + assert.deepEqual(facts, { slug: "alpha", name: "Alpha", platform: "youtube", url: "https://www.youtube.com/@alpha", from: "corpus" }); + assert.deepEqual(f.asked, ["https://stub.test/corpus.json"]); +}); + +test("an older archive: the platform from the first shard's record, read in order, the lowest page", async () => { + const f = fakeFetch({ + "https://stub.test/corpus.json": () => respond({ ...CORPUS, spec: 5 }), + "https://stub.test/transcripts/beta/manifest.json": () => respond({ pageCount: 3, slugToPage: { v9: 2, v1: 1, v2: 1 } }), + "https://stub.test/transcripts/beta/page-0001.json": () => + respond([{ id: "v1", title: "no url" }, { id: "v2", webpageUrl: "https://rumble.com/v2-x.html" }]), + }); + const facts = await archiveChannelFacts("https://stub.test", "beta", { fetch: f }); + assert.deepEqual(facts, { slug: "beta", name: "Beta", platform: "rumble", url: null, from: "record", sampleVideoUrl: "https://rumble.com/v2-x.html" }); + assert.deepEqual(f.asked, [ + "https://stub.test/corpus.json", + "https://stub.test/transcripts/beta/manifest.json", + "https://stub.test/transcripts/beta/page-0001.json", + ]); +}); + +test("a channel the archive does not list is refused; one with no readable record is unknown", async () => { + const f = fakeFetch({ "https://stub.test/corpus.json": () => respond({ ...CORPUS, spec: 5 }) }); + await assert.rejects(archiveChannelFacts("https://stub.test", "nope", { fetch: f }), (e: unknown) => e instanceof ArchiveChannelError && /lists no channel "nope"/.test((e as Error).message)); + const facts = await archiveChannelFacts("https://stub.test", "beta", { fetch: f }); + assert.deepEqual(facts, { slug: "beta", name: "Beta", platform: null, url: null, from: "none" }); +}); diff --git a/export/CHANGELOG.md b/export/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## [Unreleased] +- **`corpus.json` is spec 6: each channel says where it is.** A channel's entry adds `platform` (youtube, rumble, …) and `url`, its page on that platform, when the archive's operator configured them, and `llms.txt` shows them beside the channel's name — what a machine with no copy of the channel needs to fetch a cited moment's media (a fresh Archilyzer clone pointed at the archive). Additive: a reader that does not know spec 6 reads the archive as before, and a reader of an older archive takes the platform from a transcript record's `webpageUrl`. Needs a rebuild and deploy of each site. + ## [0.11.2] - 2026-10-21 - **A link to a moment of a removed YouTube video opens the transcript at that moment.** `?v=…&t=<seconds>` for a video YouTube no longer plays used to open its transcript at the start: the reader followed only the player, which never got there. The transcript now starts at the linked moment on every platform, and a player that cannot play leaves it there. Needs a rebuild and deploy of each site. - **A report can keep a timeline, and a reader can subscribe to it.** `report.json` `entries` (each `{ "id", "date", "title", "body" }`, optionally `updated`) shows as **Timeline** after In brief: dated entries, newest first, each date linking to the entry's own place on the page (`#<id>`), each body citing as a section's does. The report counts as updated at its newest entry, in its header and the report list. Each entry is a slide too, and the HTML, PDF and Markdown downloads carry the Timeline. On a site with a public URL, the report publishes its timeline as feeds — `feed.xml` (RSS) and `feed.json` (JSON Feed) beside its page — and its header reads **Subscribe: RSS · JSON**; a feed reader finds them from the page too. A site with no public URL publishes no feed. The MCP's `get_report` reads the timeline, and its `section` may name an entry. Needs a rebuild and deploy of each site with reports. diff --git a/umtool/app/api/articles/channels/route.ts b/umtool/app/api/articles/channels/route.ts @@ -18,7 +18,7 @@ export async function GET(request: Request) { const opened = await openSource(source); const refs = await opened.source.listChannels(); const channels: EditorChannel[] = refs - .map((c) => ({ slug: c.slug, name: c.name ?? c.slug, kind: "video", platform: (c as { platform?: string }).platform ?? null, sites: [] })) + .map((c) => ({ slug: c.slug, name: c.name ?? c.slug, kind: "video", platform: c.platform ?? null, sites: [] })) .sort((a, b) => a.name.localeCompare(b.name)); return Response.json({ channels, source: opened.option.handle }, { headers: { "cache-control": "no-store" } }); } catch (err) {