Skip to content

Commit 6b6f140

Browse files
committed
refactor: clean manifest catalog mapping
1 parent 2b664a7 commit 6b6f140

2 files changed

Lines changed: 22 additions & 10 deletions

File tree

src/agents/model-catalog.ts

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,16 +136,27 @@ export function loadManifestModelCatalog(params: {
136136
const plan = planManifestModelCatalogRows({
137137
registry: { plugins: eligiblePlugins },
138138
});
139-
return plan.rows.map((row) => ({
140-
id: row.id,
141-
name: row.name,
142-
provider: row.provider,
143-
...(row.contextWindow ? { contextWindow: row.contextWindow } : {}),
144-
...(row.contextTokens && !row.contextWindow ? { contextWindow: row.contextTokens } : {}),
145-
...(typeof row.reasoning === "boolean" ? { reasoning: row.reasoning } : {}),
146-
...(row.input?.length ? { input: [...row.input] } : {}),
147-
...(row.compat ? { compat: row.compat } : {}),
148-
}));
139+
return plan.rows.map((row) => {
140+
const entry: ModelCatalogEntry = {
141+
id: row.id,
142+
name: row.name,
143+
provider: row.provider,
144+
};
145+
const contextWindow = row.contextWindow ?? row.contextTokens;
146+
if (contextWindow) {
147+
entry.contextWindow = contextWindow;
148+
}
149+
if (typeof row.reasoning === "boolean") {
150+
entry.reasoning = row.reasoning;
151+
}
152+
if (row.input?.length) {
153+
entry.input = [...row.input];
154+
}
155+
if (row.compat) {
156+
entry.compat = row.compat;
157+
}
158+
return entry;
159+
});
149160
}
150161

151162
export async function loadModelCatalog(params?: {

src/agents/tools/manifest-capability-availability.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ function metadataKeyForCapabilityContract(
165165
case "mediaUnderstandingProviders":
166166
return undefined;
167167
}
168+
return undefined;
168169
}
169170

170171
function normalizeBaseUrlForManifestGuard(value: string): string {

0 commit comments

Comments
 (0)