Contents: waterfall layout of analysis pages; add Lean theorem-proving page
Deploy / deploy (push) Successful in 7m27s

- /contents: masonry cards, one per analysis page, with stats and a glimpse of what is inside
- new node lean-theorem-proving (kind "papers"): papers matched by text, their analysis articles,
  benchmarks used, full paper list; node kinds: tools | papers
- tools table rows get anchors

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FbMbJPadPzVwvt9rU9GBNo
This commit is contained in:
claude-bot
2026-10-23 21:18:29 +08:00
parent 9ffe734275
commit 5e3441d76a
7 changed files with 229 additions and 27 deletions
+34
View File
@@ -0,0 +1,34 @@
import { CONTENT_TREE, ContentNode } from './content-tree';
import { getPaperList } from './content-papers';
import { getToolTable } from './tool-taxonomy';
export interface Card {
id: string; title: string; blurb: string; kind: ContentNode['kind'];
stats: { n: number; label: string }[];
items: { title: string; href: string; note?: string }[]; // what is inside: categories, analysed papers, ...
more?: string;
}
/** One card per analysis page on /contents, with a glimpse of what is inside. */
export async function getCards(): Promise<Card[]> {
return Promise.all(CONTENT_TREE.children.map(async (n): Promise<Card> => {
const base = { id: n.id, title: n.title, blurb: n.blurb, kind: n.kind };
if (n.kind === 'tools') {
const t = await getToolTable();
const top = t.rows.filter((r) => r.depth === 0);
return {
...base,
stats: [{ n: t.tools, label: 'tools' }, { n: t.papers, label: 'papers' }, { n: t.rows.length, label: 'categories' }],
items: top.map((r) => ({ title: r.title, href: `/contents/${n.id}#${r.slug}`, note: `${r.entries.length}` })),
};
}
const l = await getPaperList(n);
const shown = l.analysed.slice(0, 6);
return {
...base,
stats: [{ n: l.total, label: 'papers' }, { n: l.analysed.length, label: 'analysed in depth' }, { n: l.byVenue.length, label: 'venues' }],
items: shown.map((a) => ({ title: a.paperTitle.split(':')[0], href: `/papers/${a.paperId}`, note: a.updatedAt })),
more: l.analysed.length > shown.length ? `+${l.analysed.length - shown.length} more` : undefined,
};
}));
}
+64
View File
@@ -0,0 +1,64 @@
import { query } from './db';
import { ensureAnalysisSchema } from './analysis-schema';
import type { ContentNode } from './content-tree';
export interface ListedPaper { id: number; conf: string; ext_id: string | null; title: string; conf_short: string; date: string; analysed: boolean }
export interface AnalysedArticle { slug: string; title: string; summary: string | null; paperId: number; paperTitle: string; updatedAt: string }
export interface PaperListContent {
total: number;
papers: ListedPaper[];
analysed: AnalysedArticle[];
byVenue: { conf_short: string; n: number }[];
benchmarks: { id: number; name: string; n: number }[];
}
const TEXT = `(p.title || ' ' || COALESCE(p.abstract, '') || ' ' || COALESCE(p.keywords, ''))`;
function where(node: ContentNode): { sql: string; params: string[] } {
const m = node.match;
if (!m) return { sql: 'FALSE', params: [] };
return m.require
? { sql: `${TEXT} ~ ? AND ${TEXT} ~* ?`, params: [m.pattern, m.require] }
: { sql: `${TEXT} ~ ?`, params: [m.pattern] };
}
/** Papers an analysis page of kind 'papers' is about, and the analysis articles written about them. */
export async function getPaperList(node: ContentNode): Promise<PaperListContent> {
const w = where(node);
const papers = await query<Omit<ListedPaper, 'analysed'>>(
`SELECT p.id, p.conf, p.ext_id, p.title, c.short AS conf_short, COALESCE(c.start_date, '2026-06-01') AS date
FROM papers p JOIN conferences c ON c.slug = p.conf
WHERE ${w.sql} ORDER BY date DESC, p.id`, w.params);
let articles: { slug: string; title: string; summary: string | null; subject_conf: string; subject_ext_id: string; updated_at: Date }[] = [];
try {
await ensureAnalysisSchema();
articles = await query(`SELECT slug, title, summary, subject_conf, subject_ext_id, updated_at FROM analysis.article ORDER BY updated_at DESC`);
} catch { /* no analysis schema reachable: list the papers without articles */ }
const byKey = new Map(papers.map((p) => [`${p.conf}/${p.ext_id}`, p]));
const analysed: AnalysedArticle[] = [];
const done = new Set<string>();
for (const a of articles) {
const p = byKey.get(`${a.subject_conf}/${a.subject_ext_id}`);
if (!p) continue;
done.add(`${p.conf}/${p.ext_id}`);
analysed.push({ slug: a.slug, title: a.title, summary: a.summary, paperId: p.id, paperTitle: p.title, updatedAt: new Date(a.updated_at).toISOString().slice(0, 10) });
}
const ids = papers.map((p) => p.id);
const benchmarks = ids.length
? await query<{ id: number; name: string; n: number }>(
`SELECT b.id, b.name, COUNT(DISTINCT pb.paper_id) AS n FROM paper_benchmarks pb JOIN benchmarks b ON b.id = pb.bench_id
WHERE pb.paper_id = ANY(?) GROUP BY b.id, b.name ORDER BY n DESC, b.id LIMIT 12`, [ids])
: [];
const venues = new Map<string, number>();
for (const p of papers) venues.set(p.conf_short, (venues.get(p.conf_short) ?? 0) + 1);
return {
total: papers.length,
papers: papers.map((p) => ({ ...p, analysed: done.has(`${p.conf}/${p.ext_id}`) })),
analysed,
byVenue: [...venues].map(([conf_short, n]) => ({ conf_short, n })).sort((a, b) => b.n - a.n),
benchmarks,
};
}
+17 -1
View File
@@ -4,15 +4,20 @@ export interface ContentNode {
id: string;
title: string;
blurb: string;
kind: 'root' | 'tools' | 'papers';
areas: string[]; // work-type areas (areas.id)
taxonomy: string[]; // taxonomy node ids
/** kind 'papers': the papers an analysis page is about = text (title + abstract + keywords) matching `pattern`
* (case-sensitive regex) and, if given, also `require` (case-insensitive). */
match?: { pattern: string; require?: string };
children: ContentNode[];
}
export const CONTENT_TREE: ContentNode = {
id: 'root',
title: 'Contents',
blurb: 'The structure of the survey write-up.',
blurb: 'Analysis pages: each one reads a group of papers in depth.',
kind: 'root',
areas: [],
taxonomy: [],
children: [
@@ -20,10 +25,21 @@ export const CONTENT_TREE: ContentNode = {
id: 'tools-of-agents',
title: 'Tools of agents',
blurb: 'How agents call tools: function calling, MCP, API use and tool-integrated reasoning.',
kind: 'tools',
areas: ['tool-use'],
taxonomy: ['agents/tools'],
children: [],
},
{
id: 'lean-theorem-proving',
title: 'Lean and formal theorem proving',
blurb: 'Papers that prove, formalize or verify in Lean 4: provers, autoformalization, benchmarks and agents.',
kind: 'papers',
areas: [],
taxonomy: [],
match: { pattern: '\\yLean( ?4)?\\y|Mathlib', require: 'theorem|formal|proof|prover|verif' },
children: [],
},
],
};