Skip to content

Commit 5c53822

Browse files
committed
fix(triggers): handle trigger-advanced mode in deploy, preview, params, and copilot
1 parent dddd642 commit 5c53822

6 files changed

Lines changed: 25 additions & 14 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/credential-selector/credential-selector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export function CredentialSelector({
9898
)
9999
const provider = effectiveProviderId
100100

101-
const isTriggerMode = subBlock.mode === 'trigger'
101+
const isTriggerMode = subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced'
102102

103103
const {
104104
data: rawCredentials = [],

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-editor/preview-editor.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,8 +1153,10 @@ function PreviewEditorContent({
11531153
if (subBlock.type === ('trigger-config' as SubBlockType)) {
11541154
return effectiveTrigger || isPureTriggerBlock
11551155
}
1156-
if (subBlock.mode === 'trigger' && !effectiveTrigger) return false
1157-
if (effectiveTrigger && subBlock.mode !== 'trigger') return false
1156+
if ((subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') && !effectiveTrigger)
1157+
return false
1158+
if (effectiveTrigger && subBlock.mode !== 'trigger' && subBlock.mode !== 'trigger-advanced')
1159+
return false
11581160
if (!isSubBlockFeatureEnabled(subBlock)) return false
11591161
if (
11601162
!isSubBlockVisibleForMode(

apps/sim/app/workspace/[workspaceId]/w/components/preview/components/preview-workflow/components/block/block.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,11 +319,11 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
319319

320320
if (effectiveTrigger) {
321321
const isValidTriggerSubblock = isPureTriggerBlock
322-
? subBlock.mode === 'trigger' || !subBlock.mode
323-
: subBlock.mode === 'trigger'
322+
? subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced' || !subBlock.mode
323+
: subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced'
324324
if (!isValidTriggerSubblock) return false
325325
} else {
326-
if (subBlock.mode === 'trigger') return false
326+
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') return false
327327
}
328328

329329
/** Skip value-dependent visibility checks in lightweight mode */

apps/sim/lib/copilot/tools/server/blocks/get-blocks-metadata-tool.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ export const getBlocksMetadataServerTool: BaseServerTool<
185185

186186
const configFields: Record<string, any> = {}
187187
for (const subBlock of trig.subBlocks) {
188-
if (subBlock.mode === 'trigger' && !SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)) {
188+
if (
189+
(subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') &&
190+
!SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)
191+
) {
189192
const fieldDef: any = {
190193
type: subBlock.type,
191194
required: subBlock.required || false,
@@ -227,7 +230,9 @@ export const getBlocksMetadataServerTool: BaseServerTool<
227230
const blockInputs = computeBlockLevelInputs(blockConfig)
228231
const { commonParameters, operationParameters } = splitParametersByOperation(
229232
Array.isArray(blockConfig.subBlocks)
230-
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
233+
? blockConfig.subBlocks.filter(
234+
(sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced'
235+
)
231236
: [],
232237
blockInputs
233238
)
@@ -424,7 +429,7 @@ function extractInputs(metadata: CopilotBlockMetadata): {
424429

425430
for (const schema of metadata.inputSchema || []) {
426431
// Skip trigger subBlocks - they're handled separately in triggers.configFields
427-
if (schema.mode === 'trigger') {
432+
if (schema.mode === 'trigger' || schema.mode === 'trigger-advanced') {
428433
continue
429434
}
430435

@@ -910,7 +915,7 @@ function splitParametersByOperation(
910915
function computeBlockLevelInputs(blockConfig: BlockConfig): Record<string, any> {
911916
const inputs = blockConfig.inputs || {}
912917
const subBlocks: any[] = Array.isArray(blockConfig.subBlocks)
913-
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
918+
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced')
914919
: []
915920

916921
const byParamKey: Record<string, any[]> = {}
@@ -945,7 +950,7 @@ function computeOperationLevelInputs(
945950
): Record<string, Record<string, any>> {
946951
const inputs = blockConfig.inputs || {}
947952
const subBlocks = Array.isArray(blockConfig.subBlocks)
948-
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
953+
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced')
949954
: []
950955

951956
const opInputs: Record<string, Record<string, any>> = {}

apps/sim/lib/webhooks/deploy.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,11 @@ function buildProviderConfig(
183183
)
184184

185185
triggerDef.subBlocks
186-
.filter((subBlock) => subBlock.mode === 'trigger' && !SYSTEM_SUBBLOCK_IDS.includes(subBlock.id))
186+
.filter(
187+
(subBlock) =>
188+
(subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') &&
189+
!SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)
190+
)
187191
.forEach((subBlock) => {
188192
const valueToUse = getConfigValue(block, subBlock)
189193
if (valueToUse !== null && valueToUse !== undefined && valueToUse !== '') {

apps/sim/tools/params.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export interface UIComponentConfig {
6666
/** Canonical parameter ID if this is part of a canonical group */
6767
canonicalParamId?: string
6868
/** The mode of the source subblock (basic/advanced/both) */
69-
mode?: 'basic' | 'advanced' | 'both' | 'trigger'
69+
mode?: 'basic' | 'advanced' | 'both' | 'trigger' | 'trigger-advanced'
7070
/** The actual subblock ID this config was derived from */
7171
actualSubBlockId?: string
7272
/** Wand configuration for AI assistance */
@@ -944,7 +944,7 @@ export function getSubBlocksForToolInput(
944944
if (EXCLUDED_SUBBLOCK_TYPES.has(sb.type)) continue
945945

946946
// Skip trigger-mode-only subblocks
947-
if (sb.mode === 'trigger') continue
947+
if (sb.mode === 'trigger' || sb.mode === 'trigger-advanced') continue
948948

949949
// Hide tool API key fields when running on hosted Sim or when env var is set
950950
if (isSubBlockHidden(sb)) continue

0 commit comments

Comments
 (0)