"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const MemoryOrchestrator_1 = require("./memory/MemoryOrchestrator");
function assert(condition, message) {
    if (!condition)
        throw new Error(message);
}
async function main() {
    const orchestrator = new MemoryOrchestrator_1.MemoryOrchestrator();
    await orchestrator.save({
        type: 'semantic',
        namespace: { project: 'open-life-core', user: 'rafa' },
        content: 'Runtime policy agora usa health e cooldown para fallback.',
        summary: 'runtime policy com health e cooldown',
        tags: ['runtime', 'phase1'],
        confidence: 0.9,
        dedupeKey: 'phase1-runtime-health',
        providers: ['local']
    });
    const results = await orchestrator.search({
        query: 'runtime policy health cooldown',
        namespace: { project: 'open-life-core' },
        topK: 5
    }, ['local']);
    assert(results.length >= 1, 'should retrieve at least one memory result');
    assert(results[0].record.namespace.project === 'open-life-core', 'should preserve namespace');
    assert(results[0].provider === 'local', 'should expose provider origin');
    console.log('TEST_MEMORY_ORCHESTRATOR_OK');
}
main().catch((error) => {
    console.error(error.message || error);
    process.exit(1);
});
