meshcode 2.4.4__tar.gz → 2.4.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 (30) hide show
  1. {meshcode-2.4.4 → meshcode-2.4.6}/PKG-INFO +1 -1
  2. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/__init__.py +1 -1
  3. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/server.py +36 -2
  4. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/PKG-INFO +1 -1
  5. {meshcode-2.4.4 → meshcode-2.4.6}/pyproject.toml +1 -1
  6. {meshcode-2.4.4 → meshcode-2.4.6}/README.md +0 -0
  7. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/cli.py +0 -0
  8. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/comms_v4.py +0 -0
  9. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/invites.py +0 -0
  10. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/launcher.py +0 -0
  11. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/launcher_install.py +0 -0
  12. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/__init__.py +0 -0
  13. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/__main__.py +0 -0
  14. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/backend.py +0 -0
  15. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/realtime.py +0 -0
  16. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/test_backend.py +0 -0
  17. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/test_realtime.py +0 -0
  18. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/meshcode_mcp/test_server_wrapper.py +0 -0
  19. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/preferences.py +0 -0
  20. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/protocol_v2.py +0 -0
  21. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/run_agent.py +0 -0
  22. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/secrets.py +0 -0
  23. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/self_update.py +0 -0
  24. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode/setup_clients.py +0 -0
  25. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/SOURCES.txt +0 -0
  26. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/dependency_links.txt +0 -0
  27. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/entry_points.txt +0 -0
  28. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/requires.txt +0 -0
  29. {meshcode-2.4.4 → meshcode-2.4.6}/meshcode.egg-info/top_level.txt +0 -0
  30. {meshcode-2.4.4 → meshcode-2.4.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.4.4
3
+ Version: 2.4.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.4.4"
2
+ __version__ = "2.4.6"
@@ -37,14 +37,48 @@ _AUTO_WAKE = os.environ.get("MESHCODE_AUTO_WAKE", "1").lower() not in ("0", "fal
37
37
 
38
38
 
39
39
  def _try_auto_wake(from_agent: str, preview: str) -> None:
40
- """Inject a nudge into the terminal if the agent is idle (not in wait).
40
+ """Inject a nudge into the terminal ONLY when agent is truly sleeping.
41
41
 
42
42
  macOS: AppleScript → keystroke into Terminal/iTerm2
43
43
  Windows: PowerShell SendKeys to the console window
44
44
  Linux: xdotool (best-effort)
45
+
46
+ Conditions to fire (ALL must be true):
47
+ - _AUTO_WAKE is enabled
48
+ - from_agent != self (never wake yourself on self-echo)
49
+ - NOT in meshcode_wait (wait loop already handles delivery)
50
+ - _current_state is 'sleeping' (truly idle, not working, not just online)
51
+ - No tool calls in the last 30 seconds (broad idle window)
52
+ - LLM CPU is low (not actively generating)
53
+ Otherwise the keystroke would interrupt the user's typing or
54
+ the LLM mid-thought.
45
55
  """
46
- if _IN_WAIT or not _AUTO_WAKE:
56
+ if not _AUTO_WAKE or _IN_WAIT:
57
+ return
58
+ # Self-echo guard: never wake on a message you sent yourself.
59
+ # Realtime can echo INSERTs back to the sender (or to all subscribers
60
+ # in some routing paths) — without this guard, every meshcode_send by
61
+ # the agent would inject AppleScript into its own terminal mid-session.
62
+ if from_agent and AGENT_NAME and from_agent == AGENT_NAME:
63
+ return
64
+ # Only fire when agent is actually sleeping — never when working or online
65
+ # (working = LLM generating; online = brief post-tool window; both would be interrupted)
66
+ if _current_state != 'sleeping':
47
67
  return
68
+ # Recent-activity guard: even if state says 'sleeping', any tool call
69
+ # in the last 30s means the LLM was just typing or about to type. The
70
+ # _IN_WAIT + state check has gaps between tool calls; this widens it.
71
+ try:
72
+ if (_time.time() - _last_tool_at) < 30.0:
73
+ return
74
+ except Exception:
75
+ pass
76
+ # Belt-and-suspenders: also check parent CPU is low (LLM not generating right now)
77
+ try:
78
+ if _get_parent_cpu() > 5.0:
79
+ return # LLM is actively generating, don't interrupt
80
+ except Exception:
81
+ pass
48
82
  import subprocess, platform, re
49
83
  # Sanitize inputs: strip everything except alphanumeric, spaces, basic punctuation
50
84
  safe_agent = re.sub(r'[^a-zA-Z0-9_\- ]', '', from_agent)[:50]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: meshcode
3
- Version: 2.4.4
3
+ Version: 2.4.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.4.4"
7
+ version = "2.4.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