diff --git a/apps/sim/blocks/blocks/agent.ts b/apps/sim/blocks/blocks/agent.ts index 552416eb45..1ea2415436 100644 --- a/apps/sim/blocks/blocks/agent.ts +++ b/apps/sim/blocks/blocks/agent.ts @@ -2,6 +2,7 @@ import { AgentIcon } from '@/components/icons' import { isHosted } from '@/lib/environment' import { createLogger } from '@/lib/logs/console/logger' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import { getAllModelProviders, getBaseModelProviders, @@ -61,6 +62,7 @@ export const AgentBlock: BlockConfig = { type: 'agent', name: 'Agent', description: 'Build an agent', + authMode: AuthMode.ApiKey, longDescription: 'The Agent block is a core workflow block that is a wrapper around an LLM. It takes in system/user prompts and calls an LLM provider. It can also make tool calls by directly containing tools inside of its tool input. It can additionally return structured output.', docsLink: 'https://docs.sim.ai/blocks/agent', diff --git a/apps/sim/blocks/blocks/airtable.ts b/apps/sim/blocks/blocks/airtable.ts index 342297eda9..354ea43fe9 100644 --- a/apps/sim/blocks/blocks/airtable.ts +++ b/apps/sim/blocks/blocks/airtable.ts @@ -1,13 +1,15 @@ import { AirtableIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { AirtableResponse } from '@/tools/airtable/types' export const AirtableBlock: BlockConfig = { type: 'airtable', name: 'Airtable', description: 'Read, create, and update Airtable', + authMode: AuthMode.OAuth, longDescription: - 'Integrates Airtable into the workflow. Can create, get, list, or update Airtable records. Requires OAuth. Can be used in trigger mode to trigger a workflow when an update is made to an Airtable table.', + 'Integrates Airtable into the workflow. Can create, get, list, or update Airtable records. Can be used in trigger mode to trigger a workflow when an update is made to an Airtable table.', docsLink: 'https://docs.sim.ai/tools/airtable', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/browser_use.ts b/apps/sim/blocks/blocks/browser_use.ts index 955125e642..2de35d058a 100644 --- a/apps/sim/blocks/blocks/browser_use.ts +++ b/apps/sim/blocks/blocks/browser_use.ts @@ -1,13 +1,14 @@ import { BrowserUseIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { BrowserUseResponse } from '@/tools/browser_use/types' export const BrowserUseBlock: BlockConfig = { type: 'browser_use', name: 'Browser Use', description: 'Run browser automation tasks', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Browser Use into the workflow. Can navigate the web and perform actions as if a real user was interacting with the browser. Requires API Key.', + 'Integrate Browser Use into the workflow. Can navigate the web and perform actions as if a real user was interacting with the browser.', docsLink: 'https://docs.sim.ai/tools/browser_use', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/clay.ts b/apps/sim/blocks/blocks/clay.ts index f52d877718..5b16434943 100644 --- a/apps/sim/blocks/blocks/clay.ts +++ b/apps/sim/blocks/blocks/clay.ts @@ -1,13 +1,13 @@ import { ClayIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ClayPopulateResponse } from '@/tools/clay/types' export const ClayBlock: BlockConfig = { type: 'clay', name: 'Clay', description: 'Populate Clay workbook', - longDescription: - 'Integrate Clay into the workflow. Can populate a table with data. Requires an API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Clay into the workflow. Can populate a table with data.', docsLink: 'https://docs.sim.ai/tools/clay', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/confluence.ts b/apps/sim/blocks/blocks/confluence.ts index e4f4ee0980..9f98983b84 100644 --- a/apps/sim/blocks/blocks/confluence.ts +++ b/apps/sim/blocks/blocks/confluence.ts @@ -1,13 +1,14 @@ import { ConfluenceIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { ConfluenceResponse } from '@/tools/confluence/types' export const ConfluenceBlock: BlockConfig = { type: 'confluence', name: 'Confluence', description: 'Interact with Confluence', - longDescription: - 'Integrate Confluence into the workflow. Can read and update a page. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate Confluence into the workflow. Can read and update a page.', docsLink: 'https://docs.sim.ai/tools/confluence', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/discord.ts b/apps/sim/blocks/blocks/discord.ts index 432d875b74..edde8bf538 100644 --- a/apps/sim/blocks/blocks/discord.ts +++ b/apps/sim/blocks/blocks/discord.ts @@ -1,13 +1,15 @@ import { DiscordIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { DiscordResponse } from '@/tools/discord/types' export const DiscordBlock: BlockConfig = { type: 'discord', name: 'Discord', description: 'Interact with Discord', + authMode: AuthMode.BotToken, longDescription: - 'Integrate Discord into the workflow. Can send and get messages, get server information, and get a user’s information. Requires bot API key.', + 'Integrate Discord into the workflow. Can send and get messages, get server information, and get a user’s information.', category: 'tools', bgColor: '#E0E0E0', icon: DiscordIcon, diff --git a/apps/sim/blocks/blocks/elevenlabs.ts b/apps/sim/blocks/blocks/elevenlabs.ts index e503d9419b..8e3f1feb36 100644 --- a/apps/sim/blocks/blocks/elevenlabs.ts +++ b/apps/sim/blocks/blocks/elevenlabs.ts @@ -1,13 +1,13 @@ import { ElevenLabsIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ElevenLabsBlockResponse } from '@/tools/elevenlabs/types' export const ElevenLabsBlock: BlockConfig = { type: 'elevenlabs', name: 'ElevenLabs', description: 'Convert TTS using ElevenLabs', - longDescription: - 'Integrate ElevenLabs into the workflow. Can convert text to speech. Requires API key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate ElevenLabs into the workflow. Can convert text to speech.', docsLink: 'https://docs.sim.ai/tools/elevenlabs', category: 'tools', bgColor: '#181C1E', diff --git a/apps/sim/blocks/blocks/exa.ts b/apps/sim/blocks/blocks/exa.ts index 4d939e5cb3..eb39302ce6 100644 --- a/apps/sim/blocks/blocks/exa.ts +++ b/apps/sim/blocks/blocks/exa.ts @@ -1,13 +1,15 @@ import { ExaAIIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { ExaResponse } from '@/tools/exa/types' export const ExaBlock: BlockConfig = { type: 'exa', name: 'Exa', description: 'Search with Exa AI', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Exa into the workflow. Can search, get contents, find similar links, answer a question, and perform research. Requires API Key.', + 'Integrate Exa into the workflow. Can search, get contents, find similar links, answer a question, and perform research.', docsLink: 'https://docs.sim.ai/tools/exa', category: 'tools', bgColor: '#1F40ED', diff --git a/apps/sim/blocks/blocks/firecrawl.ts b/apps/sim/blocks/blocks/firecrawl.ts index 2cf2947dd2..6487f5d213 100644 --- a/apps/sim/blocks/blocks/firecrawl.ts +++ b/apps/sim/blocks/blocks/firecrawl.ts @@ -1,13 +1,14 @@ import { FirecrawlIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { FirecrawlResponse } from '@/tools/firecrawl/types' export const FirecrawlBlock: BlockConfig = { type: 'firecrawl', name: 'Firecrawl', description: 'Scrape or search the web', - longDescription: - 'Integrate Firecrawl into the workflow. Can search, scrape, or crawl websites. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Firecrawl into the workflow. Can search, scrape, or crawl websites.', docsLink: 'https://docs.sim.ai/tools/firecrawl', category: 'tools', bgColor: '#181C1E', diff --git a/apps/sim/blocks/blocks/generic_webhook.ts b/apps/sim/blocks/blocks/generic_webhook.ts index 22a94e13c9..bb2b048c3e 100644 --- a/apps/sim/blocks/blocks/generic_webhook.ts +++ b/apps/sim/blocks/blocks/generic_webhook.ts @@ -8,6 +8,7 @@ export const GenericWebhookBlock: BlockConfig = { category: 'triggers', icon: WebhookIcon, bgColor: '#10B981', // Green color for triggers + triggerAllowed: true, subBlocks: [ // Generic webhook configuration - always visible diff --git a/apps/sim/blocks/blocks/github.ts b/apps/sim/blocks/blocks/github.ts index c987d52730..963ea91a63 100644 --- a/apps/sim/blocks/blocks/github.ts +++ b/apps/sim/blocks/blocks/github.ts @@ -1,17 +1,20 @@ import { GithubIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GitHubResponse } from '@/tools/github/types' export const GitHubBlock: BlockConfig = { type: 'github', name: 'GitHub', description: 'Interact with GitHub or trigger workflows from GitHub events', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Github into the workflow. Can get get PR details, create PR comment, get repository info, and get latest commit. Requires github token API Key. Can be used in trigger mode to trigger a workflow when a PR is created, commented on, or a commit is pushed.', + 'Integrate Github into the workflow. Can get get PR details, create PR comment, get repository info, and get latest commit. Can be used in trigger mode to trigger a workflow when a PR is created, commented on, or a commit is pushed.', docsLink: 'https://docs.sim.ai/tools/github', category: 'tools', bgColor: '#181C1E', icon: GithubIcon, + triggerAllowed: true, subBlocks: [ { id: 'operation', diff --git a/apps/sim/blocks/blocks/gmail.ts b/apps/sim/blocks/blocks/gmail.ts index f837bc0c0b..adce423750 100644 --- a/apps/sim/blocks/blocks/gmail.ts +++ b/apps/sim/blocks/blocks/gmail.ts @@ -1,17 +1,20 @@ import { GmailIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GmailToolResponse } from '@/tools/gmail/types' export const GmailBlock: BlockConfig = { type: 'gmail', name: 'Gmail', description: 'Send Gmail or trigger workflows from Gmail events', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Gmail into the workflow. Can send, read, and search emails. Requires OAuth. Can be used in trigger mode to trigger a workflow when a new email is received.', + 'Integrate Gmail into the workflow. Can send, read, and search emails. Can be used in trigger mode to trigger a workflow when a new email is received.', docsLink: 'https://docs.sim.ai/tools/gmail', category: 'tools', bgColor: '#E0E0E0', icon: GmailIcon, + triggerAllowed: true, subBlocks: [ // Operation selector { diff --git a/apps/sim/blocks/blocks/google.ts b/apps/sim/blocks/blocks/google.ts index 91f7b4c824..dec8a1fc8e 100644 --- a/apps/sim/blocks/blocks/google.ts +++ b/apps/sim/blocks/blocks/google.ts @@ -1,13 +1,14 @@ import { GoogleIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GoogleSearchResponse } from '@/tools/google/types' export const GoogleSearchBlock: BlockConfig = { type: 'google_search', name: 'Google Search', description: 'Search the web', - longDescription: - 'Integrate Google Search into the workflow. Can search the web. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Google Search into the workflow. Can search the web.', docsLink: 'https://docs.sim.ai/tools/google_search', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/google_calendar.ts b/apps/sim/blocks/blocks/google_calendar.ts index aeaac0bdd8..7f1a22e30d 100644 --- a/apps/sim/blocks/blocks/google_calendar.ts +++ b/apps/sim/blocks/blocks/google_calendar.ts @@ -1,13 +1,15 @@ import { GoogleCalendarIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GoogleCalendarResponse } from '@/tools/google_calendar/types' export const GoogleCalendarBlock: BlockConfig = { type: 'google_calendar', name: 'Google Calendar', description: 'Manage Google Calendar events', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Google Calendar into the workflow. Can create, read, update, and list calendar events. Requires OAuth.', + 'Integrate Google Calendar into the workflow. Can create, read, update, and list calendar events.', docsLink: 'https://docs.sim.ai/tools/google_calendar', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/google_docs.ts b/apps/sim/blocks/blocks/google_docs.ts index 84a4786af7..f023bdfe30 100644 --- a/apps/sim/blocks/blocks/google_docs.ts +++ b/apps/sim/blocks/blocks/google_docs.ts @@ -1,13 +1,15 @@ import { GoogleDocsIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GoogleDocsResponse } from '@/tools/google_docs/types' export const GoogleDocsBlock: BlockConfig = { type: 'google_docs', name: 'Google Docs', description: 'Read, write, and create documents', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Google Docs into the workflow. Can read, write, and create documents. Requires OAuth.', + 'Integrate Google Docs into the workflow. Can read, write, and create documents.', docsLink: 'https://docs.sim.ai/tools/google_docs', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/google_drive.ts b/apps/sim/blocks/blocks/google_drive.ts index 0b42940b74..718a9f6644 100644 --- a/apps/sim/blocks/blocks/google_drive.ts +++ b/apps/sim/blocks/blocks/google_drive.ts @@ -1,13 +1,14 @@ import { GoogleDriveIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GoogleDriveResponse } from '@/tools/google_drive/types' export const GoogleDriveBlock: BlockConfig = { type: 'google_drive', name: 'Google Drive', description: 'Create, upload, and list files', - longDescription: - 'Integrate Google Drive into the workflow. Can create, upload, and list files. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate Google Drive into the workflow. Can create, upload, and list files.', docsLink: 'https://docs.sim.ai/tools/google_drive', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/google_sheets.ts b/apps/sim/blocks/blocks/google_sheets.ts index 3262c4db05..51dff49095 100644 --- a/apps/sim/blocks/blocks/google_sheets.ts +++ b/apps/sim/blocks/blocks/google_sheets.ts @@ -1,13 +1,15 @@ import { GoogleSheetsIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { GoogleSheetsResponse } from '@/tools/google_sheets/types' export const GoogleSheetsBlock: BlockConfig = { type: 'google_sheets', name: 'Google Sheets', description: 'Read, write, and update data', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Google Sheets into the workflow. Can read, write, append, and update data. Requires OAuth.', + 'Integrate Google Sheets into the workflow. Can read, write, append, and update data.', docsLink: 'https://docs.sim.ai/tools/google_sheets', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/huggingface.ts b/apps/sim/blocks/blocks/huggingface.ts index 72ab72281c..5ce7fd2fe4 100644 --- a/apps/sim/blocks/blocks/huggingface.ts +++ b/apps/sim/blocks/blocks/huggingface.ts @@ -1,13 +1,15 @@ import { HuggingFaceIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { HuggingFaceChatResponse } from '@/tools/huggingface/types' export const HuggingFaceBlock: BlockConfig = { type: 'huggingface', name: 'Hugging Face', description: 'Use Hugging Face Inference API', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API. Requires API Key.', + 'Integrate Hugging Face into the workflow. Can generate completions using the Hugging Face Inference API.', docsLink: 'https://docs.sim.ai/tools/huggingface', category: 'tools', bgColor: '#0B0F19', diff --git a/apps/sim/blocks/blocks/hunter.ts b/apps/sim/blocks/blocks/hunter.ts index 738222fdbc..8b8f7ca4ad 100644 --- a/apps/sim/blocks/blocks/hunter.ts +++ b/apps/sim/blocks/blocks/hunter.ts @@ -1,13 +1,14 @@ import { HunterIOIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { HunterResponse } from '@/tools/hunter/types' export const HunterBlock: BlockConfig = { type: 'hunter', name: 'Hunter io', description: 'Find and verify professional email addresses', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Hunter into the workflow. Can search domains, find email addresses, verify email addresses, discover companies, find companies, and count email addresses. Requires API Key.', + 'Integrate Hunter into the workflow. Can search domains, find email addresses, verify email addresses, discover companies, find companies, and count email addresses.', docsLink: 'https://docs.sim.ai/tools/hunter', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/image_generator.ts b/apps/sim/blocks/blocks/image_generator.ts index 0bb1291898..950d9f21d7 100644 --- a/apps/sim/blocks/blocks/image_generator.ts +++ b/apps/sim/blocks/blocks/image_generator.ts @@ -1,13 +1,14 @@ import { ImageIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { DalleResponse } from '@/tools/openai/types' export const ImageGeneratorBlock: BlockConfig = { type: 'image_generator', name: 'Image Generator', description: 'Generate images', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image. Requires API Key.', + 'Integrate Image Generator into the workflow. Can generate images using DALL-E 3 or GPT Image.', docsLink: 'https://docs.sim.ai/tools/image_generator', category: 'tools', bgColor: '#4D5FFF', diff --git a/apps/sim/blocks/blocks/jina.ts b/apps/sim/blocks/blocks/jina.ts index aa31371f40..7831555eee 100644 --- a/apps/sim/blocks/blocks/jina.ts +++ b/apps/sim/blocks/blocks/jina.ts @@ -1,13 +1,13 @@ import { JinaAIIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ReadUrlResponse } from '@/tools/jina/types' export const JinaBlock: BlockConfig = { type: 'jina', name: 'Jina', description: 'Convert website content into text', - longDescription: - 'Integrate Jina into the workflow. Extracts content from websites. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Jina into the workflow. Extracts content from websites.', docsLink: 'https://docs.sim.ai/tools/jina', category: 'tools', bgColor: '#333333', diff --git a/apps/sim/blocks/blocks/jira.ts b/apps/sim/blocks/blocks/jira.ts index a55e592adc..d59f0683cd 100644 --- a/apps/sim/blocks/blocks/jira.ts +++ b/apps/sim/blocks/blocks/jira.ts @@ -1,13 +1,14 @@ import { JiraIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { JiraResponse } from '@/tools/jira/types' export const JiraBlock: BlockConfig = { type: 'jira', name: 'Jira', description: 'Interact with Jira', - longDescription: - 'Integrate Jira into the workflow. Can read, write, and update issues. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate Jira into the workflow. Can read, write, and update issues.', docsLink: 'https://docs.sim.ai/tools/jira', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/linear.ts b/apps/sim/blocks/blocks/linear.ts index 132842f161..f64c446494 100644 --- a/apps/sim/blocks/blocks/linear.ts +++ b/apps/sim/blocks/blocks/linear.ts @@ -1,5 +1,6 @@ import { LinearIcon } from '@/components/icons' import type { BlockConfig, BlockIcon } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { LinearResponse } from '@/tools/linear/types' const LinearBlockIcon: BlockIcon = (props) => LinearIcon(props as any) @@ -8,8 +9,8 @@ export const LinearBlock: BlockConfig = { type: 'linear', name: 'Linear', description: 'Read and create issues in Linear', - longDescription: - 'Integrate Linear into the workflow. Can read and create issues. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate Linear into the workflow. Can read and create issues.', category: 'tools', icon: LinearBlockIcon, bgColor: '#5E6AD2', diff --git a/apps/sim/blocks/blocks/linkup.ts b/apps/sim/blocks/blocks/linkup.ts index f037e08c06..cad5cf3ca8 100644 --- a/apps/sim/blocks/blocks/linkup.ts +++ b/apps/sim/blocks/blocks/linkup.ts @@ -1,12 +1,13 @@ import { LinkupIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { LinkupSearchToolResponse } from '@/tools/linkup/types' export const LinkupBlock: BlockConfig = { type: 'linkup', name: 'Linkup', description: 'Search the web with Linkup', - longDescription: 'Integrate Linkup into the workflow. Can search the web. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Linkup into the workflow. Can search the web.', docsLink: 'https://docs.sim.ai/tools/linkup', category: 'tools', bgColor: '#D6D3C7', diff --git a/apps/sim/blocks/blocks/mem0.ts b/apps/sim/blocks/blocks/mem0.ts index e2884c69d2..f91884f225 100644 --- a/apps/sim/blocks/blocks/mem0.ts +++ b/apps/sim/blocks/blocks/mem0.ts @@ -1,13 +1,13 @@ import { Mem0Icon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { Mem0Response } from '@/tools/mem0/types' export const Mem0Block: BlockConfig = { type: 'mem0', name: 'Mem0', description: 'Agent memory management', - longDescription: - 'Integrate Mem0 into the workflow. Can add, search, and retrieve memories. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Mem0 into the workflow. Can add, search, and retrieve memories.', bgColor: '#181C1E', icon: Mem0Icon, category: 'tools', diff --git a/apps/sim/blocks/blocks/microsoft_excel.ts b/apps/sim/blocks/blocks/microsoft_excel.ts index 7c4f08e2fe..3f9a5ca692 100644 --- a/apps/sim/blocks/blocks/microsoft_excel.ts +++ b/apps/sim/blocks/blocks/microsoft_excel.ts @@ -1,13 +1,15 @@ import { MicrosoftExcelIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { MicrosoftExcelResponse } from '@/tools/microsoft_excel/types' export const MicrosoftExcelBlock: BlockConfig = { type: 'microsoft_excel', name: 'Microsoft Excel', description: 'Read, write, and update data', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Microsoft Excel into the workflow. Can read, write, update, and add to table. Requires OAuth.', + 'Integrate Microsoft Excel into the workflow. Can read, write, update, and add to table.', docsLink: 'https://docs.sim.ai/tools/microsoft_excel', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/microsoft_planner.ts b/apps/sim/blocks/blocks/microsoft_planner.ts index 3dde715eed..553baf6577 100644 --- a/apps/sim/blocks/blocks/microsoft_planner.ts +++ b/apps/sim/blocks/blocks/microsoft_planner.ts @@ -1,5 +1,6 @@ import { MicrosoftPlannerIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { MicrosoftPlannerResponse } from '@/tools/microsoft_planner/types' interface MicrosoftPlannerBlockParams { @@ -19,8 +20,8 @@ export const MicrosoftPlannerBlock: BlockConfig = { type: 'microsoft_planner', name: 'Microsoft Planner', description: 'Read and create tasks in Microsoft Planner', - longDescription: - 'Integrate Microsoft Planner into the workflow. Can read and create tasks. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate Microsoft Planner into the workflow. Can read and create tasks.', docsLink: 'https://docs.sim.ai/tools/microsoft_planner', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/microsoft_teams.ts b/apps/sim/blocks/blocks/microsoft_teams.ts index a19ca9db65..8944a7225a 100644 --- a/apps/sim/blocks/blocks/microsoft_teams.ts +++ b/apps/sim/blocks/blocks/microsoft_teams.ts @@ -1,15 +1,18 @@ import { MicrosoftTeamsIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { MicrosoftTeamsResponse } from '@/tools/microsoft_teams/types' export const MicrosoftTeamsBlock: BlockConfig = { type: 'microsoft_teams', name: 'Microsoft Teams', description: 'Read, write, and create messages', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Microsoft Teams into the workflow. Can read and write chat messages, and read and write channel messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel.', + 'Integrate Microsoft Teams into the workflow. Can read and write chat messages, and read and write channel messages. Can be used in trigger mode to trigger a workflow when a message is sent to a chat or channel.', docsLink: 'https://docs.sim.ai/tools/microsoft_teams', category: 'tools', + triggerAllowed: true, bgColor: '#E0E0E0', icon: MicrosoftTeamsIcon, subBlocks: [ diff --git a/apps/sim/blocks/blocks/mistral_parse.ts b/apps/sim/blocks/blocks/mistral_parse.ts index f9554c6867..c1d7e45d39 100644 --- a/apps/sim/blocks/blocks/mistral_parse.ts +++ b/apps/sim/blocks/blocks/mistral_parse.ts @@ -1,12 +1,13 @@ import { MistralIcon } from '@/components/icons' -import type { BlockConfig, SubBlockLayout, SubBlockType } from '@/blocks/types' +import { AuthMode, type BlockConfig, type SubBlockLayout, type SubBlockType } from '@/blocks/types' import type { MistralParserOutput } from '@/tools/mistral/types' export const MistralParseBlock: BlockConfig = { type: 'mistral_parse', name: 'Mistral Parser', description: 'Extract text from PDF documents', - longDescription: `Integrate Mistral Parse into the workflow. Can extract text from uploaded PDF documents, or from a URL. Requires API Key.`, + authMode: AuthMode.ApiKey, + longDescription: `Integrate Mistral Parse into the workflow. Can extract text from uploaded PDF documents, or from a URL.`, docsLink: 'https://docs.sim.ai/tools/mistral_parse', category: 'tools', bgColor: '#000000', diff --git a/apps/sim/blocks/blocks/notion.ts b/apps/sim/blocks/blocks/notion.ts index 1393ca231f..ccfda9114a 100644 --- a/apps/sim/blocks/blocks/notion.ts +++ b/apps/sim/blocks/blocks/notion.ts @@ -1,13 +1,15 @@ import { NotionIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { NotionResponse } from '@/tools/notion/types' export const NotionBlock: BlockConfig = { type: 'notion', name: 'Notion', description: 'Manage Notion pages', + authMode: AuthMode.OAuth, longDescription: - 'Integrate with Notion into the workflow. Can read page, read database, create page, create database, append content, query database, and search workspace. Requires OAuth.', + 'Integrate with Notion into the workflow. Can read page, read database, create page, create database, append content, query database, and search workspace.', docsLink: 'https://docs.sim.ai/tools/notion', category: 'tools', bgColor: '#181C1E', diff --git a/apps/sim/blocks/blocks/onedrive.ts b/apps/sim/blocks/blocks/onedrive.ts index ca39032910..512a2a29b1 100644 --- a/apps/sim/blocks/blocks/onedrive.ts +++ b/apps/sim/blocks/blocks/onedrive.ts @@ -1,13 +1,14 @@ import { MicrosoftOneDriveIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { OneDriveResponse } from '@/tools/onedrive/types' export const OneDriveBlock: BlockConfig = { type: 'onedrive', name: 'OneDrive', description: 'Create, upload, and list files', - longDescription: - 'Integrate OneDrive into the workflow. Can create, upload, and list files. Requires OAuth.', + authMode: AuthMode.OAuth, + longDescription: 'Integrate OneDrive into the workflow. Can create, upload, and list files.', docsLink: 'https://docs.sim.ai/tools/onedrive', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/openai.ts b/apps/sim/blocks/blocks/openai.ts index 4df9835640..aac744f0e5 100644 --- a/apps/sim/blocks/blocks/openai.ts +++ b/apps/sim/blocks/blocks/openai.ts @@ -1,12 +1,13 @@ import { OpenAIIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' export const OpenAIBlock: BlockConfig = { type: 'openai', name: 'Embeddings', description: 'Generate Open AI embeddings', - longDescription: - 'Integrate Embeddings into the workflow. Can generate embeddings from text. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Embeddings into the workflow. Can generate embeddings from text.', category: 'tools', docsLink: 'https://docs.sim.ai/tools/openai', bgColor: '#10a37f', diff --git a/apps/sim/blocks/blocks/outlook.ts b/apps/sim/blocks/blocks/outlook.ts index 91f583baff..27dbb7e628 100644 --- a/apps/sim/blocks/blocks/outlook.ts +++ b/apps/sim/blocks/blocks/outlook.ts @@ -1,15 +1,18 @@ import { OutlookIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { OutlookResponse } from '@/tools/outlook/types' export const OutlookBlock: BlockConfig = { type: 'outlook', name: 'Outlook', description: 'Access Outlook', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Outlook into the workflow. Can read, draft, and send email messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a new email is received.', + 'Integrate Outlook into the workflow. Can read, draft, and send email messages. Can be used in trigger mode to trigger a workflow when a new email is received.', docsLink: 'https://docs.sim.ai/tools/outlook', category: 'tools', + triggerAllowed: true, bgColor: '#E0E0E0', icon: OutlookIcon, subBlocks: [ diff --git a/apps/sim/blocks/blocks/parallel.ts b/apps/sim/blocks/blocks/parallel.ts index e6714f25e3..69de17d1d4 100644 --- a/apps/sim/blocks/blocks/parallel.ts +++ b/apps/sim/blocks/blocks/parallel.ts @@ -1,12 +1,13 @@ import { ParallelIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ToolResponse } from '@/tools/types' export const ParallelBlock: BlockConfig = { type: 'parallel_ai', name: 'Parallel AI', description: 'Search with Parallel AI', - longDescription: 'Integrate Parallel AI into the workflow. Can search the web. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Parallel AI into the workflow. Can search the web.', docsLink: 'https://docs.parallel.ai/search-api/search-quickstart', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/perplexity.ts b/apps/sim/blocks/blocks/perplexity.ts index 15801c3340..fecae112be 100644 --- a/apps/sim/blocks/blocks/perplexity.ts +++ b/apps/sim/blocks/blocks/perplexity.ts @@ -1,5 +1,5 @@ import { PerplexityIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { PerplexityChatResponse } from '@/tools/perplexity/types' export const PerplexityBlock: BlockConfig = { @@ -7,7 +7,8 @@ export const PerplexityBlock: BlockConfig = { name: 'Perplexity', description: 'Use Perplexity AI chat models', longDescription: - 'Integrate Perplexity into the workflow. Can generate completions using Perplexity AI chat models. Requires API Key.', + 'Integrate Perplexity into the workflow. Can generate completions using Perplexity AI chat models.', + authMode: AuthMode.ApiKey, docsLink: 'https://docs.sim.ai/tools/perplexity', category: 'tools', bgColor: '#20808D', // Perplexity turquoise color diff --git a/apps/sim/blocks/blocks/pinecone.ts b/apps/sim/blocks/blocks/pinecone.ts index 52c27b9ff1..36a6c5ca57 100644 --- a/apps/sim/blocks/blocks/pinecone.ts +++ b/apps/sim/blocks/blocks/pinecone.ts @@ -1,13 +1,15 @@ import { PineconeIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { PineconeResponse } from '@/tools/pinecone/types' export const PineconeBlock: BlockConfig = { type: 'pinecone', name: 'Pinecone', description: 'Use Pinecone vector database', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Pinecone into the workflow. Can generate embeddings, upsert text, search with text, fetch vectors, and search with vectors. Requires API Key.', + 'Integrate Pinecone into the workflow. Can generate embeddings, upsert text, search with text, fetch vectors, and search with vectors.', docsLink: 'https://docs.sim.ai/tools/pinecone', category: 'tools', bgColor: '#0D1117', diff --git a/apps/sim/blocks/blocks/qdrant.ts b/apps/sim/blocks/blocks/qdrant.ts index 9673ce8a3f..a06743764e 100644 --- a/apps/sim/blocks/blocks/qdrant.ts +++ b/apps/sim/blocks/blocks/qdrant.ts @@ -1,13 +1,14 @@ import { QdrantIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { QdrantResponse } from '@/tools/qdrant/types' export const QdrantBlock: BlockConfig = { type: 'qdrant', name: 'Qdrant', description: 'Use Qdrant vector database', - longDescription: - 'Integrate Qdrant into the workflow. Can upsert, search, and fetch points. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Qdrant into the workflow. Can upsert, search, and fetch points.', docsLink: 'https://qdrant.tech/documentation/', category: 'tools', bgColor: '#1A223F', diff --git a/apps/sim/blocks/blocks/reddit.ts b/apps/sim/blocks/blocks/reddit.ts index 102e803a24..ffbe0509e2 100644 --- a/apps/sim/blocks/blocks/reddit.ts +++ b/apps/sim/blocks/blocks/reddit.ts @@ -1,13 +1,15 @@ import { RedditIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { RedditResponse } from '@/tools/reddit/types' export const RedditBlock: BlockConfig = { type: 'reddit', name: 'Reddit', description: 'Access Reddit data and content', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Reddit into the workflow. Can get posts and comments from a subreddit. Requires OAuth.', + 'Integrate Reddit into the workflow. Can get posts and comments from a subreddit.', docsLink: 'https://docs.sim.ai/tools/reddit', category: 'tools', bgColor: '#FF5700', diff --git a/apps/sim/blocks/blocks/router.ts b/apps/sim/blocks/blocks/router.ts index b84f722a59..6c909650b3 100644 --- a/apps/sim/blocks/blocks/router.ts +++ b/apps/sim/blocks/blocks/router.ts @@ -1,6 +1,6 @@ import { ConnectIcon } from '@/components/icons' import { isHosted } from '@/lib/environment' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ProviderId } from '@/providers/types' import { getAllModelProviders, @@ -108,6 +108,7 @@ export const RouterBlock: BlockConfig = { type: 'router', name: 'Router', description: 'Route workflow', + authMode: AuthMode.ApiKey, longDescription: 'This is a core workflow block. Intelligently direct workflow execution to different paths based on input analysis. Use natural language to instruct the router to route to certain blocks based on the input.', category: 'blocks', diff --git a/apps/sim/blocks/blocks/s3.ts b/apps/sim/blocks/blocks/s3.ts index c29dbabfcb..577c6cc374 100644 --- a/apps/sim/blocks/blocks/s3.ts +++ b/apps/sim/blocks/blocks/s3.ts @@ -1,11 +1,13 @@ import { S3Icon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { S3Response } from '@/tools/s3/types' export const S3Block: BlockConfig = { type: 's3', name: 'S3', description: 'View S3 files', + authMode: AuthMode.ApiKey, longDescription: 'Integrate S3 into the workflow. Can get presigned URLs for S3 objects. Requires access key and secret access key.', docsLink: 'https://docs.sim.ai/tools/s3', diff --git a/apps/sim/blocks/blocks/serper.ts b/apps/sim/blocks/blocks/serper.ts index f98ebe4a57..267adafbf4 100644 --- a/apps/sim/blocks/blocks/serper.ts +++ b/apps/sim/blocks/blocks/serper.ts @@ -1,12 +1,14 @@ import { SerperIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { SearchResponse } from '@/tools/serper/types' export const SerperBlock: BlockConfig = { type: 'serper', name: 'Serper', description: 'Search the web using Serper', - longDescription: 'Integrate Serper into the workflow. Can search the web. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Serper into the workflow. Can search the web.', docsLink: 'https://docs.sim.ai/tools/serper', category: 'tools', bgColor: '#2B3543', diff --git a/apps/sim/blocks/blocks/sharepoint.ts b/apps/sim/blocks/blocks/sharepoint.ts index 11212c9d7b..18fba7a5c2 100644 --- a/apps/sim/blocks/blocks/sharepoint.ts +++ b/apps/sim/blocks/blocks/sharepoint.ts @@ -1,13 +1,15 @@ import { MicrosoftSharepointIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { SharepointResponse } from '@/tools/sharepoint/types' export const SharepointBlock: BlockConfig = { type: 'sharepoint', name: 'Sharepoint', description: 'Read and create pages', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Sharepoint into the workflow. Can read and create pages, and list sites. Requires OAuth.', + 'Integrate Sharepoint into the workflow. Can read and create pages, and list sites.', docsLink: 'https://docs.sim.ai/tools/sharepoint', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/slack.ts b/apps/sim/blocks/blocks/slack.ts index 89cab78483..305bb32c29 100644 --- a/apps/sim/blocks/blocks/slack.ts +++ b/apps/sim/blocks/blocks/slack.ts @@ -1,17 +1,20 @@ import { SlackIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { SlackResponse } from '@/tools/slack/types' export const SlackBlock: BlockConfig = { type: 'slack', name: 'Slack', description: 'Send messages to Slack or trigger workflows from Slack events', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Slack into the workflow. Can send messages, create canvases, and read messages. Requires OAuth. Can be used in trigger mode to trigger a workflow when a message is sent to a channel.', + 'Integrate Slack into the workflow. Can send messages, create canvases, and read messages. Requires Bot Token instead of OAuth in advanced mode. Can be used in trigger mode to trigger a workflow when a message is sent to a channel.', docsLink: 'https://docs.sim.ai/tools/slack', category: 'tools', bgColor: '#611f69', icon: SlackIcon, + triggerAllowed: true, subBlocks: [ { id: 'operation', diff --git a/apps/sim/blocks/blocks/stagehand.ts b/apps/sim/blocks/blocks/stagehand.ts index ac23277833..6ef63cbf69 100644 --- a/apps/sim/blocks/blocks/stagehand.ts +++ b/apps/sim/blocks/blocks/stagehand.ts @@ -1,5 +1,5 @@ import { StagehandIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { ToolResponse } from '@/tools/types' export interface StagehandExtractResponse extends ToolResponse { @@ -12,8 +12,9 @@ export const StagehandBlock: BlockConfig = { type: 'stagehand', name: 'Stagehand Extract', description: 'Extract data from websites', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Stagehand into the workflow. Can extract structured data from webpages. Requires API Key.', + 'Integrate Stagehand into the workflow. Can extract structured data from webpages.', docsLink: 'https://docs.sim.ai/tools/stagehand', category: 'tools', bgColor: '#FFC83C', diff --git a/apps/sim/blocks/blocks/stagehand_agent.ts b/apps/sim/blocks/blocks/stagehand_agent.ts index c2dc79cc65..f6225bb847 100644 --- a/apps/sim/blocks/blocks/stagehand_agent.ts +++ b/apps/sim/blocks/blocks/stagehand_agent.ts @@ -1,13 +1,14 @@ import { StagehandIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { StagehandAgentResponse } from '@/tools/stagehand/types' export const StagehandAgentBlock: BlockConfig = { type: 'stagehand_agent', name: 'Stagehand Agent', description: 'Autonomous web browsing agent', + authMode: AuthMode.ApiKey, longDescription: - 'Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks. Requires API Key.', + 'Integrate Stagehand Agent into the workflow. Can navigate the web and perform tasks.', docsLink: 'https://docs.sim.ai/tools/stagehand_agent', category: 'tools', bgColor: '#FFC83C', diff --git a/apps/sim/blocks/blocks/supabase.ts b/apps/sim/blocks/blocks/supabase.ts index 09b6f01bb4..2bd6c57d95 100644 --- a/apps/sim/blocks/blocks/supabase.ts +++ b/apps/sim/blocks/blocks/supabase.ts @@ -1,6 +1,6 @@ import { SupabaseIcon } from '@/components/icons' import { createLogger } from '@/lib/logs/console/logger' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import type { SupabaseResponse } from '@/tools/supabase/types' const logger = createLogger('SupabaseBlock') @@ -9,6 +9,7 @@ export const SupabaseBlock: BlockConfig = { type: 'supabase', name: 'Supabase', description: 'Use Supabase database', + authMode: AuthMode.ApiKey, longDescription: 'Integrate Supabase into the workflow. Can get many rows, get, create, update, delete, and upsert a row.', docsLink: 'https://docs.sim.ai/tools/supabase', diff --git a/apps/sim/blocks/blocks/tavily.ts b/apps/sim/blocks/blocks/tavily.ts index 5e8196c867..a75013df9f 100644 --- a/apps/sim/blocks/blocks/tavily.ts +++ b/apps/sim/blocks/blocks/tavily.ts @@ -1,11 +1,13 @@ import { TavilyIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { TavilyResponse } from '@/tools/tavily/types' export const TavilyBlock: BlockConfig = { type: 'tavily', name: 'Tavily', description: 'Search and extract information', + authMode: AuthMode.ApiKey, longDescription: 'Integrate Tavily into the workflow. Can search the web and extract content from specific URLs. Requires API Key.', category: 'tools', diff --git a/apps/sim/blocks/blocks/telegram.ts b/apps/sim/blocks/blocks/telegram.ts index 66d5b8dde1..3f247c525a 100644 --- a/apps/sim/blocks/blocks/telegram.ts +++ b/apps/sim/blocks/blocks/telegram.ts @@ -1,17 +1,20 @@ import { TelegramIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { TelegramMessageResponse } from '@/tools/telegram/types' export const TelegramBlock: BlockConfig = { type: 'telegram', name: 'Telegram', description: 'Send messages through Telegram or trigger workflows from Telegram events', + authMode: AuthMode.BotToken, longDescription: 'Integrate Telegram into the workflow. Can send messages. Can be used in trigger mode to trigger a workflow when a message is sent to a chat.', docsLink: 'https://docs.sim.ai/tools/telegram', category: 'tools', bgColor: '#E0E0E0', icon: TelegramIcon, + triggerAllowed: true, subBlocks: [ { id: 'botToken', diff --git a/apps/sim/blocks/blocks/translate.ts b/apps/sim/blocks/blocks/translate.ts index 360221edeb..a4e4f5c199 100644 --- a/apps/sim/blocks/blocks/translate.ts +++ b/apps/sim/blocks/blocks/translate.ts @@ -1,6 +1,6 @@ import { TranslateIcon } from '@/components/icons' import { isHosted } from '@/lib/environment' -import type { BlockConfig } from '@/blocks/types' +import { AuthMode, type BlockConfig } from '@/blocks/types' import { getAllModelProviders, getBaseModelProviders, @@ -29,6 +29,7 @@ export const TranslateBlock: BlockConfig = { type: 'translate', name: 'Translate', description: 'Translate text to any language', + authMode: AuthMode.ApiKey, longDescription: 'Integrate Translate into the workflow. Can translate text to any language.', docsLink: 'https://docs.sim.ai/tools/translate', category: 'tools', diff --git a/apps/sim/blocks/blocks/twilio.ts b/apps/sim/blocks/blocks/twilio.ts index 6a51b901f2..f997f0dd86 100644 --- a/apps/sim/blocks/blocks/twilio.ts +++ b/apps/sim/blocks/blocks/twilio.ts @@ -1,11 +1,13 @@ import { TwilioIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { TwilioSMSBlockOutput } from '@/tools/twilio/types' export const TwilioSMSBlock: BlockConfig = { type: 'twilio_sms', name: 'Twilio SMS', description: 'Send SMS messages', + authMode: AuthMode.ApiKey, longDescription: 'Integrate Twilio into the workflow. Can send SMS messages.', category: 'tools', bgColor: '#F22F46', // Twilio brand color diff --git a/apps/sim/blocks/blocks/typeform.ts b/apps/sim/blocks/blocks/typeform.ts index f98f1a87fd..c63334e71e 100644 --- a/apps/sim/blocks/blocks/typeform.ts +++ b/apps/sim/blocks/blocks/typeform.ts @@ -1,11 +1,13 @@ import { TypeformIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { TypeformResponse } from '@/tools/typeform/types' export const TypeformBlock: BlockConfig = { type: 'typeform', name: 'Typeform', description: 'Interact with Typeform', + authMode: AuthMode.ApiKey, longDescription: 'Integrate Typeform into the workflow. Can retrieve responses, download files, and get form insights. Requires API Key.', docsLink: 'https://docs.sim.ai/tools/typeform', diff --git a/apps/sim/blocks/blocks/vision.ts b/apps/sim/blocks/blocks/vision.ts index dfab793e1e..5d56ad1b1d 100644 --- a/apps/sim/blocks/blocks/vision.ts +++ b/apps/sim/blocks/blocks/vision.ts @@ -1,13 +1,14 @@ import { EyeIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { VisionResponse } from '@/tools/vision/types' export const VisionBlock: BlockConfig = { type: 'vision', name: 'Vision', description: 'Analyze images with vision models', - longDescription: - 'Integrate Vision into the workflow. Can analyze images with vision models. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate Vision into the workflow. Can analyze images with vision models.', docsLink: 'https://docs.sim.ai/tools/vision', category: 'tools', bgColor: '#4D5FFF', diff --git a/apps/sim/blocks/blocks/wealthbox.ts b/apps/sim/blocks/blocks/wealthbox.ts index 7e0e59c6e7..7022cc8342 100644 --- a/apps/sim/blocks/blocks/wealthbox.ts +++ b/apps/sim/blocks/blocks/wealthbox.ts @@ -1,13 +1,15 @@ import { WealthboxIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { WealthboxResponse } from '@/tools/wealthbox/types' export const WealthboxBlock: BlockConfig = { type: 'wealthbox', name: 'Wealthbox', description: 'Interact with Wealthbox', + authMode: AuthMode.OAuth, longDescription: - 'Integrate Wealthbox into the workflow. Can read and write notes, read and write contacts, and read and write tasks. Requires OAuth.', + 'Integrate Wealthbox into the workflow. Can read and write notes, read and write contacts, and read and write tasks.', docsLink: 'https://docs.sim.ai/tools/wealthbox', category: 'tools', bgColor: '#E0E0E0', diff --git a/apps/sim/blocks/blocks/webhook.ts b/apps/sim/blocks/blocks/webhook.ts index d5b870fa00..27874f33a2 100644 --- a/apps/sim/blocks/blocks/webhook.ts +++ b/apps/sim/blocks/blocks/webhook.ts @@ -13,6 +13,7 @@ import { WhatsAppIcon, } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' const getWebhookProviderIcon = (provider: string) => { const iconMap: Record> = { @@ -36,9 +37,11 @@ export const WebhookBlock: BlockConfig = { type: 'webhook', name: 'Webhook', description: 'Trigger workflow execution from external webhooks', + authMode: AuthMode.OAuth, category: 'triggers', icon: WebhookIcon, bgColor: '#10B981', // Green color for triggers + triggerAllowed: true, hideFromToolbar: true, // Hidden for backwards compatibility - use generic webhook trigger instead subBlocks: [ diff --git a/apps/sim/blocks/blocks/whatsapp.ts b/apps/sim/blocks/blocks/whatsapp.ts index 4899f3e5ad..77801d1ad8 100644 --- a/apps/sim/blocks/blocks/whatsapp.ts +++ b/apps/sim/blocks/blocks/whatsapp.ts @@ -1,16 +1,19 @@ import { WhatsAppIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { WhatsAppResponse } from '@/tools/whatsapp/types' export const WhatsAppBlock: BlockConfig = { type: 'whatsapp', name: 'WhatsApp', description: 'Send WhatsApp messages', + authMode: AuthMode.ApiKey, longDescription: 'Integrate WhatsApp into the workflow. Can send messages.', docsLink: 'https://docs.sim.ai/tools/whatsapp', category: 'tools', bgColor: '#25D366', icon: WhatsAppIcon, + triggerAllowed: true, subBlocks: [ { id: 'phoneNumber', diff --git a/apps/sim/blocks/blocks/x.ts b/apps/sim/blocks/blocks/x.ts index a47fa65031..2b675925fe 100644 --- a/apps/sim/blocks/blocks/x.ts +++ b/apps/sim/blocks/blocks/x.ts @@ -1,13 +1,15 @@ import { xIcon } from '@/components/icons' import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { XResponse } from '@/tools/x/types' export const XBlock: BlockConfig = { type: 'x', name: 'X', description: 'Interact with X', + authMode: AuthMode.OAuth, longDescription: - 'Integrate X into the workflow. Can post a new tweet, get tweet details, search tweets, and get user profile. Requires OAuth.', + 'Integrate X into the workflow. Can post a new tweet, get tweet details, search tweets, and get user profile.', docsLink: 'https://docs.sim.ai/tools/x', category: 'tools', bgColor: '#000000', // X's black color diff --git a/apps/sim/blocks/blocks/youtube.ts b/apps/sim/blocks/blocks/youtube.ts index b5c53deafa..982f924c0b 100644 --- a/apps/sim/blocks/blocks/youtube.ts +++ b/apps/sim/blocks/blocks/youtube.ts @@ -1,16 +1,20 @@ import { YouTubeIcon } from '@/components/icons' -import type { BlockConfig } from '@/blocks/types' +import type { BlockConfig, BlockIcon } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import type { YouTubeSearchResponse } from '@/tools/youtube/types' +const YouTubeBlockIcon: BlockIcon = (props) => YouTubeIcon(props as any) + export const YouTubeBlock: BlockConfig = { type: 'youtube', name: 'YouTube', description: 'Search for videos on YouTube', - longDescription: 'Integrate YouTube into the workflow. Can search for videos. Requires API Key.', + authMode: AuthMode.ApiKey, + longDescription: 'Integrate YouTube into the workflow. Can search for videos.', docsLink: 'https://docs.sim.ai/tools/youtube', category: 'tools', bgColor: '#FF0000', - icon: YouTubeIcon, + icon: YouTubeBlockIcon, subBlocks: [ { id: 'query', diff --git a/apps/sim/blocks/types.ts b/apps/sim/blocks/types.ts index 55158b6d89..77d2bfe0da 100644 --- a/apps/sim/blocks/types.ts +++ b/apps/sim/blocks/types.ts @@ -7,6 +7,13 @@ export type PrimitiveValueType = 'string' | 'number' | 'boolean' | 'json' | 'arr export type BlockCategory = 'blocks' | 'tools' | 'triggers' +// Authentication modes for sub-blocks and summaries +export enum AuthMode { + OAuth = 'oauth', + ApiKey = 'api_key', + BotToken = 'bot_token', +} + export type GenerationType = | 'javascript-function-body' | 'typescript-function-body' @@ -186,6 +193,8 @@ export interface BlockConfig { bgColor: string icon: BlockIcon subBlocks: SubBlockConfig[] + triggerAllowed?: boolean + authMode?: AuthMode tools: { access: string[] config?: { diff --git a/apps/sim/lib/copilot/tools/client/blocks/get-blocks-metadata.ts b/apps/sim/lib/copilot/tools/client/blocks/get-blocks-metadata.ts index 34aa738c38..af50f30b2b 100644 --- a/apps/sim/lib/copilot/tools/client/blocks/get-blocks-metadata.ts +++ b/apps/sim/lib/copilot/tools/client/blocks/get-blocks-metadata.ts @@ -61,6 +61,7 @@ export class GetBlocksMetadataClientTool extends BaseClientTool { this.setState(ClientToolCallState.success) } catch (error: any) { const message = error instanceof Error ? error.message : String(error) + logger.error('Execute failed', { message }) await this.markToolComplete(500, message) this.setState(ClientToolCallState.error) } diff --git a/apps/sim/lib/copilot/tools/server/blocks/get-blocks-and-tools.ts b/apps/sim/lib/copilot/tools/server/blocks/get-blocks-and-tools.ts index a44bade416..ab55fa952c 100644 --- a/apps/sim/lib/copilot/tools/server/blocks/get-blocks-and-tools.ts +++ b/apps/sim/lib/copilot/tools/server/blocks/get-blocks-and-tools.ts @@ -5,7 +5,7 @@ import { } from '@/lib/copilot/tools/shared/schemas' import { createLogger } from '@/lib/logs/console/logger' import { registry as blockRegistry } from '@/blocks/registry' -import { tools as toolsRegistry } from '@/tools/registry' +import type { BlockConfig } from '@/blocks/types' export const getBlocksAndToolsServerTool: BaseServerTool< ReturnType, @@ -23,23 +23,36 @@ export const getBlocksAndToolsServerTool: BaseServerTool< if ((blockConfig as any).hideFromToolbar) return false return true }) - .forEach(([blockType, blockConfig]: any) => { - blocks.push({ id: blockType, type: blockType, name: blockConfig.name || blockType }) + .forEach(([blockType, blockConfig]: [string, BlockConfig]) => { + blocks.push({ + type: blockType, + name: blockConfig.name, + description: blockConfig.longDescription, + triggerAllowed: !!blockConfig.triggerAllowed, + }) }) - const specialBlocks = { loop: { name: 'Loop' }, parallel: { name: 'Parallel' } } + const specialBlocks = { + loop: { + name: 'Loop', + longDescription: + 'Control flow block for iterating over collections or repeating actions in a loop', + }, + parallel: { + name: 'Parallel', + longDescription: 'Control flow block for executing multiple branches simultaneously', + }, + } Object.entries(specialBlocks).forEach(([blockType, info]) => { - if (!blocks.some((b) => b.id === blockType)) { - blocks.push({ id: blockType, type: blockType, name: (info as any).name }) + if (!blocks.some((b) => b.type === blockType)) { + blocks.push({ + type: blockType, + name: (info as any).name, + longDescription: (info as any).longDescription, + }) } }) - const tools: any[] = Object.entries(toolsRegistry).map(([toolId, toolConfig]: any) => ({ - id: toolId, - type: toolId, - name: toolConfig?.name || toolId, - })) - - return GetBlocksAndToolsResult.parse({ blocks, tools }) + return GetBlocksAndToolsResult.parse({ blocks }) }, } diff --git a/apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts b/apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts index 9103bed30d..a91189de46 100644 --- a/apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts +++ b/apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts @@ -7,7 +7,55 @@ import { } from '@/lib/copilot/tools/shared/schemas' import { createLogger } from '@/lib/logs/console/logger' import { registry as blockRegistry } from '@/blocks/registry' +import type { BlockConfig } from '@/blocks/types' +import { AuthMode } from '@/blocks/types' import { tools as toolsRegistry } from '@/tools/registry' +import { TRIGGER_REGISTRY } from '@/triggers' + +export interface CopilotSubblockMetadata { + id: string + type: string + title?: string + required?: boolean + description?: string +} + +export interface CopilotToolMetadata { + id: string + name: string + description?: string + inputs?: any + outputs?: any +} + +export interface CopilotTriggerMetadata { + id: string + outputs?: any +} + +export interface CopilotBlockMetadata { + id: string + name: string + description: string + commonParameters: Record + triggerAllowed?: boolean + authType?: 'OAuth' | 'API Key' | 'Bot Token' + tools: CopilotToolMetadata[] + triggers: CopilotTriggerMetadata[] + operationParameters: Record + operations?: Record< + string, + { + toolId?: string + toolName?: string + description?: string + inputs?: Record + outputs?: Record + parameters?: CopilotSubblockMetadata[] + } + > + yamlDocumentation?: string +} export const getBlocksMetadataServerTool: BaseServerTool< ReturnType, @@ -22,35 +70,100 @@ export const getBlocksMetadataServerTool: BaseServerTool< const logger = createLogger('GetBlocksMetadataServerTool') logger.debug('Executing get_blocks_metadata', { count: blockIds?.length }) - const result: Record = {} + const result: Record = {} for (const blockId of blockIds || []) { - let metadata: any = {} + let metadata: any if (SPECIAL_BLOCKS_METADATA[blockId]) { - metadata = { ...SPECIAL_BLOCKS_METADATA[blockId] } - metadata.tools = metadata.tools?.access || [] + const specialBlock = SPECIAL_BLOCKS_METADATA[blockId] + const { operationParameters } = splitParametersByOperation( + specialBlock.subBlocks || [], + specialBlock.inputs || {} + ) + metadata = { + id: specialBlock.id, + name: specialBlock.name, + description: specialBlock.description || '', + commonParameters: specialBlock.inputs || {}, + tools: [], + triggers: [], + operationParameters, + } + ;(metadata as any).subBlocks = undefined } else { - const blockConfig: any = (blockRegistry as any)[blockId] + const blockConfig: BlockConfig | undefined = blockRegistry[blockId] if (!blockConfig) { logger.debug('Block not found in registry', { blockId }) continue } + + if (blockConfig.hideFromToolbar) { + logger.debug('Skipping block hidden from toolbar', { blockId }) + continue + } + const tools: CopilotToolMetadata[] = Array.isArray(blockConfig.tools?.access) + ? blockConfig.tools!.access.map((toolId) => { + const tool = toolsRegistry[toolId] + if (!tool) return { id: toolId, name: toolId } + return { + id: toolId, + name: tool.name || toolId, + description: tool.description || '', + inputs: tool.params || {}, + outputs: tool.outputs || {}, + } + }) + : [] + + const triggers: CopilotTriggerMetadata[] = [] + const availableTriggerIds = blockConfig.triggers?.available || [] + for (const tid of availableTriggerIds) { + const trig = TRIGGER_REGISTRY[tid] + triggers.push({ + id: tid, + outputs: trig?.outputs || {}, + }) + } + + const blockInputs = computeBlockLevelInputs(blockConfig) + const { operationParameters } = splitParametersByOperation( + Array.isArray(blockConfig.subBlocks) ? blockConfig.subBlocks : [], + blockInputs + ) + + const operationInputs = computeOperationLevelInputs(blockConfig) + const operationIds = resolveOperationIds(blockConfig, operationParameters) + const operations: Record = {} + for (const opId of operationIds) { + const resolvedToolId = resolveToolIdForOperation(blockConfig, opId) + const toolCfg = resolvedToolId ? toolsRegistry[resolvedToolId] : undefined + const toolParams: Record = toolCfg?.params || {} + const toolOutputs: Record = toolCfg?.outputs || {} + const filteredToolParams: Record = {} + for (const [k, v] of Object.entries(toolParams)) { + if (!(k in blockInputs)) filteredToolParams[k] = v + } + operations[opId] = { + toolId: resolvedToolId, + toolName: toolCfg?.name || resolvedToolId, + description: toolCfg?.description || undefined, + inputs: { ...filteredToolParams, ...(operationInputs[opId] || {}) }, + outputs: toolOutputs, + parameters: operationParameters[opId] || [], + } + } + metadata = { id: blockId, name: blockConfig.name || blockId, - description: blockConfig.description || '', - longDescription: blockConfig.longDescription, - category: blockConfig.category, - bgColor: blockConfig.bgColor, - inputs: blockConfig.inputs || {}, - outputs: blockConfig.outputs || {}, - tools: blockConfig.tools?.access || [], - hideFromToolbar: blockConfig.hideFromToolbar, - } - if (blockConfig.subBlocks && Array.isArray(blockConfig.subBlocks)) { - metadata.subBlocks = processSubBlocks(blockConfig.subBlocks) - } else { - metadata.subBlocks = [] + description: blockConfig.longDescription || blockConfig.description || '', + commonParameters: blockInputs, + triggerAllowed: !!blockConfig.triggerAllowed, + authType: resolveAuthType(blockConfig.authMode), + tools, + triggers, + operationParameters, + operations, } } @@ -73,87 +186,180 @@ export const getBlocksMetadataServerTool: BaseServerTool< } } catch {} - if (Array.isArray(metadata.tools) && metadata.tools.length > 0) { - metadata.toolDetails = {} - for (const toolId of metadata.tools) { - const tool = (toolsRegistry as any)[toolId] - if (tool) { - metadata.toolDetails[toolId] = { name: tool.name, description: tool.description } - } - } + if (metadata) { + result[blockId] = metadata as CopilotBlockMetadata } - - result[blockId] = metadata } return GetBlocksMetadataResult.parse({ metadata: result }) }, } -function resolveSubBlockOptions(options: any): any[] { +function simplifySubBlock(sb: any): CopilotSubblockMetadata { + const simplified: CopilotSubblockMetadata = { + id: sb.id, + type: sb.type, + } + if (sb.title) simplified.title = sb.title + if (sb.required) simplified.required = sb.required + if (sb.description) simplified.description = sb.description + return simplified +} + +function resolveAuthType( + authMode: AuthMode | undefined +): 'OAuth' | 'API Key' | 'Bot Token' | undefined { + if (!authMode) return undefined + if (authMode === AuthMode.OAuth) return 'OAuth' + if (authMode === AuthMode.ApiKey) return 'API Key' + if (authMode === AuthMode.BotToken) return 'Bot Token' + return undefined +} + +function normalizeCondition(condition: any): any | undefined { try { - if (typeof options === 'function') { - const resolved = options() - return Array.isArray(resolved) ? resolved : [] + if (!condition) return undefined + if (typeof condition === 'function') { + return condition() } - return Array.isArray(options) ? options : [] + return condition } catch { - return [] + return undefined } } -function processSubBlocks(subBlocks: any[]): any[] { - if (!Array.isArray(subBlocks)) return [] - return subBlocks.map((subBlock) => { - const processed: any = { - id: subBlock.id, - title: subBlock.title, - type: subBlock.type, - layout: subBlock.layout, - mode: subBlock.mode, - required: subBlock.required, - placeholder: subBlock.placeholder, - description: subBlock.description, - hidden: subBlock.hidden, - condition: subBlock.condition, - min: subBlock.min, - max: subBlock.max, - step: subBlock.step, - integer: subBlock.integer, - rows: subBlock.rows, - password: subBlock.password, - multiSelect: subBlock.multiSelect, - language: subBlock.language, - generationType: subBlock.generationType, - provider: subBlock.provider, - serviceId: subBlock.serviceId, - requiredScopes: subBlock.requiredScopes, - mimeType: subBlock.mimeType, - acceptedTypes: subBlock.acceptedTypes, - multiple: subBlock.multiple, - maxSize: subBlock.maxSize, - connectionDroppable: subBlock.connectionDroppable, - columns: subBlock.columns, - value: typeof subBlock.value === 'function' ? 'function' : undefined, - wandConfig: subBlock.wandConfig, +function splitParametersByOperation( + subBlocks: any[], + blockInputsForDescriptions?: Record +): { + commonParameters: CopilotSubblockMetadata[] + operationParameters: Record +} { + const commonParameters: CopilotSubblockMetadata[] = [] + const operationParameters: Record = {} + + for (const sb of subBlocks || []) { + const cond = normalizeCondition(sb.condition) + const simplified = simplifySubBlock(sb) + + if (cond && cond.field === 'operation' && !cond.not && cond.value !== undefined) { + const values: any[] = Array.isArray(cond.value) ? cond.value : [cond.value] + for (const v of values) { + const key = String(v) + if (!operationParameters[key]) operationParameters[key] = [] + operationParameters[key].push(simplified) + } + } else { + // Override description from blockInputs if available (by id or canonicalParamId) + if (blockInputsForDescriptions) { + const candidates = [sb.id, sb.canonicalParamId].filter(Boolean) + for (const key of candidates) { + const bi = (blockInputsForDescriptions as any)[key as string] + if (bi && typeof bi.description === 'string') { + simplified.description = bi.description + break + } + } + } + commonParameters.push(simplified) + } + } + + return { commonParameters, operationParameters } +} + +function computeBlockLevelInputs(blockConfig: BlockConfig): Record { + const inputs = blockConfig.inputs || {} + const subBlocks: any[] = Array.isArray(blockConfig.subBlocks) ? blockConfig.subBlocks : [] + + // Build quick lookup of subBlocks by id and canonicalParamId + const byParamKey: Record = {} + for (const sb of subBlocks) { + if (sb.id) { + byParamKey[sb.id] = byParamKey[sb.id] || [] + byParamKey[sb.id].push(sb) + } + if (sb.canonicalParamId) { + byParamKey[sb.canonicalParamId] = byParamKey[sb.canonicalParamId] || [] + byParamKey[sb.canonicalParamId].push(sb) + } + } + + const blockInputs: Record = {} + for (const key of Object.keys(inputs)) { + const sbs = byParamKey[key] || [] + // If any related subBlock is gated by operation, treat as operation-level and exclude + const isOperationGated = sbs.some((sb) => { + const cond = normalizeCondition(sb.condition) + return cond && cond.field === 'operation' && !cond.not && cond.value !== undefined + }) + if (!isOperationGated) { + blockInputs[key] = inputs[key] } - if (subBlock.options) { - const resolvedOptions = resolveSubBlockOptions(subBlock.options) - processed.options = resolvedOptions.map((option: any) => ({ - label: option.label, - id: option.id, - hasIcon: !!option.icon, - })) + } + + return blockInputs +} + +function computeOperationLevelInputs( + blockConfig: BlockConfig +): Record> { + const inputs = blockConfig.inputs || {} + const subBlocks = Array.isArray(blockConfig.subBlocks) ? blockConfig.subBlocks : [] + + const opInputs: Record> = {} + + // Map subblocks to inputs keys via id or canonicalParamId and collect by operation + for (const sb of subBlocks) { + const cond = normalizeCondition(sb.condition) + if (!cond || cond.field !== 'operation' || cond.not) continue + const keys: string[] = [] + if (sb.canonicalParamId) keys.push(sb.canonicalParamId) + if (sb.id) keys.push(sb.id) + const values = Array.isArray(cond.value) ? cond.value : [cond.value] + for (const key of keys) { + if (!(key in inputs)) continue + for (const v of values) { + const op = String(v) + if (!opInputs[op]) opInputs[op] = {} + opInputs[op][key] = inputs[key] + } + } + } + + return opInputs +} + +function resolveOperationIds( + blockConfig: BlockConfig, + operationParameters: Record +): string[] { + // Prefer explicit operation subblock options if present + const opBlock = (blockConfig.subBlocks || []).find((sb) => sb.id === 'operation') + if (opBlock && Array.isArray(opBlock.options)) { + const ids = opBlock.options.map((o) => o.id).filter(Boolean) + if (ids.length > 0) return ids + } + // Fallback: keys from operationParameters + return Object.keys(operationParameters) +} + +function resolveToolIdForOperation(blockConfig: BlockConfig, opId: string): string | undefined { + try { + const toolSelector = blockConfig.tools?.config?.tool + if (typeof toolSelector === 'function') { + const maybeToolId = toolSelector({ operation: opId }) + if (typeof maybeToolId === 'string') return maybeToolId } - return Object.fromEntries(Object.entries(processed).filter(([_, v]) => v !== undefined)) - }) + } catch {} + return undefined } const DOCS_FILE_MAPPING: Record = {} const SPECIAL_BLOCKS_METADATA: Record = { loop: { - type: 'loop', + id: 'loop', name: 'Loop', description: 'Control flow block for iterating over collections or repeating actions', inputs: { @@ -168,7 +374,6 @@ const SPECIAL_BLOCKS_METADATA: Record = { currentItem: 'any', totalIterations: 'number', }, - tools: { access: [] }, subBlocks: [ { id: 'loopType', @@ -208,7 +413,7 @@ const SPECIAL_BLOCKS_METADATA: Record = { ], }, parallel: { - type: 'parallel', + id: 'parallel', name: 'Parallel', description: 'Control flow block for executing multiple branches simultaneously', inputs: { @@ -218,7 +423,6 @@ const SPECIAL_BLOCKS_METADATA: Record = { maxConcurrency: { type: 'number', required: false, default: 10, minimum: 1, maximum: 50 }, }, outputs: { results: 'array', branchId: 'number', branchItem: 'any', totalBranches: 'number' }, - tools: { access: [] }, subBlocks: [ { id: 'parallelType', diff --git a/apps/sim/lib/copilot/tools/shared/schemas.ts b/apps/sim/lib/copilot/tools/shared/schemas.ts index 2ee5bd07a0..8564eebfa4 100644 --- a/apps/sim/lib/copilot/tools/shared/schemas.ts +++ b/apps/sim/lib/copilot/tools/shared/schemas.ts @@ -10,8 +10,16 @@ export type ExecuteResponseSuccess = z.infer