nexo-brain 5.3.17 → 5.3.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "5.3.17",
3
+ "version": "5.3.18",
4
4
  "description": "Local cognitive runtime for Claude Code \u2014 persistent memory, overnight learning, doctor diagnostics, personal scripts, recovery-aware jobs, startup preflight, and optional dashboard/power helper.",
5
5
  "author": {
6
6
  "name": "NEXO Brain",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "5.3.17",
3
+ "version": "5.3.18",
4
4
  "mcpName": "io.github.wazionapps/nexo",
5
5
  "description": "NEXO Brain — Shared brain for AI agents. Persistent memory, semantic RAG, natural forgetting, metacognitive guard, trust scoring, 150+ MCP tools. Works with Claude Code, Codex, Claude Desktop & any MCP client. 100% local, free.",
6
6
  "homepage": "https://nexo-brain.com",
@@ -28,11 +28,30 @@ SRC_DIR = Path(__file__).resolve().parent
28
28
  NEXO_CODE = Path(os.environ.get("NEXO_CODE", str(SRC_DIR)))
29
29
  REPO_DIR = SRC_DIR.parent
30
30
 
31
+
32
+ def _resolve_repo_dir() -> Path:
33
+ """Return the source repo root, falling back to NEXO_HOME for npm installs.
34
+
35
+ On git installs SRC_DIR is ``<repo>/src`` so parent is the repo root.
36
+ On npm installs SRC_DIR *is* NEXO_HOME (``~/.nexo``) so parent is ``~``,
37
+ which has no ``templates/`` or ``migrations/``. In that case we fall back
38
+ to NEXO_HOME itself where the installer already copied the runtime files.
39
+ """
40
+ candidate = SRC_DIR.parent
41
+ if (candidate / "templates").is_dir():
42
+ return candidate
43
+ if (NEXO_HOME / "templates").is_dir():
44
+ return NEXO_HOME
45
+ return candidate
46
+
47
+
48
+ _RESOLVED_REPO_DIR = _resolve_repo_dir()
49
+
31
50
  LAST_CHECK_FILE = DATA_DIR / "auto_update_last_check.json"
32
51
  MIGRATION_VERSION_FILE = DATA_DIR / "migration_version"
33
52
  CLAUDE_MD_VERSION_FILE = DATA_DIR / "claude_md_version.txt"
34
- MIGRATIONS_DIR = REPO_DIR / "migrations"
35
- TEMPLATE_FILE = REPO_DIR / "templates" / "CLAUDE.md.template"
53
+ MIGRATIONS_DIR = _RESOLVED_REPO_DIR / "migrations"
54
+ TEMPLATE_FILE = _RESOLVED_REPO_DIR / "templates" / "CLAUDE.md.template"
36
55
 
37
56
  CHECK_COOLDOWN_SECONDS = 3600 # 1 hour
38
57
  GIT_TIMEOUT_SECONDS = 4 # stay well under the 5s total budget
@@ -1514,7 +1533,7 @@ def _auto_update_check_locked() -> dict:
1514
1533
 
1515
1534
  # Backfill all templates for existing installs (no hardcoded list)
1516
1535
  try:
1517
- templates_src = REPO_DIR / "templates"
1536
+ templates_src = _RESOLVED_REPO_DIR / "templates"
1518
1537
  templates_dest = NEXO_HOME / "templates"
1519
1538
  templates_dest.mkdir(parents=True, exist_ok=True)
1520
1539
  import shutil
@@ -1569,8 +1588,8 @@ def _auto_update_check_locked() -> dict:
1569
1588
  result["git_update"] = _check_git_updates()
1570
1589
  else:
1571
1590
  # Non-git install — check npm for newer version
1572
- version_json = REPO_DIR / "version.json"
1573
- pkg_json = REPO_DIR / "package.json"
1591
+ version_json = _RESOLVED_REPO_DIR / "version.json"
1592
+ pkg_json = _RESOLVED_REPO_DIR / "package.json"
1574
1593
  if version_json.exists() or pkg_json.exists():
1575
1594
  result["npm_notice"] = _check_npm_version()
1576
1595