meshcode 2.10.18__tar.gz → 2.10.20__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 (32) hide show
  1. {meshcode-2.10.18 → meshcode-2.10.20}/PKG-INFO +1 -1
  2. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/__init__.py +1 -1
  3. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/server.py +17 -40
  4. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/PKG-INFO +1 -1
  5. {meshcode-2.10.18 → meshcode-2.10.20}/pyproject.toml +1 -1
  6. {meshcode-2.10.18 → meshcode-2.10.20}/README.md +0 -0
  7. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/ascii_art.py +0 -0
  8. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/cli.py +0 -0
  9. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/comms_v4.py +0 -0
  10. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/invites.py +0 -0
  11. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/launcher.py +0 -0
  12. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/launcher_install.py +0 -0
  13. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/__init__.py +0 -0
  14. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/__main__.py +0 -0
  15. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/backend.py +0 -0
  16. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/realtime.py +0 -0
  17. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/test_backend.py +0 -0
  18. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  19. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  20. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/preferences.py +0 -0
  21. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/protocol_v2.py +0 -0
  22. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/run_agent.py +0 -0
  23. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/secrets.py +0 -0
  24. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/self_update.py +0 -0
  25. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode/setup_clients.py +0 -0
  26. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/SOURCES.txt +0 -0
  27. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/dependency_links.txt +0 -0
  28. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/entry_points.txt +0 -0
  29. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/requires.txt +0 -0
  30. {meshcode-2.10.18 → meshcode-2.10.20}/meshcode.egg-info/top_level.txt +0 -0
  31. {meshcode-2.10.18 → meshcode-2.10.20}/setup.cfg +0 -0
  32. {meshcode-2.10.18 → meshcode-2.10.20}/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.10.18
3
+ Version: 2.10.20
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.10.18"
2
+ __version__ = "2.10.20"
@@ -8,11 +8,9 @@ Run with:
8
8
  MESHCODE_PROJECT=my-app MESHCODE_AGENT=backend python -m meshcode_mcp serve
9
9
  """
10
10
  import asyncio
11
- import atexit
12
11
  import json
13
12
  import logging
14
13
  import os
15
- import signal
16
14
  import sys
17
15
  import hashlib as _hashlib
18
16
  import traceback as _traceback
@@ -577,8 +575,7 @@ def with_working_status(func):
577
575
  try:
578
576
  return await func(*args, **kwargs)
579
577
  except asyncio.CancelledError:
580
- # User pressed ESC or MCP client cancelled the request.
581
- # Let it propagate cleanly — FastMCP handles cancellation.
578
+ # Let CancelledError propagate FastMCP handles it correctly.
582
579
  raise
583
580
  except Exception as e:
584
581
  if not skip:
@@ -811,22 +808,13 @@ def _log_crash_to_db(reason: str = "unknown", error_detail: str = "") -> None:
811
808
  _mc_log(f" crash logged: {reason}", "warn")
812
809
 
813
810
 
814
- def _on_exit() -> None:
815
- """atexit handler — release lease and log shutdown."""
816
- _log_crash_to_db("process_exit", "atexit handler fired")
817
- _release_lease()
818
811
 
819
-
820
- def _on_signal(signum, frame) -> None:
821
- """Signal handler for SIGTERM/SIGINT clean shutdown."""
822
- sig_name = signal.Signals(signum).name if hasattr(signal, 'Signals') else str(signum)
823
- _log_crash_to_db("signal", f"Received {sig_name}")
824
- _release_lease()
825
- sys.exit(128 + signum)
826
-
827
-
828
- atexit.register(_on_exit)
829
- signal.signal(signal.SIGTERM, _on_signal)
812
+ # NOTE: Do NOT install signal handlers (SIGTERM, SIGINT) or atexit hooks here.
813
+ # FastMCP/anyio manages its own event loop and signal handling. Custom signal
814
+ # handlers override Python's default KeyboardInterrupt, preventing anyio from
815
+ # cancelling tasks cleanly. Network calls inside signal/atexit handlers can
816
+ # deadlock or corrupt the event loop. The lease will be released by the
817
+ # lifespan shutdown handler instead.
830
818
 
831
819
 
832
820
  # ============================================================
@@ -2665,30 +2653,19 @@ def _auto_update() -> None:
2665
2653
  def run_server():
2666
2654
  """Start the MCP server on stdio (default for Claude Code).
2667
2655
 
2668
- Wraps mcp.run() with crash recovery: if the event loop dies for any
2669
- reason, log the crash, release the lease, and exit cleanly instead of
2670
- leaving the agent in a zombie state.
2656
+ IMPORTANT: Do NOT wrap mcp.run() with try/except, signal handlers, or
2657
+ atexit hooks. FastMCP/anyio manages its own event loop lifecycle and
2658
+ signal handling. Any interference (custom SIGINT handler, atexit network
2659
+ calls, catching KeyboardInterrupt) corrupts the event loop and causes
2660
+ the MCP server to crash when Claude Code cancels a tool call (ESC).
2671
2661
  """
2672
2662
  _auto_update()
2673
2663
  print(
2674
2664
  f"[meshcode-mcp] Starting server for {AGENT_NAME}@{PROJECT_NAME}",
2675
2665
  file=sys.stderr,
2676
2666
  )
2677
- try:
2678
- # Restore real stdout for FastMCP's JSON-RPC transport.
2679
- # sys.stdout was redirected to stderr at module load to prevent
2680
- # accidental stdout writes from corrupting the MCP protocol.
2681
- sys.stdout = _REAL_STDOUT
2682
- mcp.run()
2683
- except KeyboardInterrupt:
2684
- _log_crash_to_db("keyboard_interrupt", "User stopped the agent")
2685
- except SystemExit as e:
2686
- _log_crash_to_db("system_exit", f"exit code: {e.code}")
2687
- raise # re-raise so the process exits with the correct code
2688
- except Exception as e:
2689
- import traceback as _tb
2690
- tb_str = _tb.format_exc()
2691
- _log_crash_to_db("unhandled_exception", f"{type(e).__name__}: {e}\n{tb_str}")
2692
- print(f"[meshcode-mcp] FATAL: {e}", file=sys.stderr)
2693
- print(f"[meshcode-mcp] Stack trace logged to mc_agent_crash_logs", file=sys.stderr)
2694
- sys.exit(1)
2667
+ # Restore real stdout for FastMCP's JSON-RPC transport.
2668
+ # sys.stdout was redirected to stderr at module load to prevent
2669
+ # accidental stdout writes from corrupting the MCP protocol.
2670
+ sys.stdout = _REAL_STDOUT
2671
+ mcp.run()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.10.18
3
+ Version: 2.10.20
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.10.18"
7
+ version = "2.10.20"
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