perf: use manifest catalog for agent allowlists

This commit is contained in:
Shakker
2026-05-01 20:21:16 +01:00
parent dfde770a3a
commit f8639d3429
5 changed files with 122 additions and 5 deletions

View File

@@ -51,7 +51,7 @@ import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "./defaults.js";
import { resolveFastModeState } from "./fast-mode.js";
import { AGENT_LANE_SUBAGENT } from "./lanes.js";
import { LiveSessionModelSwitchError } from "./live-model-switch.js";
import { loadModelCatalog } from "./model-catalog.js";
import { loadManifestModelCatalog } from "./model-catalog.js";
import { runWithModelFallback } from "./model-fallback.js";
import {
buildAllowedModelSet,
@@ -729,12 +729,12 @@ async function agentCommandInternal(
}
const needsModelCatalog = Boolean(hasAllowlist);
let allowedModelKeys = new Set<string>();
let allowedModelCatalog: Awaited<ReturnType<typeof loadModelCatalog>> = [];
let modelCatalog: Awaited<ReturnType<typeof loadModelCatalog>> | null = null;
let allowedModelCatalog: ReturnType<typeof loadManifestModelCatalog> = [];
let modelCatalog: ReturnType<typeof loadManifestModelCatalog> | null = null;
let allowAnyModel = !hasAllowlist;
if (needsModelCatalog) {
modelCatalog = await loadModelCatalog({ config: cfg });
modelCatalog = loadManifestModelCatalog({ config: cfg, workspaceDir });
const allowed = buildAllowedModelSet({
cfg,
catalog: modelCatalog,