remote-claude 0.2.3 → 0.2.4

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.
@@ -43,6 +43,7 @@ class LarkHandler:
43
43
 
44
44
  _CHAT_BINDINGS_FILE = get_chat_bindings_file()
45
45
  _OLD_CHAT_BINDINGS_FILE = Path("/tmp/remote-claude/lark_chat_bindings.json")
46
+ _LARK_GROUP_IDS_FILE = Path(get_chat_bindings_file()).parent / "lark_group_ids.json"
46
47
 
47
48
  def __init__(self):
48
49
  # 兼容迁移:旧绑定文件存在而新路径不存在时,自动迁移
@@ -61,6 +62,8 @@ class LarkHandler:
61
62
  self._poller = SharedMemoryPoller(card_service)
62
63
  # chat_id → session_name 持久化绑定(重启后自动恢复)
63
64
  self._chat_bindings: Dict[str, str] = self._load_chat_bindings()
65
+ # 专属群聊 chat_id 集合(仅包含通过 /new-group 创建的群)
66
+ self._group_chat_ids: set = self._load_group_chat_ids()
64
67
  # chat_id → CardSlice(用户主动断开后保留,供重连时冻结旧卡片)
65
68
  self._detached_slices: Dict[str, CardSlice] = {}
66
69
 
@@ -83,6 +86,23 @@ class LarkHandler:
83
86
  except Exception as e:
84
87
  logger.warning(f"保存绑定失败: {e}")
85
88
 
89
+ def _load_group_chat_ids(self) -> set:
90
+ try:
91
+ if self._LARK_GROUP_IDS_FILE.exists():
92
+ return set(json.loads(self._LARK_GROUP_IDS_FILE.read_text()))
93
+ except Exception:
94
+ pass
95
+ return set()
96
+
97
+ def _save_group_chat_ids(self):
98
+ try:
99
+ ensure_user_data_dir()
100
+ self._LARK_GROUP_IDS_FILE.write_text(
101
+ json.dumps(list(self._group_chat_ids), ensure_ascii=False)
102
+ )
103
+ except Exception as e:
104
+ logger.warning(f"保存群聊 ID 失败: {e}")
105
+
86
106
  def _remove_binding_by_chat(self, chat_id: str):
87
107
  self._chat_bindings.pop(chat_id, None)
88
108
  self._save_chat_bindings()
@@ -526,7 +546,11 @@ class LarkHandler:
526
546
  """显示快捷操作菜单(内嵌会话列表)"""
527
547
  sessions = list_active_sessions()
528
548
  current = self._chat_sessions.get(chat_id)
529
- session_groups = {sname: cid for cid, sname in self._chat_bindings.items() if cid.startswith("oc_")}
549
+ session_groups = {
550
+ self._chat_bindings[cid]: cid
551
+ for cid in self._group_chat_ids
552
+ if cid in self._chat_bindings
553
+ }
530
554
  card = build_menu_card(sessions, current_session=current, session_groups=session_groups)
531
555
  await self._send_or_update_card(chat_id, card, message_id)
532
556
 
@@ -570,7 +594,11 @@ class LarkHandler:
570
594
  await card_service.send_text(chat_id, f"读取目录失败:{e}")
571
595
  return
572
596
 
573
- session_groups = {sname: cid for cid, sname in self._chat_bindings.items() if cid.startswith("oc_")}
597
+ session_groups = {
598
+ self._chat_bindings[cid]: cid
599
+ for cid in self._group_chat_ids
600
+ if cid in self._chat_bindings
601
+ }
574
602
  card = build_dir_card(target, entries, sessions_info, tree=tree, session_groups=session_groups, page=page)
575
603
  await self._send_or_update_card(chat_id, card, message_id)
576
604
 
@@ -630,6 +658,8 @@ class LarkHandler:
630
658
  group_chat_id = create_data["data"]["chat_id"]
631
659
  self._chat_bindings[group_chat_id] = session_name
632
660
  self._save_chat_bindings()
661
+ self._group_chat_ids.add(group_chat_id)
662
+ self._save_group_chat_ids()
633
663
  # 立即 attach,让新群即刻开始接收 Claude 输出
634
664
  await self._attach(group_chat_id, session_name)
635
665
 
@@ -696,6 +726,8 @@ class LarkHandler:
696
726
 
697
727
  # 无论 Feishu delete 是否成功,都清理本地绑定
698
728
  self._remove_binding_by_chat(group_chat_id)
729
+ self._group_chat_ids.discard(group_chat_id)
730
+ self._save_group_chat_ids()
699
731
  await self._detach(group_chat_id)
700
732
 
701
733
  if feishu_ok:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "remote-claude",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "双端共享 Claude CLI 工具",
5
5
  "bin": {
6
6
  "remote-claude": "bin/remote-claude",