meshcode 2.5.4__tar.gz → 2.5.6__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.5.4 → meshcode-2.5.6}/PKG-INFO +1 -1
  2. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/__init__.py +1 -1
  3. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/backend.py +13 -5
  4. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/server.py +39 -6
  5. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/PKG-INFO +1 -1
  6. {meshcode-2.5.4 → meshcode-2.5.6}/pyproject.toml +1 -1
  7. {meshcode-2.5.4 → meshcode-2.5.6}/README.md +0 -0
  8. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/cli.py +0 -0
  9. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/comms_v4.py +0 -0
  10. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/invites.py +0 -0
  11. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/launcher.py +0 -0
  12. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/launcher_install.py +0 -0
  13. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/__init__.py +0 -0
  14. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/__main__.py +0 -0
  15. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/realtime.py +0 -0
  16. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/test_backend.py +0 -0
  17. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  18. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  19. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/preferences.py +0 -0
  20. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/protocol_v2.py +0 -0
  21. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/run_agent.py +0 -0
  22. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/secrets.py +0 -0
  23. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/self_update.py +0 -0
  24. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode/setup_clients.py +0 -0
  25. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/SOURCES.txt +0 -0
  26. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/dependency_links.txt +0 -0
  27. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/entry_points.txt +0 -0
  28. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/requires.txt +0 -0
  29. {meshcode-2.5.4 → meshcode-2.5.6}/meshcode.egg-info/top_level.txt +0 -0
  30. {meshcode-2.5.4 → meshcode-2.5.6}/setup.cfg +0 -0
  31. {meshcode-2.5.4 → meshcode-2.5.6}/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.5.4
