| 1 | // TODO-FE: refactor |
| 2 | export interface AgentScaOverviewItem { |
| 3 | agent_id: string |
| 4 | agent_name: string |
| 5 | customer_code?: string | null |
| 6 | policy_id: string |
| 7 | policy_name: string |
| 8 | description: string |
| 9 | total_checks: number |
| 10 | pass: number |
| 11 | fail: number |
| 12 | invalid: number |
| 13 | score: number |
| 14 | start_scan: string |
| 15 | end_scan: string |
| 16 | references?: string | null |
| 17 | hash_file?: string | null |
| 18 | } |
| 19 | |
| 20 | export interface ScaOverviewResponse { |
| 21 | sca_results: AgentScaOverviewItem[] |
| 22 | total_count: number |
| 23 | total_agents: number |
| 24 | total_policies: number |
| 25 | average_score: number |
| 26 | total_checks_all_agents: number |
| 27 | total_passes_all_agents: number |
| 28 | total_fails_all_agents: number |
| 29 | total_invalid_all_agents: number |
| 30 | page: number |
| 31 | page_size: number |
| 32 | total_pages: number |
| 33 | has_next: boolean |
| 34 | has_previous: boolean |
| 35 | success: boolean |
| 36 | message: string |
| 37 | filters_applied: Record<string, string | number | boolean> |
| 38 | } |
| 39 | |
| 40 | export interface ScaOverviewQuery { |
| 41 | customer_code?: string |
| 42 | agent_name?: string |
| 43 | policy_id?: string |
| 44 | policy_name?: string |
| 45 | min_score?: number |
| 46 | max_score?: number |
| 47 | page?: number |
| 48 | page_size?: number |
| 49 | } |
| 50 | |
| 51 | export interface ScaStatsResponse { |
| 52 | total_agents_with_sca: number |
| 53 | total_policies: number |
| 54 | average_score_across_all: number |
| 55 | total_checks_all_agents: number |
| 56 | total_passes_all_agents: number |
| 57 | total_fails_all_agents: number |
| 58 | total_invalid_all_agents: number |
| 59 | by_customer: Record< |
| 60 | string, |
| 61 | { |
| 62 | total_agents: number |
| 63 | total_policies: number |
| 64 | average_score: number |
| 65 | total_checks: number |
| 66 | total_passes: number |
| 67 | total_fails: number |
| 68 | total_invalid: number |
| 69 | } |
| 70 | > |
| 71 | success: boolean |
| 72 | message: string |
| 73 | } |
| 74 | |
| 75 | export interface SCAReport { |
| 76 | id: number |
| 77 | report_name: string |
| 78 | customer_code: string |
| 79 | file_name: string |
| 80 | file_size: number |
| 81 | generated_at: string |
| 82 | generated_by: number |
| 83 | total_policies: number |
| 84 | total_checks: number |
| 85 | passed_count: number |
| 86 | failed_count: number |
| 87 | invalid_count: number |
| 88 | filters_applied: Record<string, string | number | boolean> |
| 89 | status: "processing" | "completed" | "failed" |
| 90 | error_message?: string | null |
| 91 | download_url: string |
| 92 | } |
| 93 | |
| 94 | export interface SCAReportGenerateRequest { |
| 95 | customer_code: string |
| 96 | report_name?: string |
| 97 | agent_name?: string |
| 98 | policy_id?: string |
| 99 | min_score?: number |
| 100 | max_score?: number |
| 101 | } |
| 102 | |
| 103 | export interface SCAReportGenerateResponse { |
| 104 | success: boolean |
| 105 | message: string |
| 106 | report?: SCAReport |
| 107 | error?: string |
| 108 | } |
| 109 | |
| 110 | export interface SCAReportListResponse { |
| 111 | success: boolean |
| 112 | message: string |
| 113 | reports: SCAReport[] |
| 114 | total_count: number |
| 115 | } |
| 116 | |
| 117 | export interface SCAReportDeleteResponse { |
| 118 | success: boolean |
| 119 | message: string |
| 120 | } |
| 121 | |
| 122 | export enum ScaComplianceLevel { |
| 123 | Excellent = "Excellent", // 90-100% |
| 124 | Good = "Good", // 80-89% |
| 125 | Average = "Average", // 70-79% |
| 126 | Poor = "Poor", // 60-69% |
| 127 | Critical = "Critical" // <60% |
| 128 | } |
| 129 | |
| 130 | // Streaming event types |
| 131 | export interface ScaStreamStartEvent { |
| 132 | total_agents: number |
| 133 | message: string |
| 134 | } |
| 135 | |
| 136 | export interface ScaStreamAgentResult { |
| 137 | agent_id: string |
| 138 | agent_name: string |
| 139 | customer_code: string | null |
| 140 | policy_count: number |
| 141 | policies: AgentScaOverviewItem[] |
| 142 | } |
| 143 | |
| 144 | export interface ScaStreamProgress { |
| 145 | processed: number |
| 146 | total: number |
| 147 | successful: number |
| 148 | failed: number |
| 149 | results_so_far: number |
| 150 | percent_complete: number |
| 151 | } |
| 152 | |
| 153 | export interface ScaStreamComplete { |
| 154 | total_results: number |
| 155 | total_agents: number |
| 156 | total_policies: number |
| 157 | average_score: number |
| 158 | total_checks: number |
| 159 | total_passes: number |
| 160 | total_fails: number |
| 161 | total_invalid: number |
| 162 | agents_processed: number |
| 163 | agents_successful: number |
| 164 | agents_failed: number |
| 165 | message: string |
| 166 | } |
| 167 | |
| 168 | export interface ScaStreamError { |
| 169 | error?: string |
| 170 | message: string |
| 171 | agent_id?: string |
| 172 | agent_name?: string |
| 173 | } |
| 174 | |
| 175 | // ── SCA Policies (from CoPilot-SCA GitHub repo) ── |
| 176 | |
| 177 | export interface ScaPolicyItem { |
| 178 | id: string |
| 179 | name: string |
| 180 | description: string |
| 181 | file: string |
| 182 | application: string |
| 183 | app_version: string |
| 184 | platform: string |
| 185 | cis_version: string |
| 186 | } |
| 187 | |
| 188 | export interface ScaPoliciesIndexResponse { |
| 189 | version: string |
| 190 | last_updated: string |
| 191 | policies: ScaPolicyItem[] |
| 192 | success: boolean |
| 193 | message: string |
| 194 | } |
| 195 | |
| 196 | export interface ScaPolicyContentResponse { |
| 197 | policy_id: string |
| 198 | file_path: string |
| 199 | content: string |
| 200 | success: boolean |
| 201 | message: string |
| 202 | } |
| 203 | |
| 204 | // ── SCA Package Registry & Agent Detection ── |
| 205 | |
| 206 | export interface ScaPackageRegistryItem { |
| 207 | key: string |
| 208 | display_name: string |
| 209 | sca_application: string |
| 210 | package_patterns: string[] |
| 211 | } |
| 212 | |
| 213 | export interface ScaPackageRegistryResponse { |
| 214 | entries: ScaPackageRegistryItem[] |
| 215 | total: number |
| 216 | success: boolean |
| 217 | message: string |
| 218 | } |
| 219 | |
| 220 | export interface AgentPackageMatch { |
| 221 | agent_id: string | null |
| 222 | agent_name: string | null |
| 223 | package_name: string | null |
| 224 | package_version: string | null |
| 225 | package_architecture: string | null |
| 226 | } |
| 227 | |
| 228 | export interface ScaPackageAgentsResponse { |
| 229 | registry_key: string |
| 230 | display_name: string |
| 231 | sca_application: string |
| 232 | matched_agents: AgentPackageMatch[] |
| 233 | total: number |
| 234 | applicable_policies: ScaPolicyItem[] |
| 235 | success: boolean |
| 236 | message: string |
| 237 | } |