nexo-brain 6.0.5 → 6.0.6

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": "6.0.5",
3
+ "version": "6.0.6",
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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  [Watch the overview video](https://nexo-brain.com/watch/) · [Watch on YouTube](https://www.youtube.com/watch?v=i2lkGhKyVqI) · [Open the infographic](https://nexo-brain.com/assets/nexo-brain-infographic-v5.png)
20
20
 
21
- Version `6.0.5` is the current packaged-runtime line: the strict pre-tool guardrail no longer blocks `Edit`/`Write` with *"unknown target"* when Claude Code's `PreToolUse` payload omits `session_id`. `process_pre_tool_event` now falls back to `$NEXO_HOME/coordination/.claude-session-id` (written by the SessionStart hook) before giving up, so a user who already called `nexo_startup` + `nexo_task_open` + `nexo_guard_check` + `nexo_track` stops seeing the block storm that several Claude Code versions triggered in 6.0.2–6.0.4. Fail-closed semantics are preserved: if neither the payload nor the coordination file yields a session id the guardrail still blocks with `missing_startup`. Release also lands a new `.github/workflows/tests.yml` that runs the full `pytest` suite on every PR the hook-guardrail regressions that shipped unnoticed in 6.0.2+ would have been caught by CI had this job existed then.
21
+ Version `6.0.6` is the current packaged-runtime line: the installer no longer leaks `export PATH="$NEXO_HOME/bin:$PATH"` into the developer's real shell profile (`~/.bash_profile`, `~/.bashrc`, `~/.zshrc`) when `NEXO_HOME` points somewhere other than the canonical `$HOME/.nexo` the classic case being any pytest run with `NEXO_HOME=/tmp/pytest-xxx`. Both the Python path (`src/auto_update.py::_ensure_runtime_cli_in_shell`) and the two JavaScript twins in `bin/nexo-brain.js` (install Step 8 and the migration path that restores the operator alias) now consult `_should_skip_shell_profile_backfill()` / `shouldSkipShellProfileBackfill()` and skip the write whenever `NEXO_HOME` is non-canonical, with `NEXO_SKIP_SHELL_PROFILE=1` as an explicit escape hatch. Fresh installs at `$HOME/.nexo` are unaffected. Release also carries v6.0.5's strict-hook `unknown target` fix and the pytest CI gate that caught this regression in the first place.
22
22
 
23
23
  Previously in `6.0.2`: adds the reserved caller prefix `personal/*` so scripts living in `~/.nexo/scripts/` can invoke the automation backend with their own caller id without editing `src/resonance_map.py`. New kwarg `tier` (`"maximo"` / `"alto"` / `"medio"` / `"bajo"`) on `run_automation_prompt`, `run_automation_interactive`, `nexo_helper.run_automation_text`, `nexo_helper.run_automation_json`, and `nexo-agent-run.py --tier`. Precedence for `personal/*` callers: explicit `tier=` → explicit `reasoning_effort=` → `calibration.preferences.default_resonance` → `DEFAULT_RESONANCE` (`alto`). Registered callers keep their behaviour unchanged. New guide: [`docs/personal-scripts-guide.md`](docs/personal-scripts-guide.md).
24
24
 
package/bin/nexo-brain.js CHANGED
@@ -21,6 +21,27 @@ const path = require("path");
21
21
  const readline = require("readline");
22
22
 
23
23
  let NEXO_HOME = process.env.NEXO_HOME || path.join(require("os").homedir(), ".nexo");
24
+
25
+ function shouldSkipShellProfileBackfill() {
26
+ // Mirror of _should_skip_shell_profile_backfill() in src/auto_update.py.
27
+ // Prevent the installer from leaking ``export PATH`` / operator alias lines
28
+ // into the developer's real shell profile whenever NEXO_HOME is not the
29
+ // canonical $HOME/.nexo path (pytest tmp dirs, CI sandboxes, containers).
30
+ const flag = String(process.env.NEXO_SKIP_SHELL_PROFILE || "").trim().toLowerCase();
31
+ if (["1", "true", "yes", "on"].includes(flag)) {
32
+ return { skip: true, reason: `NEXO_SKIP_SHELL_PROFILE=${flag}` };
33
+ }
34
+ const canonical = path.join(require("os").homedir(), ".nexo");
35
+ let actual = NEXO_HOME;
36
+ try {
37
+ actual = path.resolve(NEXO_HOME);
38
+ } catch {}
39
+ if (actual !== canonical) {
40
+ return { skip: true, reason: `NEXO_HOME=${actual} is not the canonical ${canonical}` };
41
+ }
42
+ return { skip: false, reason: "" };
43
+ }
44
+
24
45
  const CLAUDE_SETTINGS = path.join(
25
46
  require("os").homedir(),
26
47
  ".claude",
@@ -1856,6 +1877,10 @@ async function main() {
1856
1877
  const migOperatorName = installed.operator_name || "NEXO";
1857
1878
  const migAliasName = migOperatorName.toLowerCase();
1858
1879
  if (migAliasName !== "nexo") {
1880
+ const migSkip = shouldSkipShellProfileBackfill();
1881
+ if (migSkip.skip) {
1882
+ log(` Skipping shell profile alias restore — ${migSkip.reason}`);
1883
+ } else {
1859
1884
  const migAliasLine = `alias ${migAliasName}='nexo chat .'`;
1860
1885
  const migAliasComment = `# ${migOperatorName} — open the configured NEXO terminal client`;
1861
1886
  const migNexoPathLine = `export PATH="${path.join(NEXO_HOME, "bin")}:$PATH"`;
@@ -1884,6 +1909,7 @@ async function main() {
1884
1909
  log(` Restored '${migAliasName}' alias in ${path.basename(rcFile)}`);
1885
1910
  }
1886
1911
  }
1912
+ }
1887
1913
  }
1888
1914
 
1889
1915
  console.log("");
@@ -3390,6 +3416,12 @@ ${doScan ? `- Stack: ${Object.keys(profileData.code.languages || {}).slice(0, 5)
3390
3416
 
3391
3417
  // Step 8: Create shell alias and add runtime CLI to PATH
3392
3418
  const aliasName = operatorName.toLowerCase();
3419
+ const installSkipShell = shouldSkipShellProfileBackfill();
3420
+ if (installSkipShell.skip) {
3421
+ log(`Skipping shell profile setup — ${installSkipShell.reason}`);
3422
+ log(`(Runtime CLI wrapper still installed at ${path.join(NEXO_HOME, "bin", "nexo")}; add it to PATH manually if needed.)`);
3423
+ console.log("");
3424
+ } else {
3393
3425
  const nexoPathLine = `export PATH="${path.join(NEXO_HOME, "bin")}:$PATH"`;
3394
3426
  const nexoPathComment = "# NEXO runtime CLI";
3395
3427
 
@@ -3442,6 +3474,7 @@ ${doScan ? `- Stack: ${Object.keys(profileData.code.languages || {}).slice(0, 5)
3442
3474
  log(`After setup, open a new terminal and type: ${aliasName} or nexo`);
3443
3475
  }
3444
3476
  console.log("");
3477
+ }
3445
3478
 
3446
3479
  // Step 9: Generate CLAUDE.md template
3447
3480
  log("Generating operator instructions...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "6.0.5",
3
+ "version": "6.0.6",
4
4
  "mcpName": "io.github.wazionapps/nexo",
5
5
  "description": "NEXO Brain \u2014 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",
@@ -383,7 +383,38 @@ def _shell_rc_files() -> list[Path]:
383
383
  return [home_dir / ".bash_profile", home_dir / ".bashrc"]
384
384
 
385
385
 
386
+ def _should_skip_shell_profile_backfill() -> tuple[bool, str]:
387
+ """Decide whether to skip writing ``export PATH`` into the user's shell rc.
388
+
389
+ The backfill must only touch the real user shell profile when the runtime
390
+ is installed at the canonical ``$HOME/.nexo`` location. When ``NEXO_HOME``
391
+ points elsewhere (pytest ``tmp_path``, CI sandbox, containerised test
392
+ harness) writing to ``~/.bash_profile`` / ``~/.bashrc`` / ``~/.zshrc``
393
+ leaks a non-canonical ``export PATH`` line into the developer's real
394
+ shell, which is exactly the bug reported for v6.0.x. Users can force-skip
395
+ via ``NEXO_SKIP_SHELL_PROFILE=1``.
396
+ """
397
+ flag = os.environ.get("NEXO_SKIP_SHELL_PROFILE", "").strip().lower()
398
+ if flag in {"1", "true", "yes", "on"}:
399
+ return True, f"NEXO_SKIP_SHELL_PROFILE={flag}"
400
+ try:
401
+ canonical = managed_nexo_home()
402
+ except Exception:
403
+ canonical = Path.home() / ".nexo"
404
+ try:
405
+ same = NEXO_HOME.resolve(strict=False) == canonical.resolve(strict=False)
406
+ except Exception:
407
+ same = NEXO_HOME == canonical
408
+ if not same:
409
+ return True, f"NEXO_HOME={NEXO_HOME} is not the canonical {canonical}"
410
+ return False, ""
411
+
412
+
386
413
  def _ensure_runtime_cli_in_shell():
414
+ skip, reason = _should_skip_shell_profile_backfill()
415
+ if skip:
416
+ _log(f"Skipping shell profile backfill — {reason}")
417
+ return
387
418
  path_line = f'export PATH="{NEXO_HOME / "bin"}:$PATH"'
388
419
  comment = "# NEXO runtime CLI"
389
420
  for rc_file in _shell_rc_files():