Agent Zero AI framework
Squashed commit of the following:
frdel80518f22a6ec
diff --git a/.gitignore b/.gitignoreindex d4a41496c..75cc842de 100644--- a/.gitignore+++ b/.gitignore@@ -4,6 +4,7 @@**/__pycache__/*.py[cod]**/.conda/+**/node_modules/#Ignore IDE files.cursor/diff --git a/plugins/_email_integration/extensions/python/system_prompt/_20_email_context.py b/plugins/_email_integration/extensions/python/system_prompt/_20_email_context.pyindex ec3aa49e1..0b4c89dd2 100644--- a/plugins/_email_integration/extensions/python/system_prompt/_20_email_context.py+++ b/plugins/_email_integration/extensions/python/system_prompt/_20_email_context.py@@ -1,10 +1,14 @@"""Inject email conversation context into system prompt for email sessions."""from helpers.extension import Extension+from helpers import pluginsfrom agent import LoopDatafrom plugins._email_integration.helpers.dispatcher import CTX_EMAIL_HANDLER+PLUGIN_NAME = "_email_integration"++class EmailContextPrompt(Extension):async def execute(@@ -16,7 +20,23 @@ class EmailContextPrompt(Extension):if not self.agent:return- if self.agent.context.data.get(CTX_EMAIL_HANDLER):- system_prompt.append(- self.agent.read_prompt("fw.email.system_context_reply.md")- )+ handler_name = self.agent.context.data.get(CTX_EMAIL_HANDLER)+ if not handler_name:+ return++ system_prompt.append(+ self.agent.read_prompt("fw.email.system_context_reply.md")+ )++ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ for h in config.get("handlers", []):+ if h.get("name") == handler_name:+ instructions = h.get("agent_instructions", "")+ if instructions:+ system_prompt.append(+ self.agent.read_prompt(+ "fw.email.user_message_instructions.md",+ instructions=instructions,+ )+ )+ breakdiff --git a/plugins/_email_integration/helpers/handler.py b/plugins/_email_integration/helpers/handler.pyindex 020f00bbf..f36ee3efe 100644--- a/plugins/_email_integration/helpers/handler.py+++ b/plugins/_email_integration/helpers/handler.py@@ -394,19 +394,13 @@ def _is_own_email(sender: str, own_address: str) -> bool:def _build_user_message(agent: Agent, msg: InboundMessage, handler_cfg: dict) -> str:recipient = handler_cfg.get("username", "")- text = agent.read_prompt(+ return agent.read_prompt("fw.email.user_message.md",sender=msg.sender,recipient=recipient,subject=msg.subject,body=msg.body,)- instructions = handler_cfg.get("agent_instructions", "")- if instructions:- text += agent.read_prompt(- "fw.email.user_message_instructions.md", instructions=instructions,- )- return text# ------------------------------------------------------------------diff --git a/plugins/_email_integration/prompts/fw.email.user_message_instructions.md b/plugins/_email_integration/prompts/fw.email.user_message_instructions.mdindex 580f1a54e..e4d908b60 100644--- a/plugins/_email_integration/prompts/fw.email.user_message_instructions.md+++ b/plugins/_email_integration/prompts/fw.email.user_message_instructions.md@@ -1,2 +1,2 @@--[Handler instructions: {{instructions}}]+# Email custom rules+{{instructions}}diff --git a/plugins/_telegram_integration/prompts/fw.telegram.user_message_instructions.md b/plugins/_telegram_integration/prompts/fw.telegram.user_message_instructions.mdindex 6b8835747..1a8178431 100644--- a/plugins/_telegram_integration/prompts/fw.telegram.user_message_instructions.md+++ b/plugins/_telegram_integration/prompts/fw.telegram.user_message_instructions.md@@ -1,2 +1,2 @@--[Handler instructions: {{instructions}}]\ No newline at end of file+# Telegram custom rules+{{instructions}}\ No newline at end of filediff --git a/plugins/_whatsapp_integration/README.md b/plugins/_whatsapp_integration/README.mdnew file mode 100644index 000000000..3180556c1--- /dev/null+++ b/plugins/_whatsapp_integration/README.md@@ -0,0 +1,63 @@+# WhatsApp Integration Plugin++Communicate with Agent Zero via WhatsApp using a Baileys-based Node.js bridge.++## Requirements++- **Node.js** (v18+) and npm installed on the system+- A WhatsApp account on a phone (for QR code pairing)++## Setup++### Install bridge dependencies++```bash+cd plugins/_whatsapp_integration/whatsapp-bridge+npm install --production+```++Dependencies are auto-installed on first bridge start if missing.++### Configure and pair++1. Enable the plugin in Settings > External > WhatsApp Integration+2. Configure allowed phone numbers+3. Click Show QR Code and scan with WhatsApp on your phone+4. Send a message from an allowed number to start a chat++The WhatsApp session persists across restarts in `tmp/whatsapp/session/`. No re-pairing needed unless you disconnect via settings.+Be careful: if you use your personal number and leave `allowed_numbers` open, other people could misuse your Agent Zero.++## Configuration++| Setting | Description | Default |+|---------|-------------|---------|+| `enabled` | Enable bridge and polling | `false` |+| `mode` | `self-chat` (personal number) or `dedicated` (separate number) | `self-chat` |+| `allow_group` | Respond in group chats when mentioned or replied to | `false` |+| `bridge_port` | Local HTTP port for bridge | `3100` |+| `poll_interval_seconds` | Poll frequency (min 2) | `3` |+| `allowed_numbers` | Phone numbers without + prefix | `[]` (all) |+| `project` | Activate project for WA chats | `""` |+| `agent_instructions` | Extra agent instructions | `""` |++## How It Works++1. The bridge connects to WhatsApp via Baileys and exposes HTTP endpoints on localhost+2. In personal-number mode, you can message your own WhatsApp number to talk to the agent, and the agent can also handle messages that other people send to that number+3. The plugin polls the bridge for new messages every few seconds+4. Incoming messages are routed to existing chats by WhatsApp chat ID or new chats are created+5. Agent responses are sent back via the bridge as WhatsApp messages+6. Media (images, documents) is supported in both directions++## Architecture++```+WhatsApp Phone+ ↕ (WhatsApp protocol via Baileys)+whatsapp-bridge/bridge.js (Node.js subprocess)+ ↕ (HTTP API on localhost)+Python helpers (wa_client, handler, bridge_manager)+ ↕ (Framework extensions)+Agent Zero+```diff --git a/plugins/_whatsapp_integration/api/disconnect.py b/plugins/_whatsapp_integration/api/disconnect.pynew file mode 100644index 000000000..0205d0d08--- /dev/null+++ b/plugins/_whatsapp_integration/api/disconnect.py@@ -0,0 +1,27 @@+"""Disconnect WhatsApp account by stopping bridge and clearing session."""++import os+import shutil++from helpers.api import ApiHandler, Request+from helpers.errors import format_error+++class Disconnect(ApiHandler):++ async def process(self, input: dict, request: Request) -> dict:+ try:+ from plugins._whatsapp_integration.helpers import bridge_manager+ from plugins._whatsapp_integration.helpers.storage_paths import get_bridge_session_dir++ # Stop bridge first+ await bridge_manager.stop_bridge()++ # Delete session files+ session_dir = get_bridge_session_dir()+ if os.path.exists(session_dir):+ shutil.rmtree(session_dir, ignore_errors=True)++ return {"success": True, "message": "Account disconnected"}+ except Exception as e:+ return {"success": False, "message": format_error(e)}diff --git a/plugins/_whatsapp_integration/api/qr_code.py b/plugins/_whatsapp_integration/api/qr_code.pynew file mode 100644index 000000000..a6ef0698b--- /dev/null+++ b/plugins/_whatsapp_integration/api/qr_code.py@@ -0,0 +1,83 @@+"""WhatsApp QR code pairing endpoint."""++from helpers.api import ApiHandler, Request+from helpers.errors import format_error+from helpers import plugins+++PLUGIN_NAME = "_whatsapp_integration"+++class QrCode(ApiHandler):++ async def process(self, input: dict, request: Request) -> dict:+ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ port = int(config.get("bridge_port", 3100))+ mode = config.get("mode", "self-chat")++ from plugins._whatsapp_integration.helpers.bridge_manager import (+ ensure_bridge_http_up,+ get_bridge_url,+ is_process_alive,+ )+ from plugins._whatsapp_integration.helpers.storage_paths import (+ get_bridge_media_dir,+ get_bridge_session_dir,+ )+ from plugins._whatsapp_integration.helpers.wa_client import get_qr++ session_dir = get_bridge_session_dir()+ cache_dir = get_bridge_media_dir()+ base_url = get_bridge_url(port)++ # Start bridge if not running+ if not is_process_alive():+ try:+ ok = await ensure_bridge_http_up(+ port, session_dir, cache_dir, mode=mode,+ )+ if not ok:+ return {+ "status": "error",+ "message": "Failed to start bridge",+ "qr": None,+ }+ except Exception as e:+ return {+ "status": "error",+ "message": format_error(e),+ "qr": None,+ }++ # Fetch QR status from bridge+ try:+ data = await get_qr(base_url)+ status = data.get("status", "error")+ qr = data.get("qr")++ if status == "connected":+ return {+ "status": "connected",+ "message": "WhatsApp is already connected",+ "qr": None,+ }++ if status == "waiting_scan" and qr:+ return {+ "status": "waiting_scan",+ "message": "Scan the QR code with WhatsApp",+ "qr": qr,+ }++ return {+ "status": "waiting_qr",+ "message": "Generating QR code...",+ "qr": None,+ }++ except Exception as e:+ return {+ "status": "error",+ "message": f"Bridge not reachable: {format_error(e)}",+ "qr": None,+ }diff --git a/plugins/_whatsapp_integration/api/start.py b/plugins/_whatsapp_integration/api/start.pynew file mode 100644index 000000000..6340b1652--- /dev/null+++ b/plugins/_whatsapp_integration/api/start.py@@ -0,0 +1,41 @@+"""Start WhatsApp bridge immediately."""++from helpers.api import ApiHandler, Request+from helpers.errors import format_error+from helpers import plugins+++PLUGIN_NAME = "_whatsapp_integration"+++class Start(ApiHandler):++ async def process(self, input: dict, request: Request) -> dict:+ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ port = int(config.get("bridge_port", 3100))+ mode = config.get("mode", "self-chat")++ from plugins._whatsapp_integration.helpers.bridge_manager import (+ ensure_bridge_http_up,+ is_process_alive,+ )+ from plugins._whatsapp_integration.helpers.storage_paths import (+ get_bridge_media_dir,+ get_bridge_session_dir,+ )++ session_dir = get_bridge_session_dir()+ cache_dir = get_bridge_media_dir()++ if is_process_alive():+ return {"success": True, "message": "Bridge already running"}++ try:+ ok = await ensure_bridge_http_up(+ port, session_dir, cache_dir, mode=mode,+ )+ if ok:+ return {"success": True, "message": "Bridge started"}+ return {"success": False, "message": "Failed to start bridge"}+ except Exception as e:+ return {"success": False, "message": format_error(e)}diff --git a/plugins/_whatsapp_integration/api/test_connection.py b/plugins/_whatsapp_integration/api/test_connection.pynew file mode 100644index 000000000..48c248384--- /dev/null+++ b/plugins/_whatsapp_integration/api/test_connection.py@@ -0,0 +1,50 @@+"""Test WhatsApp bridge connection health."""++from helpers.api import ApiHandler, Request+from helpers.errors import format_error+from helpers import plugins+++PLUGIN_NAME = "_whatsapp_integration"+++class TestConnection(ApiHandler):++ async def process(self, input: dict, request: Request) -> dict:+ config = input.get("config") or plugins.get_plugin_config(PLUGIN_NAME) or {}+ port = int(config.get("bridge_port", 3100))+ results: list[dict] = []++ await self._test_bridge(port, results)++ ok = all(r["ok"] for r in results)+ return {"success": ok, "results": results}++ async def _test_bridge(self, port: int, results: list[dict]) -> None:+ from plugins._whatsapp_integration.helpers.wa_client import get_health+ from plugins._whatsapp_integration.helpers.bridge_manager import get_bridge_url++ try:+ health = await get_health(get_bridge_url(port))+ status = health.get("status", "unknown")+ queue = health.get("queueLength", 0)+ uptime = health.get("uptime", 0)++ if status == "connected":+ results.append({+ "test": "Bridge",+ "ok": True,+ "message": f"Connected (uptime: {uptime:.0f}s, queue: {queue})",+ })+ else:+ results.append({+ "test": "Bridge",+ "ok": False,+ "message": f"Bridge running but status: {status}",+ })+ except Exception as e:+ results.append({+ "test": "Bridge",+ "ok": False,+ "message": f"Bridge not reachable: {format_error(e)}",+ })diff --git a/plugins/_whatsapp_integration/default_config.yaml b/plugins/_whatsapp_integration/default_config.yamlnew file mode 100644index 000000000..f31a04763--- /dev/null+++ b/plugins/_whatsapp_integration/default_config.yaml@@ -0,0 +1,12 @@+enabled: false+mode: self-chat+# dedicated: separate phone number — people message it directly+# self-chat: personal number — you can message yourself, and the agent can also handle messages sent to your number+bridge_port: 3100+poll_interval_seconds: 3+allow_group: false+# allow_group: respond in group chats when mentioned or replied to+allowed_numbers: []+# Example: ["34652029134", "1234567890"]+project: ""+agent_instructions: ""diff --git a/plugins/_whatsapp_integration/extensions/python/job_loop/_10_wa_poll.py b/plugins/_whatsapp_integration/extensions/python/job_loop/_10_wa_poll.pynew file mode 100644index 000000000..438b86e8f--- /dev/null+++ b/plugins/_whatsapp_integration/extensions/python/job_loop/_10_wa_poll.py@@ -0,0 +1,121 @@+"""WhatsApp poll loop — start bridge and poll for incoming messages."""++import asyncio+from typing import Any++from helpers.extension import Extension+from helpers.errors import format_error+from helpers.print_style import PrintStyle+from helpers import plugins+++PLUGIN_NAME: str = "_whatsapp_integration"+DEFAULT_INTERVAL: int = 3+MIN_INTERVAL: int = 2+MAX_CONSECUTIVE_FAILURES: int = 5+++# ------------------------------------------------------------------+# Extension entry point+# ------------------------------------------------------------------++class WhatsAppAutoPoll(Extension):++ async def execute(self, **kwargs: Any) -> None:+ import plugins._whatsapp_integration.helpers.handler as handler_mod++ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ enabled = config.get("enabled", False)++ if not enabled:+ if handler_mod._poll_task and not handler_mod._poll_task.done():+ handler_mod._poll_task.cancel()+ handler_mod._poll_task = None+ return++ if not handler_mod._poll_task or handler_mod._poll_task.done():+ handler_mod._poll_task = asyncio.create_task(_poll_loop())+++# ------------------------------------------------------------------+# Poll loop+# ------------------------------------------------------------------++async def _poll_loop() -> None:+ from plugins._whatsapp_integration.helpers import bridge_manager+ from plugins._whatsapp_integration.helpers.handler import poll_messages+ from plugins._whatsapp_integration.helpers.storage_paths import (+ get_bridge_media_dir,+ get_bridge_session_dir,+ )++ bridge_started = False+ consecutive_failures = 0++ try:+ while True:+ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ if not config.get("enabled", False):+ break+ if PLUGIN_NAME not in plugins.get_enabled_plugins(None):+ break++ port = int(config.get("bridge_port", 3100))+ session_dir = get_bridge_session_dir()+ cache_dir = get_bridge_media_dir()+ mode = config.get("mode", "self-chat")++ # Detect config changes that require bridge restart+ desired = {"port": port, "mode": mode}+ running = bridge_manager.get_running_config()+ if bridge_started and bridge_manager.is_process_alive() and running != desired:+ PrintStyle.info(f"WhatsApp: config changed, restarting bridge")+ await bridge_manager.stop_bridge()+ bridge_started = False+ consecutive_failures = 0++ # Start bridge if needed+ if not bridge_started or not bridge_manager.is_process_alive():+ try:+ bridge_started = await bridge_manager.start_bridge(+ port, session_dir, cache_dir, mode=mode,+ )+ if bridge_started:+ consecutive_failures = 0+ else:+ consecutive_failures += 1+ except FileNotFoundError:+ PrintStyle.error(+ "WhatsApp: Node.js is not installed. "+ "Stopping poll loop — install Node.js and re-enable the plugin."+ )+ break+ except Exception as e:+ consecutive_failures += 1+ PrintStyle.error(f"WhatsApp bridge start error: {format_error(e)}")++ if consecutive_failures >= MAX_CONSECUTIVE_FAILURES:+ PrintStyle.error(+ f"WhatsApp: bridge failed {consecutive_failures} times in a row, "+ f"stopping poll loop. Disable and re-enable the plugin to retry."+ )+ break++ if not bridge_started:+ await asyncio.sleep(10)+ continue++ try:+ await poll_messages(config)+ except Exception as e:+ PrintStyle.error(f"WhatsApp poll error: {format_error(e)}")++ sleep_sec = max(config.get("poll_interval_seconds", DEFAULT_INTERVAL), MIN_INTERVAL)+ await asyncio.sleep(sleep_sec)+ finally:+ # Ensure bridge stops when poll loop exits (plugin disabled or task cancelled)+ try:+ if bridge_manager.is_process_alive():+ await bridge_manager.stop_bridge()+ except Exception:+ passdiff --git a/plugins/_whatsapp_integration/extensions/python/monologue_end/_90_wa_typing_cleanup.py b/plugins/_whatsapp_integration/extensions/python/monologue_end/_90_wa_typing_cleanup.pynew file mode 100644index 000000000..3bf23e3b6--- /dev/null+++ b/plugins/_whatsapp_integration/extensions/python/monologue_end/_90_wa_typing_cleanup.py@@ -0,0 +1,33 @@+from helpers.extension import Extension+from helpers import plugins+from plugins._whatsapp_integration.helpers.handler import (+ CTX_WA_CHAT_ID,+ CTX_WA_TYPING_ACTIVE,+)+from plugins._whatsapp_integration.helpers import bridge_manager, wa_client+++PLUGIN_NAME = "_whatsapp_integration"+++class WhatsAppTypingCleanup(Extension):++ async def execute(self, **kwargs): # type: ignore[override]+ if not self.agent:+ return++ context = self.agent.context++ if not context.data.get(CTX_WA_TYPING_ACTIVE):+ return++ chat_id = context.data.get(CTX_WA_CHAT_ID, "")+ if not chat_id:+ return++ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ port = int(config.get("bridge_port", 3100))+ base_url = bridge_manager.get_bridge_url(port)++ await wa_client.send_typing(base_url, chat_id, paused=True)+ context.data[CTX_WA_TYPING_ACTIVE] = Falsediff --git a/plugins/_whatsapp_integration/extensions/python/process_chain_end/_55_wa_reply.py b/plugins/_whatsapp_integration/extensions/python/process_chain_end/_55_wa_reply.pynew file mode 100644index 000000000..1c6e36e23--- /dev/null+++ b/plugins/_whatsapp_integration/extensions/python/process_chain_end/_55_wa_reply.py@@ -0,0 +1,80 @@+"""Auto-send WhatsApp reply when agent responds in a WhatsApp session."""++import asyncio+from helpers.extension import Extension+from helpers.print_style import PrintStyle+from agent import AgentContext, LoopData, UserMessage+from plugins._whatsapp_integration.helpers.handler import CTX_WA_CHAT_ID, CTX_WA_ATTACHMENTS, CTX_WA_REPLY_TO++MAX_SEND_RETRIES: int = 2+CTX_SEND_FAILURES: str = "_wa_send_failures"+++class WhatsAppAutoReply(Extension):++ async def execute(self, loop_data: LoopData = LoopData(), **kwargs):+ if not self.agent or self.agent.number != 0:+ return++ context = self.agent.context+ if not context.data.get(CTX_WA_CHAT_ID):+ return++ response_text = _extract_last_response(context)+ if not response_text:+ return++ attachments = context.data.pop(CTX_WA_ATTACHMENTS, [])+ reply_to = context.data.pop(CTX_WA_REPLY_TO, "")+ if attachments:+ PrintStyle.info(f"WhatsApp: sending reply with {len(attachments)} attachment(s)")+ asyncio.create_task(self._send_reply(context, response_text, attachments, reply_to))++ async def _send_reply(+ self, context: AgentContext, response_text: str, attachments: list[str],+ reply_to: str = "",+ ):+ from plugins._whatsapp_integration.helpers.handler import send_wa_reply+ error = await send_wa_reply(context, response_text, attachments, reply_to=reply_to)+ if not error:+ context.data[CTX_SEND_FAILURES] = 0+ return+ failures = context.data.get(CTX_SEND_FAILURES, 0) + 1+ context.data[CTX_SEND_FAILURES] = failures+ if failures <= MAX_SEND_RETRIES:+ _notify_agent_of_failure(context, error, failures)+ else:+ PrintStyle.error(+ f"WhatsApp send failed {failures} times, giving up: {error}"+ )+ context.log.log(+ type="error",+ heading="WhatsApp send failed (max retries reached)",+ content=error,+ )+++# ------------------------------------------------------------------+# Helpers+# ------------------------------------------------------------------++def _extract_last_response(context: AgentContext) -> str:+ with context.log._lock:+ logs = list(context.log.logs)+ if not logs:+ return ""+ for item in reversed(logs):+ if item.type == "response":+ return item.content or ""+ return ""+++def _notify_agent_of_failure(+ context: AgentContext, error: str, attempt: int,+):+ msg = context.agent0.read_prompt(+ "fw.wa.send_failed.md", error=error, attempt=str(attempt),+ max_retries=str(MAX_SEND_RETRIES),+ )+ context.log.log(type="error", heading="WhatsApp send failed", content=error)+ context.communicate(UserMessage(message="", system_message=[msg]))diff --git a/plugins/_whatsapp_integration/extensions/python/system_prompt/_20_wa_context.py b/plugins/_whatsapp_integration/extensions/python/system_prompt/_20_wa_context.pynew file mode 100644index 000000000..1f4542b16--- /dev/null+++ b/plugins/_whatsapp_integration/extensions/python/system_prompt/_20_wa_context.py@@ -0,0 +1,32 @@+"""Inject WhatsApp conversation context into system prompt."""++from helpers.extension import Extension+from helpers import plugins+from agent import LoopData+from plugins._whatsapp_integration.helpers.handler import CTX_WA_CHAT_ID, PLUGIN_NAME+++class WhatsAppContextPrompt(Extension):++ async def execute(+ self,+ system_prompt: list[str] = [],+ loop_data: LoopData = LoopData(),+ **kwargs,+ ):+ if not self.agent:+ return++ if self.agent.context.data.get(CTX_WA_CHAT_ID):+ system_prompt.append(+ self.agent.read_prompt("fw.wa.system_context_reply.md")+ )+ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ instructions = config.get("agent_instructions", "")+ if instructions:+ system_prompt.append(+ self.agent.read_prompt(+ "fw.wa.user_message_instructions.md",+ instructions=instructions,+ )+ )diff --git a/plugins/_whatsapp_integration/extensions/python/tool_execute_after/_50_wa_response.py b/plugins/_whatsapp_integration/extensions/python/tool_execute_after/_50_wa_response.pynew file mode 100644index 000000000..576452d3c--- /dev/null+++ b/plugins/_whatsapp_integration/extensions/python/tool_execute_after/_50_wa_response.py@@ -0,0 +1,64 @@+"""Intercept response tool in WhatsApp sessions for attachments and break_loop."""++from helpers.extension import Extension+from helpers.print_style import PrintStyle+from helpers.tool import Response+from plugins._whatsapp_integration.helpers.handler import CTX_WA_CHAT_ID, CTX_WA_ATTACHMENTS, CTX_WA_REPLY_TO+++class WhatsAppResponseIntercept(Extension):++ async def execute(+ self, tool_name: str = "", response: Response | None = None, **kwargs,+ ):+ if tool_name != "response":+ return+ if not self.agent:+ return+ context = self.agent.context+ if not context.data.get(CTX_WA_CHAT_ID):+ return++ tool = self.agent.loop_data.current_tool+ if not tool:+ return++ # Capture attachments and reply_to for later (process_chain_end) or inline send+ attachments = tool.args.get("attachments", [])+ if attachments:+ context.data[CTX_WA_ATTACHMENTS] = attachments+ reply_to = tool.args.get("reply_to", "")+ if reply_to:+ context.data[CTX_WA_REPLY_TO] = reply_to++ # Check break_loop arg from agent+ agent_break = tool.args.get("break_loop", True)+ if agent_break is False and response:+ await self._send_inline(context, tool, response)++ async def _send_inline(+ self, context, tool, response: Response,+ ):+ from plugins._whatsapp_integration.helpers.handler import send_wa_reply++ agent = self.agent+ assert agent is not None++ text = tool.args.get("text", tool.args.get("message", ""))+ attachments = context.data.pop(CTX_WA_ATTACHMENTS, [])+ reply_to = context.data.pop(CTX_WA_REPLY_TO, "")++ if attachments:+ PrintStyle.info(f"WhatsApp: sending update with {len(attachments)} attachment(s)")++ error = await send_wa_reply(context, text, attachments or None, reply_to=reply_to, keep_typing=True)++ if error:+ result = agent.read_prompt("fw.wa.update_error.md", error=error)+ else:+ result = agent.read_prompt("fw.wa.update_ok.md")++ # Override response: don't break loop, add result to history+ response.break_loop = False+ response.message = result+ agent.hist_add_tool_result("response", result)diff --git a/plugins/_whatsapp_integration/helpers/__init__.py b/plugins/_whatsapp_integration/helpers/__init__.pynew file mode 100644index 000000000..e69de29bbdiff --git a/plugins/_whatsapp_integration/helpers/attachment_reader.py b/plugins/_whatsapp_integration/helpers/attachment_reader.pynew file mode 100644index 000000000..ce9b3456a--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/attachment_reader.py@@ -0,0 +1,40 @@+"""+Read attachment files from execution runtime.++No agent/tool dependencies.+"""++import base64+import os+from typing import TypedDict+++# ------------------------------------------------------------------+# Data models+# ------------------------------------------------------------------++class AttachmentData(TypedDict):+ name: str+ content_b64: str+ error: str+++# ------------------------------------------------------------------+# File reader+# ------------------------------------------------------------------++def read_attachment(path: str) -> AttachmentData:+ try:+ if not os.path.isfile(path):+ return AttachmentData(+ name="", content_b64="", error=f"file not found: {path}")+ name = os.path.basename(path)+ with open(path, "rb") as f:+ content = f.read()+ return AttachmentData(+ name=name,+ content_b64=base64.b64encode(content).decode(),+ error="",+ )+ except Exception as e:+ return AttachmentData(name="", content_b64="", error=str(e))diff --git a/plugins/_whatsapp_integration/helpers/attachment_writer.py b/plugins/_whatsapp_integration/helpers/attachment_writer.pynew file mode 100644index 000000000..52d5e8a1a--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/attachment_writer.py@@ -0,0 +1,35 @@+"""+Write attachment files into execution runtime.++No agent/tool dependencies.+"""++import base64+from typing import TypedDict+++# ------------------------------------------------------------------+# Data models+# ------------------------------------------------------------------++class WriteResult(TypedDict):+ path: str+ error: str+++# ------------------------------------------------------------------+# File writer+# ------------------------------------------------------------------++def write_attachment(rel_path: str, content_b64: str) -> WriteResult:+ try:+ from helpers import files+ abs_path = files.get_abs_path(rel_path)+ files.make_dirs(abs_path)++ content = base64.b64decode(content_b64)+ files.write_file_bin(abs_path, content)++ return WriteResult(path=abs_path, error="")+ except Exception as e:+ return WriteResult(path="", error=str(e))diff --git a/plugins/_whatsapp_integration/helpers/bridge_manager.py b/plugins/_whatsapp_integration/helpers/bridge_manager.pynew file mode 100644index 000000000..5f4cd72dc--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/bridge_manager.py@@ -0,0 +1,548 @@+"""+WhatsApp bridge subprocess manager.++No agent/tool dependencies.+"""++from __future__ import annotations++import asyncio+import hashlib+import json+import os+import platform+import shutil+import subprocess+import threading+from collections import deque+from pathlib import Path+from typing import Any, Sequence++from helpers.print_style import PrintStyle+++_bridge_lock: asyncio.Lock | None = None+_bridge_lock_loop: asyncio.AbstractEventLoop | None = None+_bridge_config: dict = {} # config the running bridge was started with++MAX_STARTUP_LOG_LINES = 80+STARTUP_WAIT_ATTEMPTS = 20+STARTUP_WAIT_SECONDS = 0.5+DEPENDENCY_FAILURE_MARKERS = (+ "ERR_MODULE_NOT_FOUND",+ "MODULE_NOT_FOUND",+ "Cannot find module",+ "Cannot find package",+)+++# ------------------------------------------------------------------+# Process wrapper with destructor+# ------------------------------------------------------------------++class _BridgeProcess:+ """Thin wrapper around Popen — kills the process on garbage collection."""++ def __init__(self, process: subprocess.Popen, port: int):+ self._process = process+ self._port = port+ self._recent_output: deque[str] = deque(maxlen=MAX_STARTUP_LOG_LINES)++ def poll(self) -> int | None:+ return self._process.poll()++ def terminate(self) -> None:+ self._process.terminate()++ def wait(self, timeout: float | None = None) -> int:+ return self._process.wait(timeout=timeout)++ def kill(self) -> None:+ self._process.kill()++ def remember_output(self, text: str) -> None:+ self._recent_output.append(text)++ def recent_output(self) -> str:+ return "\n".join(self._recent_output)++ @property+ def stdout(self):+ return self._process.stdout++ def __del__(self) -> None:+ try:+ if self._process.poll() is None:+ PrintStyle.error("WhatsApp: bridge still running on GC, killing")+ self._process.terminate()+ try:+ self._process.wait(timeout=5)+ except subprocess.TimeoutExpired:+ self._process.kill()+ _kill_port_process(self._port)+ except Exception as e:+ PrintStyle.error(f"WhatsApp: bridge destructor error: {e}")+++_bridge_process: _BridgeProcess | None = None++REPO_ROOT = Path(__file__).resolve().parents[3]+BRIDGE_DIR = str(Path(__file__).parent.parent / "whatsapp-bridge")+BRIDGE_SCRIPT = os.path.join(BRIDGE_DIR, "bridge.js")+BRIDGE_PACKAGE_JSON = os.path.join(BRIDGE_DIR, "package.json")+BRIDGE_PACKAGE_LOCK = os.path.join(BRIDGE_DIR, "package-lock.json")+BRIDGE_RUNTIME_DIR = os.path.join(REPO_ROOT, "usr", "whatsapp", "bridge-runtime")+BRIDGE_INSTALL_STATE = os.path.join(BRIDGE_RUNTIME_DIR, "deps-state.json")+BRIDGE_NPM_CACHE = os.path.join(BRIDGE_RUNTIME_DIR, "npm-cache")+NODE_MODULES_DIR = os.path.join(BRIDGE_DIR, "node_modules")+++# ------------------------------------------------------------------+# Public API+# ------------------------------------------------------------------++async def start_bridge(+ port: int,+ session_dir: str,+ cache_dir: str,+ mode: str = "self-chat",+) -> bool:+ async with _get_bridge_lock():+ return await _ensure_bridge_started(+ port=port,+ session_dir=session_dir,+ cache_dir=cache_dir,+ mode=mode,+ require_connection=True,+ start_label="WhatsApp: starting bridge",+ )+++async def stop_bridge() -> None:+ async with _get_bridge_lock():+ _stop_bridge_process()+++async def is_bridge_running(port: int) -> bool:+ if not _bridge_process or _bridge_process.poll() is not None:+ return False+ return await _check_health(port)+++def get_bridge_url(port: int) -> str:+ return f"http://127.0.0.1:{port}"+++async def ensure_bridge_http_up(+ port: int,+ session_dir: str,+ cache_dir: str,+ mode: str = "self-chat",+) -> bool:+ """Start bridge if needed and wait for HTTP server only (not WA connection)."""+ async with _get_bridge_lock():+ return await _ensure_bridge_started(+ port=port,+ session_dir=session_dir,+ cache_dir=cache_dir,+ mode=mode,+ require_connection=False,+ start_label="WhatsApp: starting bridge for pairing",+ )+++def is_process_alive() -> bool:+ return _bridge_process is not None and _bridge_process.poll() is None+++def get_running_config() -> dict:+ return dict(_bridge_config)+++# ------------------------------------------------------------------+# Internal+# ------------------------------------------------------------------++def _get_bridge_lock() -> asyncio.Lock:+ global _bridge_lock, _bridge_lock_loop+ loop = asyncio.get_running_loop()+ if _bridge_lock is None or _bridge_lock_loop is not loop:+ _bridge_lock = asyncio.Lock()+ _bridge_lock_loop = loop+ return _bridge_lock+++async def _ensure_bridge_started(+ *,+ port: int,+ session_dir: str,+ cache_dir: str,+ mode: str,+ require_connection: bool,+ start_label: str,+) -> bool:+ global _bridge_process++ if _bridge_process and _bridge_process.poll() is None:+ if require_connection:+ return True+ if await _check_http_up(port):+ return True++ PrintStyle.warning("WhatsApp: bridge is running but HTTP is not responding, restarting")+ _stop_bridge_process()++ await _ensure_bridge_dependencies()++ attempt = 0+ while attempt < 2:+ attempt += 1+ success, output = await _start_bridge_once(+ port=port,+ session_dir=session_dir,+ cache_dir=cache_dir,+ mode=mode,+ require_connection=require_connection,+ start_label=start_label,+ )+ if success:+ return True++ if attempt == 1 and _looks_like_dependency_failure(output):+ PrintStyle.warning(+ "WhatsApp: bridge startup looks like a dependency issue, "+ "reinstalling dependencies and retrying"+ )+ await _ensure_bridge_dependencies(force_reinstall=True)+ continue++ return False++ return False+++async def _start_bridge_once(+ *,+ port: int,+ session_dir: str,+ cache_dir: str,+ mode: str,+ require_connection: bool,+ start_label: str,+) -> tuple[bool, str]:+ global _bridge_process++ cmd = [+ "node", BRIDGE_SCRIPT,+ "--port", str(port),+ "--session", session_dir,+ "--cache-dir", cache_dir,+ "--mode", mode,+ ]++ _kill_port_process(port)+ PrintStyle.info(start_label)+ _bridge_process = _BridgeProcess(subprocess.Popen(+ cmd,+ stdout=subprocess.PIPE,+ stderr=subprocess.STDOUT,+ cwd=BRIDGE_DIR,+ ), port)+ _start_log_reader(_bridge_process)+ _bridge_config.clear()+ _bridge_config.update({"port": port, "mode": mode})++ healthy, output = await _wait_for_bridge_startup(+ port=port,+ require_connection=require_connection,+ )+ if healthy:+ return True, output++ if output:+ PrintStyle.error(f"WhatsApp: bridge startup failed\n{output}")+ return False, output+++async def _wait_for_bridge_startup(*, port: int, require_connection: bool) -> tuple[bool, str]:+ for _ in range(STARTUP_WAIT_ATTEMPTS):+ await asyncio.sleep(STARTUP_WAIT_SECONDS)++ process = _bridge_process+ if process is None:+ return False, ""++ if process.poll() is not None:+ output = _summarize_output(process.recent_output())+ PrintStyle.error("WhatsApp: bridge process exited unexpectedly")+ _clear_bridge_process()+ return False, output++ if require_connection:+ if await _check_health(port):+ return True, process.recent_output()+ else:+ if await _check_http_up(port):+ return True, process.recent_output()++ if require_connection:+ PrintStyle.warning("WhatsApp: bridge started but not yet connected")+ process = _bridge_process+ return True, process.recent_output() if process else ""++ process = _bridge_process+ return False, _summarize_output(process.recent_output()) if process else ""+++def _looks_like_dependency_failure(output: str) -> bool:+ return any(marker in output for marker in DEPENDENCY_FAILURE_MARKERS)+++async def _check_health(port: int) -> bool:+ try:+ from plugins._whatsapp_integration.helpers.wa_client import get_health+ health = await get_health(get_bridge_url(port))+ return health.get("status") == "connected"+ except Exception:+ return False+++async def _check_http_up(port: int) -> bool:+ try:+ from plugins._whatsapp_integration.helpers.wa_client import get_health+ await get_health(get_bridge_url(port))+ return True+ except Exception:+ return False+++async def _ensure_bridge_dependencies(force_reinstall: bool = False) -> None:+ expected_state = await _build_dependency_state()++ if not force_reinstall:+ install_state = _load_dependency_state()+ if os.path.isdir(NODE_MODULES_DIR) and await _validate_bridge_dependencies():+ if install_state is None:+ _write_dependency_state(expected_state)+ return+ if install_state == expected_state:+ return++ await _reinstall_bridge_dependencies()++ if not await _validate_bridge_dependencies():+ raise RuntimeError("WhatsApp: bridge dependencies failed validation after reinstall")++ _write_dependency_state(await _build_dependency_state())+++async def _build_dependency_state() -> dict[str, Any]:+ return {+ "package_json_hash": _sha256_file(BRIDGE_PACKAGE_JSON),+ "package_lock_hash": _sha256_file(BRIDGE_PACKAGE_LOCK) if os.path.isfile(BRIDGE_PACKAGE_LOCK) else "",+ "platform": platform.system(),+ "arch": platform.machine(),+ "node_version": (await _run_subprocess(["node", "--version"], cwd=BRIDGE_DIR)).strip(),+ "npm_version": (await _run_subprocess(["npm", "--version"], cwd=BRIDGE_DIR)).strip(),+ }+++async def _validate_bridge_dependencies() -> bool:+ dependency_names = _bridge_dependency_names()+ if not dependency_names or not os.path.isdir(NODE_MODULES_DIR):+ return False++ imports = ", ".join(json.dumps(name) for name in dependency_names)+ script = (+ f"for (const name of [{imports}]) {{ await import(name); }}\n"+ "process.stdout.write('ok');\n"+ )++ try:+ output = await _run_subprocess(+ ["node", "--input-type=module", "--eval", script],+ cwd=BRIDGE_DIR,+ )+ except RuntimeError as e:+ PrintStyle.warning(f"WhatsApp: dependency validation failed: {e}")+ return False+ return output.strip() == "ok"+++async def _reinstall_bridge_dependencies() -> None:+ _ensure_runtime_dir()++ if os.path.isdir(NODE_MODULES_DIR):+ PrintStyle.warning("WhatsApp: bridge dependencies missing, outdated, or corrupt; reinstalling")+ shutil.rmtree(NODE_MODULES_DIR, ignore_errors=True)+ else:+ PrintStyle.info("WhatsApp: installing bridge dependencies")++ if os.path.isfile(BRIDGE_INSTALL_STATE):+ try:+ os.remove(BRIDGE_INSTALL_STATE)+ except OSError:+ pass++ commands: list[list[str]] = []+ if os.path.isfile(BRIDGE_PACKAGE_LOCK):+ commands.append(["npm", "ci", "--omit=dev", "--no-audit", "--no-fund"])+ commands.append(["npm", "install", "--omit=dev", "--no-audit", "--no-fund"])+ env = {"npm_config_cache": BRIDGE_NPM_CACHE}++ last_error: RuntimeError | None = None+ for command in commands:+ try:+ await _run_subprocess(command, cwd=BRIDGE_DIR, env=env)+ return+ except RuntimeError as e:+ last_error = e+ PrintStyle.warning(f"WhatsApp: {' '.join(command)} failed: {e}")++ raise RuntimeError(str(last_error) if last_error else "npm install failed")+++def _bridge_dependency_names() -> list[str]:+ with open(BRIDGE_PACKAGE_JSON, "r", encoding="utf-8") as f:+ package_json = json.load(f)+ dependencies = package_json.get("dependencies") or {}+ return sorted(dependencies.keys())+++def _load_dependency_state() -> dict[str, Any] | None:+ if not os.path.isfile(BRIDGE_INSTALL_STATE):+ return None+ try:+ with open(BRIDGE_INSTALL_STATE, "r", encoding="utf-8") as f:+ return json.load(f)+ except (OSError, json.JSONDecodeError):+ return None+++def _write_dependency_state(state: dict[str, Any]) -> None:+ _ensure_runtime_dir()+ with open(BRIDGE_INSTALL_STATE, "w", encoding="utf-8") as f:+ json.dump(state, f, indent=2, sort_keys=True)+++def _sha256_file(path: str) -> str:+ digest = hashlib.sha256()+ with open(path, "rb") as f:+ for chunk in iter(lambda: f.read(65536), b""):+ digest.update(chunk)+ return digest.hexdigest()+++def _ensure_runtime_dir() -> None:+ os.makedirs(BRIDGE_RUNTIME_DIR, exist_ok=True)+++async def _run_subprocess(+ command: Sequence[str],+ *,+ cwd: str,+ env: dict[str, str] | None = None,+) -> str:+ process_env = os.environ.copy()+ if env:+ process_env.update(env)++ proc = await asyncio.create_subprocess_exec(+ *command,+ cwd=cwd,+ env=process_env,+ stdout=asyncio.subprocess.PIPE,+ stderr=asyncio.subprocess.STDOUT,+ )+ stdout, _ = await proc.communicate()+ output = stdout.decode("utf-8", errors="replace").strip()+ if proc.returncode != 0:+ raise RuntimeError(output or f"{' '.join(command)} exited with code {proc.returncode}")+ return output+++def _stop_bridge_process() -> None:+ global _bridge_process+ if not _bridge_process:+ return+ try:+ _bridge_process.terminate()+ try:+ _bridge_process.wait(timeout=5)+ except subprocess.TimeoutExpired:+ _bridge_process.kill()+ except Exception:+ pass+ _clear_bridge_process()+ PrintStyle.info("WhatsApp: bridge stopped")+++def _clear_bridge_process() -> None:+ global _bridge_process+ _bridge_process = None+ _bridge_config.clear()+++def _kill_port_process(port: int) -> None:+ """Kill any orphaned process listening on the given TCP port."""+ try:+ system = platform.system()+ if system == "Windows":+ result = subprocess.run(+ ["netstat", "-ano", "-p", "TCP"],+ capture_output=True, text=True, timeout=5,+ )+ for line in result.stdout.splitlines():+ parts = line.split()+ if len(parts) >= 5 and parts[3] == "LISTENING":+ if parts[1].endswith(f":{port}"):+ try:+ subprocess.run(+ ["taskkill", "/PID", parts[4], "/F"],+ capture_output=True, timeout=5,+ )+ except subprocess.SubprocessError:+ pass+ elif system == "Darwin":+ result = subprocess.run(+ ["lsof", "-ti", f"tcp:{port}"],+ capture_output=True, text=True, timeout=5,+ )+ for pid_str in result.stdout.strip().splitlines():+ try:+ os.kill(int(pid_str.strip()), 9)+ except (ValueError, OSError):+ pass+ else:+ result = subprocess.run(+ ["fuser", f"{port}/tcp"],+ capture_output=True, timeout=5,+ )+ if result.returncode == 0:+ subprocess.run(+ ["fuser", "-k", f"{port}/tcp"],+ capture_output=True, timeout=5,+ )+ except Exception:+ pass+++def _start_log_reader(process: _BridgeProcess) -> None:+ def _reader() -> None:+ assert process.stdout+ for line in iter(process.stdout.readline, b""):+ text = line.decode("utf-8", errors="replace").rstrip()+ if text:+ process.remember_output(text)+ PrintStyle.standard(f"WhatsApp bridge: {text}")+ process.stdout.close()++ thread = threading.Thread(target=_reader, daemon=True)+ thread.start()+++def _summarize_output(output: str, max_lines: int = 12) -> str:+ if not output:+ return ""+ lines = [line for line in output.splitlines() if line.strip()]+ return "\n".join(lines[-max_lines:])diff --git a/plugins/_whatsapp_integration/helpers/handler.py b/plugins/_whatsapp_integration/helpers/handler.pynew file mode 100644index 000000000..88587e43f--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/handler.py@@ -0,0 +1,406 @@+"""+WhatsApp handler — orchestrates poll, dispatch, and reply.++Requires agent context.+"""++import asyncio+import base64+import os+import re+import uuid++from agent import Agent, AgentContext, UserMessage+from helpers import plugins, files, runtime+from helpers import message_queue as mq+from helpers.persist_chat import save_tmp_chat+from helpers.print_style import PrintStyle+from helpers.errors import format_error+from initialize import initialize_agent++from plugins._whatsapp_integration.helpers import wa_client+from plugins._whatsapp_integration.helpers import bridge_manager+from plugins._whatsapp_integration.helpers.number_utils import (+ normalize_allowed_numbers,+ normalize_number,+)+++PLUGIN_NAME = "_whatsapp_integration"+MEDIA_FOLDER = "usr/whatsapp/media"++# Context data keys (no underscore prefix — must persist across restarts)+CTX_WA_CHAT_ID = "wa_chat_id"+CTX_WA_SENDER_NAME = "wa_sender_name"+CTX_WA_SENDER_NUMBER = "wa_sender_number"+CTX_WA_IS_GROUP = "wa_is_group"+CTX_WA_LAST_BODY = "wa_last_body"+CTX_WA_LAST_MSG_ID = "wa_last_msg_id"+# Transient — consumed per-reply, not persisted+CTX_WA_ATTACHMENTS = "_wa_response_attachments"+CTX_WA_REPLY_TO = "_wa_reply_to"+CTX_WA_TYPING_ACTIVE = "_wa_typing_active"++# Poll task — lives here (not in extension module) because+# extension modules are re-executed on each job_loop tick,+# which would reset module-level state and orphan running tasks.+_poll_task: asyncio.Task | None = None # type: ignore[type-arg]+++# ------------------------------------------------------------------+# Poll loop+# ------------------------------------------------------------------++async def _refresh_typing(base_url: str) -> None:+ """Re-send composing for all contexts with active typing flag."""+ for ctx in AgentContext._contexts.values():+ if not isinstance(ctx, AgentContext):+ continue+ if not ctx.data.get(CTX_WA_TYPING_ACTIVE):+ continue+ chat_id = ctx.data.get(CTX_WA_CHAT_ID, "")+ if chat_id:+ await wa_client.send_typing(base_url, chat_id)+++async def poll_messages(config: dict) -> None:+ if not config.get("enabled", False):+ return+ if PLUGIN_NAME not in plugins.get_enabled_plugins(None):+ return++ port = int(config.get("bridge_port", 3100))+ base_url = bridge_manager.get_bridge_url(port)++ # Refresh typing indicator for active sessions (beats 25s WhatsApp timeout)+ await _refresh_typing(base_url)++ try:+ messages = await wa_client.get_messages(base_url)+ except Exception as e:+ PrintStyle.error(f"WhatsApp poll error: {format_error(e)}")+ return++ if not messages:+ return++ # Allowed-numbers filtering is authoritative in Python.+ allowed_set = normalize_allowed_numbers(config.get("allowed_numbers"))++ for msg in messages:+ try:+ # Filter by allowed numbers if configured+ if allowed_set:+ sender_num = normalize_number(msg.get("senderNumber", "") or msg.get("senderId", ""))+ if sender_num not in allowed_set:+ PrintStyle.debug(+ f"WhatsApp: ignored message from {sender_num} "+ f"(senderId: {msg.get('senderId', '')}, allowed: {allowed_set})"+ )+ continue+ await _dispatch_message(config, msg)+ except Exception as e:+ PrintStyle.error(f"WhatsApp dispatch error: {format_error(e)}")+++# ------------------------------------------------------------------+# Dispatch a single inbound message+# ------------------------------------------------------------------++async def _dispatch_message(config: dict, msg: dict) -> None:+ chat_id = msg.get("chatId", "")+ is_group = msg.get("isGroup", False)++ # Group filtering: skip unless allow_group enabled AND bot was mentioned or replied to+ if is_group:+ if not config.get("allow_group", False):+ PrintStyle.debug(f"WhatsApp: skipping group message (allow_group disabled)")+ return+ if not msg.get("mentionedMe", False) and not msg.get("repliedToMe", False):+ PrintStyle.debug(f"WhatsApp: skipping group message (not mentioned or replied to)")+ return++ # Show typing indicator immediately so user sees activity+ port = int(config.get("bridge_port", 3100))+ base_url = bridge_manager.get_bridge_url(port)+ await wa_client.send_typing(base_url, chat_id)++ existing = _find_chats_by_jid(chat_id)++ if existing:+ # Continue most recent chat for this JID+ await _route_to_chat(msg, existing[0])+ else:+ await _start_new_chat(config, msg)+++# ------------------------------------------------------------------+# Chat creation and routing+# ------------------------------------------------------------------++async def _start_new_chat(config: dict, msg: dict) -> None:+ from helpers import projects++ sender_name = msg.get("senderName", "Unknown")+ sender_number = msg.get("senderNumber", "") or normalize_number(msg.get("senderId", ""))+ chat_id = msg.get("chatId", "")+ is_group = msg.get("isGroup", False)++ agent_config = initialize_agent()+ context = AgentContext(agent_config, name=f"WhatsApp: {sender_name[:50]}")++ context.data[CTX_WA_CHAT_ID] = chat_id+ context.data[CTX_WA_SENDER_NAME] = sender_name+ context.data[CTX_WA_SENDER_NUMBER] = sender_number+ context.data[CTX_WA_IS_GROUP] = is_group+ context.data[CTX_WA_LAST_BODY] = msg.get("body", "")+ context.data[CTX_WA_LAST_MSG_ID] = msg.get("messageId", "")+ context.data[CTX_WA_TYPING_ACTIVE] = True++ project = config.get("project", "")+ if project:+ projects.activate_project(context.id, project)++ save_tmp_chat(context)++ user_msg = _build_user_message(context.agent0, msg)+ system_ctx = context.agent0.read_prompt("fw.wa.system_context.md")++ msg_id = str(uuid.uuid4())+ media_urls = msg.get("mediaUrls", [])+ attachments = await _save_incoming_media(media_urls) if media_urls else []+ mq.log_user_message(+ context, user_msg, attachments, message_id=msg_id, source=" (whatsapp)",+ )+ context.communicate(UserMessage(+ message=user_msg,+ system_message=[system_ctx],+ attachments=attachments,+ id=msg_id,+ ))++ PrintStyle.success(+ f"WhatsApp: new chat {context.id} for {sender_name} ({sender_number})"+ )+++async def _route_to_chat(+ msg: dict, context_id: str,+) -> None:+ context = AgentContext.get(context_id)+ if not context:+ return++ context.data[CTX_WA_LAST_BODY] = msg.get("body", "")+ context.data[CTX_WA_LAST_MSG_ID] = msg.get("messageId", "")+ context.data[CTX_WA_TYPING_ACTIVE] = True++ user_msg = _build_user_message(context.agent0, msg)+ msg_id = str(uuid.uuid4())+ media_urls = msg.get("mediaUrls", [])+ attachments = await _save_incoming_media(media_urls) if media_urls else []+ mq.log_user_message(+ context, user_msg, attachments, message_id=msg_id, source=" (whatsapp)",+ )+ context.communicate(UserMessage(+ message=user_msg,+ attachments=attachments,+ id=msg_id,+ ))++ save_tmp_chat(context)+ PrintStyle.info(f"WhatsApp: continuing chat {context_id}")+++# ------------------------------------------------------------------+# Chat discovery+# ------------------------------------------------------------------++def _find_chats_by_jid(chat_id: str) -> list[str]:+ """Return context IDs for chats matching the given WhatsApp JID, newest first."""+ results = []+ for ctx_id, ctx in AgentContext._contexts.items():+ if not isinstance(ctx, AgentContext):+ continue+ if ctx.data.get(CTX_WA_CHAT_ID) != chat_id:+ continue+ results.append(ctx_id)++ results.sort(reverse=True)+ return results+++# ------------------------------------------------------------------+# Markdown to WhatsApp formatting+# ------------------------------------------------------------------++def _md_to_whatsapp(text: str) -> str:+ """Convert markdown formatting to WhatsApp formatting."""+ # Protect code blocks from conversion+ code_blocks: list[str] = []+ def _save_code(m: re.Match) -> str:+ code_blocks.append(m.group(0))+ return f"\x00CB{len(code_blocks) - 1}\x00"+ text = re.sub(r"```[\s\S]*?```", _save_code, text)++ # Protect inline code+ inline_codes: list[str] = []+ def _save_inline(m: re.Match) -> str:+ inline_codes.append(m.group(0))+ return f"\x00IC{len(inline_codes) - 1}\x00"+ text = re.sub(r"`[^`]+`", _save_inline, text)++ # Bold+italic ***text*** → *_text_*+ text = re.sub(r"\*{3}(.+?)\*{3}", r"*_\1_*", text)+ # Bold **text** or __text__ → *text*+ text = re.sub(r"\*{2}(.+?)\*{2}", r"*\1*", text)+ text = re.sub(r"__(.+?)__", r"*\1*", text)+ # Italic _text_ stays _text_ (same in WhatsApp)+ # Strikethrough ~~text~~ → ~text~+ text = re.sub(r"~~(.+?)~~", r"~\1~", text)+ # Headings → bold+ text = re.sub(r"^#{1,6}\s+(.+)$", r"*\1*", text, flags=re.MULTILINE)++ # Restore code blocks and inline code+ for i, block in enumerate(code_blocks):+ text = text.replace(f"\x00CB{i}\x00", block)+ for i, code in enumerate(inline_codes):+ text = text.replace(f"\x00IC{i}\x00", code)++ return text+++# ------------------------------------------------------------------+# Message builders+# ------------------------------------------------------------------++def _build_user_message(agent: Agent, msg: dict) -> str:+ sender_name = msg.get("senderName", "Unknown")+ sender_number = msg.get("senderNumber", "") or normalize_number(msg.get("senderId", ""))+ is_group = msg.get("isGroup", False)+ prompt = "fw.wa.user_message_group.md" if is_group else "fw.wa.user_message.md"+ text = agent.read_prompt(+ prompt,+ sender_name=sender_name,+ sender_number=sender_number,+ group_name=msg.get("chatName", ""),+ message_id=msg.get("messageId", ""),+ body=msg.get("body", ""),+ )+ return text+++# ------------------------------------------------------------------+# Reply sending (called from process_chain_end extension)+# ------------------------------------------------------------------++async def send_wa_reply(+ context: AgentContext,+ response_text: str,+ attachments: list[str] | None = None,+ reply_to: str = "",+ keep_typing: bool = False,+) -> str | None:+ chat_id = context.data.get(CTX_WA_CHAT_ID)+ if not chat_id:+ return "No WhatsApp chat ID"++ config = plugins.get_plugin_config(PLUGIN_NAME) or {}+ port = int(config.get("bridge_port", 3100))+ base_url = bridge_manager.get_bridge_url(port)++ # For group chats, auto-reply to last received message if no explicit reply_to+ if not reply_to and context.data.get(CTX_WA_IS_GROUP):+ reply_to = context.data.get(CTX_WA_LAST_MSG_ID, "")++ # Convert markdown to WhatsApp formatting+ response_text = _md_to_whatsapp(response_text)++ # Prefix response in self-chat mode so user can distinguish agent messages+ mode = config.get("mode", "self-chat")+ if mode == "self-chat":+ response_text = context.agent0.read_prompt(+ "fw.wa.self_chat_prefix.md", response_text=response_text,+ )++ # Send text+ try:+ result = await wa_client.send_message(base_url, chat_id, response_text, reply_to=reply_to)+ if result.get("error"):+ return result["error"]+ except Exception as e:+ return str(e)++ # Send attachments via RFC (files may live in execution runtime)+ if attachments:+ host_paths = await _read_attachments_to_host(attachments)+ for host_path in host_paths:+ try:+ result = await wa_client.send_media(+ base_url, chat_id, host_path,+ )+ if result.get("error"):+ PrintStyle.warning(f"WhatsApp: attachment error: {result['error']}")+ except Exception as e:+ PrintStyle.warning(f"WhatsApp: attachment error: {e}")++ # Typing: restart if agent is still working, stop if final reply+ if keep_typing:+ await wa_client.send_typing(base_url, chat_id)+ else:+ await wa_client.send_typing(base_url, chat_id, paused=True)+ context.data[CTX_WA_TYPING_ACTIVE] = False++ return None+++# ------------------------------------------------------------------+# Attachment reading (via RFC into execution runtime)+# ------------------------------------------------------------------++async def _read_attachments_to_host(+ paths: list[str],+) -> list[str]:+ """Read files from execution runtime and write to host media cache."""+ from plugins._whatsapp_integration.helpers.attachment_reader import read_attachment++ host_paths: list[str] = []+ for path in paths:+ data = await runtime.call_development_function(read_attachment, path)+ if data["error"]:+ PrintStyle.warning(f"WhatsApp attachment: {data['error']}")+ continue+ # Write decoded bytes to host-side media cache+ host_path = os.path.join(+ files.get_abs_path(MEDIA_FOLDER), data["name"],+ )+ os.makedirs(os.path.dirname(host_path), exist_ok=True)+ with open(host_path, "wb") as f:+ f.write(base64.b64decode(data["content_b64"]))+ host_paths.append(host_path)+ return host_paths+++async def _save_incoming_media(+ media_urls: list[str],+) -> list[str]:+ """Save incoming media files into execution runtime via RFC."""+ from plugins._whatsapp_integration.helpers.attachment_writer import write_attachment++ runtime_paths: list[str] = []+ for host_path in media_urls:+ if not os.path.isfile(host_path):+ continue+ name = os.path.basename(host_path)+ with open(host_path, "rb") as f:+ content_b64 = base64.b64encode(f.read()).decode()+ rel_path = os.path.join(MEDIA_FOLDER, name)+ result = await runtime.call_development_function(+ write_attachment, rel_path, content_b64,+ )+ if result.get("error"):+ PrintStyle.warning(f"WhatsApp media save: {result['error']}")+ runtime_paths.append(host_path) # fallback to host path+ else:+ runtime_paths.append(result["path"])+ return runtime_pathsdiff --git a/plugins/_whatsapp_integration/helpers/number_utils.py b/plugins/_whatsapp_integration/helpers/number_utils.pynew file mode 100644index 000000000..66e69253c--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/number_utils.py@@ -0,0 +1,32 @@+"""Phone-number normalization helpers for WhatsApp integration."""++from __future__ import annotations++import re+from collections.abc import Iterable+++_JID_SUFFIX_RE = re.compile(r"[@:].*")+_NON_DIGIT_RE = re.compile(r"\D+")+_LEADING_ZERO_RE = re.compile(r"^0+")+++def normalize_number(raw: str) -> str:+ """Normalize WhatsApp sender identifiers and phone numbers to comparable digits."""+ text = _JID_SUFFIX_RE.sub("", str(raw or ""))+ digits = _NON_DIGIT_RE.sub("", text)+ return _LEADING_ZERO_RE.sub("", digits)+++def normalize_allowed_numbers(value: object) -> set[str]:+ """Accept stored config as a list/tuple/set or comma-delimited string."""+ if isinstance(value, str):+ candidates = value.split(",")+ elif isinstance(value, Iterable):+ candidates = value+ else:+ return set()++ normalized = {normalize_number(item) for item in candidates}+ normalized.discard("")+ return normalizeddiff --git a/plugins/_whatsapp_integration/helpers/storage_paths.py b/plugins/_whatsapp_integration/helpers/storage_paths.pynew file mode 100644index 000000000..f973efa3a--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/storage_paths.py@@ -0,0 +1,11 @@+"""Shared storage paths for the WhatsApp bridge."""++from helpers import files+++def get_bridge_session_dir() -> str:+ return files.get_abs_path(files.TEMP_DIR, "whatsapp", "session")+++def get_bridge_media_dir() -> str:+ return files.get_abs_path(files.TEMP_DIR, "whatsapp", "media")diff --git a/plugins/_whatsapp_integration/helpers/wa_client.py b/plugins/_whatsapp_integration/helpers/wa_client.pynew file mode 100644index 000000000..fce70b46f--- /dev/null+++ b/plugins/_whatsapp_integration/helpers/wa_client.py@@ -0,0 +1,103 @@+"""+WhatsApp bridge HTTP client.++No agent/tool dependencies.+"""++import aiohttp+++async def get_messages(base_url: str) -> list[dict]:+ async with aiohttp.ClientSession() as session:+ async with session.get(+ f"{base_url}/messages", timeout=aiohttp.ClientTimeout(total=10),+ ) as resp:+ if resp.status == 200:+ return await resp.json()+ return []+++async def send_message(+ base_url: str, chat_id: str, message: str, reply_to: str = "",+) -> dict:+ payload: dict = {"chatId": chat_id, "message": message}+ if reply_to:+ payload["replyTo"] = reply_to+ async with aiohttp.ClientSession() as session:+ async with session.post(+ f"{base_url}/send",+ json=payload,+ timeout=aiohttp.ClientTimeout(total=30),+ ) as resp:+ return await resp.json()+++async def send_media(+ base_url: str,+ chat_id: str,+ file_path: str,+ caption: str = "",+ media_type: str = "",+ file_name: str = "",+) -> dict:+ payload: dict = {"chatId": chat_id, "filePath": file_path}+ if caption:+ payload["caption"] = caption+ if media_type:+ payload["mediaType"] = media_type+ if file_name:+ payload["fileName"] = file_name+ async with aiohttp.ClientSession() as session:+ async with session.post(+ f"{base_url}/send-media",+ json=payload,+ timeout=aiohttp.ClientTimeout(total=30),+ ) as resp:+ return await resp.json()+++async def send_typing(base_url: str, chat_id: str, paused: bool = False) -> None:+ try:+ payload: dict = {"chatId": chat_id}+ if paused:+ payload["status"] = "paused"+ async with aiohttp.ClientSession() as session:+ async with session.post(+ f"{base_url}/typing",+ json=payload,+ timeout=aiohttp.ClientTimeout(total=5),+ ) as resp:+ await resp.json()+ except Exception:+ pass+++async def get_health(base_url: str) -> dict:+ async with aiohttp.ClientSession() as session:+ async with session.get(+ f"{base_url}/health", timeout=aiohttp.ClientTimeout(total=5),+ ) as resp:+ if resp.status == 200:+ return await resp.json()+ return {"status": "error", "queueLength": 0, "uptime": 0}+++async def get_qr(base_url: str) -> dict:+ async with aiohttp.ClientSession() as session:+ async with session.get(+ f"{base_url}/qr", timeout=aiohttp.ClientTimeout(total=5),+ ) as resp:+ if resp.status == 200:+ return await resp.json()+ return {"status": "error", "qr": None}+++async def get_chat_info(base_url: str, chat_id: str) -> dict:+ async with aiohttp.ClientSession() as session:+ async with session.get(+ f"{base_url}/chat/{chat_id}",+ timeout=aiohttp.ClientTimeout(total=10),+ ) as resp:+ if resp.status == 200:+ return await resp.json()+ return {"name": "", "isGroup": False, "participants": []}diff --git a/plugins/_whatsapp_integration/plugin.yaml b/plugins/_whatsapp_integration/plugin.yamlnew file mode 100644index 000000000..86f0af4f4--- /dev/null+++ b/plugins/_whatsapp_integration/plugin.yaml@@ -0,0 +1,8 @@+name: _whatsapp_integration+title: WhatsApp Integration+description: Communicate with Agent Zero via WhatsApp. Uses Baileys bridge for message sending and receiving.+version: 1.0.0+settings_sections:+ - external+per_project_config: false+per_agent_config: falsediff --git a/plugins/_whatsapp_integration/prompts/fw.wa.poll_error.md b/plugins/_whatsapp_integration/prompts/fw.wa.poll_error.mdnew file mode 100644index 000000000..c870ee0d9--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.poll_error.md@@ -0,0 +1 @@+whatsapp poll error: {{error}}diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.poll_ok.md b/plugins/_whatsapp_integration/prompts/fw.wa.poll_ok.mdnew file mode 100644index 000000000..b47df01cc--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.poll_ok.md@@ -0,0 +1 @@+whatsapp poll complete: {{result}}diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.self_chat_prefix.md b/plugins/_whatsapp_integration/prompts/fw.wa.self_chat_prefix.mdnew file mode 100644index 000000000..7a0cb9806--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.self_chat_prefix.md@@ -0,0 +1,2 @@+[🤖 Agent Zero]+{{response_text}}\ No newline at end of filediff --git a/plugins/_whatsapp_integration/prompts/fw.wa.send_failed.md b/plugins/_whatsapp_integration/prompts/fw.wa.send_failed.mdnew file mode 100644index 000000000..e10897984--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.send_failed.md@@ -0,0 +1,3 @@+whatsapp send failed (attempt {{attempt}}/{{max_retries}}): {{error}}+previous response was NOT delivered to user+retry or inform user issue existsdiff --git a/plugins/_whatsapp_integration/prompts/fw.wa.system_context.md b/plugins/_whatsapp_integration/prompts/fw.wa.system_context.mdnew file mode 100644index 000000000..c7b7d6d28--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.system_context.md@@ -0,0 +1,6 @@+whatsapp session user communicates via whatsapp+response tool sends whatsapp message dont use python+break_loop true > stop working and wait for user reply+break_loop false > only for mid-task progress updates then keep working+always keep user informed send progress before long tasks+tell user what you are doing now and what comes next\ No newline at end of filediff --git a/plugins/_whatsapp_integration/prompts/fw.wa.system_context_reply.md b/plugins/_whatsapp_integration/prompts/fw.wa.system_context_reply.mdnew file mode 100644index 000000000..ae08f213a--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.system_context_reply.md@@ -0,0 +1,37 @@+# WhatsApp session behavior+user communicates via whatsapp+response tool = send whatsapp message to user+dont use code to send message+break_loop true > stop working and wait for user reply+break_loop false > only for mid-task progress updates then keep working+include file paths in attachments array for sending files+multiple files zip first attach single archive+in group chats use reply_to with msg id to quote a specific message+group replies auto-quote last received message if reply_to omitted+usage:++~~~json+{+ ...+ "tool_name": "response",+ "tool_args": {+ "text": "Working on it...",+ "break_loop": false+ }+}+~~~++~~~json+{+ ...+ "tool_name": "response",+ "tool_args": {+ "text": "Here is...",+ "attachments": [+ "/path/file.zip"+ ],+ "reply_to": "msg_id",+ "break_loop": true+ }+}+~~~diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.update_error.md b/plugins/_whatsapp_integration/prompts/fw.wa.update_error.mdnew file mode 100644index 000000000..5f3233c2b--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.update_error.md@@ -0,0 +1 @@+whatsapp update failed: {{error}}diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.update_ok.md b/plugins/_whatsapp_integration/prompts/fw.wa.update_ok.mdnew file mode 100644index 000000000..94608ef7d--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.update_ok.md@@ -0,0 +1 @@+whatsapp update sent continue workingdiff --git a/plugins/_whatsapp_integration/prompts/fw.wa.user_message.md b/plugins/_whatsapp_integration/prompts/fw.wa.user_message.mdnew file mode 100644index 000000000..32a4f0d92--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.user_message.md@@ -0,0 +1,3 @@+[WhatsApp from {{sender_name}}]++{{body}}diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.user_message_group.md b/plugins/_whatsapp_integration/prompts/fw.wa.user_message_group.mdnew file mode 100644index 000000000..ef78c7df9--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.user_message_group.md@@ -0,0 +1,3 @@+[WhatsApp group "{{group_name}}" from {{sender_name}} id:{{message_id}}]++{{body}}diff --git a/plugins/_whatsapp_integration/prompts/fw.wa.user_message_instructions.md b/plugins/_whatsapp_integration/prompts/fw.wa.user_message_instructions.mdnew file mode 100644index 000000000..351c8c478--- /dev/null+++ b/plugins/_whatsapp_integration/prompts/fw.wa.user_message_instructions.md@@ -0,0 +1,2 @@+# WhatsApp custom rules+{{instructions}}diff --git a/plugins/_whatsapp_integration/webui/config.html b/plugins/_whatsapp_integration/webui/config.htmlnew file mode 100644index 000000000..1269af968--- /dev/null+++ b/plugins/_whatsapp_integration/webui/config.html@@ -0,0 +1,337 @@+<html>+<head>+ <title>WhatsApp Integration</title>+</head>++<body>+ <div x-data="{+ testing: false,+ test_results: null,+ projects: [],++ qr_visible: false,+ qr_status: '',+ qr_message: '',+ qr_data_url: null,+ qr_poll_timer: null,++ disconnecting: false,+ disconnect_message: '',++ async init() {+ try {+ const { callJsonApi } = await import('/js/api.js');+ const res = await callJsonApi('projects', { action: 'list' });+ this.projects = res.data || [];+ } catch (e) { this.projects = []; }+ },+ allowed_text() {+ const value = config?.allowed_numbers;+ if (Array.isArray(value)) return value.join(', ');+ return typeof value === 'string' ? value : '';+ },+ allowed_is_empty() {+ const value = config?.allowed_numbers;+ if (Array.isArray(value)) return value.length === 0;+ return !String(value || '').trim();+ },+ set_allowed(val) {+ config.allowed_numbers = val.split(',')+ .map(s => s.trim())+ .filter(s => s);+ },+ async test_connection() {+ this.testing = true;+ this.test_results = null;+ try {+ const { callJsonApi } = await import('/js/api.js');+ const res = await callJsonApi('/plugins/_whatsapp_integration/test_connection', {+ config: { bridge_port: config.bridge_port }+ });+ this.test_results = res;+ } catch (e) {+ this.test_results = { success: false, results: [{ test: 'Connection', ok: false, message: String(e) }] };+ }+ this.testing = false;+ },++ async show_qr() {+ this.qr_visible = true;+ this.qr_status = 'loading';+ this.qr_message = 'Starting bridge...';+ this.qr_data_url = null;+ await this.poll_qr();+ this.qr_poll_timer = setInterval(() => this.poll_qr(), 3000);+ },+ hide_qr() {+ this.qr_visible = false;+ this.qr_data_url = null;+ this.qr_status = '';+ if (this.qr_poll_timer) {+ clearInterval(this.qr_poll_timer);+ this.qr_poll_timer = null;+ }+ },+ async poll_qr() {+ try {+ const { callJsonApi } = await import('/js/api.js');+ const res = await callJsonApi('/plugins/_whatsapp_integration/qr_code', {});+ this.qr_status = res.status || 'error';+ this.qr_message = res.message || '';+ this.qr_data_url = res.qr || null;++ if (res.status === 'connected') {+ if (this.qr_poll_timer) {+ clearInterval(this.qr_poll_timer);+ this.qr_poll_timer = null;+ }+ }+ } catch (e) {+ this.qr_status = 'error';+ this.qr_message = String(e);+ this.qr_data_url = null;+ }+ },+ async disconnect_account() {+ if (!confirm('Disconnect this WhatsApp account? You will need to scan a new QR code to reconnect.')) return;+ this.disconnecting = true;+ this.disconnect_message = '';+ try {+ const { callJsonApi } = await import('/js/api.js');+ const res = await callJsonApi('/plugins/_whatsapp_integration/disconnect', {});+ this.disconnect_message = res.success ? 'Account disconnected' : (res.message || 'Failed');+ } catch (e) {+ this.disconnect_message = String(e);+ }+ this.disconnecting = false;+ }+ }">+ <template x-if="config">+ <div>+ <div class="section-title">WhatsApp Integration</div>+++ <div class="field">+ <div class="field-label">+ <div class="field-title">Enabled</div>+ <div class="field-description">Enable WhatsApp bridge and message polling</div>+ </div>+ <div class="field-control">+ <label class="toggle">+ <input type="checkbox" x-model="config.enabled" />+ <span class="toggler"></span>+ </label>+ </div>+ </div>++ <!-- WhatsApp Account (shown when enabled) -->+ <template x-if="config.enabled">+ <div>+ <div class="field">+ <div class="field-label">+ <div class="field-title">WhatsApp Account</div>+ <div class="field-description">+ <span x-show="!disconnect_message">Pair or switch your WhatsApp account</span>+ <span x-show="disconnect_message" x-text="disconnect_message"+ :style="'color:' + (disconnect_message === 'Account disconnected' ? '#4caf50' : '#f44336')"></span>+ </div>+ </div>+ <div class="field-control" style="display: flex; gap: 8px;">+ <button class="btn btn-field" @click="show_qr()">+ Show QR Code+ </button>+ <button class="btn btn-field" @click="disconnect_account()" :disabled="disconnecting">+ <span x-show="!disconnecting">Disconnect</span>+ <span x-show="disconnecting">Disconnecting...</span>+ </button>+ </div>+ </div>++ <!-- QR Code panel -->+ <template x-if="qr_visible">+ <div style="margin-top: 8px; padding: 16px; border-radius: 8px;+ border: 1px solid var(--border-color, #333);+ text-align: center;">++ <!-- Connected state -->+ <template x-if="qr_status === 'connected'">+ <div>+ <div style="font-size: 1.5rem; margin-bottom: 8px;">✓</div>+ <div style="font-weight: 500; color: #4caf50;" x-text="qr_message"></div>+ <button class="btn btn-field" @click="hide_qr()" style="margin-top: 12px;">+ Close+ </button>+ </div>+ </template>++ <!-- QR code ready -->+ <template x-if="qr_status === 'waiting_scan' && qr_data_url">+ <div>+ <div style="font-weight: 500; margin-bottom: 12px;">+ Scan with WhatsApp on your phone+ </div>+ <img :src="qr_data_url" alt="WhatsApp QR Code"+ style="width: 256px; height: 256px; border-radius: 8px;+ background: white; padding: 4px;" />+ <div style="margin-top: 8px; font-size: 0.8rem; opacity: 0.6;">+ QR code refreshes automatically+ </div>+ <button class="btn btn-field" @click="hide_qr()" style="margin-top: 12px;">+ Cancel+ </button>+ </div>+ </template>++ <!-- Loading / waiting for QR -->+ <template x-if="qr_status !== 'connected' && !(qr_status === 'waiting_scan' && qr_data_url)">+ <div>+ <div style="font-weight: 500; margin-bottom: 8px;" x-text="qr_message || 'Connecting...'"></div>+ <div style="font-size: 0.85rem; opacity: 0.6;">+ <template x-if="qr_status === 'error'">+ <span style="color: #f44336;" x-text="qr_message"></span>+ </template>+ <template x-if="qr_status !== 'error'">+ <span>Please wait...</span>+ </template>+ </div>+ <button class="btn btn-field" @click="hide_qr()" style="margin-top: 12px;">+ Cancel+ </button>+ </div>+ </template>+ </div>+ </template>+ </div>+ </template>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Mode</div>+ <div class="field-description">+ <span x-show="config.mode === 'self-chat'">+ Use your personal number. You can message yourself to talk to the agent, and the agent can also handle messages that other people send to your number.+ </span>+ <span x-show="config.mode !== 'self-chat'">+ Use a separate WhatsApp number dedicated to Agent Zero conversations.+ </span>+ </div>+ </div>+ <div class="field-control">+ <select x-model="config.mode">+ <option value="self-chat">Personal number (self-chat)</option>+ <option value="dedicated">Separate number (dedicated)</option>+ </select>+ </div>+ </div>++ <template x-if="config.enabled && allowed_is_empty()">+ <div style="margin: 8px 0 20px; padding: 12px 14px; border-radius: 10px;+ border: 1px solid rgba(255, 170, 0, 0.45);+ background: rgba(255, 170, 0, 0.12);+ color: var(--color-warning-text);">+ <div style="font-weight: 600; display: flex; align-items: center; gap: 8px;">+ <span aria-hidden="true">⚠</span>+ <span>Warning</span>+ </div>+ <div style="margin-top: 4px; line-height: 1.45;">+ Allowed Numbers is empty. If other people can message this WhatsApp number, they can use your Agent Zero.+ </div>+ </div>+ </template>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Allowed Numbers</div>+ <div class="field-description">Comma-separated phone numbers. Matching is normalized by the backend, so punctuation and + prefixes are okay. Empty = allow all.</div>+ </div>+ <div class="field-control">+ <input type="text" :value="allowed_text()" @change="set_allowed($event.target.value)" placeholder="+1 (415) 555-1234, +44 7911 123456" />+ </div>+ </div>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Allow Group</div>+ <div class="field-description">Respond in group chats when mentioned or replied to</div>+ </div>+ <div class="field-control">+ <label class="toggle">+ <input type="checkbox" x-model="config.allow_group" />+ <span class="toggler"></span>+ </label>+ </div>+ </div>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Project</div>+ <div class="field-description">Project to activate for WhatsApp chats</div>+ </div>+ <div class="field-control">+ <select :value="config.project" @change="config.project = $event.target.value">+ <option value="">No project</option>+ <template x-for="proj in projects" :key="proj.name">+ <option :value="proj.name" x-text="proj.title || proj.name" :selected="config.project === proj.name"></option>+ </template>+ </select>+ </div>+ </div>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Agent Instructions</div>+ <div class="field-description">Extra instructions for the agent in WhatsApp chats</div>+ </div>+ <div class="field-control">+ <textarea x-model="config.agent_instructions" rows="3" placeholder="e.g. Always respond concisely..."></textarea>+ </div>+ </div>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Bridge Port</div>+ <div class="field-description">Local port for the WhatsApp bridge HTTP server</div>+ </div>+ <div class="field-control">+ <input type="number" x-model.number="config.bridge_port" placeholder="3100" />+ </div>+ </div>++ <div class="field">+ <div class="field-label">+ <div class="field-title">Poll Interval (seconds)</div>+ <div class="field-description">How often to check for new messages (minimum 2)</div>+ </div>+ <div class="field-control">+ <input type="number" x-model.number="config.poll_interval_seconds" min="2" placeholder="3" />+ </div>+ </div>++ <!-- Test connection -->+ <div style="margin-top: 16px; display: flex; align-items: center; gap: 12px;">+ <button class="btn btn-field" @click="test_connection()" :disabled="testing">+ <span x-show="!testing">Test Connection</span>+ <span x-show="testing">Testing...</span>+ </button>+ </div>++ <!-- Test results -->+ <template x-if="test_results">+ <div style="margin-top: 8px; padding: 8px 12px; border-radius: 6px; font-size: 0.85rem;+ border: 1px solid var(--border-color, #333);">+ <template x-for="r in test_results.results" :key="r.test">+ <div style="display: flex; align-items: center; gap: 8px; padding: 4px 0;">+ <span x-text="r.ok ? '✓' : '✗'"+ :style="'font-weight: bold; color:' + (r.ok ? '#4caf50' : '#f44336')"></span>+ <span style="font-weight: 500; min-width: 50px;" x-text="r.test"></span>+ <span style="opacity: 0.8;" x-text="r.message"></span>+ </div>+ </template>+ </div>+ </template>+ </div>+ </template>+ </div>+</body>++</html>diff --git a/plugins/_whatsapp_integration/webui/thumbnail.jpg b/plugins/_whatsapp_integration/webui/thumbnail.jpgnew file mode 100644index 000000000..415d55a71Binary files /dev/null and b/plugins/_whatsapp_integration/webui/thumbnail.jpg differdiff --git a/plugins/_whatsapp_integration/whatsapp-bridge/bridge.js b/plugins/_whatsapp_integration/whatsapp-bridge/bridge.jsnew file mode 100644index 000000000..c35afc87a--- /dev/null+++ b/plugins/_whatsapp_integration/whatsapp-bridge/bridge.js@@ -0,0 +1,615 @@+#!/usr/bin/env node+/**+ * Agent Zero WhatsApp Bridge+ *+ * Standalone Node.js process that connects to WhatsApp via Baileys+ * and exposes HTTP endpoints for the Python plugin.+ *+ * Endpoints:+ * GET /messages - Poll for new incoming messages+ * POST /send - Send a message { chatId, message, replyTo? }+ * POST /edit - Edit a sent message { chatId, messageId, message }+ * POST /send-media - Send media { chatId, filePath, mediaType?, caption?, fileName? }+ * POST /typing - Send typing indicator { chatId }+ * GET /chat/:id - Get chat info+ * GET /health - Health check+ *+ * Usage:+ * node bridge.js --port 3100 --session /path/to/session --cache-dir /path/to/media+ */++import { makeWASocket, useMultiFileAuthState, DisconnectReason, fetchLatestBaileysVersion, downloadMediaMessage } from '@whiskeysockets/baileys';+import express from 'express';+import { Boom } from '@hapi/boom';+import pino from 'pino';+import path from 'path';+import { mkdirSync, readFileSync, writeFileSync, existsSync, readdirSync } from 'fs';+import { randomBytes } from 'crypto';+import qrcode from 'qrcode-terminal';+import QRCode from 'qrcode';++// Parse CLI args+const args = process.argv.slice(2);+function getArg(name, defaultVal) {+ const idx = args.indexOf(`--${name}`);+ return idx !== -1 && args[idx + 1] ? args[idx + 1] : defaultVal;+}++const WHATSAPP_DEBUG =+ typeof process !== 'undefined' &&+ process.env &&+ typeof process.env.WHATSAPP_DEBUG === 'string' &&+ ['1', 'true', 'yes', 'on'].includes(process.env.WHATSAPP_DEBUG.toLowerCase());++const DEFAULT_DATA_ROOT = path.resolve(path.dirname(new URL(import.meta.url).pathname), '..', '..', '..', 'tmp', 'whatsapp');+const PORT = parseInt(getArg('port', '3100'), 10);+const SESSION_DIR = getArg('session', path.join(DEFAULT_DATA_ROOT, 'session'));+const CACHE_DIR = getArg('cache-dir', path.join(DEFAULT_DATA_ROOT, 'media'));+const PAIR_ONLY = args.includes('--pair-only');+const MODE = getArg('mode', 'self-chat'); // "dedicated" or "self-chat"+++mkdirSync(SESSION_DIR, { recursive: true });+mkdirSync(CACHE_DIR, { recursive: true });++// Build LID -> phone reverse map from session files (lid-mapping-{phone}.json)+function buildLidMap() {+ const map = {};+ try {+ for (const f of readdirSync(SESSION_DIR)) {+ const m = f.match(/^lid-mapping-(\d+)\.json$/);+ if (!m) continue;+ const phone = m[1];+ const lid = JSON.parse(readFileSync(path.join(SESSION_DIR, f), 'utf8'));+ if (lid) map[String(lid)] = phone;+ }+ } catch {}+ return map;+}+let lidToPhone = buildLidMap();++// Cache group names to avoid repeated metadata fetches+const groupNameCache = {};++// Extract raw number from a JID (strips @domain and :device)+function numOf(jid) {+ return (jid || '').split('@')[0].split(':')[0];+}++// Resolve LID-based number to phone number using lidToPhone map+function resolveNumber(num) {+ const raw = num.split(':')[0];+ return lidToPhone[raw] || lidToPhone[num] || raw;+}++const logger = pino({ level: 'warn' });++// Message queue for polling+const messageQueue = [];+const MAX_QUEUE_SIZE = 100;++// Track recently sent message IDs to prevent echo-back loops+const recentlySentIds = new Set();+const MAX_RECENT_IDS = 50;++// Store received messages for reply quoting+const messageStore = new Map();+const MAX_STORED_MESSAGES = 200;++let sock = null;+let connectionState = 'disconnected';+let latestQrDataUrl = null;++async function startSocket() {+ const { state, saveCreds } = await useMultiFileAuthState(SESSION_DIR);+ const { version } = await fetchLatestBaileysVersion();++ sock = makeWASocket({+ version,+ auth: state,+ logger,+ printQRInTerminal: false,+ browser: ['Agent Zero', 'Chrome', '120.0'],+ syncFullHistory: false,+ markOnlineOnConnect: false,+ getMessage: async (key) => {+ return { conversation: '' };+ },+ });++ sock.ev.on('creds.update', () => { saveCreds(); lidToPhone = buildLidMap(); });++ sock.ev.on('connection.update', (update) => {+ const { connection, lastDisconnect, qr } = update;++ if (qr) {+ console.log('\n[bridge] Scan this QR code with WhatsApp on your phone:\n');+ qrcode.generate(qr, { small: true });+ console.log('\n[bridge] Waiting for scan...\n');+ QRCode.toDataURL(qr, { width: 256, margin: 2 }).then(url => {+ latestQrDataUrl = url;+ }).catch(() => {});+ }++ if (connection === 'close') {+ const reason = new Boom(lastDisconnect?.error)?.output?.statusCode;+ connectionState = 'disconnected';++ if (reason === DisconnectReason.loggedOut) {+ console.log('[bridge] Logged out. Delete session and restart to re-authenticate.');+ process.exit(1);+ } else {+ if (reason === 515) {+ console.log('[bridge] WhatsApp requested restart (code 515). Reconnecting...');+ } else {+ console.log(`[bridge] Connection closed (reason: ${reason}). Reconnecting in 3s...`);+ }+ setTimeout(startSocket, reason === 515 ? 1000 : 3000);+ }+ } else if (connection === 'open') {+ connectionState = 'connected';+ latestQrDataUrl = null;+ console.log('[bridge] WhatsApp connected');+ if (PAIR_ONLY) {+ console.log('[bridge] Pairing complete. Credentials saved.');+ setTimeout(() => process.exit(0), 2000);+ }+ }+ });++ sock.ev.on('messages.upsert', async ({ messages, type }) => {+ if (type !== 'notify' && type !== 'append') return;++ for (const msg of messages) {+ if (!msg.message) continue;++ const chatId = msg.key.remoteJid;+ if (WHATSAPP_DEBUG) {+ try {+ console.log(JSON.stringify({+ event: 'upsert', type,+ fromMe: !!msg.key.fromMe, chatId,+ senderId: msg.key.participant || chatId,+ messageKeys: Object.keys(msg.message || {}),+ }));+ } catch {}+ }+ const senderId = msg.key.participant || chatId;+ const isGroup = chatId.endsWith('@g.us');+ const senderNumber = senderId.replace(/@.*/, '');++ // Handle fromMe messages based on mode+ if (msg.key.fromMe) {+ if (isGroup || chatId.includes('status')) continue;++ if (MODE === 'dedicated') {+ // Dedicated mode: separate number — all fromMe are echo-backs, skip+ continue;+ }++ // Self-chat mode: only accept messages in the user's own self-chat+ const myNumber = (sock.user?.id || '').replace(/:.*@/, '@').replace(/@.*/, '');+ const myLid = (sock.user?.lid || '').replace(/:.*@/, '@').replace(/@.*/, '');+ const chatNumber = chatId.replace(/@.*/, '');+ const isSelfChat = (myNumber && chatNumber === myNumber) || (myLid && chatNumber === myLid);+ if (!isSelfChat) continue;+ }++ // Skip status broadcasts+ if (chatId === 'status@broadcast') continue;++ // Unwrap documentWithCaptionMessage (Baileys wraps captioned docs)+ if (msg.message.documentWithCaptionMessage?.message?.documentMessage) {+ msg.message.documentMessage = msg.message.documentWithCaptionMessage.message.documentMessage;+ }++ // Extract message body+ let body = '';+ let hasMedia = false;+ let mediaType = '';+ const mediaUrls = [];++ if (msg.message.conversation) {+ body = msg.message.conversation;+ } else if (msg.message.extendedTextMessage?.text) {+ body = msg.message.extendedTextMessage.text;+ } else if (msg.message.imageMessage) {+ body = msg.message.imageMessage.caption || '';+ hasMedia = true;+ mediaType = 'image';+ } else if (msg.message.videoMessage) {+ body = msg.message.videoMessage.caption || '';+ hasMedia = true;+ mediaType = 'video';+ } else if (msg.message.audioMessage || msg.message.pttMessage) {+ hasMedia = true;+ mediaType = msg.message.pttMessage ? 'ptt' : 'audio';+ } else if (msg.message.documentMessage) {+ body = msg.message.documentMessage.caption || '';+ hasMedia = true;+ mediaType = 'document';+ }++ // Download media to disk+ if (hasMedia) {+ try {+ const buf = await downloadMediaMessage(msg, 'buffer', {}, { logger, reuploadRequest: sock.updateMediaMessage });+ let ext = '.bin';+ let prefix = mediaType;+ if (mediaType === 'image') {+ const mime = msg.message.imageMessage?.mimetype || 'image/jpeg';+ const extMap = { 'image/jpeg': '.jpg', 'image/png': '.png', 'image/webp': '.webp', 'image/gif': '.gif' };+ ext = extMap[mime] || '.jpg';+ } else if (mediaType === 'video') {+ const mime = msg.message.videoMessage?.mimetype || 'video/mp4';+ ext = mime.includes('mp4') ? '.mp4' : '.mkv';+ } else if (mediaType === 'audio' || mediaType === 'ptt') {+ const mime = msg.message.audioMessage?.mimetype || msg.message.pttMessage?.mimetype || 'audio/ogg';+ ext = mime.includes('opus') || mime.includes('ogg') ? '.ogg' : '.mp3';+ } else if (mediaType === 'document') {+ const docMsg = msg.message.documentMessage;+ const fileName = docMsg?.fileName || '';+ if (fileName) {+ // Use original filename for documents+ const filePath = path.join(CACHE_DIR, `${randomBytes(4).toString('hex')}_${fileName}`);+ writeFileSync(filePath, buf);+ mediaUrls.push(filePath);+ if (!body) body = fileName;+ } else {+ const mime = docMsg?.mimetype || 'application/octet-stream';+ const docExtMap = { 'application/pdf': '.pdf', 'application/msword': '.doc' };+ ext = docExtMap[mime] || '.bin';+ }+ }+ // Write file if not already handled (document with fileName)+ if (mediaUrls.length === 0) {+ const filePath = path.join(CACHE_DIR, `${prefix}_${randomBytes(6).toString('hex')}${ext}`);+ writeFileSync(filePath, buf);+ mediaUrls.push(filePath);+ }+ } catch (err) {+ console.error(`[bridge] Failed to download ${mediaType}:`, err.message);+ }+ }++ // For media without caption, use a placeholder+ if (hasMedia && !body) {+ body = `[${mediaType} received]`;+ }++ // Skip echo-backs via recently sent IDs+ if (recentlySentIds.has(msg.key.id)) {+ if (WHATSAPP_DEBUG) {+ try { console.log(JSON.stringify({ event: 'ignored', reason: 'agent_echo', chatId, messageId: msg.key.id })); } catch {}+ }+ continue;+ }++ // Skip empty messages+ if (!body && !hasMedia) {+ if (WHATSAPP_DEBUG) {+ try {+ console.log(JSON.stringify({ event: 'ignored', reason: 'empty', chatId, messageKeys: Object.keys(msg.message || {}) }));+ } catch {}+ }+ continue;+ }++ // Detect if the bot was mentioned or replied to in a group message+ let mentionedMe = false;+ let repliedToMe = false;+ if (isGroup && sock.user) {+ const contextInfo = msg.message.extendedTextMessage?.contextInfo+ || msg.message.imageMessage?.contextInfo+ || msg.message.videoMessage?.contextInfo+ || msg.message.documentMessage?.contextInfo+ || null;++ // Build set of bot's own numbers for comparison+ const myNums = new Set();+ if (sock.user.id) myNums.add(numOf(sock.user.id));+ if (sock.user.lid) myNums.add(numOf(sock.user.lid));+ for (const [lid, phone] of Object.entries(lidToPhone)) {+ if (myNums.has(lid)) myNums.add(String(phone));+ if (myNums.has(String(phone))) myNums.add(lid);+ }++ // Check @mentions+ const mentionedJids = contextInfo?.mentionedJid || [];+ for (const jid of mentionedJids) {+ if (myNums.has(numOf(jid))) { mentionedMe = true; break; }+ }++ // Check if replying to a bot message+ if (contextInfo?.stanzaId) {+ const replyParticipant = contextInfo.participant || '';+ if (replyParticipant && myNums.has(numOf(replyParticipant))) {+ repliedToMe = true;+ } else if (recentlySentIds.has(contextInfo.stanzaId)) {+ repliedToMe = true;+ }+ }++ if (WHATSAPP_DEBUG && (mentionedJids.length > 0 || repliedToMe)) {+ try { console.log(JSON.stringify({ event: 'mention_reply_check', myNums: [...myNums], mentionedJids, mentionedMe, repliedToMe, stanzaId: contextInfo?.stanzaId })); } catch {}+ }+ }++ // Resolve sender number (LID -> phone if possible)+ const resolvedSender = resolveNumber(senderNumber);++ // Resolve group name from metadata cache or fetch+ let chatName;+ if (isGroup) {+ if (groupNameCache[chatId]) {+ chatName = groupNameCache[chatId];+ } else {+ try {+ const meta = await sock.groupMetadata(chatId);+ chatName = meta.subject || chatId.split('@')[0];+ groupNameCache[chatId] = chatName;+ } catch {+ chatName = chatId.split('@')[0];+ }+ }+ } else {+ chatName = msg.pushName || resolvedSender;+ }++ // Strip bot's own @mention from body so agent gets clean text+ let cleanBody = body;+ if (isGroup && mentionedMe && sock.user) {+ const myNum = numOf(sock.user.id || '');+ const myLidNum = numOf(sock.user.lid || '');+ // Remove @number or @lid patterns matching the bot+ for (const n of [myNum, myLidNum, resolveNumber(myNum), resolveNumber(myLidNum)]) {+ if (n) cleanBody = cleanBody.replace(new RegExp(`@${n}\\b`, 'g'), '').trim();+ }+ }++ const event = {+ messageId: msg.key.id,+ chatId,+ senderId,+ senderNumber: resolvedSender,+ senderName: msg.pushName || resolvedSender,+ chatName,+ isGroup,+ mentionedMe,+ repliedToMe,+ body: cleanBody,+ hasMedia,+ mediaType,+ mediaUrls,+ timestamp: msg.messageTimestamp,+ };++ // Store raw message for reply quoting+ messageStore.set(msg.key.id, msg);+ if (messageStore.size > MAX_STORED_MESSAGES) {+ messageStore.delete(messageStore.keys().next().value);+ }++ messageQueue.push(event);+ if (messageQueue.length > MAX_QUEUE_SIZE) {+ messageQueue.shift();+ }+ }+ });+}++// HTTP server+const app = express();+app.use(express.json());++// Poll for new messages+app.get('/messages', (req, res) => {+ const msgs = messageQueue.splice(0, messageQueue.length);+ res.json(msgs);+});++// Send a message+app.post('/send', async (req, res) => {+ if (!sock || connectionState !== 'connected') {+ return res.status(503).json({ error: 'Not connected to WhatsApp' });+ }++ const { chatId, message, replyTo } = req.body;+ if (!chatId || !message) {+ return res.status(400).json({ error: 'chatId and message are required' });+ }++ try {+ const opts = {};+ if (replyTo && messageStore.has(replyTo)) {+ opts.quoted = messageStore.get(replyTo);+ }+ const sent = await sock.sendMessage(chatId, { text: message }, opts);++ if (sent?.key?.id) {+ recentlySentIds.add(sent.key.id);+ if (recentlySentIds.size > MAX_RECENT_IDS) {+ recentlySentIds.delete(recentlySentIds.values().next().value);+ }+ }++ res.json({ success: true, messageId: sent?.key?.id });+ } catch (err) {+ res.status(500).json({ error: err.message });+ }+});++// Edit a previously sent message+app.post('/edit', async (req, res) => {+ if (!sock || connectionState !== 'connected') {+ return res.status(503).json({ error: 'Not connected to WhatsApp' });+ }++ const { chatId, messageId, message } = req.body;+ if (!chatId || !messageId || !message) {+ return res.status(400).json({ error: 'chatId, messageId, and message are required' });+ }++ try {+ const key = { id: messageId, fromMe: true, remoteJid: chatId };+ await sock.sendMessage(chatId, { text: message, edit: key });+ res.json({ success: true });+ } catch (err) {+ res.status(500).json({ error: err.message });+ }+});++// MIME type map and media type inference+const MIME_MAP = {+ jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png',+ webp: 'image/webp', gif: 'image/gif',+ mp4: 'video/mp4', mov: 'video/quicktime', avi: 'video/x-msvideo',+ mkv: 'video/x-matroska', '3gp': 'video/3gpp',+ pdf: 'application/pdf',+ doc: 'application/msword',+ docx: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',+ xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',+};++function inferMediaType(ext) {+ if (['jpg', 'jpeg', 'png', 'webp', 'gif'].includes(ext)) return 'image';+ if (['mp4', 'mov', 'avi', 'mkv', '3gp'].includes(ext)) return 'video';+ if (['ogg', 'opus', 'mp3', 'wav', 'm4a'].includes(ext)) return 'audio';+ return 'document';+}++// Send media natively+app.post('/send-media', async (req, res) => {+ if (!sock || connectionState !== 'connected') {+ return res.status(503).json({ error: 'Not connected to WhatsApp' });+ }++ const { chatId, filePath, mediaType, caption, fileName } = req.body;+ if (!chatId || !filePath) {+ return res.status(400).json({ error: 'chatId and filePath are required' });+ }++ try {+ if (!existsSync(filePath)) {+ return res.status(404).json({ error: `File not found: ${filePath}` });+ }++ const buffer = readFileSync(filePath);+ const ext = filePath.toLowerCase().split('.').pop();+ const type = mediaType || inferMediaType(ext);+ let msgPayload;++ switch (type) {+ case 'image':+ msgPayload = { image: buffer, caption: caption || undefined, mimetype: MIME_MAP[ext] || 'image/jpeg' };+ break;+ case 'video':+ msgPayload = { video: buffer, caption: caption || undefined, mimetype: MIME_MAP[ext] || 'video/mp4' };+ break;+ case 'audio': {+ const audioMime = (ext === 'ogg' || ext === 'opus') ? 'audio/ogg; codecs=opus' : 'audio/mpeg';+ msgPayload = { audio: buffer, mimetype: audioMime, ptt: ext === 'ogg' || ext === 'opus' };+ break;+ }+ case 'document':+ default:+ msgPayload = {+ document: buffer,+ fileName: fileName || path.basename(filePath),+ caption: caption || undefined,+ mimetype: MIME_MAP[ext] || 'application/octet-stream',+ };+ break;+ }++ const sent = await sock.sendMessage(chatId, msgPayload);++ if (sent?.key?.id) {+ recentlySentIds.add(sent.key.id);+ if (recentlySentIds.size > MAX_RECENT_IDS) {+ recentlySentIds.delete(recentlySentIds.values().next().value);+ }+ }++ res.json({ success: true, messageId: sent?.key?.id });+ } catch (err) {+ res.status(500).json({ error: err.message });+ }+});++// Typing indicator+app.post('/typing', async (req, res) => {+ if (!sock || connectionState !== 'connected') {+ return res.status(503).json({ error: 'Not connected' });+ }++ const { chatId, status } = req.body;+ if (!chatId) return res.status(400).json({ error: 'chatId required' });++ try {+ await sock.sendPresenceUpdate(status === 'paused' ? 'paused' : 'composing', chatId);+ res.json({ success: true });+ } catch (err) {+ res.json({ success: false });+ }+});++// Chat info+app.get('/chat/:id', async (req, res) => {+ const chatId = req.params.id;+ const isGroup = chatId.endsWith('@g.us');++ if (isGroup && sock) {+ try {+ const metadata = await sock.groupMetadata(chatId);+ return res.json({+ name: metadata.subject,+ isGroup: true,+ participants: metadata.participants.map(p => p.id),+ });+ } catch {+ // Fall through to default+ }+ }++ res.json({+ name: chatId.replace(/@.*/, ''),+ isGroup,+ participants: [],+ });+});++// QR code for web UI pairing+app.get('/qr', (req, res) => {+ if (connectionState === 'connected') {+ return res.json({ status: 'connected', qr: null });+ }+ if (latestQrDataUrl) {+ return res.json({ status: 'waiting_scan', qr: latestQrDataUrl });+ }+ res.json({ status: 'waiting_qr', qr: null });+});++// Health check+app.get('/health', (req, res) => {+ res.json({+ status: connectionState,+ queueLength: messageQueue.length,+ uptime: process.uptime(),+ });+});++// Start+if (PAIR_ONLY) {+ console.log('[bridge] WhatsApp pairing mode');+ console.log(`[bridge] Session: ${SESSION_DIR}`);+ console.log();+ startSocket();+} else {+ app.listen(PORT, '127.0.0.1', () => {+ console.log(`[bridge] WhatsApp bridge listening on port ${PORT} (mode: ${MODE})`);+ console.log(`[bridge] Session: ${SESSION_DIR}`);+ console.log();+ startSocket();+ });+}diff --git a/plugins/_whatsapp_integration/whatsapp-bridge/package-lock.json b/plugins/_whatsapp_integration/whatsapp-bridge/package-lock.jsonnew file mode 100644index 000000000..c9a46afd1--- /dev/null+++ b/plugins/_whatsapp_integration/whatsapp-bridge/package-lock.json@@ -0,0 +1,2468 @@+{+ "name": "a0-whatsapp-bridge",+ "version": "1.0.0",+ "lockfileVersion": 3,+ "requires": true,+ "packages": {+ "": {+ "name": "a0-whatsapp-bridge",+ "version": "1.0.0",+ "dependencies": {+ "@whiskeysockets/baileys": "7.0.0-rc.9",+ "express": "^4.21.0",+ "pino": "^9.0.0",+ "qrcode": "^1.5.0",+ "qrcode-terminal": "^0.12.0"+ }+ },+ "node_modules/@borewit/text-codec": {+ "version": "0.2.2",+ "resolved": "https://registry.npmjs.org/@borewit/text-codec/-/text-codec-0.2.2.tgz",+ "integrity": "sha512-DDaRehssg1aNrH4+2hnj1B7vnUGEjU6OIlyRdkMd0aUdIUvKXrJfXsy8LVtXAy7DRvYVluWbMspsRhz2lcW0mQ==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/Borewit"+ }+ },+ "node_modules/@cacheable/memory": {+ "version": "2.0.8",+ "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.0.8.tgz",+ "integrity": "sha512-FvEb29x5wVwu/Kf93IWwsOOEuhHh6dYCJF3vcKLzXc0KXIW181AOzv6ceT4ZpBHDvAfG60eqb+ekmrnLHIy+jw==",+ "license": "MIT",+ "dependencies": {+ "@cacheable/utils": "^2.4.0",+ "@keyv/bigmap": "^1.3.1",+ "hookified": "^1.15.1",+ "keyv": "^5.6.0"+ }+ },+ "node_modules/@cacheable/node-cache": {+ "version": "1.7.6",+ "resolved": "https://registry.npmjs.org/@cacheable/node-cache/-/node-cache-1.7.6.tgz",+ "integrity": "sha512-6Omk2SgNnjtxB5f/E6bTIWIt5xhdpx39fGNRQgU9lojvRxU68v+qY+SXXLsp3ZGukqoPjsK21wZ6XABFr/Ge3A==",+ "license": "MIT",+ "dependencies": {+ "cacheable": "^2.3.1",+ "hookified": "^1.14.0",+ "keyv": "^5.5.5"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@cacheable/utils": {+ "version": "2.4.0",+ "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.4.0.tgz",+ "integrity": "sha512-PeMMsqjVq+bF0WBsxFBxr/WozBJiZKY0rUojuaCoIaKnEl3Ju1wfEwS+SV1DU/cSe8fqHIPiYJFif8T3MVt4cQ==",+ "license": "MIT",+ "dependencies": {+ "hashery": "^1.5.0",+ "keyv": "^5.6.0"+ }+ },+ "node_modules/@emnapi/runtime": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.9.1.tgz",+ "integrity": "sha512-VYi5+ZVLhpgK4hQ0TAjiQiZ6ol0oe4mBx7mVv7IflsiEp0OWoVsp/+f9Vc1hOhE0TtkORVrI1GvzyreqpgWtkA==",+ "license": "MIT",+ "optional": true,+ "peer": true,+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },+ "node_modules/@hapi/boom": {+ "version": "9.1.4",+ "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz",+ "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "@hapi/hoek": "9.x.x"+ }+ },+ "node_modules/@hapi/hoek": {+ "version": "9.3.0",+ "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz",+ "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@img/colour": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz",+ "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==",+ "license": "MIT",+ "peer": true,+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/@img/sharp-darwin-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.34.5.tgz",+ "integrity": "sha512-imtQ3WMJXbMY4fxb/Ndp6HBTNVtWCUI0WdobyheGf5+ad6xX8VIDO8u2xE4qc/fr08CKG/7dDseFtn6M6g/r3w==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-darwin-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.34.5.tgz",+ "integrity": "sha512-YNEFAF/4KQ/PeW0N+r+aVVsoIY0/qxxikF2SWdp+NRkmMB7y9LBZAVqQ4yhGCm/H3H270OSykqmQMKLBhBJDEw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-darwin-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.2.4.tgz",+ "integrity": "sha512-zqjjo7RatFfFoP0MkQ51jfuFZBnVE2pRiaydKJ1G/rHZvnsrHAOcQALIi9sA5co5xenQdTugCvtb1cuf78Vf4g==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-darwin-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.2.4.tgz",+ "integrity": "sha512-1IOd5xfVhlGwX+zXv2N93k0yMONvUlANylbJw1eTah8K/Jtpi15KC+WSiaX/nBmbm2HxRM1gZ0nSdjSsrZbGKg==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "darwin"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.2.4.tgz",+ "integrity": "sha512-bFI7xcKFELdiNCVov8e44Ia4u2byA+l3XtsAj+Q8tfCwO6BQ8iDojYdvoPMqsKDkuoOo+X6HZA0s0q11ANMQ8A==",+ "cpu": [+ "arm"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.2.4.tgz",+ "integrity": "sha512-excjX8DfsIcJ10x1Kzr4RcWe1edC9PquDRRPx3YVCvQv+U5p7Yin2s32ftzikXojb1PIFc/9Mt28/y+iRklkrw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-ppc64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.2.4.tgz",+ "integrity": "sha512-FMuvGijLDYG6lW+b/UvyilUWu5Ayu+3r2d1S8notiGCIyYU/76eig1UfMmkZ7vwgOrzKzlQbFSuQfgm7GYUPpA==",+ "cpu": [+ "ppc64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-riscv64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.2.4.tgz",+ "integrity": "sha512-oVDbcR4zUC0ce82teubSm+x6ETixtKZBh/qbREIOcI3cULzDyb18Sr/Wcyx7NRQeQzOiHTNbZFF1UwPS2scyGA==",+ "cpu": [+ "riscv64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-s390x": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.2.4.tgz",+ "integrity": "sha512-qmp9VrzgPgMoGZyPvrQHqk02uyjA0/QrTO26Tqk6l4ZV0MPWIW6LTkqOIov+J1yEu7MbFQaDpwdwJKhbJvuRxQ==",+ "cpu": [+ "s390x"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linux-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.2.4.tgz",+ "integrity": "sha512-tJxiiLsmHc9Ax1bz3oaOYBURTXGIRDODBqhveVHonrHJ9/+k89qbLl0bcJns+e4t4rvaNBxaEZsFtSfAdquPrw==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.2.4.tgz",+ "integrity": "sha512-FVQHuwx1IIuNow9QAbYUzJ+En8KcVm9Lk5+uGUQJHaZmMECZmOlix9HnH7n1TRkXMS0pGxIJokIVB9SuqZGGXw==",+ "cpu": [+ "arm64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {+ "version": "1.2.4",+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.2.4.tgz",+ "integrity": "sha512-+LpyBk7L44ZIXwz/VYfglaX/okxezESc6UxDSoyo2Ks6Jxc4Y7sGjpgU9s4PMgqgjj1gZCylTieNamqA1MF7Dg==",+ "cpu": [+ "x64"+ ],+ "license": "LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-linux-arm": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.34.5.tgz",+ "integrity": "sha512-9dLqsvwtg1uuXBGZKsxem9595+ujv0sJ6Vi8wcTANSFpwV/GONat5eCkzQo/1O6zRIkh0m/8+5BjrRr7jDUSZw==",+ "cpu": [+ "arm"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.34.5.tgz",+ "integrity": "sha512-bKQzaJRY/bkPOXyKx5EVup7qkaojECG6NLYswgktOZjaXecSAeCWiZwwiFf3/Y+O1HrauiE3FVsGxFg8c24rZg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-ppc64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.34.5.tgz",+ "integrity": "sha512-7zznwNaqW6YtsfrGGDA6BRkISKAAE1Jo0QdpNYXNMHu2+0dTrPflTLNkpc8l7MUP5M16ZJcUvysVWWrMefZquA==",+ "cpu": [+ "ppc64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-ppc64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-riscv64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.34.5.tgz",+ "integrity": "sha512-51gJuLPTKa7piYPaVs8GmByo7/U7/7TZOq+cnXJIHZKavIRHAP77e3N2HEl3dgiqdD/w0yUfiJnII77PuDDFdw==",+ "cpu": [+ "riscv64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-riscv64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-s390x": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.34.5.tgz",+ "integrity": "sha512-nQtCk0PdKfho3eC5MrbQoigJ2gd1CgddUMkabUj+rBevs8tZ2cULOx46E7oyX+04WGfABgIwmMC0VqieTiR4jg==",+ "cpu": [+ "s390x"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-s390x": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linux-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.34.5.tgz",+ "integrity": "sha512-MEzd8HPKxVxVenwAa+JRPwEC7QFjoPWuS5NZnBt6B3pu7EG2Ge0id1oLHZpPJdn3OQK+BQDiw9zStiHBTJQQQQ==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linux-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.34.5.tgz",+ "integrity": "sha512-fprJR6GtRsMt6Kyfq44IsChVZeGN97gTD331weR1ex1c1rypDEABN6Tm2xa1wE6lYb5DdEnk03NZPqA7Id21yg==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-linuxmusl-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.34.5.tgz",+ "integrity": "sha512-Jg8wNT1MUzIvhBFxViqrEhWDGzqymo3sV7z7ZsaWbZNDLXRJZoRGrjulp60YYtV4wfY8VIKcWidjojlLcWrd8Q==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0",+ "optional": true,+ "os": [+ "linux"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4"+ }+ },+ "node_modules/@img/sharp-wasm32": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.34.5.tgz",+ "integrity": "sha512-OdWTEiVkY2PHwqkbBI8frFxQQFekHaSSkUIJkwzclWZe64O1X4UlUjqqqLaPbUpMOQk6FBu/HtlGXNblIs0huw==",+ "cpu": [+ "wasm32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",+ "optional": true,+ "peer": true,+ "dependencies": {+ "@emnapi/runtime": "^1.7.0"+ },+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-arm64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.34.5.tgz",+ "integrity": "sha512-WQ3AgWCWYSb2yt+IG8mnC6Jdk9Whs7O0gxphblsLvdhSpSTtmu69ZG1Gkb6NuvxsNACwiPV6cNSZNzt0KPsw7g==",+ "cpu": [+ "arm64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-ia32": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.34.5.tgz",+ "integrity": "sha512-FV9m/7NmeCmSHDD5j4+4pNI8Cp3aW+JvLoXcTUo0IqyjSfAZJ8dIUmijx1qaJsIiU+Hosw6xM5KijAWRJCSgNg==",+ "cpu": [+ "ia32"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@img/sharp-win32-x64": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.34.5.tgz",+ "integrity": "sha512-+29YMsqY2/9eFEiW93eqWnuLcWcufowXewwSNIT6UwZdUUCrM3oFjMWH/Z6/TMmb4hlFenmfAVbpWeup2jryCw==",+ "cpu": [+ "x64"+ ],+ "license": "Apache-2.0 AND LGPL-3.0-or-later",+ "optional": true,+ "os": [+ "win32"+ ],+ "peer": true,+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ }+ },+ "node_modules/@keyv/bigmap": {+ "version": "1.3.1",+ "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz",+ "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==",+ "license": "MIT",+ "dependencies": {+ "hashery": "^1.4.0",+ "hookified": "^1.15.0"+ },+ "engines": {+ "node": ">= 18"+ },+ "peerDependencies": {+ "keyv": "^5.6.0"+ }+ },+ "node_modules/@keyv/serialize": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz",+ "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==",+ "license": "MIT"+ },+ "node_modules/@pinojs/redact": {+ "version": "0.4.0",+ "resolved": "https://registry.npmjs.org/@pinojs/redact/-/redact-0.4.0.tgz",+ "integrity": "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg==",+ "license": "MIT"+ },+ "node_modules/@protobufjs/aspromise": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",+ "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/base64": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",+ "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/codegen": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",+ "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/eventemitter": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",+ "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/fetch": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",+ "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "@protobufjs/aspromise": "^1.1.1",+ "@protobufjs/inquire": "^1.1.0"+ }+ },+ "node_modules/@protobufjs/float": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",+ "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/inquire": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",+ "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/path": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",+ "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/pool": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",+ "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@protobufjs/utf8": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",+ "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==",+ "license": "BSD-3-Clause"+ },+ "node_modules/@tokenizer/inflate": {+ "version": "0.4.1",+ "resolved": "https://registry.npmjs.org/@tokenizer/inflate/-/inflate-0.4.1.tgz",+ "integrity": "sha512-2mAv+8pkG6GIZiF1kNg1jAjh27IDxEPKwdGul3snfztFerfPGI1LjDezZp3i7BElXompqEtPmoPx6c2wgtWsOA==",+ "license": "MIT",+ "dependencies": {+ "debug": "^4.4.3",+ "token-types": "^6.1.1"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/Borewit"+ }+ },+ "node_modules/@tokenizer/inflate/node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/@tokenizer/inflate/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/@tokenizer/token": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/@tokenizer/token/-/token-0.3.0.tgz",+ "integrity": "sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==",+ "license": "MIT"+ },+ "node_modules/@types/long": {+ "version": "4.0.2",+ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz",+ "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==",+ "license": "MIT"+ },+ "node_modules/@types/node": {+ "version": "25.5.0",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.5.0.tgz",+ "integrity": "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw==",+ "license": "MIT",+ "dependencies": {+ "undici-types": "~7.18.0"+ }+ },+ "node_modules/@whiskeysockets/baileys": {+ "version": "7.0.0-rc.9",+ "resolved": "https://registry.npmjs.org/@whiskeysockets/baileys/-/baileys-7.0.0-rc.9.tgz",+ "integrity": "sha512-YFm5gKXfDP9byCXCW3OPHKXLzrAKzolzgVUlRosHHgwbnf2YOO3XknkMm6J7+F0ns8OA0uuSBhgkRHTDtqkacw==",+ "hasInstallScript": true,+ "license": "MIT",+ "dependencies": {+ "@cacheable/node-cache": "^1.4.0",+ "@hapi/boom": "^9.1.3",+ "async-mutex": "^0.5.0",+ "libsignal": "git+https://github.com/whiskeysockets/libsignal-node.git",+ "lru-cache": "^11.1.0",+ "music-metadata": "^11.7.0",+ "p-queue": "^9.0.0",+ "pino": "^9.6",+ "protobufjs": "^7.2.4",+ "ws": "^8.13.0"+ },+ "engines": {+ "node": ">=20.0.0"+ },+ "peerDependencies": {+ "audio-decode": "^2.1.3",+ "jimp": "^1.6.0",+ "link-preview-js": "^3.0.0",+ "sharp": "*"+ },+ "peerDependenciesMeta": {+ "audio-decode": {+ "optional": true+ },+ "jimp": {+ "optional": true+ },+ "link-preview-js": {+ "optional": true+ }+ }+ },+ "node_modules/accepts": {+ "version": "1.3.8",+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",+ "integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",+ "license": "MIT",+ "dependencies": {+ "mime-types": "~2.1.34",+ "negotiator": "0.6.3"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/ansi-regex": {+ "version": "5.0.1",+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ansi-styles": {+ "version": "4.3.0",+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",+ "license": "MIT",+ "dependencies": {+ "color-convert": "^2.0.1"+ },+ "engines": {+ "node": ">=8"+ },+ "funding": {+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"+ }+ },+ "node_modules/array-flatten": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",+ "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",+ "license": "MIT"+ },+ "node_modules/async-mutex": {+ "version": "0.5.0",+ "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz",+ "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==",+ "license": "MIT",+ "dependencies": {+ "tslib": "^2.4.0"+ }+ },+ "node_modules/atomic-sleep": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",+ "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",+ "license": "MIT",+ "engines": {+ "node": ">=8.0.0"+ }+ },+ "node_modules/body-parser": {+ "version": "1.20.4",+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.4.tgz",+ "integrity": "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "content-type": "~1.0.5",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "~1.2.0",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "on-finished": "~2.4.1",+ "qs": "~6.14.0",+ "raw-body": "~2.5.3",+ "type-is": "~1.6.18",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/bytes": {+ "version": "3.1.2",+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/cacheable": {+ "version": "2.3.4",+ "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.3.4.tgz",+ "integrity": "sha512-djgxybDbw9fL/ZWMI3+CE8ZilNxcwFkVtDc1gJ+IlOSSWkSMPQabhV/XCHTQ6pwwN6aivXPZ43omTooZiX06Ew==",+ "license": "MIT",+ "dependencies": {+ "@cacheable/memory": "^2.0.8",+ "@cacheable/utils": "^2.4.0",+ "hookified": "^1.15.0",+ "keyv": "^5.6.0",+ "qified": "^0.9.0"+ }+ },+ "node_modules/call-bind-apply-helpers": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/call-bound": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "get-intrinsic": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/camelcase": {+ "version": "5.3.1",+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",+ "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/cliui": {+ "version": "6.0.0",+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",+ "license": "ISC",+ "dependencies": {+ "string-width": "^4.2.0",+ "strip-ansi": "^6.0.0",+ "wrap-ansi": "^6.2.0"+ }+ },+ "node_modules/color-convert": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",+ "license": "MIT",+ "dependencies": {+ "color-name": "~1.1.4"+ },+ "engines": {+ "node": ">=7.0.0"+ }+ },+ "node_modules/color-name": {+ "version": "1.1.4",+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",+ "license": "MIT"+ },+ "node_modules/content-disposition": {+ "version": "0.5.4",+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",+ "integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",+ "license": "MIT",+ "dependencies": {+ "safe-buffer": "5.2.1"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/content-type": {+ "version": "1.0.5",+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie": {+ "version": "0.7.2",+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/cookie-signature": {+ "version": "1.0.7",+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",+ "integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",+ "license": "MIT"+ },+ "node_modules/curve25519-js": {+ "version": "0.0.4",+ "resolved": "https://registry.npmjs.org/curve25519-js/-/curve25519-js-0.0.4.tgz",+ "integrity": "sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w==",+ "license": "MIT"+ },+ "node_modules/debug": {+ "version": "2.6.9",+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",+ "license": "MIT",+ "dependencies": {+ "ms": "2.0.0"+ }+ },+ "node_modules/decamelize": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz",+ "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/depd": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/destroy": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",+ "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8",+ "npm": "1.2.8000 || >= 1.4.16"+ }+ },+ "node_modules/detect-libc": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",+ "license": "Apache-2.0",+ "peer": true,+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/dijkstrajs": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/dijkstrajs/-/dijkstrajs-1.0.3.tgz",+ "integrity": "sha512-qiSlmBq9+BCdCA/L46dw8Uy93mloxsPSbwnm5yrKn2vMPiy8KyAskTF6zuV/j5BMsmOGZDPs7KjU+mjb670kfA==",+ "license": "MIT"+ },+ "node_modules/dunder-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.1",+ "es-errors": "^1.3.0",+ "gopd": "^1.2.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/ee-first": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",+ "license": "MIT"+ },+ "node_modules/emoji-regex": {+ "version": "8.0.0",+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",+ "license": "MIT"+ },+ "node_modules/encodeurl": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/es-define-property": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-errors": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/es-object-atoms": {+ "version": "1.1.1",+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/escape-html": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",+ "license": "MIT"+ },+ "node_modules/etag": {+ "version": "1.8.1",+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/eventemitter3": {+ "version": "5.0.4",+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",+ "license": "MIT"+ },+ "node_modules/express": {+ "version": "4.22.1",+ "resolved": "https://registry.npmjs.org/express/-/express-4.22.1.tgz",+ "integrity": "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g==",+ "license": "MIT",+ "dependencies": {+ "accepts": "~1.3.8",+ "array-flatten": "1.1.1",+ "body-parser": "~1.20.3",+ "content-disposition": "~0.5.4",+ "content-type": "~1.0.4",+ "cookie": "~0.7.1",+ "cookie-signature": "~1.0.6",+ "debug": "2.6.9",+ "depd": "2.0.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "finalhandler": "~1.3.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.0",+ "merge-descriptors": "1.0.3",+ "methods": "~1.1.2",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "path-to-regexp": "~0.1.12",+ "proxy-addr": "~2.0.7",+ "qs": "~6.14.0",+ "range-parser": "~1.2.1",+ "safe-buffer": "5.2.1",+ "send": "~0.19.0",+ "serve-static": "~1.16.2",+ "setprototypeof": "1.2.0",+ "statuses": "~2.0.1",+ "type-is": "~1.6.18",+ "utils-merge": "1.0.1",+ "vary": "~1.1.2"+ },+ "engines": {+ "node": ">= 0.10.0"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/file-type": {+ "version": "21.3.4",+ "resolved": "https://registry.npmjs.org/file-type/-/file-type-21.3.4.tgz",+ "integrity": "sha512-Ievi/yy8DS3ygGvT47PjSfdFoX+2isQueoYP1cntFW1JLYAuS4GD7NUPGg4zv2iZfV52uDyk5w5Z0TdpRS6Q1g==",+ "license": "MIT",+ "dependencies": {+ "@tokenizer/inflate": "^0.4.1",+ "strtok3": "^10.3.4",+ "token-types": "^6.1.1",+ "uint8array-extras": "^1.4.0"+ },+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sindresorhus/file-type?sponsor=1"+ }+ },+ "node_modules/finalhandler": {+ "version": "1.3.2",+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",+ "integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "on-finished": "~2.4.1",+ "parseurl": "~1.3.3",+ "statuses": "~2.0.2",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/find-up": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",+ "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",+ "license": "MIT",+ "dependencies": {+ "locate-path": "^5.0.0",+ "path-exists": "^4.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/forwarded": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/fresh": {+ "version": "0.5.2",+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",+ "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/function-bind": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-caller-file": {+ "version": "2.0.5",+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",+ "license": "ISC",+ "engines": {+ "node": "6.* || 8.* || >= 10.*"+ }+ },+ "node_modules/get-intrinsic": {+ "version": "1.3.0",+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",+ "license": "MIT",+ "dependencies": {+ "call-bind-apply-helpers": "^1.0.2",+ "es-define-property": "^1.0.1",+ "es-errors": "^1.3.0",+ "es-object-atoms": "^1.1.1",+ "function-bind": "^1.1.2",+ "get-proto": "^1.0.1",+ "gopd": "^1.2.0",+ "has-symbols": "^1.1.0",+ "hasown": "^2.0.2",+ "math-intrinsics": "^1.1.0"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/get-proto": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",+ "license": "MIT",+ "dependencies": {+ "dunder-proto": "^1.0.1",+ "es-object-atoms": "^1.0.0"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/gopd": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/has-symbols": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/hashery": {+ "version": "1.5.1",+ "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz",+ "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==",+ "license": "MIT",+ "dependencies": {+ "hookified": "^1.15.0"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/hasown": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",+ "license": "MIT",+ "dependencies": {+ "function-bind": "^1.1.2"+ },+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/hookified": {+ "version": "1.15.1",+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz",+ "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==",+ "license": "MIT"+ },+ "node_modules/http-errors": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",+ "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",+ "license": "MIT",+ "dependencies": {+ "depd": "~2.0.0",+ "inherits": "~2.0.4",+ "setprototypeof": "~1.2.0",+ "statuses": "~2.0.2",+ "toidentifier": "~1.0.1"+ },+ "engines": {+ "node": ">= 0.8"+ },+ "funding": {+ "type": "opencollective",+ "url": "https://opencollective.com/express"+ }+ },+ "node_modules/iconv-lite": {+ "version": "0.4.24",+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",+ "license": "MIT",+ "dependencies": {+ "safer-buffer": ">= 2.1.2 < 3"+ },+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/ieee754": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",+ "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "BSD-3-Clause"+ },+ "node_modules/inherits": {+ "version": "2.0.4",+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",+ "license": "ISC"+ },+ "node_modules/ipaddr.js": {+ "version": "1.9.1",+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/is-fullwidth-code-point": {+ "version": "3.0.0",+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/keyv": {+ "version": "5.6.0",+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz",+ "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==",+ "license": "MIT",+ "dependencies": {+ "@keyv/serialize": "^1.1.1"+ }+ },+ "node_modules/libsignal": {+ "name": "@whiskeysockets/libsignal-node",+ "version": "2.0.1",+ "resolved": "git+ssh://[email protected]/whiskeysockets/libsignal-node.git#1c30d7d7e76a3b0aa120b04dc6a26f5a12dccf67",+ "license": "GPL-3.0",+ "dependencies": {+ "curve25519-js": "^0.0.4",+ "protobufjs": "6.8.8"+ }+ },+ "node_modules/libsignal/node_modules/@types/node": {+ "version": "10.17.60",+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz",+ "integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==",+ "license": "MIT"+ },+ "node_modules/libsignal/node_modules/long": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",+ "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==",+ "license": "Apache-2.0"+ },+ "node_modules/libsignal/node_modules/protobufjs": {+ "version": "6.8.8",+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.8.8.tgz",+ "integrity": "sha512-AAmHtD5pXgZfi7GMpllpO3q1Xw1OYldr+dMUlAnffGTAhqkg72WdmSY71uKBF/JuyiKs8psYbtKrhi0ASCD8qw==",+ "hasInstallScript": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "@protobufjs/aspromise": "^1.1.2",+ "@protobufjs/base64": "^1.1.2",+ "@protobufjs/codegen": "^2.0.4",+ "@protobufjs/eventemitter": "^1.1.0",+ "@protobufjs/fetch": "^1.1.0",+ "@protobufjs/float": "^1.0.2",+ "@protobufjs/inquire": "^1.1.0",+ "@protobufjs/path": "^1.1.2",+ "@protobufjs/pool": "^1.1.0",+ "@protobufjs/utf8": "^1.1.0",+ "@types/long": "^4.0.0",+ "@types/node": "^10.1.0",+ "long": "^4.0.0"+ },+ "bin": {+ "pbjs": "bin/pbjs",+ "pbts": "bin/pbts"+ }+ },+ "node_modules/locate-path": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",+ "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",+ "license": "MIT",+ "dependencies": {+ "p-locate": "^4.1.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/long": {+ "version": "5.3.2",+ "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz",+ "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==",+ "license": "Apache-2.0"+ },+ "node_modules/lru-cache": {+ "version": "11.2.7",+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.7.tgz",+ "integrity": "sha512-aY/R+aEsRelme17KGQa/1ZSIpLpNYYrhcrepKTZgE+W3WM16YMCaPwOHLHsmopZHELU0Ojin1lPVxKR0MihncA==",+ "license": "BlueOak-1.0.0",+ "engines": {+ "node": "20 || >=22"+ }+ },+ "node_modules/math-intrinsics": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ }+ },+ "node_modules/media-typer": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/merge-descriptors": {+ "version": "1.0.3",+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",+ "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",+ "license": "MIT",+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/methods": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",+ "integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime": {+ "version": "1.6.0",+ "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",+ "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",+ "license": "MIT",+ "bin": {+ "mime": "cli.js"+ },+ "engines": {+ "node": ">=4"+ }+ },+ "node_modules/mime-db": {+ "version": "1.52.0",+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/mime-types": {+ "version": "2.1.35",+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",+ "license": "MIT",+ "dependencies": {+ "mime-db": "1.52.0"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/ms": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",+ "license": "MIT"+ },+ "node_modules/music-metadata": {+ "version": "11.12.3",+ "resolved": "https://registry.npmjs.org/music-metadata/-/music-metadata-11.12.3.tgz",+ "integrity": "sha512-n6hSTZkuD59qWgHh6IP5dtDlDZQXoxk/bcA85Jywg8Z1iFrlNgl2+GTFgjZyn52W5UgQpV42V4XqrQZZAMbZTQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/Borewit"+ },+ {+ "type": "buymeacoffee",+ "url": "https://buymeacoffee.com/borewit"+ }+ ],+ "license": "MIT",+ "dependencies": {+ "@borewit/text-codec": "^0.2.2",+ "@tokenizer/token": "^0.3.0",+ "content-type": "^1.0.5",+ "debug": "^4.4.3",+ "file-type": "^21.3.1",+ "media-typer": "^1.1.0",+ "strtok3": "^10.3.4",+ "token-types": "^6.1.2",+ "uint8array-extras": "^1.5.0",+ "win-guid": "^0.2.1"+ },+ "engines": {+ "node": ">=18"+ }+ },+ "node_modules/music-metadata/node_modules/debug": {+ "version": "4.4.3",+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",+ "license": "MIT",+ "dependencies": {+ "ms": "^2.1.3"+ },+ "engines": {+ "node": ">=6.0"+ },+ "peerDependenciesMeta": {+ "supports-color": {+ "optional": true+ }+ }+ },+ "node_modules/music-metadata/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/negotiator": {+ "version": "0.6.3",+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",+ "integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/object-inspect": {+ "version": "1.13.4",+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/on-exit-leak-free": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",+ "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",+ "license": "MIT",+ "engines": {+ "node": ">=14.0.0"+ }+ },+ "node_modules/on-finished": {+ "version": "2.4.1",+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",+ "license": "MIT",+ "dependencies": {+ "ee-first": "1.1.1"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/p-limit": {+ "version": "2.3.0",+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",+ "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==",+ "license": "MIT",+ "dependencies": {+ "p-try": "^2.0.0"+ },+ "engines": {+ "node": ">=6"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-locate": {+ "version": "4.1.0",+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",+ "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",+ "license": "MIT",+ "dependencies": {+ "p-limit": "^2.2.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/p-queue": {+ "version": "9.1.0",+ "resolved": "https://registry.npmjs.org/p-queue/-/p-queue-9.1.0.tgz",+ "integrity": "sha512-O/ZPaXuQV29uSLbxWBGGZO1mCQXV2BLIwUr59JUU9SoH76mnYvtms7aafH/isNSNGwuEfP6W/4xD0/TJXxrizw==",+ "license": "MIT",+ "dependencies": {+ "eventemitter3": "^5.0.1",+ "p-timeout": "^7.0.0"+ },+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-timeout": {+ "version": "7.0.1",+ "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-7.0.1.tgz",+ "integrity": "sha512-AxTM2wDGORHGEkPCt8yqxOTMgpfbEHqF51f/5fJCmwFC3C/zNcGT63SymH2ttOAaiIws2zVg4+izQCjrakcwHg==",+ "license": "MIT",+ "engines": {+ "node": ">=20"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/p-try": {+ "version": "2.2.0",+ "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz",+ "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==",+ "license": "MIT",+ "engines": {+ "node": ">=6"+ }+ },+ "node_modules/parseurl": {+ "version": "1.3.3",+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/path-exists": {+ "version": "4.0.0",+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",+ "license": "MIT",+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/path-to-regexp": {+ "version": "0.1.12",+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz",+ "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==",+ "license": "MIT"+ },+ "node_modules/pino": {+ "version": "9.14.0",+ "resolved": "https://registry.npmjs.org/pino/-/pino-9.14.0.tgz",+ "integrity": "sha512-8OEwKp5juEvb/MjpIc4hjqfgCNysrS94RIOMXYvpYCdm/jglrKEiAYmiumbmGhCvs+IcInsphYDFwqrjr7398w==",+ "license": "MIT",+ "dependencies": {+ "@pinojs/redact": "^0.4.0",+ "atomic-sleep": "^1.0.0",+ "on-exit-leak-free": "^2.1.0",+ "pino-abstract-transport": "^2.0.0",+ "pino-std-serializers": "^7.0.0",+ "process-warning": "^5.0.0",+ "quick-format-unescaped": "^4.0.3",+ "real-require": "^0.2.0",+ "safe-stable-stringify": "^2.3.1",+ "sonic-boom": "^4.0.1",+ "thread-stream": "^3.0.0"+ },+ "bin": {+ "pino": "bin.js"+ }+ },+ "node_modules/pino-abstract-transport": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz",+ "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==",+ "license": "MIT",+ "dependencies": {+ "split2": "^4.0.0"+ }+ },+ "node_modules/pino-std-serializers": {+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz",+ "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==",+ "license": "MIT"+ },+ "node_modules/pngjs": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",+ "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==",+ "license": "MIT",+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/process-warning": {+ "version": "5.0.0",+ "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",+ "integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/fastify"+ },+ {+ "type": "opencollective",+ "url": "https://opencollective.com/fastify"+ }+ ],+ "license": "MIT"+ },+ "node_modules/protobufjs": {+ "version": "7.5.4",+ "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz",+ "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==",+ "hasInstallScript": true,+ "license": "BSD-3-Clause",+ "dependencies": {+ "@protobufjs/aspromise": "^1.1.2",+ "@protobufjs/base64": "^1.1.2",+ "@protobufjs/codegen": "^2.0.4",+ "@protobufjs/eventemitter": "^1.1.0",+ "@protobufjs/fetch": "^1.1.0",+ "@protobufjs/float": "^1.0.2",+ "@protobufjs/inquire": "^1.1.0",+ "@protobufjs/path": "^1.1.2",+ "@protobufjs/pool": "^1.1.0",+ "@protobufjs/utf8": "^1.1.0",+ "@types/node": ">=13.7.0",+ "long": "^5.0.0"+ },+ "engines": {+ "node": ">=12.0.0"+ }+ },+ "node_modules/proxy-addr": {+ "version": "2.0.7",+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",+ "license": "MIT",+ "dependencies": {+ "forwarded": "0.2.0",+ "ipaddr.js": "1.9.1"+ },+ "engines": {+ "node": ">= 0.10"+ }+ },+ "node_modules/qified": {+ "version": "0.9.0",+ "resolved": "https://registry.npmjs.org/qified/-/qified-0.9.0.tgz",+ "integrity": "sha512-4q61YgkHbY6gmwkqm0BsxyLDO3UYdrdiJTJ7JiaZb3xpW1duxn135SB7KqUEkCiuu5O4W+TtwEWP2VjmSRanvA==",+ "license": "MIT",+ "dependencies": {+ "hookified": "^2.1.0"+ },+ "engines": {+ "node": ">=20"+ }+ },+ "node_modules/qified/node_modules/hookified": {+ "version": "2.1.0",+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.1.0.tgz",+ "integrity": "sha512-ootKng4eaxNxa7rx6FJv2YKef3DuhqbEj3l70oGXwddPQEEnISm50TEZQclqiLTAtilT2nu7TErtCO523hHkyg==",+ "license": "MIT"+ },+ "node_modules/qrcode": {+ "version": "1.5.4",+ "resolved": "https://registry.npmjs.org/qrcode/-/qrcode-1.5.4.tgz",+ "integrity": "sha512-1ca71Zgiu6ORjHqFBDpnSMTR2ReToX4l1Au1VFLyVeBTFavzQnv5JxMFr3ukHVKpSrSA2MCk0lNJSykjUfz7Zg==",+ "license": "MIT",+ "dependencies": {+ "dijkstrajs": "^1.0.1",+ "pngjs": "^5.0.0",+ "yargs": "^15.3.1"+ },+ "bin": {+ "qrcode": "bin/qrcode"+ },+ "engines": {+ "node": ">=10.13.0"+ }+ },+ "node_modules/qrcode-terminal": {+ "version": "0.12.0",+ "resolved": "https://registry.npmjs.org/qrcode-terminal/-/qrcode-terminal-0.12.0.tgz",+ "integrity": "sha512-EXtzRZmC+YGmGlDFbXKxQiMZNwCLEO6BANKXG4iCtSIM0yqc/pappSx3RIKr4r0uh5JsBckOXeKrB3Iz7mdQpQ==",+ "bin": {+ "qrcode-terminal": "bin/qrcode-terminal.js"+ }+ },+ "node_modules/qs": {+ "version": "6.14.2",+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.2.tgz",+ "integrity": "sha512-V/yCWTTF7VJ9hIh18Ugr2zhJMP01MY7c5kh4J870L7imm6/DIzBsNLTXzMwUA3yZ5b/KBqLx8Kp3uRvd7xSe3Q==",+ "license": "BSD-3-Clause",+ "dependencies": {+ "side-channel": "^1.1.0"+ },+ "engines": {+ "node": ">=0.6"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/quick-format-unescaped": {+ "version": "4.0.4",+ "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",+ "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",+ "license": "MIT"+ },+ "node_modules/range-parser": {+ "version": "1.2.1",+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/raw-body": {+ "version": "2.5.3",+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",+ "integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",+ "license": "MIT",+ "dependencies": {+ "bytes": "~3.1.2",+ "http-errors": "~2.0.1",+ "iconv-lite": "~0.4.24",+ "unpipe": "~1.0.0"+ },+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/real-require": {+ "version": "0.2.0",+ "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",+ "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",+ "license": "MIT",+ "engines": {+ "node": ">= 12.13.0"+ }+ },+ "node_modules/require-directory": {+ "version": "2.1.1",+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",+ "license": "MIT",+ "engines": {+ "node": ">=0.10.0"+ }+ },+ "node_modules/require-main-filename": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz",+ "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==",+ "license": "ISC"+ },+ "node_modules/safe-buffer": {+ "version": "5.2.1",+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",+ "funding": [+ {+ "type": "github",+ "url": "https://github.com/sponsors/feross"+ },+ {+ "type": "patreon",+ "url": "https://www.patreon.com/feross"+ },+ {+ "type": "consulting",+ "url": "https://feross.org/support"+ }+ ],+ "license": "MIT"+ },+ "node_modules/safe-stable-stringify": {+ "version": "2.5.0",+ "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",+ "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",+ "license": "MIT",+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/safer-buffer": {+ "version": "2.1.2",+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",+ "license": "MIT"+ },+ "node_modules/semver": {+ "version": "7.7.4",+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",+ "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",+ "license": "ISC",+ "peer": true,+ "bin": {+ "semver": "bin/semver.js"+ },+ "engines": {+ "node": ">=10"+ }+ },+ "node_modules/send": {+ "version": "0.19.2",+ "resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",+ "integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",+ "license": "MIT",+ "dependencies": {+ "debug": "2.6.9",+ "depd": "2.0.0",+ "destroy": "1.2.0",+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "etag": "~1.8.1",+ "fresh": "~0.5.2",+ "http-errors": "~2.0.1",+ "mime": "1.6.0",+ "ms": "2.1.3",+ "on-finished": "~2.4.1",+ "range-parser": "~1.2.1",+ "statuses": "~2.0.2"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/send/node_modules/ms": {+ "version": "2.1.3",+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",+ "license": "MIT"+ },+ "node_modules/serve-static": {+ "version": "1.16.3",+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",+ "integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",+ "license": "MIT",+ "dependencies": {+ "encodeurl": "~2.0.0",+ "escape-html": "~1.0.3",+ "parseurl": "~1.3.3",+ "send": "~0.19.1"+ },+ "engines": {+ "node": ">= 0.8.0"+ }+ },+ "node_modules/set-blocking": {+ "version": "2.0.0",+ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz",+ "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==",+ "license": "ISC"+ },+ "node_modules/setprototypeof": {+ "version": "1.2.0",+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",+ "license": "ISC"+ },+ "node_modules/sharp": {+ "version": "0.34.5",+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.34.5.tgz",+ "integrity": "sha512-Ou9I5Ft9WNcCbXrU9cMgPBcCK8LiwLqcbywW3t4oDV37n1pzpuNLsYiAV8eODnjbtQlSDwZ2cUEeQz4E54Hltg==",+ "hasInstallScript": true,+ "license": "Apache-2.0",+ "peer": true,+ "dependencies": {+ "@img/colour": "^1.0.0",+ "detect-libc": "^2.1.2",+ "semver": "^7.7.3"+ },+ "engines": {+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"+ },+ "funding": {+ "url": "https://opencollective.com/libvips"+ },+ "optionalDependencies": {+ "@img/sharp-darwin-arm64": "0.34.5",+ "@img/sharp-darwin-x64": "0.34.5",+ "@img/sharp-libvips-darwin-arm64": "1.2.4",+ "@img/sharp-libvips-darwin-x64": "1.2.4",+ "@img/sharp-libvips-linux-arm": "1.2.4",+ "@img/sharp-libvips-linux-arm64": "1.2.4",+ "@img/sharp-libvips-linux-ppc64": "1.2.4",+ "@img/sharp-libvips-linux-riscv64": "1.2.4",+ "@img/sharp-libvips-linux-s390x": "1.2.4",+ "@img/sharp-libvips-linux-x64": "1.2.4",+ "@img/sharp-libvips-linuxmusl-arm64": "1.2.4",+ "@img/sharp-libvips-linuxmusl-x64": "1.2.4",+ "@img/sharp-linux-arm": "0.34.5",+ "@img/sharp-linux-arm64": "0.34.5",+ "@img/sharp-linux-ppc64": "0.34.5",+ "@img/sharp-linux-riscv64": "0.34.5",+ "@img/sharp-linux-s390x": "0.34.5",+ "@img/sharp-linux-x64": "0.34.5",+ "@img/sharp-linuxmusl-arm64": "0.34.5",+ "@img/sharp-linuxmusl-x64": "0.34.5",+ "@img/sharp-wasm32": "0.34.5",+ "@img/sharp-win32-arm64": "0.34.5",+ "@img/sharp-win32-ia32": "0.34.5",+ "@img/sharp-win32-x64": "0.34.5"+ }+ },+ "node_modules/side-channel": {+ "version": "1.1.0",+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3",+ "side-channel-list": "^1.0.0",+ "side-channel-map": "^1.0.1",+ "side-channel-weakmap": "^1.0.2"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-list": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",+ "license": "MIT",+ "dependencies": {+ "es-errors": "^1.3.0",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-map": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/side-channel-weakmap": {+ "version": "1.0.2",+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",+ "license": "MIT",+ "dependencies": {+ "call-bound": "^1.0.2",+ "es-errors": "^1.3.0",+ "get-intrinsic": "^1.2.5",+ "object-inspect": "^1.13.3",+ "side-channel-map": "^1.0.1"+ },+ "engines": {+ "node": ">= 0.4"+ },+ "funding": {+ "url": "https://github.com/sponsors/ljharb"+ }+ },+ "node_modules/sonic-boom": {+ "version": "4.2.1",+ "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz",+ "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==",+ "license": "MIT",+ "dependencies": {+ "atomic-sleep": "^1.0.0"+ }+ },+ "node_modules/split2": {+ "version": "4.2.0",+ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",+ "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",+ "license": "ISC",+ "engines": {+ "node": ">= 10.x"+ }+ },+ "node_modules/statuses": {+ "version": "2.0.2",+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/string-width": {+ "version": "4.2.3",+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",+ "license": "MIT",+ "dependencies": {+ "emoji-regex": "^8.0.0",+ "is-fullwidth-code-point": "^3.0.0",+ "strip-ansi": "^6.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/strip-ansi": {+ "version": "6.0.1",+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",+ "license": "MIT",+ "dependencies": {+ "ansi-regex": "^5.0.1"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/strtok3": {+ "version": "10.3.5",+ "resolved": "https://registry.npmjs.org/strtok3/-/strtok3-10.3.5.tgz",+ "integrity": "sha512-ki4hZQfh5rX0QDLLkOCj+h+CVNkqmp/CMf8v8kZpkNVK6jGQooMytqzLZYUVYIZcFZ6yDB70EfD8POcFXiF5oA==",+ "license": "MIT",+ "dependencies": {+ "@tokenizer/token": "^0.3.0"+ },+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/Borewit"+ }+ },+ "node_modules/thread-stream": {+ "version": "3.1.0",+ "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz",+ "integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==",+ "license": "MIT",+ "dependencies": {+ "real-require": "^0.2.0"+ }+ },+ "node_modules/toidentifier": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",+ "license": "MIT",+ "engines": {+ "node": ">=0.6"+ }+ },+ "node_modules/token-types": {+ "version": "6.1.2",+ "resolved": "https://registry.npmjs.org/token-types/-/token-types-6.1.2.tgz",+ "integrity": "sha512-dRXchy+C0IgK8WPC6xvCHFRIWYUbqqdEIKPaKo/AcTUNzwLTK6AH7RjdLWsEZcAN/TBdtfUw3PYEgPr5VPr6ww==",+ "license": "MIT",+ "dependencies": {+ "@borewit/text-codec": "^0.2.1",+ "@tokenizer/token": "^0.3.0",+ "ieee754": "^1.2.1"+ },+ "engines": {+ "node": ">=14.16"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/Borewit"+ }+ },+ "node_modules/tslib": {+ "version": "2.8.1",+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",+ "license": "0BSD"+ },+ "node_modules/type-is": {+ "version": "1.6.18",+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",+ "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",+ "license": "MIT",+ "dependencies": {+ "media-typer": "0.3.0",+ "mime-types": "~2.1.24"+ },+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/type-is/node_modules/media-typer": {+ "version": "0.3.0",+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",+ "integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.6"+ }+ },+ "node_modules/uint8array-extras": {+ "version": "1.5.0",+ "resolved": "https://registry.npmjs.org/uint8array-extras/-/uint8array-extras-1.5.0.tgz",+ "integrity": "sha512-rvKSBiC5zqCCiDZ9kAOszZcDvdAHwwIKJG33Ykj43OKcWsnmcBRL09YTU4nOeHZ8Y2a7l1MgTd08SBe9A8Qj6A==",+ "license": "MIT",+ "engines": {+ "node": ">=18"+ },+ "funding": {+ "url": "https://github.com/sponsors/sindresorhus"+ }+ },+ "node_modules/undici-types": {+ "version": "7.18.2",+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",+ "integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",+ "license": "MIT"+ },+ "node_modules/unpipe": {+ "version": "1.0.0",+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/utils-merge": {+ "version": "1.0.1",+ "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",+ "integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.4.0"+ }+ },+ "node_modules/vary": {+ "version": "1.1.2",+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",+ "license": "MIT",+ "engines": {+ "node": ">= 0.8"+ }+ },+ "node_modules/which-module": {+ "version": "2.0.1",+ "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.1.tgz",+ "integrity": "sha512-iBdZ57RDvnOR9AGBhML2vFZf7h8vmBjhoaZqODJBFWHVtKkDmKuHai3cx5PgVMrX5YDNp27AofYbAwctSS+vhQ==",+ "license": "ISC"+ },+ "node_modules/win-guid": {+ "version": "0.2.1",+ "resolved": "https://registry.npmjs.org/win-guid/-/win-guid-0.2.1.tgz",+ "integrity": "sha512-gEIQU4mkgl2OPeoNrWflcJFJ3Ae2BPd4eCsHHA/XikslkIVms/nHhvnvzIZV7VLmBvtFlDOzLt9rrZT+n6D67A==",+ "license": "MIT"+ },+ "node_modules/wrap-ansi": {+ "version": "6.2.0",+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",+ "license": "MIT",+ "dependencies": {+ "ansi-styles": "^4.0.0",+ "string-width": "^4.1.0",+ "strip-ansi": "^6.0.0"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/ws": {+ "version": "8.20.0",+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.20.0.tgz",+ "integrity": "sha512-sAt8BhgNbzCtgGbt2OxmpuryO63ZoDk/sqaB/znQm94T4fCEsy/yV+7CdC1kJhOU9lboAEU7R3kquuycDoibVA==",+ "license": "MIT",+ "engines": {+ "node": ">=10.0.0"+ },+ "peerDependencies": {+ "bufferutil": "^4.0.1",+ "utf-8-validate": ">=5.0.2"+ },+ "peerDependenciesMeta": {+ "bufferutil": {+ "optional": true+ },+ "utf-8-validate": {+ "optional": true+ }+ }+ },+ "node_modules/y18n": {+ "version": "4.0.3",+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz",+ "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==",+ "license": "ISC"+ },+ "node_modules/yargs": {+ "version": "15.4.1",+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",+ "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",+ "license": "MIT",+ "dependencies": {+ "cliui": "^6.0.0",+ "decamelize": "^1.2.0",+ "find-up": "^4.1.0",+ "get-caller-file": "^2.0.1",+ "require-directory": "^2.1.1",+ "require-main-filename": "^2.0.0",+ "set-blocking": "^2.0.0",+ "string-width": "^4.2.0",+ "which-module": "^2.0.0",+ "y18n": "^4.0.0",+ "yargs-parser": "^18.1.2"+ },+ "engines": {+ "node": ">=8"+ }+ },+ "node_modules/yargs-parser": {+ "version": "18.1.3",+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",+ "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",+ "license": "ISC",+ "dependencies": {+ "camelcase": "^5.0.0",+ "decamelize": "^1.2.0"+ },+ "engines": {+ "node": ">=6"+ }+ }+ }+}diff --git a/plugins/_whatsapp_integration/whatsapp-bridge/package.json b/plugins/_whatsapp_integration/whatsapp-bridge/package.jsonnew file mode 100644index 000000000..c1953b1fe--- /dev/null+++ b/plugins/_whatsapp_integration/whatsapp-bridge/package.json@@ -0,0 +1,17 @@+{+ "name": "a0-whatsapp-bridge",+ "version": "1.0.0",+ "description": "WhatsApp bridge for Agent Zero using Baileys",+ "private": true,+ "type": "module",+ "scripts": {+ "start": "node bridge.js"+ },+ "dependencies": {+ "@whiskeysockets/baileys": "7.0.0-rc.9",+ "express": "^4.21.0",+ "qrcode-terminal": "^0.12.0",+ "qrcode": "^1.5.0",+ "pino": "^9.0.0"+ }+}diff --git a/tests/test_whatsapp_bridge_manager.py b/tests/test_whatsapp_bridge_manager.pynew file mode 100644index 000000000..8364a69d5--- /dev/null+++ b/tests/test_whatsapp_bridge_manager.py@@ -0,0 +1,181 @@+import asyncio+import sys+from pathlib import Path++import pytest++PROJECT_ROOT = Path(__file__).resolve().parents[1]+if str(PROJECT_ROOT) not in sys.path:+ sys.path.insert(0, str(PROJECT_ROOT))++from plugins._whatsapp_integration.helpers import bridge_manager++[email protected](autouse=True)+def reset_bridge_manager_state():+ bridge_manager._bridge_lock = None+ bridge_manager._bridge_lock_loop = None+ bridge_manager._bridge_process = None+ bridge_manager._bridge_config.clear()+ yield+ bridge_manager._bridge_lock = None+ bridge_manager._bridge_lock_loop = None+ bridge_manager._bridge_process = None+ bridge_manager._bridge_config.clear()+++def test_get_bridge_lock_recreates_lock_when_loop_marker_changes():+ async def _run():+ original_lock = asyncio.Lock()+ bridge_manager._bridge_lock = original_lock+ bridge_manager._bridge_lock_loop = object()++ refreshed_lock = bridge_manager._get_bridge_lock()++ assert refreshed_lock is bridge_manager._bridge_lock+ assert refreshed_lock is not original_lock++ asyncio.run(_run())+++def test_ensure_bridge_dependencies_reinstalls_invalid_dependency_tree(monkeypatch):+ state_writes: list[dict] = []+ validate_results = [False, True]+ reinstall_calls: list[bool] = []++ monkeypatch.setattr(bridge_manager, "NODE_MODULES_DIR", "/tmp/whatsapp-node-modules")+ monkeypatch.setattr(bridge_manager.os.path, "isdir", lambda path: path == "/tmp/whatsapp-node-modules")++ async def fake_build_dependency_state():+ return {"package_json_hash": "a", "package_lock_hash": "b"}++ async def fake_validate_bridge_dependencies():+ return validate_results.pop(0)++ async def fake_reinstall_bridge_dependencies():+ reinstall_calls.append(True)++ monkeypatch.setattr(bridge_manager, "_build_dependency_state", fake_build_dependency_state)+ monkeypatch.setattr(bridge_manager, "_load_dependency_state", lambda: {"package_json_hash": "a", "package_lock_hash": "b"})+ monkeypatch.setattr(bridge_manager, "_validate_bridge_dependencies", fake_validate_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_reinstall_bridge_dependencies", fake_reinstall_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_write_dependency_state", lambda state: state_writes.append(state))++ asyncio.run(bridge_manager._ensure_bridge_dependencies())++ assert reinstall_calls == [True]+ assert state_writes == [{"package_json_hash": "a", "package_lock_hash": "b"}]+++def test_ensure_bridge_dependencies_bootstraps_missing_state_without_reinstall(monkeypatch):+ state_writes: list[dict] = []+ reinstall_calls: list[bool] = []++ monkeypatch.setattr(bridge_manager, "NODE_MODULES_DIR", "/tmp/whatsapp-node-modules")+ monkeypatch.setattr(bridge_manager.os.path, "isdir", lambda path: path == "/tmp/whatsapp-node-modules")++ async def fake_build_dependency_state():+ return {"package_json_hash": "a", "package_lock_hash": "b"}++ async def fake_validate_bridge_dependencies():+ return True++ async def fake_reinstall_bridge_dependencies():+ reinstall_calls.append(True)++ monkeypatch.setattr(bridge_manager, "_build_dependency_state", fake_build_dependency_state)+ monkeypatch.setattr(bridge_manager, "_load_dependency_state", lambda: None)+ monkeypatch.setattr(bridge_manager, "_validate_bridge_dependencies", fake_validate_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_reinstall_bridge_dependencies", fake_reinstall_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_write_dependency_state", lambda state: state_writes.append(state))++ asyncio.run(bridge_manager._ensure_bridge_dependencies())++ assert reinstall_calls == []+ assert state_writes == [{"package_json_hash": "a", "package_lock_hash": "b"}]+++def test_reinstall_bridge_dependencies_uses_local_npm_cache(monkeypatch):+ run_calls: list[tuple[list[str], dict[str, str] | None]] = []+ real_isdir = bridge_manager.os.path.isdir++ monkeypatch.setattr(bridge_manager.PrintStyle, "warning", staticmethod(lambda message: None))+ monkeypatch.setattr(bridge_manager.PrintStyle, "info", staticmethod(lambda message: None))+ monkeypatch.setattr(bridge_manager, "NODE_MODULES_DIR", "/tmp/whatsapp-node-modules")+ monkeypatch.setattr(bridge_manager, "BRIDGE_PACKAGE_LOCK", "/tmp/package-lock.json")+ monkeypatch.setattr(bridge_manager, "BRIDGE_INSTALL_STATE", "/tmp/deps-state.json")+ monkeypatch.setattr(bridge_manager, "BRIDGE_NPM_CACHE", "/tmp/npm-cache")+ monkeypatch.setattr(+ bridge_manager.os.path,+ "isdir",+ lambda path: path == "/tmp/whatsapp-node-modules" or real_isdir(path),+ )+ monkeypatch.setattr(+ bridge_manager.os.path,+ "isfile",+ lambda path: path == "/tmp/package-lock.json",+ )+ monkeypatch.setattr(bridge_manager.shutil, "rmtree", lambda path, ignore_errors=True: None)++ async def fake_run_subprocess(command, *, cwd, env=None):+ run_calls.append((list(command), env))+ return ""++ monkeypatch.setattr(bridge_manager, "_run_subprocess", fake_run_subprocess)++ asyncio.run(bridge_manager._reinstall_bridge_dependencies())++ assert run_calls == [+ (+ ["npm", "ci", "--omit=dev", "--no-audit", "--no-fund"],+ {"npm_config_cache": "/tmp/npm-cache"},+ ),+ ]+++def test_start_bridge_reinstalls_and_retries_after_dependency_failure(monkeypatch):+ ensure_calls: list[bool] = []+ start_attempts = [+ (False, "Error: Cannot find package '@whiskeysockets/baileys'"),+ (True, ""),+ ]++ async def fake_ensure_bridge_dependencies(force_reinstall: bool = False):+ ensure_calls.append(force_reinstall)++ async def fake_start_bridge_once(**kwargs):+ return start_attempts.pop(0)++ monkeypatch.setattr(bridge_manager, "_ensure_bridge_dependencies", fake_ensure_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_start_bridge_once", fake_start_bridge_once)++ started = asyncio.run(bridge_manager.start_bridge(+ port=3100,+ session_dir="/tmp/wa-session",+ cache_dir="/tmp/wa-cache",+ ))++ assert started is True+ assert ensure_calls == [False, True]+++def test_start_bridge_does_not_reinstall_on_non_dependency_failure(monkeypatch):+ ensure_calls: list[bool] = []++ async def fake_ensure_bridge_dependencies(force_reinstall: bool = False):+ ensure_calls.append(force_reinstall)++ async def fake_start_bridge_once(**kwargs):+ return False, "Bridge closed unexpectedly without module resolution errors"++ monkeypatch.setattr(bridge_manager, "_ensure_bridge_dependencies", fake_ensure_bridge_dependencies)+ monkeypatch.setattr(bridge_manager, "_start_bridge_once", fake_start_bridge_once)++ started = asyncio.run(bridge_manager.start_bridge(+ port=3100,+ session_dir="/tmp/wa-session",+ cache_dir="/tmp/wa-cache",+ ))++ assert started is False+ assert ensure_calls == [False]diff --git a/tests/test_whatsapp_number_utils.py b/tests/test_whatsapp_number_utils.pynew file mode 100644index 000000000..766012981--- /dev/null+++ b/tests/test_whatsapp_number_utils.py@@ -0,0 +1,36 @@+import sys+from pathlib import Path+++PROJECT_ROOT = Path(__file__).resolve().parents[1]+if str(PROJECT_ROOT) not in sys.path:+ sys.path.insert(0, str(PROJECT_ROOT))++from plugins._whatsapp_integration.helpers.number_utils import (+ normalize_allowed_numbers,+ normalize_number,+)+++def test_normalize_number_handles_jids_and_phone_formatting():+ assert normalize_number("+1 (415) 555-1234") == "14155551234"+ assert normalize_number("00420 777 123 456") == "420777123456"+ assert normalize_number("[email protected]") == "14155551234"+ assert normalize_number("14155551234:[email protected]") == "14155551234"+++def test_normalize_allowed_numbers_accepts_lists_and_csv_strings():+ assert normalize_allowed_numbers([+ "+1 (415) 555-1234",+ "00420 777 123 456",+ "",+ ]) == {"14155551234", "420777123456"}++ assert normalize_allowed_numbers(+ "+1 (415) 555-1234, 00420 777 123 456"+ ) == {"14155551234", "420777123456"}+++def test_normalize_allowed_numbers_ignores_unsupported_values():+ assert normalize_allowed_numbers(None) == set()+ assert normalize_allowed_numbers(12345) == set()diff --git a/tests/test_whatsapp_storage_paths.py b/tests/test_whatsapp_storage_paths.pynew file mode 100644index 000000000..c21bc0e27--- /dev/null+++ b/tests/test_whatsapp_storage_paths.py@@ -0,0 +1,18 @@+import sys+from pathlib import Path+++PROJECT_ROOT = Path(__file__).resolve().parents[1]+if str(PROJECT_ROOT) not in sys.path:+ sys.path.insert(0, str(PROJECT_ROOT))++from helpers import files+from plugins._whatsapp_integration.helpers.storage_paths import (+ get_bridge_media_dir,+ get_bridge_session_dir,+)+++def test_whatsapp_bridge_storage_paths_use_agent_zero_tmp():+ assert get_bridge_session_dir() == files.get_abs_path(files.TEMP_DIR, "whatsapp", "session")+ assert get_bridge_media_dir() == files.get_abs_path(files.TEMP_DIR, "whatsapp", "media")