import type { Issue } from '../../types/analysis.types'; /** * A loosely-typed AI issue as it actually appears in backend / cache payloads. * The model has, across prompt/schema versions, emitted findings with drifted * field names (`waf_pillar`, `confidence`) that we fold onto the canonical * {@link Issue} names before the consumer reads them. */ export type RawAiIssue = Partial & { waf_pillar?: string; confidence?: number; }; /** * Locate the issue array inside a single-resource AI result, tolerating every * top-level schema the backend has emitted over time. * * The AI service has cached Bedrock results under several shapes as the prompt * evolved (verified against `cdki-analysis-cache-prod`): the canonical * `{ issues: [...] }`, plus `{ findings: [...] }`, `{ analysis: [...] }`, * `{ resourceAnalysis: { findings: [...] } }`, and * `{ resource_analysis: { findings: [...] } }`. Cache entries created under an * older prompt are served verbatim to current CLIs, so a consumer that only * understands `{ issues }` silently discards ~a third of paid AI results. This * accepts all of them. * * Returns a normalized list of issue-like records (field-name drift folded: * `waf_pillar` → `wafPillar`, `confidence` → `aiConfidence`). Returns `[]` when * no recognizable issue array can be located — e.g. the malformed * `{ analysis: { resource: {...} } }` resource-dump shape, which carries no * usable findings list. */ export declare const extractAiIssues: (result: unknown) => RawAiIssue[];