mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-12 15:34:58 -05:00
update change detection to account for synthetic tool ids
This commit is contained in:
@@ -645,6 +645,18 @@ describe('Workflow Normalization Utilities', () => {
|
||||
const result = filterSubBlockIds(ids)
|
||||
expect(result).toEqual(['signingSecret'])
|
||||
})
|
||||
|
||||
it.concurrent('should exclude synthetic tool-input subBlock IDs', () => {
|
||||
const ids = [
|
||||
'toolConfig',
|
||||
'toolConfig-tool-0-query',
|
||||
'toolConfig-tool-0-url',
|
||||
'toolConfig-tool-1-status',
|
||||
'systemPrompt',
|
||||
]
|
||||
const result = filterSubBlockIds(ids)
|
||||
expect(result).toEqual(['systemPrompt', 'toolConfig'])
|
||||
})
|
||||
})
|
||||
|
||||
describe('normalizeTriggerConfigValues', () => {
|
||||
|
||||
@@ -411,7 +411,14 @@ export function extractBlockFieldsForComparison(block: BlockState): ExtractedBlo
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters subBlock IDs to exclude system and trigger runtime subBlocks.
|
||||
* Pattern matching synthetic subBlock IDs created by ToolSubBlockRenderer.
|
||||
* These IDs follow the format `{subBlockId}-tool-{index}-{paramId}` and are
|
||||
* mirrors of values already stored in toolConfig.value.tools[N].params.
|
||||
*/
|
||||
const SYNTHETIC_TOOL_SUBBLOCK_RE = /-tool-\d+-/
|
||||
|
||||
/**
|
||||
* Filters subBlock IDs to exclude system, trigger runtime, and synthetic tool subBlocks.
|
||||
*
|
||||
* @param subBlockIds - Array of subBlock IDs to filter
|
||||
* @returns Filtered and sorted array of subBlock IDs
|
||||
@@ -422,6 +429,7 @@ export function filterSubBlockIds(subBlockIds: string[]): string[] {
|
||||
if (TRIGGER_RUNTIME_SUBBLOCK_IDS.includes(id)) return false
|
||||
if (SYSTEM_SUBBLOCK_IDS.some((sysId) => id === sysId || id.startsWith(`${sysId}_`)))
|
||||
return false
|
||||
if (SYNTHETIC_TOOL_SUBBLOCK_RE.test(id)) return false
|
||||
return true
|
||||
})
|
||||
.sort()
|
||||
|
||||
Reference in New Issue
Block a user