@aiyiran/myclaw 1.1.9 → 1.1.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.
@@ -10,7 +10,7 @@
10
10
  * 2. 注册 minimax provider + 模型定义 (openclaw.json)
11
11
  * 3. 设置默认聊天模型为 MiniMax (openclaw.json)
12
12
  * 4. 将 MiniMax 模型加入白名单 (openclaw.json)
13
- * 5. 为所有 agent 写入 API Key (~/.openclaw/agents/<id>/agent/auth-profiles.json)
13
+ * 5. 为所有 agent 写入 API Key (auth-profiles.json,不存在则创建)
14
14
  *
15
15
  * 不触碰: 图片模型、其他 provider、onboard 流程
16
16
  *
@@ -49,7 +49,7 @@ function run(cliArgs) {
49
49
 
50
50
  console.log('📍 找到配置: ' + configPath);
51
51
 
52
- // ─── 1. auth profile (openclaw.json) ───
52
+ // ─── 1. auth profile ───
53
53
  if (!config.auth) config.auth = {};
54
54
  if (!config.auth.profiles) config.auth.profiles = {};
55
55
  config.auth.profiles["minimax:cn"] = {
@@ -66,7 +66,6 @@ function run(cliArgs) {
66
66
  baseUrl: "https://api.minimaxi.com/anthropic",
67
67
  api: "anthropic-messages",
68
68
  authHeader: true,
69
- apiKey: apiKey,
70
69
  models: [
71
70
  {
72
71
  id: "MiniMax-M2.7-highspeed",
@@ -92,14 +91,10 @@ function run(cliArgs) {
92
91
  primary: "minimax/MiniMax-M2.7-highspeed"
93
92
  };
94
93
 
95
- // ─── 4. 白名单 ───
94
+ // ─── 4. 白名单,清理残留 ───
96
95
  if (!config.agents.defaults.models) config.agents.defaults.models = {};
97
96
  config.agents.defaults.models["minimax/MiniMax-M2.7-highspeed"] = {};
98
-
99
- // 清理 onboard 可能写入的残留
100
- if (config.agents.defaults.models["minimax/MiniMax-M2.7"]) {
101
- delete config.agents.defaults.models["minimax/MiniMax-M2.7"];
102
- }
97
+ delete config.agents.defaults.models["minimax/MiniMax-M2.7"];
103
98
 
104
99
  // ─── 写入 openclaw.json ───
105
100
  writeConfig(config, configPath);
@@ -112,24 +107,18 @@ function run(cliArgs) {
112
107
 
113
108
  for (const agent of agentList) {
114
109
  const agentDir = agent.agentDir;
115
- if (!agentDir) {
116
- skipCount++;
117
- continue;
118
- }
110
+ if (!agentDir) { skipCount++; continue; }
119
111
 
120
112
  const profilesPath = path.join(agentDir, 'auth-profiles.json');
121
113
 
122
- // 读取现有文件(若存在),否则创建骨架
114
+ // 读取现有文件,不存在则初始化骨架
123
115
  let profiles = { version: 1, profiles: {}, lastGood: {} };
124
116
  if (fs.existsSync(profilesPath)) {
125
117
  try {
126
- profiles = JSON.parse(fs.readFileSync(profilesPath, 'utf8'));
127
- if (!profiles.profiles) profiles.profiles = {};
118
+ const parsed = JSON.parse(fs.readFileSync(profilesPath, 'utf8'));
119
+ if (parsed.profiles) profiles = parsed;
128
120
  if (!profiles.lastGood) profiles.lastGood = {};
129
- } catch {
130
- // 解析失败则重建
131
- profiles = { version: 1, profiles: {}, lastGood: {} };
132
- }
121
+ } catch { /* 解析失败则用空骨架 */ }
133
122
  }
134
123
 
135
124
  // 写入 minimax:cn,保留其他 profile 不动
@@ -141,29 +130,8 @@ function run(cliArgs) {
141
130
  profiles.lastGood["minimax"] = "minimax:cn";
142
131
 
143
132
  try {
144
- // 确保目录存在
145
- if (!fs.existsSync(agentDir)) {
146
- fs.mkdirSync(agentDir, { recursive: true });
147
- }
133
+ if (!fs.existsSync(agentDir)) fs.mkdirSync(agentDir, { recursive: true });
148
134
  fs.writeFileSync(profilesPath, JSON.stringify(profiles, null, 2) + '\n', 'utf8');
149
-
150
- // 同时更新 models.json 里的 minimax.apiKey 占位符
151
- const modelsPath = path.join(agentDir, 'models.json');
152
- if (fs.existsSync(modelsPath)) {
153
- try {
154
- const models = JSON.parse(fs.readFileSync(modelsPath, 'utf8'));
155
- if (models.providers && models.providers.minimax) {
156
- models.providers.minimax.apiKey = apiKey;
157
- }
158
- if (models.providers && models.providers['minimax-portal']) {
159
- models.providers['minimax-portal'].apiKey = apiKey;
160
- }
161
- fs.writeFileSync(modelsPath, JSON.stringify(models, null, 2) + '\n', 'utf8');
162
- } catch {
163
- // models.json 解析失败则跳过
164
- }
165
- }
166
-
167
135
  console.log(' ✅ ' + agent.id);
168
136
  okCount++;
169
137
  } catch (err) {
@@ -173,10 +141,10 @@ function run(cliArgs) {
173
141
  }
174
142
 
175
143
  console.log('');
176
- console.log('✅ MiniMax 配置已注入');
177
- console.log(' 模型: MiniMax-M2.7-highspeed');
178
- console.log(' 默认: minimax/MiniMax-M2.7-highspeed');
179
- console.log(' Agent: ' + okCount + ' 个写入成功,' + skipCount + ' 个跳过');
144
+ console.log('✅ MiniMax 注入完成');
145
+ console.log(' 模型: MiniMax-M2.7-highspeed');
146
+ console.log(' 默认: minimax/MiniMax-M2.7-highspeed');
147
+ console.log(' Agent: ' + okCount + ' 个写入,' + skipCount + ' 个跳过');
180
148
  console.log('');
181
149
  }
182
150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiyiran/myclaw",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {