Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
Merge origin/main into feat/mochat-channel
tjb-techef7972b6d34e
diff --cc README.mdindex 55dc7fa53,8f7c1a2a3..d15fd2f6c--- a/README.md+++ b/README.md@@@ -164,7 -166,7 +166,7 @@@ nanobot agent -m "Hello from my local L## π¬ Chat Apps- Talk to your nanobot through Telegram, Discord, WhatsApp, Feishu, or Mochat β anytime, anywhere.-Talk to your nanobot through Telegram, Discord, WhatsApp, Feishu, DingTalk, or Email β anytime, anywhere.++Talk to your nanobot through Telegram, Discord, WhatsApp, Feishu, Mochat, DingTalk, or Email β anytime, anywhere.| Channel | Setup ||---------|-------|@@@ -172,7 -174,8 +174,9 @@@| **Discord** | Easy (bot token + intents) || **WhatsApp** | Medium (scan QR) || **Feishu** | Medium (app credentials) |+| **Mochat** | Medium (claw token + websocket) |+ | **DingTalk** | Medium (app credentials) |+ | **Email** | Medium (IMAP/SMTP credentials) |<details><summary><b>Telegram</b> (Recommended)</summary>diff --cc nanobot/channels/manager.pyindex 64214ce1e,26fa9f32a..f1d000196--- a/nanobot/channels/manager.py+++ b/nanobot/channels/manager.py@@@ -78,20 -85,37 +85,49 @@@ class ChannelManagerexcept ImportError as e:logger.warning(f"Feishu channel not available: {e}")+ # Mochat channel+ if self.config.channels.mochat.enabled:+ try:+ from nanobot.channels.mochat import MochatChannel++ self.channels["mochat"] = MochatChannel(+ self.config.channels.mochat, self.bus+ )+ logger.info("Mochat channel enabled")+ except ImportError as e:+ logger.warning(f"Mochat channel not available: {e}")+++ # DingTalk channel+ if self.config.channels.dingtalk.enabled:+ try:+ from nanobot.channels.dingtalk import DingTalkChannel+ self.channels["dingtalk"] = DingTalkChannel(+ self.config.channels.dingtalk, self.bus+ )+ logger.info("DingTalk channel enabled")+ except ImportError as e:+ logger.warning(f"DingTalk channel not available: {e}")++ # Email channel+ if self.config.channels.email.enabled:+ try:+ from nanobot.channels.email import EmailChannel+ self.channels["email"] = EmailChannel(+ self.config.channels.email, self.bus+ )+ logger.info("Email channel enabled")+ except ImportError as e:+ logger.warning(f"Email channel not available: {e}")+ async def _start_channel(self, name: str, channel: BaseChannel) -> None:+ """Start a channel and log any exceptions."""+ try:+ await channel.start()+ except Exception as e:+ logger.error(f"Failed to start channel {name}: {e}")+async def start_all(self) -> None:- """Start WhatsApp channel and the outbound dispatcher."""+ """Start all channels and the outbound dispatcher."""if not self.channels:logger.warning("No channels enabled")returndiff --cc nanobot/config/schema.pyindex 1d6ca9e22,aa9729b03..a3d8aa5f3--- a/nanobot/config/schema.py+++ b/nanobot/config/schema.py@@@ -38,50 -46,45 +46,82 @@@ class DiscordConfig(BaseModel)gateway_url: str = "wss://gateway.discord.gg/?v=10&encoding=json"intents: int = 37377 # GUILDS + GUILD_MESSAGES + DIRECT_MESSAGES + MESSAGE_CONTENT+ class EmailConfig(BaseModel):+ """Email channel configuration (IMAP inbound + SMTP outbound)."""+ enabled: bool = False+ consent_granted: bool = False # Explicit owner permission to access mailbox data++ # IMAP (receive)+ imap_host: str = ""+ imap_port: int = 993+ imap_username: str = ""+ imap_password: str = ""+ imap_mailbox: str = "INBOX"+ imap_use_ssl: bool = True++ # SMTP (send)+ smtp_host: str = ""+ smtp_port: int = 587+ smtp_username: str = ""+ smtp_password: str = ""+ smtp_use_tls: bool = True+ smtp_use_ssl: bool = False+ from_address: str = ""++ # Behavior+ auto_reply_enabled: bool = True # If false, inbound email is read but no automatic reply is sent+ poll_interval_seconds: int = 30+ mark_seen: bool = True+ max_body_chars: int = 12000+ subject_prefix: str = "Re: "+ allow_from: list[str] = Field(default_factory=list) # Allowed sender email addresses++class MochatMentionConfig(BaseModel):+ """Mochat mention behavior configuration."""+ require_in_groups: bool = False+++class MochatGroupRule(BaseModel):+ """Mochat per-group mention requirement."""+ require_mention: bool = False+++class MochatConfig(BaseModel):+ """Mochat channel configuration."""+ enabled: bool = False+ base_url: str = "http://localhost:11000"+ socket_url: str = ""+ socket_path: str = "/socket.io"+ socket_disable_msgpack: bool = False+ socket_reconnect_delay_ms: int = 1000+ socket_max_reconnect_delay_ms: int = 10000+ socket_connect_timeout_ms: int = 10000+ refresh_interval_ms: int = 30000+ watch_timeout_ms: int = 25000+ watch_limit: int = 100+ retry_delay_ms: int = 500+ max_retry_attempts: int = 0 # 0 means unlimited retries+ claw_token: str = ""+ agent_user_id: str = ""+ sessions: list[str] = Field(default_factory=list)+ panels: list[str] = Field(default_factory=list)+ allow_from: list[str] = Field(default_factory=list)+ mention: MochatMentionConfig = Field(default_factory=MochatMentionConfig)+ groups: dict[str, MochatGroupRule] = Field(default_factory=dict)+ reply_delay_mode: str = "non-mention" # off | non-mention+ reply_delay_ms: int = 120000++class ChannelsConfig(BaseModel):"""Configuration for chat channels."""whatsapp: WhatsAppConfig = Field(default_factory=WhatsAppConfig)telegram: TelegramConfig = Field(default_factory=TelegramConfig)discord: DiscordConfig = Field(default_factory=DiscordConfig)feishu: FeishuConfig = Field(default_factory=FeishuConfig)+ mochat: MochatConfig = Field(default_factory=MochatConfig)+ dingtalk: DingTalkConfig = Field(default_factory=DingTalkConfig)+ email: EmailConfig = Field(default_factory=EmailConfig)class AgentDefaults(BaseModel):diff --cc pyproject.tomlindex 81d38b789,6fda084c8..274f97169--- a/pyproject.toml+++ b/pyproject.toml@@@ -28,10 -28,10 +28,12 @@@ dependencies ="readability-lxml>=0.8.0","rich>=13.0.0","croniter>=2.0.0",- "python-telegram-bot>=21.0",+ "dingtalk-stream>=0.4.0",+ "python-telegram-bot[socks]>=21.0","lark-oapi>=1.0.0",+ "socksio>=1.0.0",+ "python-socketio>=5.11.0",+ "msgpack>=1.0.8",][project.optional-dependencies]