UNPKG

@hivetechs/hive-ai

Version:

Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API

56 lines 2.51 kB
/** * Bridge Between Wizard System and SOURCE_OF_TRUTH Consensus * * The wizard creates profiles using enhanced-pipeline-config (better-sqlite3). * The consensus engine needs profiles in SOURCE_OF_TRUTH format (sqlite3). * This bridge syncs between the two systems seamlessly. */ import { v4 as uuidv4 } from 'uuid'; /** * Sync wizard profiles to SOURCE_OF_TRUTH consensus profiles */ export async function syncWizardProfilesToConsensus() { try { // Get wizard profiles from the secure config (used by setup wizard) const { securePipelineConfig } = await import('../security/secure-pipeline-config.js'); const wizardProfiles = await securePipelineConfig.getProfiles(); // Get existing consensus profiles const { getAllConsensusProfiles, createConsensusProfile, setActiveConsensusProfile } = await import('../storage/database.js'); const consensusProfiles = await getAllConsensusProfiles(); // Sync each wizard profile for (const wizardProfile of wizardProfiles) { // Check if already synced const existing = consensusProfiles.find(cp => cp.profile_name === wizardProfile.name); if (!existing) { // Create new consensus profile const consensusId = uuidv4(); await createConsensusProfile(consensusId, wizardProfile.name, wizardProfile.generator.model, wizardProfile.refiner.model, wizardProfile.validator.model, wizardProfile.curator?.model || wizardProfile.validator.model); // Set as active if it's the default in wizard if (wizardProfile.is_default) { await setActiveConsensusProfile(consensusId); } console.log(`🔄 Synced profile: "${wizardProfile.name}"`); } } } catch (error) { console.error('Bridge sync error:', error); // Don't throw - consensus should work even if bridge fails } } /** * Get active wizard profile and ensure it exists in consensus system */ export async function ensureActiveProfile() { try { await syncWizardProfilesToConsensus(); const { getActiveConsensusProfile } = await import('../storage/database.js'); const activeProfile = await getActiveConsensusProfile(); return !!activeProfile; } catch (error) { console.error('Error ensuring active profile:', error); return false; } } //# sourceMappingURL=consensus-bridge.js.map