orchestrix-yuri 4.5.2 → 4.5.3
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.
|
@@ -3,6 +3,32 @@
|
|
|
3
3
|
const { Bot } = require('grammy');
|
|
4
4
|
const { log } = require('../log');
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* Detect proxy from environment variables and return grammy-compatible config.
|
|
8
|
+
* Node.js native https does NOT respect http_proxy/https_proxy env vars,
|
|
9
|
+
* so we must explicitly configure a proxy agent for grammy.
|
|
10
|
+
*/
|
|
11
|
+
function getProxyConfig() {
|
|
12
|
+
const proxyUrl = process.env.https_proxy || process.env.HTTPS_PROXY
|
|
13
|
+
|| process.env.http_proxy || process.env.HTTP_PROXY;
|
|
14
|
+
if (!proxyUrl) return {};
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
18
|
+
const agent = new HttpsProxyAgent(proxyUrl);
|
|
19
|
+
log.telegram(`Using proxy: ${proxyUrl}`);
|
|
20
|
+
return {
|
|
21
|
+
baseFetchConfig: {
|
|
22
|
+
agent,
|
|
23
|
+
compress: true,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
} catch {
|
|
27
|
+
log.warn('https-proxy-agent not available, proxy env vars will be ignored');
|
|
28
|
+
return {};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
6
32
|
/**
|
|
7
33
|
* Telegram channel adapter using grammy (polling mode).
|
|
8
34
|
*/
|
|
@@ -23,7 +49,7 @@ class TelegramAdapter {
|
|
|
23
49
|
throw new Error('Telegram bot token is required. Run: orchestrix-yuri start --token YOUR_TOKEN');
|
|
24
50
|
}
|
|
25
51
|
|
|
26
|
-
this.bot = new Bot(this.token);
|
|
52
|
+
this.bot = new Bot(this.token, { client: getProxyConfig() });
|
|
27
53
|
|
|
28
54
|
// Handle text messages
|
|
29
55
|
this.bot.on('message:text', async (ctx) => {
|
|
@@ -200,6 +226,17 @@ function splitMessage(text, maxLength) {
|
|
|
200
226
|
function forceDisconnectPolling(token) {
|
|
201
227
|
const https = require('https');
|
|
202
228
|
|
|
229
|
+
// Use proxy agent if available
|
|
230
|
+
let agent = undefined;
|
|
231
|
+
const proxyUrl = process.env.https_proxy || process.env.HTTPS_PROXY
|
|
232
|
+
|| process.env.http_proxy || process.env.HTTP_PROXY;
|
|
233
|
+
if (proxyUrl) {
|
|
234
|
+
try {
|
|
235
|
+
const { HttpsProxyAgent } = require('https-proxy-agent');
|
|
236
|
+
agent = new HttpsProxyAgent(proxyUrl);
|
|
237
|
+
} catch { /* ok */ }
|
|
238
|
+
}
|
|
239
|
+
|
|
203
240
|
const call = (method, body) => new Promise((resolve) => {
|
|
204
241
|
const data = JSON.stringify(body);
|
|
205
242
|
const req = https.request({
|
|
@@ -208,6 +245,7 @@ function forceDisconnectPolling(token) {
|
|
|
208
245
|
method: 'POST',
|
|
209
246
|
headers: { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(data) },
|
|
210
247
|
timeout: 10000,
|
|
248
|
+
agent,
|
|
211
249
|
}, (res) => {
|
|
212
250
|
let buf = '';
|
|
213
251
|
res.on('data', (d) => { buf += d; });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orchestrix-yuri",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.3",
|
|
4
4
|
"description": "Yuri — Meta-Orchestrator for Orchestrix. Drive your entire project lifecycle with natural language.",
|
|
5
5
|
"main": "lib/installer.js",
|
|
6
6
|
"bin": {
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@larksuiteoapi/node-sdk": "^1.60.0",
|
|
36
36
|
"grammy": "^1.41.1",
|
|
37
|
+
"https-proxy-agent": "^8.0.0",
|
|
37
38
|
"js-yaml": "^4.1.1"
|
|
38
39
|
}
|
|
39
40
|
}
|