@chrysb/alphaclaw 0.9.25 → 0.9.26
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/lib/server/auth-profiles.js +31 -2
- package/package.json +1 -1
|
@@ -340,12 +340,41 @@ const createAuthProfiles = () => {
|
|
|
340
340
|
|
|
341
341
|
// ── Model config operations ──
|
|
342
342
|
|
|
343
|
+
const preserveCodexRuntimeModels = (configuredModels) => {
|
|
344
|
+
const models =
|
|
345
|
+
configuredModels && typeof configuredModels === "object"
|
|
346
|
+
? configuredModels
|
|
347
|
+
: {};
|
|
348
|
+
if (!hasCodexOauthProfile()) return models;
|
|
349
|
+
return Object.fromEntries(
|
|
350
|
+
Object.entries(models).map(([modelKey, modelConfig]) => {
|
|
351
|
+
if (!modelKey.startsWith("openai/gpt-")) {
|
|
352
|
+
return [modelKey, modelConfig];
|
|
353
|
+
}
|
|
354
|
+
return [
|
|
355
|
+
modelKey,
|
|
356
|
+
{
|
|
357
|
+
...(modelConfig && typeof modelConfig === "object"
|
|
358
|
+
? modelConfig
|
|
359
|
+
: {}),
|
|
360
|
+
agentRuntime: { id: "codex" },
|
|
361
|
+
},
|
|
362
|
+
];
|
|
363
|
+
}),
|
|
364
|
+
);
|
|
365
|
+
};
|
|
366
|
+
|
|
343
367
|
const getModelConfig = () => {
|
|
344
368
|
const cfg = loadOpenclawConfig();
|
|
345
369
|
const defaults = cfg.agents?.defaults || {};
|
|
370
|
+
const configuredModels = preserveCodexRuntimeModels(defaults.models || {});
|
|
371
|
+
if (JSON.stringify(configuredModels) !== JSON.stringify(defaults.models || {})) {
|
|
372
|
+
cfg.agents.defaults.models = configuredModels;
|
|
373
|
+
saveOpenclawConfig(cfg);
|
|
374
|
+
}
|
|
346
375
|
return {
|
|
347
376
|
primary: defaults.model?.primary || null,
|
|
348
|
-
configuredModels
|
|
377
|
+
configuredModels,
|
|
349
378
|
};
|
|
350
379
|
};
|
|
351
380
|
|
|
@@ -358,7 +387,7 @@ const createAuthProfiles = () => {
|
|
|
358
387
|
cfg.agents.defaults.model.primary = primary;
|
|
359
388
|
}
|
|
360
389
|
if (configuredModels !== undefined) {
|
|
361
|
-
cfg.agents.defaults.models = configuredModels;
|
|
390
|
+
cfg.agents.defaults.models = preserveCodexRuntimeModels(configuredModels);
|
|
362
391
|
}
|
|
363
392
|
saveOpenclawConfig(cfg);
|
|
364
393
|
};
|