diff --git a/README.md b/README.md index 23c10de618..f25393ba18 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Sim.ai Discord Twitter - Documentation + Documentation DeepWiki

diff --git a/apps/sim/app/api/form/[identifier]/route.ts b/apps/sim/app/api/form/[identifier]/route.ts index 907051f92a..e75dd236c6 100644 --- a/apps/sim/app/api/form/[identifier]/route.ts +++ b/apps/sim/app/api/form/[identifier]/route.ts @@ -11,6 +11,7 @@ import { preprocessExecution } from '@/lib/execution/preprocessing' import { LoggingSession } from '@/lib/logs/execution/logging-session' import { normalizeInputFormatValue } from '@/lib/workflows/input-format' import { createStreamingResponse } from '@/lib/workflows/streaming/streaming' +import { isValidStartBlockType } from '@/lib/workflows/triggers/start-block-types' import { setFormAuthCookie, validateFormAuth } from '@/app/api/form/utils' import { createErrorResponse, createSuccessResponse } from '@/app/api/workflows/utils' @@ -35,10 +36,7 @@ async function getWorkflowInputSchema(workflowId: string): Promise { .from(workflowBlocks) .where(eq(workflowBlocks.workflowId, workflowId)) - const startBlock = blocks.find( - (block) => - block.type === 'starter' || block.type === 'start_trigger' || block.type === 'input_trigger' - ) + const startBlock = blocks.find((block) => isValidStartBlockType(block.type)) if (!startBlock) { return [] diff --git a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/delete-chunk-modal/delete-chunk-modal.tsx b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/delete-chunk-modal/delete-chunk-modal.tsx index 7d69f5e146..ff841ddec9 100644 --- a/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/delete-chunk-modal/delete-chunk-modal.tsx +++ b/apps/sim/app/workspace/[workspaceId]/knowledge/[id]/[documentId]/components/delete-chunk-modal/delete-chunk-modal.tsx @@ -77,7 +77,7 @@ export function DeleteChunkModal({

- {errors.password && ( -

{errors.password}

+

{errors.password}

)}

{existingForm?.hasPassword @@ -519,7 +520,7 @@ export function FormDeploy({ placeholderWithTags='Add another' /> {errors.emails && ( -

{errors.emails}

+

{errors.emails}

)}

Add specific emails or entire domains (@example.com) @@ -550,7 +551,7 @@ export function FormDeploy({ )} {errors.general && ( -

{errors.general}

+

{errors.general}

)} + Generate + ) : ( - handleSchemaPromptChange(e.target.value)} - onBlur={handleSchemaPromptBlur} - onKeyDown={handleSchemaPromptKeyDown} - disabled={schemaGeneration.isStreaming} - className='h-[16px] w-full border-none bg-transparent py-0 pr-[2px] text-right font-medium text-[12px] text-[var(--text-primary)] leading-[14px] placeholder:text-[var(--text-muted)] focus:outline-none' - placeholder='Describe schema...' - /> +
+ handleSchemaPromptChange(e.target.value)} + onBlur={handleSchemaPromptBlur} + onKeyDown={handleSchemaPromptKeyDown} + disabled={schemaGeneration.isStreaming} + className={cn( + 'h-5 max-w-[200px] flex-1 text-[11px]', + schemaGeneration.isStreaming && 'text-muted-foreground' + )} + placeholder='Generate...' + /> + +
)} @@ -952,35 +971,53 @@ try { Code {codeError && !codeGeneration.isStreaming && ( -
+
{codeError}
)}
-
+
{!isCodePromptActive ? ( - + Generate + ) : ( - handleCodePromptChange(e.target.value)} - onBlur={handleCodePromptBlur} - onKeyDown={handleCodePromptKeyDown} - disabled={codeGeneration.isStreaming} - className='h-[16px] w-full border-none bg-transparent py-0 pr-[2px] text-right font-medium text-[12px] text-[var(--text-primary)] leading-[14px] placeholder:text-[var(--text-muted)] focus:outline-none' - placeholder='Describe code...' - /> +
+ handleCodePromptChange(e.target.value)} + onBlur={handleCodePromptBlur} + onKeyDown={handleCodePromptKeyDown} + disabled={codeGeneration.isStreaming} + className={cn( + 'h-5 max-w-[200px] flex-1 text-[11px]', + codeGeneration.isStreaming && 'text-muted-foreground' + )} + placeholder='Generate...' + /> + +
)}
diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx index e403ce37b5..77c6b3da2f 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/panel.tsx @@ -556,14 +556,17 @@ export function Panel() { Delete Workflow

- Deleting this workflow will permanently remove all associated blocks, executions, and - configuration.{' '} + Are you sure you want to delete{' '} + + {currentWorkflow?.name ?? 'this workflow'} + + ? This will permanently remove all associated blocks, executions, and configuration.{' '} This action cannot be undone.

{error && ( -

{error}

+

{error}

)} @@ -306,7 +306,7 @@ export function BYOK() { setDeleteConfirmProvider(null)}> - + Delete API Key

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/copilot/copilot.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/copilot/copilot.tsx index b3aef1a089..f59e970244 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/copilot/copilot.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/copilot/copilot.tsx @@ -211,7 +211,7 @@ export function Copilot() { {/* Create API Key Dialog */} - + Create new API key

@@ -234,7 +234,7 @@ export function Copilot() { autoFocus /> {createError && ( -

{createError}

+

{createError}

)}
@@ -273,7 +273,7 @@ export function Copilot() { } }} > - + Your API key has been created

@@ -310,7 +310,7 @@ export function Copilot() { {/* Delete Confirmation Dialog */} - + Delete API key

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credential-sets/credential-sets.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credential-sets/credential-sets.tsx index 080e0fa3e7..a1fae5b1ab 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credential-sets/credential-sets.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/credential-sets/credential-sets.tsx @@ -824,7 +824,7 @@ export function CredentialSets() { {/* Create Polling Group Modal */} - + Create Polling Group

@@ -897,7 +897,7 @@ export function CredentialSets() { {/* Leave Confirmation Modal */} setLeavingMembership(null)}> - + Leave Polling Group

@@ -925,7 +925,7 @@ export function CredentialSets() { {/* Delete Confirmation Modal */} setDeletingSet(null)}> - + Delete Polling Group

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/custom-tools/custom-tools.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/custom-tools/custom-tools.tsx index c0a85d9a62..33ee8340ad 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/custom-tools/custom-tools.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/custom-tools/custom-tools.tsx @@ -206,7 +206,7 @@ export function CustomTools() { /> - + Delete Custom Tool

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx index 964dcdd91e..63d7072971 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/environment/environment.tsx @@ -821,7 +821,7 @@ export function EnvironmentVariables({ registerBeforeLeaveHandler }: Environment

- + Unsaved Changes

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx index bc4965c661..e02b4c1a50 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/integrations/integrations.tsx @@ -390,7 +390,7 @@ export function Integrations({ onOpenChange, registerCloseHandler }: Integration - + Disconnect Service

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx index 90fba9595e..134417d494 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/mcp/mcp.tsx @@ -1170,7 +1170,7 @@ export function MCP({ initialServerId }: MCPProps) { - + Delete MCP Server

diff --git a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/components/cancel-subscription/cancel-subscription.tsx b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/components/cancel-subscription/cancel-subscription.tsx index 2461f3e739..7e4ef4b278 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/components/cancel-subscription/cancel-subscription.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/components/sidebar/components/settings-modal/components/subscription/components/cancel-subscription/cancel-subscription.tsx @@ -245,10 +245,7 @@ export function CancelSubscription({ subscription, subscriptionData }: CancelSub ? 'Your subscription is set to cancel at the end of the billing period. Would you like to keep your subscription active?' : `You'll be redirected to Stripe to manage your subscription. You'll keep access until ${formatDate( periodEndDate - )}, then downgrade to free plan.`}{' '} - {!isCancelAtPeriodEnd && ( - This action cannot be undone. - )} + )}, then downgrade to free plan. You can restore your subscription at any time.`}

{!isCancelAtPeriodEnd && ( @@ -266,7 +263,7 @@ export function CancelSubscription({ subscription, subscriptionData }: CancelSub
+ + +
+
) } diff --git a/apps/sim/lib/copilot/tools/client/workflow/get-block-upstream-references.ts b/apps/sim/lib/copilot/tools/client/workflow/get-block-upstream-references.ts index 749c04919a..a0b03e9232 100644 --- a/apps/sim/lib/copilot/tools/client/workflow/get-block-upstream-references.ts +++ b/apps/sim/lib/copilot/tools/client/workflow/get-block-upstream-references.ts @@ -17,6 +17,7 @@ import { type GetBlockUpstreamReferencesResultType, } from '@/lib/copilot/tools/shared/schemas' import { BlockPathCalculator } from '@/lib/workflows/blocks/block-path-calculator' +import { isValidStartBlockType } from '@/lib/workflows/triggers/start-block-types' import { useWorkflowRegistry } from '@/stores/workflows/registry/store' import { useWorkflowStore } from '@/stores/workflows/workflow/store' import type { Loop, Parallel } from '@/stores/workflows/workflow/types' @@ -140,9 +141,7 @@ export class GetBlockUpstreamReferencesClientTool extends BaseClientTool { const accessibleIds = new Set(ancestorIds) accessibleIds.add(blockId) - const starterBlock = Object.values(blocks).find( - (b) => b.type === 'starter' || b.type === 'start_trigger' - ) + const starterBlock = Object.values(blocks).find((b) => isValidStartBlockType(b.type)) if (starterBlock && ancestorIds.includes(starterBlock.id)) { accessibleIds.add(starterBlock.id) } diff --git a/apps/sim/lib/mcp/workflow-tool-schema.ts b/apps/sim/lib/mcp/workflow-tool-schema.ts index 45572ea52c..3e7555c3f6 100644 --- a/apps/sim/lib/mcp/workflow-tool-schema.ts +++ b/apps/sim/lib/mcp/workflow-tool-schema.ts @@ -1,6 +1,6 @@ import { z } from 'zod' import { normalizeInputFormatValue } from '@/lib/workflows/input-format' -import { isValidStartBlockType } from '@/lib/workflows/triggers/trigger-utils' +import { isValidStartBlockType } from '@/lib/workflows/triggers/start-block-types' import type { InputFormatField } from '@/lib/workflows/types' import type { McpToolSchema } from './types' diff --git a/apps/sim/lib/workflows/input-format.ts b/apps/sim/lib/workflows/input-format.ts index 5e857464d4..d4c8b242f6 100644 --- a/apps/sim/lib/workflows/input-format.ts +++ b/apps/sim/lib/workflows/input-format.ts @@ -1,3 +1,4 @@ +import { isValidStartBlockType } from '@/lib/workflows/triggers/start-block-types' import type { InputFormatField } from '@/lib/workflows/types' /** @@ -23,7 +24,7 @@ export function extractInputFieldsFromBlocks( // Find trigger block const triggerEntry = Object.entries(blocks).find(([, block]) => { const b = block as Record - return b.type === 'start_trigger' || b.type === 'input_trigger' || b.type === 'starter' + return typeof b.type === 'string' && isValidStartBlockType(b.type) }) if (!triggerEntry) return [] diff --git a/apps/sim/lib/workflows/triggers/start-block-types.ts b/apps/sim/lib/workflows/triggers/start-block-types.ts new file mode 100644 index 0000000000..5bf389f91f --- /dev/null +++ b/apps/sim/lib/workflows/triggers/start-block-types.ts @@ -0,0 +1,21 @@ +/** + * Valid start block types that can trigger a workflow + * This module is kept lightweight with no dependencies to avoid circular imports + */ +export const VALID_START_BLOCK_TYPES = [ + 'starter', + 'start', + 'start_trigger', + 'api', + 'api_trigger', + 'input_trigger', +] as const + +export type ValidStartBlockType = (typeof VALID_START_BLOCK_TYPES)[number] + +/** + * Check if a block type is a valid start block type + */ +export function isValidStartBlockType(blockType: string): blockType is ValidStartBlockType { + return VALID_START_BLOCK_TYPES.includes(blockType as ValidStartBlockType) +} diff --git a/apps/sim/lib/workflows/triggers/trigger-utils.ts b/apps/sim/lib/workflows/triggers/trigger-utils.ts index 718101fa93..de68af8a7b 100644 --- a/apps/sim/lib/workflows/triggers/trigger-utils.ts +++ b/apps/sim/lib/workflows/triggers/trigger-utils.ts @@ -1,4 +1,5 @@ import { createLogger } from '@sim/logger' +import { isValidStartBlockType } from '@/lib/workflows/triggers/start-block-types' import { type StartBlockCandidate, StartBlockPath, @@ -11,27 +12,6 @@ import { getTrigger } from '@/triggers' const logger = createLogger('TriggerUtils') -/** - * Valid start block types that can trigger a workflow - */ -export const VALID_START_BLOCK_TYPES = [ - 'starter', - 'start', - 'start_trigger', - 'api', - 'api_trigger', - 'input_trigger', -] as const - -export type ValidStartBlockType = (typeof VALID_START_BLOCK_TYPES)[number] - -/** - * Check if a block type is a valid start block type - */ -export function isValidStartBlockType(blockType: string): blockType is ValidStartBlockType { - return VALID_START_BLOCK_TYPES.includes(blockType as ValidStartBlockType) -} - /** * Check if a workflow state has a valid start block */