| 57 | : undefined |
| 58 | |
| 59 | export const getRooReasoning = ({ |
| 60 | model, |
| 61 | reasoningEffort, |
| 62 | settings, |
| 63 | }: GetModelReasoningOptions): RooReasoningParams | undefined => { |
| 64 | // Check if model supports reasoning effort |
| 65 | if (!model.supportsReasoningEffort) { |
| 66 | return undefined |
| 67 | } |
| 68 | |
| 69 | if (model.requiredReasoningEffort) { |
| 70 | // Honor the provided effort if it's valid, otherwise let the model choose. |
| 71 | if (reasoningEffort && reasoningEffort !== "disable" && reasoningEffort !== "minimal") { |
| 72 | return { enabled: true, effort: reasoningEffort } |
| 73 | } else { |
| 74 | return { enabled: true } |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | // Explicit off switch from settings: always send disabled for back-compat and to |
| 79 | // prevent automatic reasoning when the toggle is turned off. |
| 80 | if (settings.enableReasoningEffort === false) { |
| 81 | return { enabled: false } |
| 82 | } |
| 83 | |
| 84 | // For Roo models that support reasoning effort, absence of a selection should be |
| 85 | // treated as an explicit "off" signal so that the backend does not auto-enable |
| 86 | // reasoning. This aligns with the default behavior in tests. |
| 87 | if (!reasoningEffort) { |
| 88 | return { enabled: false } |
| 89 | } |
| 90 | |
| 91 | // "disable" is a legacy sentinel that means "omit the reasoning field entirely" |
| 92 | // and let the server decide any defaults. |
| 93 | if (reasoningEffort === "disable") { |
| 94 | return undefined |
| 95 | } |
| 96 | |
| 97 | // For Roo, "minimal" is treated as "none" for effort-based reasoning – we omit |
| 98 | // the reasoning field entirely instead of sending an explicit effort. |
| 99 | if (reasoningEffort === "minimal") { |
| 100 | return undefined |
| 101 | } |
| 102 | |
| 103 | // When an effort is provided (e.g. "low" | "medium" | "high" | "none"), enable |
| 104 | // with the selected effort. |
| 105 | return { enabled: true, effort: reasoningEffort as ReasoningEffortExtended } |
| 106 | } |
| 107 | |
| 108 | export const getAnthropicReasoning = ({ |
| 109 | model, |