()
| 1790 | // Nested: needs closure access to sdkMcpConfigs, applyMcpServerChanges, |
| 1791 | // updateSdkMcp. |
| 1792 | async function applyPluginMcpDiff(): Promise<void> { |
| 1793 | const { servers: newConfigs } = await getAllMcpConfigs() |
| 1794 | const supportedConfigs: Record<string, McpServerConfigForProcessTransport> = |
| 1795 | {} |
| 1796 | for (const [name, config] of Object.entries(newConfigs)) { |
| 1797 | const type = config.type |
| 1798 | if ( |
| 1799 | type === undefined || |
| 1800 | type === 'stdio' || |
| 1801 | type === 'sse' || |
| 1802 | type === 'http' || |
| 1803 | type === 'sdk' |
| 1804 | ) { |
| 1805 | supportedConfigs[name] = config |
| 1806 | } |
| 1807 | } |
| 1808 | for (const [name, config] of Object.entries(sdkMcpConfigs)) { |
| 1809 | if (config.type === 'sdk' && !(name in supportedConfigs)) { |
| 1810 | supportedConfigs[name] = config |
| 1811 | } |
| 1812 | } |
| 1813 | const { response, sdkServersChanged } = |
| 1814 | await applyMcpServerChanges(supportedConfigs) |
| 1815 | if (sdkServersChanged) { |
| 1816 | void updateSdkMcp() |
| 1817 | } |
| 1818 | logForDebugging( |
| 1819 | `Headless MCP refresh: added=${response.added.length}, removed=${response.removed.length}`, |
| 1820 | ) |
| 1821 | } |
| 1822 | |
| 1823 | // Subscribe to skill changes for hot reloading |
| 1824 | const unsubscribeSkillChanges = skillChangeDetector.subscribe(() => { |
no test coverage detected