Hive_2 / bootstrap.py
Paulhayes's picture
Create bootstrap.py
cf076b1 verified
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})()
)