"use strict";
/**
 * Test script for the ModelStandardsUtility validation functions
 *
 * This script tests the validation of model configurations using the
 * @bluefly/reelcode package integration.
 *
 * Run with:
 * npx ts-node src/components/model-registry/test-standards-validation.ts
 */
Object.defineProperty(exports, "__esModule", { value: true });
const ModelStandardsUtility_js_1 = require("./ModelStandardsUtility.js");
// Sample models for testing
const validModel = {
    name: 'valid-model',
    provider: 'anthropic',
    version: '1.0.0',
    description: 'A properly configured model',
    parameters: {
        temperature: 0.7,
        max_tokens: 1024,
        top_p: 0.95
    },
    capabilities: ['text-generation', 'chat'],
    deployment_config: {
        environment: 'development',
        strategy: 'rolling',
        replicas: 1,
        auto_scaling: false
    }
};
const invalidModel = {
    name: 'invalid model!', // Invalid characters
    provider: 'unknown', // Invalid provider - using type assertion
    version: '1.0', // Not full semver
    description: 'A model with configuration issues',
    parameters: {
        temperature: 1.5, // Out of range
        max_tokens: -10 // Invalid value
    },
    deployment_config: {
        environment: 'production', // Production with insufficient config
        strategy: 'rolling',
        replicas: 1, // Too few for production
        auto_scaling: false // Should be true for production
    }
};
const productionModel = {
    name: 'production-model',
    provider: 'anthropic',
    version: '2.0.0',
    description: 'A production model',
    parameters: {
        temperature: 0.5,
        max_tokens: 2048,
        // Missing top_p and top_k for production
    },
    deployment_config: {
        environment: 'production',
        strategy: 'blue_green',
        replicas: 1, // Too few for production
        auto_scaling: false // Should be true for production
    }
    // Missing metrics for production
};
// Run validation tests
async function runValidationTests() {
    console.log('=== Model Standards Validation Test ===\n');
    // Test 1: Valid model
    console.log('Test 1: Valid model');
    const validResult = (0, ModelStandardsUtility_js_1.validateModelStandards)(validModel);
    console.log('Valid model result:', validResult.valid ? 'PASSED' : 'FAILED');
    console.log('Errors:', validResult.errors.length);
    console.log('Warnings:', validResult.warnings.length);
    if (validResult.warnings.length > 0) {
        console.log('Warnings:');
        validResult.warnings.forEach((warning) => {
            console.log(`  - ${warning.rule}: ${warning.message}`);
        });
    }
    console.log();
    // Test 2: Invalid model
    console.log('Test 2: Invalid model');
    const invalidResult = (0, ModelStandardsUtility_js_1.validateModelStandards)(invalidModel);
    console.log('Invalid model result:', invalidResult.valid ? 'FAILED' : 'PASSED');
    console.log('Errors:', invalidResult.errors.length);
    console.log('Warnings:', invalidResult.warnings.length);
    if (invalidResult.errors.length > 0) {
        console.log('Errors:');
        invalidResult.errors.forEach((error) => {
            console.log(`  - ${error.rule}: ${error.message}`);
        });
    }
    console.log();
    // Test 3: Production model (should have warnings)
    console.log('Test 3: Production model');
    const productionResult = (0, ModelStandardsUtility_js_1.validateModelStandards)(productionModel);
    console.log('Production model result:', productionResult.valid ? 'VALID' : 'INVALID');
    console.log('Errors:', productionResult.errors.length);
    console.log('Warnings:', productionResult.warnings.length);
    if (productionResult.warnings.length > 0) {
        console.log('Warnings:');
        productionResult.warnings.forEach((warning) => {
            console.log(`  - ${warning.rule}: ${warning.message}`);
        });
    }
    console.log();
    // Test 4: Auto-fix invalid model
    console.log('Test 4: Auto-fix invalid model');
    console.log('Before fix:');
    console.log(JSON.stringify(invalidModel, null, 2));
    const fixedModel = (0, ModelStandardsUtility_js_1.applyModelStandards)(invalidModel);
    console.log('After fix:');
    console.log(JSON.stringify(fixedModel, null, 2));
    // Validate fixed model
    const fixedResult = (0, ModelStandardsUtility_js_1.validateModelStandards)(fixedModel);
    console.log('Fixed model result:', fixedResult.valid ? 'FIXED' : 'STILL INVALID');
    console.log('Remaining errors:', fixedResult.errors.length);
    console.log('Remaining warnings:', fixedResult.warnings.length);
}
// Run the tests
runValidationTests().catch(error => {
    console.error('Test failed:', error);
});
//# sourceMappingURL=test-standards-validation.js.map