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(docs): rebrand to Vibe Remote; add Chinese README; update setup guides; refresh user-facing texts; badges and logo placeholder; clarify Slack usage and security/ops
cyhhao10e6a8225835
diff --git a/CLAUDE.md b/CLAUDE.mdindex 73a0e3649..8d167fb57 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -4,7 +4,17 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co## Project Overview-This is a multi-platform remote control bot for Claude Code, supporting both Telegram and Slack. Users can send messages through IM platforms to execute Claude Code commands remotely. The system provides persistent sessions, real-time feedback, and maintains conversation context.+Vibe Remote is a multi-platform, chat-native controller for vibe coding. It supports Slack and Telegram, letting users remote-control Claude Code (and future coding CLIs) from chat. The system provides persistent sessions, real-time streaming feedback, and maintains conversation context.++## Project Name & Vision++Vibe Remote — hands-free vibe coding from chat.++Vision:++- Minimize manual review; let the AI drive coding based on intent and constraints+- Enable work-from-anywhere by controlling coding CLIs via Slack/Telegram+- Stay extensible beyond Claude Code to other coding agents and toolchains## Development Commandsdiff --git a/README.md b/README.mdindex 9f47d2ad5..fdc501f24 100644--- a/README.md+++ b/README.md@@ -1,28 +1,59 @@-# Claude Code Remote Control Bot+# Vibe Remote-A modular system for controlling Claude Code through multiple instant messaging platforms (Telegram, Slack).+[<img src="assets/logo.png" alt="Vibe Remote" width="120" align="right" />](assets/logo.png)++[](https://www.python.org/)+[](#setup-guides)+[](LICENSE)+[](CONTRIBUTING.md)++[English](README.md) | [中文](README_ZH.md)++_Hands‑free remote vibe coding from Slack/Telegram._++Vibe Remote is a chat‑native controller for vibe coding. Trigger and steer coding CLIs (starting with Claude Code) from Slack/Telegram — minimal review, intent‑driven, ship faster. Built to work anywhere you work.++## Why Vibe Remote++- **Vibe coding, not micromanaging**: Let AI drive based on your intent and constraints; focus on outcomes.+- **Work from anywhere**: Control coding sessions over Slack/Telegram; no IDE tether.+- **Extensible by design**: Starts with Claude Code, built to support additional coding agents/CLIs.+- **Session persistence by thread + path**: Each Slack thread/Telegram chat maintains its own Claude session and working dir; auto‑resume via saved mappings.+- **Interactive Slack UX**: `/start` menu + Settings/CWD modals; buttons over commands for faster flow.++> Recommendation: Prefer Slack as the primary platform. Threaded conversations enable parallel subtasks and keep channel history tidy — each subtask stays in its own thread.++## Core Features++- **Multi‑platform**: First‑class Slack & Telegram support+- **Hands‑free flow**: Minimal review; messages stream back in real time+- **Persistent sessions**: Per chat/thread sessions, easy resume+- **Threaded Slack UX**: Clean, per‑conversation threads+- **Working dir control**: Inspect and change `cwd` on the fly+- **Personalization**: Toggle which message types to display++## Architecture (Brief)++- `BaseIMClient` + platform implementations (`slack.py`, `telegram.py`)+- `IMFactory` to construct clients by `IM_PLATFORM`+- `Controller` orchestrates sessions, formatting, and command routing## Quick Start-1. Install dependencies:+1. Install dependencies```bashpip install -r requirements.txt```-2. Create `.env` file from template:+2. Create and edit `.env````bashcp .env.example .env-# Edit .env with your platform choice and credentials+# Set IM_PLATFORM and tokens```-3. Choose your platform:-- - Set `IM_PLATFORM=telegram` for Telegram- - Set `IM_PLATFORM=slack` for Slack--4. Run the bot:+3. Run```bash./start.sh@@ -32,125 +63,81 @@ python main.py## Configuration-### Platform Selection--Set `IM_PLATFORM` in your `.env` file:--- `telegram` - Use Telegram Bot-- `slack` - Use Slack Bot--### Telegram Configuration--- `TELEGRAM_BOT_TOKEN` (required): Your Telegram bot token from @BotFather-- `TELEGRAM_TARGET_CHAT_ID` (optional): Whitelist of allowed chat IDs- - Empty or `[]`: Only accept private messages (DMs)- - `null` or omit: Accept all chats- - `[123456789,987654321]`: Only accept messages from these chat IDs- - Use `/start` command to get your chat ID--### Slack Configuration+### Platform selection-- `SLACK_BOT_TOKEN` (required): Your Slack bot token (starts with `xoxb-`)-- `SLACK_APP_TOKEN` (required for Socket Mode): App-level token (starts with `xapp-`)-- `SLACK_TARGET_CHANNEL` (optional): Whitelist of allowed channel IDs- - Empty or `[]`: Only accept direct messages (DMs)- - `null` or omit: Accept all channels- - `[C1234567890,C0987654321]`: Only accept messages from these channel IDs+- `IM_PLATFORM=slack` or `IM_PLATFORM=telegram`-For detailed Slack setup instructions, see [docs/SLACK_SETUP.md](docs/SLACK_SETUP.md).--### Claude Configuration--- `CLAUDE_DEFAULT_CWD` (required): Working directory for Claude Code (e.g. `./_tmp`)-- `CLAUDE_PERMISSION_MODE` (required): Permission mode, e.g. `bypassPermissions`-- `CLAUDE_SYSTEM_PROMPT` (optional): Custom system prompt--Claude Code SDK credentials (set via environment, if required by your setup):--- `ANTHROPIC_API_KEY` (or other keys required by `claude-code-sdk`)--### Application Configuration--- `LOG_LEVEL`: Logging level (default: `INFO`)+### Slack-## Features+- `SLACK_BOT_TOKEN` (xoxb-...)+- `SLACK_APP_TOKEN` (xapp-..., Socket Mode)+- `SLACK_TARGET_CHANNEL` optional whitelist of allowed channel IDs (channels only, start with `C`). Leave empty or omit to accept all channels. DMs are not supported currently.-### Core Features+### Telegram-1. **Multi-Platform Support**: Works with Telegram and Slack-2. **Automatic Execution**: Messages are processed automatically in order-3. **Message Queue**: User messages are queued and executed sequentially-4. **Real-time Feedback**: Claude Code outputs are forwarded in real-time-5. **Session Management**: Supports multiple concurrent users with independent queues-6. **Status Tracking**: Visual indicators for queue and execution status-7. **Working Directory Management**: Change Claude Code's working directory on the fly-8. **Personalization Settings**: Configure which message types to display+- `TELEGRAM_BOT_TOKEN` from @BotFather+- `TELEGRAM_TARGET_CHAT_ID` optional whitelist: `[123,...]` | `[]` only DMs | `null` all-### Platform-Specific Features+### Claude Code-#### Telegram+- `CLAUDE_DEFAULT_CWD` e.g. `./_tmp`+- `CLAUDE_PERMISSION_MODE` e.g. `bypassPermissions`+- `CLAUDE_SYSTEM_PROMPT` optional+- `ANTHROPIC_API_KEY` if required by your SDK setup-- Direct message and group chat support-- Inline keyboard for settings-- Message threading via reply-to-- Markdown formatting support+### App-#### Slack+- `LOG_LEVEL` default `INFO`-- **Thread Support**: Each conversation is organized in its own thread-- **Socket Mode**: No need for public webhooks-- **Channel & DM Support**: Works in both channels and direct messages-- **Mention-based Triggering**: In channels, mention the bot to interact+## Usage-## Commands+### Commands (all platforms)-All platforms support the same commands:+- `/start` open menu / welcome+- `/clear` reset conversation/session+- `/cwd` show working directory+- `/set_cwd <path>` change working directory+- `/settings` configure message visibility+- `/stop` interrupt current execution-- `/start` - Shows welcome message and IDs-- `/status` - Display queue and execution status-- `/clear` - Clear message queue-- `/cwd` - Show current working directory-- `/set_cwd <path>` - Change working directory-- `/execute` - Manually trigger queue processing-- `/queue` - Show messages in queue-- `/settings` - Configure message visibility+### Slack-## Usage+- In channels, run `/start` to open the interactive menu (Current Dir, Change Work Dir, Reset Session, Settings, How it Works)+- The bot organizes each conversation as a thread; reply in the thread to continue+- Slack DMs are not supported currently+- Slash commands are limited in threads; to stop in a thread, type `stop` directly### Telegram-1. Start a chat with your bot-2. Send messages directly - they'll be queued and processed automatically-3. Use commands with `/` prefix+- DM or group; run `/start` then type naturally+- Real‑time streaming; long outputs are split and code blocks are formatted-### Slack+## Setup Guides-1. **In Channels**: Mention the bot (`@bot-name your message`)-2. **In DMs**: Send messages directly-3. Commands work with `/` prefix-4. Each user's conversation is organized in a thread+- Slack: [English](docs/SLACK_SETUP.md) | [中文](docs/SLACK_SETUP_ZH.md)+- Telegram: [English](docs/TELEGRAM_SETUP.md) | [中文](docs/TELEGRAM_SETUP_ZH.md)-## Adding New Platforms+## Roadmap-The architecture supports easy addition of new IM platforms:+- Additional coding CLIs/agents beyond Claude Code+- More IM platforms (Discord, Teams)+- File upload/attachments piping to coding sessions+- Advanced session policies & permissions-1. Create a new class inheriting from `BaseIMClient`-2. Implement all abstract methods-3. Add configuration class inheriting from `BaseIMConfig`-4. Update `IMFactory` to support the new platform-5. Add platform-specific environment variables+## Contributing-See `modules/im/slack.py` for a complete implementation example.+See `CONTRIBUTING.md`. By participating you agree to `CODE_OF_CONDUCT.md`.## License-This project is licensed under the MIT License. See `LICENSE` for details.--## Contributing--Please see `CONTRIBUTING.md`. By participating you agree to the `CODE_OF_CONDUCT.md`.+MIT. See `LICENSE`.## Security-- Do not commit secrets. Use `.env` based on `.env.example`.-- The underlying `claude-code-sdk` may require credentials such as `ANTHROPIC_API_KEY` in your environment.+## Security & Ops++- **Secrets**: Never commit tokens. Use `.env`. Rotate regularly.+- **Whitelists**: Restrict access via `SLACK_TARGET_CHANNEL` (channels only, `C…`) or `TELEGRAM_TARGET_CHAT_ID`. `null` accepts all; empty list limits to DMs/groups accordingly (Slack DMs currently unsupported).+- **Logs**: Runtime logs at `logs/claude_proxy.log`.+- **Session persistence**: `user_settings.json` stores per‑thread/chat session mappings and preferences; persist this file in production.+- **Cleanup**: Set `CLEANUP_ENABLED=true` to safely prune completed receiver tasks during message handling for long‑running processes.diff --git a/README_ZH.md b/README_ZH.mdnew file mode 100644index 000000000..d10258d82--- /dev/null+++ b/README_ZH.md@@ -0,0 +1,141 @@+# Vibe Remote++[<img src="assets/logo.png" alt="Vibe Remote" width="120" align="right" />](assets/logo.png)++[](https://www.python.org/)+[](#setup-guides)+[](LICENSE)+[](CONTRIBUTING.md)++[English](README.md) | 中文++_面向 Slack/Telegram 的免干预 vibe coding 远程工作流。_++Vibe Remote 是一个面向聊天(chat‑native)的 vibe coding 控制器。你可以在 Slack/Telegram 中触发与引导编码 CLI(起步支持 Claude Code),以“意图驱动、最小 review”的方式更快交付。++## 为什么选择 Vibe Remote++- **专注 vibe coding**:基于你的意图与约束让 AI 自主推进,你只把控方向与结果。+- **随时随地**:不被 IDE 束缚,直接在 Slack/Telegram 中远程操控编码会话。+- **为扩展而生**:从 Claude Code 起步,后续可扩展到更多 coding agents/CLIs。+- **按线程 + 路径持久化**:每个 Slack 线程/Telegram 对话都维持独立 Claude 会话与工作目录,并通过持久化映射自动恢复。+- **Slack 交互式体验**:`/start` 菜单 + Settings/CWD 模态,按钮优先于命令,更快上手。++> 推荐:优先使用 Slack 作为主要平台。其线程模型更适合并行子任务,也能保持频道历史整洁(每个子任务都在各自的线程里)。++## 核心特性++- **多平台**:原生支持 Slack 与 Telegram+- **免干预工作流**:最小 review,实时流式回传消息+- **持久会话**:按聊天/线程维度持久化,可随时恢复+- **Slack 线程化 UX**:每个会话独立线程,保持频道整洁+- **工作目录控制**:随时查看与更改 `cwd`+- **个性化**:自定义隐藏的消息类型++## 架构(简述)++- `BaseIMClient` + 平台实现(`modules/im/slack.py`、`modules/im/telegram.py`)+- `IMFactory` 通过 `IM_PLATFORM` 动态创建客户端+- `Controller` 统一编排会话、格式化与命令路由++## 快速开始++1. 安装依赖++```bash+pip install -r requirements.txt+```++2. 创建并编辑 `.env`++```bash+cp .env.example .env+# 设置 IM_PLATFORM 与各自的 Token+```++3. 运行++```bash+./start.sh+# 或+python main.py+```++## 配置++### 平台选择++- `IM_PLATFORM=slack` 或 `IM_PLATFORM=telegram`++### Slack++- `SLACK_BOT_TOKEN`(xoxb-...)+- `SLACK_APP_TOKEN`(xapp-...,用于 Socket Mode)+- `SLACK_TARGET_CHANNEL` 可选的频道 ID 白名单(仅频道,形如 `C...`)。留空或省略为接受所有频道。当前不支持 Slack DM。++### Telegram++- `TELEGRAM_BOT_TOKEN` 来自 @BotFather+- `TELEGRAM_TARGET_CHAT_ID` 可选的聊天白名单:`[123,...]` | `[]` 仅私聊 | `null` 允许全部++### Claude Code++- `CLAUDE_DEFAULT_CWD` 例如 `./_tmp`+- `CLAUDE_PERMISSION_MODE` 例如 `bypassPermissions`+- `CLAUDE_SYSTEM_PROMPT` 可选+- `ANTHROPIC_API_KEY`(取决于你的 SDK 设置)++### 应用++- `LOG_LEVEL` 默认 `INFO`++## 使用方式++### Commands(全平台)++- `/start` 打开菜单/欢迎信息+- `/clear` 重置对话/会话+- `/cwd` 显示工作目录+- `/set_cwd <path>` 更改工作目录+- `/settings` 配置消息可见性+- `/stop` 中断当前执行++### Slack++- 在频道中运行 `/start` 打开交互菜单(Current Dir、Change Work Dir、Reset Session、Settings、How it Works)+- 机器人会把每次对话组织到各自的线程中;在线程中继续回复即可+- 当前不支持 Slack DM+- Slash 命令在线程中受限;要在线程内停止,请直接输入 `stop`++### Telegram++- 支持私聊/群组;先运行 `/start` 然后直接对话+- 支持实时流式输出;长消息自动分割;代码块自动格式化++## Setup Guides++- Slack: [English](docs/SLACK_SETUP.md) | [中文](docs/SLACK_SETUP_ZH.md)+- Telegram: [English](docs/TELEGRAM_SETUP.md) | [中文](docs/TELEGRAM_SETUP_ZH.md)++## Roadmap++- 扩展到更多编码 CLI/agents(超越 Claude Code)+- 更多 IM 平台(Discord、Teams)+- 文件上传/附件到编码会话的管道化+- 更细粒度的会话策略与权限++## Contributing++参见 `CONTRIBUTING.md`。参与即代表同意 `CODE_OF_CONDUCT.md`。++## License++MIT,详见 `LICENSE`。++## Security & Ops++- **Secrets**:不要提交 Token;使用 `.env`,并定期轮换。+- **Whitelists**:通过 `SLACK_TARGET_CHANNEL`(仅频道,`C…`)或 `TELEGRAM_TARGET_CHAT_ID` 限制访问。`null` 允许全部;空列表则只在相应上下文生效(Slack DM 当前不支持)。+- **Logs**:运行日志位于 `logs/claude_proxy.log`。+- **会话持久化**:`user_settings.json` 存储每个线程/聊天的会话映射与偏好;生产环境请持久化此文件。+- **清理**:设置 `CLEANUP_ENABLED=true`,在消息处理入口安全清理已完成的接收任务,适合长时间运行。diff --git a/core/handlers/command_handlers.py b/core/handlers/command_handlers.pyindex a8e979d30..01e353b5e 100644--- a/core/handlers/command_handlers.py+++ b/core/handlers/command_handlers.py@@ -18,7 +18,7 @@ class CommandHandlers:self.im_client = controller.im_clientself.session_manager = controller.session_managerself.settings_manager = controller.settings_manager-+def _get_channel_context(self, context: MessageContext) -> MessageContext:"""Get context for channel messages (no thread)"""# For Slack: send command responses directly to channel, not in thread@@ -27,7 +27,7 @@ class CommandHandlers:user_id=context.user_id,channel_id=context.channel_id,thread_id=None, # No thread for command responses- platform_specific=context.platform_specific+ platform_specific=context.platform_specific,)# For other platforms, keep original contextreturn context@@ -62,7 +62,7 @@ class CommandHandlers:# Build welcome message using formatter to handle escaping properlylines = [- formatter.format_bold("Welcome to Claude Code Remote Control Bot!"),+ formatter.format_bold("Welcome to Vibe Remote!"),"",f"Platform: {formatter.format_text(platform_name)}",f"User ID: {formatter.format_code_inline(context.user_id)}",@@ -112,7 +112,7 @@ class CommandHandlers:keyboard = InlineKeyboard(buttons=buttons)- welcome_text = f"""🎉 **Welcome to Claude Code Remote Control Bot!**+ welcome_text = f"""🎉 **Welcome to Vibe Remote!**👋 Hello **{user_name}**!🔧 Platform: **{platform_name}**@@ -136,25 +136,27 @@ Use the buttons below to manage your Claude Code sessions, or simply type any me# Get current session mappings before clearing themsettings = self.settings_manager.get_user_settings(settings_key)session_bases_to_clear = set(settings.session_mappings.keys())-+# Clear ALL session mappings for this user/channelself.settings_manager.clear_all_session_mappings(settings_key)-+# Clear all Claude sessions from memory that belong to this channel/usersessions_to_clear = []for session_key in self.controller.claude_sessions.keys():# Session keys format: "base_session_id:working_path"- base_part = session_key.split(':')[0] if ':' in session_key else session_key-+ base_part = (+ session_key.split(":")[0] if ":" in session_key else session_key+ )+# Check if this session should be clearedif base_part in session_bases_to_clear:sessions_to_clear.append(session_key)-+# Clear identified sessionsfor session_key in sessions_to_clear:try:client = self.controller.claude_sessions[session_key]- if hasattr(client, 'close'):+ if hasattr(client, "close"):await client.close()del self.controller.claude_sessions[session_key]logger.info(f"Cleared Claude session: {session_key}")@@ -163,7 +165,9 @@ Use the buttons below to manage your Claude Code sessions, or simply type any me# Clear session and disconnect clients (legacy)legacy_response = await self.session_manager.clear_session(settings_key)- logger.info(f"User {context.user_id} cleared all sessions for {settings_key}")+ logger.info(+ f"User {context.user_id} cleared all sessions for {settings_key}"+ )# Build response message based on what was actually clearedif len(sessions_to_clear) > 0:@@ -171,7 +175,9 @@ Use the buttons below to manage your Claude Code sessions, or simply type any meelif session_bases_to_clear:full_response = f"✅ Cleared {len(session_bases_to_clear)} stored session mapping(s).\n🔄 All sessions have been reset."else:- full_response = "📋 No active sessions to clear.\n🔄 Session state has been reset."+ full_response = (+ "📋 No active sessions to clear.\n🔄 Session state has been reset."+ )# Send the complete responsechannel_context = self._get_channel_context(context)@@ -228,7 +234,9 @@ Use the buttons below to manage your Claude Code sessions, or simply type any metry:if not args:channel_context = self._get_channel_context(context)- await self.im_client.send_message(channel_context, "Usage: /set_cwd <path>")+ await self.im_client.send_message(+ channel_context, "Usage: /set_cwd <path>"+ )returnnew_path = args.strip()@@ -327,18 +335,19 @@ Use the buttons below to manage your Claude Code sessions, or simply type any meif not session_handler:channel_context = self._get_channel_context(context)await self.im_client.send_message(- channel_context,- "❌ Session handler not available"+ channel_context, "❌ Session handler not available")return# Get session info for the current context- base_session_id, working_path, composite_key = session_handler.get_session_info(context)-+ base_session_id, working_path, composite_key = (+ session_handler.get_session_info(context)+ )+# Check if there's an active Claude sessionif composite_key not in self.controller.claude_sessions:channel_context = self._get_channel_context(context)-+# Provide helpful guidance based on platformif self.config.platform == "slack":formatter = self.im_client.formatter@@ -365,29 +374,29 @@ Use the buttons below to manage your Claude Code sessions, or simply type any me"3. Claude will stop execution but keep the session active\n\n""💡 Tip: Start a conversation with Claude first, then use `/stop` if needed.")-+await self.im_client.send_message(channel_context, help_text)return# Get the Claude client for this sessionclient = self.controller.claude_sessions[composite_key]-+# Send acknowledgment - use original context to send to thread if applicableawait self.im_client.send_message(context, # Use original context, not channel_context- "🛑 Sending stop signal to Claude..."+ "🛑 Sending stop signal to Claude...",)-+# Send interrupt message to Claude through the same sessionstop_message = "Please stop the current execution immediately and wait for further instructions."await client.query(stop_message, session_id=composite_key)-+logger.info(f"Sent stop command to Claude session {composite_key}")-+except Exception as e:logger.error(f"Error sending stop command: {e}", exc_info=True)# For errors, still use original context to maintain thread consistencyawait self.im_client.send_message(context, # Use original context- f"❌ Error sending stop command: {str(e)}"+ f"❌ Error sending stop command: {str(e)}",)diff --git a/core/handlers/settings_handler.py b/core/handlers/settings_handler.pyindex aafce77a9..fd97662d5 100644--- a/core/handlers/settings_handler.py+++ b/core/handlers/settings_handler.py@@ -8,7 +8,7 @@ logger = logging.getLogger(__name__)class SettingsHandler:"""Handles settings and configuration operations"""-+def __init__(self, controller):"""Initialize with reference to main controller"""self.controller = controller@@ -16,11 +16,11 @@ class SettingsHandler:self.im_client = controller.im_clientself.settings_manager = controller.settings_managerself.formatter = controller.im_client.formatter-+def _get_settings_key(self, context: MessageContext) -> str:"""Get settings key - delegate to controller"""return self.controller._get_settings_key(context)-+async def handle_settings(self, context: MessageContext, args: str = ""):"""Handle settings command - show settings menu"""try:@@ -30,135 +30,151 @@ class SettingsHandler:else:# For other platforms, use inline keyboardawait self._handle_settings_traditional(context)-+except Exception as e:logger.error(f"Error showing settings: {e}")await self.im_client.send_message(- context,- f"❌ Error showing settings: {str(e)}"+ context, f"❌ Error showing settings: {str(e)}")-+async def _handle_settings_traditional(self, context: MessageContext):"""Handle settings for non-Slack platforms (Telegram, etc)"""# Get current settingssettings_key = self._get_settings_key(context)user_settings = self.settings_manager.get_user_settings(settings_key)-+# Get available message types and display namesmessage_types = self.settings_manager.get_available_message_types()display_names = self.settings_manager.get_message_type_display_names()-+# Create inline keyboard buttons in 2x2 layoutbuttons = []row = []-+for i, msg_type in enumerate(message_types):is_hidden = msg_type in user_settings.hidden_message_typescheckbox = "☑️" if is_hidden else "⬜"display_name = display_names.get(msg_type, msg_type)button = InlineButton(text=f"{checkbox} Hide {display_name}",- callback_data=f"toggle_msg_{msg_type}"+ callback_data=f"toggle_msg_{msg_type}",)row.append(button)-+# Create 2x2 layoutif len(row) == 2 or i == len(message_types) - 1:buttons.append(row)row = []-+# Add info button on its own row- buttons.append([InlineButton("ℹ️ About Message Types", callback_data="info_msg_types")])-+ buttons.append(+ [InlineButton("ℹ️ About Message Types", callback_data="info_msg_types")]+ )+keyboard = InlineKeyboard(buttons=buttons)-+# Send settings message with escaped dashawait self.im_client.send_message_with_buttons(context,"⚙️ *Settings \\- Message Visibility*\n\nSelect which message types to hide from Claude output:",- keyboard+ keyboard,)-+async def _handle_settings_slack(self, context: MessageContext):"""Handle settings for Slack using modal dialog"""# For slash commands or direct triggers, we might have trigger_id- trigger_id = context.platform_specific.get('trigger_id') if context.platform_specific else None-- if trigger_id and hasattr(self.im_client, 'open_settings_modal'):+ trigger_id = (+ context.platform_specific.get("trigger_id")+ if context.platform_specific+ else None+ )++ if trigger_id and hasattr(self.im_client, "open_settings_modal"):# We have trigger_id, open modal directlysettings_key = self._get_settings_key(context)user_settings = self.settings_manager.get_user_settings(settings_key)message_types = self.settings_manager.get_available_message_types()display_names = self.settings_manager.get_message_type_display_names()-+try:- await self.im_client.open_settings_modal(trigger_id, user_settings, message_types, display_names, context.channel_id)+ await self.im_client.open_settings_modal(+ trigger_id,+ user_settings,+ message_types,+ display_names,+ context.channel_id,+ )except Exception as e:logger.error(f"Error opening settings modal: {e}")- await self.im_client.send_message(context, "❌ Failed to open settings. Please try again.")+ await self.im_client.send_message(+ context, "❌ Failed to open settings. Please try again."+ )else:# No trigger_id, show button to open modal- buttons = [[- InlineButton(- text="🛠️ Open Settings",- callback_data="open_settings_modal"- )- ]]-+ buttons = [+ [+ InlineButton(+ text="🛠️ Open Settings", callback_data="open_settings_modal"+ )+ ]+ ]+keyboard = InlineKeyboard(buttons=buttons)-+await self.im_client.send_message_with_buttons(context,"⚙️ *Personalization Settings*\n\nConfigure how Claude Code messages appear in your Slack workspace.",- keyboard+ keyboard,)-+async def handle_toggle_message_type(self, context: MessageContext, msg_type: str):"""Handle toggle for message type visibility"""try:# Toggle message type visibilitysettings_key = self._get_settings_key(context)- is_hidden = self.settings_manager.toggle_hidden_message_type(settings_key, msg_type)-+ is_hidden = self.settings_manager.toggle_hidden_message_type(+ settings_key, msg_type+ )+# Update the keyboarduser_settings = self.settings_manager.get_user_settings(settings_key)message_types = self.settings_manager.get_available_message_types()display_names = self.settings_manager.get_message_type_display_names()-+buttons = []row = []-+for i, mt in enumerate(message_types):is_hidden_now = mt in user_settings.hidden_message_typescheckbox = "☑️" if is_hidden_now else "⬜"display_name = display_names.get(mt, mt)button = InlineButton(text=f"{checkbox} Hide {display_name}",- callback_data=f"toggle_msg_{mt}"+ callback_data=f"toggle_msg_{mt}",)row.append(button)-+# Create 2x2 layoutif len(row) == 2 or i == len(message_types) - 1:buttons.append(row)row = []-- buttons.append([InlineButton("ℹ️ About Message Types", callback_data="info_msg_types")])-++ buttons.append(+ [InlineButton("ℹ️ About Message Types", callback_data="info_msg_types")]+ )+keyboard = InlineKeyboard(buttons=buttons)-+# Update messageif context.message_id:await self.im_client.edit_message(- context,- context.message_id,- keyboard=keyboard+ context, context.message_id, keyboard=keyboard)-+# Answer callback (for Telegram)display_name = display_names.get(msg_type, msg_type)action = "hidden" if is_hidden else "shown"-+# Platform-specific callback answeringif self.config.platform == "telegram":# For Telegram, we need the actual callback query object@@ -167,22 +183,21 @@ class SettingsHandler:elif self.config.platform == "slack":# For Slack, we might send an ephemeral messageawait self.im_client.send_message(- context,- f"{display_name} messages are now {action}"+ context, f"{display_name} messages are now {action}")-+except Exception as e:logger.error(f"Error toggling message type {msg_type}: {e}")await self.im_client.send_message(context,- self.formatter.format_error(f"Failed to toggle setting: {str(e)}")+ self.formatter.format_error(f"Failed to toggle setting: {str(e)}"),)-+async def handle_info_message_types(self, context: MessageContext):"""Show information about different message types"""try:formatter = self.im_client.formatter-+# Use the new format_info_message method for clean, platform-agnostic formattinginfo_text = formatter.format_info_message(title="Message Types Info:",@@ -191,42 +206,46 @@ class SettingsHandler:("System", "System initialization and status messages"),("Response", "Tool execution responses and results"),("Assistant", "Claude's messages and explanations"),- ("Result", "Final execution results and summaries")+ ("Result", "Final execution results and summaries"),],- footer="Hidden messages won't be sent to your IM platform."+ footer="Hidden messages won't be sent to your IM platform.",)-+# Send as new messageawait self.im_client.send_message(context, info_text)logger.info(f"Sent info_msg_types message to user {context.user_id}")-+except Exception as e:logger.error(f"Error in info_msg_types handler: {e}", exc_info=True)- await self.im_client.send_message(context, "❌ Error showing message types info")-+ await self.im_client.send_message(+ context, "❌ Error showing message types info"+ )+async def handle_info_how_it_works(self, context: MessageContext):"""Show information about how the bot works"""try:formatter = self.im_client.formatter-+# Use format_info_message for clean, platform-agnostic formattinginfo_text = formatter.format_info_message(- title="How Claude Code Bot Works:",+ title="How Vibe Remote Works:",emoji="📚",items=[("Real-time", "Messages are immediately sent to Claude Code"),("Persistent", "Each chat maintains its own conversation context"),("Commands", "Use /start for menu, /clear to reset session"),("Work Dir", "Change working directory with /set_cwd or via menu"),- ("Settings", "Customize message visibility in Settings")+ ("Settings", "Customize message visibility in Settings"),],- footer="Just type normally to chat with Claude Code!"+ footer="Just type normally to chat with Claude Code!",)-+# Send as new messageawait self.im_client.send_message(context, info_text)logger.info(f"Sent how_it_works info to user {context.user_id}")-+except Exception as e:logger.error(f"Error in handle_info_how_it_works: {e}", exc_info=True)- await self.im_client.send_message(context, "❌ Error showing help information")\ No newline at end of file+ await self.im_client.send_message(+ context, "❌ Error showing help information"+ )diff --git a/docs/SLACK_SETUP.md b/docs/SLACK_SETUP.mdindex 5028fce83..731a2117d 100644--- a/docs/SLACK_SETUP.md+++ b/docs/SLACK_SETUP.md@@ -1,18 +1,18 @@# Slack Bot Setup Guide-This guide will walk you through setting up a Slack bot for the Claude Code Remote Control Bot.+This guide will walk you through setting up a Slack bot for Vibe Remote.## Prerequisites- Admin access to a Slack workspace- Python 3.6 or higher installed-- Claude Code Remote Control Bot cloned and dependencies installed+- Vibe Remote cloned and dependencies installed## Step 1: Create a Slack App1. Go to [https://api.slack.com/apps](https://api.slack.com/apps)2. Click **"Create New App"** → **"From scratch"**-3. Enter an app name (e.g., "Claude Code Bot")+3. Enter an app name (e.g., "Vibe Remote")4. Select your workspace5. Click **"Create App"**@@ -23,34 +23,39 @@ This guide will walk you through setting up a Slack bot for the Claude Code Remo3. Add ALL the following OAuth scopes to avoid permission issues:### Essential Scopes (Required)- - `channels:history` - View messages in public channels- - `channels:read` - View basic information about public channels- - `chat:write` - Send messages as bot- - `app_mentions:read` - View messages that mention your bot- - `users:read` - View basic information about users- - `commands` - Use slash commands (automatically added)++- `channels:history` - View messages in public channels+- `channels:read` - View basic information about public channels+- `chat:write` - Send messages as bot+- `app_mentions:read` - View messages that mention your bot+- `users:read` - View basic information about users+- `commands` - Use slash commands (automatically added)### Private Channel Support- - `groups:read` - View basic information about private channels- - `groups:history` - View messages in private channels- - `groups:write` - Send messages to private channels++- `groups:read` - View basic information about private channels+- `groups:history` - View messages in private channels+- `groups:write` - Send messages to private channels### Enhanced Features- - `chat:write.public` - Send messages to channels without joining- - `chat:write.customize` - Send messages with custom username and avatar- - `files:read` - View files shared in channels (for future file handling)- - `files:write` - Upload files (for future file upload support)- - `reactions:read` - View emoji reactions- - `reactions:write` - Add emoji reactions- - `users:read.email` - View email addresses (for enhanced user info)- - `team:read` - View team/workspace information++- `chat:write.public` - Send messages to channels without joining+- `chat:write.customize` - Send messages with custom username and avatar+- `files:read` - View files shared in channels (for future file handling)+- `files:write` - Upload files (for future file upload support)+- `reactions:read` - View emoji reactions+- `reactions:write` - Add emoji reactions+- `users:read.email` - View email addresses (for enhanced user info)+- `team:read` - View team/workspace information**Note**: It's better to add all permissions now to avoid reinstalling the app multiple times later. Unused permissions won't affect the bot's performance.### Quick Permission Checklist+To ensure full functionality, make sure you've added:+- ✅ All Essential Scopes (6 scopes)-- ✅ All Private Channel scopes (3 scopes)+- ✅ All Private Channel scopes (3 scopes)- ✅ Any Enhanced Features you want (up to 8 additional scopes)**Total recommended scopes: ~17 scopes** for full functionality.@@ -83,16 +88,18 @@ Socket Mode allows your bot to connect without exposing a public URL.3. Under **"Subscribe to bot events"**, add ALL these events:### Message Events- - `message.channels` - Messages in public channels- - `message.groups` - Messages in private channels- - `app_mention` - When someone mentions your bot++- `message.channels` - Messages in public channels+- `message.groups` - Messages in private channels+- `app_mention` - When someone mentions your bot### Additional Events (Optional but Recommended)- - `member_joined_channel` - When bot joins a channel- - `member_left_channel` - When bot leaves a channel- - `channel_created` - When a new channel is created- - `channel_renamed` - When a channel is renamed- - `team_join` - When a new member joins the workspace++- `member_joined_channel` - When bot joins a channel+- `member_left_channel` - When bot leaves a channel+- `channel_created` - When a new channel is created+- `channel_renamed` - When a channel is renamed+- `team_join` - When a new member joins the workspace4. Click **"Save Changes"**@@ -106,12 +113,13 @@ Native Slack slash commands provide the best user experience with autocomplete a1. Navigate to [https://api.slack.com/apps](https://api.slack.com/apps)2. Log in to your Slack account (if not already logged in)-3. Find your Claude Code Bot app in the "Your Apps" list+3. Find your Vibe Remote app in the "Your Apps" list4. Click on your app name to enter the management interface5. In the left sidebar, find **"Features"** section and click **"Slash Commands"**6. You'll see the "Slash Commands" page showing any existing commands**Page Overview**:+- New apps will show "You haven't created any slash commands yet"- Green **"Create New Command"** button is in the top right corner- Existing commands appear in a list with edit options@@ -119,6 +127,7 @@ Native Slack slash commands provide the best user experience with autocomplete a### 6.2 Create Commands**Steps for each command**:+1. Click **"Create New Command"** button2. Fill in the command form (see specific configurations below)3. Click **"Save"** to save the command@@ -126,6 +135,7 @@ Native Slack slash commands provide the best user experience with autocomplete a5. Return to command list to verify creation**Important Notes**:+- Commands must be created one at a time- Command names cannot be duplicated or contain spaces- All fields are case-sensitive@@ -133,6 +143,7 @@ Native Slack slash commands provide the best user experience with autocomplete a### 6.3 Required Commands**Configuration Guidelines**:+- Leave **Request URL** empty for all commands (we use Socket Mode)- Check **"Escape channels, users, and links"** for all commands- Copy and paste the configurations below@@ -140,34 +151,40 @@ Native Slack slash commands provide the best user experience with autocomplete a---#### Command 1: `/start`+```Command: /startRequest URL: (leave empty)Short Description: Open main menu with interactive buttons-Usage Hint: Start Claude Code bot and show menu+Usage Hint: Start Vibe Remote and show menu```+**Steps**:+1. Click **"Create New Command"**2. Fill in **"Command"** field: `/start`3. Leave **"Request URL"** blank4. Fill in **"Short Description"**: `Open main menu with interactive buttons`-5. Fill in **"Usage Hint"**: `Start Claude Code bot and show menu`+5. Fill in **"Usage Hint"**: `Start Vibe Remote and show menu`6. ✅ Check "Escape channels, users, and links"7. Click **"Save"**8. Return to Slash Commands page#### Command 2: `/stop`+```Command: /stopRequest URL: (leave empty)-Short Description: Stop Claude Code bot session+Short Description: Stop Vibe Remote sessionUsage Hint: Stop the current bot session```+**Steps**:+1. Click **"Create New Command"**2. Fill in **"Command"** field: `/stop`3. Leave **"Request URL"** blank-4. Fill in **"Short Description"**: `Stop Claude Code bot session`+4. Fill in **"Short Description"**: `Stop Vibe Remote session`5. Fill in **"Usage Hint"**: `Stop the current bot session`6. ✅ Check "Escape channels, users, and links"7. Click **"Save"**@@ -185,6 +202,7 @@ Usage Hint: Stop the current bot session### 6.5 VerificationAfter creating both commands:+1. Go back to the main "Slash Commands" page2. You should see both `/start` and `/stop` commands listed3. Each command should show "✅ Configured" status@@ -192,6 +210,7 @@ After creating both commands:### 6.6 Setup Checklist**Verify your configuration**:+- [ ] Accessed [https://api.slack.com/apps](https://api.slack.com/apps) and selected your app- [ ] Navigated to "Features" > "Slash Commands" page- [ ] Created `/start` command@@ -203,11 +222,13 @@ After creating both commands:### 6.7 Troubleshooting Slash CommandsIf commands not showing in autocomplete:+- Reinstall app to workspace via "OAuth & Permissions" page- Verify Socket Mode is enabled- Ensure bot is invited to channel: `/invite @YourBotName`If commands execute but no response:+- Check bot process is running- Verify `SLACK_APP_TOKEN` and `SLACK_BOT_TOKEN` are correctly configured@@ -230,6 +251,7 @@ SLACK_TARGET_CHANNEL=[C1234567890,C0987654321]### Finding Channel IDsTo find a channel ID:+1. Right-click on the channel name in Slack2. Select **"View channel details"**3. Scroll to the bottom@@ -256,15 +278,18 @@ python main.pyThe bot supports multiple ways to interact:#### 1. Slash Commands (Recommended)+```/start/stop```+- Provides autocomplete and help text- Works in any channel where the bot is invited- Most user-friendly experience#### 2. In Channels+- Use `/start` to begin- The bot creates threads to organize conversations- All responses appear in the thread@@ -272,6 +297,7 @@ The bot supports multiple ways to interact:### Using the Bot#### Primary Command+- `/start` - Opens the main menu with interactive buttons:- **Current Dir** - Display current working directory- **Change Work Dir** - Open modal to change working directory@@ -280,10 +306,13 @@ The bot supports multiple ways to interact:- **How it Works** - Display help information#### Additional Command-- `/stop` - Stop the current Claude Code session++- `/stop` - Stop the current Vibe Remote session#### Sending Messages to Claude+After using `/start`, simply type your message in the channel. The bot will:+1. Send your message to Claude Code2. Stream the response back in real-time3. Maintain conversation context for follow-ups@@ -291,6 +320,7 @@ After using `/start`, simply type your message in the channel. The bot will:## Thread SupportThe Slack bot automatically uses threads to organize conversations:+- Each user's messages are grouped in a thread- Responses from Claude Code appear in the same thread- This keeps channel history clean and organized@@ -298,11 +328,13 @@ The Slack bot automatically uses threads to organize conversations:## Troubleshooting### Bot not responding+1. Check that the bot is online (green dot in Slack)2. Verify the bot was invited to the channel3. Check logs for any error messages### Permission errors+1. Ensure all required scopes are added (including `groups:read` for private channels)2. **Important**: After adding new scopes, you MUST reinstall the app to workspace:- Go to **"OAuth & Permissions"** page@@ -311,7 +343,9 @@ The Slack bot automatically uses threads to organize conversations:3. Verify tokens are correctly set in `.env`### Private Channel Access Issues+If you see `missing_scope` errors with `groups:read`:+1. Add ALL private channel scopes: `groups:read`, `groups:history`, `groups:write`2. Click **"Reinstall to Workspace"** (this is mandatory!)3. Copy the new Bot Token and update your `.env` file@@ -319,13 +353,16 @@ If you see `missing_scope` errors with `groups:read`:5. Ensure bot is invited to the private channel: `/invite @YourBotName`### Thread Reply Issues+If you see `cannot_reply_to_message` error:+1. This usually means the bot is trying to reply to a message that doesn't exist or in wrong context2. Ensure the bot has `channels:history` or `groups:history` permission for the channel type3. Check that the message timestamp (thread_ts) is valid4. Verify the bot is a member of the channel where it's trying to reply### Socket Mode issues+1. Ensure `SLACK_APP_TOKEN` is set correctly2. Check that the app-level token has `connections:write` scope3. Verify Socket Mode is enabled in app settings@@ -333,12 +370,14 @@ If you see `cannot_reply_to_message` error:### Slash Command IssuesIf slash commands not working:-1. Verify commands created in app settings++1. Verify commands created in app settings2. Check Socket Mode is enabled3. Ensure bot is invited to channel: `/invite @YourBotName`4. Restart bot if neededCheck bot logs for startup confirmation:+```INFO - Starting Slack bot in Socket Mode...INFO - A new session has been established@@ -366,4 +405,4 @@ Note: Webhook mode requires a publicly accessible HTTPS endpoint, which is more- [Slack API Documentation](https://api.slack.com/)- [Python Slack SDK](https://slack.dev/python-slack-sdk/)-- [Socket Mode Guide](https://api.slack.com/apis/connections/socket)\ No newline at end of file+- [Socket Mode Guide](https://api.slack.com/apis/connections/socket)diff --git a/docs/SLACK_SETUP_ZH.md b/docs/SLACK_SETUP_ZH.mdindex ee4922d83..78e0bee3d 100644--- a/docs/SLACK_SETUP_ZH.md+++ b/docs/SLACK_SETUP_ZH.md@@ -1,18 +1,18 @@# Slack 机器人设置指南-本指南将指导你为 Claude Code 远程控制机器人设置 Slack 机器人。+本指南将指导你为 Vibe Remote 设置 Slack 机器人。## 前置条件- Slack 工作区的管理员权限- 已安装 Python 3.6 或更高版本-- 已克隆 Claude Code 远程控制机器人并安装依赖+- 已克隆 Vibe Remote 并安装依赖## 步骤 1:创建 Slack 应用1. 访问 [https://api.slack.com/apps](https://api.slack.com/apps)2. 点击 **"Create New App"** → **"From scratch"**-3. 输入应用名称(例如 "Claude Code Bot")+3. 输入应用名称(例如 "Vibe Remote")4. 选择你的工作区5. 点击 **"Create App"**@@ -23,32 +23,37 @@3. 添加以下所有 OAuth 权限范围以避免权限问题:### 基础权限范围(必需)- - `channels:history` - 查看公共频道中的消息- - `channels:read` - 查看公共频道的基本信息- - `chat:write` - 作为机器人发送消息- - `app_mentions:read` - 查看提及你的机器人的消息- - `users:read` - 查看用户的基本信息- - `commands` - 使用斜杠命令(自动添加)++- `channels:history` - 查看公共频道中的消息+- `channels:read` - 查看公共频道的基本信息+- `chat:write` - 作为机器人发送消息+- `app_mentions:read` - 查看提及你的机器人的消息+- `users:read` - 查看用户的基本信息+- `commands` - 使用斜杠命令(自动添加)### 私有频道支持- - `groups:read` - 查看私有频道的基本信息- - `groups:history` - 查看私有频道中的消息- - `groups:write` - 向私有频道发送消息++- `groups:read` - 查看私有频道的基本信息+- `groups:history` - 查看私有频道中的消息+- `groups:write` - 向私有频道发送消息### 增强功能- - `chat:write.public` - 无需加入即可向频道发送消息- - `chat:write.customize` - 使用自定义用户名和头像发送消息- - `files:read` - 查看频道中共享的文件(用于未来的文件处理)- - `files:write` - 上传文件(用于未来的文件上传支持)- - `reactions:read` - 查看表情反应- - `reactions:write` - 添加表情反应- - `users:read.email` - 查看电子邮件地址(用于增强用户信息)- - `team:read` - 查看团队/工作区信息++- `chat:write.public` - 无需加入即可向频道发送消息+- `chat:write.customize` - 使用自定义用户名和头像发送消息+- `files:read` - 查看频道中共享的文件(用于未来的文件处理)+- `files:write` - 上传文件(用于未来的文件上传支持)+- `reactions:read` - 查看表情反应+- `reactions:write` - 添加表情反应+- `users:read.email` - 查看电子邮件地址(用于增强用户信息)+- `team:read` - 查看团队/工作区信息**注意**:现在添加所有权限比以后多次重新安装应用要好。未使用的权限不会影响机器人的性能。### 快速权限检查清单+为确保完整功能,请确保已添加:+- ✅ 所有基础权限范围(6 个权限)- ✅ 所有私有频道权限(3 个权限)- ✅ 任何你想要的增强功能(最多 8 个额外权限)@@ -83,16 +88,18 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。3. 在 **"Subscribe to bot events"** 下,添加所有这些事件:### 消息事件- - `message.channels` - 公共频道中的消息- - `message.groups` - 私有频道中的消息- - `app_mention` - 有人提及你的机器人时++- `message.channels` - 公共频道中的消息+- `message.groups` - 私有频道中的消息+- `app_mention` - 有人提及你的机器人时### 其他事件(可选但推荐)- - `member_joined_channel` - 机器人加入频道时- - `member_left_channel` - 机器人离开频道时- - `channel_created` - 创建新频道时- - `channel_renamed` - 频道重命名时- - `team_join` - 新成员加入工作区时++- `member_joined_channel` - 机器人加入频道时+- `member_left_channel` - 机器人离开频道时+- `channel_created` - 创建新频道时+- `channel_renamed` - 频道重命名时+- `team_join` - 新成员加入工作区时4. 点击 **"Save Changes"**@@ -106,12 +113,13 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。1. 导航到 [https://api.slack.com/apps](https://api.slack.com/apps)2. 登录你的 Slack 账户(如果尚未登录)-3. 在"Your Apps"列表中找到你的 Claude Code Bot 应用+3. 在"Your Apps"列表中找到你的 Vibe Remote 应用4. 点击应用名称进入管理界面5. 在左侧边栏中,找到 **"Features"** 部分并点击 **"Slash Commands"**6. 你将看到"Slash Commands"页面,显示任何现有命令**页面概览**:+- 新应用会显示"You haven't created any slash commands yet"- 绿色的 **"Create New Command"** 按钮位于右上角- 现有命令以列表形式显示,带有编辑选项@@ -119,6 +127,7 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。### 6.2 创建命令**每个命令的步骤**:+1. 点击 **"Create New Command"** 按钮2. 填写命令表单(见下方具体配置)3. 点击 **"Save"** 保存命令@@ -126,6 +135,7 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。5. 返回命令列表验证创建**重要说明**:+- 命令必须逐个创建- 命令名称不能重复或包含空格- 所有字段都区分大小写@@ -133,6 +143,7 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。### 6.3 必需的命令**配置指南**:+- 所有命令的 **Request URL** 留空(我们使用 Socket 模式)- 为所有命令勾选 **"Escape channels, users, and links"**- 复制并粘贴下面的配置@@ -140,13 +151,16 @@ Socket 模式允许你的机器人连接而无需暴露公共 URL。---#### 命令 1:`/start`+```Command: /startRequest URL: (留空)Short Description: 打开带有交互按钮的主菜单-Usage Hint: 启动 Claude Code 机器人并显示菜单+Usage Hint: 启动 Vibe Remote 并显示菜单```+**步骤**:+1. 点击 **"Create New Command"**2. 填写 **"Command"** 字段:`/start`3. **"Request URL"** 留空@@ -157,13 +171,16 @@ Usage Hint: 启动 Claude Code 机器人并显示菜单8. 返回 Slash Commands 页面#### 命令 2:`/stop`+```Command: /stopRequest URL: (留空)-Short Description: 停止 Claude Code 机器人会话+Short Description: 停止 Vibe Remote 会话Usage Hint: 停止当前机器人会话```+**步骤**:+1. 点击 **"Create New Command"**2. 填写 **"Command"** 字段:`/stop`3. **"Request URL"** 留空@@ -185,6 +202,7 @@ Usage Hint: 停止当前机器人会话### 6.5 验证创建两个命令后:+1. 返回主"Slash Commands"页面2. 你应该看到 `/start` 和 `/stop` 命令都列出3. 每个命令应显示"✅ Configured"状态@@ -192,6 +210,7 @@ Usage Hint: 停止当前机器人会话### 6.6 设置检查清单**验证你的配置**:+- [ ] 访问 [https://api.slack.com/apps](https://api.slack.com/apps) 并选择你的应用- [ ] 导航到"Features" > "Slash Commands"页面- [ ] 创建 `/start` 命令@@ -203,11 +222,13 @@ Usage Hint: 停止当前机器人会话### 6.7 斜杠命令故障排除如果命令不在自动完成中显示:+- 通过"OAuth & Permissions"页面重新安装应用到工作区- 验证 Socket 模式已启用- 确保机器人被邀请到频道:`/invite @YourBotName`如果命令执行但无响应:+- 检查机器人进程正在运行- 验证 `SLACK_APP_TOKEN` 和 `SLACK_BOT_TOKEN` 配置正确@@ -230,6 +251,7 @@ SLACK_TARGET_CHANNEL=[C1234567890,C0987654321]### 查找频道 ID要查找频道 ID:+1. 在 Slack 中右键点击频道名称2. 选择 **"View channel details"**3. 滚动到底部@@ -256,15 +278,18 @@ python main.py机器人支持多种交互方式:#### 1. 斜杠命令(推荐)+```/start/stop```+- 提供自动完成和帮助文本- 在机器人被邀请的任何频道中工作- 最友好的用户体验#### 2. 在频道中+- 使用 `/start` 开始- 机器人创建线程来组织对话- 所有响应都出现在线程中@@ -272,6 +297,7 @@ python main.py### 使用机器人#### 主要命令+- `/start` - 打开带有交互按钮的主菜单:- **Current Dir** - 显示当前工作目录- **Change Work Dir** - 打开模态框更改工作目录@@ -280,10 +306,13 @@ python main.py- **How it Works** - 显示帮助信息#### 附加命令-- `/stop` - 停止当前 Claude Code 会话++- `/stop` - 停止当前 Vibe Remote 会话#### 向 Claude 发送消息+使用 `/start` 后,只需在频道中输入你的消息。机器人将:+1. 将你的消息发送到 Claude Code2. 实时流式传输响应3. 为后续消息维护对话上下文@@ -291,6 +320,7 @@ python main.py## 线程支持Slack 机器人自动使用线程来组织对话:+- 每个用户的消息都分组在一个线程中- Claude Code 的响应出现在同一线程中- 这使频道历史记录保持整洁有序@@ -298,11 +328,13 @@ Slack 机器人自动使用线程来组织对话:## 故障排除### 机器人无响应+1. 检查机器人是否在线(Slack 中的绿点)2. 验证机器人是否被邀请到频道3. 检查日志中的任何错误消息### 权限错误+1. 确保添加了所有必需的权限范围(包括私有频道的 `groups:read`)2. **重要**:添加新权限范围后,你必须重新安装应用到工作区:- 转到 **"OAuth & Permissions"** 页面@@ -311,7 +343,9 @@ Slack 机器人自动使用线程来组织对话:3. 验证令牌在 `.env` 中正确设置### 私有频道访问问题+如果你看到 `missing_scope` 错误与 `groups:read`:+1. 添加所有私有频道权限范围:`groups:read`、`groups:history`、`groups:write`2. 点击 **"Reinstall to Workspace"**(这是强制性的!)3. 复制新的 Bot Token 并更新你的 `.env` 文件@@ -319,13 +353,16 @@ Slack 机器人自动使用线程来组织对话:5. 确保机器人被邀请到私有频道:`/invite @YourBotName`### 线程回复问题+如果你看到 `cannot_reply_to_message` 错误:+1. 这通常意味着机器人正在尝试回复不存在的消息或在错误的上下文中2. 确保机器人对频道类型有 `channels:history` 或 `groups:history` 权限3. 检查消息时间戳(thread_ts)是否有效4. 验证机器人是它尝试回复的频道的成员### Socket 模式问题+1. 确保 `SLACK_APP_TOKEN` 设置正确2. 检查应用级令牌是否有 `connections:write` 权限范围3. 验证应用设置中已启用 Socket 模式@@ -333,12 +370,14 @@ Slack 机器人自动使用线程来组织对话:### 斜杠命令问题如果斜杠命令不工作:+1. 验证命令在应用设置中已创建2. 检查 Socket 模式已启用3. 确保机器人被邀请到频道:`/invite @YourBotName`4. 如需要重启机器人检查机器人日志的启动确认:+```INFO - Starting Slack bot in Socket Mode...INFO - A new session has been established@@ -366,4 +405,4 @@ INFO - A new session has been established- [Slack API 文档](https://api.slack.com/)- [Python Slack SDK](https://slack.dev/python-slack-sdk/)-- [Socket 模式指南](https://api.slack.com/apis/connections/socket)\ No newline at end of file+- [Socket 模式指南](https://api.slack.com/apis/connections/socket)diff --git a/docs/TELEGRAM_SETUP.md b/docs/TELEGRAM_SETUP.mdindex 0d913bb87..e2a759671 100644--- a/docs/TELEGRAM_SETUP.md+++ b/docs/TELEGRAM_SETUP.md@@ -1,12 +1,12 @@# Telegram Bot Setup Guide-This guide will walk you through setting up a Telegram bot for the Claude Code Remote Control Bot.+This guide will walk you through setting up a Telegram bot for Vibe Remote.## Prerequisites- Telegram account- Python 3.6 or higher installed-- Claude Code Remote Control Bot cloned and dependencies installed+- Vibe Remote cloned and dependencies installed## Step 1: Create a Telegram Bot@@ -14,7 +14,7 @@ This guide will walk you through setting up a Telegram bot for the Claude Code R2. Start a conversation with BotFather3. Send the command `/newbot`4. Follow the prompts:- - Choose a name for your bot (e.g., "Claude Code Bot")+ - Choose a name for your bot (e.g., "Vibe Remote")- Choose a username for your bot (must end in `bot`, e.g., `claude_code_bot`)5. BotFather will provide you with a **bot token** that looks like:```@@ -27,24 +27,31 @@ This guide will walk you through setting up a Telegram bot for the Claude Code RWhile still chatting with BotFather, you can configure additional settings:### Set Bot Description+```/setdescription```+Then select your bot and provide a description like:-"Remote control bot for Claude Code - execute commands and get AI assistance"+"Vibe Remote - trigger AI coding from Telegram"### Set About Text+```/setabouttext```+Select your bot and add:-"Claude Code Remote Control Bot - AI-powered coding assistant"+"Vibe Remote - AI-powered remote coding assistant"### Set Bot Commands+```/setcommands```+Select your bot and paste these commands:+```start - Show welcome message and available commandsclear - Reset conversation and start fresh@@ -54,9 +61,11 @@ settings - Open personalization settings```### Enable Inline Mode (Optional)+```/setinline```+This allows the bot to be used inline in other chats.## Step 3: Configure Your Environment@@ -82,17 +91,20 @@ CLAUDE_CWD=/path/to/your/projectTo find a chat ID:#### For Personal Chats+1. Send any message to your bot2. Check the bot logs - the chat ID will be displayed3. Personal chat IDs are positive numbers#### For Groups+1. Add the bot to the group2. Send a message in the group3. Check the bot logs for the chat ID4. Group chat IDs are negative numbers starting with `-100`#### Using IDBot (Alternative)+1. Add **@username_to_id_bot** to your group2. It will automatically display the chat ID3. Remove the bot after getting the ID@@ -131,6 +143,7 @@ The bot should now be running and ready to accept commands.### Sending Messages to ClaudeAfter starting the bot, simply send any message and it will be forwarded to Claude Code. The bot will:+1. Send your message to Claude Code2. Stream the response back in real-time3. Maintain conversation context for follow-ups@@ -138,6 +151,7 @@ After starting the bot, simply send any message and it will be forwarded to Clau### In GroupsWhen using the bot in groups:+- Messages must start with `/` to be processed as commands- Regular messages are processed as Claude queries- The bot maintains separate sessions for each chat@@ -147,14 +161,16 @@ When using the bot in groups:### Message FormattingThe bot supports Telegram's MarkdownV2 format:+- **Bold text** with `**text**`-- *Italic text* with `*text*`+- _Italic text_ with `*text*`- `Code` with backticks-- ```Code blocks``` with triple backticks+- `Code blocks` with triple backticks### Inline KeyboardsThe settings command provides inline keyboard buttons for:+- Show/hide raw Claude output- Show/hide thinking process- Reset session@@ -163,6 +179,7 @@ The settings command provides inline keyboard buttons for:### Real-time StreamingMessages from Claude are streamed in real-time:+- Long messages are automatically split- Code blocks are properly formatted- Progress is shown during processing@@ -200,6 +217,7 @@ Messages from Claude are streamed in real-time:### Rate limitingTelegram has rate limits:+- 30 messages per second to different users- 20 messages per minute to the same group- 1 message per second to the same user@@ -209,16 +227,19 @@ If you hit rate limits, the bot will automatically retry with delays.## Security Considerations### Token Security+- Never commit the bot token to version control- Keep the token private - anyone with it can control your bot- Regenerate the token if it's ever exposed### Chat Whitelisting+- Use `TELEGRAM_CHAT_ID` to restrict bot access to specific chats- This prevents unauthorized users from using your bot- Leave it as `null` only for development/testing### Group Security+- Consider making the bot admin with restricted permissions- Monitor bot usage in groups- Use chat whitelisting for production deployments@@ -236,6 +257,7 @@ For production deployments, you can use webhooks instead of polling:### Custom KeyboardsYou can implement custom keyboard layouts for frequently used commands:+- Reply keyboards for quick command access- Inline keyboards for interactive menus- Remove keyboards when not needed@@ -243,6 +265,7 @@ You can implement custom keyboard layouts for frequently used commands:### Persistent SettingsUser settings are stored in `user_settings.json`:+- Per-user preferences- Session management- Message visibility options@@ -260,4 +283,4 @@ User settings are stored in `user_settings.json`:2. **Logging**: Enable debug logging to troubleshoot issues3. **Updates**: Keep the python-telegram-bot library updated4. **Monitoring**: Use bot analytics to track usage-5. **Backups**: Regularly backup your `user_settings.json` file\ No newline at end of file+5. **Backups**: Regularly backup your `user_settings.json` filediff --git a/docs/TELEGRAM_SETUP_ZH.md b/docs/TELEGRAM_SETUP_ZH.mdindex 1470e615f..9f68c5b1d 100644--- a/docs/TELEGRAM_SETUP_ZH.md+++ b/docs/TELEGRAM_SETUP_ZH.md@@ -1,12 +1,12 @@# Telegram 机器人设置指南-本指南将指导你为 Claude Code 远程控制机器人设置 Telegram 机器人。+本指南将指导你为 Vibe Remote 设置 Telegram 机器人。## 前置条件- Telegram 账户- 已安装 Python 3.6 或更高版本-- 已克隆 Claude Code 远程控制机器人并安装依赖+- 已克隆 Vibe Remote 并安装依赖## 步骤 1:创建 Telegram 机器人@@ -14,7 +14,7 @@2. 与 BotFather 开始对话3. 发送命令 `/newbot`4. 按照提示操作:- - 为你的机器人选择一个名称(例如 "Claude Code Bot")+ - 为你的机器人选择一个名称(例如 "Vibe Remote")- 为你的机器人选择用户名(必须以 `bot` 结尾,例如 `claude_code_bot`)5. BotFather 会提供一个**机器人令牌**,格式如下:```@@ -27,24 +27,31 @@继续与 BotFather 对话,你可以配置其他设置:### 设置机器人描述+```/setdescription```+然后选择你的机器人并提供描述,例如:-"Claude Code 远程控制机器人 - 执行命令并获得 AI 协助"+"Vibe Remote - 远程编码助手"### 设置关于文本+```/setabouttext```+选择你的机器人并添加:-"Claude Code 远程控制机器人 - AI 驱动的编程助手"+"Vibe Remote - AI 驱动的远程编码助手"### 设置机器人命令+```/setcommands```+选择你的机器人并粘贴这些命令:+```start - 显示欢迎消息和可用命令clear - 重置对话并重新开始@@ -54,9 +61,11 @@ settings - 打开个性化设置```### 启用内联模式(可选)+```/setinline```+这允许机器人在其他聊天中以内联方式使用。## 步骤 3:配置你的环境@@ -82,17 +91,20 @@ CLAUDE_CWD=/path/to/your/project查找聊天 ID 的方法:#### 个人聊天+1. 向你的机器人发送任何消息2. 检查机器人日志 - 将显示聊天 ID3. 个人聊天 ID 是正数#### 群组+1. 将机器人添加到群组2. 在群组中发送消息3. 检查机器人日志中的聊天 ID4. 群组聊天 ID 是以 `-100` 开头的负数#### 使用 IDBot(替代方法)+1. 将 **@username_to_id_bot** 添加到你的群组2. 它会自动显示聊天 ID3. 获取 ID 后移除该机器人@@ -131,6 +143,7 @@ python main.py### 向 Claude 发送消息启动机器人后,只需发送任何消息,它就会被转发到 Claude Code。机器人将:+1. 将你的消息发送到 Claude Code2. 实时流式传输响应3. 为后续消息维护对话上下文@@ -138,6 +151,7 @@ python main.py### 在群组中使用在群组中使用机器人时:+- 消息必须以 `/` 开头才能作为命令处理- 常规消息作为 Claude 查询处理- 机器人为每个聊天维护独立的会话@@ -147,14 +161,16 @@ python main.py### 消息格式化机器人支持 Telegram 的 MarkdownV2 格式:+- **粗体文本** 使用 `**文本**`-- *斜体文本* 使用 `*文本*`+- _斜体文本_ 使用 `*文本*`- `代码` 使用反引号-- ```代码块``` 使用三个反引号+- `代码块` 使用三个反引号### 内联键盘设置命令提供内联键盘按钮:+- 显示/隐藏原始 Claude 输出- 显示/隐藏思考过程- 重置会话@@ -163,6 +179,7 @@ python main.py### 实时流式传输来自 Claude 的消息实时流式传输:+- 长消息自动分割- 代码块正确格式化- 处理期间显示进度@@ -200,6 +217,7 @@ python main.py### 速率限制Telegram 有速率限制:+- 每秒向不同用户发送 30 条消息- 每分钟向同一群组发送 20 条消息- 每秒向同一用户发送 1 条消息@@ -209,16 +227,19 @@ Telegram 有速率限制:## 安全注意事项### 令牌安全+- 永远不要将机器人令牌提交到版本控制- 保持令牌私密 - 任何拥有它的人都可以控制你的机器人- 如果令牌曾经暴露,请重新生成### 聊天白名单+- 使用 `TELEGRAM_CHAT_ID` 限制机器人访问特定聊天- 这可以防止未授权用户使用你的机器人- 仅在开发/测试时将其设置为 `null`### 群组安全+- 考虑将机器人设为具有受限权限的管理员- 监控群组中的机器人使用情况- 在生产部署中使用聊天白名单@@ -236,6 +257,7 @@ Telegram 有速率限制:### 自定义键盘你可以为常用命令实现自定义键盘布局:+- 用于快速命令访问的回复键盘- 用于交互式菜单的内联键盘- 不需要时移除键盘@@ -243,6 +265,7 @@ Telegram 有速率限制:### 持久化设置用户设置存储在 `user_settings.json` 中:+- 每用户偏好设置- 会话管理- 消息可见性选项@@ -260,4 +283,4 @@ Telegram 有速率限制:2. **日志**:启用调试日志以排除问题3. **更新**:保持 python-telegram-bot 库更新4. **监控**:使用机器人分析跟踪使用情况-5. **备份**:定期备份你的 `user_settings.json` 文件\ No newline at end of file+5. **备份**:定期备份你的 `user_settings.json` 文件