Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
chore(plugin): Wave 11.C cleanup — drop dead legacy refs for migrated nodes
trohitg2724d606a048
diff --git a/server/services/ai.py b/server/services/ai.pyindex 47760ca3..b45bd84e 100644--- a/server/services/ai.py+++ b/server/services/ai.py@@ -2701,17 +2701,16 @@ class AIService:if db_schema_config:return self._build_schema_from_config(db_schema_config)- # Calculator tool schema- if node_type == 'calculatorTool':- class CalculatorSchema(BaseModel):- """Schema for calculator tool arguments."""- operation: str = Field(- description="Math operation: add, subtract, multiply, divide, power, sqrt, mod, abs"- )- a: float = Field(description="First number")- b: float = Field(default=0, description="Second number (not needed for sqrt, abs)")+ # Wave 11.B.1 plugin fast-path: if this node_type is a registered+ # BaseNode subclass, use its Pydantic Params model directly. The+ # plugin owns the LLM-visible schema; per-type ad-hoc schemas+ # below only fire for not-yet-migrated nodes.+ from services.node_registry import get_node_class+ plugin_cls = get_node_class(node_type)+ if plugin_cls is not None and hasattr(plugin_cls, 'Params'):+ return plugin_cls.Params- return CalculatorSchema+ # calculatorTool: schema now provided by nodes/tool/calculator_tool.py via plugin fast-path above.# HTTP Request tool schemaif node_type in ('httpRequest', 'httpRequestTool'):@@ -2761,23 +2760,9 @@ class AIService:return CurrentTimeSchema- # DuckDuckGo search tool schema- if node_type == 'duckduckgoSearch':- class DuckDuckGoSearchSchema(BaseModel):- """Search the web using DuckDuckGo (free, no API key)."""- query: str = Field(description="Search query to look up on the web")-- return DuckDuckGoSearchSchema-- # Brave Search tool schema (dual-purpose: workflow node + AI tool)- if node_type == 'braveSearch':- class BraveSearchSchema(BaseModel):- """Search the web using Brave Search API."""- query: str = Field(description="Search query to look up on the web")-- return BraveSearchSchema-- # Serper Search tool schema (dual-purpose: workflow node + AI tool)+ # duckduckgoSearch / braveSearch / perplexitySearch: schemas now provided+ # by nodes/search/*.py via plugin fast-path above. serperSearch keeps its+ # ad-hoc schema until migration.if node_type == 'serperSearch':class SerperSearchSchema(BaseModel):"""Search the web using Google via Serper API."""@@ -2785,14 +2770,6 @@ class AIService:return SerperSearchSchema- # Perplexity Search tool schema (dual-purpose: workflow node + AI tool)- if node_type == 'perplexitySearch':- class PerplexitySearchSchema(BaseModel):- """Search the web using Perplexity Sonar AI for an answer with citations."""- query: str = Field(description="Search query to get AI-powered answer with citations")-- return PerplexitySearchSchema-# Timer tool schema (dual-purpose: workflow node + AI tool)if node_type == 'timer':class TimerSchema(BaseModel):@@ -3362,33 +3339,7 @@ class AIService:# GOOGLE WORKSPACE CONSOLIDATED TOOL SCHEMAS# ============================================================================- if node_type == 'gmail':- class GoogleGmailSchema(BaseModel):- """Send, search, and read emails via Gmail.-- - send: Compose and send an email (requires to, subject, body)- - search: Find emails by query (requires query)- - read: Get email by message ID (requires message_id)- """- operation: str = Field(- description="Operation: 'send', 'search', or 'read'"- )- # send fields- to: Optional[str] = Field(default=None, description="[send] Recipient email(s), comma-separated")- subject: Optional[str] = Field(default=None, description="[send] Email subject line")- body: Optional[str] = Field(default=None, description="[send] Email body content")- cc: Optional[str] = Field(default=None, description="[send] CC recipients, comma-separated")- bcc: Optional[str] = Field(default=None, description="[send] BCC recipients, comma-separated")- body_type: str = Field(default="text", description="[send] Body type: 'text' or 'html'")- # search fields- query: Optional[str] = Field(default=None, description="[search] Gmail search query (e.g., 'from:[email protected]', 'subject:meeting', 'is:unread')")- max_results: int = Field(default=10, description="[search] Max messages to return (1-100)")- include_body: bool = Field(default=False, description="[search] Fetch full message body")- # read fields- message_id: Optional[str] = Field(default=None, description="[read] Gmail message ID to read")- format: str = Field(default="full", description="[read] Format: 'full', 'minimal', 'raw', 'metadata'")-- return GoogleGmailSchema+ # gmail: schema now provided by nodes/google/gmail.py via plugin fast-path above.if node_type == 'calendar':class GoogleCalendarSchema(BaseModel):diff --git a/server/services/handlers/tools.py b/server/services/handlers/tools.pyindex 2cd042cb..682f27e1 100644--- a/server/services/handlers/tools.py+++ b/server/services/handlers/tools.py@@ -272,50 +272,8 @@ async def execute_tool(tool_name: str, tool_args: Dict[str, Any],return await _execute_generic(tool_args, config)-async def _execute_calculator(args: Dict[str, Any]) -> Dict[str, Any]:- """Execute calculator operations.-- Supported operations: add, subtract, multiply, divide, power, sqrt, mod, abs-- Args:- args: Dict with 'operation', 'a', and optionally 'b'-- Returns:- Dict with operation, inputs, and result- """- operation = args.get('operation', '').lower()- a = float(args.get('a', 0))- b = float(args.get('b', 0))-- operations = {- 'add': lambda: a + b,- 'subtract': lambda: a - b,- 'multiply': lambda: a * b,- 'divide': lambda: a / b if b != 0 else float('inf'),- 'power': lambda: math.pow(a, b),- 'sqrt': lambda: math.sqrt(abs(a)), # Use abs to handle negative- 'mod': lambda: a % b if b != 0 else 0,- 'abs': lambda: abs(a),- }-- if operation not in operations:- return {- "error": f"Unknown operation: {operation}",- "supported_operations": list(operations.keys())- }-- try:- result = operations[operation]()- logger.debug(f"[Calculator] {operation}({a}, {b}) = {result}")- return {- "operation": operation,- "a": a,- "b": b,- "result": result- }- except Exception as e:- logger.error(f"[Calculator] Error: {e}")- return {"error": str(e)}+# _execute_calculator: deleted in Wave 11.C cleanup. Logic moved to+# nodes/tool/calculator_tool.py CalculatorToolNode.calculate().async def _execute_http_request(args: Dict[str, Any],@@ -618,125 +576,8 @@ async def _execute_current_time(args: Dict[str, Any],return {"error": f"Invalid timezone: {timezone_str}. Error: {str(e)}"}-async def _execute_duckduckgo_search(args: Dict[str, Any],- node_params: Dict[str, Any]) -> Dict[str, Any]:- """Execute web search.-- Args:- args: Dict with 'query'- node_params: Node parameters containing provider, apiKey, maxResults-- Returns:- Dict with query, results list, provider- """- import httpx- import asyncio-- query = args.get('query', '')- if not query:- return {"error": "No search query provided"}-- provider = node_params.get('provider', 'duckduckgo')- max_results = int(node_params.get('maxResults', 5))-- logger.info(f"[WebSearch] Searching '{query}' via {provider}")-- try:- if provider == 'duckduckgo':- # Use the ddgs library for proper web search results- try:- from ddgs import DDGS-- # Run synchronous DDGS in a thread pool to not block async- def do_search():- ddgs = DDGS()- return list(ddgs.text(query, max_results=max_results))-- search_results = await asyncio.get_event_loop().run_in_executor(- None, do_search- )-- results = []- for item in search_results:- results.append({- "title": item.get('title', ''),- "snippet": item.get('body', ''),- "url": item.get('href', '')- })-- logger.info(f"[WebSearch] Found {len(results)} results via DuckDuckGo")- return {- "query": query,- "results": results,- "provider": "duckduckgo"- }-- except ImportError:- logger.warning("[WebSearch] ddgs not installed, falling back to Instant Answer API")- # Fallback to Instant Answer API (limited results)- async with httpx.AsyncClient(timeout=10.0) as client:- response = await client.get(- "https://api.duckduckgo.com/",- params={"q": query, "format": "json", "no_html": 1}- )- data = response.json()-- results = []- if data.get('AbstractText'):- results.append({- "title": data.get('Heading', 'Result'),- "snippet": data.get('AbstractText'),- "url": data.get('AbstractURL', '')- })-- for topic in data.get('RelatedTopics', [])[:max_results]:- if isinstance(topic, dict) and 'Text' in topic:- results.append({- "title": topic.get('Text', '')[:50],- "snippet": topic.get('Text', ''),- "url": topic.get('FirstURL', '')- })-- logger.info(f"[WebSearch] Found {len(results)} results (Instant Answer API fallback)")- return {- "query": query,- "results": results[:max_results],- "provider": "duckduckgo"- }-- elif provider == 'serper':- api_key = node_params.get('apiKey', '')- if not api_key:- return {"error": "Serper API key required"}-- async with httpx.AsyncClient(timeout=10.0) as client:- response = await client.post(- "https://google.serper.dev/search",- headers={"X-API-KEY": api_key, "Content-Type": "application/json"},- json={"q": query, "num": max_results}- )- data = response.json()-- results = []- for item in data.get('organic', [])[:max_results]:- results.append({- "title": item.get('title', ''),- "snippet": item.get('snippet', ''),- "url": item.get('link', '')- })-- logger.info(f"[WebSearch] Found {len(results)} results via Serper")- return {- "query": query,- "results": results,- "provider": "serper"- }-- return {"error": f"Unknown search provider: {provider}"}-- except Exception as e:- logger.error(f"[WebSearch] Error: {e}")- return {"error": f"Search failed: {str(e)}"}+# _execute_duckduckgo_search: deleted in Wave 11.C cleanup. Logic moved+# to nodes/search/duckduckgo_search.py DuckDuckGoSearchNode.search().async def _execute_whatsapp_send(args: Dict[str, Any],@@ -1471,18 +1312,8 @@ async def _execute_twitter_user(args: Dict[str, Any],)-async def _execute_google_gmail(args: Dict[str, Any],- node_params: Dict[str, Any]) -> Dict[str, Any]:- """Execute Gmail operations via consolidated dispatcher."""- from services.handlers.gmail import handle_google_gmail-- parameters = {**node_params, **args}- return await handle_google_gmail(- node_id="tool_google_gmail",- node_type="gmail",- parameters=parameters,- context={}- )+# _execute_google_gmail: deleted in Wave 11.C cleanup. gmail now routes+# through the plugin fast-path (nodes/google/gmail.py).# ============================================================================@@ -2509,19 +2340,10 @@ async def handle_task_manager(# SEARCH TOOL WRAPPERS (for AI Agent tool calling)# =============================================================================-async def _execute_brave_search_tool(args: Dict[str, Any],- node_params: Dict[str, Any]) -> Dict[str, Any]:- """Execute Brave Search via handler (AI Agent tool wrapper)."""- from services.handlers.search import handle_brave_search-- parameters = {**node_params, **args}- return await handle_brave_search(- node_id="tool_brave_search",- node_type="braveSearch",- parameters=parameters,- context={}- )-+# brave + perplexity tool wrappers: deleted in Wave 11.C cleanup. Both+# now route through the plugin fast-path in execute_tool which calls+# the BaseNode.execute_as_tool method on the plugin class.+# _execute_serper_search_tool stays until serperSearch is migrated.async def _execute_serper_search_tool(args: Dict[str, Any],node_params: Dict[str, Any]) -> Dict[str, Any]:@@ -2537,20 +2359,6 @@ async def _execute_serper_search_tool(args: Dict[str, Any],)-async def _execute_perplexity_search_tool(args: Dict[str, Any],- node_params: Dict[str, Any]) -> Dict[str, Any]:- """Execute Perplexity Search via handler (AI Agent tool wrapper)."""- from services.handlers.search import handle_perplexity_search-- parameters = {**node_params, **args}- return await handle_perplexity_search(- node_id="tool_perplexity_search",- node_type="perplexitySearch",- parameters=parameters,- context={}- )--async def _execute_email_tool(node_type: str, args: Dict[str, Any],node_params: Dict[str, Any]) -> Dict[str, Any]:"""Execute email send/read as AI tool via EmailService."""diff --git a/server/services/node_executor.py b/server/services/node_executor.pyindex 667944d1..14c0a5d8 100644--- a/server/services/node_executor.py+++ b/server/services/node_executor.py@@ -30,19 +30,23 @@ from services.handlers import (handle_create_map, handle_add_locations, handle_nearby_places,handle_text_generator, handle_file_handler,handle_chat_send, handle_chat_history,- handle_start, handle_cron_scheduler, handle_timer, handle_console, handle_team_monitor,+ handle_start, handle_cron_scheduler, handle_timer, handle_team_monitor,+ # handle_console: migrated to nodes/utility/console.py (Wave 11.C).handle_whatsapp_send, handle_whatsapp_db,handle_social_receive, handle_social_send,handle_http_scraper, handle_file_downloader, handle_document_parser,handle_text_chunker, handle_embedding_generator, handle_vector_store,handle_task_manager,handle_twitter_send, handle_twitter_search, handle_twitter_user,- handle_serper_search, handle_perplexity_search, # handle_brave_search: used only by handlers/tools.py (Wave 11.B)+ handle_serper_search,+ # Wave 11 migrated: handle_brave_search, handle_perplexity_search now imported+ # lazily by their plugin classes in nodes/search/.handle_rlm_agent,)from services.handlers.claude_code import handle_claude_code_agentfrom services.handlers.deep_agent import handle_deep_agent-from services.handlers.telegram import handle_telegram_send+# Wave 11 migrated: handle_telegram_send now imported lazily by+# nodes/telegram/telegram_send.py.from services.handlers.apify import handle_apify_actorfrom services.handlers.crawlee import handle_crawlee_scraperfrom services.handlers.browser import handle_browser@@ -52,7 +56,8 @@ from services.handlers.todo import handle_write_todosfrom services.handlers.process import handle_process_managerfrom services.handlers.email import handle_email_send, handle_email_read, handle_email_receive# Consolidated Google Workspace handlers (6 services with operation dispatchers)-from services.handlers.gmail import handle_google_gmail, handle_gmail_receive+# Wave 11 migrated: gmail handlers (send/search/read) imported lazily+# by nodes/google/gmail.py; handle_gmail_receive lazily by gmail_receive.py.from services.handlers.calendar import handle_google_calendarfrom services.handlers.drive import handle_google_drivefrom services.handlers.sheets import handle_google_sheets@@ -179,7 +184,7 @@ class NodeExecutor:'twitterUser': handle_twitter_user,# Google Workspace (consolidated with operation dispatchers)# gmail: migrated to nodes/gmail.py (Wave 11.B). Plugin handler wins via registry.update.- 'gmailReceive': handle_gmail_receive, # Polling-based trigger (custom handler)+ # gmailReceive: migrated to nodes/google/gmail_receive.py (Wave 11.B). Plugin handler wins.'calendar': handle_google_calendar,'drive': handle_google_drive,'sheets': handle_google_sheets,@@ -392,11 +397,10 @@ class NodeExecutor:return await handler(node_id, node_type, params, context)# Legacy special handlers — invoked when no plugin is registered.+ # console: migrated to nodes/utility/console.py (Wave 11.C); plugin wins above.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':return await handle_social_receive(node_id, node_type, params, context, outputs, source_nodes)handlers = {