Agents: update pi dependencies to 0.50.7

This commit is contained in:
Mario Zechner
2026-01-31 04:19:56 +01:00
parent cc366f4baa
commit c0a6e675a3
13 changed files with 303 additions and 180 deletions

View File

@@ -1,6 +1,8 @@
import { join } from "node:path";
import type { Api, AssistantMessage, Context, Model } from "@mariozechner/pi-ai";
import { complete } from "@mariozechner/pi-ai";
import { discoverAuthStorage, discoverModels } from "@mariozechner/pi-coding-agent";
import { AuthStorage, ModelRegistry } from "@mariozechner/pi-coding-agent";
import { getApiKeyForModel, requireApiKey } from "../../agents/model-auth.js";
import { ensureOpenClawModelsJson } from "../../agents/models-config.js";
@@ -12,8 +14,8 @@ export async function describeImageWithModel(
params: ImageDescriptionRequest,
): Promise<ImageDescriptionResult> {
await ensureOpenClawModelsJson(params.cfg, params.agentDir);
const authStorage = discoverAuthStorage(params.agentDir);
const modelRegistry = discoverModels(authStorage, params.agentDir);
const authStorage = new AuthStorage(join(params.agentDir, "auth.json"));
const modelRegistry = new ModelRegistry(authStorage, join(params.agentDir, "models.json"));
const model = modelRegistry.find(params.provider, params.model) as Model<Api> | null;
if (!model) {
throw new Error(`Unknown model: ${params.provider}/${params.model}`);