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.
Files changed (31) hide show
  1. {meshcode-2.6.1 → meshcode-2.6.3}/PKG-INFO +1 -1
  2. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/__init__.py +1 -1
  3. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/server.py +73 -20
  4. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/PKG-INFO +1 -1
  5. {meshcode-2.6.1 → meshcode-2.6.3}/pyproject.toml +1 -1
  6. {meshcode-2.6.1 → meshcode-2.6.3}/README.md +0 -0
  7. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/cli.py +0 -0
  8. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/comms_v4.py +0 -0
  9. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/invites.py +0 -0
  10. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/launcher.py +0 -0
  11. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/launcher_install.py +0 -0
  12. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/__init__.py +0 -0
  13. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/__main__.py +0 -0
  14. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/backend.py +0 -0
  15. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/realtime.py +0 -0
  16. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_backend.py +0 -0
  17. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  18. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  19. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/preferences.py +0 -0
  20. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/protocol_v2.py +0 -0
  21. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/run_agent.py +0 -0
  22. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/secrets.py +0 -0
  23. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/self_update.py +0 -0
  24. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode/setup_clients.py +0 -0
  25. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/SOURCES.txt +0 -0
  26. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/dependency_links.txt +0 -0
  27. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/entry_points.txt +0 -0
  28. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/requires.txt +0 -0
  29. {meshcode-2.6.1 → meshcode-2.6.3}/meshcode.egg-info/top_level.txt +0 -0
  30. {meshcode-2.6.1 → meshcode-2.6.3}/setup.cfg +0 -0
  31. {meshcode-2.6.1 → meshcode-2.6.3}/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.1
3
+ Version: 2.6.3
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.1"
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 instead of waiting
1343
- raw = be.read_inbox(_PROJECT_ID, AGENT_NAME, mark_read=False, api_key=_get_api_key())
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
- """Silently upgrade meshcode from PyPI in background on every launch.
2186
+ """Blocking self-update: check PyPI, install if newer, re-exec.
2186
2187
 
2187
- Ensures all agents always run the latest version. Disable with
2188
- MESHCODE_AUTO_UPDATE=0 if needed.
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 threading
2201
+ import subprocess
2202
+ import urllib.request
2195
2203
 
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}")
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
- threading.Thread(target=_upgrade, daemon=True).start()
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():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.6.1
3
+ Version: 2.6.3
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.1"
7
+ version = "2.6.3"
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