mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 03:41:22 +00:00
chore: update deps and pi model discovery
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
// 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";
|
||||
@@ -12,12 +10,12 @@ type ModelEntry = { id: string; contextWindow?: number };
|
||||
const MODEL_CACHE = new Map<string, number>();
|
||||
const loadPromise = (async () => {
|
||||
try {
|
||||
const { AuthStorage, ModelRegistry } = await import("@mariozechner/pi-coding-agent");
|
||||
const { discoverAuthStorage, discoverModels } = await import("./pi-model-discovery.js");
|
||||
const cfg = loadConfig();
|
||||
await ensureOpenClawModelsJson(cfg);
|
||||
const agentDir = resolveOpenClawAgentDir();
|
||||
const authStorage = new AuthStorage(join(agentDir, "auth.json"));
|
||||
const modelRegistry = new ModelRegistry(authStorage, join(agentDir, "models.json"));
|
||||
const authStorage = discoverAuthStorage(agentDir);
|
||||
const modelRegistry = discoverModels(authStorage, agentDir);
|
||||
const models = modelRegistry.getAll() as ModelEntry[];
|
||||
for (const m of models) {
|
||||
if (!m?.id) continue;
|
||||
|
||||
Reference in New Issue
Block a user