meshcode 2.6.1__tar.gz → 2.6.3__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.6.1 → meshcode-2.6.3}/PKG-INFO +1 -1
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/__init__.py +1 -1
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/server.py +73 -20
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/PKG-INFO +1 -1
- {meshcode-2.6.1 → meshcode-2.6.3}/pyproject.toml +1 -1
- {meshcode-2.6.1 → meshcode-2.6.3}/README.md +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/cli.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/comms_v4.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/invites.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/launcher.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/launcher_install.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/__init__.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/__main__.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/backend.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/realtime.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_backend.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_realtime.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/preferences.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/protocol_v2.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/run_agent.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/secrets.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/self_update.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/setup_clients.py +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/SOURCES.txt +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/dependency_links.txt +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/entry_points.txt +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/requires.txt +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/top_level.txt +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/setup.cfg +0 -0
- {meshcode-2.6.1 → meshcode-2.6.3}/tests/test_status_enum_coverage.py +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"""MeshCode — Real-time communication between AI agents."""
|
|
2
|
-
__version__ = "2.6.
|
|
2
|
+
__version__ = "2.6.3"
|
|
@@ -1339,8 +1339,9 @@ async def meshcode_wait(timeout_seconds: int = 120, include_acks: bool = False)
|
|
|
1339
1339
|
try:
|
|
1340
1340
|
db_pending = be.count_pending(_PROJECT_ID, AGENT_NAME)
|
|
1341
1341
|
if db_pending and db_pending > 0:
|
|
1342
|
-
# Fetch and return the messages
|
|
1343
|
-
|
|
1342
|
+
# Fetch and return the messages — mark_read=True so the next
|
|
1343
|
+
# meshcode_wait() won't re-refuse with the same messages.
|
|
1344
|
+
raw = be.read_inbox(_PROJECT_ID, AGENT_NAME, mark_read=True, api_key=_get_api_key())
|
|
1344
1345
|
msgs = [
|
|
1345
1346
|
{"from": m["from_agent"], "type": m.get("type", "msg"),
|
|
1346
1347
|
"ts": m.get("created_at"), "payload": m.get("payload", {}),
|
|
@@ -2182,32 +2183,84 @@ def history_resource() -> str:
|
|
|
2182
2183
|
# ============================================================
|
|
2183
2184
|
|
|
2184
2185
|
def _auto_update() -> None:
|
|
2185
|
-
"""
|
|
2186
|
+
"""Blocking self-update: check PyPI, install if newer, re-exec.
|
|
2186
2187
|
|
|
2187
|
-
Ensures
|
|
2188
|
-
|
|
2188
|
+
Ensures every agent launch always runs the latest meshcode version.
|
|
2189
|
+
The update is blocking (with short timeouts) so the new code is loaded
|
|
2190
|
+
before the MCP server starts — no "two-launch" delay.
|
|
2191
|
+
|
|
2192
|
+
Disable with MESHCODE_AUTO_UPDATE=0 if needed.
|
|
2193
|
+
Re-exec guard: MESHCODE_UPDATED=1 prevents infinite restart loops.
|
|
2189
2194
|
"""
|
|
2190
2195
|
if os.environ.get("MESHCODE_AUTO_UPDATE", "1").lower() in ("0", "false", "no"):
|
|
2191
2196
|
log.debug("[meshcode] Auto-update disabled (MESHCODE_AUTO_UPDATE=0)")
|
|
2192
2197
|
return
|
|
2198
|
+
if os.environ.get("MESHCODE_UPDATED") == "1":
|
|
2199
|
+
return
|
|
2193
2200
|
|
|
2194
|
-
import
|
|
2201
|
+
import subprocess
|
|
2202
|
+
import urllib.request
|
|
2195
2203
|
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2204
|
+
# 1. Fetch latest version from PyPI (fast, 3s timeout)
|
|
2205
|
+
current = "0.0.0"
|
|
2206
|
+
try:
|
|
2207
|
+
from meshcode import __version__
|
|
2208
|
+
current = __version__
|
|
2209
|
+
except Exception:
|
|
2210
|
+
pass
|
|
2211
|
+
|
|
2212
|
+
latest = None
|
|
2213
|
+
try:
|
|
2214
|
+
req = urllib.request.Request(
|
|
2215
|
+
f"https://pypi.org/pypi/meshcode/json",
|
|
2216
|
+
headers={"User-Agent": f"meshcode/{current}"},
|
|
2217
|
+
)
|
|
2218
|
+
with urllib.request.urlopen(req, timeout=3) as resp:
|
|
2219
|
+
data = json.loads(resp.read().decode("utf-8"))
|
|
2220
|
+
latest = data.get("info", {}).get("version")
|
|
2221
|
+
except Exception:
|
|
2222
|
+
log.debug("[meshcode] Auto-update: PyPI check failed (offline?), skipping")
|
|
2223
|
+
return
|
|
2224
|
+
|
|
2225
|
+
if not latest:
|
|
2226
|
+
return
|
|
2227
|
+
|
|
2228
|
+
# 2. Compare versions
|
|
2229
|
+
def _ver(v: str):
|
|
2230
|
+
return tuple(int(x) for x in v.split(".") if x.isdigit())
|
|
2231
|
+
|
|
2232
|
+
try:
|
|
2233
|
+
if _ver(latest) <= _ver(current):
|
|
2234
|
+
log.debug(f"[meshcode] Already at latest version ({current})")
|
|
2235
|
+
return
|
|
2236
|
+
except Exception:
|
|
2237
|
+
return
|
|
2238
|
+
|
|
2239
|
+
# 3. Install the new version (blocking, 60s timeout)
|
|
2240
|
+
print(f"[meshcode] Updating {current} → {latest}...", file=sys.stderr)
|
|
2241
|
+
try:
|
|
2242
|
+
result = subprocess.run(
|
|
2243
|
+
[sys.executable, "-m", "pip", "install", "--upgrade",
|
|
2244
|
+
"--disable-pip-version-check", "--quiet", "meshcode"],
|
|
2245
|
+
capture_output=True, text=True, timeout=60,
|
|
2246
|
+
)
|
|
2247
|
+
if result.returncode != 0:
|
|
2248
|
+
log.debug(f"[meshcode] pip upgrade failed: {result.stderr}")
|
|
2249
|
+
return
|
|
2250
|
+
except subprocess.TimeoutExpired:
|
|
2251
|
+
log.debug("[meshcode] pip upgrade timed out (60s), skipping")
|
|
2252
|
+
return
|
|
2253
|
+
except Exception as e:
|
|
2254
|
+
log.debug(f"[meshcode] Auto-update failed: {e}")
|
|
2255
|
+
return
|
|
2209
2256
|
|
|
2210
|
-
|
|
2257
|
+
# 4. Re-exec to load the new code
|
|
2258
|
+
print(f"[meshcode] Updated to {latest}, restarting...", file=sys.stderr)
|
|
2259
|
+
os.environ["MESHCODE_UPDATED"] = "1"
|
|
2260
|
+
try:
|
|
2261
|
+
os.execv(sys.executable, [sys.executable] + sys.argv)
|
|
2262
|
+
except Exception as e:
|
|
2263
|
+
log.debug(f"[meshcode] Re-exec failed: {e}, continuing with old version")
|
|
2211
2264
|
|
|
2212
2265
|
|
|
2213
2266
|
def run_server():
|
|
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
|
|
File without changes
|