mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-15 11:43:10 +03:00
* feat(cursor): prefer live synced catalog for listing and Test All When an active synced Cursor catalog exists, list only live models plus injected auto routers (and customs). Keep the static registry as offline fallback. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(cursor): send live-catalog model ids verbatim on AgentRun Skip #7289 effort/reasoning splits when the exact id is in the active synced Cursor catalog so AgentRun does not rewrite flattened live ids into missing bases that return AI Model Not Found. Also wires auto-cost/balance/intelligence to default + optimization for the injected routers. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: yansigit <yansigit@users.noreply.github.com>
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
/**
|
|
* Ensure Cursor catalog listings always expose OmniRoute's public auto-router
|
|
* ids (`auto` + Cost/Balance/Intelligence variants). Live AvailableModels /
|
|
* cursor-agent often return wire id `default` only.
|
|
*/
|
|
|
|
export type CursorAutoCatalogEntry = {
|
|
id: string;
|
|
name: string;
|
|
owned_by?: string;
|
|
[key: string]: unknown;
|
|
};
|
|
|
|
export const CURSOR_AUTO_ROUTER_VARIANT_IDS = [
|
|
"auto-cost",
|
|
"auto-balance",
|
|
"auto-intelligence",
|
|
] as const;
|
|
|
|
const CURSOR_AUTO_ROUTER_VARIANT_NAMES: Record<
|
|
(typeof CURSOR_AUTO_ROUTER_VARIANT_IDS)[number],
|
|
string
|
|
> = {
|
|
"auto-cost": "Auto (cost)",
|
|
"auto-balance": "Auto (balance)",
|
|
"auto-intelligence": "Auto (intelligence)",
|
|
};
|
|
|
|
/** Cursor auto-router: catalog id `auto`, wire id `default`. Always keep `auto` visible. */
|
|
export function ensureCursorAutoCatalogEntry<T extends CursorAutoCatalogEntry>(models: T[]): T[] {
|
|
const byId = new Map(models.map((m) => [m.id, m]));
|
|
const out = [...models];
|
|
|
|
if (!byId.has("auto")) {
|
|
const defaultEntry = byId.get("default");
|
|
const autoEntry = {
|
|
id: "auto",
|
|
name:
|
|
typeof defaultEntry?.name === "string" && defaultEntry.name.trim()
|
|
? defaultEntry.name
|
|
: "Auto (current, default)",
|
|
owned_by: "cursor",
|
|
} as T;
|
|
out.unshift(autoEntry);
|
|
byId.set("auto", autoEntry);
|
|
}
|
|
|
|
for (const id of CURSOR_AUTO_ROUTER_VARIANT_IDS) {
|
|
if (byId.has(id)) continue;
|
|
const entry = {
|
|
id,
|
|
name: CURSOR_AUTO_ROUTER_VARIANT_NAMES[id],
|
|
owned_by: "cursor",
|
|
} as T;
|
|
out.push(entry);
|
|
byId.set(id, entry);
|
|
}
|
|
|
|
return out;
|
|
}
|