Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(schema): Wave 8 - slim socialNodes (-624 LOC, biggest batch yet)
trohitg23c3f353ede5
diff --git a/client/src/nodeDefinitions/socialNodes.ts b/client/src/nodeDefinitions/socialNodes.tsindex 999dac66..ca07cf08 100644--- a/client/src/nodeDefinitions/socialNodes.ts+++ b/client/src/nodeDefinitions/socialNodes.ts@@ -15,57 +15,8 @@ const SOCIAL_RECEIVE_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/// Social Send - Paper plane with globe (multi-platform send)const SOCIAL_SEND_ICON = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%236366F1'%3E%3Cpath d='M2.01 21L23 12 2.01 3 2 10l15 2-15 2z'/%3E%3Ccircle cx='18' cy='18' r='4' fill='%236366F1' stroke='%23fff' stroke-width='1'/%3E%3Cpath d='M18 15.5c-1.38 0-2.5 1.12-2.5 2.5s1.12 2.5 2.5 2.5 2.5-1.12 2.5-2.5-1.12-2.5-2.5-2.5zm0 1c.28 0 .5.22.5.5v1h1c.28 0 .5.22.5.5s-.22.5-.5.5h-1v1c0 .28-.22.5-.5.5s-.5-.22-.5-.5v-1h-1c-.28 0-.5-.22-.5-.5s.22-.5.5-.5h1v-1c0-.28.22-.5.5-.5z' fill='%23fff'/%3E%3C/svg%3E";-// ============================================================================-// CHANNEL OPTIONS - All supported platforms-// ============================================================================-const CHANNEL_OPTIONS = [- { name: 'All Channels', value: 'all' },- { name: 'WhatsApp', value: 'whatsapp' },- { name: 'Telegram', value: 'telegram' },- { name: 'Discord', value: 'discord' },- { name: 'Slack', value: 'slack' },- { name: 'Signal', value: 'signal' },- { name: 'SMS', value: 'sms' },- { name: 'Webchat', value: 'webchat' },- { name: 'Email', value: 'email' },- { name: 'Matrix', value: 'matrix' },- { name: 'Teams', value: 'teams' }-];--// For send node (no "All Channels" option)-const SEND_CHANNEL_OPTIONS = CHANNEL_OPTIONS.filter(opt => opt.value !== 'all');--// ============================================================================-// MESSAGE TYPE OPTIONS-// ============================================================================-const MESSAGE_TYPE_OPTIONS = [- { name: 'All Types', value: 'all' },- { name: 'Text', value: 'text' },- { name: 'Image', value: 'image' },- { name: 'Video', value: 'video' },- { name: 'Audio', value: 'audio' },- { name: 'Document', value: 'document' },- { name: 'Sticker', value: 'sticker' },- { name: 'Location', value: 'location' },- { name: 'Contact', value: 'contact' },- { name: 'Poll', value: 'poll' },- { name: 'Reaction', value: 'reaction' }-];--// For send node (no "All Types" option, plus buttons/list)-const SEND_MESSAGE_TYPE_OPTIONS = [- { name: 'Text', value: 'text' },- { name: 'Image', value: 'image' },- { name: 'Video', value: 'video' },- { name: 'Audio', value: 'audio' },- { name: 'Document', value: 'document' },- { name: 'Sticker', value: 'sticker' },- { name: 'Location', value: 'location' },- { name: 'Contact', value: 'contact' },- { name: 'Poll', value: 'poll' },- { name: 'Buttons', value: 'buttons' },- { name: 'List', value: 'list' }-];+// Wave 8: channel + message-type option lists now live in+// SocialReceiveParams / SocialSendParams Pydantic enums.// ============================================================================// SOCIAL NODES@@ -114,102 +65,12 @@ export const socialNodes: Record<string, INodeTypeDescription> = {description: 'Message metadata: message_id, chat_id, timestamp, is_forwarded, is_from_me, reply_to'}],+ // Wave 8: schema lives on backend (SocialReceiveParams).properties: [- // ===== CHANNEL FILTER =====- {- displayName: 'Channel Filter',- name: 'channelFilter',- type: 'options',- options: CHANNEL_OPTIONS,- default: 'all',- description: 'Filter messages by source platform'- },-- // ===== MESSAGE TYPE FILTER =====- {- displayName: 'Message Type',- name: 'messageTypeFilter',- type: 'options',- options: MESSAGE_TYPE_OPTIONS,- default: 'all',- description: 'Filter by message content type'- },-- // ===== SENDER FILTER =====- {- displayName: 'Sender Filter',- name: 'senderFilter',- type: 'options',- options: [- { name: 'All Messages', value: 'all' },- { name: 'From Any Contact (Non-Group)', value: 'any_contact' },- { name: 'From Specific Contact', value: 'contact' },- { name: 'From Specific Group', value: 'group' },- { name: 'Contains Keywords', value: 'keywords' }- ],- default: 'all',- description: 'Filter which messages trigger the workflow'- },- {- displayName: 'Contact Phone',- name: 'contactPhone',- type: 'string',- default: '',- required: true,- displayOptions: {- show: { senderFilter: ['contact'] }- },- placeholder: '1234567890',- description: 'Phone number to filter messages from (without + prefix)'- },- {- displayName: 'Group ID',- name: 'groupId',- type: 'string',- default: '',- required: true,- displayOptions: {- show: { senderFilter: ['group'] }- },- placeholder: '[email protected]',- description: 'Group identifier to filter messages from'- },- {- displayName: 'Keywords',- name: 'keywords',- type: 'string',- default: '',- required: true,- displayOptions: {- show: { senderFilter: ['keywords'] }- },- placeholder: 'help, support, info',- description: 'Comma-separated keywords to trigger on (case-insensitive)'- },-- // ===== OPTIONS =====- {- displayName: 'Ignore Own Messages',- name: 'ignoreOwnMessages',- type: 'boolean',- default: true,- description: 'Do not trigger on messages sent by this device'- },- {- displayName: 'Ignore Bots',- name: 'ignoreBots',- type: 'boolean',- default: false,- description: 'Do not trigger on messages from bots'- },- {- displayName: 'Include Media Data',- name: 'includeMediaData',- type: 'boolean',- default: false,- description: 'Include base64 media data in output (increases memory usage)'- }- ]+ { displayName: 'Contact Phone', name: 'contactPhone', type: 'string' as any, default: '', placeholder: '1234567890' },+ { displayName: 'Group ID', name: 'groupId', type: 'string' as any, default: '', placeholder: '[email protected]' },+ { displayName: 'Keywords', name: 'keywords', type: 'string' as any, default: '', placeholder: 'help, support, info' },+ ],},// Social Send - Unified outbound message (dual-purpose: workflow + AI tool)@@ -268,478 +129,17 @@ export const socialNodes: Record<string, INodeTypeDescription> = {description: 'Connect to AI Agent tool handle'}],+ // Wave 8: schema lives on backend (SocialSendParams).properties: [- // ===== CHANNEL SELECTION =====- {- displayName: 'Channel',- name: 'channel',- type: 'options',- options: SEND_CHANNEL_OPTIONS,- default: 'whatsapp',- description: 'Target chat platform'- },-- // ===== RECIPIENT =====- {- displayName: 'Send To',- name: 'recipientType',- type: 'options',- options: [- { name: 'Phone Number', value: 'phone' },- { name: 'Group', value: 'group' },- { name: 'Channel', value: 'channel' },- { name: 'User ID', value: 'user' },- { name: 'Chat ID', value: 'chat' }- ],- default: 'phone',- description: 'Type of recipient'- },- {- displayName: 'Phone Number',- name: 'phone',- type: 'string',- default: '',- required: true,- placeholder: '1234567890',- description: 'Recipient phone number (without + prefix)',- displayOptions: {- show: { recipientType: ['phone'] }- }- },- {- displayName: 'Group ID',- name: 'groupId',- type: 'string',- default: '',- required: true,- placeholder: '[email protected]',- description: 'Group identifier',- displayOptions: {- show: { recipientType: ['group'] }- }- },- {- displayName: 'Channel ID',- name: 'channelId',- type: 'string',- default: '',- required: true,- placeholder: 'C01234567',- description: 'Channel identifier',- displayOptions: {- show: { recipientType: ['channel'] }- }- },- {- displayName: 'User ID',- name: 'userId',- type: 'string',- default: '',- required: true,- placeholder: 'U01234567',- description: 'User identifier',- displayOptions: {- show: { recipientType: ['user'] }- }- },- {- displayName: 'Chat ID',- name: 'chatId',- type: 'string',- default: '',- required: true,- placeholder: 'chat_123456',- description: 'Generic chat identifier',- displayOptions: {- show: { recipientType: ['chat'] }- }- },- {- displayName: 'Thread ID',- name: 'threadId',- type: 'string',- default: '',- placeholder: 'thread_123',- description: 'Thread to reply in (optional)'- },-- // ===== MESSAGE TYPE =====- {- displayName: 'Message Type',- name: 'messageType',- type: 'options',- options: SEND_MESSAGE_TYPE_OPTIONS,- default: 'text',- description: 'Type of message to send'- },-- // ===== TEXT MESSAGE =====- {- displayName: 'Message',- name: 'message',- type: 'string',- default: '',- required: true,- typeOptions: { rows: 4 },- description: 'Text message content',- placeholder: 'Enter your message...',- displayOptions: {- show: { messageType: ['text'] }- }- },- {- displayName: 'Format',- name: 'format',- type: 'options',- options: [- { name: 'Plain Text', value: 'plain' },- { name: 'Markdown', value: 'markdown' },- { name: 'HTML', value: 'html' }- ],- default: 'plain',- description: 'Text formatting',- displayOptions: {- show: { messageType: ['text'] }- }- },-- // ===== MEDIA MESSAGES (image, video, audio, document, sticker) =====- {- displayName: 'Media Source',- name: 'mediaSource',- type: 'options',- options: [- { name: 'URL', value: 'url' },- { name: 'Base64 Data', value: 'base64' },- { name: 'File Path', value: 'file' }- ],- default: 'url',- description: 'Source of media data',- displayOptions: {- show: { messageType: ['image', 'video', 'audio', 'document', 'sticker'] }- }- },- {- displayName: 'Media URL',- name: 'mediaUrl',- type: 'string',- default: '',- required: true,- placeholder: 'https://example.com/image.jpg',- description: 'URL to download media from',- displayOptions: {- show: { messageType: ['image', 'video', 'audio', 'document', 'sticker'], mediaSource: ['url'] }- }- },- {- displayName: 'Media Data (Base64)',- name: 'mediaData',- type: 'string',- default: '',- required: true,- typeOptions: { rows: 3 },- description: 'Base64-encoded media data',- displayOptions: {- show: { messageType: ['image', 'video', 'audio', 'document', 'sticker'], mediaSource: ['base64'] }- }- },- {- displayName: 'File Path',- name: 'filePath',- type: 'string',- default: '',- required: true,- placeholder: '/path/to/file.jpg',- description: 'Server file path',- displayOptions: {- show: { messageType: ['image', 'video', 'audio', 'document', 'sticker'], mediaSource: ['file'] }- }- },- {- displayName: 'MIME Type',- name: 'mimeType',- type: 'string',- default: '',- placeholder: 'image/jpeg, video/mp4, audio/ogg',- description: 'MIME type of the media (auto-detected if empty)',- displayOptions: {- show: { messageType: ['image', 'video', 'audio', 'document', 'sticker'] }- }- },- {- displayName: 'Caption',- name: 'caption',- type: 'string',- default: '',- typeOptions: { rows: 2 },- description: 'Optional caption for media',- displayOptions: {- show: { messageType: ['image', 'video', 'document'] }- }- },- {- displayName: 'Filename',- name: 'filename',- type: 'string',- default: '',- placeholder: 'document.pdf',- description: 'Filename for document',- displayOptions: {- show: { messageType: ['document'] }- }- },-- // ===== LOCATION MESSAGE =====- {- displayName: 'Latitude',- name: 'latitude',- type: 'number',- default: 0,- required: true,- description: 'Location latitude',- displayOptions: {- show: { messageType: ['location'] }- }- },- {- displayName: 'Longitude',- name: 'longitude',- type: 'number',- default: 0,- required: true,- description: 'Location longitude',- displayOptions: {- show: { messageType: ['location'] }- }- },- {- displayName: 'Location Name',- name: 'locationName',- type: 'string',- default: '',- placeholder: 'San Francisco',- description: 'Display name for location',- displayOptions: {- show: { messageType: ['location'] }- }- },- {- displayName: 'Address',- name: 'address',- type: 'string',- default: '',- placeholder: 'California, USA',- description: 'Address text',- displayOptions: {- show: { messageType: ['location'] }- }- },-- // ===== CONTACT MESSAGE =====- {- displayName: 'Contact Name',- name: 'contactName',- type: 'string',- default: '',- required: true,- placeholder: 'John Doe',- description: 'Display name for contact',- displayOptions: {- show: { messageType: ['contact'] }- }- },- {- displayName: 'Contact Phone',- name: 'contactPhone',- type: 'string',- default: '',- placeholder: '+1234567890',- description: 'Contact phone number',- displayOptions: {- show: { messageType: ['contact'] }- }- },- {- displayName: 'Contact vCard',- name: 'vcard',- type: 'string',- default: '',- typeOptions: { rows: 4 },- placeholder: 'BEGIN:VCARD\nVERSION:3.0\nFN:John Doe\nTEL:+1234567890\nEND:VCARD',- description: 'vCard 3.0 format string (optional if phone provided)',- displayOptions: {- show: { messageType: ['contact'] }- }- },-- // ===== POLL MESSAGE =====- {- displayName: 'Poll Question',- name: 'pollQuestion',- type: 'string',- default: '',- required: true,- placeholder: 'What is your favorite color?',- description: 'Poll question',- displayOptions: {- show: { messageType: ['poll'] }- }- },- {- displayName: 'Poll Options',- name: 'pollOptions',- type: 'string',- default: '',- required: true,- placeholder: 'Red, Blue, Green, Yellow',- description: 'Comma-separated poll options',- displayOptions: {- show: { messageType: ['poll'] }- }- },- {- displayName: 'Allow Multiple',- name: 'pollAllowMultiple',- type: 'boolean',- default: false,- description: 'Allow multiple selections',- displayOptions: {- show: { messageType: ['poll'] }- }- },-- // ===== BUTTONS MESSAGE =====- {- displayName: 'Button Text',- name: 'buttonText',- type: 'string',- default: '',- required: true,- placeholder: 'Choose an option',- description: 'Text displayed above buttons',- displayOptions: {- show: { messageType: ['buttons'] }- }- },- {- displayName: 'Buttons (JSON)',- name: 'buttons',- type: 'string',- default: '[]',- required: true,- typeOptions: { rows: 4 },- placeholder: '[{"id": "btn1", "text": "Option 1"}, {"id": "btn2", "text": "Option 2"}]',- description: 'JSON array of button objects with id and text',- displayOptions: {- show: { messageType: ['buttons'] }- }- },-- // ===== LIST MESSAGE =====- {- displayName: 'List Title',- name: 'listTitle',- type: 'string',- default: '',- required: true,- placeholder: 'Select an option',- description: 'Title for the list',- displayOptions: {- show: { messageType: ['list'] }- }- },- {- displayName: 'Button Text',- name: 'listButtonText',- type: 'string',- default: 'View Options',- required: true,- description: 'Text for the list button',- displayOptions: {- show: { messageType: ['list'] }- }- },- {- displayName: 'List Sections (JSON)',- name: 'listSections',- type: 'string',- default: '[]',- required: true,- typeOptions: { rows: 6 },- placeholder: '[{"title": "Section 1", "rows": [{"id": "row1", "title": "Row 1", "description": "Description"}]}]',- description: 'JSON array of sections with rows',- displayOptions: {- show: { messageType: ['list'] }- }- },-- // ===== REPLY (QUOTE) =====- {- displayName: 'Reply To Message',- name: 'replyToMessage',- type: 'boolean',- default: false,- description: 'Quote an existing message'- },- {- displayName: 'Reply Message ID',- name: 'replyMessageId',- type: 'string',- default: '',- required: true,- placeholder: 'ABC123DEF456',- description: 'ID of message to reply to',- displayOptions: {- show: { replyToMessage: [true] }- }- },- {- displayName: 'Reply To Current',- name: 'replyToCurrent',- type: 'boolean',- default: false,- description: 'Reply to the message that triggered this workflow',- displayOptions: {- show: { replyToMessage: [true] }- }- },-- // ===== SEND OPTIONS =====- {- displayName: 'Send as Voice Note',- name: 'audioAsVoice',- type: 'boolean',- default: false,- description: 'Send audio as voice message',- displayOptions: {- show: { messageType: ['audio'] }- }- },- {- displayName: 'Disable Link Preview',- name: 'disablePreview',- type: 'boolean',- default: false,- description: 'Disable link preview in text messages',- displayOptions: {- show: { messageType: ['text'] }- }- },- {- displayName: 'Silent',- name: 'silent',- type: 'boolean',- default: false,- description: 'Send without notification sound'- },- {- displayName: 'Protect Content',- name: 'protectContent',- type: 'boolean',- default: false,- description: 'Prevent forwarding/saving (if supported)'- }- ]+ { displayName: 'Phone Number', name: 'phone', type: 'string' as any, default: '', placeholder: '1234567890' },+ { displayName: 'Group ID', name: 'groupId', type: 'string' as any, default: '', placeholder: '[email protected]' },+ { displayName: 'Channel ID', name: 'channelId', type: 'string' as any, default: '', placeholder: 'C01234567' },+ { displayName: 'User ID', name: 'userId', type: 'string' as any, default: '', placeholder: 'U01234567' },+ { displayName: 'Chat ID', name: 'chatId', type: 'string' as any, default: '', placeholder: 'chat_123456' },+ { displayName: 'Thread ID', name: 'threadId', type: 'string' as any, default: '', placeholder: 'thread_123' },+ { displayName: 'Message', name: 'message', type: 'string' as any, default: '', placeholder: 'Enter your message...' },+ { displayName: 'Media URL', name: 'mediaUrl', type: 'string' as any, default: '', placeholder: 'https://example.com/image.jpg' },+ ],}};diff --git a/server/models/nodes.py b/server/models/nodes.pyindex 76a5b906..6492dbda 100644--- a/server/models/nodes.py+++ b/server/models/nodes.py@@ -812,26 +812,88 @@ class TwitterUserParams(BaseNodeParams):class SocialReceiveParams(BaseNodeParams):"""Parameters for unified social receive trigger node."""type: Literal["socialReceive"]- platform_filter: str = Field(default="all", alias="platformFilter")- channel_filter: str = Field(default="", alias="channelFilter")+ channel_filter: str = Field(default="all", alias="channelFilter")message_type_filter: str = Field(default="all", alias="messageTypeFilter")+ sender_filter: Literal["all", "any_contact", "contact", "group", "keywords"] = Field(+ default="all",+ alias="senderFilter",+ json_schema_extra={"options": [+ {"name": "All Messages", "value": "all"},+ {"name": "From Any Contact (Non-Group)", "value": "any_contact"},+ {"name": "From Specific Contact", "value": "contact"},+ {"name": "From Specific Group", "value": "group"},+ {"name": "Contains Keywords", "value": "keywords"},+ ]},+ )+ contact_phone: str = Field(+ default="", alias="contactPhone",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["contact"]}}},+ )+ group_id: str = Field(+ default="", alias="groupId",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["group"]}}},+ )+ keywords: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"sender_filter": ["keywords"]}}},+ )+ ignore_own_messages: bool = Field(default=True, alias="ignoreOwnMessages")+ ignore_bots: bool = Field(default=False, alias="ignoreBots")+ include_media_data: bool = Field(default=False, alias="includeMediaData")class SocialSendParams(BaseNodeParams):"""Parameters for unified social send node."""type: Literal["socialSend"]- platform: Literal["whatsapp", "telegram", "discord", "slack", "signal", "sms", "webchat", "email", "matrix", "teams"] = "whatsapp"- recipient: str = ""+ channel: Literal["whatsapp", "telegram", "discord", "slack", "signal", "sms", "webchat", "email", "matrix", "teams"] = "whatsapp"+ recipient_type: Literal["phone", "group", "channel", "user", "chat"] = Field(+ default="phone", alias="recipientType",+ json_schema_extra={"options": [+ {"name": "Phone Number", "value": "phone"},+ {"name": "Group", "value": "group"},+ {"name": "Channel", "value": "channel"},+ {"name": "User ID", "value": "user"},+ {"name": "Chat ID", "value": "chat"},+ ]},+ )+ phone: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["phone"]}}},+ )+ group_id: str = Field(+ default="", alias="groupId",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["group"]}}},+ )+ channel_id: str = Field(+ default="", alias="channelId",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["channel"]}}},+ )+ user_id: str = Field(+ default="", alias="userId",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["user"]}}},+ )+ chat_id: str = Field(+ default="", alias="chatId",+ json_schema_extra={"displayOptions": {"show": {"recipient_type": ["chat"]}}},+ )+ thread_id: str = Field(default="", alias="threadId")message_type: Literal["text", "image", "video", "audio", "document", "sticker", "location", "contact", "poll", "buttons", "list"] = Field(default="text", alias="messageType")- text: str = Field(+ message: str = Field(default="",- json_schema_extra={"displayOptions": {"show": {"message_type": ["text", "buttons", "list"]}}},+ json_schema_extra={+ "displayOptions": {"show": {"message_type": ["text"]}},+ "rows": 4,+ },)media_url: str = Field(- default="",- alias="mediaUrl",+ default="", alias="mediaUrl",json_schema_extra={"displayOptions": {"show": {"message_type": ["image", "video", "audio", "document", "sticker"]}}},)+ caption: str = Field(+ default="",+ json_schema_extra={"displayOptions": {"show": {"message_type": ["image", "video", "document"]}}},+ )+ silent: bool = False# =============================================================================diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.pyindex 97dd1fc5..7fac0ce5 100644--- a/server/tests/test_node_spec.py+++ b/server/tests/test_node_spec.py@@ -178,10 +178,11 @@ class TestPhase3bCoverage:def test_social_send_platform_enum(self):spec = get_node_spec("socialSend")- platform = spec["inputs"]["properties"]["platform"]- assert "whatsapp" in platform["enum"]- assert "telegram" in platform["enum"]- assert "discord" in platform["enum"]+ # Wave 8 renamed: 'platform' -> 'channel' to match the frontend SOCIAL_SEND.+ channel = spec["inputs"]["properties"]["channel"]+ assert "whatsapp" in channel["enum"]+ assert "telegram" in channel["enum"]+ assert "discord" in channel["enum"]class TestPhase3cCoverage:@@ -503,6 +504,7 @@ class TestDisplayOptionsEnrichment:spec = get_node_spec("socialSend")media = spec["inputs"]["properties"]["mediaUrl"]assert "image" in media["displayOptions"]["show"]["message_type"]+ # 'text' is in the message field's gate, mediaUrl is gated on media types.assert "text" not in media["displayOptions"]["show"]["message_type"]def test_gmail_receive_label_carries_load_options(self):