MCPcopy Create free account
hub / github.com/tiann/hapi / extractModelConfigOption

Function extractModelConfigOption

cli/src/modules/common/opencodeModels.ts:36–52  ·  view source on GitHub ↗
(response: Record<string, unknown>)

Source from the content-addressed store, hash-verified

34}
35
36function extractModelConfigOption(response: Record<string, unknown>): {
37 currentValue: string | null;
38 options: unknown[];
39} | null {
40 if (!Array.isArray(response.configOptions)) return null;
41
42 for (const entry of response.configOptions) {
43 if (!isObject(entry)) continue;
44 if (asString(entry.category) !== 'model') continue;
45 return {
46 currentValue: asString(entry.currentValue),
47 options: Array.isArray(entry.options) ? entry.options : []
48 };
49 }
50
51 return null;
52}
53
54function extractModelsFromResponse(response: unknown): {
55 availableModels: OpencodeModelSummary[];

Callers 1

Calls 2

isObjectFunction · 0.85
asStringFunction · 0.50

Tested by

no test coverage detected