aixxai 1.7.8 → 1.7.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aixxai",
3
- "version": "1.7.8",
3
+ "version": "1.7.10",
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": {
@@ -17,7 +17,7 @@ import readline from 'readline';
17
17
  import { randomInt } from 'crypto';
18
18
  import { DEFAULT_BASE_URL } from '../../bin/aixx.js';
19
19
  import { downloadSkill } from '../utils/download.js';
20
- import { setupEnv, maskKey } from '../utils/env.js';
20
+ import { setupEnv, maskKey, loadApiKey } from '../utils/env.js';
21
21
  import { configureAgents } from '../utils/agentconfig.js';
22
22
 
23
23
  // skill目录检测(installed/search 命令也会复用,所以 export)
@@ -95,7 +95,7 @@ async function nakedRegisterFlow() {
95
95
  signal: AbortSignal.timeout(15000),
96
96
  });
97
97
  const nj = await nr.json().catch(() => null);
98
- if (!nj || !nj.ok) return null;
98
+ if (!nj || !nj.ok) return { fail: (nj && nj.message) || ('HTTP ' + nr.status) }; // 1122质检茬②: 失败原因带给install诚实分流
99
99
  try {
100
100
  const aixxDir = join(homedir(), '.aixx');
101
101
  if (!existsSync(aixxDir)) mkdirSync(aixxDir, { recursive: true }); // 1122修: 首装目录未建致身份写入ENOENT被吞
@@ -343,10 +343,21 @@ export async function install(subArgs) {
343
343
  console.log(`✅ 操作系统: ${process.platform}`);
344
344
 
345
345
  // 2. 获取或创建API Key
346
- // 记录key来源,用于后面给出正确的提示(环境变量 / 本地账号)
346
+ // 记录key来源,用于后面给出正确的提示(环境变量 / 本地账号 / 本机config)
347
347
  let apiKey = process.env.AIXX_API_KEY;
348
348
  let keySource = apiKey ? 'env' : null;
349
349
 
350
+ if (!apiKey) {
351
+ // 1122质检茬③幂等修: 复用loadApiKey三处链(env→config.json→account.json)——
352
+ // 旧读链漏config.json致已装机器重跑install误判零key再注册(身份翻倍·key翻倍)
353
+ const saved = loadApiKey();
354
+ if (saved) {
355
+ apiKey = saved;
356
+ keySource = 'saved';
357
+ console.log('\n✅ 检测到本机已安装AIXX(沿用已有API Key·身份可用 aixx status 查看)');
358
+ }
359
+ }
360
+
350
361
  if (!apiKey) {
351
362
  // 检查本地是否有已保存的账号
352
363
  const accountFile = join(homedir(), '.aixx', 'account.json');
@@ -364,7 +375,8 @@ export async function install(subArgs) {
364
375
  }
365
376
 
366
377
  // 1122 K哥令agent直连闭环: 零key先走裸注册链(零交互·一句装完自动发key)——agent场景主路径
367
- try {
378
+ // (幂等守卫: 已有key(含loadApiKey从config读到)不重注册——重跑install=更新skill/配置而非翻倍身份)
379
+ if (!apiKey) try {
368
380
  console.log('\n📝 零注册开通(免邮箱·数据API免费80次)...');
369
381
  const nj = await nakedRegisterFlow();
370
382
  if (nj && nj.key) {
@@ -374,8 +386,16 @@ export async function install(subArgs) {
374
386
  printNakedIdentity(nj);
375
387
  } else if (nj) {
376
388
  printNakedIdentity(nj); // 老版bridge只给身份不给key——继续走邮箱流补key
389
+ } else if (nj && nj.fail) {
390
+ // 1122质检茬②: 失败诚实报因退出——静默降级邮箱流=agent死链(无邮箱可输)
391
+ console.error('\n❌ 零注册开通未成功: ' + nj.fail);
392
+ console.error(' 稍后重新运行 npx aixxai install 重试(限频类约1小时后自动恢复)。');
393
+ process.exit(1);
377
394
  }
378
- } catch {} // 裸注册失败(网络/限频)降级邮箱流
395
+ } catch (e) {
396
+ console.error('\n⚠️ 零注册网络异常: ' + (e?.message || e));
397
+ console.error(' 将尝试备用注册方式...');
398
+ } // 网络异常才降级邮箱流(限频不降级·见上)
379
399
 
380
400
 
381
401
  if (!apiKey) {
@@ -13,7 +13,7 @@ const MODEL_DESC = {
13
13
  'deepseek-chat': '低价档',
14
14
  'deepseek-v4-pro': 'DeepSeek 旗舰,推理强',
15
15
  'deepseek-ai/DeepSeek-V3': 'DeepSeek V3',
16
- 'glm-4-flash': '智谱免费,速度快',
16
+ 'glm-5.3-flash': '智谱coding plan现役,能力强',
17
17
  'glm-4-plus': '智谱旗舰,中文写作强',
18
18
  'deepseek-ai/DeepSeek-V3': 'DeepSeek旗舰(硅基流动)',
19
19
  'glm-4-long': '智谱超长文本',
@@ -44,7 +44,7 @@ const MODEL_DESC = {
44
44
  function classifyScenario(id) {
45
45
  const lower = id.toLowerCase();
46
46
  if (lower.includes('embed') || lower.includes('bge')) return 'embedding';
47
- const budget = ['deepseek-chat', 'glm-4-flash', 'deepseek-ai/DeepSeek-V3', 'claude-haiku'];
47
+ const budget = ['deepseek-chat', 'glm-5.3-flash', 'deepseek-ai/DeepSeek-V3', 'claude-haiku'];
48
48
  if (budget.some(p => lower.startsWith(p) || lower.includes(p))) return 'budget';
49
49
  const flagship = ['opus-5', 'gpt-5.6', 'gpt-5.5', 'fable-5', 'deepseek-v4-pro'];
50
50
  if (flagship.some(p => lower.includes(p))) return 'flagship';
@@ -112,7 +112,7 @@ export async function models(subArgs) {
112
112
 
113
113
  console.log(`\n📊 共 ${modelIds.length} 个模型\n`);
114
114
  console.log('💡 选模型小抄:');
115
- console.log(' - 日常聊天/写文案 → deepseek-chat(便宜)或 glm-4-flash(智谱)');
115
+ console.log(' - 日常聊天/写文案 → deepseek-chat(便宜)或 glm-5.3-flash(智谱)');
116
116
  console.log(' - 中文写作 → glm-4-plus 或 claude-fable-5');
117
117
  console.log(' - 读超长文档 → moonshot-v1-128k');
118
118
  console.log(' - 复杂推理/代码 → claude-opus-5 或 gpt-5.6-sol');