'use strict';

const path = require('path');

const runtimePath = path.join(__dirname, '..', 'template', 'wall-e', 'lib', 'mcp-integration');
let runtime = null;

function loadRuntime() {
  if (runtime) return runtime;
  try {
    runtime = require(runtimePath);
  } catch {
    runtime = require('../../wall-e/lib/mcp-integration');
  }
  return runtime;
}

module.exports = {
  get MCP_TARGETS() { return loadRuntime().MCP_TARGETS; },
  detectMcpIntegrations: (...args) => loadRuntime().detectMcpIntegrations(...args),
  ensureMcpIntegrations: (...args) => loadRuntime().ensureMcpIntegrations(...args),
  injectMcpConfigs: (...args) => loadRuntime().injectMcpConfigs(...args),
  testWallEMcpEndpoint: (...args) => loadRuntime().testWallEMcpEndpoint(...args),
  wallEMcpUrl: (...args) => loadRuntime().wallEMcpUrl(...args),
};
