nexo-brain 7.25.1 → 7.25.2

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": "nexo-brain",
3
- "version": "7.25.1",
3
+ "version": "7.25.2",
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",
@@ -280,18 +280,41 @@ def _npm_command_parts() -> tuple[list[str], dict[str, str]]:
280
280
  desktop_node = str(os.environ.get("NEXO_DESKTOP_NODE", "")).strip()
281
281
  bundled_npm_cli = str(os.environ.get("NEXO_DESKTOP_NPM_CLI", "")).strip()
282
282
  env = dict(os.environ)
283
- if desktop_node and bundled_npm_cli and Path(desktop_node).exists():
283
+ if desktop_node and bundled_npm_cli and Path(desktop_node).exists() and Path(bundled_npm_cli).exists():
284
284
  env["ELECTRON_RUN_AS_NODE"] = "1"
285
+ _apply_desktop_npm_prefix(env)
285
286
  return [desktop_node, bundled_npm_cli], env
286
287
  return ["npm"], env
287
288
 
288
289
 
290
+ def _desktop_npm_prefix() -> str:
291
+ return (
292
+ str(os.environ.get("NEXO_DESKTOP_NPM_PREFIX", "")).strip()
293
+ or str(os.environ.get("NEXO_CLAUDE_PREFIX", "")).strip()
294
+ or str(NEXO_HOME / "runtime" / "bootstrap" / "npm-global")
295
+ )
296
+
297
+
298
+ def _apply_desktop_npm_prefix(env: dict[str, str]) -> None:
299
+ if env.get("ELECTRON_RUN_AS_NODE") != "1":
300
+ return
301
+ npm_prefix = _desktop_npm_prefix()
302
+ if not npm_prefix:
303
+ return
304
+ env.setdefault("NPM_CONFIG_PREFIX", npm_prefix)
305
+ prefix_bin = str(Path(npm_prefix) / "bin")
306
+ current_path = str(env.get("PATH", ""))
307
+ entries = [entry for entry in current_path.split(os.pathsep) if entry]
308
+ env["PATH"] = os.pathsep.join([prefix_bin, *[entry for entry in entries if entry != prefix_bin]])
309
+
310
+
289
311
  def _run_npm(args: list[str], **kwargs):
290
312
  cmd, env = _npm_command_parts()
291
313
  extra_env = kwargs.pop("env", None)
292
314
  merged_env = dict(env)
293
315
  if extra_env:
294
316
  merged_env.update(extra_env)
317
+ _apply_desktop_npm_prefix(merged_env)
295
318
  return subprocess.run([*cmd, *args], env=merged_env, **kwargs)
296
319
 
297
320
 
@@ -1268,7 +1291,7 @@ def _handle_packaged_update(progress_fn=None, *, include_clis: bool = True) -> s
1268
1291
  try:
1269
1292
  _emit_progress(progress_fn, "Downloading and applying the latest npm package...")
1270
1293
  result = _run_npm(
1271
- ["update", "-g", "nexo-brain"],
1294
+ ["install", "-g", "nexo-brain@latest"],
1272
1295
  capture_output=True, text=True, timeout=120,
1273
1296
  env={**os.environ, "NEXO_HOME": str(NEXO_HOME)},
1274
1297
  )