@aiyiran/myclaw 1.1.11 → 1.1.12
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/injects/inject-minimax.js +14 -6
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
const fs = require('fs');
|
|
21
21
|
const path = require('path');
|
|
22
|
+
const os = require('os');
|
|
22
23
|
const { readConfig, writeConfig } = require('../find-config');
|
|
23
24
|
|
|
24
25
|
const DEFAULT_MINIMAX_KEY = "sk-cp-DC5lWd2Stt9CBFzLIT2awP4K-ZEn5AkYwjl3Cdj-mIBmgjxod518F2LaVF2L9c35Wv5-Eox0F1ctJD5vXtB9p3OmxoWLd9ge9zIUIMrCVuqBYdL_s6kb8Qs";
|
|
@@ -101,14 +102,21 @@ function run(cliArgs) {
|
|
|
101
102
|
console.log('✅ openclaw.json 已更新');
|
|
102
103
|
|
|
103
104
|
// ─── 5. 为所有 agent 写入 auth-profiles.json ───
|
|
105
|
+
// 始终包含 main agent 默认路径,防止 fresh onboard 后 agents.list 为空
|
|
106
|
+
const DEFAULT_MAIN_DIR = path.join(os.homedir(), '.openclaw', 'agents', 'main', 'agent');
|
|
104
107
|
const agentList = (config.agents && config.agents.list) || [];
|
|
105
|
-
let okCount = 0;
|
|
106
|
-
let skipCount = 0;
|
|
107
108
|
|
|
109
|
+
// 构建去重的 agentDir 列表,main 默认路径始终存在
|
|
110
|
+
const agentDirs = new Map();
|
|
111
|
+
agentDirs.set(DEFAULT_MAIN_DIR, 'main');
|
|
108
112
|
for (const agent of agentList) {
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
if (agent.agentDir) agentDirs.set(agent.agentDir, agent.id);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let okCount = 0;
|
|
117
|
+
let skipCount = 0;
|
|
111
118
|
|
|
119
|
+
for (const [agentDir, agentId] of agentDirs) {
|
|
112
120
|
const profilesPath = path.join(agentDir, 'auth-profiles.json');
|
|
113
121
|
|
|
114
122
|
// 读取现有文件,不存在则初始化骨架
|
|
@@ -132,10 +140,10 @@ function run(cliArgs) {
|
|
|
132
140
|
try {
|
|
133
141
|
if (!fs.existsSync(agentDir)) fs.mkdirSync(agentDir, { recursive: true });
|
|
134
142
|
fs.writeFileSync(profilesPath, JSON.stringify(profiles, null, 2) + '\n', 'utf8');
|
|
135
|
-
console.log(' ✅ ' +
|
|
143
|
+
console.log(' ✅ ' + agentId);
|
|
136
144
|
okCount++;
|
|
137
145
|
} catch (err) {
|
|
138
|
-
console.log(' ⚠ ' +
|
|
146
|
+
console.log(' ⚠ ' + agentId + ': ' + err.message);
|
|
139
147
|
skipCount++;
|
|
140
148
|
}
|
|
141
149
|
}
|