diff --git a/apps/sim/blocks/types.ts b/apps/sim/blocks/types.ts index 9523b543e..def037eee 100644 --- a/apps/sim/blocks/types.ts +++ b/apps/sim/blocks/types.ts @@ -243,11 +243,7 @@ export interface SubBlockConfig { hidden?: boolean hideFromPreview?: boolean // Hide this subblock from the workflow block preview requiresFeature?: string // Environment variable name that must be truthy for this subblock to be visible - /** - * Hide this subblock when running on hosted Sim (isHosted is true). - * Used for tool API key fields that should be hidden when Sim provides hosted keys. - */ - hideWhenHosted?: boolean + hideWhenHosted?: boolean // Hide this subblock when running on hosted sim description?: string tooltip?: string // Tooltip text displayed via info icon next to the title value?: (params: Record) => string diff --git a/apps/sim/serializer/index.ts b/apps/sim/serializer/index.ts index 622667d9f..53b72e17c 100644 --- a/apps/sim/serializer/index.ts +++ b/apps/sim/serializer/index.ts @@ -10,6 +10,7 @@ import { isCanonicalPair, isNonEmptyValue, isSubBlockFeatureEnabled, + isSubBlockHiddenByHostedKey, resolveCanonicalMode, } from '@/lib/workflows/subblocks/visibility' import { getBlock } from '@/blocks' @@ -49,6 +50,7 @@ function shouldSerializeSubBlock( canonicalModeOverrides?: CanonicalModeOverrides ): boolean { if (!isSubBlockFeatureEnabled(subBlockConfig)) return false + if (isSubBlockHiddenByHostedKey(subBlockConfig)) return false if (subBlockConfig.mode === 'trigger') { if (!isTriggerContext && !isTriggerCategory) return false diff --git a/apps/sim/tools/index.ts b/apps/sim/tools/index.ts index b94d796d5..44247e2c3 100644 --- a/apps/sim/tools/index.ts +++ b/apps/sim/tools/index.ts @@ -3,6 +3,7 @@ import { generateInternalToken } from '@/lib/auth/internal' import { getBYOKKey } from '@/lib/api-key/byok' import { logFixedUsage } from '@/lib/billing/core/usage-log' import { env } from '@/lib/core/config/env' +import { isHosted } from '@/lib/core/config/feature-flags' import { DEFAULT_EXECUTION_TIMEOUT_MS } from '@/lib/core/execution-limits' import { secureFetchWithPinnedIP, @@ -61,6 +62,7 @@ async function injectHostedKeyIfNeeded( requestId: string ): Promise { if (!tool.hosting) return false + if (!isHosted) return false const { envKeys, apiKeyParam, byokProviderId } = tool.hosting const userProvidedKey = params[apiKeyParam] diff --git a/apps/sim/tools/serper/search.ts b/apps/sim/tools/serper/search.ts index 81861c495..4e4b22919 100644 --- a/apps/sim/tools/serper/search.ts +++ b/apps/sim/tools/serper/search.ts @@ -43,7 +43,7 @@ export const searchTool: ToolConfig = { }, apiKey: { type: 'string', - required: false, + required: true, visibility: 'user-only', description: 'Serper API Key', },