🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@wecom/aibot-node-sdk

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wecom/aibot-node-sdk - npm Package Compare versions

Comparing version
1.0.6
to
1.0.7-beta.0
+29
-2
dist/index.cjs.js

@@ -125,2 +125,14 @@ 'use strict';

/**
* 解析代理 URL(从环境变量)
*
* 优先级:HTTPS_PROXY → https_proxy → HTTP_PROXY → http_proxy
*/
function resolveProxyUrl() {
return (process.env.HTTPS_PROXY ||
process.env.https_proxy ||
process.env.HTTP_PROXY ||
process.env.http_proxy ||
'');
}
/**
* 企业微信 API 客户端

@@ -132,3 +144,3 @@ * 仅负责文件下载等 HTTP 辅助功能,消息收发均走 WebSocket 通道

this.logger = logger;
this.httpClient = axios.create({
const config = {
timeout,

@@ -138,3 +150,18 @@ headers: {

},
});
};
// 自动检测代理环境变量,使用 CONNECT 隧道代理 HTTPS 请求
const proxyUrl = resolveProxyUrl();
if (proxyUrl) {
try {
const { HttpsProxyAgent } = require('https-proxy-agent');
config.httpsAgent = new HttpsProxyAgent(proxyUrl);
config.proxy = false; // 禁用 axios 内置代理解析,使用 agent
logger.info(`Using HTTPS proxy for API client: ${proxyUrl}`);
}
catch {
// https-proxy-agent 不可用时静默降级,不影响直连场景
logger.debug('https-proxy-agent not available, using direct connection');
}
}
this.httpClient = axios.create(config);
}

@@ -141,0 +168,0 @@ /**

@@ -121,2 +121,14 @@ import { EventEmitter } from 'eventemitter3';

/**
* 解析代理 URL(从环境变量)
*
* 优先级:HTTPS_PROXY → https_proxy → HTTP_PROXY → http_proxy
*/
function resolveProxyUrl() {
return (process.env.HTTPS_PROXY ||
process.env.https_proxy ||
process.env.HTTP_PROXY ||
process.env.http_proxy ||
'');
}
/**
* 企业微信 API 客户端

@@ -128,3 +140,3 @@ * 仅负责文件下载等 HTTP 辅助功能,消息收发均走 WebSocket 通道

this.logger = logger;
this.httpClient = axios.create({
const config = {
timeout,

@@ -134,3 +146,18 @@ headers: {

},
});
};
// 自动检测代理环境变量,使用 CONNECT 隧道代理 HTTPS 请求
const proxyUrl = resolveProxyUrl();
if (proxyUrl) {
try {
const { HttpsProxyAgent } = require('https-proxy-agent');
config.httpsAgent = new HttpsProxyAgent(proxyUrl);
config.proxy = false; // 禁用 axios 内置代理解析,使用 agent
logger.info(`Using HTTPS proxy for API client: ${proxyUrl}`);
}
catch {
// https-proxy-agent 不可用时静默降级,不影响直连场景
logger.debug('https-proxy-agent not available, using direct connection');
}
}
this.httpClient = axios.create(config);
}

@@ -137,0 +164,0 @@ /**

+4
-1
{
"name": "@wecom/aibot-node-sdk",
"version": "1.0.6",
"version": "1.0.7-beta.0",
"description": "企业微信智能机器人 Node.js SDK - WebSocket 长连接通道",

@@ -42,3 +42,6 @@ "main": "dist/index.cjs.js",

"ws": "^8.16.0"
},
"optionalDependencies": {
"https-proxy-agent": "^7.0.0"
}
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display