"use client"; import { useState } from "react"; import { readSse } from "@/lib/stream"; import { ReportView } from "./report-view"; import { ExportButtons } from "./export-buttons"; const STAGES = ["digesting", "proposing", "judging", "writing"] as const; const LABEL: Record = { digesting: "Reading the plan", proposing: "Asking for options", judging: "Jev is scoring", writing: "Writing the report" }; export function Runner() { const [xml, setXml] = useState(""); const [note, setNote] = useState(""); const [stage, setStage] = useState(null); const [oul, setOul] = useState(""); const [error, setError] = useState(null); const at = stage ? STAGES.indexOf(stage as (typeof STAGES)[number]) : -1; async function run() { setError(null); setOul(""); setStage("digesting"); try { const res = await fetch("/api/analyze", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ xml, note }) }); if (!res.ok || !res.body) { setError((await res.json().catch(() => null))?.error ?? `Request failed (${res.status}).`); return setStage(null); } for await (const e of readSse(res.body)) { if (e.event === "stage") setStage(e.data.stage); else if (e.event === "oul") setOul((s) => s + e.data.chunk); else if (e.event === "error") setError(`${e.data.stage}: ${e.data.message}`); else if (e.event === "done") { setStage(null); history.replaceState(null, "", `/app/${e.data.id}`); } } } catch (e) { setError((e as Error).message || "The connection to the server dropped."); setStage(null); } } return

Paste a plan

Where do I get this XML?
  1. SSMS: press Ctrl+M (Include Actual Execution Plan), then run the query.
  2. On the Execution Plan tab, right-click → Save As .sqlplan. Or right-click the statement → Showplan XML and copy the cell.
  3. No SSMS: prefix the batch with SET STATISTICS XML ON; and copy the XML result cell.
  4. Drop the file or paste its contents below. Only the digest leaves this container, and only to your own models.