MCPcopy Index your code
hub / github.com/freecodexyz/free-code / getRuntimeMainLoopModel

Function getRuntimeMainLoopModel

src/utils/model/model.ts:148–170  ·  view source on GitHub ↗
(params: {
  permissionMode: PermissionMode
  mainLoopModel: string
  exceeds200kTokens?: boolean
})

Source from the content-addressed store, hash-verified

146 * @returns The model to use
147 */
148export function getRuntimeMainLoopModel(params: {
149 permissionMode: PermissionMode
150 mainLoopModel: string
151 exceeds200kTokens?: boolean
152}): ModelName {
153 const { permissionMode, mainLoopModel, exceeds200kTokens = false } = params
154
155 // opusplan uses Opus in plan mode without [1m] suffix.
156 if (
157 getUserSpecifiedModelSetting() === 'opusplan' &&
158 permissionMode === 'plan' &&
159 !exceeds200kTokens
160 ) {
161 return getDefaultOpusModel()
162 }
163
164 // sonnetplan by default
165 if (getUserSpecifiedModelSetting() === 'haiku' && permissionMode === 'plan') {
166 return getDefaultSonnetModel()
167 }
168
169 return mainLoopModel
170}
171
172/**
173 * Get the default main loop model setting.

Callers 5

queryLoopFunction · 0.85
getContextUsedPercentFunction · 0.85
analyzeContextUsageFunction · 0.85
getAgentModelFunction · 0.85

Calls 3

getDefaultOpusModelFunction · 0.85
getDefaultSonnetModelFunction · 0.85

Tested by

no test coverage detected