import * as i0 from "@angular/core";
/**
 * Lightweight record types for dashboard aggregation.
 * We use ResultType: 'simple' with explicit Fields to avoid pulling
 * large text columns (InputData, OutputData, etc.) that can blow up
 * the GraphQL response beyond V8's string limit.
 */
export interface PromptRunRecord {
    ID: string;
    RunAt: string;
    CompletedAt: string | null;
    Success: boolean;
    Cost: number | null;
    TokensUsed: number | null;
    TokensPrompt: number | null;
    TokensCompletion: number | null;
    ExecutionTimeMS: number | null;
    ModelID: string | null;
    Model: string | null;
    AgentID: string | null;
    Agent: string | null;
    Prompt: string | null;
    ErrorMessage: string | null;
}
export interface AgentRunRecord {
    ID: string;
    StartedAt: string;
    CompletedAt: string | null;
    Status: string;
    Success: boolean;
    TotalCost: number | null;
    TotalTokensUsed: number | null;
    AgentID: string | null;
    Agent: string | null;
    ErrorMessage: string | null;
}
export interface DashboardKPIs {
    totalExecutions: number;
    activeExecutions: number;
    totalCost: number;
    costCurrency: string;
    avgExecutionTime: number;
    successRate: number;
    totalTokens: number;
    costPerToken: number;
    topModel: string;
    topAgent: string;
    errorRate: number;
    dailyCostBurn: number;
}
export interface TrendData {
    timestamp: Date;
    executions: number;
    cost: number;
    tokens: number;
    avgTime: number;
    errors: number;
}
export interface LiveExecution {
    id: string;
    type: 'prompt' | 'agent';
    name: string;
    status: 'running' | 'completed' | 'failed';
    startTime: Date;
    duration?: number;
    cost?: number;
    tokens?: number;
    progress?: number;
}
export interface ExecutionDetails {
    id: string;
    type: 'prompt' | 'agent';
    name: string;
    status: string;
    startTime: Date;
    endTime?: Date;
    cost: number;
    tokens: number;
    success: boolean;
    errorMessage?: string;
    parentId?: string;
    children: ExecutionDetails[];
    model?: string;
    vendor?: string;
}
export interface ChartData {
    executionTrends: TrendData[];
    costByModel: {
        model: string;
        cost: number;
        tokens: number;
    }[];
    performanceMatrix: {
        agent: string;
        model: string;
        avgTime: number;
        successRate: number;
    }[];
    tokenEfficiency: {
        inputTokens: number;
        outputTokens: number;
        cost: number;
        model: string;
    }[];
}
export declare class AIInstrumentationService {
    private readonly _dateRange$;
    private readonly _refreshTrigger$;
    private readonly _isLoading$;
    readonly isLoading$: import("rxjs").Observable<boolean>;
    constructor();
    /**
     * Single data load: fetches prompt runs and agent runs ONCE per refresh/date-range change.
     * All downstream streams derive from this shared dataset.
     */
    private readonly rawData$;
    readonly kpis$: import("rxjs").Observable<DashboardKPIs>;
    readonly trends$: import("rxjs").Observable<TrendData[]>;
    readonly liveExecutions$: import("rxjs").Observable<LiveExecution[]>;
    readonly chartData$: import("rxjs").Observable<ChartData>;
    setDateRange(start: Date, end: Date): void;
    refresh(): void;
    /**
     * Single batch query that loads all data needed by every dashboard widget.
     * Uses ResultType: 'simple' with explicit Fields to minimize payload size.
     */
    private loadAllData;
    private computeKPIs;
    private computeTrends;
    private computeLiveExecutions;
    private computeChartData;
    private countActiveExecutions;
    private sumCosts;
    private sumTokens;
    private calculateAverageExecutionTime;
    private calculateSuccessRate;
    private countErrors;
    private calculateDailyCostBurn;
    private getBucketSizeMs;
    private createHourlyBuckets;
    private getTopModel;
    private getTopAgent;
    private analyzeCostByModel;
    private analyzePerformanceMatrix;
    private analyzeTokenEfficiency;
    getExecutionDetails(executionId: string, type: 'prompt' | 'agent'): Promise<ExecutionDetails | null>;
    private getPromptExecutionDetails;
    private getAgentExecutionDetails;
    static ɵfac: i0.ɵɵFactoryDeclaration<AIInstrumentationService, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<AIInstrumentationService>;
}
//# sourceMappingURL=ai-instrumentation.service.d.ts.map