/** * Batched analyze client. * * Companion to `analyzeResource.ts`. Posts a group of resources to the * backend's `/v1/analyze/batch` endpoint instead of issuing one HTTP call * per resource. The batched prompt amortizes the system prompt across N * resources, dramatically reducing per-insight cost on Mistral and even * more so on Anthropic models with prompt caching. * * Returns a map keyed by `stableResourceId` (the same id the caller sent), * so the orchestrator can map results back to original logical IDs. */ import type { AxiosResponse } from 'axios'; import type { CloudFormationResource, Issue } from '../../types/analysis.types'; import type { ResourceAnalysisContext } from '../analyzeResource/analyzeResource'; /** One resource within a batched analysis call. */ export interface BatchResourceInput { /** * Stable, deterministic ID the backend will use to key its response - * the orchestrator owns the mapping back to the original logical ID. */ stableResourceId: string; resourceData: CloudFormationResource; resourceType: string; context?: ResourceAnalysisContext; existingFindings?: Issue[]; } /** Per-resource analysis result returned for one batch entry. */ export interface BatchedAnalysisEntry { resourceId: string; resourceName?: string; issues: Issue[]; /** True if the backend served this resource from cache (no Bedrock call). */ cacheHit: boolean; } type AxiosClient = { post(url: string, data?: unknown, config?: unknown): Promise>; get(url: string, config?: unknown): Promise>; }; export declare const createAnalyzeResourcesBatch: (axiosClient: AxiosClient, apiUrl: string) => (stackName: string, resources: BatchResourceInput[], authToken: string, fingerprint: string, aiModelId?: string) => Promise>; export type AnalyzeResourcesBatchFn = ReturnType; export {};