"use strict";
/**
 * Test ReelCode Integration
 *
 * This script tests the integration between bfui and the published ReelCode package
 * with model validation functionality.
 *
 * Run with:
 * ts-node test-reelcode-integration.ts
 */
Object.defineProperty(exports, "__esModule", { value: true });
const reelcode_1 = require("@bluefly/reelcode");
const ModelStandardsUtility_js_1 = require("./ModelStandardsUtility.js");
// Test models
const validModel = {
    name: 'valid-model',
    provider: 'anthropic',
    version: '1.0.0',
    description: 'A valid model for testing',
    parameters: {
        temperature: 0.7,
        max_tokens: 1024,
        top_p: 0.95
    },
    deployment_config: {
        environment: 'development',
        strategy: 'rolling',
        replicas: 1
    }
};
const invalidModel = {
    name: 'in!valid model', // Invalid name with special characters and spaces
    provider: 'unknown-provider', // Invalid provider
    version: '1.0', // Invalid version
    parameters: {
        temperature: 1.5, // Outside valid range
        max_tokens: 0 // Too small
    },
    deployment_config: {
        environment: 'production',
        strategy: 'rolling',
        replicas: 1, // Too few for production
        auto_scaling: false // Required for production
    }
};
async function testReelCodeIntegration() {
    console.log('Testing ReelCode Package Integration');
    console.log('===================================');
    // Test 1: Direct ReelCode validation
    console.log('\n1. Direct ReelCode Package Validation:');
    try {
        const result = await (0, reelcode_1.validateModel)({
            name: 'test-model',
            provider: 'anthropic',
            version: '1.0.0'
        });
        console.log('Direct validation result:', result.valid ? 'Valid' : 'Invalid', `(${result.errors.length} errors, ${result.warnings.length} warnings)`);
    }
    catch (error) {
        console.error('Error with direct validation:', error);
    }
    // Test 2: bfui utility validation with valid model
    console.log('\n2. bfui Utility Validation (Valid Model):');
    try {
        const result = await (0, ModelStandardsUtility_js_1.validateModelStandards)(validModel);
        console.log('Valid model result:', result.valid ? 'Valid' : 'Invalid', `(${result.errors.length} errors, ${result.warnings.length} warnings)`);
    }
    catch (error) {
        console.error('Error validating valid model:', error);
    }
    // Test 3: bfui utility validation with invalid model
    console.log('\n3. bfui Utility Validation (Invalid Model):');
    try {
        const result = await (0, ModelStandardsUtility_js_1.validateModelStandards)(invalidModel);
        console.log('Invalid model result:', result.valid ? 'Valid' : 'Invalid', `(${result.errors.length} errors, ${result.warnings.length} warnings)`);
        if (result.errors.length > 0) {
            console.log('\nValidation errors:');
            result.errors.forEach(error => {
                console.log(`- ${error.rule}: ${error.message}`);
            });
        }
    }
    catch (error) {
        console.error('Error validating invalid model:', error);
    }
    // Test 4: bfui utility auto-fix
    console.log('\n4. bfui Utility Auto-Fix:');
    try {
        console.log('Before fixing:');
        console.log('- Name:', invalidModel.name);
        console.log('- Provider:', invalidModel.provider);
        console.log('- Version:', invalidModel.version);
        console.log('- Temperature:', invalidModel.parameters?.temperature);
        console.log('- Max Tokens:', invalidModel.parameters?.max_tokens);
        console.log('- Replicas:', invalidModel.deployment_config?.replicas);
        console.log('- Auto Scaling:', invalidModel.deployment_config?.auto_scaling);
        const fixedModel = await (0, ModelStandardsUtility_js_1.applyModelStandards)(invalidModel);
        console.log('\nAfter fixing:');
        console.log('- Name:', fixedModel.name);
        console.log('- Provider:', fixedModel.provider); // This won't be fixed
        console.log('- Version:', fixedModel.version);
        console.log('- Temperature:', fixedModel.parameters?.temperature);
        console.log('- Max Tokens:', fixedModel.parameters?.max_tokens);
        console.log('- Replicas:', fixedModel.deployment_config?.replicas);
        console.log('- Auto Scaling:', fixedModel.deployment_config?.auto_scaling);
    }
    catch (error) {
        console.error('Error applying standards:', error);
    }
    console.log('\nTests completed!');
}
// Run the tests
testReelCodeIntegration().catch(error => {
    console.error('Test error:', error);
});
//# sourceMappingURL=test-reelcode-integration.js.map