Merge branch 'feat/request-fidelity' into test/provider-hardening-e2e

This commit is contained in:
Patrick Wozniak
2026-08-07 14:37:42 +02:00
3 changed files with 49 additions and 17 deletions
+11 -14
View File
@@ -14,13 +14,15 @@ type CommandCodeReasoningEffort = Exclude<PiThinkingLevel, "off">
/**
* Per-model reasoning efforts supported by Command Code's generate endpoint.
*
* The Provider API does not expose reasoning metadata. These entries are
* maintained from the official Command Code CLI model catalog, so a model is
* marked reasoning-capable only when its upstream effort support is known.
* The Provider API does not expose reasoning metadata. This is an exact
* snapshot of `reasoningEfforts` from the command-code@1.14.1 model catalog
* (`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[]>> = {
"Qwen/Qwen3.8-Max": ["low", "medium", "xhigh"],
"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-8": ["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-lite": ["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"],
"tencent/hy3-paid": ["low", "medium", "high"],
"xai/grok-4.5": ["low", "medium", "high"],
"zai-org/GLM-5.2": ["high", "max"],
}
@@ -72,22 +70,21 @@ export function thinkingLevelMapForEfforts(
export interface ThinkingMetadata {
thinkingLevelMap: Partial<Record<PiThinkingLevel, string | null>>
thinking: {
effortMap: Partial<Record<PiThinkingLevel, string | null>>
mode: "effort"
effortMap: Partial<Record<CommandCodeReasoningEffort, string>>
efforts: readonly CommandCodeReasoningEffort[]
defaultLevel: CommandCodeReasoningEffort
}
}
export function thinkingMetadataForModel(modelId: string): ThinkingMetadata | undefined {
const efforts = MODEL_EFFORTS[modelId]
if (!efforts) return undefined
const effortMap = thinkingLevelMapForEfforts(efforts)
return {
thinkingLevelMap: effortMap,
thinkingLevelMap: thinkingLevelMapForEfforts(efforts),
thinking: {
effortMap,
mode: "effort",
effortMap: Object.fromEntries(efforts.map((effort) => [effort, effort])),
efforts,
defaultLevel: efforts[efforts.length - 2] ?? efforts[0],
},
}
}
+2 -2
View File
@@ -75,9 +75,9 @@ export interface ModelLike {
reasoning?: boolean
thinkingLevelMap?: Partial<Record<string, string | null>>
thinking?: {
effortMap?: Partial<Record<string, string | null>>
mode?: "effort"
effortMap?: Partial<Record<string, string>>
efforts?: readonly string[]
defaultLevel?: string
}
}
+36 -1
View File
@@ -94,10 +94,45 @@ describe("commandCodeModelsFromApiResponse()", () => {
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)) {
const metadata = thinkingMetadataForModel(modelId)
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) {
const expected = efforts.includes(level)
assert.equal(