meshcode 2.6.0__tar.gz → 2.6.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 (31) hide show
  1. {meshcode-2.6.0 → meshcode-2.6.2}/PKG-INFO +1 -1
  2. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/__init__.py +1 -1
  3. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/server.py +72 -20
  4. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/PKG-INFO +1 -1
  5. {meshcode-2.6.0 → meshcode-2.6.2}/pyproject.toml +1 -1
  6. {meshcode-2.6.0 → meshcode-2.6.2}/README.md +0 -0
  7. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/cli.py +0 -0
  8. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/comms_v4.py +0 -0
  9. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/invites.py +0 -0
  10. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/launcher.py +0 -0
  11. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/launcher_install.py +0 -0
  12. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/__init__.py +0 -0
  13. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/__main__.py +0 -0
  14. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/backend.py +0 -0
  15. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/realtime.py +0 -0
  16. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/test_backend.py +0 -0
  17. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  18. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  19. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/preferences.py +0 -0
  20. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/protocol_v2.py +0 -0
  21. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/run_agent.py +0 -0
  22. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/secrets.py +0 -0
  23. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/self_update.py +0 -0
  24. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode/setup_clients.py +0 -0
  25. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/SOURCES.txt +0 -0
  26. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/dependency_links.txt +0 -0
  27. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/entry_points.txt +0 -0
  28. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/requires.txt +0 -0
  29. {meshcode-2.6.0 → meshcode-2.6.2}/meshcode.egg-info/top_level.txt +0 -0
  30. {meshcode-2.6.0 → meshcode-2.6.2}/setup.cfg +0 -0
  31. {meshcode-2.6.0 → meshcode-2.6.2}/tests/test_status_enum_coverage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.6.0
3
+ Version: 2.6.2
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.6.0"
2
+ __version__ = "2.6.2"
@@ -2182,32 +2182,84 @@ def history_resource() -> str:
2182
2182
  # ============================================================
2183
2183
 
2184
2184
  def _auto_update() -> None:
2185
- """Upgrade meshcode from PyPI in background opt-in via MESHCODE_AUTO_UPDATE=1.
2185
+ """Blocking self-update: check PyPI, install if newer, re-exec.
2186
2186
 
2187
- Disabled by default to mitigate supply chain risk: if the PyPI account
2188
- is compromised, every agent would silently install malicious code.
2187
+ Ensures every agent launch always runs the latest meshcode version.
2188
+ The update is blocking (with short timeouts) so the new code is loaded
2189
+ before the MCP server starts — no "two-launch" delay.
2190
+
2191
+ Disable with MESHCODE_AUTO_UPDATE=0 if needed.
2192
+ Re-exec guard: MESHCODE_UPDATED=1 prevents infinite restart loops.
2189
2193
  """
2190
- if os.environ.get("MESHCODE_AUTO_UPDATE", "0") != "1":
2191
- log.debug("[meshcode] Auto-update disabled (set MESHCODE_AUTO_UPDATE=1 to enable)")
2194
+ if os.environ.get("MESHCODE_AUTO_UPDATE", "1").lower() in ("0", "false", "no"):
2195
+ log.debug("[meshcode] Auto-update disabled (MESHCODE_AUTO_UPDATE=0)")
2196
+ return
2197
+ if os.environ.get("MESHCODE_UPDATED") == "1":
2192
2198
  return
2193
2199
 
2194
- import threading
2200
+ import subprocess
2201
+ import urllib.request
2195
2202
 
2196
- def _upgrade():
2197
- try:
2198
- import subprocess
2199
- result = subprocess.run(
2200
- [sys.executable, "-m", "pip", "install", "--upgrade", "--quiet", "meshcode"],
2201
- capture_output=True, text=True, timeout=30,
2202
- )
2203
- if result.returncode == 0 and "Successfully installed" in result.stdout + result.stderr:
2204
- log.info("[meshcode] Auto-updated to latest version from PyPI")
2205
- else:
2206
- log.debug("[meshcode] Already at latest version")
2207
- except Exception as e:
2208
- log.debug(f"[meshcode] Auto-update failed (non-fatal): {e}")
2203
+ # 1. Fetch latest version from PyPI (fast, 3s timeout)
2204
+ current = "0.0.0"
2205
+ try:
2206
+ from meshcode import __version__
2207
+ current = __version__
2208
+ except Exception:
2209
+ pass
2210
+
2211
+ latest = None
2212
+ try:
2213
+ req = urllib.request.Request(
2214
+ f"https://pypi.org/pypi/meshcode/json",
2215
+ headers={"User-Agent": f"meshcode/{current}"},
2216
+ )
2217
+ with urllib.request.urlopen(req, timeout=3) as resp:
2218
+ data = json.loads(resp.read().decode("utf-8"))
2219
+ latest = data.get("info", {}).get("version")
2220
+ except Exception:
2221
+ log.debug("[meshcode] Auto-update: PyPI check failed (offline?), skipping")
2222
+ return
2223
+
2224
+ if not latest:
2225
+ return
2226
+
2227
+ # 2. Compare versions
2228
+ def _ver(v: str):
2229
+ return tuple(int(x) for x in v.split(".") if x.isdigit())
2230
+
2231
+ try:
2232
+ if _ver(latest) <= _ver(current):
2233
+ log.debug(f"[meshcode] Already at latest version ({current})")
2234
+ return
2235
+ except Exception:
2236
+ return
2237
+
2238
+ # 3. Install the new version (blocking, 60s timeout)
2239
+ print(f"[meshcode] Updating {current} → {latest}...", file=sys.stderr)
2240
+ try:
2241
+ result = subprocess.run(
2242
+ [sys.executable, "-m", "pip", "install", "--upgrade",
2243
+ "--disable-pip-version-check", "--quiet", "meshcode"],
2244
+ capture_output=True, text=True, timeout=60,
2245
+ )
2246
+ if result.returncode != 0:
2247
+ log.debug(f"[meshcode] pip upgrade failed: {result.stderr}")
2248
+ return
2249
+ except subprocess.TimeoutExpired:
2250
+ log.debug("[meshcode] pip upgrade timed out (60s), skipping")
2251
+ return
2252
+ except Exception as e:
2253
+ log.debug(f"[meshcode] Auto-update failed: {e}")
2254
+ return
2209
2255
 
2210
- threading.Thread(target=_upgrade, daemon=True).start()
2256
+ # 4. Re-exec to load the new code
2257
+ print(f"[meshcode] Updated to {latest}, restarting...", file=sys.stderr)
2258
+ os.environ["MESHCODE_UPDATED"] = "1"
2259
+ try:
2260
+ os.execv(sys.executable, [sys.executable] + sys.argv)
2261
+ except Exception as e:
2262
+ log.debug(f"[meshcode] Re-exec failed: {e}, continuing with old version")
2211
2263
 
2212
2264
 
2213
2265
  def run_server():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.6.0
3
+ Version: 2.6.2
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.6.0"
7
+ version = "2.6.2"
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