"use client"; import { ScoreLadder } from "@/components/ScoreLadder"; import type { ChunkView } from "@/lib/api"; /** * The refusal state — deliberately the most carefully set surface in this app. * * Most interfaces treat a non-answer as a failure and style it accordingly: small, grey, * apologetic. That hierarchy is wrong here. A grounded system declining to answer is the * product working exactly as designed, and it is the hardest thing in the stack to build. * So it gets the full treatment — ochre rather than red, because nothing has gone wrong; * a plain statement of what happened; and the near misses set underneath as marginalia, * with their real scores. * * Those near misses are the argument. They prove the corpus was searched, that the best * candidate was measured against a fixed floor, and by exactly how much it fell short. */ export function RefusalCard({ text, nearMisses, floor, bestScore, onOpen, }: { text: string; nearMisses: ChunkView[]; floor: number | null; bestScore: number | null; onOpen: (chunkId: string) => void; }) { const [lead, ...rest] = text.split("\n\n"); return (

Not covered by the indexed corpus

{lead}

{rest.map((paragraph, index) => (

{paragraph}

))} {bestScore !== null && floor !== null ? (
best candidate {bestScore >= 0 ? "+" : ""} {bestScore.toFixed(2)} floor {floor.toFixed(2)} short by {(floor - bestScore).toFixed(2)}
) : null} {nearMisses.length > 0 ? (

Closest passages considered

) : null}
); }