|
6 | 6 | resolveCommandCodeDynamicModel, |
7 | 7 | } from "../index.js"; |
8 | 8 | import { commandCodeBaselineModels } from "../src/baseline.models.js"; |
| 9 | +import manifest from "../openclaw.plugin.json"; |
9 | 10 |
|
10 | 11 | describe("isClaudeModel", () => { |
11 | 12 | it("detects Claude ids by convention", () => { |
@@ -129,3 +130,37 @@ describe("resolveCommandCodeDynamicModel", () => { |
129 | 130 | expect(m?.api).toBe("anthropic-messages"); |
130 | 131 | }); |
131 | 132 | }); |
| 133 | + |
| 134 | +describe("manifest modelCatalog (drift guard)", () => { |
| 135 | + const catalog = manifest.modelCatalog.providers.commandcode; |
| 136 | + const projected = providerFromRows(commandCodeBaselineModels); |
| 137 | + |
| 138 | + it("mirrors the baseline projection model by model", () => { |
| 139 | + expect(catalog.models.length).toBe(projected.models.length); |
| 140 | + const byId = new Map(projected.models.map((m) => [m.id, m])); |
| 141 | + for (const entry of catalog.models) { |
| 142 | + const expected = byId.get(entry.id); |
| 143 | + expect(expected, `manifest model ${entry.id} missing from baseline projection`).toBeDefined(); |
| 144 | + expect(entry.name).toBe(expected?.name); |
| 145 | + expect(entry.api).toBe(expected?.api); |
| 146 | + expect(entry.baseUrl).toBe(expected?.baseUrl); |
| 147 | + expect(entry.reasoning).toBe(expected?.reasoning); |
| 148 | + expect(entry.input).toEqual(expected?.input); |
| 149 | + expect(entry.contextWindow).toBe(expected?.contextWindow); |
| 150 | + expect(entry.maxTokens).toBe(expected?.maxTokens); |
| 151 | + expect(entry.cost).toEqual(expected?.cost); |
| 152 | + } |
| 153 | + }); |
| 154 | + |
| 155 | + it("keeps ids in the same order as the baseline", () => { |
| 156 | + expect(catalog.models.map((m) => m.id)).toEqual( |
| 157 | + commandCodeBaselineModels.map((r) => r.id), |
| 158 | + ); |
| 159 | + }); |
| 160 | + |
| 161 | + it("declares static discovery and the provider-level transport", () => { |
| 162 | + expect(manifest.modelCatalog.discovery.commandcode).toBe("static"); |
| 163 | + expect(catalog.baseUrl).toBe("https://api.commandcode.ai/provider/v1"); |
| 164 | + expect(catalog.api).toBe("openai-completions"); |
| 165 | + }); |
| 166 | +}); |
0 commit comments