Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/v2-model-catalog-efforts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@moonshot-ai/agent-core-v2": patch
---

Fix the v2 model catalog response omitting support_efforts and default_effort, restoring thinking-effort selection for clients connected to the v2 backend.
12 changes: 8 additions & 4 deletions packages/agent-core-v2/src/app/modelCatalog/modelCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import type {
import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation';

import type { ModelAlias } from '#/app/model/model';
import { effectiveModelConfig } from '#/app/model/modelAuth';
import type { ProviderConfig } from '#/app/provider/provider';

export type RefreshProviderModelsScope = 'all' | 'oauth';
Expand Down Expand Up @@ -51,12 +52,15 @@ export interface ProviderCredentialState {
}

export function toProtocolModel(modelId: string, alias: ModelAlias): ModelCatalogItem {
const effective = effectiveModelConfig(alias);
return {
provider: alias.provider ?? '',
provider: effective.provider ?? '',
model: modelId,
display_name: alias.displayName ?? alias.model ?? modelId,
max_context_size: alias.maxContextSize ?? 0,
capabilities: alias.capabilities,
display_name: effective.displayName ?? effective.model ?? modelId,
max_context_size: effective.maxContextSize ?? 0,
capabilities: effective.capabilities,
support_efforts: effective.supportEfforts,
default_effort: effective.defaultEffort,
};
}

Expand Down
28 changes: 28 additions & 0 deletions packages/agent-core-v2/test/app/modelCatalog/modelCatalog.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,34 @@ describe('ModelCatalogService', () => {
]);
});

it('projects support_efforts and default_effort from the model config', async () => {
backing.models['k2'] = {
...backing.models['k2'],
supportEfforts: ['low', 'high', 'max'],
defaultEffort: 'max',
};
const [k2] = await catalog().listModels();
expect(k2).toMatchObject({
model: 'k2',
support_efforts: ['low', 'high', 'max'],
default_effort: 'max',
});
});

it('projects effort fields from overrides when present', async () => {
backing.models['k2'] = {
...backing.models['k2'],
supportEfforts: ['low', 'high'],
defaultEffort: 'high',
overrides: { supportEfforts: ['low', 'high', 'max'], defaultEffort: 'max' },
};
const [k2] = await catalog().listModels();
expect(k2).toMatchObject({
support_efforts: ['low', 'high', 'max'],
default_effort: 'max',
});
});

it('lists providers with per-provider models, default model, and credential state', async () => {
await expect(catalog().listProviders()).resolves.toEqual([
{
Expand Down
Loading