File size: 1,653 Bytes
cf076b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import os
import json
import logging
from pathlib import Path

class Bootstrap:
    def __init__(self, config_path):
        self.config_path = Path(config_path)
        self.config = self.load_config()
        
    def load_config(self):
        if self.config_path.exists():
            return json.loads(self.config_path.read_text())
        return {}
    
    def run(self):
        # Initialize directories
        hive_home = Path(self.config.get("hive_home", "/data/hive_data"))
        for subdir in ["system", "users", "voice", "admin", "curves", "knowledge"]:
            (hive_home / subdir).mkdir(parents=True, exist_ok=True)
        
        # Initialize subsystems
        from ..security.auth import Auth
        from ..voice.voiceprint import VoicePrint
        from ..voice.asr import ASR
        from ..convo.dialogue_manager import DialogueManager
        from ..persistence.persistence_engine import PersistenceEngine
        
        # Create core components
        auth = Auth(hive_home)
        voiceprint = VoicePrint(hive_home)
        asr = ASR(hive_home)
        persistence = PersistenceEngine(hive_home)
        
        # Create dialogue manager
        dialogue = DialogueManager(self.config, persistence, auth, voiceprint, asr)
        
        # Return Hive instance
        from .hive_core import HiveCore
        return HiveCore(
            dialogue=dialogue,
            persistence=persistence,
            security=type('Security', (), {'auth': auth})(),
            voice=type('Voice', (), {'voiceprint': voiceprint, 'asr': asr})(),
            convo=type('Convo', (), {'dialogue_manager': dialogue})()
        )