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
+54
View File
@@ -0,0 +1,54 @@
import Link from 'next/link';
import type { PaperListContent } from '../lib/content-papers';
/** Body of an analysis page about a group of papers (kind 'papers'). */
export default function PaperGroup({ list }: { list: PaperListContent }) {
return (
<>
<div className="cards">
<div className="card"><div className="stat">{list.total}</div>papers in this group</div>
<div className="card"><div className="stat">{list.analysed.length}</div>analysed in depth</div>
{list.byVenue.slice(0, 4).map((v) => <div key={v.conf_short} className="card"><div className="stat">{v.n}</div>at {v.conf_short}</div>)}
</div>
<h2>Analysed in depth</h2>
{list.analysed.length === 0 && <p className="sub">No paper in this group has an analysis article yet.</p>}
<div className="masonry">
{list.analysed.map((a) => (
<Link key={a.slug} href={`/papers/${a.paperId}`} className="tile tile-papers">
<div className="tile-kind">Analysis · updated {a.updatedAt}</div>
<h3>{a.paperTitle.split(':')[0]}</h3>
<p><b style={{ color: 'var(--fg)' }}>{a.title}</b></p>
{a.summary && <p>{a.summary}</p>}
</Link>
))}
</div>
{list.benchmarks.length > 0 && (
<>
<h2>Benchmarks these papers use</h2>
<table>
<thead><tr><th>Benchmark</th><th>Papers</th></tr></thead>
<tbody>{list.benchmarks.map((b) => <tr key={b.id}><td><Link href={`/benchmarks/${b.id}`}>{b.name}</Link></td><td>{b.n}</td></tr>)}</tbody>
</table>
</>
)}
<h2>All papers in the group</h2>
<p className="sub">Matched by text (title, abstract, keywords); a paper may be a false match.</p>
<table>
<thead><tr><th>Paper</th><th>Venue</th><th>Date</th><th>Analysis</th></tr></thead>
<tbody>
{list.papers.map((p) => (
<tr key={p.id}>
<td><Link href={`/papers/${p.id}`}>{p.title}</Link></td>
<td style={{ whiteSpace: 'nowrap' }}>{p.conf_short}</td>
<td style={{ whiteSpace: 'nowrap' }}>{p.date}</td>
<td>{p.analysed ? '✓' : ''}</td>
</tr>
))}
</tbody>
</table>
</>
);
}
+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: [],
},
],
};
+18 -5
View File
@@ -4,20 +4,33 @@ import Layout from '../../components/Layout';
import { getContent } from '../../lib/content';
import { findNode } from '../../lib/content-tree';
import { getToolTable, ToolTable } from '../../lib/tool-taxonomy';
import { getPaperList, PaperListContent } from '../../lib/content-papers';
import PaperGroup from '../../components/PaperGroup';
import { typeSlug } from '../../lib/slug';
type Content = Awaited<ReturnType<typeof getContent>>;
interface Props { node: { id: string; title: string; blurb: string; areas: string[]; taxonomy: string[] }; content: Content; tools: ToolTable | null }
interface Props { node: { id: string; title: string; blurb: string; areas: string[]; taxonomy: string[] }; content: Content | null; tools: ToolTable | null; list: PaperListContent | null }
export const getServerSideProps: GetServerSideProps<Props> = async ({ params }) => {
const node = findNode(String(params?.node));
if (!node || node.id === 'root') return { notFound: true };
const { children: _c, ...plain } = node;
const tools = node.id === 'tools-of-agents' ? await getToolTable() : null;
return { props: { node: plain, content: await getContent(node), tools } };
if (node.kind === 'papers') return { props: { node: plain, content: null, tools: null, list: await getPaperList(node) } };
const tools = node.kind === 'tools' ? await getToolTable() : null;
return { props: { node: plain, content: await getContent(node), tools, list: null } };
};
export default function Contents({ node, content, tools }: Props) {
export default function Contents({ node, content, tools, list }: Props) {
if (!content) {
return (
<Layout title={node.title}>
<p><Link href="/contents">← Contents</Link></p>
<h1>{node.title}</h1>
<p className="sub">{node.blurb}</p>
{list && <PaperGroup list={list} />}
</Layout>
);
}
const area = content.areas[0];
return (
<Layout title={node.title}>
@@ -50,7 +63,7 @@ export default function Contents({ node, content, tools }: Props) {
<thead><tr><th>Category</th><th>Papers</th><th>Tools (paper)</th></tr></thead>
<tbody>
{tools.rows.map((r) => (
<tr key={r.slug}>
<tr key={r.slug} id={r.slug}>
<td title={r.descr ?? undefined}>
{r.path.slice(0, -1).map((t, i) => <span key={i} style={{ color: 'var(--muted)' }}>{t} → </span>)}
<b>{r.title}</b>
+26 -21
View File
@@ -1,31 +1,36 @@
import type { GetServerSideProps } from 'next';
import Link from 'next/link';
import Layout from '../../components/Layout';
import { CONTENT_TREE, ContentNode } from '../../lib/content-tree';
import { CONTENT_TREE } from '../../lib/content-tree';
import { Card, getCards } from '../../lib/content-cards';
function Toc({ nodes, prefix }: { nodes: ContentNode[]; prefix: string }) {
return (
<ol style={{ listStyle: 'none', paddingLeft: prefix ? 24 : 0 }}>
{nodes.map((n, i) => {
const num = `${prefix}${i + 1}`;
return (
<li key={n.id} style={{ margin: '10px 0' }}>
<span className="sub" style={{ margin: 0, marginRight: 8 }}>{num}</span>
<Link href={`/contents/${n.id}`}><b>{n.title}</b></Link>
<div className="sub" style={{ margin: '2px 0 0 28px', fontSize: 13 }}>{n.blurb}</div>
{n.children.length > 0 && <Toc nodes={n.children} prefix={`${num}.`} />}
</li>
);
})}
</ol>
);
}
export const getServerSideProps: GetServerSideProps<{ cards: Card[] }> = async () => ({ props: { cards: await getCards() } });
export default function Contents() {
const KIND: Record<string, string> = { tools: 'Taxonomy table', papers: 'Paper group' };
export default function Contents({ cards }: { cards: Card[] }) {
return (
<Layout title="Contents">
<h1>Contents</h1>
<p className="sub">{CONTENT_TREE.blurb} Each entry opens its own page.</p>
<div className="card"><Toc nodes={CONTENT_TREE.children} prefix="" /></div>
<p className="sub">{CONTENT_TREE.blurb} Each card opens its own page.</p>
<div className="masonry">
{cards.map((c) => (
<Link key={c.id} href={`/contents/${c.id}`} className={`tile tile-${c.kind}`}>
<div className="tile-kind">{KIND[c.kind] ?? 'Analysis'}</div>
<h3>{c.title}</h3>
<p>{c.blurb}</p>
<div className="tile-stats">
{c.stats.map((s) => <span key={s.label}><b>{s.n.toLocaleString()}</b> {s.label}</span>)}
</div>
{c.items.length > 0 && (
<ul>
{c.items.map((it) => <li key={it.title}>{it.title}{it.note && <i>{it.note}</i>}</li>)}
{c.more && <li className="more">{c.more}</li>}
</ul>
)}
</Link>
))}
</div>
</Layout>
);
}
+16
View File
@@ -94,3 +94,19 @@ h3{font-size:16px;margin:18px 0 8px}
.mermaid-svg{overflow-x:auto;text-align:center}
.mermaid-svg svg{max-width:100%;height:auto}
pre.mermaid-src,pre.code-block{background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:10px 12px;overflow:auto;font-size:12.5px}
/* waterfall (masonry) layout of analysis pages on /contents */
.masonry{column-width:300px;column-gap:16px}
.tile{display:block;break-inside:avoid;margin:0 0 16px;padding:16px 18px;background:var(--card,#fff);border:1px solid var(--line,#e6e6e3);border-top:4px solid var(--accent);border-radius:12px;color:inherit;text-decoration:none;transition:box-shadow .15s,transform .15s}
.tile:hover{box-shadow:0 6px 18px rgba(0,0,0,.08);transform:translateY(-2px)}
.tile.tile-papers{border-top-color:#0f8a6d}
.tile-kind{font-size:11px;letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.tile h3{margin:6px 0 6px;font-size:18px;color:var(--accent)}
.tile.tile-papers h3{color:#0f8a6d}
.tile p{margin:0 0 10px;font-size:14px;color:var(--muted)}
.tile-stats{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:13px;margin-bottom:8px}
.tile-stats b{font-size:16px}
.tile ul{list-style:none;margin:8px 0 0;padding:8px 0 0;border-top:1px solid var(--line,#e6e6e3);font-size:13px}
.tile li{display:flex;justify-content:space-between;gap:10px;padding:2px 0}
.tile li i{font-style:normal;color:var(--muted)}
.tile li.more{color:var(--muted)}