nexo-brain 7.30.26 → 7.30.27

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": "7.30.26",
3
+ "version": "7.30.27",
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,9 @@
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 `7.30.26` is the current packaged-runtime line. Patch release over v7.30.25 - `nexo update` now copies packaged core scripts through the F0.6 `scripts -> core/scripts` shim, so watchdog fixes reach the active LaunchAgent path.
21
+ Version `7.30.27` is the current packaged-runtime line. Patch release over v7.30.26 - post-update repair now recovers core scripts archived by older F0.6 shim reconciliation and refreshes `core/current` from `core`, so same-version snapshots cannot keep stale watchdog code.
22
+
23
+ Previously in `7.30.26`: patch release over v7.30.25 - `nexo update` now copies packaged core scripts through the F0.6 `scripts -> core/scripts` shim, so watchdog fixes reach the active LaunchAgent path.
22
24
 
23
25
  Previously in `7.30.25`: patch release over v7.30.24 - Desktop-facing maintenance diagnostics now self-heal or stay informational when the runtime is healthy, and watchdog uses the canonical cognitive DB layout.
24
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nexo-brain",
3
- "version": "7.30.26",
3
+ "version": "7.30.27",
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",
@@ -5590,12 +5590,126 @@ def _maybe_promote_adaptive_weights_empirically(dest: Path) -> tuple[bool, str |
5590
5590
  return True, None
5591
5591
 
5592
5592
 
5593
+ def _promote_f06_core_scripts_from_latest_legacy_conflict(dest: Path) -> tuple[bool, str | None]:
5594
+ """Recover core script updates archived by the pre-fix F0.6 shim path.
5595
+
5596
+ Older updaters copied packaged scripts into ``NEXO_HOME/scripts`` after
5597
+ breaking the F0.6 compatibility symlink. The subsequent shim reconciliation
5598
+ saw those fresh scripts as legacy conflicts and archived them under
5599
+ ``runtime/backups/legacy-shim-conflicts-*`` instead of replacing
5600
+ ``core/scripts``. This hook runs from the freshly-copied release tree, so it
5601
+ can repair the first upgrade that introduces the updater fix.
5602
+ """
5603
+ try:
5604
+ marker = (dest / ".structure-version").read_text(encoding="utf-8").strip()
5605
+ except Exception:
5606
+ marker = ""
5607
+ if marker != "F0.6":
5608
+ return False, None
5609
+
5610
+ core_scripts = dest / "core" / "scripts"
5611
+ backups_dir = dest / "runtime" / "backups"
5612
+ if not core_scripts.is_dir() or not backups_dir.is_dir():
5613
+ return False, None
5614
+
5615
+ try:
5616
+ candidates = sorted(
5617
+ [p for p in backups_dir.glob("legacy-shim-conflicts-*") if (p / "scripts").is_dir()],
5618
+ key=lambda p: p.stat().st_mtime,
5619
+ reverse=True,
5620
+ )
5621
+ except Exception:
5622
+ return False, "f06-core-scripts-promote-warning:scan"
5623
+
5624
+ if not candidates:
5625
+ return False, None
5626
+
5627
+ def _should_skip(path: Path) -> bool:
5628
+ return (
5629
+ path.name == "__pycache__"
5630
+ or path.name.startswith(".")
5631
+ or is_duplicate_artifact_name(path)
5632
+ )
5633
+
5634
+ def _source_is_not_older(src: Path, dst: Path) -> bool:
5635
+ if not dst.exists() and not dst.is_symlink():
5636
+ return True
5637
+ try:
5638
+ return src.stat().st_mtime >= dst.stat().st_mtime
5639
+ except Exception:
5640
+ return False
5641
+
5642
+ copied = 0
5643
+
5644
+ def _copy_entry(src: Path, dst: Path) -> None:
5645
+ nonlocal copied
5646
+ if _should_skip(src):
5647
+ return
5648
+ if src.is_dir():
5649
+ dst.mkdir(parents=True, exist_ok=True)
5650
+ for child in src.iterdir():
5651
+ _copy_entry(child, dst / child.name)
5652
+ return
5653
+ if not src.is_file() or not _source_is_not_older(src, dst):
5654
+ return
5655
+ try:
5656
+ if dst.exists() and dst.is_file() and src.read_bytes() == dst.read_bytes():
5657
+ return
5658
+ except Exception:
5659
+ pass
5660
+ dst.parent.mkdir(parents=True, exist_ok=True)
5661
+ shutil.copy2(str(src), str(dst))
5662
+ if src.suffix == ".sh":
5663
+ dst.chmod(0o755)
5664
+ copied += 1
5665
+
5666
+ for backup_root in candidates[:3]:
5667
+ scripts_backup = backup_root / "scripts"
5668
+ try:
5669
+ for item in scripts_backup.iterdir():
5670
+ _copy_entry(item, core_scripts / item.name)
5671
+ except Exception as exc:
5672
+ return False, f"f06-core-scripts-promote-warning:{exc.__class__.__name__}"
5673
+ if copied:
5674
+ return True, f"f06-core-scripts-promoted:{copied}"
5675
+
5676
+ return False, None
5677
+
5678
+
5679
+ def _refresh_active_versioned_runtime_snapshot(dest: Path) -> tuple[bool, str | None]:
5680
+ """Rebuild ``core/current`` from ``core`` after an update.
5681
+
5682
+ Version equality is not enough evidence that the active snapshot contains
5683
+ the same bytes as ``core``: a same-version repair can update ``core/scripts``
5684
+ after ``core/current`` was already activated. Refreshing the snapshot keeps
5685
+ Desktop/CLI clients that resolve through ``core/current`` on the repaired
5686
+ runtime tree.
5687
+ """
5688
+ core_root = dest / "core"
5689
+ if not core_root.is_dir() or not (core_root / "cli.py").is_file():
5690
+ return False, None
5691
+ try:
5692
+ from runtime_versioning import activate_versioned_runtime_snapshot, read_version_for_path
5693
+
5694
+ version = str(read_version_for_path(core_root) or "").strip()
5695
+ if not version:
5696
+ return False, "runtime-snapshot-refresh-skipped:missing-version"
5697
+ result = activate_versioned_runtime_snapshot(source_root=core_root, version=version)
5698
+ except Exception as exc:
5699
+ return False, f"runtime-snapshot-refresh-warning:{exc.__class__.__name__}"
5700
+ if not result.get("ok"):
5701
+ return False, f"runtime-snapshot-refresh-warning:{result.get('error', 'unknown')}"
5702
+ return True, f"runtime-snapshot-refreshed:{version}"
5703
+
5704
+
5593
5705
  # Whitelist of post-install hooks to invoke from the fresh tree. Each entry
5594
5706
  # is the function name inside ``auto_update.py`` of the freshly-copied
5595
5707
  # code. The subprocess resolves them on the NEW module and calls
5596
5708
  # ``fn(dest)`` returning ``(bool, str | None)``. New hooks added in
5597
5709
  # future releases only need an entry here — no extra wiring.
5598
5710
  _POST_INSTALL_FRESH_HOOKS = (
5711
+ ("f06-core-scripts-promoted", "_promote_f06_core_scripts_from_latest_legacy_conflict"),
5712
+ ("runtime-snapshot-refreshed", "_refresh_active_versioned_runtime_snapshot"),
5599
5713
  ("guardian-hard-persisted", "_persist_guardian_hard_defaults"),
5600
5714
  ("adaptive-weights-promoted", "_maybe_promote_adaptive_weights_empirically"),
5601
5715
  )