// MemPalace integration class MemPalace { constructor() { this.palacePath = '~/.mempalace/palace'; this.wing = 'nexus_chat'; this.init(); } async init() { try { await this.setupWing(); this.setupAutoMining(); } catch (error) { console.error('MemPalace init failed:', error); } } async setupWing() { await window.electronAPI.execPython(`mempalace init ${this.palacePath}`); await window.electronAPI.execPython(`mempalace mine ~/chats --mode convos --wing ${this.wing}`); } setupAutoMining() { setInterval(() => { window.electronAPI.execPython(`mempalace mine #chat-container --mode convos --wing ${this.wing}`); }, 30000); // Mine every 30 seconds } async search(query) { const result = await window.electronAPI.execPython(`mempalace search "${query}" --wing ${this.wing}`); return result.stdout; } updateStats() { const stats = window.electronAPI.execPython(`mempalace status --wing ${this.wing}`); document.getElementById('compression-ratio').textContent = `${stats.compression_ratio.toFixed(1)}x`; document.getElementById('docs-mined').textContent = stats.total_docs; document.getElementById('aaak-size').textContent = stats.aaak_size; } } // Initialize MemPalace const mempalace = new MemPalace();