remote-claude 1.0.0 → 1.0.1

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 (2) hide show
  1. package/package.json +1 -1
  2. package/utils/session.py +12 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-claude",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "双端共享 Claude CLI 工具",
5
5
  "bin": {
6
6
  "remote-claude": "bin/remote-claude",
package/utils/session.py CHANGED
@@ -6,6 +6,7 @@
6
6
  - 通用工具
7
7
  """
8
8
 
9
+ import hashlib
9
10
  import os
10
11
  import subprocess
11
12
  import tempfile
@@ -19,6 +20,11 @@ SOCKET_DIR = Path("/tmp/remote-claude")
19
20
  USER_DATA_DIR = Path.home() / ".remote-claude"
20
21
  TMUX_SESSION_PREFIX = "rc-"
21
22
 
23
+ # macOS AF_UNIX sun_path 限制 104 字节
24
+ # /tmp/remote-claude/ = 19 字节, .sock = 5 字节
25
+ _MAX_SOCKET_PATH = 104
26
+ _MAX_FILENAME = _MAX_SOCKET_PATH - len(str(SOCKET_DIR)) - 1 - len(".sock")
27
+
22
28
 
23
29
  def get_env_file() -> Path:
24
30
  """获取 .env 配置文件路径"""
@@ -41,8 +47,12 @@ def ensure_user_data_dir():
41
47
 
42
48
 
43
49
  def _safe_filename(session_name: str) -> str:
44
- """将会话名转为安全文件名(/ 和 . 替换为 _"""
45
- return session_name.replace('/', '_').replace('.', '_')
50
+ """将会话名转为安全文件名(/ 和 . 替换为 _),超长时用完整 MD5"""
51
+ name = session_name.replace('/', '_').replace('.', '_')
52
+ if len(name) <= _MAX_FILENAME:
53
+ return name
54
+ # 超长:直接用完整 32 字符 MD5,彻底避免路径超限
55
+ return hashlib.md5(session_name.encode()).hexdigest()
46
56
 
47
57
 
48
58
  def get_socket_path(session_name: str) -> Path: