aixxai 1.7.10 → 1.7.11
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/bin/aixx.js +12 -0
- package/package.json +4 -1
- package/src/commands/market.js +25 -5
package/bin/aixx.js
CHANGED
|
@@ -44,6 +44,18 @@ const VERSION = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), '
|
|
|
44
44
|
// 改完后请全局搜索 "安全警告" 同步更新 env.js 与 templates/QUICKSTART.md 中的同名地址。
|
|
45
45
|
export const DEFAULT_BASE_URL = 'https://console.aixx.ai/v1';
|
|
46
46
|
|
|
47
|
+
// 1123质检靶单②修: 企业代理环境支持——Node原生fetch不认HTTP(S)_PROXY(公司内网agent用户全挂实锤)。
|
|
48
|
+
// undici ProxyAgent显式接管: 读 HTTPS_PROXY/HTTP_PROXY/ALL_PROXY(小写优先)·无代理零影响。
|
|
49
|
+
try {
|
|
50
|
+
const _px = process.env.HTTPS_PROXY || process.env.https_proxy
|
|
51
|
+
|| process.env.HTTP_PROXY || process.env.http_proxy
|
|
52
|
+
|| process.env.ALL_PROXY || process.env.all_proxy || '';
|
|
53
|
+
if (_px) {
|
|
54
|
+
const { ProxyAgent, setGlobalDispatcher } = await import('undici');
|
|
55
|
+
setGlobalDispatcher(new ProxyAgent(_px));
|
|
56
|
+
}
|
|
57
|
+
} catch { /* 代理设置失败不阻塞CLI·按直连行为走 */ }
|
|
58
|
+
|
|
47
59
|
// 命令表:所有子命令的单一来源(新增命令在这里加一行即可)。
|
|
48
60
|
// 未知命令的"你想用的是不是"近似匹配也从这张表取已知命令名,不另写一份。
|
|
49
61
|
const COMMANDS = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aixxai",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.11",
|
|
4
4
|
"description": "AIXX CLI - 让你的AI调用万物。One command, every AI model. By AIXX (Wanan Exchange), the verification-first compute exchange. 安装:npx aixxai",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -34,5 +34,8 @@
|
|
|
34
34
|
"license": "ISC",
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=18"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"undici": "^6.21.0"
|
|
37
40
|
}
|
|
38
41
|
}
|
package/src/commands/market.js
CHANGED
|
@@ -98,8 +98,20 @@ async function mFetch(path) {
|
|
|
98
98
|
process.exit(1);
|
|
99
99
|
}
|
|
100
100
|
if (res.status === 401) {
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
// 1123质检靶单②修: 401先探活再归因——网络层失败(代理/墙/劫持)可能被中间层翻译成401,
|
|
102
|
+
// 误导用户去重新登录绕死圈。无鉴权探活端点200=网络真通=才可能是token问题。
|
|
103
|
+
let netOk = false;
|
|
104
|
+
try {
|
|
105
|
+
const pv = await fetch('https://www.aixx.vip/api/v1/docs.json', { signal: AbortSignal.timeout(8000) });
|
|
106
|
+
netOk = pv.ok;
|
|
107
|
+
} catch {}
|
|
108
|
+
if (!netOk) {
|
|
109
|
+
console.error('网络不可达(无法连接 www.aixx.vip)——若在公司内网/代理环境,请配置 HTTPS_PROXY 环境变量后重试;本次失败与令牌无关。');
|
|
110
|
+
} else {
|
|
111
|
+
console.error('令牌无效或已过期,请重新登录: aixx market login --token <T>');
|
|
112
|
+
}
|
|
113
|
+
process.exitCode = 1; // 1123修: exit()在pending句柄上致UV_HANDLE_CLOSING崩溃——exitCode自然排空
|
|
114
|
+
return null;
|
|
103
115
|
}
|
|
104
116
|
if (!res.ok) {
|
|
105
117
|
console.error(`服务暂不可用 (${res.status}),请稍后重试`);
|
|
@@ -107,9 +119,14 @@ async function mFetch(path) {
|
|
|
107
119
|
}
|
|
108
120
|
return await res.json();
|
|
109
121
|
} catch (err) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
122
|
+
// 1123质检靶单②: 网络失败禁归因令牌——代理环境感知文案(公司内网用户首查项)
|
|
123
|
+
const hasPx = !!(process.env.HTTPS_PROXY || process.env.https_proxy || process.env.HTTP_PROXY || process.env.http_proxy);
|
|
124
|
+
const tip = err?.name === 'AbortError' || err?.name === 'TimeoutError'
|
|
125
|
+
? '连接超时,请检查网络后重试' : '网络异常(无法连接数据服务)';
|
|
126
|
+
console.error(tip + (hasPx ? '——检测到代理环境(HTTP_PROXY/HTTPS_PROXY),请确认代理可用或取消该变量后重试' : '——若在公司内网,请配置 HTTPS_PROXY 环境变量'));
|
|
127
|
+
console.error('本次失败与令牌无关,无需重新登录。');
|
|
128
|
+
process.exitCode = 1;
|
|
129
|
+
return null;
|
|
113
130
|
} finally {
|
|
114
131
|
clearTimeout(timer);
|
|
115
132
|
}
|
|
@@ -168,6 +185,7 @@ async function market(subArgs) {
|
|
|
168
185
|
|
|
169
186
|
if (sub === 'tickers') {
|
|
170
187
|
const d = await mFetch('/api/v1/market/bulk');
|
|
188
|
+
if (!d) return; // mFetch已报错并置exitCode——不再打印空表
|
|
171
189
|
const items = d?.data?.items || [];
|
|
172
190
|
if (asJson) { console.log(JSON.stringify(d, null, 2)); return; }
|
|
173
191
|
console.log(`AIXX 大宗算力行情 更新: ${d?.data?.generated_at || '-'} 标的: ${items.length}\n`);
|
|
@@ -179,6 +197,7 @@ async function market(subArgs) {
|
|
|
179
197
|
const sym = (args[0] || '').trim();
|
|
180
198
|
if (!sym) { console.error(`用法: aixx market ${sub} <标的,如 b300>`); process.exit(1); }
|
|
181
199
|
const d = await mFetch('/api/v1/market/bulk');
|
|
200
|
+
if (!d) return; // mFetch已报错并置exitCode——不再打印空表
|
|
182
201
|
const items = filterItems(d?.data?.items || [], sym);
|
|
183
202
|
if (asJson) { console.log(JSON.stringify(sub === 'detail' ? items : items[0] || {}, null, 2)); return; }
|
|
184
203
|
if (items.length === 0) {
|
|
@@ -205,6 +224,7 @@ async function market(subArgs) {
|
|
|
205
224
|
const sym = (args[0] || '').toLowerCase();
|
|
206
225
|
if (!sym) { console.error('用法: aixx market consumer <型号,如 4090>'); process.exit(1); }
|
|
207
226
|
const d = await mFetch(`/api/v1/market/consumer?symbol=${encodeURIComponent(sym)}`);
|
|
227
|
+
if (!d) return; // mFetch已报错并置exitCode——不再打印空表
|
|
208
228
|
const syms = d?.data?.symbols || [];
|
|
209
229
|
if (asJson) { console.log(JSON.stringify(d, null, 2)); return; }
|
|
210
230
|
if (syms.length === 0) {
|