agentic-qe
Version: 
Agentic Quality Engineering Fleet System - AI-driven quality management platform
112 lines • 2.62 kB
TypeScript
/**
 * Database - SQLite database management for the AQE Fleet
 *
 * Provides persistent storage for fleet state, agent metrics, task history,
 * and configuration data using SQLite for the MVP implementation.
 */
export interface DatabaseRow {
    [key: string]: any;
}
export declare class Database {
    private db;
    private readonly logger;
    private readonly dbPath;
    private isInitialized;
    constructor(dbPath?: string);
    /**
     * Initialize database connection and create tables
     */
    initialize(): Promise<void>;
    /**
     * Close database connection
     */
    close(): Promise<void>;
    /**
     * Execute SQL query
     */
    exec(sql: string): Promise<void>;
    /**
     * Run SQL query with parameters
     */
    run(sql: string, params?: any[]): Promise<{
        lastID: number;
        changes: number;
    }>;
    /**
     * Get single row from database
     */
    get(sql: string, params?: any[]): Promise<DatabaseRow | undefined>;
    /**
     * Get all rows from database
     */
    all(sql: string, params?: any[]): Promise<DatabaseRow[]>;
    /**
     * Create database tables
     */
    private createTables;
    /**
     * Insert or update fleet record
     */
    upsertFleet(fleet: {
        id: string;
        name: string;
        config: any;
        status: string;
    }): Promise<void>;
    /**
     * Insert or update agent record
     */
    upsertAgent(agent: {
        id: string;
        fleetId: string;
        type: string;
        status: string;
        config?: any;
        metrics?: any;
    }): Promise<void>;
    /**
     * Insert or update task record
     */
    upsertTask(task: {
        id: string;
        fleetId: string;
        agentId?: string;
        type: string;
        name: string;
        data?: any;
        requirements?: any;
        status: string;
        priority?: number;
        result?: any;
        error?: string;
        startedAt?: Date;
        completedAt?: Date;
    }): Promise<void>;
    /**
     * Insert event record
     */
    insertEvent(event: {
        id: string;
        fleetId?: string;
        agentId?: string;
        taskId?: string;
        type: string;
        source: string;
        target?: string;
        data: any;
    }): Promise<void>;
    /**
     * Insert metric record
     */
    insertMetric(metric: {
        fleetId?: string;
        agentId?: string;
        taskId?: string;
        metricType: string;
        metricName: string;
        metricValue: number;
        unit?: string;
        tags?: any;
    }): Promise<void>;
}
//# sourceMappingURL=Database.d.ts.map