-
Notifications
You must be signed in to change notification settings - Fork 24
fix: expose per-model thinking tiers and forward reasoning_effort #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,93 @@ export interface CommandCodeModel { | |
| maxTokens: number | ||
| } | ||
|
|
||
| /** | ||
| * Per-model reasoning effort levels supported by Command Code's /alpha/generate. | ||
| * | ||
| * Extracted from the official command-code CLI (1.7.0) catalog. The Provider API | ||
| * (/provider/v1/models) exposes no effort metadata, so this static table is the | ||
| * only source. Unknown model ids fall back to no thinkingLevelMap, preserving | ||
| * pi's default off..high tiers. | ||
| */ | ||
| export const MODEL_EFFORTS: Readonly<Record<string, readonly string[]>> = { | ||
| "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"], | ||
| "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"], | ||
| "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"], | ||
| } | ||
|
|
||
| /** pi thinking levels in increasing order (mirrors pi-ai ThinkingLevel). */ | ||
| const PI_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"] as const | ||
|
|
||
| /** | ||
| * Build a pi ThinkingLevelMap from a Command Code effort list. Supported levels | ||
| * map to their upstream effort string; unsupported levels are explicitly `null` | ||
| * so pi-ai's getSupportedThinkingLevels hides them and clampThinkingLevel snaps | ||
| * to the nearest supported level. `off` always maps to itself. | ||
| */ | ||
| export function thinkingLevelMapForEfforts( | ||
| efforts: readonly string[], | ||
| ): Record<string, string | null> { | ||
| const map: Record<string, string | null> = { off: "off" } | ||
| for (const level of PI_THINKING_LEVELS) { | ||
| if (level === "off") continue | ||
| map[level] = efforts.includes(level) ? level : null | ||
| } | ||
| return map | ||
| } | ||
|
|
||
| export type ThinkingMetadata = { | ||
| thinkingLevelMap: Record<string, string | null> | ||
| thinking: { | ||
| effortMap: Record<string, string | null> | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OMP 17.2.x expects canonical |
||
| efforts: string[] | ||
| defaultLevel: string | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Resolve per-model thinking metadata for provider registration. Models absent | ||
| * from MODEL_EFFORTS get no map, preserving pi's default off..high tiers. | ||
| * Emits both `thinkingLevelMap` (pi-ai <=0.75.5) and `thinking.effortMap` | ||
| * (OMP 17.2.x) so the plugin works across host versions. | ||
| */ | ||
| export function thinkingMetadataForModel(modelId: string): ThinkingMetadata | undefined { | ||
| const efforts = MODEL_EFFORTS[modelId] | ||
| if (!efforts) return undefined | ||
| const effortMap = thinkingLevelMapForEfforts(efforts) | ||
| return { | ||
| thinkingLevelMap: effortMap, | ||
| thinking: { | ||
| effortMap, | ||
| efforts: [...efforts], | ||
| defaultLevel: efforts[efforts.length - 2] ?? efforts[0], | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please do not infer |
||
| }, | ||
| } | ||
| } | ||
|
|
||
| interface FetchCommandCodeModelsOptions { | ||
| url?: string | ||
| fetchImpl?: typeof fetch | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checked-in table does not match the authoritative
command-code@1.7.0catalog. These five entries have no adjustable effort surface in the published CLI:claude-haiku-4-5-20251001,moonshotai/Kimi-K2.5,moonshotai/Kimi-K2.6,meta/muse-spark-1.1, andtencent/hy3-paid. The CLI's generatedreference/models.mdmarks their Efforts column as—("models without an effort column entry decide their own reasoning depth"). Please remove these entries; otherwise the provider exposes and sends effort values that the official CLI does not support. The remaining 22 entries match the 1.7.0 effort map.