mesh-context-layer 0.4.0__tar.gz → 0.4.2__tar.gz

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.
Files changed (33) hide show
  1. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/PKG-INFO +1 -1
  2. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/cli.py +57 -2
  3. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/memory.py +3 -2
  4. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/store.py +1 -1
  5. mesh_context_layer-0.4.2/mesh/version.py +38 -0
  6. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/pyproject.toml +3 -1
  7. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/.github/workflows/test.yml +0 -0
  8. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/.gitignore +0 -0
  9. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/ARCHITECTURE.md +0 -0
  10. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/DEVELOPER_GUIDE.md +0 -0
  11. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/LICENSE +0 -0
  12. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/MANIFEST.in +0 -0
  13. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/README.md +0 -0
  14. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/examples/basic_usage.py +0 -0
  15. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/examples/two_agents_demo.py +0 -0
  16. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/examples/v02_demo.py +0 -0
  17. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/__init__.py +0 -0
  18. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/audit.py +0 -0
  19. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/context_builder.py +0 -0
  20. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/dashboard.py +0 -0
  21. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/digest.py +0 -0
  22. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/http_server.py +0 -0
  23. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/io.py +0 -0
  24. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/mcp_server.py +0 -0
  25. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/namespaces.py +0 -0
  26. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/mesh/passive.py +0 -0
  27. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/pytest.ini +0 -0
  28. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/test_out.txt +0 -0
  29. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/test_out_utf8.txt +0 -0
  30. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/tests/__init__.py +0 -0
  31. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/tests/test_memory.py +0 -0
  32. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/tests/test_v03.py +0 -0
  33. {mesh_context_layer-0.4.0 → mesh_context_layer-0.4.2}/tests/test_v04.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mesh-context-layer
3
- Version: 0.4.0
3
+ Version: 0.4.2
4
4
  Summary: Shared memory layer for AI agents — MCP server and Python library
5
5
  Project-URL: Homepage, https://github.com/billighost/mesh
6
6
  Project-URL: Repository, https://github.com/billighost/mesh
@@ -5,6 +5,7 @@ mesh/cli.py — Command-line interface for Mesh.
5
5
  import sys
6
6
  import json
7
7
  import argparse
8
+ from .version import VERSION, check_for_updates
8
9
 
9
10
 
10
11
  def export_cmd():
@@ -222,8 +223,7 @@ def ask_cmd():
222
223
 
223
224
  results = mesh.recall(
224
225
  query=args.query,
225
- count=args.count,
226
- memory_type=args.memory_type,
226
+ n=args.count,
227
227
  min_confidence=args.min_confidence
228
228
  )
229
229
 
@@ -284,6 +284,7 @@ def why_cmd():
284
284
 
285
285
  def status_cmd():
286
286
  """Entry point for: mesh-status"""
287
+ check_for_updates()
287
288
  import argparse
288
289
  parser = argparse.ArgumentParser(description="Show Mesh status overview.")
289
290
  parser.add_argument("--namespace", default=None)
@@ -319,3 +320,57 @@ def status_cmd():
319
320
  others = [n["namespace"] for n in all_ns if n["namespace"] != ns]
320
321
  print(f" Other namespaces: {', '.join(others)}")
321
322
  print()
323
+
324
+
325
+ def help_cmd():
326
+ """Entry point for: mesh-help"""
327
+ check_for_updates()
328
+ print(f"Mesh Collective Memory (v{VERSION})")
329
+ print("Usage: mesh <command> [options]\n")
330
+ print("Available Commands:")
331
+ print(" mesh-add Store a memory manually")
332
+ print(" mesh-ask Search for memories by topic or question")
333
+ print(" mesh-status Overview of namespaces and memory counts")
334
+ print(" mesh-why Show recent audit trail (who read/wrote what)")
335
+ print(" mesh-context Output memories as system prompt (for AI tools)")
336
+ print(" mesh-server Start the MCP server (for Claude/Cursor)")
337
+ print(" mesh-dashboard Open the web-based visualizer")
338
+ print(" mesh-http Start the REST API server")
339
+ print(" mesh-namespaces List, rename, or delete namespaces")
340
+ print(" mesh-export Export memories to JSON")
341
+ print(" mesh-import Import memories from JSON")
342
+ print(" mesh-capture Extract memories from past AI logs")
343
+ print(" mesh-digest Generate high-level summaries of activity")
344
+ print("\nFor help with a specific command, run: <command> --help")
345
+ print("Example: mesh-add --help")
346
+
347
+
348
+ def main():
349
+ """Unified 'mesh' command that routes to others."""
350
+ if len(sys.argv) < 2:
351
+ help_cmd()
352
+ return
353
+
354
+ cmd = sys.argv[1]
355
+
356
+ # Map 'mesh <subcommand>' to the corresponding function
357
+ mapping = {
358
+ "add": add_cmd,
359
+ "ask": ask_cmd,
360
+ "status": status_cmd,
361
+ "why": why_cmd,
362
+ "context": context_cmd,
363
+ "help": help_cmd,
364
+ "export": export_cmd,
365
+ "import": import_cmd,
366
+ "namespaces": namespaces_cmd,
367
+ }
368
+
369
+ if cmd in mapping:
370
+ # Rebuild sys.argv to look like the subcommand was called directly
371
+ sys.argv = [f"mesh-{cmd}"] + sys.argv[2:]
372
+ mapping[cmd]()
373
+ else:
374
+ print(f"Unknown command: '{cmd}'")
375
+ print("Type 'mesh-help' or 'mesh help' to see available commands.")
376
+ sys.exit(1)
@@ -4,7 +4,7 @@ import uuid
4
4
  from datetime import datetime, timedelta
