MCPcopy Create free account
hub / github.com/EvoMap/evolver / _codexConfigExpectsProxy

Function _codexConfigExpectsProxy

src/adapters/scripts/evolver-session-start.js:83–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

81}
82
83function _codexConfigExpectsProxy() {
84 const file = _codexConfigPath();
85 if (!file || !fs.existsSync(file)) return false;
86 let selectedProvider = null;
87 let section = '';
88 const providerUrls = {};
89 try {
90 const content = fs.readFileSync(file, 'utf8');
91 for (const line of content.split(/\r?\n/)) {
92 const clean = _stripTomlComment(line);
93 if (!clean) continue;
94 const sectionMatch = clean.match(/^\[([^\]]+)\]$/);
95 if (sectionMatch) {
96 section = sectionMatch[1].trim();
97 continue;
98 }
99 const kv = clean.match(/^([A-Za-z0-9_.-]+)\s*=\s*([\s\S]+)$/);
100 if (!kv) continue;
101 const key = kv[1].trim();
102 const value = _tomlStringValue(kv[2]);
103 if (!section && key === 'model_provider') {
104 selectedProvider = value;
105 continue;
106 }
107 const providerMatch = section.match(/^model_providers\.([A-Za-z0-9_.-]+)$/);
108 if (providerMatch && key === 'base_url') {
109 providerUrls[providerMatch[1]] = value;
110 continue;
111 }
112 if (!section && key === 'base_url' && _isLoopbackProxyUrl(value)) return true;
113 }
114 } catch {
115 return false;
116 }
117 if (selectedProvider && _isLoopbackProxyUrl(providerUrls[selectedProvider])) return true;
118 return Object.keys(providerUrls).some(name =>
119 /(?:evomap|proxy)/i.test(name) && _isLoopbackProxyUrl(providerUrls[name])
120 );
121}
122
123function _proxyExpected() {
124 if (String(process.env.EVOMAP_PROXY || '').trim() === '1') return true;

Callers 1

_proxyExpectedFunction · 0.85

Calls 4

_codexConfigPathFunction · 0.85
_stripTomlCommentFunction · 0.85
_tomlStringValueFunction · 0.85
_isLoopbackProxyUrlFunction · 0.85

Tested by

no test coverage detected