@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 CHANGED
@@ -190,9 +190,49 @@ function restoreOpenClaw() {
190
190
  }
191
191
  }
192
192
  }
193
+ cleanLegacy();
193
194
  cleanState();
194
195
  restartGateway();
195
196
  }
197
+ function cleanLegacy() {
198
+ if ((0, import_node_fs2.existsSync)(OPENCLAW_CONFIG)) {
199
+ try {
200
+ const config = parseConfig((0, import_node_fs2.readFileSync)(OPENCLAW_CONFIG, "utf-8"));
201
+ let changed = false;
202
+ if (config.models?.providers?.become) {
203
+ delete config.models.providers.become;
204
+ changed = true;
205
+ }
206
+ const primary = config.agents?.defaults?.model?.primary ?? "";
207
+ if (primary.startsWith("become/")) {
208
+ config.agents.defaults.model.primary = "openrouter/" + primary.slice("become/".length);
209
+ changed = true;
210
+ }
211
+ for (const prov of Object.values(config.models?.providers ?? {})) {
212
+ if (prov && typeof prov === "object" && "_originalModel" in prov) {
213
+ delete prov._originalModel;
214
+ changed = true;
215
+ }
216
+ }
217
+ if (changed) (0, import_node_fs2.writeFileSync)(OPENCLAW_CONFIG, JSON.stringify(config, null, 2), "utf-8");
218
+ } catch {
219
+ }
220
+ }
221
+ try {
222
+ const clawConfig = parseConfig((0, import_node_fs2.readFileSync)(OPENCLAW_CONFIG, "utf-8"));
223
+ const modelsJsonPath = getModelsJsonPath(clawConfig);
224
+ if (modelsJsonPath && (0, import_node_fs2.existsSync)(modelsJsonPath)) {
225
+ const models = JSON.parse((0, import_node_fs2.readFileSync)(modelsJsonPath, "utf-8"));
226
+ let changed = false;
227
+ if (models.providers?.become) {
228
+ delete models.providers.become;
229
+ changed = true;
230
+ }
231
+ if (changed) (0, import_node_fs2.writeFileSync)(modelsJsonPath, JSON.stringify(models, null, 2), "utf-8");
232
+ }
233
+ } catch {
234
+ }
235
+ }
196
236
  function listOpenClawAgents() {
197
237
  if (!(0, import_node_fs2.existsSync)(OPENCLAW_CONFIG)) return [];
198
238
  try {