| 583 | |
| 584 | // Find all config values (handle arrays) |
| 585 | const findAllConfigValues = (obj: any, paramName: string): any[] => { |
| 586 | const results: any[] = [] |
| 587 | |
| 588 | if (typeof obj !== 'object' || obj === null) { |
| 589 | return results |
| 590 | } |
| 591 | |
| 592 | // Handle arrays (e.g., agentTools array) |
| 593 | if (Array.isArray(obj)) { |
| 594 | for (const item of obj) { |
| 595 | results.push(...findAllConfigValues(item, paramName)) |
| 596 | } |
| 597 | return results |
| 598 | } |
| 599 | |
| 600 | // Direct property match |
| 601 | if (Object.prototype.hasOwnProperty.call(obj, paramName)) { |
| 602 | results.push(obj[paramName]) |
| 603 | } |
| 604 | |
| 605 | // Recursively search nested objects |
| 606 | for (const value of Object.values(obj)) { |
| 607 | results.push(...findAllConfigValues(value, paramName)) |
| 608 | } |
| 609 | |
| 610 | return results |
| 611 | } |
| 612 | |
| 613 | const configValues = findAllConfigValues(paramsObj, configParamName) |
| 614 | |