main
ts 223 lines 4.91 KB
Raw
1 export interface AiAnalystJob {
2 id: string
3 alert_id: number
4 customer_code: string
5 status: string
6 alert_type: string | null
7 triggered_by: string
8 template_used: string | null
9 created_at: string
10 started_at: string | null
11 completed_at: string | null
12 error_message: string | null
13 }
14
15 export interface AiAnalystReport {
16 id: number
17 job_id: string
18 alert_id: number
19 customer_code: string
20 severity_assessment: string | null
21 summary: string | null
22 report_markdown: string | null
23 recommended_actions: string | null
24 created_at: string
25 }
26
27 export interface AiAnalystIoc {
28 id: number
29 report_id: number
30 alert_id: number
31 customer_code: string
32 ioc_value: string
33 ioc_type: string
34 vt_verdict: string
35 vt_score: string | null
36 details: string | null
37 created_at: string
38 }
39
40 export interface AlertWithReport {
41 alert_id: number
42 alert_name: string
43 customer_code: string
44 status: string
45 source: string
46 assigned_to: string | null
47 alert_creation_time: string
48 report: AiAnalystReport
49 }
50
51 // --- Review / Palace / Replay ---
52
53 export type OverallVerdict = "up" | "down"
54 export type TemplateChoice = "correct" | "wrong" | "partial"
55 export type LessonType = "environment" | "false_positives" | "assets" | "threat_intel" | "alerts"
56 export type Durability = "one_off" | "durable"
57 export type PalaceLessonStatus = "pending" | "ingested" | "failed" | "expired"
58
59 export interface AiAnalystIocReview {
60 id: number
61 review_id: number
62 ioc_id: number
63 verdict_correct: boolean
64 note: string | null
65 created_at: string
66 }
67
68 export interface AiAnalystReview {
69 id: number
70 report_id: number
71 alert_id: number
72 customer_code: string
73 reviewer_user_id: number
74 overall_verdict: OverallVerdict | null
75 template_choice: TemplateChoice | null
76 template_used: string | null
77 rating_instructions: number | null
78 rating_artifacts: number | null
79 rating_severity: number | null
80 missing_steps: string | null
81 suggested_edits: string | null
82 created_at: string
83 updated_at: string | null
84 ioc_reviews: AiAnalystIocReview[]
85 }
86
87 export interface IocVerdictCorrection {
88 ioc_id: number
89 verdict_correct: boolean
90 note?: string
91 }
92
93 export interface SubmitReviewPayload {
94 overall_verdict?: OverallVerdict
95 template_choice?: TemplateChoice
96 template_used?: string
97 rating_instructions?: number
98 rating_artifacts?: number
99 rating_severity?: number
100 missing_steps?: string
101 suggested_edits?: string
102 ioc_reviews?: IocVerdictCorrection[]
103 }
104
105 export interface AiAnalystPalaceLesson {
106 id: number
107 review_id: number | null
108 customer_code: string
109 lesson_type: string
110 lesson_text: string
111 durability: string
112 status: string
113 ingested_at: string | null
114 created_at: string
115 }
116
117 export interface QueuePalaceLessonPayload {
118 customer_code: string
119 lesson_type: LessonType
120 lesson_text: string
121 durability?: Durability
122 review_id?: number
123 }
124
125 export interface ReplayPayload {
126 template_override: string
127 customer_code: string
128 sender?: string
129 }
130
131 export interface PalaceSearchHit {
132 id: string | null
133 room: string | null
134 wing: string | null
135 text: string | null
136 source_file: string | null
137 score: number | null
138 metadata: Record<string, unknown> | null
139 }
140
141 // --- Feedback dashboard ---
142
143 export interface ReviewStatsTemplate {
144 template_used: string | null
145 total: number
146 thumbs_up: number
147 thumbs_down: number
148 correct: number
149 partial: number
150 wrong: number
151 avg_rating_instructions: number | null
152 avg_rating_artifacts: number | null
153 avg_rating_severity: number | null
154 }
155
156 export interface ReviewStatsIocAccuracy {
157 total: number
158 correct: number
159 incorrect: number
160 accuracy_pct: number | null
161 }
162
163 export interface AiAnalystReviewStats {
164 customer_code: string
165 total_reviews: number
166 thumbs_up: number
167 thumbs_down: number
168 thumbs_up_pct: number | null
169 template_choice_correct: number
170 template_choice_partial: number
171 template_choice_wrong: number
172 avg_rating_instructions: number | null
173 avg_rating_artifacts: number | null
174 avg_rating_severity: number | null
175 ioc_accuracy: ReviewStatsIocAccuracy
176 per_template: ReviewStatsTemplate[]
177 recent_reviews: AiAnalystReview[]
178 }
179
180 // --- Palace consolidation (Step 21.B) ---
181
182 export interface PalaceConsolidationLesson {
183 id: number
184 lesson_type: string
185 lesson_text: string
186 durability: string
187 status: string
188 drawer_id: string | null
189 created_at: string
190 ingested_at: string | null
191 days_until_expiry: number | null
192 }
193
194 export interface PalaceConsolidationRoomGroup {
195 room: string
196 total: number
197 durable: number
198 one_off: number
199 lessons: PalaceConsolidationLesson[]
200 }
201
202 export interface PalaceConsolidationDuplicatePair {
203 room: string
204 lesson_a_id: number
205 lesson_b_id: number
206 lesson_a_text: string
207 lesson_b_text: string
208 similarity: number
209 }
210
211 export interface PalaceConsolidation {
212 customer_code: string
213 generated_at: string
214 total_lessons: number
215 total_durable: number
216 total_one_off: number
217 total_pending: number
218 total_ingested: number
219 upcoming_expirations: PalaceConsolidationLesson[]
220 rooms: PalaceConsolidationRoomGroup[]
221 duplicate_candidates: PalaceConsolidationDuplicatePair[]
222 markdown: string
223 }