kyd-shared-badge 0.2.26 → 0.2.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.ts CHANGED
@@ -134,6 +134,27 @@ export interface IpRiskAnalysis {
134
134
  countries?: string[];
135
135
  }
136
136
 
137
+ export interface CSLDetails {
138
+ name: string;
139
+ description: string;
140
+ url: string;
141
+ }
142
+
143
+ export interface FBIWantedDetails {
144
+ name: string;
145
+ description: string;
146
+ url: string;
147
+ }
148
+
149
+ export interface FBIWantedMatch {
150
+ uid: string;
151
+ title: string;
152
+ url: string;
153
+ justification: string;
154
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
155
+ raw_result: any;
156
+ }
157
+
137
158
  export interface AssessmentResult {
138
159
  report_summary?: string;
139
160
  recommendations: {
@@ -142,12 +163,15 @@ export interface AssessmentResult {
142
163
  };
143
164
  developer_trust_explanation?: string;
144
165
  industry_considerations?: string;
145
- ai_usage_summary: {
146
- explanation?: string;
147
- key_findings?: string[];
148
- files_with_ai_findings?: number;
149
- files_analyzed?: number;
150
- } | null;
166
+
167
+ ai_usage_summary?: {
168
+ explanation: string;
169
+ key_findings: string[];
170
+ files_with_ai_findings: number;
171
+ files_analyzed: number;
172
+ files_with_disclosure: number;
173
+ transparency_score: number;
174
+ };
151
175
  key_skills?: string[];
152
176
  summary_scores?: {
153
177
  developer_trust?: SummaryScore;
@@ -168,19 +192,38 @@ export interface AssessmentResult {
168
192
  ofac_screen?: {
169
193
  checked?: boolean;
170
194
  sources?: string[];
171
- matches?: any[];
195
+ matches?: {
196
+ sanction: {
197
+ source: string;
198
+ name: string;
199
+ url: string;
200
+ programs: string[];
201
+ entityLink: string;
202
+ };
203
+ uid: string;
204
+ title: string;
205
+ url: string;
206
+ justification: string;
207
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
208
+ raw_result: any;
209
+ }[];
210
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
172
211
  raw?: any;
173
212
  };
174
213
  sanctions_sources_detailed?: { issuingEntity: string; listName: string; matched?: boolean; sublists?: string[] }[];
175
214
  sanctions_sublists?: string[];
176
- csl_details?: any;
177
- fbi_matches?: any[];
215
+ csl_details?: CSLDetails;
216
+ fbi_details?: FBIWantedDetails;
217
+ fbi_matches?: FBIWantedMatch[];
178
218
  };
179
219
  top_contributing_rules?: TopContributingRule[];
180
220
  rules_graph_s3_key?: string;
181
- rules_digest?: any;
182
221
  optOutScreening?: boolean;
183
222
  clientMetadata?: ClientMetadata;
223
+ scoring_summary?: ScoringSummary;
224
+ skills_matrix?: SkillsMatrix;
225
+ skills_all?: SkillsAll;
226
+ graph_insights?: GraphInsightsPayload;
184
227
  }
185
228
 
186
229
  export interface ClientMetadata {
@@ -192,6 +235,156 @@ export interface ClientMetadata {
192
235
  referrer: string;
193
236
  }
194
237
 
238
+ // --- Scoring Summary (from rules engine) ---
239
+ export interface ScoringSummaryConfig {
240
+ coldstart_fraction?: number;
241
+ system_weights?: { [k: string]: number };
242
+ genre_mapping?: { [genre: string]: string[] };
243
+ }
244
+
245
+ export interface ScoreBreakdownTotals {
246
+ applied?: number;
247
+ applied_signed?: number;
248
+ theoretical?: number;
249
+ coldstart?: number;
250
+ percent_progress?: number; // 0-100
251
+ percent_progress_signed?: number; // -100 to 100
252
+ percent_coldstart_over_final?: number | null;
253
+ }
254
+
255
+ export interface ScoreBreakdown {
256
+ categories?: {
257
+ [category: string]: {
258
+ applied?: number;
259
+ applied_signed?: number;
260
+ theoretical?: number;
261
+ coldstart?: number;
262
+ percent_progress?: number;
263
+ percent_progress_signed?: number;
264
+ percent_coldstart_over_final?: number | null;
265
+ };
266
+ };
267
+ totals?: ScoreBreakdownTotals;
268
+ }
269
+
270
+ export interface GenreScoreEntry {
271
+ categories: string[];
272
+ atomic: ScoreBreakdownTotals & {};
273
+ business: ScoreBreakdownTotals & {};
274
+ combined: { percent_progress?: number; percent_progress_signed?: number; percent_coldstart_over_final?: number | null };
275
+ }
276
+
277
+ export interface ScoringSummary {
278
+ config?: ScoringSummaryConfig;
279
+ overall?: {
280
+ atomic?: ScoreBreakdownTotals;
281
+ business?: ScoreBreakdownTotals;
282
+ combined?: { percent_progress?: number; percent_progress_signed?: number; percent_coldstart_over_final?: number | null };
283
+ };
284
+ genres?: { [genre: string]: GenreScoreEntry };
285
+ category_scores?: {
286
+ [category: string]: {
287
+ atomic?: { percent_progress?: number; percent_progress_signed?: number } & Partial<ScoreBreakdownTotals>;
288
+ business?: { percent_progress?: number; percent_progress_signed?: number } & Partial<ScoreBreakdownTotals>;
289
+ combined?: { percent_progress?: number; percent_progress_signed?: number };
290
+ };
291
+ };
292
+ }
293
+
294
+ // Graph insights payload rendered by GraphInsights and used in SharedBadgeDisplay
295
+ export type CategoryTopBusinessItem = {
296
+ label?: string;
297
+ rule_label?: string;
298
+ provider?: string;
299
+ weight?: number;
300
+ };
301
+
302
+ export interface GraphInsightsPayload {
303
+ providers?: Array<{
304
+ name: string;
305
+ scores?: { atomic?: number; business?: number; total?: number };
306
+ errorCount?: number;
307
+ }>;
308
+ categoryAggregate?: Array<{
309
+ category: string;
310
+ applied_weight_sum?: number;
311
+ }>;
312
+ // New: per-category percent score (0-100) from rules_engine scoring_summary
313
+ categoryScoresPercent?: Array<{
314
+ category: string;
315
+ percent?: number; // 0-100
316
+ }>;
317
+ sanctions?: {
318
+ ofacMatches?: number;
319
+ fbiMatches?: number;
320
+ cslMatched?: boolean;
321
+ };
322
+ ipRisk?: { phase?: 'NO_MATCH' | 'POSSIBLE_MATCH' | 'POSITIVE_MATCH' | string };
323
+ categoryTopBusiness?: { [category: string]: CategoryTopBusinessItem[] };
324
+ domainAffiliations?: { checkedCount?: number };
325
+ // New: Skills category radar data
326
+ skillsCategoryRadar?: Array<{
327
+ axis: string;
328
+ observed?: number; // 0-100
329
+ self_reported?: number; // 0-100
330
+ certified?: number; // 0-100
331
+ }>;
332
+ // New: Flattened list of business rule selections (for appendix)
333
+ business_rules_all?: Array<{
334
+ provider: string;
335
+ category?: string;
336
+ label?: string;
337
+ group_id?: string;
338
+ uid?: string;
339
+ likert_label?: string;
340
+ likert_value?: number;
341
+ weight?: number;
342
+ }>;
343
+ // New: Compact UI summary for top summary cards
344
+ uiSummary?: {
345
+ technical?: {
346
+ percent?: number; // 0-100, higher = more evidence
347
+ label?: string; // e.g., LOW/MODERATE/HIGH EVIDENCE
348
+ top_movers?: Array<{ label?: string; uid?: string }>;
349
+ };
350
+ risk?: {
351
+ percent_good?: number; // 0-100, higher = lower risk (good)
352
+ label?: string; // e.g., LOW/MODERATE/HIGH RISK
353
+ top_movers?: Array<{ label?: string; uid?: string }>;
354
+ };
355
+ };
356
+ ai_usage_summary: {
357
+ explanation: string;
358
+ key_findings: string[];
359
+ files_with_ai_findings: number;
360
+ files_analyzed: number;
361
+ files_with_disclosure?: number;
362
+ transparency_score: number;
363
+ }
364
+ }
365
+
366
+ // Skills matrix
367
+ export interface SkillBucket {
368
+ present: boolean;
369
+ evidence?: string;
370
+ sources?: string[];
371
+ }
372
+
373
+ export interface SkillRow {
374
+ name: string;
375
+ observed: SkillBucket;
376
+ self_reported: SkillBucket;
377
+ certified: SkillBucket;
378
+ }
379
+
380
+ export interface SkillsMatrix {
381
+ skills: SkillRow[];
382
+ }
383
+
384
+ export interface SkillsAll {
385
+ skills: SkillRow[];
386
+ }
387
+
195
388
  export interface ScoresByCategory {
196
389
  [category: string]: {
197
390
  subtotal: number;
@@ -212,4 +405,23 @@ export interface AnalyzedItem {
212
405
  summary: string;
213
406
  quality_score?: number;
214
407
  professional_score?: number;
215
- }
408
+ }
409
+
410
+ export interface BusinessRule {
411
+ provider: string;
412
+ category: string;
413
+ label: string;
414
+ group_id: string;
415
+ likert_label: string;
416
+ likert_value: number;
417
+ weight: number;
418
+ uid: string;
419
+ }
420
+
421
+ export interface TopBusinessRule {
422
+ provider: string;
423
+ category: string;
424
+ label: string;
425
+ weight: number;
426
+ uid: string;
427
+ }