mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-28 03:00:29 -04:00
fix(triggers): handle trigger-advanced mode in deploy, preview, params, and copilot
This commit is contained in:
@@ -98,7 +98,7 @@ export function CredentialSelector({
|
||||
)
|
||||
const provider = effectiveProviderId
|
||||
|
||||
const isTriggerMode = subBlock.mode === 'trigger'
|
||||
const isTriggerMode = subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced'
|
||||
|
||||
const {
|
||||
data: rawCredentials = [],
|
||||
|
||||
@@ -1153,8 +1153,10 @@ function PreviewEditorContent({
|
||||
if (subBlock.type === ('trigger-config' as SubBlockType)) {
|
||||
return effectiveTrigger || isPureTriggerBlock
|
||||
}
|
||||
if (subBlock.mode === 'trigger' && !effectiveTrigger) return false
|
||||
if (effectiveTrigger && subBlock.mode !== 'trigger') return false
|
||||
if ((subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') && !effectiveTrigger)
|
||||
return false
|
||||
if (effectiveTrigger && subBlock.mode !== 'trigger' && subBlock.mode !== 'trigger-advanced')
|
||||
return false
|
||||
if (!isSubBlockFeatureEnabled(subBlock)) return false
|
||||
if (
|
||||
!isSubBlockVisibleForMode(
|
||||
|
||||
@@ -319,11 +319,11 @@ function WorkflowPreviewBlockInner({ data }: NodeProps<WorkflowPreviewBlockData>
|
||||
|
||||
if (effectiveTrigger) {
|
||||
const isValidTriggerSubblock = isPureTriggerBlock
|
||||
? subBlock.mode === 'trigger' || !subBlock.mode
|
||||
: subBlock.mode === 'trigger'
|
||||
? subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced' || !subBlock.mode
|
||||
: subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced'
|
||||
if (!isValidTriggerSubblock) return false
|
||||
} else {
|
||||
if (subBlock.mode === 'trigger') return false
|
||||
if (subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') return false
|
||||
}
|
||||
|
||||
/** Skip value-dependent visibility checks in lightweight mode */
|
||||
|
||||
@@ -185,7 +185,10 @@ export const getBlocksMetadataServerTool: BaseServerTool<
|
||||
|
||||
const configFields: Record<string, any> = {}
|
||||
for (const subBlock of trig.subBlocks) {
|
||||
if (subBlock.mode === 'trigger' && !SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)) {
|
||||
if (
|
||||
(subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') &&
|
||||
!SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)
|
||||
) {
|
||||
const fieldDef: any = {
|
||||
type: subBlock.type,
|
||||
required: subBlock.required || false,
|
||||
@@ -227,7 +230,9 @@ export const getBlocksMetadataServerTool: BaseServerTool<
|
||||
const blockInputs = computeBlockLevelInputs(blockConfig)
|
||||
const { commonParameters, operationParameters } = splitParametersByOperation(
|
||||
Array.isArray(blockConfig.subBlocks)
|
||||
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
|
||||
? blockConfig.subBlocks.filter(
|
||||
(sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced'
|
||||
)
|
||||
: [],
|
||||
blockInputs
|
||||
)
|
||||
@@ -424,7 +429,7 @@ function extractInputs(metadata: CopilotBlockMetadata): {
|
||||
|
||||
for (const schema of metadata.inputSchema || []) {
|
||||
// Skip trigger subBlocks - they're handled separately in triggers.configFields
|
||||
if (schema.mode === 'trigger') {
|
||||
if (schema.mode === 'trigger' || schema.mode === 'trigger-advanced') {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -910,7 +915,7 @@ function splitParametersByOperation(
|
||||
function computeBlockLevelInputs(blockConfig: BlockConfig): Record<string, any> {
|
||||
const inputs = blockConfig.inputs || {}
|
||||
const subBlocks: any[] = Array.isArray(blockConfig.subBlocks)
|
||||
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
|
||||
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced')
|
||||
: []
|
||||
|
||||
const byParamKey: Record<string, any[]> = {}
|
||||
@@ -945,7 +950,7 @@ function computeOperationLevelInputs(
|
||||
): Record<string, Record<string, any>> {
|
||||
const inputs = blockConfig.inputs || {}
|
||||
const subBlocks = Array.isArray(blockConfig.subBlocks)
|
||||
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger')
|
||||
? blockConfig.subBlocks.filter((sb) => sb.mode !== 'trigger' && sb.mode !== 'trigger-advanced')
|
||||
: []
|
||||
|
||||
const opInputs: Record<string, Record<string, any>> = {}
|
||||
|
||||
@@ -183,7 +183,11 @@ function buildProviderConfig(
|
||||
)
|
||||
|
||||
triggerDef.subBlocks
|
||||
.filter((subBlock) => subBlock.mode === 'trigger' && !SYSTEM_SUBBLOCK_IDS.includes(subBlock.id))
|
||||
.filter(
|
||||
(subBlock) =>
|
||||
(subBlock.mode === 'trigger' || subBlock.mode === 'trigger-advanced') &&
|
||||
!SYSTEM_SUBBLOCK_IDS.includes(subBlock.id)
|
||||
)
|
||||
.forEach((subBlock) => {
|
||||
const valueToUse = getConfigValue(block, subBlock)
|
||||
if (valueToUse !== null && valueToUse !== undefined && valueToUse !== '') {
|
||||
|
||||
@@ -66,7 +66,7 @@ export interface UIComponentConfig {
|
||||
/** Canonical parameter ID if this is part of a canonical group */
|
||||
canonicalParamId?: string
|
||||
/** The mode of the source subblock (basic/advanced/both) */
|
||||
mode?: 'basic' | 'advanced' | 'both' | 'trigger'
|
||||
mode?: 'basic' | 'advanced' | 'both' | 'trigger' | 'trigger-advanced'
|
||||
/** The actual subblock ID this config was derived from */
|
||||
actualSubBlockId?: string
|
||||
/** Wand configuration for AI assistance */
|
||||
@@ -944,7 +944,7 @@ export function getSubBlocksForToolInput(
|
||||
if (EXCLUDED_SUBBLOCK_TYPES.has(sb.type)) continue
|
||||
|
||||
// Skip trigger-mode-only subblocks
|
||||
if (sb.mode === 'trigger') continue
|
||||
if (sb.mode === 'trigger' || sb.mode === 'trigger-advanced') continue
|
||||
|
||||
// Hide tool API key fields when running on hosted Sim or when env var is set
|
||||
if (isSubBlockHidden(sb)) continue
|
||||
|
||||
Reference in New Issue
Block a user