| 473 | // Helper function to find params with loadConfig recursively |
| 474 | // Example: Finds ["agentModel", "agentSelectedTool"] from the inputParams structure |
| 475 | const findParamsWithLoadConfig = (inputParams: any[]): string[] => { |
| 476 | const paramsWithLoadConfig: string[] = [] |
| 477 | |
| 478 | for (const param of inputParams) { |
| 479 | // Direct loadConfig param (e.g., agentModel with loadConfig: true) |
| 480 | if (param.loadConfig === true) { |
| 481 | paramsWithLoadConfig.push(param.name) |
| 482 | } |
| 483 | |
| 484 | // Check nested array parameters (e.g., agentTools.array contains agentSelectedTool with loadConfig: true) |
| 485 | if (param.type === 'array' && param.array && Array.isArray(param.array)) { |
| 486 | const nestedParams = findParamsWithLoadConfig(param.array) |
| 487 | paramsWithLoadConfig.push(...nestedParams) |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | return paramsWithLoadConfig |
| 492 | } |
| 493 | |
| 494 | // Helper function to find value of a parameter recursively in nested objects/arrays |
| 495 | // Example: Searches for "agentSelectedTool" value in complex nested inputs structure |