import type { PanelRecord, StampedFinding } from "../run/types.js"; const OID_DISPLAY_LENGTH = 7; export type CloseoutDismissed = { id: string; title: string; reason: string; }; export type CloseoutLow = { id: string; title: string; }; export type CloseoutCommentInput = { submitted: number; fixed: number; dismissed: CloseoutDismissed[]; lowAdvisory: CloseoutLow[]; seats: string[]; extras: string[]; lost: string[]; baseRef: string; baseOid: string; headRef?: string; headOid: string; }; export type CloseoutJudgmentRow = { id: string; reason: string; }; export type AccountCloseoutInput = { findings: readonly StampedFinding[]; dismissed: readonly CloseoutJudgmentRow[]; lowAdvisory: readonly string[]; }; export type AccountedCloseout = { submitted: number; fixed: StampedFinding[]; dismissed: CloseoutDismissed[]; lowAdvisory: CloseoutLow[]; }; export type AssembleCloseoutInput = AccountCloseoutInput & { panel: PanelRecord; lost: readonly string[]; meta: { baseRef: string; baseOid: string; headOid: string }; headRef?: string; }; function shortOid(oid: string): string { return oid.slice(0, OID_DISPLAY_LENGTH); } /** Flatten injected headings, mentions, and HTML so card fields stay one line. */ export function sanitizeCardText(text: string): string { return text .replace(/[\r\n\u2028\u2029]+/g, " ") .replace(//g, " ") .replace(/