Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
revert: undo all plugin-source modifications
trohitgb2ae9001892a
diff --git a/server/models/nodes.py b/server/models/nodes.pyindex 1bcced10..8478febc 100644--- a/server/models/nodes.py+++ b/server/models/nodes.py@@ -35,12 +35,7 @@ from constants import (class BaseNodeParams(BaseModel):"""Base class for all node parameters."""- # populate_by_name=True so snake_case field names are accepted as- # inputs even when an alias (camelCase) is declared. Pre-refactor- # NodeExecutor._inject_api_keys + handler code both wrote/read- # snake_case; without this, validate_node_params would silently- # lose user-provided snake_case values and re-dump the defaults.- model_config = {"extra": "allow", "populate_by_name": True}+ model_config = {"extra": "allow"} # Allow extra fields for flexibility# =============================================================================diff --git a/server/nodes/agent/_specialized.py b/server/nodes/agent/_specialized.pyindex 2aabe31d..4f6c1c8e 100644--- a/server/nodes/agent/_specialized.py+++ b/server/nodes/agent/_specialized.py@@ -95,10 +95,7 @@ class SpecializedAgentBase(ActionNode, abstract=True):context=ctx.raw, database=database,log_prefix=f"[{self.type}]",)- call_parameters = kwargs.pop("parameters")- response = await ai_service.execute_chat_agent(- ctx.node_id, call_parameters, **kwargs,- )+ response = await ai_service.execute_chat_agent(ctx.node_id, **kwargs)if response.get("success"):return response.get("result") or responseraise RuntimeError(response.get("error") or f"{self.type} execution failed")diff --git a/server/nodes/agent/ai_agent.py b/server/nodes/agent/ai_agent.pyindex f8357560..af4fbbe0 100644--- a/server/nodes/agent/ai_agent.py+++ b/server/nodes/agent/ai_agent.py@@ -100,12 +100,7 @@ class AIAgentNode(ActionNode):context=ctx.raw, database=database,log_prefix="[AI Agent]",)- # ``AIService.execute_agent`` signature is- # ``(node_id, parameters, **opts)`` -- pass parameters positionally.- call_parameters = kwargs.pop("parameters")- response = await ai_service.execute_agent(- ctx.node_id, call_parameters, **kwargs,- )+ response = await ai_service.execute_agent(ctx.node_id, **kwargs)if response.get("success"):return response.get("result") or responseraise RuntimeError(response.get("error") or "AI Agent execution failed")diff --git a/server/nodes/agent/chat_agent.py b/server/nodes/agent/chat_agent.pyindex a1a70b27..3e8d053c 100644--- a/server/nodes/agent/chat_agent.py+++ b/server/nodes/agent/chat_agent.py@@ -87,10 +87,7 @@ class ChatAgentNode(ActionNode):context=ctx.raw, database=database,log_prefix="[Chat Agent]",)- call_parameters = kwargs.pop("parameters")- response = await ai_service.execute_chat_agent(- ctx.node_id, call_parameters, **kwargs,- )+ response = await ai_service.execute_chat_agent(ctx.node_id, **kwargs)if response.get("success"):return response.get("result") or responseraise RuntimeError(response.get("error") or "Chat Agent execution failed")diff --git a/server/nodes/agent/claude_code_agent.py b/server/nodes/agent/claude_code_agent.pyindex 07536c46..8a7ede6b 100644--- a/server/nodes/agent/claude_code_agent.py+++ b/server/nodes/agent/claude_code_agent.py@@ -9,9 +9,7 @@ from __future__ import annotationsimport timefrom datetime import datetime-from typing import Any, Optional--from pydantic import ConfigDict, Field+from typing import Anyfrom core.logging import get_loggerfrom services.plugin import ActionNode, NodeContext, Operation, TaskQueue@@ -23,26 +21,6 @@ from ._specialized import SpecializedAgentOutput, SpecializedAgentParamslogger = get_logger(__name__)-class ClaudeCodeAgentParams(SpecializedAgentParams):- """SpecializedAgentParams plus the CLI-specific knobs.-- Pre-refactor handler read these fields from the raw payload- (maxTurns, maxBudgetUsd, allowedTools, workingDirectory, systemPrompt).- ``SpecializedAgentParams`` has ``extra="ignore"`` which silently drops- them, so declaring them restores the pre-refactor contract.- """-- max_turns: int = Field(default=10, alias="maxTurns", ge=1, le=200)- max_budget_usd: float = Field(default=5.0, alias="maxBudgetUsd", ge=0.0)- allowed_tools: str = Field(- default="Read,Edit,Bash,Glob,Grep,Write", alias="allowedTools",- )- working_directory: Optional[str] = Field(default=None, alias="workingDirectory")- system_prompt: Optional[str] = Field(default=None, alias="systemPrompt")-- model_config = ConfigDict(populate_by_name=True, extra="ignore")--class ClaudeCodeAgentNode(ActionNode):type = "claude_code_agent"display_name = "Claude Code"@@ -57,11 +35,11 @@ class ClaudeCodeAgentNode(ActionNode):annotations = {"destructive": True, "readonly": False, "open_world": True}task_queue = TaskQueue.AI_HEAVY- Params = ClaudeCodeAgentParams+ Params = SpecializedAgentParamsOutput = SpecializedAgentOutput@Operation("execute", cost={"service": "claude_code_agent", "action": "run", "count": 1})- async def execute_op(self, ctx: NodeContext, params: ClaudeCodeAgentParams) -> Any:+ async def execute_op(self, ctx: NodeContext, params: SpecializedAgentParams) -> Any:from core.container import containerfrom services.claude_code_service import get_claude_code_servicefrom services.status_broadcaster import get_status_broadcasterdiff --git a/server/nodes/code/_base.py b/server/nodes/code/_base.pyindex ee825231..715f329f 100644--- a/server/nodes/code/_base.py+++ b/server/nodes/code/_base.py@@ -15,10 +15,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass CodeExecutorParams(BaseModel):- # Pre-refactor contract: empty code returned an error envelope from- # the handler body ("No code provided"), not a Pydantic ValidationError.- # Let empty through so the handler's explicit check drives the error.- code: str = Field(default="", json_schema_extra={"editor": "code"})+ code: str = Field(..., min_length=1, json_schema_extra={"editor": "code"})timeout: int = Field(default=30, ge=1, le=600)model_config = ConfigDict(extra="allow")diff --git a/server/nodes/code/javascript_executor.py b/server/nodes/code/javascript_executor.pyindex 18c4e32b..6fd684c1 100644--- a/server/nodes/code/javascript_executor.py+++ b/server/nodes/code/javascript_executor.py@@ -2,7 +2,6 @@from __future__ import annotations-from datetime import datetime, timezonefrom typing import Anyfrom services.plugin import NodeContext, Operation@@ -39,5 +38,4 @@ class JavaScriptExecutorNode(CodeExecutorBase):return {"output": result.get("output"),"console_output": result.get("console_output", ""),- "timestamp": datetime.now(timezone.utc).isoformat(),}diff --git a/server/nodes/code/python_executor.py b/server/nodes/code/python_executor.pyindex 92ea434c..2c5f9c2f 100644--- a/server/nodes/code/python_executor.py+++ b/server/nodes/code/python_executor.py@@ -2,7 +2,6 @@from __future__ import annotations-from datetime import datetime, timezonefrom typing import Anyfrom services.plugin import NodeContext, Operation@@ -26,13 +25,9 @@ class PythonExecutorNode(CodeExecutorBase):results are reachable; ``workspace_dir`` is the per-workflowscratch directory."""- import collections- import datetime as datetime_moduleimport ioimport json as json_moduleimport math- import random- import reif not params.code.strip():raise RuntimeError("No code provided")@@ -44,29 +39,24 @@ class PythonExecutorNode(CodeExecutorBase):kwargs["file"] = stdout_captureprint(*args, **kwargs)- import builtins as _builtins_module-- builtins_dict = dict(_builtins_module.__dict__)- builtins_dict["print"] = captured_print-+ safe_builtins = {+ "abs": abs, "all": all, "any": any, "bool": bool,+ "dict": dict, "enumerate": enumerate, "filter": filter,+ "float": float, "int": int, "len": len, "list": list,+ "map": map, "max": max, "min": min, "print": captured_print,+ "range": range, "round": round, "set": set, "sorted": sorted,+ "str": str, "sum": sum, "tuple": tuple, "type": type, "zip": zip,+ "True": True, "False": False, "None": None,+ "math": math, "json": json_module,+ }namespace = {- "__builtins__": builtins_dict,+ "__builtins__": safe_builtins,"input_data": input_data,"workspace_dir": ctx.workspace_dir or "","output": None,- "math": math,- "json": json_module,- "datetime": datetime_module.datetime,- "timedelta": datetime_module.timedelta,- "collections": collections,- "Counter": collections.Counter,- "defaultdict": collections.defaultdict,- "re": re,- "random": random,}- exec(params.code, namespace) # noqa: S102 -- sandboxed namespace+ exec(params.code, namespace) # noqa: S102 — sandboxed namespacereturn {"output": namespace.get("output"),"console_output": stdout_capture.getvalue(),- "timestamp": datetime.now(timezone.utc).isoformat(),}diff --git a/server/nodes/code/typescript_executor.py b/server/nodes/code/typescript_executor.pyindex 96ed1981..0a28c394 100644--- a/server/nodes/code/typescript_executor.py+++ b/server/nodes/code/typescript_executor.py@@ -2,7 +2,6 @@from __future__ import annotations-from datetime import datetime, timezonefrom typing import Anyfrom services.plugin import NodeContext, Operation@@ -38,5 +37,4 @@ class TypeScriptExecutorNode(CodeExecutorBase):return {"output": result.get("output"),"console_output": result.get("console_output", ""),- "timestamp": datetime.now(timezone.utc).isoformat(),}diff --git a/server/nodes/document/document_parser.py b/server/nodes/document/document_parser.pyindex a5067b20..50edc7ce 100644--- a/server/nodes/document/document_parser.py+++ b/server/nodes/document/document_parser.py@@ -39,8 +39,7 @@ def _parse_file_sync(path: Path, parser: str) -> str:class DocumentParserParams(BaseModel):file_path: str = Field(default="", alias="filePath")- # Pre-refactor: unknown parser -> handler error, not Pydantic ValidationError.- parser: str = "pypdf"+ parser: Literal["pypdf", "marker", "unstructured", "beautifulsoup"] = "pypdf"model_config = ConfigDict(populate_by_name=True, extra="allow")diff --git a/server/nodes/document/embedding_generator.py b/server/nodes/document/embedding_generator.pyindex 6ab7e2e2..a99a9f7f 100644--- a/server/nodes/document/embedding_generator.py+++ b/server/nodes/document/embedding_generator.py@@ -12,7 +12,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass EmbeddingGeneratorParams(BaseModel):chunks: List[Optional[dict]] = Field(default_factory=list)- provider: str = "huggingface" # unknown -> handler error, not Pydantic+ provider: Literal["huggingface", "openai", "ollama"] = "huggingface"model: str = Field(default="BAAI/bge-small-en-v1.5")api_key: str = Field(default="", alias="apiKey")diff --git a/server/nodes/document/vector_store.py b/server/nodes/document/vector_store.pyindex 3cc86afb..4156261b 100644--- a/server/nodes/document/vector_store.py+++ b/server/nodes/document/vector_store.py@@ -17,9 +17,8 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass VectorStoreParams(BaseModel):- # Pre-refactor: unknown op / backend -> handler error, not Pydantic.- operation: str = "store"- backend: str = "chroma"+ operation: Literal["store", "query", "delete"] = "store"+ backend: Literal["chroma", "chromadb", "qdrant", "pinecone"] = "chroma"collection_name: str = Field(default="documents", alias="collectionName")embeddings: Optional[list] = Nonechunks: Optional[list] = Nonediff --git a/server/nodes/email/email_read.py b/server/nodes/email/email_read.pyindex 7a3fe52b..488a74b0 100644--- a/server/nodes/email/email_read.py+++ b/server/nodes/email/email_read.py@@ -14,7 +14,7 @@ class EmailReadParams(BaseModel):"gmail", "outlook", "yahoo", "icloud","protonmail", "fastmail", "custom",] = "gmail"- operation: str = "list" # handler dispatches; unknown op raised from body+ operation: Literal["list", "search", "read", "folders", "move", "delete", "flag"] = "list"folder: str = Field(default="INBOX")query: str = Field(default="")message_id: str = Field(default="", alias="messageId")@@ -60,4 +60,4 @@ class EmailReadNode(ActionNode):async def query(self, ctx: NodeContext, params: EmailReadParams) -> Any:# Body inlined from handlers/email.py (Wave 11.D.1).from services.email_service import get_email_service- return await get_email_service().read(params.model_dump(by_alias=False))+ return await get_email_service().read(params.model_dump(by_alias=True))diff --git a/server/nodes/email/email_receive.py b/server/nodes/email/email_receive.pyindex a1c5c010..0fa3de7e 100644--- a/server/nodes/email/email_receive.py+++ b/server/nodes/email/email_receive.py@@ -6,9 +6,6 @@ IMAP polling for new mail via Himalaya CLI. Thin delegation tofrom __future__ import annotations-# Re-exported so tests can patch `nodes.email.email_receive.asyncio.sleep`-# without reaching into the delegate handler module.-import asyncio # noqa: F401from typing import Any, Dict, Literal, Optionalfrom pydantic import BaseModel, ConfigDict, Fielddiff --git a/server/nodes/filesystem/file_modify.py b/server/nodes/filesystem/file_modify.pyindex 6147570e..10a46c84 100644--- a/server/nodes/filesystem/file_modify.py+++ b/server/nodes/filesystem/file_modify.py@@ -10,10 +10,8 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass FileModifyParams(BaseModel):- # Pre-refactor contract: unknown operation -> "Unknown operation ..."- # error from handler body, not Pydantic ValidationError.- operation: str = Field(default="write")- file_path: str = Field(default="", alias="filePath")+ operation: Literal["write", "edit"] = "write"+ file_path: str = Field(..., alias="filePath")content: str = Field(default="")old_string: str = Field(default="", alias="oldString")new_string: str = Field(default="", alias="newString")diff --git a/server/nodes/filesystem/fs_search.py b/server/nodes/filesystem/fs_search.pyindex 6841ec91..5f91a1f6 100644--- a/server/nodes/filesystem/fs_search.py+++ b/server/nodes/filesystem/fs_search.py@@ -10,9 +10,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass FsSearchParams(BaseModel):- # Pre-refactor contract: unknown mode raised "Unknown mode ..." from- # the handler body rather than failing Pydantic validation.- mode: str = Field(default="ls")+ mode: Literal["ls", "glob", "grep"] = "ls"path: str = Field(default=".")pattern: str = Field(default="")diff --git a/server/nodes/filesystem/shell.py b/server/nodes/filesystem/shell.pyindex 001011b9..35ed5a54 100644--- a/server/nodes/filesystem/shell.py+++ b/server/nodes/filesystem/shell.py@@ -10,9 +10,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass ShellParams(BaseModel):- # Pre-refactor contract: empty command returned- # "Command is required" from the handler body.- command: str = Field(default="")+ command: str = Field(..., min_length=1)cwd: str = Field(default="")timeout: int = Field(default=30, ge=1, le=600)diff --git a/server/nodes/google/calendar.py b/server/nodes/google/calendar.pyindex bc79b104..e8e62948 100644--- a/server/nodes/google/calendar.py+++ b/server/nodes/google/calendar.py@@ -15,8 +15,7 @@ from ._base import build_google_service, run_sync, track_google_usageclass CalendarParams(BaseModel):- # Pre-refactor: unknown op -> "Unknown operation ..." from handler, not Pydantic.- operation: str = "list"+ operation: Literal["create", "list", "update", "delete"] = "list"calendar_id: str = Field(default="primary", alias="calendarId")event_id: Optional[str] = Field(default=None, alias="eventId")title: Optional[str] = Nonediff --git a/server/nodes/google/contacts.py b/server/nodes/google/contacts.pyindex 41176165..a6ddbabe 100644--- a/server/nodes/google/contacts.py+++ b/server/nodes/google/contacts.py@@ -14,7 +14,7 @@ from ._base import build_google_service, run_sync, track_google_usageclass ContactsParams(BaseModel):- operation: str = "list" # handler dispatches; unknown op raised from body+ operation: Literal["create", "list", "search", "get", "update", "delete"] = "list"resource_name: Optional[str] = Field(default=None, alias="resourceName")first_name: Optional[str] = Field(default=None, alias="firstName")last_name: Optional[str] = Field(default=None, alias="lastName")diff --git a/server/nodes/google/drive.py b/server/nodes/google/drive.pyindex 989cbc5b..7f4c6d24 100644--- a/server/nodes/google/drive.py+++ b/server/nodes/google/drive.py@@ -18,7 +18,7 @@ from ._base import build_google_service, run_sync, track_google_usageclass DriveParams(BaseModel):- operation: str = "list" # handler dispatches; unknown op raised from body+ operation: Literal["upload", "download", "list", "share"] = "list"file_id: Optional[str] = Field(default=None, alias="fileId")filename: Optional[str] = Nonefile_url: Optional[str] = Field(default=None, alias="fileUrl")diff --git a/server/nodes/google/gmail.py b/server/nodes/google/gmail.pyindex 4aa5e62b..acd21bf2 100644--- a/server/nodes/google/gmail.py+++ b/server/nodes/google/gmail.py@@ -18,7 +18,7 @@ from ._gmail import fetch_email_details, format_messageclass GmailParams(BaseModel):- operation: str = "send" # handler dispatches; unknown op raised from body+ operation: Literal["send", "search", "read"] = "send"to: str = Field(default="",diff --git a/server/nodes/google/sheets.py b/server/nodes/google/sheets.pyindex a6d47a58..250f320d 100644--- a/server/nodes/google/sheets.py+++ b/server/nodes/google/sheets.py@@ -18,7 +18,7 @@ from ._base import build_google_service, run_sync, track_google_usageclass SheetsParams(BaseModel):- operation: str = "read" # handler dispatches; unknown op raised from body+ operation: Literal["read", "write", "append"] = "read"spreadsheet_id: str = Field(default="", alias="spreadsheetId")range: str = Field(default="A1:Z1000")values: Any = Field(default_factory=list)diff --git a/server/nodes/google/tasks.py b/server/nodes/google/tasks.pyindex 1698fedb..2dc7e274 100644--- a/server/nodes/google/tasks.py+++ b/server/nodes/google/tasks.py@@ -18,7 +18,7 @@ def _ensure_rfc3339(due: str) -> str:class TasksParams(BaseModel):- operation: str = "list" # handler dispatches; unknown op raised from body+ operation: Literal["create", "list", "complete", "update", "delete"] = "list"tasklist_id: str = Field(default="@default", alias="tasklistId")task_id: Optional[str] = Field(default=None, alias="taskId")title: Optional[str] = Nonediff --git a/server/nodes/model/_base.py b/server/nodes/model/_base.pyindex 63a8dadb..3c6afc41 100644--- a/server/nodes/model/_base.py+++ b/server/nodes/model/_base.py@@ -51,16 +51,6 @@ class ChatModelParams(BaseModel):default=1.0, alias="topP", ge=0.0, le=1.0,json_schema_extra={"numberStepSize": 0.1},)- # Thinking / reasoning knobs (Anthropic extended thinking, Gemini- # thinking budget, OpenAI o-series reasoning effort, Groq reasoning- # format). Pre-refactor handler forwarded these verbatim; provider- # plugins that don't support them simply ignore the keys downstream.- thinking_enabled: bool = Field(default=False, alias="thinkingEnabled")- thinking_budget: Optional[int] = Field(- default=None, alias="thinkingBudget", ge=0, le=64000,- )- reasoning_effort: Optional[str] = Field(default=None, alias="reasoningEffort")- reasoning_format: Optional[str] = Field(default=None, alias="reasoningFormat")model_config = ConfigDict(populate_by_name=True, extra="ignore")@@ -93,32 +83,12 @@ class ChatModelBase(ActionNode, abstract=True):@Operation("chat", cost={"service": "chat_model", "action": "chat", "count": 1})async def chat(self, ctx: NodeContext, params: ChatModelParams) -> Any:- from constants import detect_ai_providerfrom core.container import containerai_service = container.ai_service()- payload = params.model_dump(by_alias=True)-- # Pre-refactor contract: NodeExecutor._inject_api_keys fetched the- # key from auth_service and wrote it into the params dict under- # the snake_case `api_key` key. Preserve that wire format so- # downstream execute_chat + telemetry see the resolved credential- # in the same place it always lived. Fetch missing, then mirror- # the aliased form into snake_case.- if not payload.get("api_key") and not payload.get("apiKey"):- provider = detect_ai_provider(self.type, payload)- try:- resolved = await ai_service.auth.get_api_key(provider)- except Exception:- resolved = None- if resolved:- payload["api_key"] = resolved- payload["apiKey"] = resolved- elif payload.get("apiKey") and not payload.get("api_key"):- # Pydantic emitted the camelCase alias; ensure snake_case also set.- payload["api_key"] = payload["apiKey"]-- response = await ai_service.execute_chat(ctx.node_id, self.type, payload)+ response = await ai_service.execute_chat(+ ctx.node_id, self.type, params.model_dump(by_alias=True),+ )if response.get("success"):return response.get("result") or responseraise RuntimeError(response.get("error") or f"{self.type} chat failed")diff --git a/server/nodes/proxy/proxy_request.py b/server/nodes/proxy/proxy_request.pyindex f31c9925..5fcd0a39 100644--- a/server/nodes/proxy/proxy_request.py+++ b/server/nodes/proxy/proxy_request.py@@ -71,12 +71,6 @@ class ProxyRequestNode(ActionNode):from ._usage import track_proxy_usagelog = get_logger(__name__)-- # Pre-refactor contract: empty URL short-circuits with a clear- # "URL is required" error before contacting the proxy service.- if not params.url.strip():- raise ValueError("URL is required")-svc = get_proxy_service()if not svc or not svc.is_enabled():raise RuntimeError(diff --git a/server/nodes/scheduler/timer.py b/server/nodes/scheduler/timer.pyindex a39ffbdb..a323b733 100644--- a/server/nodes/scheduler/timer.py+++ b/server/nodes/scheduler/timer.py@@ -15,10 +15,8 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass TimerParams(BaseModel):- # Pre-refactor contract accepted 0 (instant completion) and any- # unit string, silently falling back to raw seconds for unknown units.- duration: int = Field(default=1, ge=0, le=86400)- unit: str = Field(default="seconds")+ duration: int = Field(default=1, ge=1, le=86400)+ unit: Literal["seconds", "minutes", "hours"] = "seconds"model_config = ConfigDict(extra="ignore")diff --git a/server/nodes/scraper/crawlee_scraper.py b/server/nodes/scraper/crawlee_scraper.pyindex ec6988c1..e0bc574c 100644--- a/server/nodes/scraper/crawlee_scraper.py+++ b/server/nodes/scraper/crawlee_scraper.py@@ -170,9 +170,10 @@ async def _run_playwright(url, pages, p, proxy_config, css_selector, extract_linclass CrawleeScraperParams(BaseModel):url: str = Field(default="")- # Pre-refactor: unknown crawler_type / mode -> handler error.- crawler_type: str = Field(default="beautifulsoup", alias="crawlerType")- mode: str = Field(default="single")+ crawler_type: Literal["beautifulsoup", "playwright", "adaptive"] = Field(+ default="beautifulsoup", alias="crawlerType",+ )+ mode: Literal["single", "crawl"] = "single"css_selector: str = Field(default="", alias="cssSelector")extract_links: bool = Field(default=False, alias="extractLinks")max_pages: int = Field(default=10, alias="maxPages", ge=1, le=1000)diff --git a/server/nodes/search/brave_search.py b/server/nodes/search/brave_search.pyindex 51fdf2ec..5be82573 100644--- a/server/nodes/search/brave_search.py+++ b/server/nodes/search/brave_search.py@@ -53,7 +53,7 @@ class BraveSearchOutput(BaseModel):class BraveSearchParams(BaseModel):query: str = Field(..., description="Search query", min_length=1)- max_results: int = Field(default=10, alias="maxResults", ge=1, le=100)+ max_results: int = Field(default=10, alias="maxResults", ge=1, le=20)country: str = Field(default="", description="ISO country code (e.g. US, GB)")search_lang: str = Field(default="en", alias="searchLang")safe_search: Literal["off", "moderate", "strict"] = Field(@@ -86,11 +86,6 @@ class BraveSearchNode(ActionNode):@Operation("search", cost={"service": "brave_search", "action": "web_search", "count": 1})async def search(self, ctx: NodeContext, params: BraveSearchParams) -> BraveSearchOutput:- # Pre-refactor: handler short-circuited whitespace/empty queries- # with "query is required" (matches old error string in tests).- if not params.query.strip():- raise ValueError("query is required")-qs: dict = {"q": params.query, "count": min(params.max_results, 20)}if params.country:qs["country"] = params.countrydiff --git a/server/nodes/search/perplexity_search.py b/server/nodes/search/perplexity_search.pyindex 8c60b4a8..2a5d0ee8 100644--- a/server/nodes/search/perplexity_search.py+++ b/server/nodes/search/perplexity_search.py@@ -9,7 +9,7 @@ add more lines than it saves.from __future__ import annotations-from typing import Any, List, Literal, Optional+from typing import List, Literal, Optionalfrom pydantic import BaseModel, Field@@ -41,9 +41,7 @@ class PerplexitySearchOutput(BaseModel):answer: str = ""citations: List[str] = Field(default_factory=list)results: List[PerplexityResult] = Field(default_factory=list)- # Pre-refactor contract accepted list[str] OR list[dict]; Perplexity- # has historically returned both shapes across model versions.- images: Optional[List[Any]] = None+ images: Optional[List[dict]] = Nonerelated_questions: Optional[List[str]] = Nonemodel: str = "sonar"provider: Literal["perplexity"] = "perplexity"diff --git a/server/nodes/search/serper_search.py b/server/nodes/search/serper_search.pyindex 14eae1a1..459ed7a3 100644--- a/server/nodes/search/serper_search.py+++ b/server/nodes/search/serper_search.py@@ -30,10 +30,6 @@ class SerperSearchResult(BaseModel):snippet: str = ""url: str = ""position: Optional[int] = None- # News-vertical extras (populated only by the news branch; Optional so- # web/images/places results don't emit empty strings).- date: Optional[str] = None- source: Optional[str] = Noneclass SerperSearchOutput(BaseModel):@@ -47,8 +43,9 @@ class SerperSearchOutput(BaseModel):class SerperSearchParams(BaseModel):query: str = Field(..., min_length=1)- # Pre-refactor: unknown search_type fell back to web endpoint handler-side.- search_type: str = Field(default="search", alias="searchType")+ search_type: Literal["search", "news", "images", "places"] = Field(+ default="search", alias="searchType",+ )max_results: int = Field(default=10, alias="maxResults", ge=1, le=100)country: str = Field(default="")language: str = Field(default="en")@@ -119,8 +116,6 @@ class SerperSearchNode(ActionNode):title=item.get("title", ""),snippet=item.get("snippet", ""),url=item.get("link", ""),- date=item.get("date") or None,- source=item.get("source") or None,))elif params.search_type == "images":for item in (data.get("images") or [])[: params.max_results]:diff --git a/server/nodes/skill/simple_memory.py b/server/nodes/skill/simple_memory.pyindex 5b44feae..9af34919 100644--- a/server/nodes/skill/simple_memory.py+++ b/server/nodes/skill/simple_memory.py@@ -21,14 +21,12 @@ logger = get_logger(__name__)class SimpleMemoryParams(BaseModel):session_id: str = Field(default="default", alias="sessionId")- memory_type: str = Field(default="buffer", alias="memoryType")window_size: int = Field(default=10, alias="windowSize", ge=1, le=100)memory_content: str = Field(default="# Conversation History\n",alias="memoryContent",json_schema_extra={"rows": 12},)- clear_on_run: bool = Field(default=False, alias="clearOnRun")long_term_enabled: bool = Field(default=False, alias="longTermEnabled")retrieval_count: int = Field(default=3, alias="retrievalCount", ge=1, le=20,diff --git a/server/nodes/social/_base.py b/server/nodes/social/_base.pyindex 3cd613e5..b26be680 100644--- a/server/nodes/social/_base.py+++ b/server/nodes/social/_base.py@@ -208,13 +208,8 @@ async def handle_social_receive(parameters: Dict[str, Any],context: Dict[str, Any],outputs: Dict[str, Any] = None,- source_nodes: list = None,- connected_outputs: Dict[str, Any] = None,+ source_nodes: list = None) -> Dict[str, Any]:- # Back-compat: pre-refactor NodeExecutor passed connected_outputs as- # the keyword; the plugin now forwards it under either name.- if outputs is None and connected_outputs is not None:- outputs = connected_outputs"""Handle Social Receive node - normalizes and filters incoming messages.This node connects to platform-specific triggers (WhatsApp Receive, etc.)diff --git a/server/nodes/telegram/telegram_send.py b/server/nodes/telegram/telegram_send.pyindex b1744932..b22ff7d1 100644--- a/server/nodes/telegram/telegram_send.py+++ b/server/nodes/telegram/telegram_send.py@@ -18,14 +18,16 @@ from ._credentials import TelegramCredentialclass TelegramSendParams(BaseModel):- # Pre-refactor: unknown recipient/message type -> handler error, not- # Pydantic ValidationError.- recipient_type: str = Field(default="self", alias="recipientType")+ 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: str = Field(default="text", alias="messageType")+ 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"]}}},diff --git a/server/nodes/text/file_handler.py b/server/nodes/text/file_handler.pyindex 76d77070..51667e8d 100644--- a/server/nodes/text/file_handler.py+++ b/server/nodes/text/file_handler.py@@ -11,7 +11,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass FileHandlerParams(BaseModel):operation: Literal["read", "write", "append", "delete"] = "read"- file_path: str = Field(default="", alias="filePath")+ file_path: str = Field(..., alias="filePath")content: str = Field(default="")encoding: str = Field(default="utf-8")diff --git a/server/nodes/twitter/twitter_send.py b/server/nodes/twitter/twitter_send.pyindex d39aca66..1dbf2e48 100644--- a/server/nodes/twitter/twitter_send.py+++ b/server/nodes/twitter/twitter_send.py@@ -17,7 +17,7 @@ from ._base import (class TwitterSendParams(BaseModel):- action: str = "tweet" # unknown action -> handler "Unknown action" error+ action: Literal["tweet", "reply", "retweet", "like", "unlike", "delete"] = "tweet"text: str = Field(default="")tweet_id: str = Field(default="", alias="tweetId")reply_to_id: str = Field(default="", alias="replyToId")@@ -26,12 +26,8 @@ class TwitterSendParams(BaseModel):class TwitterSendOutput(BaseModel):- # Pre-refactor: response fields (id, text, ...) land at the top- # level of the envelope, not under a `data` wrapper. Declared as- # Optional[str] so Pydantic doesn't complain when they're absent.action: Optional[str] = None- id: Optional[str] = None- text: Optional[str] = None+ data: Optional[dict] = Nonemodel_config = ConfigDict(extra="allow")@@ -43,8 +39,7 @@ async def _do_send(client, action: str, p: dict, node_id: str, ctx_raw: dict) ->raise RuntimeError("Tweet text is required")result = await asyncio.to_thread(client.posts.create, body={"text": text[:280]})await track_twitter_usage(node_id, "tweet", 1, ctx_raw)- resp = format_response(result)- return TwitterSendOutput(action="tweet_sent", **(resp if isinstance(resp, dict) else {}))+ return TwitterSendOutput(action="tweet_sent", data=format_response(result))if action == "reply":text = p.get("text", "")@@ -56,8 +51,7 @@ async def _do_send(client, action: str, p: dict, node_id: str, ctx_raw: dict) ->body={"text": text[:280], "reply": {"in_reply_to_tweet_id": reply_to}},)await track_twitter_usage(node_id, "reply", 1, ctx_raw)- resp = format_response(result)- return TwitterSendOutput(action="reply_sent", **(resp if isinstance(resp, dict) else {}))+ return TwitterSendOutput(action="reply_sent", data=format_response(result))tweet_id = p.get("tweetId") or p.get("tweet_id")if not tweet_id:diff --git a/server/nodes/twitter/twitter_user.py b/server/nodes/twitter/twitter_user.pyindex ee0bd136..8641cfbc 100644--- a/server/nodes/twitter/twitter_user.py+++ b/server/nodes/twitter/twitter_user.py@@ -15,11 +15,10 @@ from ._base import call_with_retry, format_user, get_my_user_id, track_twitter_uclass TwitterUserParams(BaseModel):- operation: str = "me" # unknown op -> handler error, not Pydantic+ operation: Literal["me", "by_username", "by_id", "followers", "following"] = "me"username: str = Field(default="")user_id: str = Field(default="", alias="userId")- # Pre-refactor: max_results accepted any int (handler clamped internally).- max_results: int = Field(default=100, alias="maxResults", ge=1)+ max_results: int = Field(default=100, alias="maxResults", ge=1, le=1000)model_config = ConfigDict(populate_by_name=True, extra="ignore")diff --git a/server/nodes/utility/console.py b/server/nodes/utility/console.pyindex 039851a9..d65c1153 100644--- a/server/nodes/utility/console.py+++ b/server/nodes/utility/console.py@@ -163,16 +163,7 @@ class ConsoleNode(ActionNode):log_value = input_datacase "field":if field_path:- # Pre-refactor contract: dot / bracket notation always- # navigates; a bare key that isn't in input_data is- # only treated as a literal when it clearly isn't a- # path expression. This order lets `data.items[1].name`- # resolve even when `data.items[1].name` is not itself- # a top-level input_data key.- has_path_syntax = "." in field_path or "[" in field_path- if has_path_syntax or field_path in input_data:- log_value = _navigate_field_path(input_data, field_path)- elif "{{" not in field_path:+ if "{{" not in field_path and field_path not in input_data:log_value = field_pathelse:log_value = _navigate_field_path(input_data, field_path)@@ -198,15 +189,12 @@ class ConsoleNode(ActionNode):"source_node_label": source_info.get("label") if source_info else None,})- # Pass through original input for downstream nodes. `data` is the- # user-selected log value (after field-path navigation), so it must- # not be overwritten by the raw input_data spread below; put the- # spread first, then the console-owned keys.+ # Pass through original input for downstream nodes.return {- **input_data,"label": label or f"Console ({ctx.node_id[:8]})","logged_at": datetime.now().isoformat(),"format": format_type,"data": log_value,"formatted": formatted_output,+ **input_data,}diff --git a/server/nodes/utility/process_manager.py b/server/nodes/utility/process_manager.pyindex 3492cd23..22e244b0 100644--- a/server/nodes/utility/process_manager.py+++ b/server/nodes/utility/process_manager.py@@ -10,9 +10,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass ProcessManagerParams(BaseModel):- # Pre-refactor contract: unknown op -> "Unknown operation ..."- # from handler, not Pydantic error.- operation: str = Field(default="list")+ operation: Literal["start", "stop", "restart", "list", "send_input", "get_output"] = "list"name: str = Field(default="")command: str = Field(default="")cwd: str = Field(default="")@@ -69,30 +67,19 @@ class ProcessManagerNode(ActionNode):op = params.operationname = _clean(params.name)- # Pre-refactor contract: the envelope the service returns is- # `{success, result: {...}, error?}`; the plugin's own return- # should be the INNER result dict so downstream gets the flat- # shape (name, status, pid, ...) at `result["result"]`.- def _unwrap(envelope: Any) -> Any:- if isinstance(envelope, dict) and "result" in envelope and "success" in envelope:- if not envelope.get("success"):- raise RuntimeError(envelope.get("error") or "Process service error")- return envelope.get("result") or {}- return envelope-if op == "start":- return _unwrap(await svc.start(+ return await svc.start(name=name,command=_clean(params.command),workflow_id=workflow_id,working_directory=_clean(params.cwd) or agent_dir,- ))+ )if op == "stop":- return _unwrap(await svc.stop(name, workflow_id))+ return await svc.stop(name, workflow_id)if op == "restart":- return _unwrap(await svc.restart(name, workflow_id))+ return await svc.restart(name, workflow_id)if op == "send_input":- return _unwrap(await svc.send_input(name, workflow_id, _clean(params.input_text)))+ return await svc.send_input(name, workflow_id, _clean(params.input_text))if op == "list":return {"processes": svc.list_processes(workflow_id)}if op == "get_output":diff --git a/server/nodes/utility/team_monitor.py b/server/nodes/utility/team_monitor.pyindex 543fa301..a522111b 100644--- a/server/nodes/utility/team_monitor.py+++ b/server/nodes/utility/team_monitor.py@@ -12,9 +12,6 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass TeamMonitorParams(BaseModel):team_id: str = Field(default="", alias="teamId")auto_refresh: bool = Field(default=True, alias="autoRefresh")- max_history_items: int = Field(- default=50, alias="maxHistoryItems", ge=1, le=1000,- )model_config = ConfigDict(populate_by_name=True, extra="allow")@@ -69,7 +66,7 @@ class TeamMonitorNode(ActionNode):}status = await get_agent_team_service().get_team_status(team_id)- max_history = params.max_history_items+ max_history = ctx.raw.get("parameters", {}).get("maxHistoryItems", 50)return {"team_id": team_id,"members": status.get("members", []),diff --git a/server/nodes/utility/webhook_response.py b/server/nodes/utility/webhook_response.pyindex 6444fce4..73e2e93a 100644--- a/server/nodes/utility/webhook_response.py+++ b/server/nodes/utility/webhook_response.py@@ -11,7 +11,7 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass WebhookResponseParams(BaseModel):status_code: int = Field(default=200, alias="statusCode", ge=100, le=599)- body: Any = Field(default=None, alias="responseBody")+ body: Any = Field(default=None)headers: Dict[str, str] = Field(default_factory=dict)content_type: str = Field(default="application/json", alias="contentType")diff --git a/server/nodes/whatsapp/whatsapp_db.py b/server/nodes/whatsapp/whatsapp_db.pyindex fd1460ac..4f54e9c0 100644--- a/server/nodes/whatsapp/whatsapp_db.py+++ b/server/nodes/whatsapp/whatsapp_db.py@@ -15,8 +15,15 @@ from services.plugin import ActionNode, NodeContext, Operation, TaskQueueclass WhatsAppDbParams(BaseModel):- # Pre-refactor contract: unknown op -> "Unknown operation ..." from handler.- operation: str = Field(default="chat_history")+ operation: Literal[+ "chat_history", "search_groups", "get_group_info",+ "get_contact_info", "list_contacts", "check_contacts",+ "list_channels", "get_channel_info", "channel_messages",+ "channel_stats", "channel_follow", "channel_unfollow",+ "channel_create", "channel_mute", "channel_mark_viewed",+ "newsletter_react", "newsletter_live_updates",+ "contact_profile_pic",+ ] = "chat_history"chat_id: str = Field(default="", alias="chatId")group_id: str = Field(default="", alias="groupId")phone_number: str = Field(default="", alias="phoneNumber")@@ -65,7 +72,7 @@ class WhatsAppDbNode(ActionNode):from ._base import handle_whatsapp_dbresponse = await handle_whatsapp_db(node_id=ctx.node_id, node_type=self.type,- parameters=params.model_dump(by_alias=False), context=ctx.raw,+ parameters=params.model_dump(by_alias=True), context=ctx.raw,)if response.get("success"):return response.get("result") or responsediff --git a/server/services/plugin/base.py b/server/services/plugin/base.pyindex b37ce8a4..0aeeda93 100644--- a/server/services/plugin/base.py+++ b/server/services/plugin/base.py@@ -221,12 +221,9 @@ class BaseNode:op_name = self._pick_operation(parameters)op_spec = self._operations.get(op_name)if op_spec is None:- # Pre-refactor error wording: "Unknown <node_type> operation: <op>"- # so tests that assert `"unknown gmail operation"` etc. continue- # to match via lowercase-contains.return self._wrap_error(start_time=start_time,- error=f"Unknown {self.type} operation: '{op_name}'",+ error=f"Unknown operation '{op_name}' for node {self.type}",error_type="InvalidParametersError",)@@ -321,15 +318,9 @@ class BaseNode:return await method(ctx, params_obj)def _wrap_success(self, *, start_time: float, result: Any) -> Dict[str, Any]:- """95%-universal return shape. Subclasses (ToolNode) override.-- ``exclude_none=True`` preserves the pre-refactor contract where- Optional output fields were absent from the payload (rather than- present-but-None). Plugins that want an explicit None can return- a plain dict instead of a ``BaseModel``.- """+ """95%-universal return shape. Subclasses (ToolNode) override."""if isinstance(result, BaseModel):- result_data: Any = result.model_dump(exclude_none=True)+ result_data: Any = result.model_dump()else:result_data = resultreturn {diff --git a/server/services/plugin/trigger.py b/server/services/plugin/trigger.pyindex a34f7527..2b84403e 100644--- a/server/services/plugin/trigger.py+++ b/server/services/plugin/trigger.py@@ -80,8 +80,6 @@ class TriggerNode(BaseNode, abstract=True):Deployment-mode long-running watches are driven by:class:`TriggerManager`, not this method."""- import asyncio- import inspectimport timefrom services import event_waiter@@ -93,24 +91,13 @@ class TriggerNode(BaseNode, abstract=True):return self._wrap_error(start_time=start_time, error=f"Invalid parameters: {e}")if self.mode == "event":- # ``event_waiter.register`` is declared ``async def`` in the- # real module but tests patch it as a sync MagicMock returning- # a waiter with a pre-resolved ``.future``. Handle both shapes- # so production + test paths remain symmetric.- registered = event_waiter.register(+ waiter = event_waiter.register(node_type=self.type,node_id=node_id,params=parameters,)- waiter = (- await registered if inspect.isawaitable(registered) else registered- )try:event_data = await waiter.future- except asyncio.CancelledError:- return self._wrap_error(- start_time=start_time, error="Cancelled by user",- )except Exception as e:return self._wrap_error(start_time=start_time, error=str(e))return self._wrap_success(start_time=start_time, result=event_data)