File size: 5,687 Bytes
f39c319
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a273844
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
export interface BaseResponse {
  schema_version: string;
  agent_version: string;
  prompt_version: string;
  model_version: string;
}

export interface EvidenceChain {
  source_type: string;
  doc_name: string;
  section: string;
  excerpt: string;
  basis_ref: string;
}

export interface PermissionItem {
  name: string;
  purpose: string;
  trigger_page: string;
  required: boolean;
}

export interface SdkItem {
  name: string;
  vendor: string;
  purpose: string;
  data_items: string[];
  privacy_url: string;
}

export interface CaseContext {
  case_id: string;
  customer_id: string;
  customer_name: string;
  app_name: string;
  business_line: string;
  language: string;
  materials: {
    current_policy_text: string;
    prd_text: string;
    permission_items: PermissionItem[];
    sdk_items: SdkItem[];
  };
  external_context: {
    peer_updates: string[];
    regulatory_updates: string[];
  };
  metadata: {
    submitted_at: string;
    source: string;
    schema_version?: string;
    agent_version?: string;
    prompt_version?: string;
    model_version?: string;
    retry_count?: number;
  };
}

export interface PeerRegSummary extends BaseResponse {
  insufficient_context?: boolean;
  peer_summary: string;
  reg_summary: string;
  reference_clauses: {
    source: string;
    source_metadata: {
      institution?: string;
      date?: string;
      link?: string;
    };
    category: string;
    topic: string;
    clause: string;
    requirement_level: 'mandatory' | 'recommended' | 'reference';
    applicability_reason: string;
  }[];
  risk_alerts: string[];
}

export interface GapAnalysis extends BaseResponse {
  insufficient_context?: boolean;
  gaps: {
    type: string;
    severity: 'high' | 'medium' | 'low';
    description: string;
    evidence: EvidenceChain[];
  }[];
  rewrite_suggestions: {
    section: string;
    old_text: string;
    new_text: string;
    reason: string;
    basis_refs: string[];
  }[];
  uncertain_items: {
    category: string;
    description: string;
  }[];
  redline_seed: {
    full_revised_draft: string;
    change_summary: string[];
    redline_changes: {
      section: string;
      old_text: string;
      new_text: string;
    }[];
  };
  coverage_checklist: {
    item: string;
    covered: boolean;
    reason?: string;
  }[];
}

export interface ComplianceCheck extends BaseResponse {
  insufficient_context?: boolean;
  risk_levels: {
    high: number;
    medium: number;
    low: number;
  };
  compliance_gaps: {
    severity: 'high' | 'medium' | 'low';
    item: string;
    basis: string;
    basis_id: string;
  }[];
  pending_legal_items: string[];
  conclusion: string;
}

export interface LegalReviewPack extends BaseResponse {
  legal_review_pack: {
    background: string;
    key_changes: string[];
    risk_summary: string[];
    pending_items: string[];
    references: {
      source: string;
      url?: string;
      details: string;
    }[];
  };
  executive_summary: {
    overall_risk: 'high' | 'medium' | 'low';
    key_issues: string[];
    recommendation: string;
  };
  delivery_summary: {
    target_audience: string;
    summary: string;
  };
  review_recommendation: 'suggest_approve' | 'suggest_reject' | 'suggest_more_material';
  focus_items: {
    priority: 'P0' | 'P1' | 'P2';
    item: string;
    reason: string;
  }[];
}

export interface MissingMaterialItem {
  material_type: string;
  requirement_level: 'required' | 'optional' | 'conditional';
  reason: string;
}

export interface NeedMoreMaterialResponse extends BaseResponse {
  error_code: 'need_more_material';
  message: string;
  missing_materials: MissingMaterialItem[];
}

export interface LogAnalysisResult extends BaseResponse {
  insufficient_context?: boolean;
  summary: string;
  error_patterns: {
    pattern: string;
    count: number;
    first_seen?: string;
    last_seen?: string;
    level: 'high' | 'medium' | 'low';
    sample_logs: string[];
  }[];
  timeline: {
    time: string;
    event: string;
  }[];
  possible_causes: {
    cause: string;
    confidence: 'high' | 'medium' | 'low';
    evidence: string[];
  }[];
  suggested_actions: string[];
  risks: {
    risk: string;
    level: 'high' | 'medium' | 'low';
    suggestion: string;
  }[];
  need_human_review: boolean;
  confidence?: 'high' | 'medium' | 'low';
  evidence?: string[];
  report_markdown: string;
}

export interface CodeSecurityResult extends BaseResponse {
  insufficient_context?: boolean;
  risk_summary: string;
  vulnerabilities: {
    type: string;
    severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
    status: 'confirmed' | 'suspicious' | 'false_positive_candidate';
    tool?: string;
    file: string;
    line: number;
    rule_id: string;
    description: string;
    evidence: string;
    impact: string;
    fix_suggestion: string;
    safe_example?: string;
  }[];
  fix_plan: string[];
  compliance_notes: string[];
  need_security_review: boolean;
  confidence?: 'high' | 'medium' | 'low';
  evidence?: string[];
  report_markdown: string;
}

export interface RegulatoryPenaltySummary extends BaseResponse {
  insufficient_context?: boolean;
  topic: string;
  summary: string;
  risk_categories: {
    category: string;
    frequency: 'high' | 'medium' | 'low';
    severity: 'high' | 'medium' | 'low';
    description: string;
    typical_cases: {
      case_name: string;
      regulator: string;
      date: string;
      source_url: string;
      excerpt: string;
    }[];
    suggestions: string[];
  }[];
  top_risks: string[];
  action_suggestions: string[];
  references: {
    source: string;
    url: string;
    details: string;
  }[];
  briefing_markdown: string;
}