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.
- {meshcode-2.4.6 → meshcode-2.4.8}/PKG-INFO +1 -1
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/__init__.py +1 -1
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/server.py +82 -12
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/PKG-INFO +1 -1
- {meshcode-2.4.6 → meshcode-2.4.8}/pyproject.toml +1 -1
- {meshcode-2.4.6 → meshcode-2.4.8}/README.md +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/cli.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/comms_v4.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/invites.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/launcher.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/launcher_install.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/__init__.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/__main__.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/backend.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/realtime.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_backend.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_realtime.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/preferences.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/protocol_v2.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/run_agent.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/secrets.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/self_update.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode/setup_clients.py +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/SOURCES.txt +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/dependency_links.txt +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/entry_points.txt +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/requires.txt +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/meshcode.egg-info/top_level.txt +0 -0
- {meshcode-2.4.6 → meshcode-2.4.8}/setup.cfg +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""MeshCode — Real-time communication between AI agents."""
|
|
2
|
-
__version__ = "2.4.
|
|
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 (
|
|
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
|
-
|
|
700
|
-
|
|
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
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
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 =
|
|
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=
|
|
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()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|