import Link from "next/link"; import AppShell from "@/components/shell/AppShell"; import ResearchView from "@/components/research/ResearchView"; import { buttonVariants } from "@/components/ui/button"; import { listCases } from "@/lib/research/boards"; import { scopeFrom, scopeOf } from "@/lib/research/corpus"; import { researchArchiveHref } from "@/lib/research/hrefs"; import { runsHref } from "@/lib/research/runs-hrefs"; import { listSources, shownSources } from "@/lib/research/sources"; import type { ScopeSummary } from "@/lib/research/types"; export const dynamic = "force-dynamic"; // RESEARCH (plans/umtool-redesign.md, R1): ask the corpus, see what the scope // holds before anything runs, read every hit in its transcript, keep a // reading log. The page is the client's (components/research/ResearchView.tsx); // this reads the sources and the scope's preview so the first frame has them. // A search itself is never run here: it is one scan, and the page shows it // running. export default async function ResearchPage({ searchParams }: { searchParams: Promise> }) { const sp = await searchParams; const params = new URLSearchParams(); for (const [k, v] of Object.entries(sp)) for (const x of Array.isArray(v) ? v : v !== undefined ? [v] : []) params.append(k, x); const sources = await listSources(); const scope = scopeFrom(params); if (!scope.source || !sources.some((s) => s.handle === scope.source)) scope.source = sources[0].handle; let summary: ScopeSummary | null = null; let summaryError: string | null = null; try { summary = await scopeOf(scope); } catch (e) { summaryError = (e as Error).message; } const q = typeof sp.q === "string" ? sp.q : ""; // R2: the cases a pin can go to, and the one the URL chose. const cases = await listCases().catch(() => []); const initialCase = typeof sp.case === "string" ? sp.case : null; return (
Agent runs Archive inventory } />
); }