Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(wechat): polish onboarding and interaction flow
cyhhao9f2d6bf63e65
diff --git a/config/v2_config.py b/config/v2_config.pyindex f7c2638c5..14ee3c687 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -286,8 +286,8 @@ class V2Config:update = UpdateConfig(**_filter_dataclass_fields(UpdateConfig, update_payload))ack_mode = payload.get("ack_mode", "reaction")- if ack_mode not in {"reaction", "message"}:- raise ValueError("Config 'ack_mode' must be 'reaction' or 'message'")+ if ack_mode not in {"reaction", "message", "typing"}:+ raise ValueError("Config 'ack_mode' must be 'reaction', 'message', or 'typing'")show_duration = payload.get("show_duration", True)if not isinstance(show_duration, bool):diff --git a/core/controller.py b/core/controller.pyindex 96876aa2f..8d6635448 100644--- a/core/controller.py+++ b/core/controller.py@@ -291,7 +291,7 @@ class Controller:# the centralized auth pipeline (core.auth.check_auth) in IM entry points.command_handlers = {"start": self.command_handler.handle_start,- "clear": self.command_handler.handle_clear,+ "new": self.command_handler.handle_new,"cwd": self.command_handler.handle_cwd,"set_cwd": self.command_handler.handle_set_cwd,"settings": self.settings_handler.handle_settings,diff --git a/core/handlers/command_handlers.py b/core/handlers/command_handlers.pyindex 8c62335cc..78acdc61a 100644--- a/core/handlers/command_handlers.py+++ b/core/handlers/command_handlers.py@@ -1,4 +1,4 @@-"""Command handlers for bot commands like /start, /clear, /cwd, etc."""+"""Command handlers for bot commands like /start, /new, /cwd, etc."""import osimport logging@@ -32,6 +32,38 @@ class CommandHandlers(BaseHandler):# For other platforms, keep original contextreturn context+ def _build_non_interactive_start_message(+ self,+ *,+ platform_name: str,+ agent_display_name: str,+ user_name: str,+ show_channel: bool,+ channel_name: str,+ ) -> str:+ lines = [+ f"{self._t('command.start.welcome')}",+ "",+ self._t("command.start.greeting", name=user_name),+ self._t("command.start.platform", platform=platform_name),+ self._t("command.start.agent", agent=agent_display_name),+ ]+ if show_channel:+ lines.append(self._t("command.start.channel", channel=channel_name))++ lines.extend(+ [+ "",+ self._t("command.start.commandsTitle"),+ self._t("command.start.commandStart"),+ self._t("command.start.commandCwd"),+ self._t("command.start.commandSetCwd"),+ self._t("command.start.commandStop", agent=agent_display_name),+ self._t("command.start.commandNew"),+ ]+ )+ return "\n".join(line for line in lines if line)+async def handle_start(self, context: MessageContext, args: str = ""):"""Handle /start command with interactive buttons"""platform_name = self.config.platform.capitalize()@@ -60,32 +92,15 @@ class CommandHandlers(BaseHandler):# For non-interactive platforms, use traditional text messageif self.config.platform not in {"slack", "discord", "lark"}:- formatter = self.im_client.formatter-- # Build welcome message using formatter to handle escaping properly- lines = [- formatter.format_bold(self._t("command.start.welcome")),- "",- f"Platform: {formatter.format_text(platform_name)}",- f"Agent: {formatter.format_text(agent_display_name)}",- f"User ID: {formatter.format_code_inline(context.user_id)}",- f"Channel/Chat ID: {formatter.format_code_inline(context.channel_id)}",- "",- formatter.format_bold("Commands:"),- formatter.format_text("@Vibe Remote /start - Show this message"),- formatter.format_text("@Vibe Remote /clear - Reset session and start fresh"),- formatter.format_text("@Vibe Remote /cwd - Show current working directory"),- formatter.format_text("@Vibe Remote /set_cwd <path> - Set working directory"),- formatter.format_text("@Vibe Remote /settings - Personalization settings"),- formatter.format_text(f"@Vibe Remote /stop - Interrupt {agent_display_name} execution"),- "",- formatter.format_bold("How it works:"),- formatter.format_text(f"• Send any message and it's immediately sent to {agent_display_name}"),- formatter.format_text("• Each chat maintains its own conversation context"),- formatter.format_text("• Use /clear to reset the conversation"),- ]-- message_text = formatter.format_message(*lines)+ user_name = self._resolve_user_display_name(user_info, self._t("command.start.userFallback"))+ show_channel = self.config.platform != "wechat"+ message_text = self._build_non_interactive_start_message(+ platform_name=platform_name,+ agent_display_name=agent_display_name,+ user_name=user_name,+ show_channel=show_channel,+ channel_name=channel_info.get("name", "Unknown"),+ )channel_context = self._get_channel_context(context)await self.im_client.send_message(channel_context, message_text)return@@ -102,7 +117,7 @@ class CommandHandlers(BaseHandler):],# Row 2: Session and Settings[- InlineButton(text=f"🔄 {self._t('button.clearSession')}", callback_data="cmd_clear"),+ InlineButton(text=f"🆕 {self._t('button.newSession')}", callback_data="cmd_new"),InlineButton(text=f"⚙️ {self._t('button.settings')}", callback_data="cmd_settings"),],# Row 3: Resume + Agent/Model switching@@ -130,34 +145,30 @@ class CommandHandlers(BaseHandler):channel_context = self._get_channel_context(context)await self.im_client.send_message_with_buttons(channel_context, welcome_text, keyboard)- async def handle_clear(self, context: MessageContext, args: str = ""):- """Handle clear command - clears all sessions across configured agents"""+ async def handle_new(self, context: MessageContext, args: str = ""):+ """Handle /new command - reset active session state for a fresh start."""try:- # Get the correct settings key (channel_id for Slack, not user_id)settings_key = self._get_settings_key(context)-- cleared = await self.controller.agent_service.clear_sessions(settings_key)- if not cleared:- full_response = f"📋 {self._t('command.clear.noSessions')}"- else:- details = "\n".join(- f"• {self._t('command.clear.sessionItem', agent=agent, count=count)}"- for agent, count in cleared.items()- )- full_response = f"✅ {self._t('command.clear.cleared', details=details)}"+ await self.controller.agent_service.clear_sessions(settings_key)+ full_response = f"🆕 {self._t('command.new.started')}"channel_context = self._get_channel_context(context)await self.im_client.send_message(channel_context, full_response)- logger.info(f"Sent clear response to user {context.user_id}")+ logger.info("Started fresh session for user %s", context.user_id)except Exception as e:- logger.error(f"Error clearing session: {e}", exc_info=True)+ logger.error(f"Error starting new session: {e}", exc_info=True)try:channel_context = self._get_channel_context(context)await self.im_client.send_message(channel_context, f"❌ {self._t('error.clearSession', error=str(e))}")except Exception as send_error:logger.error(f"Failed to send error message: {send_error}", exc_info=True)+ async def handle_clear(self, context: MessageContext, args: str = ""):+ """Backward-compatible alias for older interactive callbacks."""++ await self.handle_new(context, args)+async def handle_cwd(self, context: MessageContext, args: str = ""):"""Handle cwd command - show current working directory"""try:diff --git a/core/handlers/message_handler.py b/core/handlers/message_handler.pyindex 2c07f004a..27ba0179c 100644--- a/core/handlers/message_handler.py+++ b/core/handlers/message_handler.py@@ -1,5 +1,6 @@"""Message routing and Agent communication handlers"""+import asyncioimport loggingfrom typing import List, Optional, Tuple@@ -39,8 +40,55 @@ class MessageHandler(BaseHandler):)return context+ def _should_use_typing_ack(self) -> bool:+ platform = getattr(self.config, "platform", "")+ if platform == "wechat":+ return True+ return getattr(self.config, "ack_mode", "reaction") == "typing"++ async def _typing_keepalive_loop(self, context: MessageContext) -> None:+ try:+ while True:+ await asyncio.sleep(5)+ ok = await self.im_client.send_typing_indicator(context)+ if not ok:+ logger.debug("Typing keepalive not applied for %s", context.user_id)+ except asyncio.CancelledError:+ raise++ async def _start_processing_indicator(+ self, context: MessageContext+ ) -> Tuple[Optional[str], Optional[str], bool, Optional[asyncio.Task]]:+ if self._should_use_typing_ack():+ try:+ ok = await self.im_client.send_typing_indicator(context)+ if ok:+ return None, None, True, asyncio.create_task(self._typing_keepalive_loop(context))+ logger.info("Typing indicator not applied (platform returned False)")+ except Exception as ack_err:+ logger.debug(f"Failed to send typing ack: {ack_err}")+ if getattr(self.config, "platform", "") == "wechat":+ return None, None, False, None++ ack_reaction_message_id = None+ ack_reaction_emoji = None+ try:+ if context.message_id:+ ack_reaction_message_id = context.message_id+ ack_reaction_emoji = ":eyes:"+ ok = await self.im_client.add_reaction(context, ack_reaction_message_id, ack_reaction_emoji)+ if not ok:+ logger.info("Ack reaction not applied (platform returned False)")+ except Exception as ack_err:+ logger.debug(f"Failed to add reaction ack: {ack_err}")+ return ack_reaction_message_id, ack_reaction_emoji, False, None+async def handle_user_message(self, context: MessageContext, message: str):"""Process regular user messages and route to configured agent"""+ ack_reaction_message_id = None+ ack_reaction_emoji = None+ typing_indicator_active = False+ typing_indicator_task = Nonetry:# Record user activity for auto-update idle detectionif hasattr(self.controller, "update_checker"):@@ -158,10 +206,8 @@ class MessageHandler(BaseHandler):ack_message_id = Noneack_mode = getattr(self.config, "ack_mode", "reaction")- ack_reaction_message_id = None- ack_reaction_emoji = None-- if ack_mode == "message":+ effective_ack_mode = "typing" if getattr(self.config, "platform", "") == "wechat" else ack_mode+ if effective_ack_mode == "message":ack_context = self._get_target_context(context)ack_text = self._get_ack_text(agent_name)try:@@ -169,16 +215,12 @@ class MessageHandler(BaseHandler):except Exception as ack_err:logger.debug(f"Failed to send ack message: {ack_err}")else:- # Default: add 👀 / :eyes: reaction to the user's message- try:- if context.message_id:- ack_reaction_message_id = context.message_id- ack_reaction_emoji = ":eyes:"- ok = await self.im_client.add_reaction(context, ack_reaction_message_id, ack_reaction_emoji)- if not ok:- logger.info("Ack reaction not applied (platform returned False)")- except Exception as ack_err:- logger.debug(f"Failed to add reaction ack: {ack_err}")+ (+ ack_reaction_message_id,+ ack_reaction_emoji,+ typing_indicator_active,+ typing_indicator_task,+ ) = await self._start_processing_indicator(context)if subagent_name and context.message_id:try:@@ -224,6 +266,8 @@ class MessageHandler(BaseHandler):# Reaction info — agent removes :eyes: on result/errorack_reaction_message_id=ack_reaction_message_id,ack_reaction_emoji=ack_reaction_emoji,+ typing_indicator_active=typing_indicator_active,+ typing_indicator_task=typing_indicator_task,files=processed_files,)try:@@ -251,6 +295,14 @@ class MessageHandler(BaseHandler):and ack_reaction_emoji # type: ignore[possibly-undefined]):await self.im_client.remove_reaction(context, ack_reaction_message_id, ack_reaction_emoji)+ if typing_indicator_task: # type: ignore[possibly-undefined]+ typing_indicator_task.cancel()+ try:+ await typing_indicator_task+ except asyncio.CancelledError:+ pass+ if typing_indicator_active: # type: ignore[possibly-undefined]+ await self.im_client.clear_typing_indicator(context)except Exception as cleanup_err:logger.debug(f"Failed to clean up reaction on error: {cleanup_err}")await self.im_client.send_message(@@ -313,8 +365,8 @@ class MessageHandler(BaseHandler):elif callback_data == "cmd_change_cwd":await command_handlers.handle_change_cwd_modal(context)- elif callback_data == "cmd_clear":- await command_handlers.handle_clear(context)+ elif callback_data in {"cmd_new", "cmd_clear"}:+ await command_handlers.handle_new(context)elif callback_data == "cmd_resume":await command_handlers.handle_resume(context)@@ -438,7 +490,7 @@ class MessageHandler(BaseHandler):logger.debug(f"Failed to send quick-reply echo message: {err}")# Add ack reaction on the echo message before dispatching.- if quick_reply_echo_id:+ if quick_reply_echo_id and getattr(self.config, "ack_mode", "reaction") == "reaction":try:await self.im_client.add_reaction(self._get_target_context(context),@@ -520,7 +572,27 @@ class MessageHandler(BaseHandler):request.ack_message_id = Noneasync def _remove_ack_reaction(self, context: MessageContext, request: AgentRequest):- """Remove acknowledgement reaction if it still exists."""+ """Remove acknowledgement reaction / typing indicator if it still exists."""+ typing_task = request.typing_indicator_task+ if typing_task is not None:+ typing_task.cancel()+ try:+ await typing_task+ except asyncio.CancelledError:+ pass+ except Exception as err:+ logger.debug(f"Failed to stop typing keepalive task: {err}")+ finally:+ request.typing_indicator_task = None++ if request.typing_indicator_active:+ try:+ await self.im_client.clear_typing_indicator(context)+ except Exception as err:+ logger.debug(f"Failed to clear typing ack: {err}")+ finally:+ request.typing_indicator_active = False+if request.ack_reaction_message_id and request.ack_reaction_emoji:try:await self.im_client.remove_reaction(@@ -585,6 +657,11 @@ class MessageHandler(BaseHandler):"name": attachment.name,"size": attachment.size,}+ attachment_data = getattr(attachment, "__dict__", {})+ for key, value in attachment_data.items():+ if key in {"name", "mimetype", "url", "content", "local_path", "size"}:+ continue+ file_info[key] = valuetimestamp = int(time.time())safe_name = self._sanitize_filename(attachment.name)filename = f"{timestamp}_{safe_name}"diff --git a/core/handlers/session_handler.py b/core/handlers/session_handler.pyindex 33dd44c80..c8ac5434d 100644--- a/core/handlers/session_handler.py+++ b/core/handlers/session_handler.py@@ -187,15 +187,17 @@ class SessionHandler(BaseHandler):reply_enhancements_on = getattr(self.config, "reply_enhancements", True)if reply_enhancements_on:- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT+ from core.reply_enhancer import build_reply_enhancements_prompt++ reply_prompt = build_reply_enhancements_prompt(include_quick_replies=self.config.platform != "wechat")if base_prompt:- final_system_prompt = f"{base_prompt}\n\n{REPLY_ENHANCEMENTS_PROMPT}"+ final_system_prompt = f"{base_prompt}\n\n{reply_prompt}"else:final_system_prompt = {"type": "preset","preset": "claude_code",- "append": REPLY_ENHANCEMENTS_PROMPT,+ "append": reply_prompt,}else:final_system_prompt = base_promptdiff --git a/core/message_dispatcher.py b/core/message_dispatcher.pyindex 224c55ecc..f036158dd 100644--- a/core/message_dispatcher.py+++ b/core/message_dispatcher.py@@ -8,6 +8,7 @@ from __future__ import annotationsimport loggingimport asyncio+from pathlib import Pathfrom typing import Optionalfrom modules.im import MessageContext@@ -94,6 +95,13 @@ class ConsolidatedMessageDispatcher:return 1900return 30000+ def _supports_quick_replies(self) -> bool:+ return self.controller.config.platform != "wechat"++ @staticmethod+ def _is_video_path(path: str) -> bool:+ return Path(path).suffix.lower() in {".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v"}+@staticmethoddef _build_result_summary(text: str, max_chars: int) -> str:if len(text) <= max_chars:@@ -154,7 +162,7 @@ class ConsolidatedMessageDispatcher:display_text = textif len(display_text) <= self._get_result_max_chars():- if enhanced and enhanced.buttons:+ if enhanced and enhanced.buttons and self._supports_quick_replies():await self._send_with_quick_replies(im_client,target_context,@@ -376,7 +384,13 @@ class ConsolidatedMessageDispatcher:upload_title = f"{upload_title}{src_ext}"try:- if getattr(fl, "is_image", False):+ if self._is_video_path(str(resolved)):+ await im_client.upload_video_from_path(+ context,+ file_path=str(resolved),+ title=upload_title,+ )+ elif getattr(fl, "is_image", False):try:await im_client.upload_image_from_path(context,diff --git a/core/reply_enhancer.py b/core/reply_enhancer.pyindex 5bec41271..a5d4d6633 100644--- a/core/reply_enhancer.py+++ b/core/reply_enhancer.py@@ -58,7 +58,7 @@ class EnhancedReply:# Matches markdown links with file:// URLs, including image links:# [label](file:///path)# -_FILE_LINK_RE = re.compile(r"(!?)\[([^\]]*)\]\((file://[^)]+)\)")+_FILE_LINK_RE = re.compile(r"(!?)\[([^\]]*)\]\((file://(?:[^()]+|\([^)]*\))+)\)")# Matches the quick-reply button block at the end of the text.# A horizontal rule (``---``) on its own line, followed by one or more@@ -150,13 +150,13 @@ def _extract_buttons(text: str) -> Tuple[List[QuickReplyButton], str]:# System prompt for injection into agent backends# ----------------------------------------------------------------------------REPLY_ENHANCEMENTS_PROMPT = """\+_FILES_PROMPT = """\# Vibe RemoteVibe Remote is a middleware layer that connects AI agents to IM platforms such as Slack. \The user is interacting with you through an IM app via Vibe Remote forwarding.-You have two optional reply-enhancement capabilities:+You have optional reply-enhancement capabilities:## 1. Send filesYou can send a local file to the user by using a Markdown link with the `file://` protocol:@@ -166,6 +166,9 @@ Vibe Remote will automatically send the file as an attachment.### Image syntaxIf you want it sent as an image attachment rather than a regular file, use Markdown image syntax:Example: +"""++_QUICK_REPLIES_PROMPT = """\## 2. Quick-reply buttonsAt the very end of the message, add a `---` separator followed by `[button text]` to provide clickable quick replies. Example:@@ -178,3 +181,15 @@ Rules:- Wrap each button in `[text]` and separate them with `|`; you may start with emoji to improve clarity- Use at most 2-4 buttons, each no longer than 20 characters"""+++def build_reply_enhancements_prompt(*, include_quick_replies: bool = True) -> str:+ """Build the reply-enhancement prompt for the current platform/backend."""++ prompt = _FILES_PROMPT+ if include_quick_replies:+ prompt += _QUICK_REPLIES_PROMPT+ return prompt+++REPLY_ENHANCEMENTS_PROMPT = build_reply_enhancements_prompt()diff --git a/modules/agents/base.py b/modules/agents/base.pyindex 392b5d9ca..42d269c79 100644--- a/modules/agents/base.py+++ b/modules/agents/base.py@@ -4,6 +4,7 @@ from __future__ import annotationsimport loggingimport time+import asynciofrom abc import ABC, abstractmethodfrom dataclasses import dataclass, fieldfrom typing import Any, Dict, List, Optional@@ -35,6 +36,8 @@ class AgentRequest:# Reaction ack: emoji added to user's message, to be removed when result is sentack_reaction_message_id: Optional[str] = Noneack_reaction_emoji: Optional[str] = None+ typing_indicator_active: bool = False+ typing_indicator_task: Optional[Any] = None# File attachments (downloaded or with URLs for download)files: Optional[List[FileAttachment]] = None@@ -72,13 +75,33 @@ class BaseAgent(ABC):return max(0, int(elapsed * 1000))async def _remove_ack_reaction(self, request: AgentRequest) -> None:- """Remove the acknowledgement reaction from user's message.+ """Remove the acknowledgement reaction / typing indicator.Called after sending result message or on terminal error to clean upthe 👀 reaction. This is the **single** implementation — subclassesshould NOT override it. The guard (check-then-clear) is idempotent socalling it more than once is harmless."""+ typing_task = request.typing_indicator_task+ if typing_task is not None:+ typing_task.cancel()+ try:+ await typing_task+ except asyncio.CancelledError:+ pass+ except Exception:+ logger.debug("Failed to stop typing keepalive task", exc_info=True)+ finally:+ request.typing_indicator_task = None++ if request.typing_indicator_active:+ try:+ await self.im_client.clear_typing_indicator(request.context)+ except Exception as err:+ logger.debug(f"Failed to clear typing indicator: {err}")+ finally:+ request.typing_indicator_active = False+if request.ack_reaction_message_id and request.ack_reaction_emoji:try:await self.im_client.remove_reaction(diff --git a/modules/agents/claude_agent.py b/modules/agents/claude_agent.pyindex 059be268d..e5ce8462f 100644--- a/modules/agents/claude_agent.py+++ b/modules/agents/claude_agent.py@@ -37,6 +37,7 @@ class ClaudeAgent(BaseAgent):# Store reaction info per session as a queue (FIFO) for cleanup after result# Each entry is (reaction_message_id, emoji)self._pending_reactions: dict[str, list[tuple[str, str]]] = {}+ self._pending_requests: dict[str, list[AgentRequest]] = {}# Question handler for AskUserQuestion support (disabled)# NOTE: Uncomment when SDK adds AskUserQuestion support@@ -72,6 +73,7 @@ class ClaudeAgent(BaseAgent):self._pending_reactions[request.composite_session_id].append((request.ack_reaction_message_id, request.ack_reaction_emoji))+ self._pending_requests.setdefault(request.composite_session_id, []).append(request)# Prepare message with file attachment info if presentmessage = self._prepare_message_with_files(request)@@ -92,6 +94,8 @@ class ClaudeAgent(BaseAgent):logger.error(f"Error processing Claude message: {e}", exc_info=True)# Clean up the specific reaction for this request (not FIFO)await self._remove_specific_pending_reaction(request.composite_session_id, context, request)+ self._remove_pending_request(request.composite_session_id, request)+ await self._remove_ack_reaction(request)await self.session_handler.handle_session_error(request.composite_session_id, context, e)finally:await self._delete_ack(context, request)@@ -155,7 +159,7 @@ class ClaudeAgent(BaseAgent):await self.controller.emit_agent_message(request.context,"notify",- "⚠️ This Claude session cannot be interrupted; consider /clear.",+ "⚠️ This Claude session cannot be interrupted; consider /new.",)return Falseexcept Exception as err:@@ -163,7 +167,7 @@ class ClaudeAgent(BaseAgent):await self.controller.emit_agent_message(request.context,"notify",- "⚠️ Failed to interrupt Claude session. Please try /clear.",+ "⚠️ Failed to interrupt Claude session. Please try /new.",)return False@@ -307,16 +311,18 @@ class ClaudeAgent(BaseAgent):# contains the same text as the last AssistantMessage,# so sending both would duplicate the content.+ pending_request = self._pop_pending_request(composite_key)+await self.emit_result_message(context,result_text,subtype=getattr(message, "subtype", "") or "",duration_ms=getattr(message, "duration_ms", 0),parse_mode="markdown",+ request=pending_request,)- # Remove ack reaction after result is sent- await self._remove_pending_reaction(composite_key, context)+ self._discard_pending_reaction(composite_key)self._last_assistant_text.pop(composite_key, None)session = await self.session_manager.get_or_create_session(context.user_id, context.channel_id)@@ -383,6 +389,34 @@ class ClaudeAgent(BaseAgent):except Exception as err:logger.debug(f"Failed to remove reaction ack: {err}")+ def _discard_pending_reaction(self, composite_key: str) -> None:+ reactions = self._pending_reactions.get(composite_key)+ if not reactions:+ return+ reactions.pop(0)+ if not reactions:+ self._pending_reactions.pop(composite_key, None)++ def _pop_pending_request(self, composite_key: str) -> Optional[AgentRequest]:+ requests = self._pending_requests.get(composite_key)+ if not requests:+ return None+ request = requests.pop(0)+ if not requests:+ self._pending_requests.pop(composite_key, None)+ return request++ def _remove_pending_request(self, composite_key: str, request: AgentRequest) -> None:+ requests = self._pending_requests.get(composite_key)+ if not requests:+ return+ for index, pending_request in enumerate(requests):+ if pending_request is request:+ requests.pop(index)+ break+ if not requests:+ self._pending_requests.pop(composite_key, None)+async def _remove_specific_pending_reaction(self, composite_key: str, context: MessageContext, request: AgentRequest) -> None:@@ -412,12 +446,16 @@ class ClaudeAgent(BaseAgent):async def _clear_pending_reactions(self, composite_key: str, context: MessageContext) -> None:"""Clear all pending reactions for a session (for error cleanup)."""reactions = self._pending_reactions.pop(composite_key, None)+ requests = self._pending_requests.pop(composite_key, None)if reactions:for message_id, emoji in reactions:try:await self.im_client.remove_reaction(context, message_id, emoji)except Exception as err:logger.debug(f"Failed to remove reaction ack: {err}")+ if requests:+ for request in requests:+ await self._remove_ack_reaction(request)def get_relative_path(self, abs_path: str, context: Optional[MessageContext] = None) -> str:"""Convert absolute path to relative path from working directory."""diff --git a/modules/agents/codex/agent.py b/modules/agents/codex/agent.pyindex 725116359..622c4e728 100644--- a/modules/agents/codex/agent.py+++ b/modules/agents/codex/agent.py@@ -271,9 +271,11 @@ class CodexAgent(BaseAgent):}if getattr(self.controller.config, "reply_enhancements", True):- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT+ from core.reply_enhancer import build_reply_enhancements_prompt- params["developerInstructions"] = REPLY_ENHANCEMENTS_PROMPT+ params["developerInstructions"] = build_reply_enhancements_prompt(+ include_quick_replies=self.controller.config.platform != "wechat"+ )resp = await transport.send_request("thread/start", params)# thread/start returns Thread directly OR may nest under "thread"diff --git a/modules/agents/opencode/agent.py b/modules/agents/opencode/agent.pyindex ccefc2fa5..2a5170e8b 100644--- a/modules/agents/opencode/agent.py+++ b/modules/agents/opencode/agent.py@@ -231,9 +231,13 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):# Inject reply-enhancement instructions via the system field (appended by OpenCode)reply_system: Optional[str] = Noneif getattr(self.controller.config, "reply_enhancements", True):- from core.reply_enhancer import REPLY_ENHANCEMENTS_PROMPT+ from core.reply_enhancer import build_reply_enhancements_prompt- reply_system = REPLY_ENHANCEMENTS_PROMPT+ reply_system = build_reply_enhancements_prompt(+ include_quick_replies=self.controller.config.platform != "wechat"+ )++ request_tools = {"question": False} if self.controller.config.platform == "wechat" else Noneawait server.prompt_async(session_id=session_id,@@ -243,6 +247,7 @@ class OpenCodeAgent(OpenCodeMessageProcessorMixin, BaseAgent):model=model_dict,reasoning_effort=reasoning_effort,system=reply_system,+ tools=request_tools,)logger.info(diff --git a/modules/agents/opencode/question_handler.py b/modules/agents/opencode/question_handler.pyindex 3f1aa3eb2..ebdba386f 100644--- a/modules/agents/opencode/question_handler.py+++ b/modules/agents/opencode/question_handler.py@@ -36,6 +36,15 @@ class OpenCodeQuestionHandler:# Maps base_session_id -> (context, message_id, emoji)self._answer_reactions: Dict[str, tuple] = {}+ def _platform_supports_question_tool(self, request: AgentRequest) -> bool:+ return getattr(self._controller.config, "platform", "") != "wechat"++ def _question_tool_disabled_text(self) -> str:+ translator = getattr(self._controller, "_t", None)+ if callable(translator):+ return translator("error.opencodeQuestionUnsupportedWechat")+ return "OpenCode interactive questions are temporarily disabled on WeChat. Please send a follow-up message instead."+def get_pending(self, base_session_id: str) -> Optional[PendingQuestionPayload]:return self._pending_questions.get(base_session_id)@@ -395,6 +404,24 @@ class OpenCodeQuestionHandler:tool_part.get("callID"),)+ if not self._platform_supports_question_tool(request):+ logger.warning(+ "Blocking OpenCode question toolcall on unsupported platform %s for session %s",+ getattr(self._controller.config, "platform", ""),+ opencode_session_id,+ )+ seen_tool_calls.add(call_key)+ try:+ await server.abort_session(opencode_session_id, request.working_path)+ except Exception as err:+ logger.warning("Failed to abort OpenCode session after blocked question toolcall: %s", err)+ await self._controller.emit_agent_message(+ request.context,+ "notify",+ self._question_tool_disabled_text(),+ )+ return False+qlist = tool_input.get("questions") if isinstance(tool_input, dict) else Noneqlist = qlist if isinstance(qlist, list) else []diff --git a/modules/agents/opencode/server.py b/modules/agents/opencode/server.pyindex d2e28e5e0..6c01fac63 100644--- a/modules/agents/opencode/server.py+++ b/modules/agents/opencode/server.py@@ -468,6 +468,7 @@ class OpenCodeServerManager:model: Optional[Dict[str, str]] = None,reasoning_effort: Optional[str] = None,system: Optional[str] = None,+ tools: Optional[Dict[str, bool]] = None,) -> None:"""Start a prompt asynchronously without holding the HTTP request open."""@@ -484,6 +485,8 @@ class OpenCodeServerManager:body["variant"] = reasoning_effortif system:body["system"] = system+ if tools:+ body["tools"] = toolsasync with session.post(f"{self.base_url}/session/{session_id}/prompt_async",diff --git a/modules/im/base.py b/modules/im/base.pyindex 35216a4fb..4a9c8ad8e 100644--- a/modules/im/base.py+++ b/modules/im/base.py@@ -151,7 +151,7 @@ class BaseIMClient(ABC):Examples:"/settings" -> "settings"- "/set_cwd /tmp" -> "set_cwd"+ "/setcwd /tmp" -> "set_cwd""bind abc123" -> "bind" (when ``allow_plain_bind`` is True)"hello" -> """""@@ -180,6 +180,8 @@ class BaseIMClient(ABC):command = head[1:]if not command:return None+ if command == "setcwd":+ command = "set_cwd"return command, argsif allow_plain_bind and head == "bind":@@ -351,6 +353,20 @@ class BaseIMClient(ABC):"""return await self.upload_file_from_path(context, file_path, title=title)+ async def upload_video_from_path(+ self,+ context: MessageContext,+ file_path: str,+ title: Optional[str] = None,+ ) -> str:+ """Upload a local video to the conversation.++ Default behavior falls back to ``upload_file_from_path`` so platforms+ without native video support still deliver the attachment.+ """++ return await self.upload_file_from_path(context, file_path, title=title)+async def download_file(self,file_info: Dict[str, Any],@@ -546,6 +562,16 @@ class BaseIMClient(ABC):"""return False+ async def send_typing_indicator(self, context: MessageContext) -> bool:+ """Start or refresh a typing indicator for the current conversation."""++ return False++ async def clear_typing_indicator(self, context: MessageContext) -> bool:+ """Clear a previously started typing indicator for the conversation."""++ return False+async def send_dm(self, user_id: str, text: str, **kwargs) -> Optional[str]:"""Send a direct message to a user by their platform user ID.diff --git a/modules/im/discord.py b/modules/im/discord.pyindex b6d5f9944..4ed9122e8 100644--- a/modules/im/discord.py+++ b/modules/im/discord.py@@ -431,6 +431,33 @@ class DiscordBot(BaseIMClient):message = await target.send(file=file_obj)return str(message.id)+ async def send_typing_indicator(self, context: MessageContext) -> bool:+ target = None+ if context.thread_id:+ target = await self._fetch_channel(context.thread_id)+ if not isinstance(target, discord.Thread):+ target = None+ if target is None:+ target = await self._fetch_channel(context.channel_id)+ if target is None:+ return False++ trigger = getattr(target, "trigger_typing", None)+ if not callable(trigger):+ return False++ try:+ await trigger()+ return True+ except Exception as err:+ logger.debug("Failed to trigger Discord typing indicator: %s", err)+ return False++ async def clear_typing_indicator(self, context: MessageContext) -> bool:+ """Discord typing indicators expire automatically without explicit cancel."""++ return True+async def upload_file_from_path(self,context: MessageContext,@@ -1738,6 +1765,7 @@ class _PersistentStartView(discord.ui.View):{"cmd_cwd","cmd_change_cwd",+ "cmd_new","cmd_clear","cmd_settings","cmd_resume",diff --git a/modules/im/wechat.py b/modules/im/wechat.pyindex 3a1ccd1ce..4bfecede9 100644--- a/modules/im/wechat.py+++ b/modules/im/wechat.py@@ -16,6 +16,7 @@ from pathlib import Pathfrom typing import Any, Callable, Dict, List, Optional, Setimport aiohttp+import base64from .base import (BaseIMClient,@@ -28,14 +29,48 @@ from .base import (from config.paths import get_state_dirfrom vibe.i18n import t as i18n_tfrom modules.im import wechat_api as _wechat_api_mod+from modules.im import wechat_cdn as _wechat_cdn_mod+from modules.im.formatters.wechat_formatter import WeChatFormatterlogger = logging.getLogger(__name__)++def _raise_if_wechat_api_error(resp: Optional[Dict[str, Any]], action: str) -> None:+ """Treat missing `ret` as success; raise only on explicit API errors."""++ if resp is None:+ raise RuntimeError(f"WeChat {action} failed: empty response")++ ret = resp.get("ret")+ errcode = resp.get("errcode")+ if ret in (None, 0) and errcode in (None, 0):+ return++ code = errcode if errcode not in (None, 0) else ret+ errmsg = resp.get("errmsg") or resp.get("msg", "")+ raise RuntimeError(f"WeChat {action} failed: code={code} errmsg={errmsg}")+++def _get_wechat_error_code(resp: Optional[Dict[str, Any]]) -> Any:+ if not resp:+ return None+ errcode = resp.get("errcode")+ if errcode not in (None, 0):+ return errcode+ return resp.get("ret")+++def _is_session_expired_code(code: Any) -> bool:+ return str(code) == str(_SESSION_EXPIRED_ERRCODE)++# ---------------------------------------------------------------------------# Constants# ---------------------------------------------------------------------------_POLL_TIMEOUT_MS = 35000+_MIN_POLL_TIMEOUT_MS = 5000+_MAX_POLL_TIMEOUT_MS = 60000_SHORT_RETRY_SECONDS = 2_LONG_RETRY_SECONDS = 30_MAX_CONSECUTIVE_FAILURES = 3@@ -129,21 +164,41 @@ class _WeChatAPI:base_url: str,token: str,to_user_id: str,- context_token: str,+ typing_ticket: str,+ status: int = _wechat_api_mod.TYPING_START,proxy: Optional[str] = None,) -> bool:"""Send a typing indicator (best-effort)."""try:- await _wechat_api_mod.send_typing(+ resp = await _wechat_api_mod.send_typing(base_url,token,to_user_id,- context_token,+ typing_ticket,+ status=status,)+ _raise_if_wechat_api_error(resp, "send_typing")return Trueexcept Exception:return False+ async def get_config(+ self,+ base_url: str,+ token: str,+ ilink_user_id: str,+ context_token: Optional[str] = None,+ proxy: Optional[str] = None,+ ) -> dict:+ """Fetch per-user WeChat bot config."""++ return await _wechat_api_mod.get_config(+ base_url,+ token,+ ilink_user_id,+ context_token=context_token,+ )+wechat_api = _WeChatAPI()@@ -163,33 +218,21 @@ class _WeChatCDN:self,base_url: str,token: str,+ cdn_base_url: str,+ to_user_id: str,file_path: str,+ media_type: int = _wechat_api_mod.UPLOAD_MEDIA_FILE,proxy: Optional[str] = None,) -> Optional[Dict[str, Any]]:- """Upload a file and return CDN metadata (file_id, aes_key, etc.)."""- url = f"{base_url}/uploadFile"- path = Path(file_path)- if not path.is_file():- logger.error("Upload file not found: %s", file_path)- return None-- data = aiohttp.FormData()- data.add_field("token", token)- data.add_field(- "file",- open(file_path, "rb"),- filename=path.name,- )-try:- async with aiohttp.ClientSession(timeout=self._timeout) as session:- async with session.post(url, data=data, proxy=proxy) as resp:- resp.raise_for_status()- result = await resp.json()- if result.get("ret", -1) != 0:- logger.error("CDN upload failed: %s", result)- return None- return result.get("data", result)+ return await _wechat_cdn_mod.upload_file_to_cdn(+ base_url=base_url,+ token=token,+ cdn_base_url=cdn_base_url,+ to_user_id=to_user_id,+ file_path=file_path,+ media_type=media_type,+ )except Exception as exc:logger.error("CDN upload error: %s", exc)return None@@ -198,33 +241,19 @@ class _WeChatCDN:self,base_url: str,token: str,+ cdn_base_url: str,+ to_user_id: str,file_path: str,proxy: Optional[str] = None,) -> Optional[Dict[str, Any]]:- """Upload an image and return CDN metadata."""- url = f"{base_url}/uploadImage"- path = Path(file_path)- if not path.is_file():- logger.error("Upload image not found: %s", file_path)- return None-- data = aiohttp.FormData()- data.add_field("token", token)- data.add_field(- "image",- open(file_path, "rb"),- filename=path.name,- )-try:- async with aiohttp.ClientSession(timeout=self._timeout) as session:- async with session.post(url, data=data, proxy=proxy) as resp:- resp.raise_for_status()- result = await resp.json()- if result.get("ret", -1) != 0:- logger.error("CDN image upload failed: %s", result)- return None- return result.get("data", result)+ return await _wechat_cdn_mod.upload_image_to_cdn(+ base_url=base_url,+ token=token,+ cdn_base_url=cdn_base_url,+ to_user_id=to_user_id,+ file_path=file_path,+ )except Exception as exc:logger.error("CDN image upload error: %s", exc)return None@@ -233,36 +262,48 @@ class _WeChatCDN:self,base_url: str,token: str,+ cdn_base_url: str,file_info: Dict[str, Any],target_path: str,proxy: Optional[str] = None,) -> bool:"""Download and decrypt a CDN file to a local path."""- url = f"{base_url}/downloadFile"- payload = {- "token": token,- "file_id": file_info.get("file_id", ""),- "aes_key": file_info.get("aes_key", ""),- "file_size": file_info.get("file_size", 0),- }+ cdn_info = file_info.get("cdn_info") or {}+ wechat_item = file_info.get("wechat_item") or {}+ encrypted_query_param = cdn_info.get("encrypt_query_param") or file_info.get("url", "")+ aes_key_b64 = cdn_info.get("aes_key", "")++ if not aes_key_b64:+ item_aes_hex = wechat_item.get("aeskey")+ if item_aes_hex:+ try:+ aes_key_b64 = base64.b64encode(bytes.fromhex(item_aes_hex)).decode("ascii")+ except ValueError:+ logger.error("Invalid WeChat image aeskey hex for file %s", file_info.get("name", ""))+ return False++ if not encrypted_query_param:+ logger.error("Missing encrypt_query_param for WeChat attachment: %s", file_info)+ return Falsedest = Path(target_path)dest.parent.mkdir(parents=True, exist_ok=True)try:- async with aiohttp.ClientSession(timeout=self._timeout) as session:- async with session.post(url, json=payload, proxy=proxy) as resp:- resp.raise_for_status()- content_type = resp.headers.get("Content-Type", "")- if "application/json" in content_type:- # Error response- error_data = await resp.json()- logger.error("CDN download error response: %s", error_data)- return False- with open(target_path, "wb") as f:- async for chunk in resp.content.iter_chunked(8192):- f.write(chunk)- return True+ if aes_key_b64:+ content = await _wechat_cdn_mod.download_and_decrypt(+ cdn_base_url,+ encrypted_query_param,+ aes_key_b64,+ )+ else:+ content = await _wechat_cdn_mod.download_plain(+ cdn_base_url,+ encrypted_query_param,+ )++ dest.write_bytes(content)+ return Trueexcept Exception as exc:logger.error("CDN download error: %s", exc)return False@@ -331,7 +372,7 @@ class WeChatBot(BaseIMClient):def __init__(self, config: WeChatConfig):super().__init__(config)self.config: WeChatConfig = config- self.formatter = None # WeChat uses plain text; no markdown formatter+ self.formatter = WeChatFormatter()self._loop: Optional[asyncio.AbstractEventLoop] = Noneself._stop_event: Optional[asyncio.Event] = None@@ -339,9 +380,12 @@ class WeChatBot(BaseIMClient):# Context tokens per user (needed for replies)self._context_tokens: Dict[str, str] = {}+ self._typing_tickets: Dict[tuple[str, str], str] = {}# getUpdates cursorself._sync_buf: str = ""+ self._poll_timeout_ms: int = _POLL_TIMEOUT_MS+ self._session_expired_logged: bool = False# Auth managerself._auth_manager = WeChatAuthManager()@@ -471,6 +515,7 @@ class WeChatBot(BaseIMClient):# Build TEXT itemitem_list = [{"type": 1, "text_item": {"text": self.format_markdown(text)}}]+ resp: Optional[Dict[str, Any]] = Nonetry:resp = await wechat_api.send_message(@@ -481,14 +526,12 @@ class WeChatBot(BaseIMClient):item_list,proxy=self.config.proxy_url,)- if resp.get("ret", -1) != 0:- logger.error(- "WeChat send_message failed: ret=%s msg=%s",- resp.get("ret"),- resp.get("msg", ""),- )+ if _is_session_expired_code(_get_wechat_error_code(resp)):+ self._mark_session_expired(_get_wechat_error_code(resp))+ _raise_if_wechat_api_error(resp, "send_message")except Exception as exc:logger.error("WeChat send_message error: %s", exc)+ raise# Generate a synthetic message ID (iLink may not return one)message_id = resp.get("message_id", "") if resp else ""@@ -548,7 +591,9 @@ class WeChatBot(BaseIMClient):"""Return basic user info. WeChat doesn't expose rich user profiles."""return {"id": user_id,- "name": user_id,+ "name": "WeChat User",+ "display_name": "WeChat User",+ "real_name": "WeChat User","platform": "wechat",}@@ -564,6 +609,29 @@ class WeChatBot(BaseIMClient):# Typing indicator# ------------------------------------------------------------------+ async def _get_typing_ticket(self, user_id: str, context_token: str) -> str:+ cache_key = (user_id, context_token)+ cached = self._typing_tickets.get(cache_key) or self._typing_tickets.get((user_id, ""))+ if cached:+ return cached++ resp = await wechat_api.get_config(+ self.config.base_url,+ self.config.bot_token,+ user_id,+ context_token=context_token or None,+ proxy=self.config.proxy_url,+ )+ _raise_if_wechat_api_error(resp, "get_config")++ typing_ticket = str(resp.get("typing_ticket") or "").strip()+ if not typing_ticket:+ raise RuntimeError(f"WeChat get_config failed: missing typing_ticket for {user_id}")++ self._typing_tickets[cache_key] = typing_ticket+ self._typing_tickets[(user_id, "")] = typing_ticket+ return typing_ticket+async def send_typing_indicator(self,context: MessageContext,@@ -573,18 +641,61 @@ class WeChatBot(BaseIMClient):context_token = self._get_context_token(context)if not context_token:return False- return await wechat_api.send_typing(+ try:+ typing_ticket = await self._get_typing_ticket(user_id, context_token)+ except Exception as exc:+ logger.debug("Failed to fetch WeChat typing ticket for %s: %s", user_id, exc)+ return False++ ok = await wechat_api.send_typing(self.config.base_url,self.config.bot_token,user_id,- context_token,+ typing_ticket,+ status=_wechat_api_mod.TYPING_START,proxy=self.config.proxy_url,)+ if not ok:+ self._typing_tickets.pop((user_id, context_token), None)+ self._typing_tickets.pop((user_id, ""), None)+ return ok++ async def clear_typing_indicator(self, context: MessageContext) -> bool:+ """Cancel the active typing indicator for the current WeChat DM."""++ user_id = context.user_id+ context_token = self._get_context_token(context)+ if not context_token:+ return False++ try:+ typing_ticket = await self._get_typing_ticket(user_id, context_token)+ except Exception as exc:+ logger.debug("Failed to fetch WeChat typing ticket for cancel %s: %s", user_id, exc)+ return False++ ok = await wechat_api.send_typing(+ self.config.base_url,+ self.config.bot_token,+ user_id,+ typing_ticket,+ status=_wechat_api_mod.TYPING_CANCEL,+ proxy=self.config.proxy_url,+ )+ if not ok:+ self._typing_tickets.pop((user_id, context_token), None)+ self._typing_tickets.pop((user_id, ""), None)+ return ok# ------------------------------------------------------------------# File operations# ------------------------------------------------------------------+ @staticmethod+ def _is_video_file(file_path: str, title: Optional[str] = None) -> bool:+ suffix = Path(title or file_path).suffix.lower()+ return suffix in {".mp4", ".mov", ".avi", ".mkv", ".webm", ".m4v"}+async def upload_file_from_path(self,context: MessageContext,@@ -592,9 +703,14 @@ class WeChatBot(BaseIMClient):title: Optional[str] = None,) -> str:"""Upload a file via CDN and send it as a file message."""+ if self._is_video_file(file_path, title):+ return await self.upload_video_from_path(context, file_path, title=title)+cdn_meta = await wechat_cdn.upload_file_to_cdn(self.config.base_url,self.config.bot_token,+ getattr(self.config, "cdn_base_url", self.config.base_url),+ context.user_id,file_path,proxy=self.config.proxy_url,)@@ -610,7 +726,11 @@ class WeChatBot(BaseIMClient):{"type": 4, # FILE"file_item": {- "media": cdn_meta,+ "media": {+ "encrypt_query_param": cdn_meta.get("encrypt_query_param", ""),+ "aes_key": cdn_meta.get("aes_key", ""),+ "encrypt_type": 1,+ },"file_name": display_name,"len": str(cdn_meta.get("file_size", 0)),},@@ -618,7 +738,7 @@ class WeChatBot(BaseIMClient):]try:- await wechat_api.send_message(+ resp = await wechat_api.send_message(self.config.base_url,self.config.bot_token,user_id,@@ -626,6 +746,9 @@ class WeChatBot(BaseIMClient):item_list,proxy=self.config.proxy_url,)+ if _is_session_expired_code(_get_wechat_error_code(resp)):+ self._mark_session_expired(_get_wechat_error_code(resp))+ _raise_if_wechat_api_error(resp, "send file message")except Exception as exc:logger.error("WeChat send file message error: %s", exc)return ""@@ -639,9 +762,14 @@ class WeChatBot(BaseIMClient):title: Optional[str] = None,) -> str:"""Upload an image via CDN and send it as an image message."""+ if self._is_video_file(file_path, title):+ return await self.upload_video_from_path(context, file_path, title=title)+cdn_meta = await wechat_cdn.upload_image_to_cdn(self.config.base_url,self.config.bot_token,+ getattr(self.config, "cdn_base_url", self.config.base_url),+ context.user_id,file_path,proxy=self.config.proxy_url,)@@ -656,13 +784,18 @@ class WeChatBot(BaseIMClient):{"type": 2, # IMAGE"image_item": {- "media": cdn_meta,+ "media": {+ "encrypt_query_param": cdn_meta.get("encrypt_query_param", ""),+ "aes_key": cdn_meta.get("aes_key", ""),+ "encrypt_type": 1,+ },+ "mid_size": cdn_meta.get("file_size_ciphertext", 0),},}]try:- await wechat_api.send_message(+ resp = await wechat_api.send_message(self.config.base_url,self.config.bot_token,user_id,@@ -670,12 +803,72 @@ class WeChatBot(BaseIMClient):item_list,proxy=self.config.proxy_url,)+ if _is_session_expired_code(_get_wechat_error_code(resp)):+ self._mark_session_expired(_get_wechat_error_code(resp))+ _raise_if_wechat_api_error(resp, "send image message")except Exception as exc:logger.error("WeChat send image message error: %s", exc)return ""return cdn_meta.get("file_id", f"wc-img-{uuid.uuid4().hex[:8]}")+ async def upload_video_from_path(+ self,+ context: MessageContext,+ file_path: str,+ title: Optional[str] = None,+ ) -> str:+ """Upload a video via CDN and send it as a native video message."""++ cdn_meta = await wechat_cdn.upload_file_to_cdn(+ self.config.base_url,+ self.config.bot_token,+ getattr(self.config, "cdn_base_url", self.config.base_url),+ context.user_id,+ file_path,+ media_type=_wechat_api_mod.UPLOAD_MEDIA_VIDEO,+ )+ if cdn_meta is None:+ logger.error("Failed to upload video to CDN: %s", file_path)+ return ""++ user_id = context.user_id+ context_token = self._get_context_token(context)+ display_name = title or Path(file_path).name++ item_list = [+ {+ "type": 5, # VIDEO+ "video_item": {+ "media": {+ "encrypt_query_param": cdn_meta.get("encrypt_query_param", ""),+ "aes_key": cdn_meta.get("aes_key", ""),+ "encrypt_type": 1,+ },+ "video_size": cdn_meta.get("file_size_ciphertext", 0),+ },+ "file_name": display_name,+ }+ ]++ try:+ resp = await wechat_api.send_message(+ self.config.base_url,+ self.config.bot_token,+ user_id,+ context_token,+ item_list,+ proxy=self.config.proxy_url,+ )+ if _is_session_expired_code(_get_wechat_error_code(resp)):+ self._mark_session_expired(_get_wechat_error_code(resp))+ _raise_if_wechat_api_error(resp, "send video message")+ except Exception as exc:+ logger.error("WeChat send video message error: %s", exc)+ return ""++ return cdn_meta.get("file_id", f"wc-video-{uuid.uuid4().hex[:8]}")+async def download_file_to_path(self,file_info: Dict[str, Any],@@ -687,6 +880,7 @@ class WeChatBot(BaseIMClient):success = await wechat_cdn.download_and_decrypt(self.config.base_url,self.config.bot_token,+ getattr(self.config, "cdn_base_url", self.config.base_url),file_info,target_path,proxy=self.config.proxy_url,@@ -850,6 +1044,28 @@ class WeChatBot(BaseIMClient):# Persist sync buffer so we don't re-process old messages on restartself._save_sync_buf()+ @staticmethod+ def _normalize_poll_timeout(timeout_ms: Any) -> int:+ try:+ value = int(timeout_ms)+ except (TypeError, ValueError):+ return _POLL_TIMEOUT_MS+ return max(_MIN_POLL_TIMEOUT_MS, min(_MAX_POLL_TIMEOUT_MS, value))++ def _mark_session_expired(self, errcode: Any) -> None:+ self._auth_manager.is_logged_in = False+ self._typing_tickets.clear()+ if not self._session_expired_logged:+ logger.error(+ "WeChat session expired (errcode %s); re-authentication required via the Web UI QR login",+ errcode,+ )+ self._session_expired_logged = True++ def _mark_session_active(self) -> None:+ self._auth_manager.is_logged_in = True+ self._session_expired_logged = False+# ------------------------------------------------------------------# Long-poll loop# ------------------------------------------------------------------@@ -864,7 +1080,7 @@ class WeChatBot(BaseIMClient):self.config.base_url,self.config.bot_token,self._sync_buf,- timeout_ms=_POLL_TIMEOUT_MS,+ timeout_ms=self._poll_timeout_ms,proxy=self.config.proxy_url,)@@ -879,12 +1095,8 @@ class WeChatBot(BaseIMClient):)# Handle session expired- if errcode == _SESSION_EXPIRED_ERRCODE:- logger.error(- "WeChat session expired (errcode %s); re-authentication required",- errcode,- )- self._auth_manager.is_logged_in = False+ if _is_session_expired_code(errcode):+ self._mark_session_expired(errcode)consecutive_failures += 1if consecutive_failures >= _MAX_CONSECUTIVE_FAILURES:@@ -901,6 +1113,18 @@ class WeChatBot(BaseIMClient):# Success pathconsecutive_failures = 0+ self._mark_session_active()++ suggested_timeout_ms = resp.get("longpolling_timeout_ms")+ if suggested_timeout_ms is not None:+ next_timeout_ms = self._normalize_poll_timeout(suggested_timeout_ms)+ if next_timeout_ms != self._poll_timeout_ms:+ logger.info(+ "WeChat long-poll timeout adjusted from %sms to %sms",+ self._poll_timeout_ms,+ next_timeout_ms,+ )+ self._poll_timeout_ms = next_timeout_ms# Update sync cursornew_buf = resp.get("get_updates_buf", "")@@ -993,10 +1217,14 @@ class WeChatBot(BaseIMClient):text=text,settings_manager=self.settings_manager,)- if auth_result is not None and auth_result is not True:- # auth_result is a denial reason string+ if not auth_result.allowed:+ logger.info(+ "Dropping unauthorized WeChat message from=%s denial=%s",+ from_user,+ auth_result.denial,+ )denial_text = self.build_auth_denial_text(- auth_result,+ auth_result.denial,channel_id=from_user,)if denial_text:@@ -1042,15 +1270,56 @@ class WeChatBot(BaseIMClient):The ``type`` field is an integer: 1=TEXT, 2=IMAGE, 3=VOICE, 4=FILE, 5=VIDEO."""text_parts: List[str] = []+ quoted_title = ""for item in msg.get("item_list", []):item_type = item.get("type", 0)- # type 1 = TEXTif item_type == 1 or item_type in ("TEXT", "text"):- content = item.get("content", "")+ text_item = item.get("text_item") or {}+ content = text_item.get("text") or item.get("content", "")if content:- text_parts.append(content)+ text_parts.append(str(content))+ ref_msg = item.get("ref_msg") or {}+ quoted_title = quoted_title or str(ref_msg.get("title") or "").strip()+ continue+ if item_type == 3 or item_type in ("VOICE", "voice"):+ voice_item = item.get("voice_item") or {}+ content = voice_item.get("text", "")+ if content:+ playtime_ms = voice_item.get("playtime")+ seconds = 0.0+ try:+ seconds = max(0.0, float(str(playtime_ms)) / 1000.0)+ except (TypeError, ValueError):+ seconds = 0.0+ prefix = f"[Voice {seconds:.1f}s] " if seconds > 0 else "[Voice] "+ text_parts.append(prefix + str(content))++ text = " ".join(text_parts).strip()+ if quoted_title:+ if text:+ return f"{text}\n[Quoted message: {quoted_title}]"+ return f"[Quoted message: {quoted_title}]"+ return text- return " ".join(text_parts).strip()+ @staticmethod+ def _extract_reference_media_item(msg: dict) -> Optional[dict]:+ for item in msg.get("item_list", []):+ if item.get("type", 0) not in (1, "TEXT", "text"):+ continue+ ref_msg = item.get("ref_msg") or {}+ ref_item = ref_msg.get("message_item") or {}+ ref_type = ref_item.get("type", 0)+ if ref_type == 2 and (ref_item.get("image_item") or {}).get("media", {}).get("encrypt_query_param"):+ return ref_item+ if ref_type == 5 and (ref_item.get("video_item") or {}).get("media", {}).get("encrypt_query_param"):+ return ref_item+ if ref_type == 4 and (ref_item.get("file_item") or {}).get("media", {}).get("encrypt_query_param"):+ return ref_item+ if ref_type == 3:+ voice_item = ref_item.get("voice_item") or {}+ if (voice_item.get("media") or {}).get("encrypt_query_param") and not voice_item.get("text"):+ return ref_item+ return Noneasync def _process_media_items(self,@@ -1061,34 +1330,59 @@ class WeChatBot(BaseIMClient):if context.files is None:context.files = []+ processed_any = False+for item in msg.get("item_list", []):item_type = item.get("type", 0)- # 2=IMAGE, 3=VOICE, 4=FILE, 5=VIDEO- type_name_map = {2: "IMAGE", 3: "VOICE", 4: "FILE", 5: "VIDEO"}- type_name = type_name_map.get(item_type)- if type_name is None:+ item_data: Dict[str, Any] = {}+ media: Dict[str, Any] = {}+ file_name = ""+ size: Optional[int] = None+ mimetype = "application/octet-stream"++ if item_type == 2:+ item_data = item.get("image_item") or {}+ media = item_data.get("media") or {}+ file_name = item.get("file_name", "") or "wechat_image.jpg"+ mimetype = "image/jpeg"+ elif item_type == 3:+ item_data = item.get("voice_item") or {}+ media = item_data.get("media") or {}+ file_name = item.get("file_name", "") or "wechat_voice.silk"+ mimetype = "audio/silk"+ elif item_type == 4:+ item_data = item.get("file_item") or {}+ media = item_data.get("media") or {}+ file_name = item_data.get("file_name", "") or item.get("file_name", "")+ try:+ size = int(item_data.get("len", 0)) or None+ except (TypeError, ValueError):+ size = None+ mimetype = "application/octet-stream"+ elif item_type == 5:+ item_data = item.get("video_item") or {}+ media = item_data.get("media") or {}+ file_name = item.get("file_name", "") or "wechat_video.mp4"+ mimetype = "video/mp4"+ else:continue- cdn_info = item.get("cdn", {})- file_name = item.get("content", "") or item.get("file_name", "")-- mime_map = {- "IMAGE": "image/jpeg",- "FILE": "application/octet-stream",- "VIDEO": "video/mp4",- "VOICE": "audio/amr",- }- mimetype = mime_map.get(type_name, "application/octet-stream")-attachment = FileAttachment(- name=file_name or f"{type_name.lower()}_attachment",+ name=file_name or f"wechat_{item_type}_attachment",mimetype=mimetype,- url=cdn_info.get("url", ""),- size=cdn_info.get("file_size"),+ url=media.get("encrypt_query_param", ""),+ size=size,)# Store CDN info for later download- attachment.__dict__["cdn_info"] = cdn_info+ attachment.__dict__["cdn_info"] = media+ attachment.__dict__["wechat_item"] = item_datacontext.files.append(attachment)+ processed_any = True++ if not processed_any:+ ref_item = self._extract_reference_media_item(msg)+ if ref_item:+ await self._process_media_items({"item_list": [ref_item]}, context)# ------------------------------------------------------------------# Deduplicationdiff --git a/modules/im/wechat_cdn.py b/modules/im/wechat_cdn.pyindex afe4a4c9e..be5105ba4 100644--- a/modules/im/wechat_cdn.py+++ b/modules/im/wechat_cdn.py@@ -293,6 +293,25 @@ async def download_and_decrypt(return decrypted+async def download_plain(+ cdn_base_url: str,+ encrypted_query_param: str,+) -> bytes:+ """Download raw CDN bytes without decryption."""++ url = _build_cdn_download_url(cdn_base_url, encrypted_query_param)+ logger.debug("CDN plain download: GET %s", url[:80])++ timeout = aiohttp.ClientTimeout(total=60)+ async with aiohttp.ClientSession(timeout=timeout) as session:+ async with session.get(url) as resp:+ logger.debug("CDN plain download: status=%d", resp.status)+ if not resp.ok:+ body = await resp.text()+ raise RuntimeError(f"CDN download {resp.status} {resp.reason}: {body[:200]}")+ return await resp.read()++# ---------------------------------------------------------------------------# High-level upload workflows# ---------------------------------------------------------------------------diff --git a/tests/test_api_save_config_merge.py b/tests/test_api_save_config_merge.pyindex 521742ef9..4425aad0b 100644--- a/tests/test_api_save_config_merge.py+++ b/tests/test_api_save_config_merge.py@@ -95,3 +95,11 @@ def test_save_config_merges_partial_payload(monkeypatch, tmp_path):assert updated.discord is not Noneassert updated.discord.bot_token == "discord-token-1234567890"assert updated.runtime.default_cwd == "/tmp/workdir"+++def test_save_config_accepts_typing_ack_mode(monkeypatch, tmp_path):+ monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))++ updated = api.save_config({**_full_config_payload(), "ack_mode": "typing"})++ assert updated.ack_mode == "typing"diff --git a/tests/test_command_handler_user_names.py b/tests/test_command_handler_user_names.pyindex 2205104a1..b266e9bb9 100644--- a/tests/test_command_handler_user_names.py+++ b/tests/test_command_handler_user_names.py@@ -13,8 +13,10 @@ sys.path.insert(0, str(ROOT))def _load_command_handlers_class():agents_module = types.ModuleType("modules.agents")- agents_module.AgentRequest = type("AgentRequest", (), {})- agents_module.get_agent_display_name = lambda agent_name, fallback=None: agent_name or fallback or "Unknown"+ setattr(agents_module, "AgentRequest", type("AgentRequest", (), {}))+ setattr(+ agents_module, "get_agent_display_name", lambda agent_name, fallback=None: agent_name or fallback or "Unknown"+ )sys.modules["modules.agents"] = agents_modulecore_pkg = types.ModuleType("core")@@ -76,10 +78,14 @@ class _StubController:self.sessions = self.settings_managerself.session_manager = object()self.receiver_tasks = {}+ self.agent_service = type("AgentService", (), {"default_agent": "codex"})()def _get_settings_key(self, context: MessageContext) -> str:return context.user_id if context.channel_id.startswith("D") else context.channel_id+ def resolve_agent_for_context(self, context: MessageContext) -> str:+ return "codex"+class CommandHandlerUserNameTests(unittest.IsolatedAsyncioTestCase):async def test_bind_success_prefers_real_name_when_display_name_blank(self):@@ -106,6 +112,42 @@ class CommandHandlerUserNameTests(unittest.IsolatedAsyncioTestCase):[("D123", "✅ 绑定成功!欢迎,Alex。你现在可以通过私信使用 Vibe Remote。")],)+ async def test_wechat_start_message_uses_localized_compact_commands(self):+ controller = _StubController({"display_name": "小王"})+ setattr(controller.config, "platform", "wechat")+ handler = CommandHandlers(controller)+ context = MessageContext(user_id="wx-user", channel_id="wx-chat")++ await handler.handle_start(context)++ self.assertEqual(len(controller.im_client.sent_messages), 1)+ _, message = controller.im_client.sent_messages[0]+ self.assertIn("欢迎使用 Vibe Remote!", message)+ self.assertIn("你好 小王!", message)+ self.assertIn("/start - 显示欢迎消息", message)+ self.assertIn("/setcwd <路径> - 设置工作目录", message)+ self.assertIn("/new - 开启一个全新的会话", message)+ self.assertNotIn("User ID", message)+ self.assertNotIn("How it works", message)+ self.assertNotIn("频道:", message)++ async def test_new_command_sends_fresh_session_confirmation(self):+ controller = _StubController({"display_name": "小王"})+ controller.agent_service.clear_sessions = _clear_sessions # type: ignore[attr-defined]+ handler = CommandHandlers(controller)+ context = MessageContext(user_id="wx-user", channel_id="wx-chat")++ await handler.handle_new(context)++ self.assertEqual(+ controller.im_client.sent_messages,+ [("wx-chat", "🆕 已开启新的会话。你下一条消息会从全新对话开始。")],+ )+++async def _clear_sessions(_settings_key):+ return {}+if __name__ == "__main__":unittest.main()diff --git a/tests/test_im_base_auth.py b/tests/test_im_base_auth.pyindex 3ca9ee8d4..b252abf27 100644--- a/tests/test_im_base_auth.py+++ b/tests/test_im_base_auth.py@@ -70,6 +70,7 @@ class _SettingsManager:def test_extract_command_action():assert BaseIMClient.extract_command_action("/settings") == "settings"+ assert BaseIMClient.extract_command_action("/setcwd /tmp") == "set_cwd"assert BaseIMClient.extract_command_action("/set_cwd /tmp") == "set_cwd"assert BaseIMClient.extract_command_action("bind code") == ""assert BaseIMClient.extract_command_action("bind code", allow_plain_bind=True) == "bind"@@ -79,6 +80,7 @@ def test_extract_command_action():def test_parse_text_command():assert BaseIMClient.parse_text_command("/settings") == ("settings", "")+ assert BaseIMClient.parse_text_command("/setcwd /tmp") == ("set_cwd", "/tmp")assert BaseIMClient.parse_text_command("/set_cwd /tmp") == ("set_cwd", "/tmp")assert BaseIMClient.parse_text_command("bind code") is Noneassert BaseIMClient.parse_text_command("bind code", allow_plain_bind=True) == ("bind", "code")diff --git a/tests/test_message_dispatcher_file_uploads.py b/tests/test_message_dispatcher_file_uploads.pyindex 5fcf796f7..74682f0f2 100644--- a/tests/test_message_dispatcher_file_uploads.py+++ b/tests/test_message_dispatcher_file_uploads.py@@ -19,6 +19,7 @@ class _StubIMClient:def __init__(self):self.file_uploads = []self.image_uploads = []+ self.video_uploads = []async def upload_file_from_path(self, context, file_path, title=None):self.file_uploads.append((context.channel_id, file_path, title))@@ -26,6 +27,9 @@ class _StubIMClient:async def upload_image_from_path(self, context, file_path, title=None):self.image_uploads.append((context.channel_id, file_path, title))+ async def upload_video_from_path(self, context, file_path, title=None):+ self.video_uploads.append((context.channel_id, file_path, title))+class MessageDispatcherFileUploadTests(unittest.IsolatedAsyncioTestCase):async def test_upload_file_link_allows_path_outside_cwd(self):@@ -65,6 +69,27 @@ class MessageDispatcherFileUploadTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(im_client.file_uploads, [])self.assertEqual(im_client.image_uploads, [("C1", resolved_path, "preview.png")])+ self.assertEqual(im_client.video_uploads, [])++ async def test_upload_video_link_uses_video_channel_even_for_image_syntax(self):+ dispatcher = ConsolidatedMessageDispatcher(_StubController())+ im_client = _StubIMClient()+ context = MessageContext(user_id="U1", channel_id="C1")++ with tempfile.TemporaryDirectory() as tmpdir:+ video_path = Path(tmpdir) / "clip.mp4"+ video_path.write_bytes(b"mp4")+ resolved_path = str(video_path.resolve())++ await dispatcher._upload_file_links(+ im_client,+ context,+ [FileLink(label="preview", path=str(video_path), is_image=True)],+ )++ self.assertEqual(im_client.file_uploads, [])+ self.assertEqual(im_client.image_uploads, [])+ self.assertEqual(im_client.video_uploads, [("C1", resolved_path, "preview.mp4")])if __name__ == "__main__":diff --git a/tests/test_message_handler_attachments.py b/tests/test_message_handler_attachments.pyindex bd7e18104..c134b4e85 100644--- a/tests/test_message_handler_attachments.py+++ b/tests/test_message_handler_attachments.py@@ -185,6 +185,30 @@ class MessageHandlerAttachmentTests(unittest.IsolatedAsyncioTestCase):)self.assertEqual(residual_files, [])+ async def test_process_file_attachments_preserves_platform_metadata(self):+ im_client = _StubIMClient(download_result=b"img", stream_result=True)+ handler = MessageHandler(_StubController(im_client))+ attachment = FileAttachment(+ name="wechat_image.jpg",+ mimetype="image/jpeg",+ url="encrypted-param",+ size=123,+ )+ attachment.__dict__["cdn_info"] = {"encrypt_query_param": "encrypted-param", "aes_key": "abc"}+ attachment.__dict__["wechat_item"] = {"aeskey": "00112233445566778899aabbccddeeff"}+ context = MessageContext(user_id="U1", channel_id="C1", files=[attachment])++ with tempfile.TemporaryDirectory() as tmpdir:+ with patch("config.paths.get_attachments_dir", return_value=Path(tmpdir)):+ processed, errors = await handler._process_file_attachments(context, "/tmp/work")++ self.assertIsNotNone(processed)+ self.assertEqual(errors, [])+ self.assertEqual(len(im_client.stream_calls), 1)+ file_info = im_client.stream_calls[0][0]+ self.assertEqual(file_info["cdn_info"]["encrypt_query_param"], "encrypted-param")+ self.assertEqual(file_info["wechat_item"]["aeskey"], "00112233445566778899aabbccddeeff")+def test_append_attachment_errors_uses_error_text_without_file_paths(self):handler = MessageHandler(_StubController(_StubIMClient()))diff --git a/tests/test_message_handler_typing.py b/tests/test_message_handler_typing.pynew file mode 100644index 000000000..fb09cc2fb--- /dev/null+++ b/tests/test_message_handler_typing.py@@ -0,0 +1,197 @@+import asyncio+import importlib.util+import sys+import types+import unittest+from dataclasses import dataclass+from pathlib import Path+from unittest.mock import patch++ROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(ROOT))++from modules.im import MessageContext+++def _load_message_handler_class():+ with patch.dict(sys.modules, {}, clear=False):+ agents_module = types.ModuleType("modules.agents")++ @dataclass+ class _AgentRequest:+ context: MessageContext+ message: str+ working_path: str+ base_session_id: str+ composite_session_id: str+ settings_key: str+ ack_message_id: str | None = None+ subagent_name: str | None = None+ subagent_key: str | None = None+ subagent_model: str | None = None+ subagent_reasoning_effort: str | None = None+ ack_reaction_message_id: str | None = None+ ack_reaction_emoji: str | None = None+ typing_indicator_active: bool = False+ typing_indicator_task: asyncio.Task | None = None+ files: list | None = None++ setattr(agents_module, "AgentRequest", _AgentRequest)+ sys.modules["modules.agents"] = agents_module++ core_pkg = types.ModuleType("core")+ core_pkg.__path__ = [str(ROOT / "core")]+ sys.modules["core"] = core_pkg++ handlers_pkg = types.ModuleType("core.handlers")+ handlers_pkg.__path__ = [str(ROOT / "core" / "handlers")]+ sys.modules["core.handlers"] = handlers_pkg++ base_name = "core.handlers.base"+ base_spec = importlib.util.spec_from_file_location(base_name, ROOT / "core" / "handlers" / "base.py")+ assert base_spec is not None+ assert base_spec.loader is not None+ base_module = importlib.util.module_from_spec(base_spec)+ sys.modules[base_name] = base_module+ base_spec.loader.exec_module(base_module)++ module_name = "core.handlers.message_handler"+ spec = importlib.util.spec_from_file_location(module_name, ROOT / "core" / "handlers" / "message_handler.py")+ assert spec is not None+ assert spec.loader is not None+ module = importlib.util.module_from_spec(spec)+ sys.modules[module_name] = module+ spec.loader.exec_module(module)+ return module.MessageHandler+++MessageHandler = _load_message_handler_class()+++class _StubSessions:+ def is_message_already_processed(self, channel_id, thread_ts, message_ts):+ return False++ def record_processed_message(self, channel_id, thread_ts, message_ts):+ return None+++class _StubSettingsManager:+ def __init__(self):+ self.sessions = _StubSessions()++ def get_channel_routing(self, settings_key):+ return None+++class _StubIMClient:+ def __init__(self, *, typing_result: bool):+ self.typing_result = typing_result+ self.typing_calls = []+ self.clear_calls = []+ self.reactions = []+ self.sent_messages = []+ self.formatter = None++ def should_use_thread_for_reply(self):+ return False++ async def send_typing_indicator(self, context):+ self.typing_calls.append((context.channel_id, context.user_id))+ return self.typing_result++ async def clear_typing_indicator(self, context):+ self.clear_calls.append((context.channel_id, context.user_id))+ return True++ async def add_reaction(self, context, message_id, emoji):+ self.reactions.append((context.channel_id, message_id, emoji))+ return True++ async def remove_reaction(self, context, message_id, emoji):+ self.reactions.append((context.channel_id, message_id, f"remove:{emoji}"))+ return True++ async def send_message(self, context, text, parse_mode=None, reply_to=None):+ self.sent_messages.append((context.channel_id, text))+ return "msg-1"+++class _StubAgentService:+ def __init__(self):+ self.default_agent = "codex"+ self.requests = []++ async def handle_message(self, agent_name, request):+ self.requests.append((agent_name, request))+++class _StubController:+ def __init__(self, *, platform: str, ack_mode: str, typing_result: bool):+ self.config = type(+ "Config",+ (),+ {"platform": platform, "ack_mode": ack_mode, "include_user_info": False, "language": "en"},+ )()+ self.im_client = _StubIMClient(typing_result=typing_result)+ self.settings_manager = _StubSettingsManager()+ self.session_manager = object()+ self.receiver_tasks = {}+ self.agent_service = _StubAgentService()+ self.command_handler = type("Cmd", (), {"handle_start": staticmethod(lambda context, args: None)})()++ def update_thread_message_id(self, context):+ return None++ def resolve_agent_for_context(self, context):+ return "codex"++ def _get_settings_key(self, context):+ return context.channel_id++ def _get_lang(self):+ return "en"+++class _StubSessionHandler:+ @staticmethod+ def get_session_info(context):+ return ("base-session", "/tmp", "base-session:/tmp")+++class MessageHandlerTypingTests(unittest.IsolatedAsyncioTestCase):+ async def test_wechat_forces_typing_even_when_ack_mode_is_message(self):+ controller = _StubController(platform="wechat", ack_mode="message", typing_result=True)+ handler = MessageHandler(controller)+ handler.set_session_handler(_StubSessionHandler())+ context = MessageContext(user_id="U1", channel_id="C1", message_id="m1")++ await handler.handle_user_message(context, "hello")++ _, request = controller.agent_service.requests[0]+ self.assertIsNone(request.ack_message_id)+ self.assertTrue(request.typing_indicator_active)+ self.assertEqual(controller.im_client.sent_messages, [])+ self.assertEqual(controller.im_client.reactions, [])+ self.assertGreaterEqual(len(controller.im_client.typing_calls), 1)++ await handler._remove_ack_reaction(context, request)+ self.assertEqual(controller.im_client.clear_calls, [("C1", "U1")])++ async def test_typing_mode_falls_back_to_reaction_when_platform_lacks_typing(self):+ controller = _StubController(platform="slack", ack_mode="typing", typing_result=False)+ handler = MessageHandler(controller)+ handler.set_session_handler(_StubSessionHandler())+ context = MessageContext(user_id="U1", channel_id="C1", message_id="m1")++ await handler.handle_user_message(context, "hello")++ _, request = controller.agent_service.requests[0]+ self.assertFalse(request.typing_indicator_active)+ self.assertEqual(request.ack_reaction_message_id, "m1")+ self.assertEqual(request.ack_reaction_emoji, ":eyes:")+ self.assertEqual(controller.im_client.reactions, [("C1", "m1", ":eyes:")])+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/test_opencode_question_handler.py b/tests/test_opencode_question_handler.pyindex b0c08b442..988a92440 100644--- a/tests/test_opencode_question_handler.py+++ b/tests/test_opencode_question_handler.py@@ -83,8 +83,9 @@ class _StubConfig:class _StubController:- def __init__(self, lang="zh"):+ def __init__(self, lang="zh", platform="slack"):self.config = _StubConfig(language=lang)+ self.config.platform = platformself.emitted_messages = []self.cleared_consolidated_ids = []@@ -102,11 +103,16 @@ class _StubServer:def __init__(self, ok=True):self.ok = okself.reply_calls = []+ self.abort_calls = []async def reply_question(self, question_id, directory, answers_payload):self.reply_calls.append((question_id, directory, answers_payload))return self.ok+ async def abort_session(self, session_id, directory):+ self.abort_calls.append((session_id, directory))+ return True+def _build_request(message: str) -> AgentRequest:return AgentRequest(@@ -154,6 +160,34 @@ class OpenCodeQuestionHandlerTests(unittest.IsolatedAsyncioTestCase):self.assertEqual(controller.cleared_consolidated_ids, [("C123", "T123", "TRIGGER1")])self.assertTrue(handler._question_answer_events[request.base_session_id].is_set())+ async def test_handle_question_toolcall_is_blocked_on_wechat(self):+ controller = _StubController(lang="zh", platform="wechat")+ im_client = _StubIMClient()+ handler = OpenCodeQuestionHandler(controller, im_client, object())+ server = _StubServer(ok=True)+ request = _build_request("ask")+ seen_tool_calls = set()++ answered = await handler.handle_question_toolcall(+ request=request,+ server=server,+ opencode_session_id="oc-session",+ message_id="msg-1",+ tool_part={"callID": "call-1"},+ tool_input={"questions": [{"question": "Need input?"}]},+ call_key="call-1",+ seen_tool_calls=seen_tool_calls,+ )++ self.assertFalse(answered)+ self.assertEqual(server.abort_calls, [("oc-session", "/tmp/work")])+ self.assertEqual(+ controller.emitted_messages,+ [("C123", "notify", "微信平台暂时不支持 OpenCode 的交互式提问。请直接再发一条消息继续。", None)],+ )+ self.assertEqual(im_client.sent_messages, [])+ self.assertIn("call-1", seen_tool_calls)+class QuestionUIHandlerTests(unittest.IsolatedAsyncioTestCase):async def test_send_answer_receipt_formats_multi_question_answers(self):diff --git a/tests/test_opencode_server.py b/tests/test_opencode_server.pynew file mode 100644index 000000000..f0c4b278e--- /dev/null+++ b/tests/test_opencode_server.py@@ -0,0 +1,57 @@+import sys+import unittest+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))++from modules.agents.opencode.server import OpenCodeServerManager+++class _FakeResponse:+ def __init__(self, *, status: int = 204, text: str = ""):+ self.status = status+ self._text = text++ async def __aenter__(self):+ return self++ async def __aexit__(self, exc_type, exc, tb):+ return False++ async def text(self):+ return self._text+++class _FakeSession:+ def __init__(self):+ self.posts = []++ def post(self, url, json=None, headers=None):+ self.posts.append({"url": url, "json": json, "headers": headers})+ return _FakeResponse()+++class OpenCodeServerTests(unittest.IsolatedAsyncioTestCase):+ async def test_prompt_async_includes_tools_when_provided(self):+ manager = OpenCodeServerManager(binary="opencode", port=4096)+ fake_session = _FakeSession()++ async def _fake_get_http_session():+ return fake_session++ manager._get_http_session = _fake_get_http_session # type: ignore[method-assign]++ await manager.prompt_async(+ session_id="ses-1",+ directory="/tmp/work",+ text="hello",+ tools={"question": False},+ )++ self.assertEqual(len(fake_session.posts), 1)+ body = fake_session.posts[0]["json"]+ self.assertEqual(body["tools"], {"question": False})+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.pynew file mode 100644index 000000000..50326c708--- /dev/null+++ b/tests/test_reply_enhancer_platform.py@@ -0,0 +1,90 @@+import sys+import unittest+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))++from core.message_dispatcher import ConsolidatedMessageDispatcher+from core.reply_enhancer import build_reply_enhancements_prompt, process_reply+from modules.im import MessageContext+++class _StubSettingsManager:+ @staticmethod+ def _canonicalize_message_type(message_type: str) -> str:+ return message_type++ @staticmethod+ def is_message_type_hidden(settings_key: str, message_type: str) -> bool:+ return False+++class _StubIMClient:+ def __init__(self):+ self.sent_messages = []+ self.sent_button_messages = []++ @staticmethod+ def should_use_thread_for_reply() -> bool:+ return False++ async def send_message(self, context, text, parse_mode=None, reply_to=None):+ self.sent_messages.append((context.channel_id, text, parse_mode))+ return "msg-1"++ async def send_message_with_buttons(self, context, text, keyboard, parse_mode=None):+ self.sent_button_messages.append((context.channel_id, text, parse_mode, keyboard))+ return "btn-1"+++class _StubController:+ def __init__(self, platform: str):+ self.config = type(+ "Config",+ (),+ {"platform": platform, "reply_enhancements": True},+ )()+ self.settings_manager = _StubSettingsManager()+ self.im_client = _StubIMClient()++ @staticmethod+ def _get_settings_key(context: MessageContext) -> str:+ return f"{context.channel_id}:{context.user_id}"+++class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):+ def test_prompt_can_exclude_quick_replies(self):+ prompt = build_reply_enhancements_prompt(include_quick_replies=False)++ self.assertIn("## 1. Send files", prompt)+ self.assertNotIn("## 2. Quick-reply buttons", prompt)++ def test_file_links_with_parentheses_are_preserved(self):+ enhanced = process_reply(".mp4)")++ self.assertEqual(len(enhanced.files), 1)+ self.assertEqual(+ enhanced.files[0].path,+ "/Users/test/SaveTwitter.Net_GABV3XNWYAARAZz(gif).mp4",+ )++ async def test_wechat_result_ignores_quick_reply_buttons(self):+ controller = _StubController("wechat")+ dispatcher = ConsolidatedMessageDispatcher(controller)+ context = MessageContext(user_id="U1", channel_id="C1")++ await dispatcher.emit_agent_message(+ context,+ "result",+ "Done.\n---\n[继续] | [提交PR]",+ )++ self.assertEqual(controller.im_client.sent_button_messages, [])+ self.assertEqual(+ controller.im_client.sent_messages,+ [("C1", "Done.", "markdown")],+ )+++if __name__ == "__main__":+ unittest.main()diff --git a/tests/test_wechat_bot.py b/tests/test_wechat_bot.pynew file mode 100644index 000000000..a44be9470--- /dev/null+++ b/tests/test_wechat_bot.py@@ -0,0 +1,319 @@+import unittest+from unittest.mock import AsyncMock+from pathlib import Path+import sys+import tempfile+from unittest.mock import patch++sys.path.insert(0, str(Path(__file__).resolve().parents[1]))++from core.auth import AuthResult+from modules.im import MessageContext+from modules.im.wechat import WeChatBot, WeChatConfig+++class WeChatBotTests(unittest.IsolatedAsyncioTestCase):+ def _make_bot(self) -> WeChatBot:+ bot = WeChatBot(WeChatConfig(bot_token="token", base_url="https://ilinkai.weixin.qq.com"))+ setattr(bot.config, "cdn_base_url", "https://novac2c.cdn.weixin.qq.com/c2c")+ return bot++ def test_extract_text_reads_text_item_and_voice_text(self):+ msg = {+ "item_list": [+ {"type": 1, "text_item": {"text": "hello"}},+ {"type": 3, "voice_item": {"text": "world", "playtime": 2300}},+ ]+ }++ self.assertEqual(WeChatBot._extract_text(msg), "hello [Voice 2.3s] world")++ def test_extract_text_appends_quoted_message_title(self):+ msg = {+ "item_list": [+ {+ "type": 1,+ "text_item": {"text": "look at this"},+ "ref_msg": {"title": "quoted image summary"},+ }+ ]+ }++ self.assertEqual(WeChatBot._extract_text(msg), "look at this\n[Quoted message: quoted image summary]")++ def test_normalize_poll_timeout_clamps_values(self):+ self.assertEqual(WeChatBot._normalize_poll_timeout("70000"), 60000)+ self.assertEqual(WeChatBot._normalize_poll_timeout("1000"), 5000)+ self.assertEqual(WeChatBot._normalize_poll_timeout("abc"), 35000)++ async def test_get_user_info_uses_short_fixed_display_name(self):+ bot = self._make_bot()++ result = await bot.get_user_info("[email protected]")++ self.assertEqual(result["display_name"], "WeChat User")+ self.assertEqual(result["real_name"], "WeChat User")+ self.assertEqual(result["name"], "WeChat User")++ async def test_send_typing_indicator_fetches_typing_ticket(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with patch(+ "modules.im.wechat.wechat_api.get_config",+ new=AsyncMock(return_value={"ret": 0, "typing_ticket": "ticket-1"}),+ ) as mock_cfg:+ with patch("modules.im.wechat.wechat_api.send_typing", new=AsyncMock(return_value=True)) as mock_typing:+ result = await bot.send_typing_indicator(context)++ self.assertTrue(result)+ mock_cfg.assert_awaited_once()+ mock_typing.assert_awaited_once()++ async def test_clear_typing_indicator_uses_cached_ticket(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})+ bot._typing_tickets[("user-1", "ctx-1")] = "ticket-1"++ with patch("modules.im.wechat.wechat_api.send_typing", new=AsyncMock(return_value=True)) as mock_typing:+ result = await bot.clear_typing_indicator(context)++ self.assertTrue(result)+ args = mock_typing.await_args.args # type: ignore[union-attr]+ self.assertEqual(args[3], "ticket-1")++ async def test_process_inbound_message_dispatches_allowed_message(self):+ bot = self._make_bot()+ bot.check_authorization = lambda **kwargs: AuthResult(allowed=True, is_dm=True)+ bot.dispatch_text_command = AsyncMock(return_value=False)+ bot._process_media_items = AsyncMock(return_value=None)+ bot.on_message_callback = AsyncMock()++ msg = {+ "message_id": "mid-1",+ "from_user_id": "user-1",+ "context_token": "ctx-1",+ "item_list": [{"type": 1, "text_item": {"text": "hi"}}],+ }++ await bot._process_inbound_message(msg)++ bot.on_message_callback.assert_awaited_once()+ args = bot.on_message_callback.await_args.args # type: ignore[union-attr]+ self.assertEqual(args[0].user_id, "user-1")+ self.assertEqual(args[1], "hi")++ async def test_process_media_items_falls_back_to_referenced_media(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", files=[])+ msg = {+ "item_list": [+ {+ "type": 1,+ "text_item": {"text": "please review"},+ "ref_msg": {+ "title": "screenshot",+ "message_item": {+ "type": 2,+ "image_item": {+ "media": {+ "encrypt_query_param": "ref-param",+ "aes_key": "ref-key",+ }+ },+ },+ },+ }+ ]+ }++ await bot._process_media_items(msg, context)++ self.assertIsNotNone(context.files)+ self.assertEqual(len(context.files or []), 1)+ attachment = (context.files or [])[0]+ self.assertEqual(attachment.url, "ref-param")++ async def test_process_inbound_message_sends_denial_for_unauthorized_user(self):+ bot = self._make_bot()+ bot.check_authorization = lambda **kwargs: AuthResult(+ allowed=False,+ denial="unbound_dm",+ is_dm=True,+ )+ bot.dispatch_text_command = AsyncMock(return_value=False)+ bot._process_media_items = AsyncMock(return_value=None)+ bot.send_message = AsyncMock(return_value="wc-1")+ bot.on_message_callback = AsyncMock()++ msg = {+ "message_id": "mid-2",+ "from_user_id": "user-2",+ "context_token": "ctx-2",+ "item_list": [{"type": 1, "text_item": {"text": "hi"}}],+ }++ await bot._process_inbound_message(msg)++ bot.send_message.assert_awaited_once()+ bot.on_message_callback.assert_not_called()++ async def test_download_file_to_path_uses_encrypt_query_param_and_image_aeskey(self):+ bot = self._make_bot()++ file_info = {+ "name": "wechat_image.jpg",+ "url": "encrypted-param",+ "cdn_info": {"encrypt_query_param": "encrypted-param"},+ "wechat_item": {"aeskey": "00112233445566778899aabbccddeeff"},+ }++ with tempfile.TemporaryDirectory() as tmpdir:+ target_path = str(Path(tmpdir) / "wechat-test-image.bin")+ with patch(+ "modules.im.wechat._wechat_cdn_mod.download_and_decrypt", new=AsyncMock(return_value=b"img")+ ) as mock_dl:+ result = await bot.download_file_to_path(file_info, target_path)++ self.assertTrue(result.success)+ mock_dl.assert_awaited_once()+ args = mock_dl.await_args.args # type: ignore[union-attr]+ self.assertEqual(args[0], "https://novac2c.cdn.weixin.qq.com/c2c")+ self.assertEqual(args[1], "encrypted-param")+ self.assertTrue(isinstance(args[2], str) and len(args[2]) > 0)++ async def test_download_file_to_path_uses_voice_media_aes_key(self):+ bot = self._make_bot()++ file_info = {+ "name": "wechat_voice.silk",+ "url": "voice-param",+ "cdn_info": {"encrypt_query_param": "voice-param", "aes_key": "dm9pY2Uta2V5"},+ "wechat_item": {},+ }++ with tempfile.TemporaryDirectory() as tmpdir:+ target_path = str(Path(tmpdir) / "wechat-test-voice.bin")+ with patch(+ "modules.im.wechat._wechat_cdn_mod.download_and_decrypt", new=AsyncMock(return_value=b"voice")+ ) as mock_dl:+ result = await bot.download_file_to_path(file_info, target_path)++ self.assertTrue(result.success)+ mock_dl.assert_awaited_once_with(+ "https://novac2c.cdn.weixin.qq.com/c2c",+ "voice-param",+ "dm9pY2Uta2V5",+ )++ async def test_upload_image_from_path_uses_cdn_workflow(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with tempfile.TemporaryDirectory() as tmpdir:+ image_path = Path(tmpdir) / "photo.png"+ image_path.write_bytes(b"png")+ cdn_meta = {"encrypt_query_param": "p", "aes_key": "k", "file_size": 3, "file_size_ciphertext": 16}+ with patch(+ "modules.im.wechat.wechat_cdn.upload_image_to_cdn", new=AsyncMock(return_value=cdn_meta)+ ) as mock_upload:+ with patch("modules.im.wechat.wechat_api.send_message", new=AsyncMock(return_value={})) as mock_send:+ result = await bot.upload_image_from_path(context, str(image_path))++ self.assertTrue(result.startswith("wc-img-"))+ mock_upload.assert_awaited_once()+ mock_send.assert_awaited_once()+ sent_items = mock_send.await_args.args[4] # type: ignore[union-attr]+ self.assertEqual(sent_items[0]["image_item"]["media"]["encrypt_query_param"], "p")+ self.assertEqual(sent_items[0]["image_item"]["media"]["aes_key"], "k")+ self.assertEqual(sent_items[0]["image_item"]["media"]["encrypt_type"], 1)+ self.assertEqual(sent_items[0]["image_item"]["mid_size"], 16)++ async def test_send_message_accepts_empty_success_response(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with patch("modules.im.wechat.wechat_api.send_message", new=AsyncMock(return_value={})):+ result = await bot.send_message(context, "hello")++ self.assertTrue(result.startswith("wc-"))++ async def test_send_message_marks_session_expired_on_explicit_error(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})+ bot._auth_manager.is_logged_in = True++ with patch(+ "modules.im.wechat.wechat_api.send_message",+ new=AsyncMock(return_value={"errcode": -14, "errmsg": "session timeout"}),+ ):+ with self.assertRaises(RuntimeError):+ await bot.send_message(context, "hello")++ self.assertFalse(bot._auth_manager.is_logged_in)++ async def test_upload_file_from_path_uses_cdn_workflow(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with tempfile.TemporaryDirectory() as tmpdir:+ file_path = Path(tmpdir) / "report.pdf"+ file_path.write_bytes(b"pdf")+ cdn_meta = {"encrypt_query_param": "p", "aes_key": "k", "file_size": 3}+ with patch(+ "modules.im.wechat.wechat_cdn.upload_file_to_cdn", new=AsyncMock(return_value=cdn_meta)+ ) as mock_upload:+ with patch("modules.im.wechat.wechat_api.send_message", new=AsyncMock(return_value={})) as mock_send:+ result = await bot.upload_file_from_path(context, str(file_path), title="report.pdf")++ self.assertTrue(result.startswith("wc-file-"))+ mock_upload.assert_awaited_once()+ mock_send.assert_awaited_once()+ sent_items = mock_send.await_args.args[4] # type: ignore[union-attr]+ self.assertEqual(sent_items[0]["file_item"]["media"]["encrypt_query_param"], "p")+ self.assertEqual(sent_items[0]["file_item"]["media"]["aes_key"], "k")+ self.assertEqual(sent_items[0]["file_item"]["media"]["encrypt_type"], 1)+ self.assertEqual(sent_items[0]["file_item"]["file_name"], "report.pdf")+ self.assertEqual(sent_items[0]["file_item"]["len"], "3")++ async def test_upload_file_from_path_routes_video_to_native_video_message(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with tempfile.TemporaryDirectory() as tmpdir:+ file_path = Path(tmpdir) / "clip.mp4"+ file_path.write_bytes(b"mp4")+ cdn_meta = {"encrypt_query_param": "p", "aes_key": "k", "file_size_ciphertext": 12}+ with patch(+ "modules.im.wechat.wechat_cdn.upload_file_to_cdn", new=AsyncMock(return_value=cdn_meta)+ ) as mock_upload:+ with patch("modules.im.wechat.wechat_api.send_message", new=AsyncMock(return_value={})) as mock_send:+ result = await bot.upload_file_from_path(context, str(file_path), title="clip.mp4")++ self.assertTrue(result.startswith("wc-video-"))+ sent_items = mock_send.await_args.args[4] # type: ignore[union-attr]+ self.assertEqual(sent_items[0]["type"], 5)+ self.assertEqual(sent_items[0]["video_item"]["media"]["encrypt_query_param"], "p")+ self.assertEqual(sent_items[0]["video_item"]["video_size"], 12)+ self.assertEqual(mock_upload.await_args.kwargs["media_type"], 2) # type: ignore[union-attr]++ async def test_upload_image_from_path_returns_empty_on_send_error_response(self):+ bot = self._make_bot()+ context = MessageContext(user_id="user-1", channel_id="user-1", platform_specific={"context_token": "ctx-1"})++ with tempfile.TemporaryDirectory() as tmpdir:+ image_path = Path(tmpdir) / "photo.png"+ image_path.write_bytes(b"png")+ cdn_meta = {"encrypt_query_param": "p", "aes_key": "k", "file_size": 3, "file_size_ciphertext": 16}+ with patch("modules.im.wechat.wechat_cdn.upload_image_to_cdn", new=AsyncMock(return_value=cdn_meta)):+ with patch(+ "modules.im.wechat.wechat_api.send_message",+ new=AsyncMock(return_value={"ret": 500, "errmsg": "bad media"}),+ ):+ result = await bot.upload_image_from_path(context, str(image_path))++ self.assertEqual(result, "")+++if __name__ == "__main__":+ unittest.main()diff --git a/ui/package-lock.json b/ui/package-lock.jsonindex cdb946f7e..e66e786ee 100644--- a/ui/package-lock.json+++ b/ui/package-lock.json@@ -85,7 +85,6 @@"integrity": "sha512-H3mcG6ZDLTlYfaSNi0iOKkigqMFvkTKlGUYlD8GW7nNOYRrevuA46iTypPyv+06V3fEmvvazfntkBU34L0azAw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@babel/code-frame": "^7.28.6","@babel/generator": "^7.28.6",@@ -1558,9 +1557,9 @@"license": "MIT"},"node_modules/@rollup/rollup-android-arm-eabi": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz",- "integrity": "sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.60.0.tgz",+ "integrity": "sha512-WOhNW9K8bR3kf4zLxbfg6Pxu2ybOUbB2AjMDHSQx86LIF4rH4Ft7vmMwNt0loO0eonglSNy4cpD3MKXXKQu0/A==","cpu": ["arm"],@@ -1572,9 +1571,9 @@]},"node_modules/@rollup/rollup-android-arm64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.55.1.tgz",- "integrity": "sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.60.0.tgz",+ "integrity": "sha512-u6JHLll5QKRvjciE78bQXDmqRqNs5M/3GVqZeMwvmjaNODJih/WIrJlFVEihvV0MiYFmd+ZyPr9wxOVbPAG2Iw==","cpu": ["arm64"],@@ -1586,9 +1585,9 @@]},"node_modules/@rollup/rollup-darwin-arm64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.1.tgz",- "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.60.0.tgz",+ "integrity": "sha512-qEF7CsKKzSRc20Ciu2Zw1wRrBz4g56F7r/vRwY430UPp/nt1x21Q/fpJ9N5l47WWvJlkNCPJz3QRVw008fi7yA==","cpu": ["arm64"],@@ -1600,9 +1599,9 @@]},"node_modules/@rollup/rollup-darwin-x64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.55.1.tgz",- "integrity": "sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.60.0.tgz",+ "integrity": "sha512-WADYozJ4QCnXCH4wPB+3FuGmDPoFseVCUrANmA5LWwGmC6FL14BWC7pcq+FstOZv3baGX65tZ378uT6WG8ynTw==","cpu": ["x64"],@@ -1614,9 +1613,9 @@]},"node_modules/@rollup/rollup-freebsd-arm64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.55.1.tgz",- "integrity": "sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.60.0.tgz",+ "integrity": "sha512-6b8wGHJlDrGeSE3aH5mGNHBjA0TTkxdoNHik5EkvPHCt351XnigA4pS7Wsj/Eo9Y8RBU6f35cjN9SYmCFBtzxw==","cpu": ["arm64"],@@ -1628,9 +1627,9 @@]},"node_modules/@rollup/rollup-freebsd-x64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.55.1.tgz",- "integrity": "sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.60.0.tgz",+ "integrity": "sha512-h25Ga0t4jaylMB8M/JKAyrvvfxGRjnPQIR8lnCayyzEjEOx2EJIlIiMbhpWxDRKGKF8jbNH01NnN663dH638mA==","cpu": ["x64"],@@ -1642,9 +1641,9 @@]},"node_modules/@rollup/rollup-linux-arm-gnueabihf": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.55.1.tgz",- "integrity": "sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.60.0.tgz",+ "integrity": "sha512-RzeBwv0B3qtVBWtcuABtSuCzToo2IEAIQrcyB/b2zMvBWVbjo8bZDjACUpnaafaxhTw2W+imQbP2BD1usasK4g==","cpu": ["arm"],@@ -1656,9 +1655,9 @@]},"node_modules/@rollup/rollup-linux-arm-musleabihf": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.55.1.tgz",- "integrity": "sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.60.0.tgz",+ "integrity": "sha512-Sf7zusNI2CIU1HLzuu9Tc5YGAHEZs5Lu7N1ssJG4Tkw6e0MEsN7NdjUDDfGNHy2IU+ENyWT+L2obgWiguWibWQ==","cpu": ["arm"],@@ -1670,9 +1669,9 @@]},"node_modules/@rollup/rollup-linux-arm64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.55.1.tgz",- "integrity": "sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.60.0.tgz",+ "integrity": "sha512-DX2x7CMcrJzsE91q7/O02IJQ5/aLkVtYFryqCjduJhUfGKG6yJV8hxaw8pZa93lLEpPTP/ohdN4wFz7yp/ry9A==","cpu": ["arm64"],@@ -1684,9 +1683,9 @@]},"node_modules/@rollup/rollup-linux-arm64-musl": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.55.1.tgz",- "integrity": "sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.60.0.tgz",+ "integrity": "sha512-09EL+yFVbJZlhcQfShpswwRZ0Rg+z/CsSELFCnPt3iK+iqwGsI4zht3secj5vLEs957QvFFXnzAT0FFPIxSrkQ==","cpu": ["arm64"],@@ -1698,9 +1697,9 @@]},"node_modules/@rollup/rollup-linux-loong64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.55.1.tgz",- "integrity": "sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.60.0.tgz",+ "integrity": "sha512-i9IcCMPr3EXm8EQg5jnja0Zyc1iFxJjZWlb4wr7U2Wx/GrddOuEafxRdMPRYVaXjgbhvqalp6np07hN1w9kAKw==","cpu": ["loong64"],@@ -1712,9 +1711,9 @@]},"node_modules/@rollup/rollup-linux-loong64-musl": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.55.1.tgz",- "integrity": "sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.60.0.tgz",+ "integrity": "sha512-DGzdJK9kyJ+B78MCkWeGnpXJ91tK/iKA6HwHxF4TAlPIY7GXEvMe8hBFRgdrR9Ly4qebR/7gfUs9y2IoaVEyog==","cpu": ["loong64"],@@ -1726,9 +1725,9 @@]},"node_modules/@rollup/rollup-linux-ppc64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.55.1.tgz",- "integrity": "sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.60.0.tgz",+ "integrity": "sha512-RwpnLsqC8qbS8z1H1AxBA1H6qknR4YpPR9w2XX0vo2Sz10miu57PkNcnHVaZkbqyw/kUWfKMI73jhmfi9BRMUQ==","cpu": ["ppc64"],@@ -1740,9 +1739,9 @@]},"node_modules/@rollup/rollup-linux-ppc64-musl": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.55.1.tgz",- "integrity": "sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.60.0.tgz",+ "integrity": "sha512-Z8pPf54Ly3aqtdWC3G4rFigZgNvd+qJlOE52fmko3KST9SoGfAdSRCwyoyG05q1HrrAblLbk1/PSIV+80/pxLg==","cpu": ["ppc64"],@@ -1754,9 +1753,9 @@]},"node_modules/@rollup/rollup-linux-riscv64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.55.1.tgz",- "integrity": "sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.60.0.tgz",+ "integrity": "sha512-3a3qQustp3COCGvnP4SvrMHnPQ9d1vzCakQVRTliaz8cIp/wULGjiGpbcqrkv0WrHTEp8bQD/B3HBjzujVWLOA==","cpu": ["riscv64"],@@ -1768,9 +1767,9 @@]},"node_modules/@rollup/rollup-linux-riscv64-musl": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.55.1.tgz",- "integrity": "sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.60.0.tgz",+ "integrity": "sha512-pjZDsVH/1VsghMJ2/kAaxt6dL0psT6ZexQVrijczOf+PeP2BUqTHYejk3l6TlPRydggINOeNRhvpLa0AYpCWSQ==","cpu": ["riscv64"],@@ -1782,9 +1781,9 @@]},"node_modules/@rollup/rollup-linux-s390x-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.55.1.tgz",- "integrity": "sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.60.0.tgz",+ "integrity": "sha512-3ObQs0BhvPgiUVZrN7gqCSvmFuMWvWvsjG5ayJ3Lraqv+2KhOsp+pUbigqbeWqueGIsnn+09HBw27rJ+gYK4VQ==","cpu": ["s390x"],@@ -1796,9 +1795,9 @@]},"node_modules/@rollup/rollup-linux-x64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.1.tgz",- "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.60.0.tgz",+ "integrity": "sha512-EtylprDtQPdS5rXvAayrNDYoJhIz1/vzN2fEubo3yLE7tfAw+948dO0g4M0vkTVFhKojnF+n6C8bDNe+gDRdTg==","cpu": ["x64"],@@ -1810,9 +1809,9 @@]},"node_modules/@rollup/rollup-linux-x64-musl": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.1.tgz",- "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.60.0.tgz",+ "integrity": "sha512-k09oiRCi/bHU9UVFqD17r3eJR9bn03TyKraCrlz5ULFJGdJGi7VOmm9jl44vOJvRJ6P7WuBi/s2A97LxxHGIdw==","cpu": ["x64"],@@ -1824,9 +1823,9 @@]},"node_modules/@rollup/rollup-openbsd-x64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.55.1.tgz",- "integrity": "sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.60.0.tgz",+ "integrity": "sha512-1o/0/pIhozoSaDJoDcec+IVLbnRtQmHwPV730+AOD29lHEEo4F5BEUB24H0OBdhbBBDwIOSuf7vgg0Ywxdfiiw==","cpu": ["x64"],@@ -1838,9 +1837,9 @@]},"node_modules/@rollup/rollup-openharmony-arm64": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.55.1.tgz",- "integrity": "sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.60.0.tgz",+ "integrity": "sha512-pESDkos/PDzYwtyzB5p/UoNU/8fJo68vcXM9ZW2V0kjYayj1KaaUfi1NmTUTUpMn4UhU4gTuK8gIaFO4UGuMbA==","cpu": ["arm64"],@@ -1852,9 +1851,9 @@]},"node_modules/@rollup/rollup-win32-arm64-msvc": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.55.1.tgz",- "integrity": "sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.60.0.tgz",+ "integrity": "sha512-hj1wFStD7B1YBeYmvY+lWXZ7ey73YGPcViMShYikqKT1GtstIKQAtfUI6yrzPjAy/O7pO0VLXGmUVWXQMaYgTQ==","cpu": ["arm64"],@@ -1866,9 +1865,9 @@]},"node_modules/@rollup/rollup-win32-ia32-msvc": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.55.1.tgz",- "integrity": "sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.60.0.tgz",+ "integrity": "sha512-SyaIPFoxmUPlNDq5EHkTbiKzmSEmq/gOYFI/3HHJ8iS/v1mbugVa7dXUzcJGQfoytp9DJFLhHH4U3/eTy2Bq4w==","cpu": ["ia32"],@@ -1880,9 +1879,9 @@]},"node_modules/@rollup/rollup-win32-x64-gnu": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.1.tgz",- "integrity": "sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.60.0.tgz",+ "integrity": "sha512-RdcryEfzZr+lAr5kRm2ucN9aVlCCa2QNq4hXelZxb8GG0NJSazq44Z3PCCc8wISRuCVnGs0lQJVX5Vp6fKA+IA==","cpu": ["x64"],@@ -1894,9 +1893,9 @@]},"node_modules/@rollup/rollup-win32-x64-msvc": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.55.1.tgz",- "integrity": "sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.60.0.tgz",+ "integrity": "sha512-PrsWNQ8BuE00O3Xsx3ALh2Df8fAj9+cvvX9AIA6o4KpATR98c9mud4XtDWVvsEuyia5U4tVSTKygawyJkjm60w==","cpu": ["x64"],@@ -2243,7 +2242,6 @@"integrity": "sha512-ne4A0IpG3+2ETuREInjPNhUGis1SFjv1d5asp8MzEAGtOZeTeHVDOYqOgqfhvseqg/iXty2hjBf1zAOb7RNiNw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"undici-types": "~7.16.0"}@@ -2254,7 +2252,6 @@"integrity": "sha512-3MbSL37jEchWZz2p2mjntRZtPt837ij10ApxKfgmXCTuHWagYg7iA5bqPw6C8BMPfwidlvfPI/fxOc42HLhcyg==","devOptional": true,"license": "MIT",- "peer": true,"dependencies": {"csstype": "^3.2.2"}@@ -2265,7 +2262,6 @@"integrity": "sha512-jp2L/eY6fn+KgVVQAOqYItbF0VY/YApe5Mz2F0aykSO8gx31bYCZyvSeYxCHKvzHG5eZjc+zyaS5BrBWya2+kQ==","devOptional": true,"license": "MIT",- "peer": true,"peerDependencies": {"@types/react": "^19.2.0"}@@ -2315,7 +2311,6 @@"integrity": "sha512-npiaib8XzbjtzS2N4HlqPvlpxpmZ14FjSJrteZpPxGUaYPlvhzlzUZ4mZyABo0EFrOWnvyd0Xxroq//hKhtAWg==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@typescript-eslint/scope-manager": "8.53.0","@typescript-eslint/types": "8.53.0",@@ -2470,13 +2465,13 @@}},"node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {- "version": "9.0.5",- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz",- "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==",+ "version": "9.0.9",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",+ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==","dev": true,"license": "ISC","dependencies": {- "brace-expansion": "^2.0.1"+ "brace-expansion": "^2.0.2"},"engines": {"node": ">=16 || 14 >=14.17"@@ -2567,7 +2562,6 @@"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==","dev": true,"license": "MIT",- "peer": true,"bin": {"acorn": "bin/acorn"},@@ -2586,9 +2580,9 @@}},"node_modules/ajv": {- "version": "6.12.6",- "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz",- "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==",+ "version": "6.14.0",+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",+ "integrity": "sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==","dev": true,"license": "MIT","dependencies": {@@ -2722,7 +2716,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"baseline-browser-mapping": "^2.9.0","caniuse-lite": "^1.0.30001759",@@ -3012,7 +3005,6 @@"integrity": "sha512-LEyamqS7W5HB3ujJyvi0HQK/dtVINZvd5mAAp9eT5S/ujByGjiZLCzPcHVzuXbpJDJF/cxwHlfceVUDZ2lnSTw==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"@eslint-community/eslint-utils": "^4.8.0","@eslint-community/regexpp": "^4.12.1",@@ -3275,9 +3267,9 @@}},"node_modules/flatted": {- "version": "3.3.3",- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.3.3.tgz",- "integrity": "sha512-GX+ysw4PBCz0PzosHDepZGANEuFCMLrnRTiEy9McGjmkCQYwRq4A/X786G/fjM/+OjsWSU1ZrY5qyARZmO/uwg==",+ "version": "3.4.2",+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",+ "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==","dev": true,"license": "ISC"},@@ -3444,7 +3436,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"@babel/runtime": "^7.28.4"},@@ -3948,9 +3939,9 @@}},"node_modules/minimatch": {- "version": "3.1.2",- "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",- "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",+ "version": "3.1.5",+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==","dev": true,"license": "ISC","dependencies": {@@ -4111,7 +4102,6 @@"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==","dev": true,"license": "MIT",- "peer": true,"engines": {"node": ">=12"},@@ -4139,7 +4129,6 @@}],"license": "MIT",- "peer": true,"dependencies": {"nanoid": "^3.3.11","picocolors": "^1.1.1",@@ -4190,7 +4179,6 @@"resolved": "https://registry.npmjs.org/react/-/react-19.2.3.tgz","integrity": "sha512-Ku/hhYbVjOQnXDZFv2+RibmLFGwFdeeKHFcOTlrt7xplBnya5OGn/hIRDsqDiSUcfORsDC7MPxwork8jBwsIWA==","license": "MIT",- "peer": true,"engines": {"node": ">=0.10.0"}@@ -4200,7 +4188,6 @@"resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.3.tgz","integrity": "sha512-yELu4WmLPw5Mr/lmeEpox5rw3RETacE++JgHqQzd2dg+YbJuat3jH4ingc+WPZhxaoFzdv9y33G+F7Nl5O0GBg==","license": "MIT",- "peer": true,"dependencies": {"scheduler": "^0.27.0"},@@ -4363,9 +4350,9 @@}},"node_modules/rollup": {- "version": "4.55.1",- "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.1.tgz",- "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==",+ "version": "4.60.0",+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.60.0.tgz",+ "integrity": "sha512-yqjxruMGBQJ2gG4HtjZtAfXArHomazDHoFwFFmZZl0r7Pdo7qCIXKqKHZc8yeoMgzJJ+pO6pEEHa+V7uzWlrAQ==","dev": true,"license": "MIT","dependencies": {@@ -4379,31 +4366,31 @@"npm": ">=8.0.0"},"optionalDependencies": {- "@rollup/rollup-android-arm-eabi": "4.55.1",- "@rollup/rollup-android-arm64": "4.55.1",- "@rollup/rollup-darwin-arm64": "4.55.1",- "@rollup/rollup-darwin-x64": "4.55.1",- "@rollup/rollup-freebsd-arm64": "4.55.1",- "@rollup/rollup-freebsd-x64": "4.55.1",- "@rollup/rollup-linux-arm-gnueabihf": "4.55.1",- "@rollup/rollup-linux-arm-musleabihf": "4.55.1",- "@rollup/rollup-linux-arm64-gnu": "4.55.1",- "@rollup/rollup-linux-arm64-musl": "4.55.1",- "@rollup/rollup-linux-loong64-gnu": "4.55.1",- "@rollup/rollup-linux-loong64-musl": "4.55.1",- "@rollup/rollup-linux-ppc64-gnu": "4.55.1",- "@rollup/rollup-linux-ppc64-musl": "4.55.1",- "@rollup/rollup-linux-riscv64-gnu": "4.55.1",- "@rollup/rollup-linux-riscv64-musl": "4.55.1",- "@rollup/rollup-linux-s390x-gnu": "4.55.1",- "@rollup/rollup-linux-x64-gnu": "4.55.1",- "@rollup/rollup-linux-x64-musl": "4.55.1",- "@rollup/rollup-openbsd-x64": "4.55.1",- "@rollup/rollup-openharmony-arm64": "4.55.1",- "@rollup/rollup-win32-arm64-msvc": "4.55.1",- "@rollup/rollup-win32-ia32-msvc": "4.55.1",- "@rollup/rollup-win32-x64-gnu": "4.55.1",- "@rollup/rollup-win32-x64-msvc": "4.55.1",+ "@rollup/rollup-android-arm-eabi": "4.60.0",+ "@rollup/rollup-android-arm64": "4.60.0",+ "@rollup/rollup-darwin-arm64": "4.60.0",+ "@rollup/rollup-darwin-x64": "4.60.0",+ "@rollup/rollup-freebsd-arm64": "4.60.0",+ "@rollup/rollup-freebsd-x64": "4.60.0",+ "@rollup/rollup-linux-arm-gnueabihf": "4.60.0",+ "@rollup/rollup-linux-arm-musleabihf": "4.60.0",+ "@rollup/rollup-linux-arm64-gnu": "4.60.0",+ "@rollup/rollup-linux-arm64-musl": "4.60.0",+ "@rollup/rollup-linux-loong64-gnu": "4.60.0",+ "@rollup/rollup-linux-loong64-musl": "4.60.0",+ "@rollup/rollup-linux-ppc64-gnu": "4.60.0",+ "@rollup/rollup-linux-ppc64-musl": "4.60.0",+ "@rollup/rollup-linux-riscv64-gnu": "4.60.0",+ "@rollup/rollup-linux-riscv64-musl": "4.60.0",+ "@rollup/rollup-linux-s390x-gnu": "4.60.0",+ "@rollup/rollup-linux-x64-gnu": "4.60.0",+ "@rollup/rollup-linux-x64-musl": "4.60.0",+ "@rollup/rollup-openbsd-x64": "4.60.0",+ "@rollup/rollup-openharmony-arm64": "4.60.0",+ "@rollup/rollup-win32-arm64-msvc": "4.60.0",+ "@rollup/rollup-win32-ia32-msvc": "4.60.0",+ "@rollup/rollup-win32-x64-gnu": "4.60.0",+ "@rollup/rollup-win32-x64-msvc": "4.60.0","fsevents": "~2.3.2"}},@@ -4574,7 +4561,6 @@"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==","devOptional": true,"license": "Apache-2.0",- "peer": true,"bin": {"tsc": "bin/tsc","tsserver": "bin/tsserver"@@ -4713,7 +4699,6 @@"integrity": "sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==","dev": true,"license": "MIT",- "peer": true,"dependencies": {"esbuild": "^0.27.0","fdir": "^6.5.0",@@ -4844,7 +4829,6 @@"integrity": "sha512-k7Nwx6vuWx1IJ9Bjuf4Zt1PEllcwe7cls3VNzm4CQ1/hgtFUK2bRNG3rvnpPUhFjmqJKAKtjV576KnUkHocg/g==","dev": true,"license": "MIT",- "peer": true,"funding": {"url": "https://github.com/sponsors/colinhacks"}diff --git a/ui/src/components/Dashboard.tsx b/ui/src/components/Dashboard.tsxindex 2e7b9bc8f..e1373c674 100644--- a/ui/src/components/Dashboard.tsx+++ b/ui/src/components/Dashboard.tsx@@ -352,6 +352,7 @@ export const Dashboard: React.FC = () => {className="w-36 bg-neutral-100 border border-border rounded px-2 py-1 text-xs font-mono"><option value="reaction">{t('dashboard.ackReaction')}</option>+ <option value="typing">{t('dashboard.ackTyping')}</option><option value="message">{t('dashboard.ackMessage')}</option></select></div>diff --git a/ui/src/components/Wizard.tsx b/ui/src/components/Wizard.tsxindex c9fe9551a..741b00b4f 100644--- a/ui/src/components/Wizard.tsx+++ b/ui/src/components/Wizard.tsx@@ -91,6 +91,7 @@ const buildConfigPayload = (data: any) => ({update: data.update,// Preserve ack_modeack_mode: data.ack_mode,+ show_duration: data.show_duration,// Preserve languagelanguage: data.language,});@@ -116,7 +117,7 @@ export const Wizard: React.FC = () => {: platform === 'wechat'? { id: 'wechat', title: 'WeChat', component: WeChatConfig }: { id: 'slack', title: 'Slack', component: SlackConfig },- { id: 'channels', title: 'Channels', component: ChannelList },+ ...(platform === 'wechat' ? [] : [{ id: 'channels', title: 'Channels', component: ChannelList }]),{ id: 'summary', title: 'Finish', component: Summary },];}, [data.platform]);@@ -155,6 +156,7 @@ export const Wizard: React.FC = () => {const nextData = {...data,...(platformChanged ? { channelConfigs: {} } : {}),+ ...(stepData?.platform === 'wechat' ? { show_duration: false } : {}),...stepData,};setData(nextData);diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsxindex f0e67574c..e42930bfc 100644--- a/ui/src/components/steps/Summary.tsx+++ b/ui/src/components/steps/Summary.tsx@@ -389,6 +389,7 @@ const buildConfigPayload = (data: any) => {} : undefined,// Preserve ack_modeack_mode: data.ack_mode,+ show_duration: data.show_duration,// Preserve languagelanguage: data.language,};diff --git a/ui/src/components/steps/WeChatConfig.tsx b/ui/src/components/steps/WeChatConfig.tsxindex ebb5e2f3a..bf622382c 100644--- a/ui/src/components/steps/WeChatConfig.tsx+++ b/ui/src/components/steps/WeChatConfig.tsx@@ -11,6 +11,8 @@ interface WeChatConfigProps {onBack: () => void;}+const QR_POLL_INTERVAL_MS = 8000;+export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack }) => {const { t } = useTranslation();const api = useApi();@@ -22,7 +24,8 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBackconst [baseUrl, setBaseUrl] = useState<string>(data.wechat?.base_url || '');const [starting, setStarting] = useState(false);- const pollTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);+ const pollTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const autoStartedRef = useRef(false);const stopPolling = useCallback(() => {if (pollTimerRef.current) {@@ -38,7 +41,7 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack};}, [stopPolling]);- const startLogin = async () => {+ const startLogin = useCallback(async () => {setStarting(true);setLoginState('idle');setMessage('');@@ -48,7 +51,11 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBackstopPolling();try {- const result = await api.wechatStartLogin();+ let result = await api.wechatStartLogin();+ if (result?.error) {+ await new Promise((resolve) => setTimeout(resolve, 800));+ result = await api.wechatStartLogin();+ }if (result.error) {setLoginState('error');setMessage(result.error);@@ -63,16 +70,41 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBackstartPolling(result.session_key);}} catch (err: any) {- setLoginState('error');- setMessage(err?.message || t('wechatConfig.startFailed'));+ try {+ await new Promise((resolve) => setTimeout(resolve, 800));+ const retryResult = await api.wechatStartLogin();+ if (retryResult?.error) {+ setLoginState('error');+ setMessage(retryResult.error);+ return;+ }+ setQrCodeUrl(retryResult.qrcode_url || '');+ setMessage(retryResult.message || '');+ setLoginState('qr_ready');+ if (retryResult.session_key) {+ startPolling(retryResult.session_key);+ }+ } catch (retryErr: any) {+ setLoginState('error');+ setMessage(retryErr?.message || err?.message || t('wechatConfig.startFailed'));+ }} finally {setStarting(false);}- };+ }, [api, stopPolling, t]);++ useEffect(() => {+ if (autoStartedRef.current) return;+ if (starting) return;+ if (loginState !== 'idle') return;++ autoStartedRef.current = true;+ void startLogin();+ }, [loginState, startLogin, starting]);const startPolling = (key: string) => {stopPolling();- pollTimerRef.current = setInterval(async () => {+ const pollOnce = async () => {try {const result = await api.wechatPollLogin(key);if (!result) return;@@ -95,12 +127,20 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBacksetLoginState('error');setMessage(result.message || t('wechatConfig.pollError'));stopPolling();+ return;}- // status === 'wait' — keep polling+ // status === 'wait' — schedule next poll after the server-side long poll window+ pollTimerRef.current = setTimeout(() => {+ void pollOnce();+ }, QR_POLL_INTERVAL_MS);} catch {- // Ignore transient errors, keep polling+ pollTimerRef.current = setTimeout(() => {+ void pollOnce();+ }, QR_POLL_INTERVAL_MS);}- }, 2000);+ };++ void pollOnce();};const isConnected = loginState === 'connected' && !!botToken;@@ -152,17 +192,9 @@ export const WeChatConfig: React.FC<WeChatConfigProps> = ({ data, onNext, onBack{loginState === 'idle' && (<div className="bg-panel border border-border rounded-xl p-6 text-center space-y-4"><div className="w-16 h-16 bg-accent/10 text-accent rounded-full flex items-center justify-center mx-auto">- <Smartphone size={32} />+ <Loader2 size={32} className="animate-spin" /></div>- <p className="text-sm text-muted">{t('wechatConfig.startDescription')}</p>- <button- onClick={startLogin}- disabled={starting}- className="px-6 py-3 bg-accent text-white rounded-lg flex items-center gap-2 mx-auto font-medium shadow-sm hover:bg-accent/90 transition-colors disabled:opacity-50 disabled:cursor-not-allowed"- >- {starting ? <RefreshCw size={16} className="animate-spin" /> : <Smartphone size={16} />}- {starting ? t('wechatConfig.starting') : t('wechatConfig.startLogin')}- </button>+ <p className="text-sm text-muted">{starting ? t('wechatConfig.starting') : t('wechatConfig.startDescription')}</p></div>)}diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex f00af134f..1bb2a13c3 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -390,6 +390,7 @@"ackMode": "Ack Mode","ackModeHint": "How bot acknowledges received messages","ackReaction": "👀 Reaction",+ "ackTyping": "Typing","ackMessage": "Message","errorRetryLimit": "Error Retry Limit","errorRetryLimitHint": "Auto-retry with 'continue' when LLM stream errors occur (0 = no retry)",diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 26722aba9..1a406eb9b 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -82,7 +82,7 @@},"wechat": {"title": "微信",- "desc": "通过 iLink Bot 连接微信个人消息"+ "desc": "通过微信扫码连接微信Bot"}},"discordConfig": {@@ -390,6 +390,7 @@"ackMode": "确认模式","ackModeHint": "机器人如何确认收到的消息","ackReaction": "👀 表情回应",+ "ackTyping": "Typing 指示","ackMessage": "消息回复","errorRetryLimit": "错误重试次数","errorRetryLimitHint": "当 LLM 流式响应出错时,自动发送 'continue' 重试(0 = 不重试)",diff --git a/vibe/i18n/en.json b/vibe/i18n/en.jsonindex 4030f5024..82dbccc22 100644--- a/vibe/i18n/en.json+++ b/vibe/i18n/en.json@@ -42,6 +42,7 @@"processActionFailed": "Error processing action: {error}","agentNotConfigured": "Agent `{agent}` is not configured. Make sure the Codex CLI is installed and environment variables are set if this channel is routed to Codex.","processMessageFailed": "Error: {error}",+ "opencodeQuestionUnsupportedWechat": "OpenCode interactive questions are temporarily disabled on WeChat. Please send a follow-up message instead.","sessionReset": "Session error detected. Session has been reset. Please try your message again.","sessionConnectionLost": "Connection to Claude was lost. Please try your message again.","sessionGeneric": "An error occurred: {error}"@@ -165,13 +166,23 @@"start": {"welcome": "Welcome to Vibe Remote!","greeting": "Hello {name}!",+ "userFallback": "User","platform": "Platform: {platform}","agent": "Agent: {agent}","channel": "Channel: {channel}",+ "commandsTitle": "Available Commands:",+ "commandStart": "/start - Show this welcome message",+ "commandCwd": "/cwd - Show current working directory",+ "commandSetCwd": "/setcwd <path> - Set working directory",+ "commandStop": "/stop - Interrupt {agent} execution",+ "commandNew": "/new - Start a fresh session","quickActions": "Quick Actions:","quickActionsDesc": "Use the buttons below to manage your {agent} sessions, or simply type any message to start chatting with {agent}!","directMessage": "Direct Message"},+ "new": {+ "started": "Started a fresh session. Your next message will begin a new conversation."+ },"clear": {"noSessions": "No active sessions to clear.\nSession state has been reset.","cleared": "Cleared active sessions for:\n{details}\nAll sessions reset.",@@ -182,9 +193,9 @@"exists": "Directory exists","notExists": "Directory does not exist","hint": "This is where Agent will execute commands",- "usage": "Usage: /set_cwd <path>",- "changeInstructions": "To change working directory, use:\n`/set_cwd <path>`\n\nExample:\n`/set_cwd ~/projects/myapp`",- "clickButton": "Click the 'Change Work Dir' button in the @Vibe Remote /start menu to change working directory."+ "usage": "Usage: /setcwd <path>",+ "changeInstructions": "To change working directory, use:\n`/setcwd <path>`\n\nExample:\n`/setcwd ~/projects/myapp`",+ "clickButton": "Click the 'Change Work Dir' button in the /start menu to change working directory."},"resume": {"slackOnly": "Resume is currently available only on Slack. Continue in the same thread to auto-resume.",@@ -198,6 +209,7 @@"button": {"currentDir": "Current Dir","changeDir": "Change Work Dir",+ "newSession": "New Session","clearSession": "Clear All Session","settings": "Settings","resumeSession": "Resume Session",diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.jsonindex a43b82931..01aae9d71 100644--- a/vibe/i18n/zh.json+++ b/vibe/i18n/zh.json@@ -42,6 +42,7 @@"processActionFailed": "处理操作时出错:{error}","agentNotConfigured": "Agent `{agent}` 未配置。若此频道路由到 Codex,请确保已安装 Codex CLI 并设置环境变量。","processMessageFailed": "出错:{error}",+ "opencodeQuestionUnsupportedWechat": "微信平台暂时不支持 OpenCode 的交互式提问。请直接再发一条消息继续。","sessionReset": "检测到会话错误。会话已重置,请重试。","sessionConnectionLost": "与 Claude 的连接已断开,请重试。","sessionGeneric": "发生错误:{error}"@@ -165,13 +166,23 @@"start": {"welcome": "欢迎使用 Vibe Remote!","greeting": "你好 {name}!",+ "userFallback": "用户","platform": "平台:{platform}","agent": "Agent:{agent}","channel": "频道:{channel}",+ "commandsTitle": "可用命令:",+ "commandStart": "/start - 显示欢迎消息",+ "commandCwd": "/cwd - 显示当前工作目录",+ "commandSetCwd": "/setcwd <路径> - 设置工作目录",+ "commandStop": "/stop - 中断 {agent} 当前执行",+ "commandNew": "/new - 开启一个全新的会话","quickActions": "快捷操作:","quickActionsDesc": "使用下方按钮管理您的 {agent} 会话,或直接输入任何消息开始与 {agent} 聊天!","directMessage": "私信"},+ "new": {+ "started": "已开启新的会话。你下一条消息会从全新对话开始。"+ },"clear": {"noSessions": "没有要清除的活动会话。\n会话状态已重置。","cleared": "已清除的活动会话:\n{details}\n所有会话已重置。",@@ -182,9 +193,9 @@"exists": "目录存在","notExists": "目录不存在","hint": "这是 Agent 执行命令的位置",- "usage": "用法:/set_cwd <路径>",- "changeInstructions": "要更改工作目录,请使用:\n`/set_cwd <路径>`\n\n示例:\n`/set_cwd ~/projects/myapp`",- "clickButton": "请点击 @Vibe Remote /start 菜单中的“更改工作目录”按钮来更改工作目录。"+ "usage": "用法:/setcwd <路径>",+ "changeInstructions": "要更改工作目录,请使用:\n`/setcwd <路径>`\n\n示例:\n`/setcwd ~/projects/myapp`",+ "clickButton": "请点击 /start 菜单中的“更改工作目录”按钮来更改工作目录。"},"resume": {"slackOnly": "恢复功能目前仅在 Slack 上可用。在同一线程中继续可自动恢复。",@@ -198,6 +209,7 @@"button": {"currentDir": "当前目录","changeDir": "更改工作目录",+ "newSession": "新会话","clearSession": "清除所有会话","settings": "设置","resumeSession": "恢复会话",diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 07d2bbbe9..3f65c39a2 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -378,10 +378,8 @@ def wechat_qr_login_poll():if result.get("ok") is False:return jsonify(result), 500- # If confirmed, auto-bind the WeChat user and send welcome message+ # If confirmed, auto-bind the WeChat userif result.get("status") == "confirmed" and result.get("bot_token"):- bot_token = result["bot_token"]- base_url = result.get("base_url") or "https://ilinkai.weixin.qq.com"user_id = result.get("user_id", "wechat_user")# Auto-bind user@@ -392,27 +390,6 @@ def wechat_qr_login_poll():except Exception as e:logger.warning("Failed to auto-bind WeChat user: %s", e)- # Send welcome message to verify the send path works- try:- from modules.im import wechat_api as _wc_api-- welcome_text = (- "WeChat bot connected successfully!\nYou can now send messages to interact with the AI agent."- )- _run_async(- _wc_api.send_message(- base_url,- bot_token,- user_id,- "", # context_token: empty for first message- [{"type": 1, "text_item": {"text": welcome_text}}],- ),- timeout=10.0,- )- logger.info("Sent welcome message to WeChat user %s", user_id)- except Exception as e:- logger.warning("Failed to send welcome message: %s", e)-# Schedule service restart so the new token takes effectdef _restart_after_login():import time