@openclawcity/become 1.0.18 → 1.0.19
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/dist/cli.cjs +40 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +40 -0
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -151,9 +151,49 @@ function restoreOpenClaw() {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
+
cleanLegacy();
|
|
154
155
|
cleanState();
|
|
155
156
|
restartGateway();
|
|
156
157
|
}
|
|
158
|
+
function cleanLegacy() {
|
|
159
|
+
if (existsSync2(OPENCLAW_CONFIG)) {
|
|
160
|
+
try {
|
|
161
|
+
const config = parseConfig(readFileSync2(OPENCLAW_CONFIG, "utf-8"));
|
|
162
|
+
let changed = false;
|
|
163
|
+
if (config.models?.providers?.become) {
|
|
164
|
+
delete config.models.providers.become;
|
|
165
|
+
changed = true;
|
|
166
|
+
}
|
|
167
|
+
const primary = config.agents?.defaults?.model?.primary ?? "";
|
|
168
|
+
if (primary.startsWith("become/")) {
|
|
169
|
+
config.agents.defaults.model.primary = "openrouter/" + primary.slice("become/".length);
|
|
170
|
+
changed = true;
|
|
171
|
+
}
|
|
172
|
+
for (const prov of Object.values(config.models?.providers ?? {})) {
|
|
173
|
+
if (prov && typeof prov === "object" && "_originalModel" in prov) {
|
|
174
|
+
delete prov._originalModel;
|
|
175
|
+
changed = true;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
if (changed) writeFileSync2(OPENCLAW_CONFIG, JSON.stringify(config, null, 2), "utf-8");
|
|
179
|
+
} catch {
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
const clawConfig = parseConfig(readFileSync2(OPENCLAW_CONFIG, "utf-8"));
|
|
184
|
+
const modelsJsonPath = getModelsJsonPath(clawConfig);
|
|
185
|
+
if (modelsJsonPath && existsSync2(modelsJsonPath)) {
|
|
186
|
+
const models = JSON.parse(readFileSync2(modelsJsonPath, "utf-8"));
|
|
187
|
+
let changed = false;
|
|
188
|
+
if (models.providers?.become) {
|
|
189
|
+
delete models.providers.become;
|
|
190
|
+
changed = true;
|
|
191
|
+
}
|
|
192
|
+
if (changed) writeFileSync2(modelsJsonPath, JSON.stringify(models, null, 2), "utf-8");
|
|
193
|
+
}
|
|
194
|
+
} catch {
|
|
195
|
+
}
|
|
196
|
+
}
|
|
157
197
|
function listOpenClawAgents() {
|
|
158
198
|
if (!existsSync2(OPENCLAW_CONFIG)) return [];
|
|
159
199
|
try {
|