agentschat-mcp 0.36.23 → 0.36.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/cli.mjs CHANGED
@@ -198,6 +198,48 @@ if (typeof globalThis.Bun !== "undefined") {
198
198
  : "./server.ts"
199
199
  );
200
200
  } else {
201
+ const hasHttpProxy = Boolean(
202
+ process.env.HTTPS_PROXY ||
203
+ process.env.HTTP_PROXY ||
204
+ process.env.https_proxy ||
205
+ process.env.http_proxy,
206
+ );
207
+ if (
208
+ hasHttpProxy &&
209
+ process.env.AGENTCHAT_NO_PROXY !== "1" &&
210
+ !process.env.NODE_USE_ENV_PROXY &&
211
+ !helpRequested &&
212
+ !botsMode &&
213
+ !codexMode
214
+ ) {
215
+ const selfPath = fileURLToPath(import.meta.url);
216
+ const childEnv = { ...process.env, NODE_USE_ENV_PROXY: "1" };
217
+ for (const key of ["NO_PROXY", "no_proxy"]) {
218
+ const cur = childEnv[key]?.trim() || "";
219
+ const items = cur ? cur.split(",").map((s) => s.trim()).filter(Boolean) : [];
220
+ for (const host of ["localhost", "127.0.0.1", "::1", "[::1]"]) {
221
+ if (!items.includes(host)) items.push(host);
222
+ }
223
+ childEnv[key] = items.join(",");
224
+ }
225
+ const child = spawn(process.execPath, [selfPath, ...filteredArgs], {
226
+ env: childEnv,
227
+ stdio: "inherit",
228
+ });
229
+ for (const sig of ["SIGINT", "SIGTERM"]) {
230
+ process.on(sig, () => {
231
+ try {
232
+ child.kill(sig);
233
+ } catch {}
234
+ });
235
+ }
236
+ const exitCode = await new Promise((resolve) => {
237
+ child.on("exit", (code, signal) => resolve(signal ? 128 : (code ?? 0)));
238
+ child.on("error", () => resolve(1));
239
+ });
240
+ process.exit(exitCode);
241
+ }
242
+
201
243
  await import(
202
244
  botsMode
203
245
  ? "../dist/codex-bots.js"