aixxai 1.6.6 → 1.6.7

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/README.md CHANGED
@@ -1,52 +1,52 @@
1
- # AIXX CLI
2
-
3
- > 让你的AI调用万物。一个命令,agent就能调用全世界的AI能力。
4
-
5
- ## 安装
6
-
7
- ```bash
8
- npx aixxai
9
- ```
10
-
11
- (等价于 `npx aixxai install`,裸命令即安装)
12
-
13
- 带推荐码安装(推荐人获分润):
14
-
15
- ```bash
16
- npx aixxai zhangsan
17
- ```
18
-
19
- ## 命令
20
-
21
- | 命令 | 说明 |
22
- |---|---|
23
- | `aixx install [推荐码]` | 安装AIXX skill到本地agent |
24
- | `aixx search <关键词>` | 搜索AIXX能力库(数据/技能,免key) |
25
- | `aixx installed` | 查看安装状态(skill/账号/版本) |
26
- | `aixx config` | 查看当前配置 |
27
- | `aixx test` | 测试AIXX连通性+调用模型 |
28
- | `aixx balance` | 查询账户余额(还剩多少钱) |
29
- | `aixx models` | 列出可用模型(国产/海外分组) |
30
- | `aixx recharge [金额]` | 充值引导(默认$5) |
31
- | `aixx --version` | 查看版本 |
32
- | `aixx --help` | 帮助 |
33
-
34
- ## 当前状态(1.4.0)
35
-
36
- - ✅ CLI代码完成,本地测试通过
37
- - ⏳ 待发布到npm(等注册)
38
- - ✅ 后端已部署:http://14.103.27.195:8080
39
- - ✅ 已接通:DeepSeek / GLM / Kimi
40
-
41
- ## 技术栈
42
-
43
- - Node.js (>=18) + ES Modules
44
- - 纯原生API,零运行时依赖
45
- - skill文件内嵌在包里(templates/),网络挂了也能装
46
-
47
- ## 文档
48
-
49
- 完整文档:https://gitee.com/kk0803/token-hub
50
-
51
- ---
52
- 维护者:龙龙(AIXX PM)| 2026-08-08
1
+ # AIXX CLI
2
+
3
+ > 让你的AI调用万物。一个命令,agent就能调用全世界的AI能力。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ npx aixxai
9
+ ```
10
+
11
+ (等价于 `npx aixxai install`,裸命令即安装)
12
+
13
+ 带推荐码安装(推荐人获分润):
14
+
15
+ ```bash
16
+ npx aixxai zhangsan
17
+ ```
18
+
19
+ ## 命令
20
+
21
+ | 命令 | 说明 |
22
+ |---|---|
23
+ | `aixx install [推荐码]` | 安装AIXX skill到本地agent |
24
+ | `aixx search <关键词>` | 搜索AIXX能力库(数据/技能,免key) |
25
+ | `aixx installed` | 查看安装状态(skill/账号/版本) |
26
+ | `aixx config` | 查看当前配置 |
27
+ | `aixx test` | 测试AIXX连通性+调用模型 |
28
+ | `aixx balance` | 查询账户余额(还剩多少钱) |
29
+ | `aixx models` | 列出可用模型(国产/海外分组) |
30
+ | `aixx recharge [金额]` | 充值引导(默认$5) |
31
+ | `aixx --version` | 查看版本 |
32
+ | `aixx --help` | 帮助 |
33
+
34
+ ## 当前状态(1.4.0)
35
+
36
+ - ✅ CLI代码完成,本地测试通过
37
+ - ⏳ 待发布到npm(等注册)
38
+ - ✅ 后端已部署:http://14.103.27.195:8080
39
+ - ✅ 已接通:DeepSeek / GLM / Kimi
40
+
41
+ ## 技术栈
42
+
43
+ - Node.js (>=18) + ES Modules
44
+ - 纯原生API,零运行时依赖
45
+ - skill文件内嵌在包里(templates/),网络挂了也能装
46
+
47
+ ## 文档
48
+
49
+ 完整文档:https://gitee.com/kk0803/token-hub
50
+
51
+ ---
52
+ 维护者:龙龙(AIXX PM)| 2026-08-08
package/bin/aixx.js CHANGED
@@ -28,6 +28,8 @@ import { test } from '../src/commands/test.js';
28
28
  import { balance } from '../src/commands/balance.js';
29
29
  import { models } from '../src/commands/models.js';
30
30
  import { recharge } from '../src/commands/recharge.js';
31
+ import { aci } from '../src/commands/aci.js';
32
+ import { servers } from '../src/commands/servers.js';
31
33
  import { showHelp, showVersion } from '../src/commands/help.js';
32
34
 
33
35
  // 版本号从 package.json 读(单一来源,别再硬编码)
@@ -51,6 +53,8 @@ const COMMANDS = [
51
53
  { name: 'balance', aliases: ['b'], run: balance },
52
54
  { name: 'models', aliases: ['m'], run: models },
53
55
  { name: 'recharge', aliases: ['r'], run: recharge },
56
+ { name: 'aci', run: aci }, /* 1021内测版: 不进help/不推npm, 凭内测令牌访问 */
57
+ { name: 'servers', run: servers }, /* 1022内测版: 萬安云服务器货架 */
54
58
  ];
55
59
 
56
60
  // help/version 不吃子参数(走 flag/无参分支),但命令名仍参与下面的近似匹配
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixxai",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "AIXX CLI - 让你的AI调用万物。安装:npx aixxai",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,7 +15,6 @@
15
15
  "llm",
16
16
  "gateway",
17
17
  "openai",
18
- "deepseek",
19
18
  "glm",
20
19
  "kimi",
21
20
  "skill",
@@ -31,4 +30,4 @@
31
30
  "engines": {
32
31
  "node": ">=18"
33
32
  }
34
- }
33
+ }
@@ -0,0 +1,150 @@
1
+ /**
2
+ * AIXX CLI - aci 命令(1021 内测版·K哥令,不对外发布)
3
+ *
4
+ * 算力行情(ACI)查询:
5
+ * aixx aci tickers [--usd] 全标的快照(价格+出身+评分)
6
+ * aixx aci scorecard <SYMBOL> 单标的记分卡明细
7
+ * aixx aci ticker <SYMBOL> 单标的快照
8
+ * aixx aci history <SYMBOL> [days] 历史点位(免费档最多7天)
9
+ *
10
+ * 内测纪律(BULLETIN 1021任务书):凭内测令牌访问,未持令牌服务端一律404不预告;
11
+ * 本命令不进 npm 正式版发布,全部通过(QA+K哥验收)后才对外。
12
+ *
13
+ * 令牌来源:环境变量 AIXX_ACI_TOKEN → ~/.aixx/config.json 的 aciBetaToken 字段。
14
+ */
15
+
16
+ import { existsSync, readFileSync } from 'fs';
17
+ import { homedir } from 'os';
18
+ import { join } from 'path';
19
+
20
+ const ACI_BASE = process.env.AIXX_ACI_BASE_URL || 'https://aixx.ai';
21
+ const FETCH_TIMEOUT = 15000;
22
+
23
+ function loadBetaToken() {
24
+ if (process.env.AIXX_ACI_TOKEN) return process.env.AIXX_ACI_TOKEN;
25
+ try {
26
+ const f = join(homedir(), '.aixx', 'config.json');
27
+ if (existsSync(f)) {
28
+ const conf = JSON.parse(readFileSync(f, 'utf-8'));
29
+ if (conf.aciBetaToken) return conf.aciBetaToken;
30
+ }
31
+ } catch (e) { /* 忽略,走未配置路径 */ }
32
+ return null;
33
+ }
34
+
35
+ async function aciFetch(path) {
36
+ const token = loadBetaToken();
37
+ if (!token) {
38
+ console.error('❌ 未配置ACI内测令牌(该能力为内测态)');
39
+ console.error(' 请设置环境变量 AIXX_ACI_TOKEN 后重试');
40
+ process.exit(1);
41
+ }
42
+ const ctrl = new AbortController();
43
+ const timer = setTimeout(() => ctrl.abort(), FETCH_TIMEOUT);
44
+ try {
45
+ const res = await fetch(`${ACI_BASE}${path}`, {
46
+ headers: { Authorization: `Bearer ${token}` },
47
+ signal: ctrl.signal,
48
+ });
49
+ if (res.status === 404) {
50
+ console.error('该能力暂不可用');
51
+ process.exit(1);
52
+ }
53
+ if (!res.ok) {
54
+ console.error(`查询失败 (HTTP ${res.status})`);
55
+ process.exit(1);
56
+ }
57
+ return await res.json();
58
+ } catch (err) {
59
+ console.error(err?.name === 'AbortError' || err?.name === 'TimeoutError'
60
+ ? '连接超时,请检查网络' : `查询失败: ${err?.message || err}`);
61
+ process.exit(1);
62
+ } finally {
63
+ clearTimeout(timer);
64
+ }
65
+ }
66
+
67
+ function srcBadge(src) {
68
+ // 出身三色标:real=实抓 / der=推算 / est=估算(口径与算交所产出契约一致)
69
+ if (src === 'real') return '实抓';
70
+ if (src === 'der') return '推算';
71
+ if (src === 'est') return '估算';
72
+ return src || '?';
73
+ }
74
+
75
+ function fmtWan(v) {
76
+ if (typeof v !== 'number') return '-';
77
+ return v >= 1 ? `${v.toFixed(1)}万` : `${(v * 10000).toFixed(0)}元`;
78
+ }
79
+
80
+ function printTickerRow(c, usd) {
81
+ const cur = usd ? '$' : '¥';
82
+ const lo = usd ? c.listing?.lo_usd : c.listing?.lo;
83
+ const hi = usd ? c.listing?.hi_usd : c.listing?.hi;
84
+ const lines = [
85
+ ` ${c.symbol} ${c.category || ''} 评分 ${c.score?.raw ?? '-'} (${c.score?.grade ?? '-'})`,
86
+ ` 在售: ${cur}${lo ?? '-'} ~ ${cur}${hi ?? '-'} (${c.listing?.count ?? 0}台, 出身:${srcBadge(c.listing?.src)})`,
87
+ ` 租赁: ¥${c.rental?.cn_hr ?? '-'}/时 (USD $${c.rental?.usd_hr ?? '-'}/时)`,
88
+ ];
89
+ if (usd && c.msrp_usd_wan != null) lines.push(` 发售价: $${c.msrp_usd_wan}万`);
90
+ console.log(lines.join('\n') + '\n');
91
+ }
92
+
93
+ export async function aci(subArgs) {
94
+ const sub = subArgs[0] || 'help';
95
+ const rest = subArgs.slice(1);
96
+
97
+ if (sub === 'tickers') {
98
+ const usd = rest.includes('--usd');
99
+ const d = await aciFetch(`/v1/aci/tickers${usd ? '?currency=USD' : ''}`);
100
+ console.log(`╔══════════════════════════════════════════╗`);
101
+ console.log(`║ AIXX 算力行情 ACI (内测) ║`);
102
+ console.log(`╚══════════════════════════════════════════╝`);
103
+ console.log(`更新: ${d.generated} | 标的: ${d.count} 个 | 币种: ${d.currency}\n`);
104
+ for (const c of d.cards || []) printTickerRow(c, usd);
105
+ return;
106
+ }
107
+
108
+ if (sub === 'ticker' || sub === 'scorecard') {
109
+ const sym = (rest[0] || '').toUpperCase();
110
+ if (!sym) {
111
+ console.error(`用法: aixx aci ${sub} <SYMBOL> 例: aixx aci ${sub} B300`);
112
+ process.exit(1);
113
+ }
114
+ const d = await aciFetch(`/v1/aci/${sub}/${sym}`);
115
+ if (sub === 'ticker') {
116
+ console.log(`AIXX 算力行情 (内测) — ${d.generated}\n`);
117
+ printTickerRow(d.ticker, d.currency === 'USD');
118
+ } else {
119
+ const s = d.scorecard || {};
120
+ console.log(`AIXX 记分卡 (内测) — ${d.symbol}`);
121
+ console.log(` 总分: ${s.raw ?? '-'} 等级: ${s.grade ?? '-'}`);
122
+ console.log(` 回本分 sR: ${s.dims?.sR ?? '-'} (权重40)`);
123
+ console.log(` 涨价分 sA: ${s.dims?.sA ?? '-'} (权重30)`);
124
+ console.log(` 售罄分 sS: ${s.dims?.sS ?? '-'} (权重30)`);
125
+ console.log(` 口径: ${d.formula || ''}`);
126
+ }
127
+ return;
128
+ }
129
+
130
+ if (sub === 'history') {
131
+ const sym = (rest[0] || '').toUpperCase();
132
+ const days = parseInt(rest[1] || '7', 10) || 7;
133
+ if (!sym) {
134
+ console.error('用法: aixx aci history <SYMBOL> [days]');
135
+ process.exit(1);
136
+ }
137
+ const d = await aciFetch(`/v1/aci/history/${sym}?days=${days}`);
138
+ console.log(`AIXX 历史点位 (内测) — ${d.symbol} 近${d.days}天${d.capped ? '(免费档上限7天)' : ''}\n`);
139
+ for (const p of d.points || []) {
140
+ console.log(` ${p.generated} 在售 ¥${p.listing?.lo ?? '-'}~¥${p.listing?.hi ?? '-'} 评分 ${p.score_raw ?? '-'}`);
141
+ }
142
+ return;
143
+ }
144
+
145
+ console.log('用法: aixx aci <子命令>');
146
+ console.log(' tickers [--usd] 全标的快照');
147
+ console.log(' ticker <SYMBOL> 单标的快照');
148
+ console.log(' scorecard <SYMBOL> 记分卡明细');
149
+ console.log(' history <SYMBOL> [days] 历史点位(≤7天)');
150
+ }
@@ -1,68 +1,68 @@
1
- /**
2
- * AIXX CLI - config 命令
3
- * 查看或修改AIXX配置
4
- */
5
-
6
- import { existsSync, readFileSync } from 'fs';
7
- import { homedir } from 'os';
8
- import { join } from 'path';
9
- import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
10
- import { loadApiKey, maskKey } from '../utils/env.js';
11
-
12
- export async function config(subArgs) {
13
- console.log('╔══════════════════════════════════════════╗');
14
- console.log('║ AIXX 配置 ║');
15
- console.log('╚══════════════════════════════════════════╝\n');
16
-
17
- // 统一配置链:环境变量 → ~/.aixx/config.json → ~/.aixx/account.json
18
- const apiKey = loadApiKey();
19
- const baseUrl = process.env.AIXX_BASE_URL || DEFAULT_BASE_URL;
20
-
21
- console.log('当前配置:');
22
- console.log(` AIXX_API_KEY : ${apiKey ? maskKey(apiKey) : '❌ 未配置'}`);
23
- console.log(` AIXX_BASE_URL: ${baseUrl}`);
24
-
25
- // 本地配置文件(key脱敏显示,绝不打印完整key)
26
- const configFile = join(homedir(), '.aixx', 'config.json');
27
- if (existsSync(configFile)) {
28
- console.log('\n本地配置文件:');
29
- try {
30
- const conf = JSON.parse(readFileSync(configFile, 'utf-8'));
31
- if (conf.AIXX_API_KEY) conf.AIXX_API_KEY = maskKey(conf.AIXX_API_KEY);
32
- console.log(` 位置: ${configFile}`);
33
- console.log(` 内容: ${JSON.stringify(conf, null, 2)}`);
34
- } catch (e) {
35
- console.log(` (配置文件解析失败: ${e.message})`);
36
- }
37
- }
38
-
39
- // 推荐码
40
- const refFile = join(homedir(), '.aixx', 'referral.json');
41
- if (existsSync(refFile)) {
42
- console.log('\n推荐归因:');
43
- try {
44
- const ref = JSON.parse(readFileSync(refFile, 'utf-8'));
45
- console.log(` 推荐码: ${ref.refCode}`);
46
- console.log(` 安装时间: ${ref.installedAt}`);
47
- } catch (e) {}
48
- }
49
-
50
- // skill位置
51
- const skillDirs = [
52
- join(homedir(), '.zcode', 'skills', 'aixx'),
53
- join(homedir(), '.agents', 'skills', 'aixx'),
54
- join(homedir(), '.claude', 'skills', 'aixx'),
55
- join(homedir(), '.aixx', 'skills', 'aixx'),
56
- ].filter(existsSync);
57
-
58
- console.log('\nskill安装位置:');
59
- if (skillDirs.length > 0) {
60
- skillDirs.forEach(d => console.log(` ✅ ${d}`));
61
- } else {
62
- console.log(' ❌ 未检测到已安装的skill(运行 aixx install 安装)');
63
- }
64
-
65
- console.log('\n修改配置:');
66
- console.log(' 重新运行: npx aixxai install');
67
- console.log(' (配置读取顺序:环境变量 AIXX_API_KEY → ~/.aixx/config.json → ~/.aixx/account.json)\n');
68
- }
1
+ /**
2
+ * AIXX CLI - config 命令
3
+ * 查看或修改AIXX配置
4
+ */
5
+
6
+ import { existsSync, readFileSync } from 'fs';
7
+ import { homedir } from 'os';
8
+ import { join } from 'path';
9
+ import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
10
+ import { loadApiKey, maskKey } from '../utils/env.js';
11
+
12
+ export async function config(subArgs) {
13
+ console.log('╔══════════════════════════════════════════╗');
14
+ console.log('║ AIXX 配置 ║');
15
+ console.log('╚══════════════════════════════════════════╝\n');
16
+
17
+ // 统一配置链:环境变量 → ~/.aixx/config.json → ~/.aixx/account.json
18
+ const apiKey = loadApiKey();
19
+ const baseUrl = process.env.AIXX_BASE_URL || DEFAULT_BASE_URL;
20
+
21
+ console.log('当前配置:');
22
+ console.log(` AIXX_API_KEY : ${apiKey ? maskKey(apiKey) : '❌ 未配置'}`);
23
+ console.log(` AIXX_BASE_URL: ${baseUrl}`);
24
+
25
+ // 本地配置文件(key脱敏显示,绝不打印完整key)
26
+ const configFile = join(homedir(), '.aixx', 'config.json');
27
+ if (existsSync(configFile)) {
28
+ console.log('\n本地配置文件:');
29
+ try {
30
+ const conf = JSON.parse(readFileSync(configFile, 'utf-8'));
31
+ if (conf.AIXX_API_KEY) conf.AIXX_API_KEY = maskKey(conf.AIXX_API_KEY);
32
+ console.log(` 位置: ${configFile}`);
33
+ console.log(` 内容: ${JSON.stringify(conf, null, 2)}`);
34
+ } catch (e) {
35
+ console.log(` (配置文件解析失败: ${e.message})`);
36
+ }
37
+ }
38
+
39
+ // 推荐码
40
+ const refFile = join(homedir(), '.aixx', 'referral.json');
41
+ if (existsSync(refFile)) {
42
+ console.log('\n推荐归因:');
43
+ try {
44
+ const ref = JSON.parse(readFileSync(refFile, 'utf-8'));
45
+ console.log(` 推荐码: ${ref.refCode}`);
46
+ console.log(` 安装时间: ${ref.installedAt}`);
47
+ } catch (e) {}
48
+ }
49
+
50
+ // skill位置
51
+ const skillDirs = [
52
+ join(homedir(), '.zcode', 'skills', 'aixx'),
53
+ join(homedir(), '.agents', 'skills', 'aixx'),
54
+ join(homedir(), '.claude', 'skills', 'aixx'),
55
+ join(homedir(), '.aixx', 'skills', 'aixx'),
56
+ ].filter(existsSync);
57
+
58
+ console.log('\nskill安装位置:');
59
+ if (skillDirs.length > 0) {
60
+ skillDirs.forEach(d => console.log(` ✅ ${d}`));
61
+ } else {
62
+ console.log(' ❌ 未检测到已安装的skill(运行 aixx install 安装)');
63
+ }
64
+
65
+ console.log('\n修改配置:');
66
+ console.log(' 重新运行: npx aixxai install');
67
+ console.log(' (配置读取顺序:环境变量 AIXX_API_KEY → ~/.aixx/config.json → ~/.aixx/account.json)\n');
68
+ }