All files / scripts/news-types/weekly-review types.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 0/0
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90                                8x                                                                                                                                                  
/**
 * @module news-types/weekly-review/types
 * @description Exported interfaces and constants for weekly-review article generation.
 *
 * @author Hack23 AB
 * @license Apache-2.0
 */
 
import type { CoalitionRiskIndex, AnomalyFlag, TrendComparison } from '../../data-transformers/risk-analysis.js';
import type { Language } from '../../types/language.js';
 
export type { CoalitionRiskIndex, AnomalyFlag, TrendComparison };
 
/**
 * Required MCP tools for weekly-review articles
 */
export const REQUIRED_TOOLS: readonly string[] = [
  'search_dokument',
  'get_dokument_innehall',
  'search_anforanden',
  'get_betankanden',
  'get_propositioner',
  'get_motioner',
  'search_voteringar',
];
 
export interface TitleSet {
  title: string;
  subtitle: string;
}
 
export interface WeeklyReviewValidationResult {
  hasWeeklySummary: boolean;
  hasMinimumSources: boolean;
  hasRetrospectiveTone: boolean;
  hasKeyOutcomes: boolean;
  passed: boolean;
}
 
export interface ArticleInput {
  content?: string;
  sources?: string[];
  [key: string]: unknown;
}
 
export interface GenerationOptions {
  languages?: Language[];
  lookbackDays?: number;
  writeArticle?: ((html: string, filename: string) => Promise<void | boolean>) | null;
}
 
/** Shape of a single voting record returned by search_voteringar */
export interface VotingRecord {
  parti?: string;
  /** Ja | Nej | Avstår | Frånvarande */
  rost?: string;
  bet?: string;
  punkt?: string;
  /** ISO date string (YYYY-MM-DD) used for post-query date filtering */
  datum?: string;
  [key: string]: unknown;
}
 
/** Coalition stress analysis result derived from voting records */
export interface CoalitionStressResult {
  /** Number of vote points where the government bloc position (Ja/Nej) matched the chamber majority */
  governmentWins: number;
  /** Number of vote points where the government bloc position did not match the chamber majority */
  governmentLosses: number;
  /** Vote points where opposition parties voted with the government */
  crossPartyVotes: number;
  /** Vote points with internal government-bloc defections */
  defections: number;
  /** Composite risk index from risk-analysis.ts */
  riskIndex: CoalitionRiskIndex;
  /** Detected anomaly flags from risk-analysis.ts */
  anomalies: AnomalyFlag[];
  /** Total distinct vote-points analysed */
  totalVotes: number;
}
 
/** Weekly activity metrics — current-week counts with CIA coalition-stability trend direction (not a prior-week comparison) */
export interface WeeklyActivityMetrics {
  currentDocuments: number;
  currentSpeeches: number;
  currentVotes: number;
  trendComparison: TrendComparison;
  activityChange: 'increasing' | 'stable' | 'declining';
}