chore: update deps and pi model discovery

This commit is contained in:
Peter Steinberger
2026-01-31 06:40:45 +01:00
parent 85dd070dea
commit 08ed62852a
32 changed files with 1424 additions and 1419 deletions

View File

@@ -1,7 +1,5 @@
import { join } from "node:path";
import type { Api, Model } from "@mariozechner/pi-ai";
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
import { discoverAuthStorage, discoverModels } from "../../agents/pi-model-discovery.js";
import { resolveOpenClawAgentDir } from "../../agents/agent-paths.js";
import type { AuthProfileStore } from "../../agents/auth-profiles.js";
@@ -43,8 +41,8 @@ const hasAuthForProvider = (provider: string, cfg: OpenClawConfig, authStore: Au
export async function loadModelRegistry(cfg: OpenClawConfig) {
await ensureOpenClawModelsJson(cfg);
const agentDir = resolveOpenClawAgentDir();
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
const registry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
const authStorage = discoverAuthStorage(agentDir);
const registry = discoverModels(authStorage, agentDir);
const models = registry.getAll() as Model<Api>[];
const availableModels = registry.getAvailable() as Model<Api>[];
const availableKeys = new Set(availableModels.map((model) => modelKey(model.provider, model.id)));