Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(plugin): Wave 11.C batch 1 — migrate 9 nodes to plugin classes
trohitgf30db1d6d60d
diff --git a/server/nodes/agent/_handles.py b/server/nodes/agent/_handles.pynew file mode 100644index 00000000..614760cb--- /dev/null+++ b/server/nodes/agent/_handles.py@@ -0,0 +1,26 @@+"""Shared handle topology for agent plugins.++Local to ``nodes/agent/`` — not a global lookup. Each agent class+imports and uses what it needs.+"""++from __future__ import annotations+++STD_SIZE = {"width": 300, "height": 200}+STD_AGENT_HINTS = {**STD_SIZE, "hasSkills": True}+++def std_agent_handles() -> tuple:+ """Skill + Tool + Memory + Task + Input + Output — shared by 18+ of the 20 agent variants. Returned as a tuple so the BaseNode+ `handles` class attribute is immutable."""+ return (+ {"name": "input-skill", "kind": "input", "position": "bottom", "offset": "25%", "label": "Skill", "role": "skill"},+ {"name": "input-tools", "kind": "input", "position": "bottom", "offset": "75%", "label": "Tool", "role": "tools"},+ {"name": "input-main", "kind": "input", "position": "left", "offset": "25%", "label": "Input", "role": "main"},+ {"name": "input-memory", "kind": "input", "position": "left", "offset": "50%", "label": "Memory", "role": "memory"},+ {"name": "input-task", "kind": "input", "position": "left", "offset": "75%", "label": "Task", "role": "task"},+ {"name": "output-main", "kind": "output", "position": "right", "offset": "50%", "label": "Output", "role": "main"},+ {"name": "output-top", "kind": "output", "position": "top", "label": "Output", "role": "main"},+ )diff --git a/server/nodes/agent/ai_agent.py b/server/nodes/agent/ai_agent.pynew file mode 100644index 00000000..6f740af7--- /dev/null+++ b/server/nodes/agent/ai_agent.py@@ -0,0 +1,99 @@+"""AI Agent — Wave 11.C migration (LangGraph agent).++Tool-calling LangGraph agent with memory, skills, and iterative+reasoning. Delegates execution to ``handlers/ai.handle_ai_agent`` —+that body owns the LangGraph graph construction + tool binding ++streaming + memory persistence + delegation.+"""++from __future__ import annotations++from typing import Any, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import ActionNode, NodeContext, Operation, TaskQueue++from ._handles import STD_AGENT_HINTS, std_agent_handles+++class AIAgentParams(BaseModel):+ prompt: str = Field(+ default="",+ json_schema_extra={+ "placeholder": "Enter your prompt or use template variables...",+ "rows": 4,+ },+ )+ provider: Literal[+ "openai", "anthropic", "gemini", "openrouter",+ "groq", "cerebras", "deepseek", "kimi", "mistral",+ ] = "openai"+ model: str = Field(+ default="", json_schema_extra={"placeholder": "Select a model..."},+ )+ temperature: float = Field(+ default=0.7, ge=0.0, le=2.0,+ json_schema_extra={"numberStepSize": 0.1},+ )+ max_tokens: Optional[int] = Field(default=1000, alias="maxTokens", ge=1, le=200000)+ system_message: Optional[str] = Field(+ default="You are a helpful assistant",+ alias="systemMessage",+ json_schema_extra={"rows": 3},+ )+ api_key: Optional[str] = Field(+ default=None, alias="apiKey",+ json_schema_extra={"password": True},+ )++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class AIAgentOutput(BaseModel):+ response: Optional[str] = None+ thinking: Optional[str] = None+ model: Optional[str] = None+ provider: Optional[str] = None+ finish_reason: Optional[str] = None+ timestamp: Optional[str] = None++ model_config = ConfigDict(extra="allow")+++class AIAgentNode(ActionNode):+ type = "aiAgent"+ display_name = "AI Agent"+ subtitle = "LangGraph Agent"+ icon = "🤖"+ color = "#bd93f9"+ group = ("agent",)+ description = "LangGraph agent with tool calling, memory, and iterative reasoning"+ component_kind = "agent"+ handles = std_agent_handles()+ ui_hints = STD_AGENT_HINTS+ annotations = {"destructive": False, "readonly": False, "open_world": True}+ task_queue = TaskQueue.AI_HEAVY++ Params = AIAgentParams+ Output = AIAgentOutput++ @Operation("execute", cost={"service": "ai_agent", "action": "run", "count": 1})+ async def execute_op(self, ctx: NodeContext, params: AIAgentParams) -> Any:+ from core.container import container+ from services.handlers.ai import handle_ai_agent++ ai_service = container.ai_service()+ database = container.database()+ payload = params.model_dump(by_alias=True)+ response = await handle_ai_agent(+ ai_service=ai_service,+ database=database,+ node_id=ctx.node_id,+ node_type=self.type,+ parameters=payload,+ context=ctx.raw,+ )+ if response.get("success"):+ return response.get("result") or response+ raise RuntimeError(response.get("error") or "AI Agent execution failed")diff --git a/server/nodes/agent/chat_agent.py b/server/nodes/agent/chat_agent.pynew file mode 100644index 00000000..011657b5--- /dev/null+++ b/server/nodes/agent/chat_agent.py@@ -0,0 +1,93 @@+"""Chat Agent (Zeenie) — Wave 11.C migration.++Conversational LangGraph agent with skills + memory. Distinct from+:class:`AIAgentNode` because it uses ``handle_chat_agent`` which+applies a different default system message + skill prompt assembly.+"""++from __future__ import annotations++from typing import Any, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import ActionNode, NodeContext, Operation, TaskQueue++from ._handles import STD_AGENT_HINTS, std_agent_handles+++class ChatAgentParams(BaseModel):+ provider: Literal[+ "openai", "anthropic", "gemini", "openrouter",+ "groq", "cerebras", "deepseek", "kimi", "mistral",+ ] = "openai"+ model: str = Field(+ default="", json_schema_extra={"placeholder": "Select a model..."},+ )+ prompt: str = Field(+ default="",+ json_schema_extra={+ "placeholder": "Optional: leave empty to use connected input",+ "rows": 4,+ },+ )+ system_message: Optional[str] = Field(+ default="", alias="systemMessage", json_schema_extra={"rows": 3},+ )+ temperature: float = Field(default=0.7, ge=0.0, le=2.0)+ max_tokens: Optional[int] = Field(default=1000, alias="maxTokens", ge=1, le=200000)+ api_key: Optional[str] = Field(+ default=None, alias="apiKey",+ json_schema_extra={"password": True},+ )++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class ChatAgentOutput(BaseModel):+ response: Optional[str] = None+ thinking: Optional[str] = None+ model: Optional[str] = None+ provider: Optional[str] = None+ finish_reason: Optional[str] = None+ timestamp: Optional[str] = None++ model_config = ConfigDict(extra="allow")+++class ChatAgentNode(ActionNode):+ type = "chatAgent"+ display_name = "Zeenie"+ subtitle = "Personal Assistant"+ icon = "🧞"+ color = "#8be9fd"+ group = ("agent",)+ description = "Conversational AI agent with skills and memory"+ component_kind = "agent"+ handles = std_agent_handles()+ ui_hints = STD_AGENT_HINTS+ annotations = {"destructive": False, "readonly": False, "open_world": True}+ task_queue = TaskQueue.AI_HEAVY++ Params = ChatAgentParams+ Output = ChatAgentOutput++ @Operation("execute", cost={"service": "chat_agent", "action": "run", "count": 1})+ async def execute_op(self, ctx: NodeContext, params: ChatAgentParams) -> Any:+ from core.container import container+ from services.handlers.ai import handle_chat_agent++ ai_service = container.ai_service()+ database = container.database()+ payload = params.model_dump(by_alias=True)+ response = await handle_chat_agent(+ ai_service=ai_service,+ database=database,+ node_id=ctx.node_id,+ node_type=self.type,+ parameters=payload,+ context=ctx.raw,+ )+ if response.get("success"):+ return response.get("result") or response+ raise RuntimeError(response.get("error") or "Chat Agent execution failed")diff --git a/server/nodes/agents.py b/server/nodes/agents.pyindex aa42ef14..fecdc5c9 100644--- a/server/nodes/agents.py+++ b/server/nodes/agents.py@@ -66,37 +66,7 @@ _DEEP_BOTTOM_HANDLES = [# -- Core agents ---------------------------------------------------------------register_node(- type="aiAgent",- metadata={- "displayName": "AI Agent",- "subtitle": "LangGraph Agent",- "icon": "🤖",- "color": "#bd93f9",- "group": ["agent"],- "componentKind": "agent",- "handles": _std_handles(),- "description": "LangGraph agent with tool calling, memory, and iterative reasoning",- "version": 1,- "uiHints": _STD_AGENT_HINTS,- },-)--register_node(- type="chatAgent",- metadata={- "displayName": "Zeenie",- "subtitle": "Personal Assistant",- "icon": "🧞",- "color": "#8be9fd",- "group": ["agent"],- "componentKind": "agent",- "handles": _std_handles(),- "description": "Conversational AI agent with skills and memory",- "version": 1,- "uiHints": _STD_AGENT_HINTS,- },-)+# aiAgent + chatAgent — migrated to nodes/agent/{ai_agent,chat_agent}.py (Wave 11.C).# -- Specialized agents (share the LangGraph Skill/Tool/Memory/Task topology) -diff --git a/server/nodes/model/gemini_chat_model.py b/server/nodes/model/gemini_chat_model.pynew file mode 100644index 00000000..0b707c5b--- /dev/null+++ b/server/nodes/model/gemini_chat_model.py@@ -0,0 +1,110 @@+"""Gemini Chat Model — Wave 11.C migration.++Per-provider chat-model plugin. Replaces the cross-provider+``AIChatModelParams`` discriminated union for *this provider only* —+gemini-specific knobs (top_k, safety_settings, thinking_budget) live+in this Params model. Other providers get their own plugins as 11.C+continues.++Delegates execution to the existing ``AIService.execute_chat`` via+``handlers.ai.handle_ai_chat_model`` — that body owns the native+SDK + LangChain dual-path for thinking/streaming/usage-tracking.+"""++from __future__ import annotations++from typing import Any, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import ActionNode, NodeContext, Operation, TaskQueue+++class GeminiChatModelParams(BaseModel):+ prompt: str = Field(+ default="",+ json_schema_extra={"rows": 4, "placeholder": "{{ $json.message }}"},+ )+ model: str = Field(+ default="",+ json_schema_extra={"placeholder": "Select a model..."},+ )+ temperature: float = Field(+ default=0.7, ge=0.0, le=2.0,+ json_schema_extra={"numberStepSize": 0.1},+ )+ max_tokens: Optional[int] = Field(default=1000, alias="maxTokens", ge=1, le=128000)+ system_prompt: Optional[str] = Field(+ default="", alias="systemMessage",+ json_schema_extra={"rows": 3, "placeholder": "You are a helpful assistant."},+ )+ api_key: Optional[str] = Field(+ default=None, alias="apiKey",+ json_schema_extra={"password": True},+ )+ top_p: Optional[float] = Field(+ default=1.0, alias="topP", ge=0.0, le=1.0,+ json_schema_extra={"numberStepSize": 0.1},+ )+ top_k: Optional[int] = Field(default=40, alias="topK", ge=1, le=100)+ safety_settings: Literal["default", "strict", "permissive"] = Field(+ default="default", alias="safetySettings",+ )+ thinking_enabled: bool = Field(default=False, alias="thinkingEnabled")+ thinking_budget: Optional[int] = Field(+ default=2048, alias="thinkingBudget", ge=1024, le=16000,+ json_schema_extra={"displayOptions": {"show": {"thinking_enabled": [True]}}},+ )++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class GeminiChatModelOutput(BaseModel):+ response: Optional[str] = None+ thinking: Optional[str] = None+ model: Optional[str] = None+ provider: Optional[str] = None+ finish_reason: Optional[str] = None+ timestamp: Optional[str] = None++ model_config = ConfigDict(extra="allow")+++class GeminiChatModelNode(ActionNode):+ type = "geminiChatModel"+ display_name = "Gemini"+ subtitle = "Chat Model"+ icon = "lobehub:gemini"+ color = "#4285F4"+ group = ("model",)+ description = "Google Gemini models for multimodal AI capabilities"+ component_kind = "model"+ handles = (+ {"name": "output-model", "kind": "output", "position": "right",+ "label": "Model", "role": "model"},+ )+ annotations = {"destructive": False, "readonly": False, "open_world": True}+ task_queue = TaskQueue.AI_HEAVY++ Params = GeminiChatModelParams+ Output = GeminiChatModelOutput++ @Operation("chat", cost={"service": "gemini", "action": "chat", "count": 1})+ async def chat(self, ctx: NodeContext, params: GeminiChatModelParams) -> Any:+ # Delegate to the legacy chat-model handler; AIService is a+ # singleton retrievable from the DI container.+ from core.container import container+ from services.handlers.ai import handle_ai_chat_model++ ai_service = container.ai_service()+ payload = params.model_dump(by_alias=True)+ response = await handle_ai_chat_model(+ ai_service=ai_service,+ node_id=ctx.node_id,+ node_type=self.type,+ parameters=payload,+ context=ctx.raw,+ )+ if response.get("success"):+ return response.get("result") or response+ raise RuntimeError(response.get("error") or "Gemini chat failed")diff --git a/server/nodes/search/duckduckgo_search.py b/server/nodes/search/duckduckgo_search.pynew file mode 100644index 00000000..7e40929d--- /dev/null+++ b/server/nodes/search/duckduckgo_search.py@@ -0,0 +1,78 @@+"""DuckDuckGo Search — Wave 11.C migration.++Free web search, no API key, no credentials. Uses the ``ddgs`` Python+library — a synchronous client wrapped via ``run_in_executor``.++This is a pure ToolNode (the only entry point is AI agents calling it+via input-tools). No usable_as_tool flag needed — being a ToolNode is+enough.+"""++from __future__ import annotations++import asyncio+from typing import List++from pydantic import BaseModel, Field++from services.plugin import NodeContext, Operation, TaskQueue, ToolNode+++class DuckDuckGoResult(BaseModel):+ title: str = ""+ snippet: str = ""+ url: str = ""+++class DuckDuckGoSearchOutput(BaseModel):+ query: str+ results: List[DuckDuckGoResult] = Field(default_factory=list)+ provider: str = "duckduckgo"+++class DuckDuckGoSearchParams(BaseModel):+ query: str = Field(..., description="Search query", min_length=1)+ max_results: int = Field(default=5, ge=1, le=20)+++class DuckDuckGoSearchNode(ToolNode):+ type = "duckduckgoSearch"+ display_name = "DuckDuckGo Search"+ subtitle = "Free Web Search"+ icon = "asset:duckduckgo"+ color = "#f1fa8c"+ group = ("tool", "ai", "search")+ description = "DuckDuckGo web search (free, no API key required)"+ component_kind = "tool"+ handles = (+ {"name": "input-main", "kind": "input", "position": "left",+ "label": "Input", "role": "main"},+ {"name": "output-tool", "kind": "output", "position": "top",+ "label": "Tool", "role": "tools"},+ )+ ui_hints = {"isToolPanel": True, "hideRunButton": True}+ annotations = {"destructive": False, "readonly": True, "open_world": True}+ task_queue = TaskQueue.REST_API++ Params = DuckDuckGoSearchParams+ Output = DuckDuckGoSearchOutput++ @Operation("search")+ async def search(+ self, ctx: NodeContext, params: DuckDuckGoSearchParams,+ ) -> DuckDuckGoSearchOutput:+ from ddgs import DDGS++ def _search_sync():+ return list(DDGS().text(params.query, max_results=params.max_results))++ raw = await asyncio.get_event_loop().run_in_executor(None, _search_sync)+ results = [+ DuckDuckGoResult(+ title=item.get("title", ""),+ snippet=item.get("body", ""),+ url=item.get("href", ""),+ )+ for item in raw+ ]+ return DuckDuckGoSearchOutput(query=params.query, results=results)diff --git a/server/nodes/search/perplexity_search.py b/server/nodes/search/perplexity_search.pynew file mode 100644index 00000000..2a5d0ee8--- /dev/null+++ b/server/nodes/search/perplexity_search.py@@ -0,0 +1,121 @@+"""Perplexity Sonar Search — Wave 11.C migration.++AI-powered search returning markdown answer + citations. The+Connection facade injects ``Authorization: Bearer <api_key>`` via+``ApiKeyCredential.key_location="bearer"``. Single-op declarative-ish:+imperative body is short enough that a routing DSL roundtrip would+add more lines than it saves.+"""++from __future__ import annotations++from typing import List, Literal, Optional++from pydantic import BaseModel, Field++from services.plugin import (+ ActionNode,+ ApiKeyCredential,+ NodeContext,+ Operation,+ TaskQueue,+)+++class PerplexityCredential(ApiKeyCredential):+ id = "perplexity"+ display_name = "Perplexity"+ category = "Search"+ icon = "asset:perplexity"+ key_name = "Authorization"+ key_location = "bearer"+ docs_url = "https://docs.perplexity.ai/guides/getting-started"+++class PerplexityResult(BaseModel):+ url: str = ""+++class PerplexitySearchOutput(BaseModel):+ query: str+ answer: str = ""+ citations: List[str] = Field(default_factory=list)+ results: List[PerplexityResult] = Field(default_factory=list)+ images: Optional[List[dict]] = None+ related_questions: Optional[List[str]] = None+ model: str = "sonar"+ provider: Literal["perplexity"] = "perplexity"+++class PerplexitySearchParams(BaseModel):+ query: str = Field(..., min_length=1)+ model: Literal["sonar", "sonar-pro", "sonar-reasoning", "sonar-reasoning-pro"] = "sonar"+ search_recency_filter: Literal["all", "month", "week", "day", "hour"] = Field(+ default="all", alias="searchRecencyFilter",+ )+ return_images: bool = Field(default=False, alias="returnImages")+ return_related_questions: bool = Field(default=False, alias="returnRelatedQuestions")++ model_config = {"populate_by_name": True, "extra": "ignore"}+++class PerplexitySearchNode(ActionNode):+ type = "perplexitySearch"+ display_name = "Perplexity Search"+ subtitle = "AI Search"+ icon = "asset:perplexity"+ color = "#ff79c6"+ group = ("search", "tool")+ description = "AI-powered search using Perplexity Sonar with citations"+ component_kind = "square"+ handles = (+ {"name": "input-main", "kind": "input", "position": "left",+ "label": "Input", "role": "main"},+ {"name": "output-main", "kind": "output", "position": "right",+ "label": "Output", "role": "main"},+ )+ credentials = (PerplexityCredential,)+ annotations = {"destructive": False, "readonly": True, "open_world": True}+ task_queue = TaskQueue.REST_API+ usable_as_tool = True++ Params = PerplexitySearchParams+ Output = PerplexitySearchOutput++ @Operation("search", cost={"service": "perplexity", "action": "sonar_search", "count": 1})+ async def search(self, ctx: NodeContext, params: PerplexitySearchParams) -> PerplexitySearchOutput:+ body = {+ "model": params.model,+ "messages": [{"role": "user", "content": params.query}],+ }+ if params.search_recency_filter and params.search_recency_filter != "all":+ body["search_recency_filter"] = params.search_recency_filter+ if params.return_images:+ body["return_images"] = True+ if params.return_related_questions:+ body["return_related_questions"] = True++ async with ctx.connection("perplexity") as conn:+ response = await conn.post(+ "https://api.perplexity.ai/chat/completions",+ json=body,+ headers={"Content-Type": "application/json"},+ )+ response.raise_for_status()+ data = response.json()++ choices = data.get("choices") or []+ answer = ""+ if choices:+ answer = (choices[0].get("message") or {}).get("content", "")+ citations = data.get("citations") or []+ results = [PerplexityResult(url=u) for u in citations]+ return PerplexitySearchOutput(+ query=params.query,+ answer=answer,+ citations=citations,+ results=results,+ images=data.get("images"),+ related_questions=data.get("related_questions"),+ model=params.model,+ )diff --git a/server/nodes/services.py b/server/nodes/services.pyindex dd0f9963..2079a05d 100644--- a/server/nodes/services.py+++ b/server/nodes/services.py@@ -63,7 +63,7 @@ register_node(type="mediaControl", metadata={"displayName": "Media Conregister_node(type="openaiChatModel", metadata={"displayName": "OpenAI", "subtitle": "Chat Model", "icon": "lobehub:openai", "color": "#00A67E", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "OpenAI GPT models for chat completion and generation", "version": 1})register_node(type="anthropicChatModel", metadata={"displayName": "Claude", "subtitle": "Chat Model", "icon": "lobehub:claude", "color": "#FF6B35", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "Anthropic Claude models for conversation and analysis", "version": 1})-register_node(type="geminiChatModel", metadata={"displayName": "Gemini", "subtitle": "Chat Model", "icon": "lobehub:gemini", "color": "#4285F4", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "Google Gemini models for multimodal AI capabilities", "version": 1})+# geminiChatModel — migrated to nodes/model/gemini_chat_model.py (Wave 11.C).register_node(type="openrouterChatModel", metadata={"displayName": "OpenRouter", "subtitle": "Chat Model", "icon": "lobehub:openrouter", "color": "#6366F1", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "OpenRouter unified API - access OpenAI, Claude, Gemini, Llama, and more", "version": 1})register_node(type="groqChatModel", metadata={"displayName": "Groq", "subtitle": "Chat Model", "icon": "lobehub:groq", "color": "#F55036", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "Groq ultra-fast LLM inference (Llama, Qwen3, GPT-OSS)", "version": 1})register_node(type="cerebrasChatModel", metadata={"displayName": "Cerebras", "subtitle": "Chat Model", "icon": "lobehub:cerebras", "color": "#ffb86c", "group": ["model"], "componentKind": "model", "handles": _MODEL_OUT, "description": "Cerebras ultra-fast inference on custom AI hardware", "version": 1})@@ -105,7 +105,7 @@ register_node(register_node(type="whatsappSend", metadata={"displayName": "WhatsApp Send", "subtitle": "Send Message", "icon": "asset:whatsapp-send", "color": "#25D366", "group": ["whatsapp", "tool"], "componentKind": "square", "handles": _IO, "description": "Send WhatsApp messages (text, media, location, contact, sticker)", "version": 1})register_node(type="whatsappDb", metadata={"displayName": "WhatsApp DB", "subtitle": "Query DB", "icon": "asset:whatsapp-db", "color": "#25D366", "group": ["whatsapp", "tool"], "componentKind": "square", "handles": _IO, "description": "Query WhatsApp database (chat history, contacts, groups, channels)", "version": 1})-register_node(type="telegramSend", metadata={"displayName": "Telegram Send", "subtitle": "Send Message", "icon": "asset:telegram", "color": "#0088CC", "group": ["social", "tool"], "componentKind": "square", "handles": _IO, "description": "Send text, photo, document, location, or contact via Telegram bot", "version": 1})+# telegramSend — migrated to nodes/telegram/telegram_send.py (Wave 11.C).register_node(type="twitterSend", metadata={"displayName": "Twitter Send", "subtitle": "Tweet / Reply", "icon": "asset:x", "color": "#1DA1F2", "group": ["social", "tool"], "componentKind": "square", "handles": _IO, "description": "Post tweets, reply, retweet, like, or delete tweets on Twitter/X", "version": 1})register_node(type="twitterSearch", metadata={"displayName": "Twitter Search", "subtitle": "Search Tweets", "icon": "asset:x", "color": "#1DA1F2", "group": ["social", "tool"], "componentKind": "square", "handles": _IO, "description": "Search recent tweets on Twitter/X using the Search API", "version": 1})@@ -136,7 +136,7 @@ register_node(type="contacts", metadata={"displayName": "Contacts", "subtitle"# braveSearch — migrated to nodes/brave_search.py (Wave 11.B class-based plugin).register_node(type="serperSearch", metadata={"displayName": "Serper Search", "subtitle": "Google SERP", "icon": "asset:google","color": "#ff79c6", "group": ["search", "tool"], "componentKind": "square", "handles": _IO, "description": "Search the web using Google via Serper API (web/news/images/places)", "version": 1})-register_node(type="perplexitySearch", metadata={"displayName": "Perplexity Search","subtitle": "AI Search", "icon": "asset:perplexity", "color": "#ff79c6", "group": ["search", "tool"], "componentKind": "square", "handles": _IO, "description": "AI-powered search using Perplexity Sonar with citations", "version": 1})+# perplexitySearch — migrated to nodes/search/perplexity_search.py (Wave 11.C).register_node(type="browser", metadata={"displayName": "Browser", "subtitle": "Browser Automation","icon": "asset:chrome", "color": "#ff79c6", "group": ["browser", "tool"], "componentKind": "square", "handles": _IO, "description": "Interactive browser automation via agent-browser CLI", "version": 1})register_node(type="apifyActor", metadata={"displayName": "Apify Actor", "subtitle": "Web Scraper", "icon": "asset:apify", "color": "#ff79c6", "group": ["api", "scraper", "tool"], "componentKind": "square", "handles": _IO, "description": "Run Apify actors for Instagram, TikTok, Twitter, LinkedIn, etc.", "version": 1})diff --git a/server/nodes/telegram/telegram_receive.py b/server/nodes/telegram/telegram_receive.pynew file mode 100644index 00000000..97ed847e--- /dev/null+++ b/server/nodes/telegram/telegram_receive.py@@ -0,0 +1,96 @@+"""Telegram Receive — Wave 11.C migration (event-based trigger).++Long-polling Telegram bot dispatches events into ``event_waiter``+under ``telegram_message_received``. The plugin's filter narrows by+sender/content type; legacy ``build_telegram_filter`` stays wired+through ``FILTER_BUILDERS`` until 11.F unifies dispatch.+"""++from __future__ import annotations++from typing import Any, Callable, Dict, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import NodeContext, Operation, TaskQueue, TriggerNode+++class TelegramReceiveParams(BaseModel):+ content_type_filter: Literal[+ "all", "text", "photo", "video", "audio", "voice", "document",+ "sticker", "location", "contact", "poll",+ ] = Field(default="all", alias="contentTypeFilter")+ sender_filter: Literal[+ "all", "self", "private", "group", "supergroup", "channel",+ "specific_chat", "specific_user", "keywords",+ ] = Field(default="all", alias="senderFilter")+ chat_id: str = Field(+ default="", alias="chatId",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["specific_chat"]}}},+ )+ from_user: str = Field(+ default="", alias="fromUser",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["specific_user"]}}},+ )+ keywords: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["keywords"]}}},+ )+ ignore_bots: bool = Field(default=True, alias="ignoreBots")++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class TelegramReceiveOutput(BaseModel):+ message_id: Optional[int] = None+ chat_id: Optional[int] = None+ chat_type: Optional[str] = None+ chat_title: Optional[str] = None+ from_id: Optional[int] = None+ from_username: Optional[str] = None+ from_first_name: Optional[str] = None+ from_last_name: Optional[str] = None+ is_bot: Optional[bool] = None+ text: Optional[str] = None+ content_type: Optional[str] = None+ date: Optional[str] = None+ reply_to_message_id: Optional[int] = None+ photo: Optional[dict] = None+ document: Optional[dict] = None+ location: Optional[dict] = None+ contact: Optional[dict] = None++ model_config = ConfigDict(extra="allow")+++class TelegramReceiveNode(TriggerNode):+ type = "telegramReceive"+ display_name = "Telegram Receive"+ subtitle = "Inbound Message"+ icon = "asset:telegram"+ color = "#0088CC"+ group = ("social", "trigger")+ description = "Trigger workflow when Telegram message is received"+ component_kind = "trigger"+ handles = (+ {"name": "output-main", "kind": "output", "position": "right",+ "label": "Output", "role": "main"},+ )+ task_queue = TaskQueue.TRIGGERS_EVENT+ mode = "event"+ event_type = "telegram_message_received"++ Params = TelegramReceiveParams+ Output = TelegramReceiveOutput++ def build_filter(self, params: TelegramReceiveParams) -> Callable[[Dict[str, Any]], bool]:+ # Delegate to legacy filter builder for full feature parity —+ # 11.F ports the body and removes the legacy registry entry.+ from services.event_waiter import build_telegram_filter+ return build_telegram_filter(params.model_dump(by_alias=True))++ @Operation("wait")+ async def wait(self, ctx: NodeContext, params: TelegramReceiveParams) -> TelegramReceiveOutput:+ raise NotImplementedError(+ "Event triggers return via TriggerNode.execute, not the op body"+ )diff --git a/server/nodes/telegram/telegram_send.py b/server/nodes/telegram/telegram_send.pynew file mode 100644index 00000000..36f11c4a--- /dev/null+++ b/server/nodes/telegram/telegram_send.py@@ -0,0 +1,110 @@+"""Telegram Send — Wave 11.C migration.++Dual-purpose: workflow ActionNode + AI tool. The Telegram bot token+lives in ``auth_service`` under ``telegram_bot_token``. Plugin+delegates to the legacy ``handle_telegram_send`` handler during+thin-migration; 11.E converts to a declarative ``TelegramCredential``.+"""++from __future__ import annotations++from typing import Any, Dict, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import ActionNode, NodeContext, Operation, TaskQueue+++class TelegramSendParams(BaseModel):+ recipient_type: Literal["self", "chat_id"] = Field(+ default="self", alias="recipientType",+ )+ chat_id: str = Field(+ default="", alias="chatId",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["chat_id"]}}},+ )+ message_type: Literal["text", "photo", "document", "location", "contact"] = Field(+ default="text", alias="messageType",+ )+ text: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["text"]}}},+ )+ media_url: str = Field(+ default="", alias="mediaUrl",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["photo", "document"]}}},+ )+ caption: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["photo", "document"]}}},+ )+ latitude: Optional[float] = Field(+ default=None,+ json_schema_extra={"displayOptions": {"show": {"message_type": ["location"]}}},+ )+ longitude: Optional[float] = Field(+ default=None,+ json_schema_extra={"displayOptions": {"show": {"message_type": ["location"]}}},+ )+ phone: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["contact"]}}},+ )+ first_name: str = Field(+ default="", alias="firstName",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["contact"]}}},+ )+ last_name: str = Field(+ default="", alias="lastName",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["contact"]}}},+ )+ parse_mode: Literal["Auto", "HTML", "Markdown", "MarkdownV2", "None"] = Field(+ default="Auto", alias="parseMode",+ )+ silent: bool = False+ reply_to_message_id: Optional[int] = Field(default=None, alias="replyToMessageId")++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class TelegramSendOutput(BaseModel):+ message_id: Optional[int] = None+ chat_id: Optional[int] = None+ sent: Optional[bool] = None++ model_config = ConfigDict(extra="allow")+++class TelegramSendNode(ActionNode):+ type = "telegramSend"+ display_name = "Telegram Send"+ subtitle = "Send Message"+ icon = "asset:telegram"+ color = "#0088CC"+ group = ("social", "tool")+ description = "Send text, photo, document, location, or contact via Telegram bot"+ component_kind = "square"+ handles = (+ {"name": "input-main", "kind": "input", "position": "left",+ "label": "Input", "role": "main"},+ {"name": "output-main", "kind": "output", "position": "right",+ "label": "Output", "role": "main"},+ )+ annotations = {"destructive": False, "readonly": False, "open_world": True}+ task_queue = TaskQueue.MESSAGING+ usable_as_tool = True++ Params = TelegramSendParams+ Output = TelegramSendOutput++ @Operation("send", cost={"service": "telegram", "action": "send", "count": 1})+ async def send(self, ctx: NodeContext, params: TelegramSendParams) -> Any:+ from services.handlers.telegram import handle_telegram_send+ payload = params.model_dump(by_alias=True)+ response = await handle_telegram_send(+ node_id=ctx.node_id, node_type=self.type,+ parameters=payload, context=ctx.raw,+ )+ if response.get("success"):+ return response.get("result") or response+ raise RuntimeError(response.get("error") or "Telegram send failed")diff --git a/server/nodes/tools.py b/server/nodes/tools.pyindex 945bda9a..a485954f 100644--- a/server/nodes/tools.py+++ b/server/nodes/tools.py@@ -40,21 +40,7 @@ register_node(},)-register_node(- type="duckduckgoSearch",- metadata={- "displayName": "DuckDuckGo Search",- "subtitle": "Free Web Search",- "icon": "asset:duckduckgo",- "color": "#f1fa8c",- "group": ["tool", "ai", "search"],- "componentKind": "tool",- "handles": _TOOL_HANDLES,- "description": "DuckDuckGo web search (free, no API key required)",- "version": 1,- "uiHints": {"isToolPanel": True, "hideRunButton": True},- },-)+# duckduckgoSearch — migrated to nodes/search/duckduckgo_search.py (Wave 11.C).register_node(type="taskManager",diff --git a/server/nodes/trigger/chat_trigger.py b/server/nodes/trigger/chat_trigger.pynew file mode 100644index 00000000..f78883d7--- /dev/null+++ b/server/nodes/trigger/chat_trigger.py@@ -0,0 +1,73 @@+"""Chat Trigger — Wave 11.C.++Event-based trigger that fires when the Console panel's chat tab+sends a message. Filter narrows to ``session_id`` so two chatTrigger+nodes with different session IDs receive independent streams.++Replaces:+- ``nodes/triggers.py:chatTrigger`` metadata-only registration.+- ``event_waiter.build_chat_filter`` stays wired until the generic+ trigger handler consults ``TriggerNode.build_filter`` directly+ (Wave 11.F).+"""++from __future__ import annotations++from typing import Any, Callable, Dict, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import NodeContext, Operation, TaskQueue, TriggerNode+++class ChatTriggerParams(BaseModel):+ session_id: str = Field(default="default", alias="sessionId")+ placeholder: str = "Type a message..."++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class ChatTriggerOutput(BaseModel):+ message: Optional[str] = None+ timestamp: Optional[str] = None+ session_id: Optional[str] = None++ model_config = ConfigDict(extra="allow")+++class ChatTriggerNode(TriggerNode):+ type = "chatTrigger"+ display_name = "Chat Trigger"+ subtitle = "Console Chat"+ icon = "asset:chat"+ color = "#ffb86c"+ group = ("utility", "trigger")+ description = "Trigger workflow when user sends a chat message from the console input"+ component_kind = "trigger"+ handles = (+ {"name": "output-main", "kind": "output", "position": "right",+ "label": "Output", "role": "main"},+ )+ ui_hints = {"isChatTrigger": True}+ task_queue = TaskQueue.TRIGGERS_EVENT+ mode = "event"+ event_type = "chat_message_received"++ Params = ChatTriggerParams+ Output = ChatTriggerOutput++ def build_filter(self, params: ChatTriggerParams) -> Callable[[Dict[str, Any]], bool]:+ session_id = params.session_id++ def matches(event: Dict[str, Any]) -> bool:+ if session_id and session_id != "default":+ return event.get("session_id") == session_id+ return True++ return matches++ @Operation("wait")+ async def wait(self, ctx: NodeContext, params: ChatTriggerParams) -> ChatTriggerOutput:+ raise NotImplementedError(+ "Event triggers return via TriggerNode.execute, not the op body"+ )diff --git a/server/nodes/triggers.py b/server/nodes/triggers.pyindex 69ef9d00..fd121988 100644--- a/server/nodes/triggers.py+++ b/server/nodes/triggers.py@@ -84,21 +84,7 @@ register_node(# webhookTrigger — migrated to nodes/webhook_trigger.py (Wave 11.B class-based plugin).-register_node(- type="chatTrigger",- metadata={- "displayName": "Chat Trigger",- "subtitle": "Console Chat",- "icon": "asset:chat",- "color": "#ffb86c",- "group": ["utility", "trigger"],- "componentKind": "trigger",- "handles": _TRIGGER_OUTPUT_HANDLES,- "description": "Trigger workflow when user sends a chat message from the console input",- "version": 1,- "uiHints": {"isChatTrigger": True},- },-)+# chatTrigger — migrated to nodes/trigger/chat_trigger.py (Wave 11.C).register_node(type="taskTrigger",@@ -130,20 +116,7 @@ register_node(},)-register_node(- type="telegramReceive",- metadata={- "displayName": "Telegram Receive",- "subtitle": "Inbound Message",- "icon": "asset:telegram",- "color": "#0088CC",- "group": ["social", "trigger"],- "componentKind": "trigger",- "handles": _TRIGGER_OUTPUT_HANDLES,- "description": "Trigger workflow when Telegram message is received",- "version": 1,- },-)+# telegramReceive — migrated to nodes/telegram/telegram_receive.py (Wave 11.C).register_node(type="twitterReceive",diff --git a/server/nodes/utilities.py b/server/nodes/utilities.pyindex c8bb6621..fc04d744 100644--- a/server/nodes/utilities.py+++ b/server/nodes/utilities.py@@ -51,24 +51,7 @@ register_node(},)-register_node(- type="console",- metadata={- "displayName": "Console",- "subtitle": "Debug Logger",- "icon": "🖥️",- "color": "#8be9fd",- "group": ["utility"],- "componentKind": "square",- "handles": [- {"name": "input-main", "kind": "input", "position": "left", "label": "Input", "role": "main"},- ],- "description": "Log data to console panel for debugging during execution",- "version": 1,- "uiHints": {"isConsoleSink": True},- "hideOutputHandle": True,- },-)+# console — migrated to nodes/utility/console.py (Wave 11.C).register_node(type="teamMonitor",diff --git a/server/nodes/utility/console.py b/server/nodes/utility/console.pynew file mode 100644index 00000000..9333da98--- /dev/null+++ b/server/nodes/utility/console.py@@ -0,0 +1,84 @@+"""Console — Wave 11.C migration.++Sink node that logs upstream outputs to the Console panel for+debugging. Reads ``connected_outputs`` + ``source_nodes`` injected+by ``NodeExecutor._dispatch`` (any plugin needing upstream data+declares its type in ``_NEEDS_CONNECTED_OUTPUTS``).++Delegates the actual log-formatting + broadcast to the existing+``handlers/utility.handle_console`` — that body is non-trivial+(JSON / table / expression formatting + WS broadcast) and stable,+so 11.C ports the shell only.+"""++from __future__ import annotations++from typing import Any, Dict, Literal, Optional++from pydantic import BaseModel, ConfigDict, Field++from services.plugin import ActionNode, NodeContext, Operation, TaskQueue+++class ConsoleParams(BaseModel):+ label: str = ""+ log_mode: Literal["all", "field", "expression"] = Field(+ default="all", alias="logMode",+ )+ field_path: str = Field(+ default="", alias="fieldPath",+ json_schema_extra={"displayOptions": {"show": {"log_mode": ["field"]}}},+ )+ expression: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"log_mode": ["expression"]}}},+ )+ format: Literal["json", "json_compact", "text", "table"] = "json"++ model_config = ConfigDict(populate_by_name=True, extra="ignore")+++class ConsoleOutput(BaseModel):+ logged: Optional[Any] = None+ label: Optional[str] = None+ timestamp: Optional[str] = None++ model_config = ConfigDict(extra="allow")+++class ConsoleNode(ActionNode):+ type = "console"+ display_name = "Console"+ subtitle = "Debug Logger"+ icon = "🖥️"+ color = "#8be9fd"+ group = ("utility",)+ description = "Log data to console panel for debugging during execution"+ component_kind = "square"+ handles = (+ {"name": "input-main", "kind": "input", "position": "left",+ "label": "Input", "role": "main"},+ )+ hide_output_handle = True+ ui_hints = {"isConsoleSink": True}+ annotations = {"destructive": False, "readonly": True, "open_world": False}+ task_queue = TaskQueue.DEFAULT++ Params = ConsoleParams+ Output = ConsoleOutput++ @Operation("log")+ async def log(self, ctx: NodeContext, params: ConsoleParams) -> Any:+ from services.handlers.utility import handle_console+ outputs = ctx.raw.get("connected_outputs") or {}+ source_nodes = ctx.raw.get("source_nodes") or []+ response = await handle_console(+ node_id=ctx.node_id, node_type=self.type,+ parameters=params.model_dump(by_alias=True),+ context=ctx.raw,+ connected_outputs=outputs,+ source_nodes=source_nodes,+ )+ if response.get("success") is False:+ raise RuntimeError(response.get("error") or "console log failed")+ return response.get("result") or {}diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.pyindex 09819373..2cd042cb 100644--- a/server/services/handlers/tools.py+++ b/server/services/handlers/tools.py@@ -116,9 +116,7 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],if node_type == 'currentTimeTool':return await _execute_current_time(tool_args, node_params)- # DuckDuckGo search tool (free, no API key)- if node_type == 'duckduckgoSearch':- return await _execute_duckduckgo_search(tool_args, node_params)+ # duckduckgoSearch: migrated to plugin (Wave 11.C). Handled by fast-path above.# Filesystem and shell tools (deepagents backends)if node_type in ('fileRead', 'fileModify', 'shell', 'fsSearch'):@@ -211,9 +209,7 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],if node_type == 'serperSearch':return await _execute_serper_search_tool(tool_args, config.get('parameters', {}))- # Perplexity Search (dual-purpose: workflow node + AI tool)- if node_type == 'perplexitySearch':- return await _execute_perplexity_search_tool(tool_args, config.get('parameters', {}))+ # perplexitySearch: migrated to plugin (Wave 11.C). Handled by fast-path above.# Google Maps Geocoding (gmaps_locations node as tool)if node_type == 'gmaps_locations':diff --git a/server/services/node_executor.py b/server/services/node_executor.pyindex 5b1ee535..667944d1 100644--- a/server/services/node_executor.py+++ b/server/services/node_executor.py@@ -137,8 +137,8 @@ class NodeExecutor:'cronScheduler': handle_cron_scheduler,'timer': handle_timer,# AI- 'aiAgent': partial(handle_ai_agent, ai_service=self.ai_service, database=self.database),- 'chatAgent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),+ # aiAgent + chatAgent: migrated to nodes/agent/{ai_agent,chat_agent}.py (Wave 11.C).+ # Plugin handler wins via registry merge.# Specialized Agents (use chatAgent handler - same skill/memory/tools architecture)'android_agent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),'coding_agent': partial(handle_chat_agent, ai_service=self.ai_service, database=self.database),@@ -168,7 +168,7 @@ class NodeExecutor:'whatsappSend': handle_whatsapp_send,'whatsappDb': handle_whatsapp_db,# Telegram (telegramReceive routed via generic handle_trigger_node)- 'telegramSend': handle_telegram_send,+ # telegramSend: migrated to nodes/telegram/telegram_send.py (Wave 11.C). Plugin handler wins via merge.# Email (Himalaya CLI)'emailSend': handle_email_send,'emailRead': handle_email_read,@@ -187,7 +187,7 @@ class NodeExecutor:'contacts': handle_google_contacts,# Search — braveSearch migrated to nodes/brave_search.py (Wave 11.B)'serperSearch': handle_serper_search,- 'perplexitySearch': handle_perplexity_search,+ # perplexitySearch: migrated to nodes/search/perplexity_search.py (Wave 11.C). Plugin handler wins.# Social (unified messaging)# Note: socialReceive handled in _dispatch with connected_outputs'socialSend': handle_social_send,@@ -367,19 +367,34 @@ class NodeExecutor:return result+ # Node types that need outputs from connected upstream nodes.+ # Computed once so plugin handlers (registered via @register_node)+ # can read context['connected_outputs'] / context['source_nodes']+ # without re-implementing the graph walk.+ _NEEDS_CONNECTED_OUTPUTS = frozenset({+ 'pythonExecutor', 'javascriptExecutor', 'typescriptExecutor',+ 'webhookResponse', 'console', 'socialReceive',+ })+async def _dispatch(self, node_id: str, node_type: str, params: Dict, context: Dict) -> Dict:"""Dispatch to handler from registry or special handlers."""- # Check registry first+ # Pre-enrich context for nodes that consume upstream outputs.+ # Both plugin handlers and legacy handlers can read these keys.+ if node_type in self._NEEDS_CONNECTED_OUTPUTS:+ outputs, source_nodes = await self._get_connected_outputs_with_info(context, node_id)+ context = {**context, 'connected_outputs': outputs, 'source_nodes': source_nodes}++ # Check registry first (plugin handlers win — they were merged in+ # via _build_handler_registry's registry.update(_PLUGIN_HANDLERS)).handler = self._handlers.get(node_type)if handler:return await handler(node_id, node_type, params, context)- # Special handlers needing connected outputs- if node_type in ('pythonExecutor', 'javascriptExecutor', 'typescriptExecutor', 'webhookResponse', 'console', 'socialReceive'):- logger.debug(f"[_dispatch] Getting connected outputs for {node_type} node_id={node_id}")- outputs, source_nodes = await self._get_connected_outputs_with_info(context, node_id)- logger.debug(f"[_dispatch] Got {len(outputs)} outputs for {node_type}: keys={list(outputs.keys())}")+ # Legacy special handlers — invoked when no plugin is registered.+ if node_type in self._NEEDS_CONNECTED_OUTPUTS:+ outputs = context['connected_outputs']+ source_nodes = context['source_nodes']if node_type == 'console':return await handle_console(node_id, node_type, params, context, outputs, source_nodes)if node_type == 'socialReceive':