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 @@
// Lazy-load pi-coding-agent model metadata so we can infer context windows when
// the agent reports a model id. This includes custom models.json entries.
import { join } from "node:path";
import { loadConfig } from "../config/config.js";
import { resolveOpenClawAgentDir } from "./agent-paths.js";
import { ensureOpenClawModelsJson } from "./models-config.js";
@@ -10,12 +12,12 @@ type ModelEntry = { id: string; contextWindow?: number };
const MODEL_CACHE = new Map<string, number>();
const loadPromise = (async () => {
try {
const { discoverAuthStorage, discoverModels } = await import("@mariozechner/pi-coding-agent");
const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent");
const cfg = loadConfig();
await ensureOpenClawModelsJson(cfg);
const agentDir = resolveOpenClawAgentDir();
const authStorage = discoverAuthStorage(agentDir);
const modelRegistry = discoverModels(authStorage, agentDir);
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
const modelRegistry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
const models = modelRegistry.getAll() as ModelEntry[];
for (const m of models) {
if (!m?.id) continue;