ocerebro 0.4.17 → 0.4.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/mcp/server.py +50 -12
package/package.json
CHANGED
package/pyproject.toml
CHANGED
package/src/mcp/server.py
CHANGED
|
@@ -564,27 +564,65 @@ class CerebroMCP:
|
|
|
564
564
|
return f"Promoção falhou: {result.metadata.get('reason', 'desconhecido')}"
|
|
565
565
|
|
|
566
566
|
def _status(self) -> str:
|
|
567
|
-
"""Status do sistema"""
|
|
567
|
+
"""Status do sistema com contagem de memórias por tipo"""
|
|
568
568
|
session_id = self.session_manager.get_session_id()
|
|
569
569
|
|
|
570
570
|
lines = [
|
|
571
|
-
"
|
|
572
|
-
|
|
573
|
-
|
|
571
|
+
"╔══════════════════════════════════════════════════════════════╗",
|
|
572
|
+
"║ 🧠 OCEREBRO STATUS ║",
|
|
573
|
+
"╚══════════════════════════════════════════════════════════════╝",
|
|
574
574
|
"",
|
|
575
|
-
"
|
|
576
|
-
f"
|
|
577
|
-
f" Working: {self.cerebro_path / 'working'}",
|
|
578
|
-
f" Official: {self.cerebro_path / 'official'}",
|
|
575
|
+
f"Session ID: {session_id}",
|
|
576
|
+
f"Path: {self.cerebro_path.absolute()}",
|
|
579
577
|
"",
|
|
580
|
-
"Índice:",
|
|
581
|
-
f" Metadata DB: {self.cerebro_path / 'index' / 'metadata.db'}",
|
|
582
|
-
f" Embeddings DB: {self.cerebro_path / 'index' / 'embeddings.db'}",
|
|
583
|
-
f" Entities DB: {self.cerebro_path / 'index' / 'entities.db'}"
|
|
584
578
|
]
|
|
585
579
|
|
|
580
|
+
# Contagem de memórias por tipo (entities DB)
|
|
581
|
+
try:
|
|
582
|
+
import sqlite3
|
|
583
|
+
conn = sqlite3.connect(str(self.cerebro_path / "index" / "entities.db"))
|
|
584
|
+
cursor = conn.cursor()
|
|
585
|
+
cursor.execute("SELECT entity_type, COUNT(*) FROM entities GROUP BY entity_type ORDER BY COUNT(*) DESC")
|
|
586
|
+
type_counts = cursor.fetchall()
|
|
587
|
+
conn.close()
|
|
588
|
+
|
|
589
|
+
if type_counts:
|
|
590
|
+
total = sum(c for _, c in type_counts)
|
|
591
|
+
lines.append(f"📊 Memórias: {total} total")
|
|
592
|
+
lines.append("")
|
|
593
|
+
lines.append("Por tipo:")
|
|
594
|
+
for entity_type, count in type_counts:
|
|
595
|
+
icon = self._get_type_icon(entity_type)
|
|
596
|
+
lines.append(f" {icon} {entity_type}: {count}")
|
|
597
|
+
else:
|
|
598
|
+
lines.append("📊 Memórias: 0")
|
|
599
|
+
except Exception:
|
|
600
|
+
lines.append("📊 Memórias: (banco não acessível)")
|
|
601
|
+
|
|
602
|
+
lines.append("")
|
|
603
|
+
lines.append("Storages:")
|
|
604
|
+
lines.append(f" 📁 Raw: {self.cerebro_path / 'raw'}")
|
|
605
|
+
lines.append(f" 📝 Working: {self.cerebro_path / 'working'}")
|
|
606
|
+
lines.append(f" 📋 Official: {self.cerebro_path / 'official'}")
|
|
607
|
+
|
|
586
608
|
return "\n".join(lines)
|
|
587
609
|
|
|
610
|
+
def _get_type_icon(self, entity_type: str) -> str:
|
|
611
|
+
"""Retorna ícone para tipo de memória"""
|
|
612
|
+
icons = {
|
|
613
|
+
"USER": "👤",
|
|
614
|
+
"FEEDBACK": "💬",
|
|
615
|
+
"PROJECT": "📂",
|
|
616
|
+
"REFERENCE": "🔗",
|
|
617
|
+
"TAG": "🏷️",
|
|
618
|
+
"TYPE": "📌",
|
|
619
|
+
"META": "⚙️",
|
|
620
|
+
"DECISION": "✅",
|
|
621
|
+
"ERROR": "❌",
|
|
622
|
+
"DRAFT": "📝",
|
|
623
|
+
}
|
|
624
|
+
return icons.get(entity_type, "📄")
|
|
625
|
+
|
|
588
626
|
def _hooks(self, args: Dict[str, Any]) -> str:
|
|
589
627
|
"""Lista e gerencia hooks customizados"""
|
|
590
628
|
action = args.get("action", "list")
|