"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const PromotionPipeline_1 = require("./orchestrator/PromotionPipeline");
const MemoryPromotionFlow_1 = require("./memory/MemoryPromotionFlow");
function assert(condition, message) {
    if (!condition)
        throw new Error(message);
}
async function main() {
    const pipeline = new PromotionPipeline_1.PromotionPipeline();
    const flow = new MemoryPromotionFlow_1.MemoryPromotionFlow({ retrievalProviders: ['local'] });
    pipeline.add({
        id: 'playbook-runtime-fallback',
        type: 'playbook',
        sourceMissionId: 'mission-123',
        summary: 'Quando Gemini cair por quota, priorizar cooldown e fallback para Codex.',
        createdAt: new Date().toISOString()
    }, {
        project: 'open-life-core',
        user: 'rafa',
        domain: 'runtime',
        missionType: 'runtime'
    });
    const results = await flow.retrieve('Gemini quota fallback codex', {
        project: 'open-life-core',
        user: 'rafa',
        domain: 'runtime'
    }, ['semantic', 'episodic']);
    assert(results.length >= 1, 'should retrieve promoted memory');
    assert(results.some((item) => item.record.namespace.project === 'open-life-core'), 'promoted memory should preserve namespace');
    console.log('TEST_MEMORY_PROMOTION_OK');
}
main().catch((error) => {
    console.error(error.message || error);
    process.exit(1);
});
