feat(codex): complete routed model catalogs

Codex treats the downloaded model catalog as a capability contract. Slug-only entries hide supported reasoning levels, can advertise invalid image inputs, and expose automatic or media-only models in the model picker. Generate complete route-aware metadata, preserve official manifests, filter non-agent models, and compute validators from the final catalog.
This commit is contained in:
Long Li committed 2026-08-22 14:43:40 +09:00
1 parent 22e1b8144a
commit e471be7302
12 files changed
+2420 -97

No files matched your search

+29 -1
View File
@@ -16,10 +16,34 @@ describe('Codex models API', () => {
})
it('fetches a manifest with the current API key without adding it to the catalog', async () => {
const manifest = {
models: [
{
slug: 'grok-4.6',
default_reasoning_level: 'high',
supported_reasoning_levels: [
{ effort: 'low', description: 'Fast responses' },
{ effort: 'xhigh', description: 'Extra-high reasoning depth' }
],
input_modalities: ['text', 'image'],
model_messages: { instructions_template: 'Use the routed model.' }
},
{
slug: 'deepseek-v4-pro',
default_reasoning_level: 'high',
supported_reasoning_levels: [
{ effort: 'low', description: 'Fast responses' },
{ effort: 'max', description: 'Maximum reasoning depth' }
],
input_modalities: ['text'],
model_messages: { instructions_template: 'Use the routed model.' }
}
]
}
const fetchMock = vi.fn().mockResolvedValue({
ok: true,
status: 200,
json: async () => ({ models: [{ slug: 'grok-4.6' }, { slug: 'deepseek-v4-pro' }] })
json: async () => manifest
})
vi.stubGlobal('fetch', fetchMock)
@@ -35,6 +59,10 @@ describe('Codex models API', () => {
})
)
expect(result.modelCount).toBe(2)
expect(JSON.parse(result.content)).toEqual(manifest)
expect(result.content).toContain('"effort": "xhigh"')
expect(result.content).toContain('"input_modalities"')
expect(result.content).toContain('"instructions_template"')
expect(result.content).not.toContain('sk-user-test')
})