| 1 | import type { MemoryCitation } from "./types"; |
| 2 | |
| 3 | const compilerCitationKinds = new Set(["compiler_reference", "constraint", "risk_note"]); |
| 4 | |
| 5 | export function visibleTranscriptMemoryCitations(citations?: MemoryCitation[]): MemoryCitation[] { |
| 6 | return (citations ?? []).filter((citation) => !isMemoryCompilerCitation(citation)); |
| 7 | } |
| 8 | |
| 9 | function isMemoryCompilerCitation(citation: MemoryCitation): boolean { |
| 10 | const kind = (citation.kind ?? "").trim(); |
| 11 | if (!compilerCitationKinds.has(kind)) return false; |
| 12 | const source = (citation.source || citation.id || "").trim().toLowerCase(); |
| 13 | return source === "" || source === "memory v5"; |
| 14 | } |
| 15 |