meshcode 2.4.6__tar.gz → 2.4.8__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 (30) hide show
  1. {meshcode-2.4.6 → meshcode-2.4.8}/PKG-INFO +1 -1
  2. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/__init__.py +1 -1
  3. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/server.py +82 -12
  4. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/PKG-INFO +1 -1
  5. {meshcode-2.4.6 → meshcode-2.4.8}/pyproject.toml +1 -1
  6. {meshcode-2.4.6 → meshcode-2.4.8}/README.md +0 -0
  7. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/cli.py +0 -0
  8. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/comms_v4.py +0 -0
  9. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/invites.py +0 -0
  10. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/launcher.py +0 -0
  11. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/launcher_install.py +0 -0
  12. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/__init__.py +0 -0
  13. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/__main__.py +0 -0
  14. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/backend.py +0 -0
  15. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/realtime.py +0 -0
  16. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_backend.py +0 -0
  17. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  18. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  19. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/preferences.py +0 -0
  20. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/protocol_v2.py +0 -0
  21. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/run_agent.py +0 -0
  22. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/secrets.py +0 -0
  23. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/self_update.py +0 -0
  24. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/setup_clients.py +0 -0
  25. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/SOURCES.txt +0 -0
  26. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/dependency_links.txt +0 -0
  27. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/entry_points.txt +0 -0
  28. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/requires.txt +0 -0
  29. {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/top_level.txt +0 -0
  30. {meshcode-2.4.6 → meshcode-2.4.8}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.4.6
3
+ Version: 2.4.8
4
4
  Summary: Real-time communication between AI agents — Supabase-backed CLI
5
5
  Author-email: MeshCode <hello@meshcode.io>
6
6
  License: MIT
@@ -1,2 +1,2 @@
1
1
  """MeshCode — Real-time communication between AI agents."""
2
- __version__ = "2.4.6"
2
+ __version__ = "2.4.8"
@@ -694,19 +694,63 @@ COMMANDER PROTOCOL (you are the team lead):
694
694
 
695
695
  _INSTRUCTIONS = _build_instructions()
696
696
 
697
- # Pre-load persistent memories into instructions (saves 1 tool call per session)
697
+ # Pre-load persistent memories into instructions (tiered, ~10x cheaper than legacy
698
+ # load-all). Strategy:
699
+ # - critical: full content always preloaded (cap 10 keys per agent)
700
+ # - reference: key list only (fetch values on demand via meshcode_recall)
701
+ # - episodic: NEVER preloaded — search via meshcode_recall_search instead
702
+ # Falls back to legacy load-all if migration 080 isn't applied yet (overload missing).
698
703
  try:
699
- _memories = be.sb_rpc("mc_memory_list", {
700
- "p_api_key": _get_api_key(),
704
+ _api_key = _get_api_key()
705
+ _crit = be.sb_rpc("mc_memory_list", {
706
+ "p_api_key": _api_key,
707
+ "p_agent_name": AGENT_NAME,
708
+ "p_tier": "critical",
709
+ "p_project_name": PROJECT_NAME,
710
+ })
711
+ _ref = be.sb_rpc("mc_memory_list", {
712
+ "p_api_key": _api_key,
701
713
  "p_agent_name": AGENT_NAME,
714
+ "p_tier": "reference",
702
715
  "p_project_name": PROJECT_NAME,
703
716
  })
704
- if isinstance(_memories, dict) and _memories.get("ok") and _memories.get("memories"):
705
- _mem_lines = []
706
- for m in _memories["memories"]:
707
- _mem_lines.append(f" {m['key']}: {json.dumps(m['value'], default=str)}")
708
- _INSTRUCTIONS += "\nPRE-LOADED MEMORIES:\n" + "\n".join(_mem_lines) + "\n"
709
- log.info(f"pre-loaded {len(_mem_lines)} memories into instructions")
717
+
718
+ _crit_ok = isinstance(_crit, dict) and _crit.get("ok")
719
+ _ref_ok = isinstance(_ref, dict) and _ref.get("ok")
720
+
721
+ if _crit_ok or _ref_ok:
722
+ _sections = []
723
+ if _crit_ok and _crit.get("memories"):
724
+ _crit_lines = [f" {m['key']}: {json.dumps(m['value'], default=str)}"
725
+ for m in _crit["memories"]]
726
+ _sections.append("CRITICAL MEMORIES (always loaded):\n" + "\n".join(_crit_lines))
727
+ if _ref_ok and _ref.get("memories"):
728
+ _ref_keys = [m["key"] for m in _ref["memories"]]
729
+ _sections.append(
730
+ "REFERENCE MEMORIES (key list — fetch on demand via meshcode_recall(key)):\n "
731
+ + ", ".join(_ref_keys)
732
+ )
733
+ _sections.append(
734
+ "EPISODIC MEMORIES: not preloaded. Search via "
735
+ "meshcode_recall_search(query) when you need past incident context."
736
+ )
737
+ _INSTRUCTIONS += "\n" + "\n\n".join(_sections) + "\n"
738
+ log.info(
739
+ f"pre-loaded tiered memories: critical={len(_crit.get('memories', [])) if _crit_ok else 0}, "
740
+ f"reference={len(_ref.get('memories', [])) if _ref_ok else 0}"
741
+ )
742
+ else:
743
+ # Legacy fallback: migration 080 not applied → load all (old behavior)
744
+ _legacy = be.sb_rpc("mc_memory_list", {
745
+ "p_api_key": _api_key,
746
+ "p_agent_name": AGENT_NAME,
747
+ "p_project_name": PROJECT_NAME,
748
+ })
749
+ if isinstance(_legacy, dict) and _legacy.get("ok") and _legacy.get("memories"):
750
+ _mem_lines = [f" {m['key']}: {json.dumps(m['value'], default=str)}"
751
+ for m in _legacy["memories"]]
752
+ _INSTRUCTIONS += "\nPRE-LOADED MEMORIES (legacy):\n" + "\n".join(_mem_lines) + "\n"
753
+ log.info(f"pre-loaded {len(_mem_lines)} memories (legacy fallback)")
710
754
  except Exception as _e:
711
755
  log.debug(f"memory pre-load skipped: {_e}")
712
756
 
@@ -1080,17 +1124,21 @@ def _detect_global_done(messages: List[Dict[str, Any]]) -> Optional[Dict[str, An
1080
1124
 
1081
1125
  @mcp.tool()
1082
1126
  @with_working_status
1083
- async def meshcode_wait(timeout_seconds: int = 60, include_acks: bool = False) -> Dict[str, Any]:
1127
+ async def meshcode_wait(timeout_seconds: int = 120, include_acks: bool = False) -> Dict[str, Any]:
1084
1128
  """Block until a mesh message arrives or timeout. Your idle state.
1085
1129
 
1086
1130
  Args:
1087
- timeout_seconds: Max wait time in seconds (default 120).
1131
+ timeout_seconds: Max wait time in seconds (default 120, hard cap 120).
1088
1132
  """
1089
1133
  global _IN_WAIT
1090
1134
  _IN_WAIT = True
1091
1135
  _set_state("waiting", "listening for messages")
1136
+ # Universal hard cap: even if a caller passes a larger value (e.g. 1800),
1137
+ # clamp to 120s. Forces shorter iteration loops across all users so progress
1138
+ # never hides behind a long wait. Per mesh-commander 2026-04-11.
1139
+ capped_timeout = min(max(1, int(timeout_seconds)), 120)
1092
1140
  try:
1093
- result = await _meshcode_wait_inner(actual_timeout=max(1, int(timeout_seconds)), include_acks=include_acks)
1141
+ result = await _meshcode_wait_inner(actual_timeout=capped_timeout, include_acks=include_acks)
1094
1142
  if result.get("got_message"):
1095
1143
  _set_state("online", "")
1096
1144
  return result
@@ -1646,6 +1694,28 @@ def meshcode_forget(key: str) -> Dict[str, Any]:
1646
1694
  })
1647
1695
 
1648
1696
 
1697
+ @mcp.tool()
1698
+ @with_working_status
1699
+ def meshcode_recall_search(query: str) -> Dict[str, Any]:
1700
+ """Full-text search across episodic memories. Use this when you need
1701
+ past-incident or debug-log context that wasn't preloaded at boot.
1702
+
1703
+ Returns top 10 matches ranked by relevance, with snippets of the
1704
+ stored value. Episodic memories are not preloaded — search them on
1705
+ demand instead of polluting the system prompt.
1706
+
1707
+ Args:
1708
+ query: Plain English search query.
1709
+ """
1710
+ api_key = _get_api_key()
1711
+ return be.sb_rpc("mc_memory_search", {
1712
+ "p_api_key": api_key,
1713
+ "p_agent_name": AGENT_NAME,
1714
+ "p_query": query,
1715
+ "p_project_name": PROJECT_NAME,
1716
+ })
1717
+
1718
+
1649
1719
  # ----------------- RESOURCES -----------------
1650
1720
 
1651
1721
  @mcp.tool()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.4.6
3
+ Version: 2.4.8
4
4
  Summary: Real-time communication between AI agents — Supabase-backed CLI
5
5
  Author-email: MeshCode <hello@meshcode.io>
6
6
  License: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "meshcode"
7
- version = "2.4.6"
7
+ version = "2.4.8"
8
8
  description = "Real-time communication between AI agents — Supabase-backed CLI"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes