@aiyiran/myclaw 1.0.52 → 1.0.53

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/index.js CHANGED
@@ -681,28 +681,35 @@ function runUpdate() {
681
681
  console.log('正在执行全量强制升级 (绕过缓存)...');
682
682
  console.log('');
683
683
 
684
- try {
685
- const { execSync } = require('child_process');
686
- // 第一步:清空缓存,防患于未然
687
- console.log('> ' + colors.yellow + 'npm cache clean --force' + colors.nc);
688
- execSync('npm cache clean --force', { stdio: 'inherit' });
689
- console.log('');
690
-
691
- // 第二步:强制拉最新版本
692
- console.log('> ' + colors.yellow + 'npm install -g @aiyiran/myclaw@latest --prefer-online' + colors.nc);
693
- execSync('npm install -g @aiyiran/myclaw@latest --prefer-online', { stdio: 'inherit' });
694
-
695
- console.log('');
696
- console.log('[' + colors.green + '成功' + colors.nc + '] MyClaw 升级完成!');
697
-
698
- if (detectPlatform() === 'wsl' || detectPlatform() === 'linux' || detectPlatform() === 'mac') {
684
+ const { execSync } = require('child_process');
685
+ const cmd = 'npm install -g @aiyiran/myclaw@latest --prefer-online';
686
+ const maxRetries = 3;
687
+
688
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
689
+ try {
690
+ console.log('> ' + colors.yellow + cmd + colors.nc);
691
+ if (attempt > 1) console.log(' (第 ' + attempt + ' 次尝试)');
692
+ execSync(cmd, { stdio: 'inherit' });
693
+
699
694
  console.log('');
700
- console.log('如果需要同时升级 OpenClaw 核心,请运行:');
701
- console.log(' ' + colors.yellow + 'myclaw install' + colors.nc);
695
+ console.log('[' + colors.green + '成功' + colors.nc + '] MyClaw 升级完成!');
696
+
697
+ if (detectPlatform() === 'wsl' || detectPlatform() === 'linux' || detectPlatform() === 'mac') {
698
+ console.log('');
699
+ console.log('如果需要同时升级 OpenClaw 核心,请运行:');
700
+ console.log(' ' + colors.yellow + 'myclaw install' + colors.nc);
701
+ }
702
+ break; // 成功就跳出
703
+ } catch (err) {
704
+ if (attempt < maxRetries) {
705
+ console.log('');
706
+ console.log('[' + colors.yellow + '重试' + colors.nc + '] 5 秒后重试 (' + attempt + '/' + maxRetries + ')...');
707
+ execSync('sleep 5', { stdio: 'ignore' });
708
+ } else {
709
+ console.log('');
710
+ console.log('[' + colors.red + '错误' + colors.nc + '] 升级失败: ' + err.message);
711
+ }
702
712
  }
703
- } catch (err) {
704
- console.log('');
705
- console.log('[' + colors.red + '错误' + colors.nc + '] 升级失败: ' + err.message);
706
713
  }
707
714
  console.log('');
708
715
  }
package/inject-minimax.js CHANGED
@@ -106,7 +106,28 @@ function run(cliArgs) {
106
106
  console.log(' models.providers → minimax (MiniMax-M2.7)');
107
107
  console.log(' agents.defaults → minimax/MiniMax-M2.7-highspeed');
108
108
 
109
- // 4. 如果传了 --key,写入环境变量
109
+ // 4. 通过 openclaw onboard 原生命令确认配置
110
+ if (apiKey) {
111
+ console.log('');
112
+ console.log('🔧 执行 openclaw onboard (非交互)...');
113
+ try {
114
+ const { execSync } = require('child_process');
115
+ execSync([
116
+ 'openclaw onboard',
117
+ '--non-interactive',
118
+ '--accept-risk',
119
+ '--skip-health',
120
+ '--auth-choice minimax-cn-api',
121
+ '--token "' + apiKey + '"',
122
+ '--minimax-api-key "' + apiKey + '"',
123
+ ].join(' '), { stdio: 'inherit' });
124
+ console.log('✅ openclaw onboard 完成');
125
+ } catch (err) {
126
+ console.log('⚠️ openclaw onboard 失败 (非致命): ' + err.message);
127
+ }
128
+ }
129
+
130
+ // 5. 如果传了 --key,写入环境变量
110
131
  if (apiKey) {
111
132
  console.log('');
112
133
  console.log('🔑 设置 MINIMAX_API_KEY 环境变量...');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -110,6 +110,29 @@ console.log(' auth.profiles → minimax:cn');
110
110
  console.log(' models.providers → minimax (MiniMax-M2.7)');
111
111
  console.log(' agents.defaults → minimax/MiniMax-M2.7-highspeed');
112
112
 
113
+ // ============================================================================
114
+ // 通过 openclaw onboard 原生命令确认配置
115
+ // ============================================================================
116
+
117
+ if (apiKey) {
118
+ console.log('');
119
+ console.log('🔧 执行 openclaw onboard (非交互)...');
120
+ try {
121
+ execSync([
122
+ 'openclaw onboard',
123
+ '--non-interactive',
124
+ '--accept-risk',
125
+ '--skip-health',
126
+ '--auth-choice minimax-cn-api',
127
+ '--token "' + apiKey + '"',
128
+ '--minimax-api-key "' + apiKey + '"',
129
+ ].join(' '), { stdio: 'inherit' });
130
+ console.log('✅ openclaw onboard 完成');
131
+ } catch (err) {
132
+ console.log('⚠️ openclaw onboard 失败 (非致命,JSON 已手动注入): ' + err.message);
133
+ }
134
+ }
135
+
113
136
  // ============================================================================
114
137
  // 设置 API Key(如果传了 --key)
115
138
  // ============================================================================