/**
 * Chandra VLM Client - Local GPU Image Analysis (Daemon Mode)
 *
 * Spawns python/vlm_worker_local.py in daemon mode (--daemon).
 * Model is loaded ONCE on first use and reused across all requests.
 * Uses ChandraClient (local Chandra OCR 2 v0.2.0) for 100% local GPU processing.
 * NO cloud API calls, NO fallbacks.
 *
 * Return types are IDENTICAL to VLMService for drop-in replacement.
 *
 * @module services/vlm/chandra
 */
/**
 * Structured analysis result from VLM
 */
export interface ImageAnalysis {
    imageType: string;
    primarySubject: string;
    paragraph1: string;
    paragraph2: string;
    paragraph3: string;
    extractedText: string[];
    dates: string[];
    names: string[];
    numbers: string[];
    confidence: number;
}
/**
 * Complete VLM result with metadata
 */
export interface VLMAnalysisResult {
    /** Combined description paragraphs */
    description: string;
    /** Structured analysis data */
    analysis: ImageAnalysis;
    /** Model used for analysis */
    model: string;
    /** Processing time in milliseconds */
    processingTimeMs: number;
    /** Total tokens used */
    tokensUsed: number;
}
/**
 * Quick classification result
 */
export interface ImageClassification {
    type: string;
    hasText: boolean;
    textDensity: string;
    complexity: string;
    confidence: number;
}
export interface ChandraClientConfig {
    pythonPath?: string;
    method?: 'hf' | 'vllm';
    batchSize?: number;
    timeout?: number;
}
/**
 * Kill all active VLM worker processes.
 * Called on process exit to prevent orphaned GPU-consuming workers.
 */
export declare function killAllVLMWorkers(): void;
/**
 * ChandraClient - Local GPU VLM image analysis via Chandra OCR 2 (v0.2.0, Daemon Mode)
 *
 * Spawns a persistent Python daemon that loads the model ONCE.
 * All requests are serialized through the daemon via JSON lines on stdin/stdout.
 *
 * Provides methods for:
 * - describeImage: Detailed image analysis with structured output
 * - classifyImage: Quick categorization
 * - deepAnalyze: Extended reasoning analysis
 * - processBatch: Sequential batch processing via daemon
 */
export declare class ChandraClient {
    private readonly pythonPath;
    private readonly workerPath;
    private readonly method;
    private readonly batchSize;
    private readonly timeout;
    /** Daemon process state */
    private _daemonProcess;
    private _daemonReadline;
    private _daemonReady;
    private _daemonStarting;
    private _pendingResolve;
    private _pendingReject;
    /** Simple promise-based lock for serial access to daemon */
    private _lockPromise;
    constructor(config?: ChandraClientConfig);
    /**
     * Acquire exclusive access to the daemon for one request.
     * Requests are serialized because the daemon processes one at a time.
     */
    private withLock;
    /**
     * Ensure daemon is running and ready. Spawns on first call, restarts on crash.
     */
    private ensureDaemon;
    /**
     * Spawn the Python daemon process and wait for the ready signal.
     */
    private _spawnDaemon;
    /**
     * Send a JSON request to the daemon and wait for a JSON response line.
     * Caller must hold the lock.
     */
    private _sendRequest;
    /**
     * Wrap a promise with a timeout.
     */
    private _withTimeout;
    /**
     * Clean up daemon process and associated resources.
     */
    private _cleanupDaemon;
    private _isDaemonReady;
    private _isErrorResponse;
    /**
     * Parse a JSON response line from the daemon.
     */
    private _parseResponse;
    /**
     * Generate detailed description of an image via daemon.
     *
     * @param imagePath - Path to the image file
     * @param options - Optional context text, prompt overrides
     * @returns VLMAnalysisResult with description and structured data
     */
    describeImage(imagePath: string, options?: {
        contextText?: string;
        useUniversalPrompt?: boolean;
        highResolution?: boolean;
    }): Promise<VLMAnalysisResult>;
    /**
     * Quick classification of an image via daemon.
     *
     * @param imagePath - Path to the image file
     * @returns ImageClassification with type and complexity
     */
    classifyImage(imagePath: string): Promise<ImageClassification>;
    /**
     * Deep analysis using extended reasoning via daemon.
     *
     * @param imagePath - Path to the image file
     * @param contextText - Optional surrounding text context
     * @returns VLMAnalysisResult (same type as describeImage for pipeline compat)
     */
    deepAnalyze(imagePath: string, contextText?: string): Promise<VLMAnalysisResult>;
    /**
     * Process a batch of images sequentially via daemon.
     * Each image is sent as a separate analyze request since the daemon is single-threaded.
     *
     * @param images - Array of image specs with paths and optional prompts
     * @returns Array of VLMAnalysisResult
     */
    processBatch(images: Array<{
        imagePath: string;
        prompt?: string;
    }>): Promise<VLMAnalysisResult[]>;
    /**
     * Get service status.
     */
    getStatus(): {
        model: string;
        method: string;
        batchSize: number;
    };
    /**
     * Parse worker JSON output into VLMAnalysisResult.
     */
    private parseAnalysisResult;
    /**
     * Parse worker JSON output into ImageClassification.
     */
    private parseClassificationResult;
    /**
     * Destroy this client instance and release all resources.
     * Kills the daemon process to free GPU memory.
     */
    destroy(): void;
}
/**
 * Get or create ChandraClient singleton.
 */
export declare function getChandraClient(): ChandraClient;
/**
 * Reset singleton for testing.
 * Cleans up daemon process to prevent orphaned GPU-consuming workers.
 */
export declare function resetChandraClient(): void;
//# sourceMappingURL=chandra.d.ts.map