loki-mode 5.46.0 → 5.48.0

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v5.46.0
5
+ **Version:** v5.48.0
6
6
 
7
7
  ---
8
8
 
package/mcp/__init__.py CHANGED
@@ -21,4 +21,4 @@ try:
21
21
  except ImportError:
22
22
  __all__ = ['mcp']
23
23
 
24
- __version__ = '5.46.0'
24
+ __version__ = '5.48.0'
@@ -819,6 +819,7 @@ class EmbeddingEngine:
819
819
 
820
820
  # Cache
821
821
  self._cache: Dict[str, np.ndarray] = {}
822
+ self._max_cache_size = 10000
822
823
  self._quality_cache: Dict[str, EmbeddingQuality] = {}
823
824
 
824
825
  # Metrics
@@ -1008,6 +1009,10 @@ class EmbeddingEngine:
1008
1009
 
1009
1010
  # Cache result
1010
1011
  if self.config.cache_enabled:
1012
+ if len(self._cache) >= self._max_cache_size:
1013
+ # Remove oldest entry (first key in dict - insertion order in Python 3.7+)
1014
+ oldest_key = next(iter(self._cache))
1015
+ del self._cache[oldest_key]
1011
1016
  self._cache[cache_key] = embedding
1012
1017
 
1013
1018
  # Track latency
package/memory/engine.py CHANGED
@@ -820,7 +820,8 @@ class MemoryEngine:
820
820
  })
821
821
 
822
822
  index["last_updated"] = datetime.now(timezone.utc).isoformat()
823
- index["total_memories"] = index.get("total_memories", 0) + 1
823
+ if not topic_found:
824
+ index["total_memories"] = index.get("total_memories", 0) + 1
824
825
 
825
826
  self.storage.write_json("index.json", index)
826
827
 
@@ -912,6 +912,7 @@ class MemoryRetrieval:
912
912
 
913
913
  for collection, items in results_by_collection.items():
914
914
  for item in items:
915
+ item = dict(item) # shallow copy to avoid mutating original
915
916
  # Ensure source is set
916
917
  if "_source" not in item:
917
918
  item["_source"] = collection
@@ -568,13 +568,24 @@ class TokenEconomics:
568
568
 
569
569
  Writes to {base_path}/token_economics.json
570
570
  """
571
+ import tempfile
572
+
571
573
  file_path = Path(self.base_path) / "token_economics.json"
572
574
  file_path.parent.mkdir(parents=True, exist_ok=True)
573
575
 
574
576
  data = self.get_summary()
575
577
 
576
- with open(file_path, "w", encoding="utf-8") as f:
577
- json.dump(data, f, indent=2)
578
+ tmp_fd, tmp_path = tempfile.mkstemp(dir=str(file_path.parent), suffix='.tmp')
579
+ try:
580
+ with os.fdopen(tmp_fd, 'w', encoding='utf-8') as f:
581
+ json.dump(data, f, indent=2)
582
+ os.replace(tmp_path, str(file_path))
583
+ except Exception:
584
+ try:
585
+ os.unlink(tmp_path)
586
+ except OSError:
587
+ pass
588
+ raise
578
589
 
579
590
  def load(self) -> None:
580
591
  """
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "5.46.0",
3
+ "version": "5.48.0",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "autonomi",
@@ -51,7 +51,7 @@
51
51
  "postinstall": "node bin/postinstall.js",
52
52
  "prepack": "find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; find . -name '*.pyc' -delete 2>/dev/null; true",
53
53
  "prepublishOnly": "cd dashboard-ui && npm ci && npm run build:all",
54
- "test": "bash -n autonomy/run.sh && bash -n autonomy/loki && bash -n autonomy/completion-council.sh && echo 'All syntax checks passed'",
54
+ "test": "bash -n autonomy/run.sh && bash -n autonomy/loki && bash -n autonomy/completion-council.sh && bash -n autonomy/app-runner.sh && bash -n autonomy/prd-checklist.sh && bash -n autonomy/playwright-verify.sh && echo 'All syntax checks passed'",
55
55
  "test:visual": "node --experimental-vm-modules node_modules/jest/bin/jest.js dashboard-ui/tests/visual-regression.test.js",
56
56
  "test:parity": "node --experimental-vm-modules dashboard-ui/scripts/check-parity.js",
57
57
  "test:parity:json": "node --experimental-vm-modules dashboard-ui/scripts/check-parity.js --json",