// Hand-written mirrors of the backend Pydantic schema (src/schemas.py). Small and stable, so this // is lower-risk than wiring up an OpenAPI codegen step. export type Recommendation = "APPROVE" | "REJECT" | "ESCALATE"; export type Confidence = "low" | "medium" | "high"; export type Severity = "low" | "medium" | "high"; export interface Beneficiary { name: string; relationship: string; country: string; } export interface Organizer { name: string; country: string; verified: boolean; } export interface CampaignSummary { id: string; title: string; category: string; goal_amount: number; currency: string; beneficiary: Beneficiary; organizer: Organizer; decided: boolean; decision: string | null; is_override: boolean; } export interface Campaign extends CampaignSummary { story: string; links: string[]; submitted_at: string | null; } export interface RuleViolation { rule_id: string; severity: "hard" | "soft"; evidence: string; rule_text?: string | null; section?: string | null; } export interface RiskSignal { name: string; detail: string; severity: Severity; } export interface TriageDecision { recommendation: Recommendation; confidence: Confidence; rule_violations: RuleViolation[]; risk_signals: RiskSignal[]; rationale: string; questions_for_submitter: string[]; manipulation_detected: boolean; } export interface GateOverride { rule_id: string; from_recommendation: Recommendation; to_recommendation: Recommendation; reason: string; rule_text?: string | null; section?: string | null; } export interface GatedResult { decision: TriageDecision; llm_recommendation: Recommendation; overrides: GateOverride[]; provider: string; // Run telemetry (cost/latency of the triage call) — optional, populated on live runs. model_name?: string | null; tokens_in?: number | null; tokens_out?: number | null; latency_ms?: number | null; } export interface Stats { policy_rules: number; precedent_cases: number; provider: string; providers: string[]; // True on the deployed public demo, where the provider is forced to Anthropic — the UI hides the // (then-inert) provider toggle. public_demo: boolean; } export interface PolicyRuleRef { rule_id: string; text: string; } export interface PolicySection { prefix: string; name: string; description: string; rules: PolicyRuleRef[]; } export interface DecisionRecord { timestamp: string; campaign_id: string; title?: string; ai_recommendation: string; ai_llm_recommendation?: string; gate_overrides?: string[]; ai_confidence?: string; provider?: string; moderator?: string; human_decision: string; is_override: boolean; reason: string; }