diff --git a/components/PaperGroup.tsx b/components/PaperGroup.tsx new file mode 100644 index 0000000..29568b8 --- /dev/null +++ b/components/PaperGroup.tsx @@ -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 ( + <> +
+
{list.total}
papers in this group
+
{list.analysed.length}
analysed in depth
+ {list.byVenue.slice(0, 4).map((v) =>
{v.n}
at {v.conf_short}
)} +
+ +

Analysed in depth

+ {list.analysed.length === 0 &&

No paper in this group has an analysis article yet.

} +
+ {list.analysed.map((a) => ( + +
Analysis ยท updated {a.updatedAt}
+

{a.paperTitle.split(':')[0]}

+

{a.title}

+ {a.summary &&

{a.summary}

} + + ))} +
+ + {list.benchmarks.length > 0 && ( + <> +

Benchmarks these papers use

+ + + {list.benchmarks.map((b) => )} +
BenchmarkPapers
{b.name}{b.n}
+ + )} + +

All papers in the group

+

Matched by text (title, abstract, keywords); a paper may be a false match.

+ + + + {list.papers.map((p) => ( + + + + + + + ))} + +
PaperVenueDateAnalysis
{p.title}{p.conf_short}{p.date}{p.analysed ? 'โœ“' : ''}
+ + ); +} diff --git a/lib/content-cards.ts b/lib/content-cards.ts new file mode 100644 index 0000000..f94eb84 --- /dev/null +++ b/lib/content-cards.ts @@ -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 { + return Promise.all(CONTENT_TREE.children.map(async (n): Promise => { + 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, + }; + })); +} diff --git a/lib/content-papers.ts b/lib/content-papers.ts new file mode 100644 index 0000000..cbfd800 --- /dev/null +++ b/lib/content-papers.ts @@ -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 { + const w = where(node); + const papers = await query>( + `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(); + 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(); + 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, + }; +} diff --git a/lib/content-tree.ts b/lib/content-tree.ts index 4ecfe43..d19a75e 100644 --- a/lib/content-tree.ts +++ b/lib/content-tree.ts @@ -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: [], + }, ], }; diff --git a/pages/contents/[node].tsx b/pages/contents/[node].tsx index 4526fd9..e6aad9f 100644 --- a/pages/contents/[node].tsx +++ b/pages/contents/[node].tsx @@ -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>; -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 = 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 ( + +

โ† Contents

+

{node.title}

+

{node.blurb}

+ {list && } +
+ ); + } const area = content.areas[0]; return ( @@ -50,7 +63,7 @@ export default function Contents({ node, content, tools }: Props) { CategoryPapersTools (paper) {tools.rows.map((r) => ( - + {r.path.slice(0, -1).map((t, i) => {t} โ†’ )} {r.title} diff --git a/pages/contents/index.tsx b/pages/contents/index.tsx index be72081..bae9c9e 100644 --- a/pages/contents/index.tsx +++ b/pages/contents/index.tsx @@ -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 ( -
    - {nodes.map((n, i) => { - const num = `${prefix}${i + 1}`; - return ( -
  1. - {num} - {n.title} -
    {n.blurb}
    - {n.children.length > 0 && } -
  2. - ); - })} -
- ); -} +export const getServerSideProps: GetServerSideProps<{ cards: Card[] }> = async () => ({ props: { cards: await getCards() } }); -export default function Contents() { +const KIND: Record = { tools: 'Taxonomy table', papers: 'Paper group' }; + +export default function Contents({ cards }: { cards: Card[] }) { return (

Contents

-

{CONTENT_TREE.blurb} Each entry opens its own page.

-
+

{CONTENT_TREE.blurb} Each card opens its own page.

+
+ {cards.map((c) => ( + +
{KIND[c.kind] ?? 'Analysis'}
+

{c.title}

+

{c.blurb}

+
+ {c.stats.map((s) => {s.n.toLocaleString()} {s.label})} +
+ {c.items.length > 0 && ( +
    + {c.items.map((it) =>
  • {it.title}{it.note && {it.note}}
  • )} + {c.more &&
  • {c.more}
  • } +
+ )} + + ))} +
); } diff --git a/styles/globals.css b/styles/globals.css index 84be43a..1970236 100644 --- a/styles/globals.css +++ b/styles/globals.css @@ -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)}