ocerebro 0.4.13 → 0.4.15

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ocerebro",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "description": "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)",
5
5
  "main": "bin/ocerebro.js",
6
6
  "bin": {
package/pyproject.toml CHANGED
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ocerebro"
7
- version = "0.4.13"
7
+ version = "0.4.15"
8
8
  description = "OCerebro - Sistema de Memoria para Agentes (Claude Code/MCP)"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
6
  <title>🧠 OCerebro Dashboard</title>
7
- <link rel="stylesheet" href="style.css">
7
+ <link rel="stylesheet" href="static/style.css">
8
8
  <!-- Cytoscape.js -->
9
9
  <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.28.1/cytoscape.min.js"></script>
10
10
  <!-- Chart.js -->
package/src/mcp/server.py CHANGED
@@ -932,75 +932,57 @@ Uma chamada por memória. O sistema salva e indexa automaticamente.
932
932
 
933
933
  port = args.get("port", 7999)
934
934
 
935
- # Verifica se está rodando
936
- import socket
937
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
938
- sock.settimeout(1)
939
- result = sock.connect_ex(('127.0.0.1', port))
940
- sock.close()
941
- is_running = result == 0
942
-
943
- if is_running:
944
- # Verifica se o servidor está usando o cerebro_path correto
935
+ # SEMPRE mata o processo antigo e reinicia - garante cerebro_path correto
936
+ pid_file = Path.home() / ".ocerebro_dashboard.pid"
937
+ if pid_file.exists():
945
938
  try:
946
- import urllib.request
947
- import json as _json
948
- with urllib.request.urlopen(
949
- f"http://127.0.0.1:{port}/api/ping", timeout=2
950
- ) as resp:
951
- data = _json.loads(resp.read().decode())
952
- running_path = data.get("cerebro_path", "")
953
- current_path = str(self.cerebro_path.absolute())
954
-
955
- if running_path != current_path:
956
- # Path diferente - precisa reiniciar o servidor
957
- # Lê o PID e mata o processo antigo
958
- pid_file = Path.home() / ".ocerebro_dashboard.pid"
959
- if pid_file.exists():
960
- try:
961
- old_pid = int(pid_file.read_text(encoding="utf-8").strip())
962
- import os
963
- # WINDOWS FIX: usa taskkill no Windows
964
- if sys.platform == "win32":
965
- import subprocess
966
- subprocess.call(["taskkill", "/F", "/PID", str(old_pid)])
967
- else:
968
- os.kill(old_pid, 9) # SIGKILL
969
- pid_file.unlink() # Remove o arquivo PID
970
- except Exception:
971
- pass # Processo já morreu ou erro ao matar
972
-
973
- # Agora is_running será False e vamos reiniciar abaixo
974
- is_running = False
939
+ old_pid = int(pid_file.read_text(encoding="utf-8").strip())
940
+ import os
941
+ # WINDOWS FIX: usa taskkill no Windows
942
+ if sys.platform == "win32":
943
+ subprocess.call(["taskkill", "/F", "/PID", str(old_pid)],
944
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
945
+ else:
946
+ os.kill(old_pid, 9) # SIGKILL
947
+ pid_file.unlink() # Remove o arquivo PID
975
948
  except Exception:
976
- pass # Se falhar o ping, tenta reiniciar mesmo assim
977
-
978
- if not is_running:
979
- # Inicia como processo separado (persiste após o MCP terminar)
980
- server_script = Path(__file__).parent.parent / "dashboard" / "standalone_server.py"
981
- if not server_script.exists():
982
- return "⚠️ Erro: standalone_server.py não encontrado."
983
-
984
- # Inicia processo em background
985
- subprocess.Popen(
986
- [sys.executable, str(server_script), str(port), str(self.cerebro_path.absolute())],
987
- stdout=subprocess.DEVNULL,
988
- stderr=subprocess.DEVNULL,
989
- start_new_session=True # Desacoplado do processo pai
990
- )
949
+ pass # Processo morreu ou erro ao matar
950
+
951
+ # Aguarda porta liberar (até 2s)
952
+ import time
953
+ for _ in range(20):
954
+ time.sleep(0.1)
955
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
956
+ sock.settimeout(1)
957
+ result = sock.connect_ex(('127.0.0.1', port))
958
+ sock.close()
959
+ if result != 0:
960
+ break
961
+
962
+ # Inicia como processo separado (persiste após o MCP terminar)
963
+ server_script = Path(__file__).parent.parent / "dashboard" / "standalone_server.py"
964
+ if not server_script.exists():
965
+ return "⚠️ Erro: standalone_server.py não encontrado."
966
+
967
+ # Inicia processo em background
968
+ subprocess.Popen(
969
+ [sys.executable, str(server_script), str(port), str(self.cerebro_path.absolute())],
970
+ stdout=subprocess.DEVNULL,
971
+ stderr=subprocess.DEVNULL,
972
+ start_new_session=True # Desacoplado do processo pai
973
+ )
991
974
 
992
- # Aguarda servidor estar pronto (até 5s)
993
- import time
994
- for _ in range(50):
995
- time.sleep(0.1)
996
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
997
- sock.settimeout(1)
998
- result = sock.connect_ex(('127.0.0.1', port))
999
- sock.close()
1000
- if result == 0:
1001
- break
1002
- else:
1003
- return "⚠️ Servidor não iniciou em 5 segundos."
975
+ # Aguarda servidor estar pronto (até 5s)
976
+ for _ in range(50):
977
+ time.sleep(0.1)
978
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
979
+ sock.settimeout(1)
980
+ result = sock.connect_ex(('127.0.0.1', port))
981
+ sock.close()
982
+ if result == 0:
983
+ break
984
+ else:
985
+ return "⚠️ Servidor não iniciou em 5 segundos."
1004
986
 
1005
987
  # Abre browser
1006
988
  import webbrowser