


























@@ -125,6 +125,9 @@ function installModelsListCommandForwardCompatMocks() {
125125vi.doMock("../../agents/model-suppression.js", () => ({
126126shouldSuppressBuiltInModel: suppressOpenAiSpark,
127127shouldSuppressBuiltInModelFromManifest: suppressOpenAiSpark,
128+createManifestBuiltInModelSuppressor: vi.fn(
129+() => (model: { provider?: string | null; id?: string | null }) => suppressOpenAiSpark(model),
130+),
128131}));
129132130133vi.doMock("./load-config.js", () => ({
@@ -156,7 +159,7 @@ function installModelsListCommandForwardCompatMocks() {
156159vi.doMock("./list.registry-load.js", () => ({
157160loadListModelRegistry: async (
158161cfg: unknown,
159-opts?: { providerFilter?: string; normalizeModels?: boolean },
162+opts?: { providerFilter?: string; normalizeModels?: boolean; loadAvailability?: boolean },
160163): Promise<{
161164models: Array<{ provider: string; id: string }>;
162165availableKeys?: Set<string>;
@@ -747,15 +750,55 @@ describe("modelsListCommand forward-compat", () => {
747750]);
748751});
749752750-it("does not fall back to the registry for provider filters without catalog coverage", async () => {
753+it("falls back to registry rows for provider filters without catalog coverage", async () => {
751754mocks.resolveConfiguredEntries.mockReturnValueOnce({ entries: [] });
752755mocks.hasProviderStaticCatalogForFilter.mockResolvedValueOnce(false);
756+mocks.loadModelRegistry.mockResolvedValueOnce({
757+models: [
758+{
759+provider: "anthropic",
760+id: "claude-opus-4-7",
761+name: "Claude Opus 4.7",
762+api: "anthropic-messages",
763+baseUrl: "https://api.anthropic.com/v1",
764+input: ["text", "image"],
765+contextWindow: 1_000_000,
766+maxTokens: 64_000,
767+cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
768+},
769+],
770+availableKeys: undefined,
771+registry: {
772+getAll: () => [
773+{
774+provider: "anthropic",
775+id: "claude-opus-4-7",
776+name: "Claude Opus 4.7",
777+api: "anthropic-messages",
778+baseUrl: "https://api.anthropic.com/v1",
779+input: ["text", "image"],
780+contextWindow: 1_000_000,
781+maxTokens: 64_000,
782+cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
783+},
784+],
785+},
786+});
753787const runtime = createRuntime();
754788755-await modelsListCommand({ all: true, provider: "openrouter", json: true }, runtime as never);
789+await modelsListCommand({ all: true, provider: "anthropic", json: true }, runtime as never);
756790757-expect(mocks.loadModelRegistry).not.toHaveBeenCalled();
758-expect(runtime.log).toHaveBeenCalledWith("No models found.");
791+expect(mocks.loadModelRegistry).toHaveBeenCalledWith(mocks.resolvedConfig, {
792+providerFilter: "anthropic",
793+normalizeModels: false,
794+loadAvailability: false,
795+});
796+expect(lastPrintedRows<{ key: string; available: boolean }>()).toEqual([
797+expect.objectContaining({
798+key: "anthropic/claude-opus-4-7",
799+available: false,
800+}),
801+]);
759802});
760803761804it("includes provider-owned supplemental catalog rows with provider filters", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。