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
fix(whatsapp): update Neonize for current clients (#6545)
chengyongru36094bcf2cc3
diff --git a/nanobot/channels/whatsapp/manifest.py b/nanobot/channels/whatsapp/manifest.pyindex 7d882397a..0c9b05de9 100644--- a/nanobot/channels/whatsapp/manifest.py+++ b/nanobot/channels/whatsapp/manifest.py@@ -29,7 +29,7 @@ PLUGIN = ChannelPlugin(setup=SETUP_SPEC,management=ChannelManagementSpec(local_state_present=local_state_present),dependencies=(- "neonize>=0.4.3.post0,<0.5.0",+ "neonize>=0.5.2,<1.0.0","python-magic>=0.4.27; sys_platform != 'win32'","python-magic-bin>=0.4.14; sys_platform == 'win32'","segno>=1.6.1,<2.0.0",diff --git a/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py b/nanobot/channels/whatsapp/tests/test_whatsapp_channel.pyindex 4e06cd5ec..8f8f94c96 100644--- a/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py+++ b/nanobot/channels/whatsapp/tests/test_whatsapp_channel.py@@ -112,6 +112,42 @@ def _patch_neonize_api(monkeypatch, detect_mime=None, detect_buffer=None) -> Non)+ ("installed_version", "needs_upgrade"),+ [("0.4.3.post0", True), ("0.5.2", False), ("0.10.0", False)],+)+def test_startup_preserves_compatible_neonize(monkeypatch, installed_version, needs_upgrade):+ from nanobot import optional_features+ from nanobot.channels.whatsapp.manifest import PLUGIN++ versions = {+ "neonize": installed_version,+ "python-magic": "0.4.27",+ "python-magic-bin": "0.4.14",+ "segno": "1.6.1",+ }+ monkeypatch.setattr(+ optional_features,+ "distribution",+ lambda name: SimpleNamespace(version=versions[name]),+ )+ installs: list[tuple[str, list[str]]] = []++ def install_extra(name, dependencies, *, runner):+ installs.append((name, dependencies))+ versions["neonize"] = "0.5.2"+ return optional_features.InstallResult(True, name, ["pip"])++ monkeypatch.setattr(optional_features, "install_extra", install_extra)++ failures = optional_features.ensure_enabled_channel_dependencies(+ {"whatsapp"}, {"whatsapp": PLUGIN},+ )++ assert failures == {}+ assert installs == ([("whatsapp", list(PLUGIN.dependencies))] if needs_upgrade else [])++def _patch_receipt_type(monkeypatch):neonize = types.ModuleType("neonize")utils = types.ModuleType("neonize.utils")diff --git a/tests/channels/test_channel_plugins.py b/tests/channels/test_channel_plugins.pyindex 96290e71f..dea2b54ff 100644--- a/tests/channels/test_channel_plugins.py+++ b/tests/channels/test_channel_plugins.py@@ -2701,7 +2701,7 @@ def test_optional_dependency_metadata_for_enable():"wecom": ("wecom-aibot-sdk-python>=0.1.7,<0.2.0",),"weixin": ("qrcode[pil]>=8.0", "pycryptodome>=3.20.0"),"whatsapp": (- "neonize>=0.4.3.post0,<0.5.0",+ "neonize>=0.5.2,<1.0.0","python-magic>=0.4.27; sys_platform != 'win32'","python-magic-bin>=0.4.14; sys_platform == 'win32'","segno>=1.6.1,<2.0.0",