The background extraction pipeline is invisible on the home surface — essential observability per the user's directive: the graph view must show what is currently running (extracting / auditing / merging) and for which chat. - extraction.ts: module-level registry of in-flight runs (chatId, phase, startedAt), updated at each phase transition in runExtraction and cleared in finally (done or failed). extractionStatuses() is the read; one process, one registry. - GET /api/graph/status: thin transport over the registry, chat titles joined from the chat store. - graph-view: polls every 2s and shows one chip per running pipeline (spinner + phase + title + elapsed seconds, bottom-left); when a run finishes (some -> none) the graph refetches, so merges land live. Status is cosmetic — poll errors never surface. - Unit test drives a mocked pipeline run and observes the registry mid-flight: 'extracting' during the extractor's generate, 'auditing' during the auditor's, empty after.
14 lines
380 B
TypeScript
14 lines
380 B
TypeScript
import { graphView } from "@/src/server";
|
|
|
|
/**
|
|
* The home graph view's data endpoint (W4; vision §1 "Home page") — thin
|
|
* transport: the server entry (src/server/graph.ts) returns nodes, edges,
|
|
* session provenance, and per-session understanding observations.
|
|
*/
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export async function GET() {
|
|
return Response.json(graphView());
|
|
}
|