5
5
  from typing import Optional
6
6
 
7
- from sentence_transformers import SentenceTransformer
7
+
8
8
 
9
9
  from .store import MeshStore
10
10
 
@@ -18,9 +18,10 @@ CONTRADICTION_THRESHOLD = 0.82
18
18
  STALE_THRESHOLD = 0.3
19
19
 
20
20
 
21
- def _get_model() -> SentenceTransformer:
21
+ def _get_model() -> "SentenceTransformer":
22
22
  global _model
23
23
  if _model is None:
24
+ from sentence_transformers import SentenceTransformer
24
25
  _model = SentenceTransformer(_MODEL_NAME)
25
26
  return _model
26
27
 
@@ -1,4 +1,3 @@
1
- import chromadb
2
1
  import sqlite3
3
2
  import json
4
3
  from pathlib import Path
@@ -24,6 +23,7 @@ class MeshStore:
24
23
  self.namespace = namespace
25
24
  MESH_DIR.mkdir(parents=True, exist_ok=True)
26
25
 
26
+ import chromadb
27
27
  self.chroma_client = chromadb.PersistentClient(
28
28
  path=str(MESH_DIR / "chroma")
29
29
  )
@@ -0,0 +1,38 @@
1
+ import threading
2
+
3
+ VERSION = "0.4.2"
4
+ PACKAGE_NAME = "mesh-context-layer"
5
+
6
+ def get_latest_version():
7
+ """Check PyPI for the latest version of the package."""
8
+ try:
9
+ import httpx
10
+ url = f"https://pypi.org/pypi/{PACKAGE_NAME}/json"
11
+ response = httpx.get(url, timeout=1.5)
12
+ if response.status_code == 200:
13
+ return response.json()["info"]["version"]
14
+ except Exception:
15
+ pass
16
+ return None
17
+
18
+ def _run_check():
19
+ latest = get_latest_version()
20
+ if not latest:
21
+ return
22
+
23
+ # Simple semver compare (only notify if latest > VERSION)
24
+ try:
25
+ l_parts = [int(p) for p in latest.split(".")]
26
+ v_parts = [int(p) for p in VERSION.split(".")]
27
+ if l_parts > v_parts:
28
+ print(f"\n📢 A new version of Mesh is available: {latest} (you have {VERSION})")
29
+ print(f" Run 'pip install --upgrade {PACKAGE_NAME}' to update.\n")
30
+ except (ValueError, IndexError):
31
+ # Fallback to string compare if semver fails
32
+ if latest != VERSION:
33
+ print(f"\n📢 Version {latest} is available on PyPI (you have {VERSION})\n")
34
+
35
+ def check_for_updates():
36
+ """Check for updates in a background thread to avoid blocking CLI startup."""
37
+ thread = threading.Thread(target=_run_check, daemon=True)
38
+ thread.start()
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "mesh-context-layer"
7
- version = "0.4.0"
7
+ version = "0.4.2"
8
8
  description = "Shared memory layer for AI agents — MCP server and Python library"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -42,6 +42,8 @@ dev = [
42
42
  ]
43
43
 
44
44
  [project.scripts]
45
+ mesh = "mesh.cli:main"
46
+ mesh-help = "mesh.cli:help_cmd"
45
47
  mesh-server = "mesh.mcp_server:run"
46
48
  mesh-dashboard = "mesh.dashboard:run"
47
49
  mesh-export = "mesh.cli:export_cmd"