Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(schema): Wave 6 - more displayOptions + loadOptionsMethod enrichment
trohitgaca8d1aa72a4
diff --git a/server/models/nodes.py b/server/models/nodes.pyindex e99c4fdf..e2eefef6 100644--- a/server/models/nodes.py+++ b/server/models/nodes.py@@ -158,9 +158,38 @@ class AndroidServiceParams(BaseNodeParams):class WhatsAppSendParams(BaseNodeParams):"""Parameters for WhatsApp send message node."""type: Literal["whatsappSend"]- phone_number: str = Field(default="", alias="phoneNumber")- message: str = ""- message_type: Literal["text", "image", "video", "audio", "document"] = Field(default="text", alias="messageType")+ recipient_type: Literal["self", "phone", "group", "channel"] = Field(default="self", alias="recipientType")+ phone_number: str = Field(+ default="",+ alias="phoneNumber",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["phone"]}}},+ )+ group_id: str = Field(+ default="",+ alias="groupId",+ json_schema_extra={+ "displayOptions": {"show": {"recipient_type": ["group"]}},+ "loadOptionsMethod": "whatsappGroups",+ },+ )+ channel_jid: str = Field(+ default="",+ alias="channelJid",+ json_schema_extra={+ "displayOptions": {"show": {"recipient_type": ["channel"]}},+ "loadOptionsMethod": "whatsappChannels",+ },+ )+ message: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["text"]}}},+ )+ message_type: Literal["text", "image", "video", "audio", "document", "sticker", "location", "contact"] = Field(default="text", alias="messageType")+ media_url: str = Field(+ default="",+ alias="mediaUrl",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["image", "video", "audio", "document", "sticker"]}}},+ )class WhatsAppReceiveParams(BaseNodeParams):@@ -489,8 +518,15 @@ class SocialSendParams(BaseNodeParams):platform: Literal["whatsapp", "telegram", "discord", "slack", "signal", "sms", "webchat", "email", "matrix", "teams"] = "whatsapp"recipient: str = ""message_type: Literal["text", "image", "video", "audio", "document", "sticker", "location", "contact", "poll", "buttons", "list"] = Field(default="text", alias="messageType")- text: str = ""- media_url: str = Field(default="", alias="mediaUrl")+ text: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["text", "buttons", "list"]}}},+ )+ media_url: str = Field(+ default="",+ alias="mediaUrl",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["image", "video", "audio", "document", "sticker"]}}},+ )# =============================================================================@@ -603,21 +639,52 @@ class EmailReceiveParams(BaseNodeParams):class GmailParams(BaseNodeParams):type: Literal["gmail"]operation: Literal["send", "search", "read"] = "send"- to: str = ""- subject: str = ""- body: str = ""- query: str = ""- message_id: str = Field(default="", alias="messageId")+ to: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"operation": ["send"]}}},+ )+ subject: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"operation": ["send"]}}},+ )+ body: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"operation": ["send"]}}},+ )+ query: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"operation": ["search"]}}},+ )+ message_id: str = Field(+ default="",+ alias="messageId",+ json_schema_extra={"displayOptions": {"show": {"operation": ["read"]}}},+ )class CalendarParams(BaseNodeParams):type: Literal["calendar"]operation: Literal["create", "list", "update", "delete"] = "list"calendar_id: str = Field(default="primary", alias="calendarId")- event_id: str = Field(default="", alias="eventId")- summary: str = ""- start_time: str = Field(default="", alias="startTime")- end_time: str = Field(default="", alias="endTime")+ event_id: str = Field(+ default="",+ alias="eventId",+ json_schema_extra={"displayOptions": {"show": {"operation": ["update", "delete"]}}},+ )+ summary: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"operation": ["create", "update"]}}},+ )+ start_time: str = Field(+ default="",+ alias="startTime",+ json_schema_extra={"displayOptions": {"show": {"operation": ["create", "update", "list"]}}},+ )+ end_time: str = Field(+ default="",+ alias="endTime",+ json_schema_extra={"displayOptions": {"show": {"operation": ["create", "update", "list"]}}},+ )class DriveParams(BaseNodeParams):diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.pyindex 5657d8f1..e3356919 100644--- a/server/tests/test_node_spec.py+++ b/server/tests/test_node_spec.py@@ -464,3 +464,38 @@ class TestDisplayOptionsEnrichment:for field in ["proxyCountry", "proxyProvider", "sessionType"]:prop = spec["inputs"]["properties"][field]assert prop["displayOptions"]["show"]["use_proxy"] == [True]++ def test_whatsapp_send_groupid_carries_load_options(self):+ # whatsappSend groupId field should route through loadOptionsMethod+ spec = get_node_spec("whatsappSend")+ group_id = spec["inputs"]["properties"]["groupId"]+ assert group_id["loadOptionsMethod"] == "whatsappGroups"+ assert group_id["displayOptions"]["show"]["recipient_type"] == ["group"]++ def test_whatsapp_send_channel_jid_carries_load_options(self):+ spec = get_node_spec("whatsappSend")+ channel = spec["inputs"]["properties"]["channelJid"]+ assert channel["loadOptionsMethod"] == "whatsappChannels"++ def test_whatsapp_send_media_shown_for_media_types(self):+ spec = get_node_spec("whatsappSend")+ media = spec["inputs"]["properties"]["mediaUrl"]+ assert "image" in media["displayOptions"]["show"]["message_type"]+ assert "document" in media["displayOptions"]["show"]["message_type"]++ def test_gmail_fields_gated_on_operation(self):+ spec = get_node_spec("gmail")+ assert spec["inputs"]["properties"]["to"]["displayOptions"]["show"]["operation"] == ["send"]+ assert spec["inputs"]["properties"]["query"]["displayOptions"]["show"]["operation"] == ["search"]+ assert spec["inputs"]["properties"]["messageId"]["displayOptions"]["show"]["operation"] == ["read"]++ def test_calendar_event_id_gated_on_update_delete(self):+ spec = get_node_spec("calendar")+ event_id = spec["inputs"]["properties"]["eventId"]+ assert event_id["displayOptions"]["show"]["operation"] == ["update", "delete"]++ def test_social_send_media_url_gated_on_message_type(self):+ spec = get_node_spec("socialSend")+ media = spec["inputs"]["properties"]["mediaUrl"]+ assert "image" in media["displayOptions"]["show"]["message_type"]+ assert "text" not in media["displayOptions"]["show"]["message_type"]