/**
 * Capabilities Collector
 * Phase 3: Report current capability flags based on actual config
 */
import { getSystemState } from '../system-state.js';
/**
 * Collect capability flags
 * Based on actual runtime enforcement, not package presence
 */
export async function collectCapabilities(appState) {
    try {
        let systemState;
        try {
            systemState = getSystemState(appState, false);
        }
        catch {
            systemState = null;
        }
        if (!systemState) {
            return {
                status: 'UNAVAILABLE',
                asOf: Date.now(),
                source: 'collector_capabilities',
                staleAfterMs: 5000,
                reasonCode: 'NO_SYSTEM_STATE',
                message: 'System state not available',
                action: 'system status',
            };
        }
        const flags = systemState.capabilityFlags;
        const data = {
            gateway: flags.gateway,
            database: flags.database,
            memory: flags.memoryLayer,
            security: flags.security,
            rateLimit: flags.rateLimiting,
        };
        // Phase 9: Capabilities are usually LIVE if collected successfully
        const now = Date.now();
        const status = 'LIVE';
        return {
            status,
            asOf: now,
            data,
            source: 'collector_capabilities',
            staleAfterMs: 5000, // Capabilities change rarely
        };
    }
    catch (error) {
        return {
            status: 'UNAVAILABLE',
            asOf: Date.now(),
            source: 'collector_capabilities',
            staleAfterMs: 5000,
            reasonCode: 'COLLECTION_ERROR',
            message: error.message || 'Unknown error',
            action: 'system status',
        };
    }
}
//# sourceMappingURL=collector_capabilities.js.map