fix(models): sync reasoning efforts with command code cli
This commit is contained in:
+11
-14
@@ -14,13 +14,15 @@ type CommandCodeReasoningEffort = Exclude<PiThinkingLevel, "off">
|
|||||||
/**
|
/**
|
||||||
* Per-model reasoning efforts supported by Command Code's generate endpoint.
|
* Per-model reasoning efforts supported by Command Code's generate endpoint.
|
||||||
*
|
*
|
||||||
* The Provider API does not expose reasoning metadata. These entries are
|
* The Provider API does not expose reasoning metadata. This is an exact
|
||||||
* maintained from the official Command Code CLI model catalog, so a model is
|
* snapshot of `reasoningEfforts` from the command-code@1.14.1 model catalog
|
||||||
* marked reasoning-capable only when its upstream effort support is known.
|
* (`packages/shared/src/model-catalog.ts`, also published in the generated
|
||||||
|
* `dist/bundled/command-code-knowledge/reference/models.md`). Models omitted
|
||||||
|
* here let Command Code choose their reasoning depth, matching the CLI.
|
||||||
*/
|
*/
|
||||||
export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasoningEffort[]>> = {
|
export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasoningEffort[]>> = {
|
||||||
|
"Qwen/Qwen3.8-Max": ["low", "medium", "xhigh"],
|
||||||
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
|
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
|
||||||
"claude-haiku-4-5-20251001": ["low", "medium", "high", "xhigh", "max"],
|
|
||||||
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
|
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
|
||||||
"claude-opus-4-8": ["low", "medium", "high", "xhigh", "max"],
|
"claude-opus-4-8": ["low", "medium", "high", "xhigh", "max"],
|
||||||
"claude-opus-5": ["low", "medium", "high", "xhigh", "max"],
|
"claude-opus-5": ["low", "medium", "high", "xhigh", "max"],
|
||||||
@@ -39,11 +41,7 @@ export const MODEL_EFFORTS: Readonly<Record<string, readonly CommandCodeReasonin
|
|||||||
"google/gemini-3.5-flash": ["low", "medium", "high"],
|
"google/gemini-3.5-flash": ["low", "medium", "high"],
|
||||||
"google/gemini-3.5-flash-lite": ["low", "medium", "high"],
|
"google/gemini-3.5-flash-lite": ["low", "medium", "high"],
|
||||||
"google/gemini-3.6-flash": ["low", "medium", "high"],
|
"google/gemini-3.6-flash": ["low", "medium", "high"],
|
||||||
"meta/muse-spark-1.1": ["low", "medium", "high"],
|
|
||||||
"moonshotai/Kimi-K2.5": ["high", "max"],
|
|
||||||
"moonshotai/Kimi-K2.6": ["high", "max"],
|
|
||||||
"sakana/fugu-ultra": ["high", "xhigh"],
|
"sakana/fugu-ultra": ["high", "xhigh"],
|
||||||
"tencent/hy3-paid": ["low", "medium", "high"],
|
|
||||||
"xai/grok-4.5": ["low", "medium", "high"],
|
"xai/grok-4.5": ["low", "medium", "high"],
|
||||||
"zai-org/GLM-5.2": ["high", "max"],
|
"zai-org/GLM-5.2": ["high", "max"],
|
||||||
}
|
}
|
||||||
@@ -72,22 +70,21 @@ export function thinkingLevelMapForEfforts(
|
|||||||
export interface ThinkingMetadata {
|
export interface ThinkingMetadata {
|
||||||
thinkingLevelMap: Partial<Record<PiThinkingLevel, string | null>>
|
thinkingLevelMap: Partial<Record<PiThinkingLevel, string | null>>
|
||||||
thinking: {
|
thinking: {
|
||||||
effortMap: Partial<Record<PiThinkingLevel, string | null>>
|
mode: "effort"
|
||||||
|
effortMap: Partial<Record<CommandCodeReasoningEffort, string>>
|
||||||
efforts: readonly CommandCodeReasoningEffort[]
|
efforts: readonly CommandCodeReasoningEffort[]
|
||||||
defaultLevel: CommandCodeReasoningEffort
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function thinkingMetadataForModel(modelId: string): ThinkingMetadata | undefined {
|
export function thinkingMetadataForModel(modelId: string): ThinkingMetadata | undefined {
|
||||||
const efforts = MODEL_EFFORTS[modelId]
|
const efforts = MODEL_EFFORTS[modelId]
|
||||||
if (!efforts) return undefined
|
if (!efforts) return undefined
|
||||||
const effortMap = thinkingLevelMapForEfforts(efforts)
|
|
||||||
return {
|
return {
|
||||||
thinkingLevelMap: effortMap,
|
thinkingLevelMap: thinkingLevelMapForEfforts(efforts),
|
||||||
thinking: {
|
thinking: {
|
||||||
effortMap,
|
mode: "effort",
|
||||||
|
effortMap: Object.fromEntries(efforts.map((effort) => [effort, effort])),
|
||||||
efforts,
|
efforts,
|
||||||
defaultLevel: efforts[efforts.length - 2] ?? efforts[0],
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -75,9 +75,9 @@ export interface ModelLike {
|
|||||||
reasoning?: boolean
|
reasoning?: boolean
|
||||||
thinkingLevelMap?: Partial<Record<string, string | null>>
|
thinkingLevelMap?: Partial<Record<string, string | null>>
|
||||||
thinking?: {
|
thinking?: {
|
||||||
effortMap?: Partial<Record<string, string | null>>
|
mode?: "effort"
|
||||||
|
effortMap?: Partial<Record<string, string>>
|
||||||
efforts?: readonly string[]
|
efforts?: readonly string[]
|
||||||
defaultLevel?: string
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+36
-1
@@ -94,10 +94,45 @@ describe("commandCodeModelsFromApiResponse()", () => {
|
|||||||
assert.equal(models[1]?.reasoning, false)
|
assert.equal(models[1]?.reasoning, false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("builds explicit maps for every known effort set", () => {
|
it("matches the exact command-code@1.14.1 reasoning effort catalog", () => {
|
||||||
|
assert.deepEqual(MODEL_EFFORTS, {
|
||||||
|
"Qwen/Qwen3.8-Max": ["low", "medium", "xhigh"],
|
||||||
|
"claude-fable-5": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"claude-opus-4-7": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"claude-opus-4-8": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"claude-opus-5": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"claude-sonnet-4-6": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"claude-sonnet-5": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"deepseek/deepseek-v4-flash": ["high", "max"],
|
||||||
|
"deepseek/deepseek-v4-pro": ["high", "max"],
|
||||||
|
"gpt-5.3-codex": ["low", "medium", "high", "xhigh"],
|
||||||
|
"gpt-5.4": ["low", "medium", "high", "xhigh"],
|
||||||
|
"gpt-5.4-mini": ["low", "medium", "high"],
|
||||||
|
"gpt-5.5": ["low", "medium", "high", "xhigh"],
|
||||||
|
"gpt-5.6-luna": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"gpt-5.6-sol": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"gpt-5.6-terra": ["low", "medium", "high", "xhigh", "max"],
|
||||||
|
"google/gemini-3.1-flash-lite": ["low", "medium", "high"],
|
||||||
|
"google/gemini-3.5-flash": ["low", "medium", "high"],
|
||||||
|
"google/gemini-3.5-flash-lite": ["low", "medium", "high"],
|
||||||
|
"google/gemini-3.6-flash": ["low", "medium", "high"],
|
||||||
|
"sakana/fugu-ultra": ["high", "xhigh"],
|
||||||
|
"xai/grok-4.5": ["low", "medium", "high"],
|
||||||
|
"zai-org/GLM-5.2": ["high", "max"],
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
it("builds separate canonical pi and OMP metadata", () => {
|
||||||
for (const [modelId, efforts] of Object.entries(MODEL_EFFORTS)) {
|
for (const [modelId, efforts] of Object.entries(MODEL_EFFORTS)) {
|
||||||
const metadata = thinkingMetadataForModel(modelId)
|
const metadata = thinkingMetadataForModel(modelId)
|
||||||
assert.ok(metadata, `${modelId} should have reasoning metadata`)
|
assert.ok(metadata, `${modelId} should have reasoning metadata`)
|
||||||
|
assert.equal(metadata.thinking.mode, "effort")
|
||||||
|
assert.deepEqual(metadata.thinking.efforts, efforts)
|
||||||
|
assert.deepEqual(
|
||||||
|
metadata.thinking.effortMap,
|
||||||
|
Object.fromEntries(efforts.map((effort) => [effort, effort])),
|
||||||
|
)
|
||||||
|
assert.equal("defaultLevel" in metadata.thinking, false)
|
||||||
for (const level of ["minimal", "low", "medium", "high", "xhigh", "max"] as const) {
|
for (const level of ["minimal", "low", "medium", "high", "xhigh", "max"] as const) {
|
||||||
const expected = efforts.includes(level)
|
const expected = efforts.includes(level)
|
||||||
assert.equal(
|
assert.equal(
|
||||||
|
|||||||
Reference in New Issue
Block a user