import { request, toQueryString } from './core'; export type ReflectAnalysis = | 'error_patterns' | 'tool_sequences' | 'cost_analysis' | 'performance_trends'; export interface ReflectInsight { type: string; summary: string; data: Record; confidence: number; } export interface ReflectResultData { analysis: ReflectAnalysis; insights: ReflectInsight[]; metadata: { sessionsAnalyzed: number; eventsAnalyzed: number; timeRange: { from: string; to: string }; }; } export async function reflect(params: { analysis: ReflectAnalysis; agentId?: string; from?: string; to?: string; limit?: number; }): Promise { const qs = toQueryString({ analysis: params.analysis, agentId: params.agentId, from: params.from, to: params.to, limit: params.limit, }); return request(`/api/reflect${qs}`); }