3
+ Version: 2.5.6
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.5.4"
2
+ __version__ = "2.5.6"
@@ -269,12 +269,18 @@ def send_message(project_id: str, from_agent: str, to_agent: str, payload: Any,
269
269
  if actual_encrypted:
270
270
  out["encrypted"] = True
271
271
  return out
272
- # If RPC returned an auth/validation error, propagate it
273
- if isinstance(result, dict) and result.get("error") and result.get("error_code"):
272
+ # If RPC returned an error, propagate it — do NOT fall through to
273
+ # direct insert (RLS blocks anon INSERT since migration 089).
274
+ if isinstance(result, dict) and result.get("error"):
274
275
  return {"error": result["error"]}
275
- # If RPC doesn't exist yet (migration not applied), fall through to direct insert
276
+ # RPC returned unexpected shape but didn't error treat as success
277
+ if result is not None:
278
+ return {"sent": True}
276
279
 
277
- # Fallback: direct insert (tests / legacy)
280
+ # Fallback: direct insert — ONLY for tests or legacy (no api_key)
281
+ if api_key:
282
+ # api_key was provided but RPC path didn't return — should not happen
283
+ return {"error": "mc_send_message RPC unavailable and direct insert blocked by RLS"}
278
284
  msg = {
279
285
  "project_id": project_id,
280
286
  "from_agent": from_agent,
@@ -326,7 +332,9 @@ def read_inbox(project_id: str, agent: str, mark_read: bool = True, api_key: Opt
326
332
  # If RPC succeeded, skip direct update
327
333
  if isinstance(result, dict) and result.get("ok"):
328
334
  marked = True
329
- if not marked:
335
+ if not marked and not api_key:
336
+ # Only attempt direct update when no api_key (tests/legacy).
337
+ # With api_key, RLS blocks anon UPDATE since migration 089.
330
338
  sb_update("mc_messages", f"id=eq.{m['id']}", {"read": True})
331
339
 
332
340
  # Auto-ACK senders — but ONLY for messages older than 60s. If the
@@ -747,9 +747,10 @@ RULES:
747
747
  SESSION START (do these IMMEDIATELY — don't wait for user input):
748
748
  1. meshcode_set_status(status="online", task="ready")
749
749
  2. meshcode_check() — read pending messages
750
- 3. meshcode_status() — see who's online
751
- 4. If other agents are online → meshcode_send them a greeting
752
- 5. meshcode_wait() enter the loop
750
+ 3. meshcode_tasks() — check for assigned/pending tasks and claim any unclaimed ones
751
+ 4. meshcode_status() see who's online
752
+ 5. If other agents are online → meshcode_send them a greeting
753
+ 6. meshcode_wait() — enter the loop
753
754
 
754
755
  CRITICAL: You communicate by CALLING TOOLS, not by thinking or writing text.
755
756
  To talk to another agent → call meshcode_send(to="agent", message="...")
@@ -1393,8 +1394,14 @@ def meshcode_done(reason: str) -> Dict[str, Any]:
1393
1394
 
1394
1395
  @mcp.tool()
1395
1396
  @with_working_status
1396
- def meshcode_check(include_acks: bool = False) -> Dict[str, Any]:
1397
- """Peek at inbox (non-destructive). Returns pending count + new messages."""
1397
+ def meshcode_check(include_acks: bool = False, since: Optional[str] = None) -> Dict[str, Any]:
1398
+ """Peek at inbox (non-destructive). Returns pending count + new messages.
1399
+
1400
+ Args:
1401
+ include_acks: Include ack messages in response.
1402
+ since: ISO-8601 timestamp. Only return messages newer than this.
1403
+ Use meshcode_remember("last_seen", ts) to persist across sessions.
1404
+ """
1398
1405
  pending = be.count_pending(_PROJECT_ID, AGENT_NAME)
1399
1406
  # Peek at realtime buffer WITHOUT draining — check is non-destructive
1400
1407
  realtime_buffered = _REALTIME.peek() if _REALTIME else []
@@ -1420,11 +1427,15 @@ def meshcode_check(include_acks: bool = False) -> Dict[str, Any]:
1420
1427
  if _seen_key({"id": m.get("id"), "from": m.get("from_agent"), "payload": m.get("payload", {}), "ts": m.get("created_at")}) not in _SEEN_MSG_IDS
1421
1428
  ]
1422
1429
 
1430
+ # Filter by `since` timestamp if provided
1431
+ if since:
1432
+ deduped = [m for m in deduped if m.get("ts") and str(m["ts"]) > since]
1433
+
1423
1434
  split = _split_messages(deduped)
1424
1435
  if not include_acks:
1425
1436
  split["acks"] = []
1426
1437
  return {
1427
- "pending": pending,
1438
+ "pending": pending if not since else len(split.get("messages", [])),
1428
1439
  "agent": AGENT_NAME,
1429
1440
  "project": PROJECT_NAME,
1430
1441
  "realtime_connected": _REALTIME.is_connected if _REALTIME else False,
@@ -1960,8 +1971,30 @@ def history_resource() -> str:
1960
1971
  # Entry point
1961
1972
  # ============================================================
1962
1973
 
1974
+ def _auto_update() -> None:
1975
+ """Silently upgrade meshcode from PyPI in background on every launch."""
1976
+ import threading
1977
+
1978
+ def _upgrade():
1979
+ try:
1980
+ import subprocess
1981
+ result = subprocess.run(
1982
+ [sys.executable, "-m", "pip", "install", "--upgrade", "--quiet", "meshcode"],
1983
+ capture_output=True, text=True, timeout=30,
1984
+ )
1985
+ if result.returncode == 0 and "Successfully installed" in result.stdout + result.stderr:
1986
+ log.info("[meshcode] Auto-updated to latest version from PyPI")
1987
+ else:
1988
+ log.debug("[meshcode] Already at latest version")
1989
+ except Exception as e:
1990
+ log.debug(f"[meshcode] Auto-update failed (non-fatal): {e}")
1991
+
1992
+ threading.Thread(target=_upgrade, daemon=True).start()
1993
+
1994
+
1963
1995
  def run_server():
1964
1996
  """Start the MCP server on stdio (default for Claude Code)."""
1997
+ _auto_update()
1965
1998
  print(
1966
1999
  f"[meshcode-mcp] Starting server for {AGENT_NAME}@{PROJECT_NAME}",
1967
2000
  file=sys.stderr,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.5.4
3
+ Version: 2.5.6
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.5.4"
7
+ version = "2.5.6"
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