MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / resolveExact

Function resolveExact

test/model-resolve.test.ts:93–102  ·  view source on GitHub ↗
(index: Map<string, Val>, modelId: string, providers: Set<string>)

Source from the content-addressed store, hash-verified

91 // Faithful replication of RouterCore.resolveModel (exact path) + the new
92 // resolvePreferringDefaultProvider tie-break.
93 const resolveExact = (index: Map<string, Val>, modelId: string, providers: Set<string>) => {
94 const direct = index.get(modelId);
95 if (!direct) return null;
96 let resolvedId = modelId;
97 if (modelId.includes('/')) {
98 const [first, ...rest] = modelId.split('/');
99 if (first && providers.has(first)) resolvedId = rest.join('/');
100 }
101 return { provider: direct.provider, resolvedId };
102 };
103 const resolvePreferringDefault = (index: Map<string, Val>, modelId: string, defProvider: string, providers: Set<string>) => {
104 if (!modelId.includes('/')) {
105 const q = resolveExact(index, `${defProvider}/${modelId}`, providers);

Callers 2

resolvePreferringDefaultFunction · 0.85

Calls 2

getMethod · 0.45
hasMethod · 0.45

Tested by

no test coverage detected