(rawModels: unknown)
| 21 | const inflight = new Map<string, Promise<ListOpencodeModelsForCwdResponse>>(); |
| 22 | |
| 23 | function normalizeAvailableModels(rawModels: unknown): OpencodeModelSummary[] { |
| 24 | if (!Array.isArray(rawModels)) return []; |
| 25 | const out: OpencodeModelSummary[] = []; |
| 26 | for (const entry of rawModels) { |
| 27 | if (!isObject(entry)) continue; |
| 28 | const modelId = asString(entry.modelId) ?? asString(entry.value); |
| 29 | if (!modelId) continue; |
| 30 | const name = asString(entry.name) ?? undefined; |
| 31 | out.push(name ? { modelId, name } : { modelId }); |
| 32 | } |
| 33 | return out; |
| 34 | } |
| 35 | |
| 36 | function extractModelConfigOption(response: Record<string, unknown>): { |
| 37 | currentValue: string | null; |
no test coverage detected