A desktop coding agent with free access to frontier models.
TypeScript
feat(app): catalog-driven omnirush.ai model picker with a Meta Muse group
ogsamratd05b8bd0c248
diff --git a/apps/app/src/app/constants.test.ts b/apps/app/src/app/constants.test.tsindex 32ce6bd7..10b92230 100644--- a/apps/app/src/app/constants.test.ts+++ b/apps/app/src/app/constants.test.ts@@ -5,8 +5,8 @@ declare const expect: (value: unknown) => {};import {+ BUILTIN_OMNIRUSH_MODEL_IDS,DEFAULT_MODEL,- OMNIRUSH_MODEL_IDS,isOmniRushModelID,OMNIRUSH_EXTENSION_CATALOG,filterOmniRushExtensionCatalogForPlatform,@@ -23,11 +23,15 @@ describe("omnirush.ai extension catalog platform filter", () => {expect(DEFAULT_MODEL).toEqual({ providerID: "omnirush", modelID: "gpt-6-astra" });});- test("recognises every omnirush.ai model, default first", () => {- expect([...OMNIRUSH_MODEL_IDS]).toEqual(["gpt-6-astra", "gpt-5.6-sol"]);+ test("recognises every omnirush.ai catalog model, not just the built-in ones", () => {+ expect([...BUILTIN_OMNIRUSH_MODEL_IDS]).toEqual(["gpt-6-astra", "gpt-5.6-sol"]);expect(isOmniRushModelID("gpt-5.6-sol")).toEqual(true);expect(isOmniRushModelID("GPT-6-Astra")).toEqual(true);+ expect(isOmniRushModelID("meta-muse-spark")).toEqual(true);+ expect(isOmniRushModelID("muse-spark-1.3")).toEqual(true);+ // The launch release's retired route is not a catalog id.expect(isOmniRushModelID("z-ai/glm-5.2")).toEqual(false);+ expect(isOmniRushModelID("")).toEqual(false);});test("resolves browser runtime to web and desktop runtime to OS", () => {diff --git a/apps/app/src/app/constants.ts b/apps/app/src/app/constants.tsindex edb1fbc0..41a41b98 100644--- a/apps/app/src/app/constants.ts+++ b/apps/app/src/app/constants.ts@@ -18,23 +18,39 @@ export const VARIANT_PREF_KEY = "omnirush.modelVariant";export { LANGUAGE_PREF_KEY } from "../i18n";export const HIDE_TITLEBAR_PREF_KEY = "omnirush.hideTitlebar";-/** Models served by the omnirush.ai account route; the first entry is the default. */-export const OMNIRUSH_MODEL_IDS = ["gpt-6-astra", "gpt-5.6-sol"] as const;+/**+ * The models the engine serves before the account's catalog first syncs (and+ * offline); the first entry is the default. The catalog itself comes from the+ * server, so any other catalog model is just as valid.+ */+export const BUILTIN_OMNIRUSH_MODEL_IDS = ["gpt-6-astra", "gpt-5.6-sol"] as const;export const DEFAULT_MODEL: ModelRef = {providerID: "omnirush",- modelID: OMNIRUSH_MODEL_IDS[0],+ modelID: BUILTIN_OMNIRUSH_MODEL_IDS[0],};+/** omnirush.ai model ids the catalog no longer serves; a stored choice of one resets to the default. */+export const RETIRED_OMNIRUSH_MODEL_IDS: readonly string[] = [];++/** The id syntax of the omnirush.ai model catalog. */+const OMNIRUSH_CATALOG_MODEL_ID = /^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;++/**+ * Whether a model id can name an omnirush.ai catalog model. Retired routes+ * (e.g. the launch release's `z-ai/glm-5.2`) cannot.+ */export function isOmniRushModelID(modelID: string): boolean {- return (OMNIRUSH_MODEL_IDS as readonly string[]).includes(modelID.trim().toLowerCase());+ const id = modelID.trim();+ return OMNIRUSH_CATALOG_MODEL_ID.test(id) && !RETIRED_OMNIRUSH_MODEL_IDS.includes(id.toLowerCase());}/**- * Effort levels offered for every omnirush.ai model, in picker order. Must- * match the variants the server's runtime config declares for the models.+ * Every effort an omnirush.ai model may offer, in picker order. Each model+ * offers its own subset: the server's runtime config declares the rest of+ * these disabled, so the engine reports exactly the model's levels.*/-export const OMNIRUSH_REASONING_EFFORTS = ["low", "high", "xhigh", "max"] as const;+export const OMNIRUSH_REASONING_EFFORTS = ["none", "minimal", "low", "medium", "high", "xhigh", "max"] as const;export const SUGGESTED_PLUGINS: SuggestedPlugin[] = [];diff --git a/apps/app/src/app/lib/model-behavior.ts b/apps/app/src/app/lib/model-behavior.tsindex f059aef2..fba611f6 100644--- a/apps/app/src/app/lib/model-behavior.ts+++ b/apps/app/src/app/lib/model-behavior.ts@@ -122,10 +122,9 @@ const usesGlmDisplayAliases = (};/**- * omnirush.ai models offer exactly the contract's effort levels. The engine- * merges its own OpenAI defaults (none, minimal, medium, max) into a reasoning- * model's variants, so the reported keys are filtered to the allow-list rather- * than trusted, which also keeps the picker default at "high".+ * omnirush.ai models offer their own catalog effort levels. The server+ * disables every other known effort, so the engine reports exactly those; the+ * filter only keeps an engine default outside the known set off the picker.*/const omnirushVariantKeys = (keys: string[]) =>keys.filter((key) => (OMNIRUSH_REASONING_EFFORTS as readonly string[]).includes(key));diff --git a/apps/app/src/app/types.ts b/apps/app/src/app/types.tsindex 245f8277..698e4f76 100644--- a/apps/app/src/app/types.ts+++ b/apps/app/src/app/types.ts@@ -425,6 +425,8 @@ export type ModelOption = {modelID: string;title: string;description?: string;+ /** Picker group for an omnirush.ai model of another family (e.g. "Meta Muse"); others group by provider. */+ group?: string;footer?: string;behaviorTitle: string;behaviorLabel: string;diff --git a/apps/app/src/app/utils/index.ts b/apps/app/src/app/utils/index.tsindex 864ebcf3..8d3dc22c 100644--- a/apps/app/src/app/utils/index.ts+++ b/apps/app/src/app/utils/index.ts@@ -144,6 +144,16 @@ export function resolveModelProviderDisplayName(return reportedProviderName?.trim() || resolveProviderDisplayName(providerID);}+/**+ * The picker group of an omnirush.ai catalog model outside the provider's own+ * line-up: the engine reports its catalog family (e.g. "Meta Muse"). Astra+ * and Sol carry none and stay under the provider's name.+ */+export function resolveOmniRushModelGroup(providerID: string, family?: string | null): string | undefined {+ if (providerID.trim().toLowerCase() !== "omnirush") return undefined;+ return family?.trim() || undefined;+}+export function resolveModelProviderIconId(providerID: string,_modelID: string,diff --git a/apps/app/src/components/model-select.tsx b/apps/app/src/components/model-select.tsxindex 72540696..3a10de17 100644--- a/apps/app/src/components/model-select.tsx+++ b/apps/app/src/components/model-select.tsx@@ -51,7 +51,12 @@ import {useModelCollectionsStore,} from "@/react-app/domains/session/models/model-collections-store";import { favoriteModelShortcutLabel } from "@/react-app/shell/favorite-model-shortcut";-import { dedupeModelOptions, resolveModelDisplayName, resolveModelProviderDisplayName } from "@/app/utils";+import {+ dedupeModelOptions,+ resolveModelDisplayName,+ resolveModelProviderDisplayName,+ resolveOmniRushModelGroup,+} from "@/app/utils";import { isSupportedModelProvider, providerCatalogRank } from "@/app/lib/provider-catalog";function getProviderDisplayName(providerId: string) {@@ -103,11 +108,13 @@ function useModelOptions(.flatMap((provider) =>Object.entries(provider.models).map(([id, model]) => {const summary = getModelBehaviorSummary(provider.id, model, null, provider.name);+ const group = resolveOmniRushModelGroup(provider.id, model.family);return {providerID: provider.id,modelID: id,title: resolveModelDisplayName(id, model.name),description: resolveModelProviderDisplayName(provider.id, id, provider.name, model.name),+ ...(group ? { group } : {}),behaviorTitle: summary.title,behaviorLabel: summary.label,behaviorDescription: summary.description,@@ -149,7 +156,7 @@ function groupByProvider(modelOptions: ModelOption[]): ModelSelectGroup[] {const groups = new Map<string, ModelSelectItem[]>();for (const option of modelOptions) {- const providerLabel = option.description ?? getProviderDisplayName(option.providerID);+ const providerLabel = option.group ?? option.description ?? getProviderDisplayName(option.providerID);const item: ModelSelectItem = {id: `${option.providerID}:${option.modelID}`,option,@@ -167,7 +174,8 @@ function groupByProvider(modelOptions: ModelOption[]): ModelSelectGroup[] {return [...groups.entries()].map(([providerLabel, options]) => ({value: providerLabel,- rank: Math.min(...options.map(({ option }) => providerCatalogRank(option.providerID))),+ // A family group (Meta Muse) follows its provider's own group.+ rank: Math.min(...options.map(({ option }) => providerCatalogRank(option.providerID) + (option.group ? 0.5 : 0))),items: [...options].sort((a, b) => a.option.title.localeCompare(b.option.title)),})).sort((a, b) => a.rank - b.rank || a.value.localeCompare(b.value));diff --git a/apps/app/src/react-app/domains/session/modals/model-picker-modal.tsx b/apps/app/src/react-app/domains/session/modals/model-picker-modal.tsxindex 7a7bc05f..5c46979d 100644--- a/apps/app/src/react-app/domains/session/modals/model-picker-modal.tsx+++ b/apps/app/src/react-app/domains/session/modals/model-picker-modal.tsx@@ -60,7 +60,9 @@ export type ModelPickerModalProps = {};type ProviderGroup = {+ /** The provider; `key` tells apart an omnirush.ai family group (Meta Muse) from the provider's own. */id: string;+ key: string;iconProviderId: string;name: string;isNew: boolean;@@ -162,28 +164,32 @@ export function ModelPickerModal(props: ModelPickerModalProps) {const providerGroups = useMemo<ProviderGroup[]>(() => {const map = new Map<string, ProviderGroup>();for (const opt of filteredOptions) {- let group = map.get(opt.providerID);+ const key = opt.group ? `${opt.providerID}\u0000${opt.group}` : opt.providerID;+ // A family group follows its provider's own group.+ const accessRank = providerCatalogRank(opt.providerID) + (opt.group ? 0.5 : 0);+ let group = map.get(key);if (!group) {group = {id: opt.providerID,+ key,iconProviderId: opt.providerID,- name: opt.description ?? resolveProviderDisplayName(opt.providerID),+ name: opt.group ?? opt.description ?? resolveProviderDisplayName(opt.providerID),isNew: !!opt.isRecommended,isCloud: opt.source === "cloud",isDisabled: disabledSet.has(opt.providerID),hasCurrent: false,- accessRank: providerCatalogRank(opt.providerID),+ accessRank,recommended: [],other: [],};- map.set(opt.providerID, group);+ map.set(key, group);}if (isRecommendedModel(opt.modelID)) {group.recommended.push(opt);} else {group.other.push(opt);}- group.accessRank = Math.min(group.accessRank, providerCatalogRank(opt.providerID));+ group.accessRank = Math.min(group.accessRank, accessRank);if (modelEquals(props.current, { providerID: opt.providerID, modelID: opt.modelID })) {group.hasCurrent = true;}@@ -206,7 +212,7 @@ export function ModelPickerModal(props: ModelPickerModalProps) {// Auto-expand on searchuseEffect(() => {if (props.query.trim()) {- setExpandedProviders(new Set(providerGroups.map((g) => g.id)));+ setExpandedProviders(new Set(providerGroups.map((g) => g.key)));}}, [props.query, providerGroups]);@@ -223,9 +229,9 @@ export function ModelPickerModal(props: ModelPickerModalProps) {if (!autoExpandedRef.current.has(id) && !toExpand.includes(id)) toExpand.push(id);};const current = providerGroups.find((group) => group.hasCurrent);- if (current) queueExpand(current.id);+ if (current) queueExpand(current.key);for (const group of providerGroups) {- if (group.isCloud) queueExpand(group.id);+ if (group.isCloud) queueExpand(group.key);}if (toExpand.length === 0) return;for (const id of toExpand) autoExpandedRef.current.add(id);@@ -333,12 +339,12 @@ export function ModelPickerModal(props: ModelPickerModalProps) {) : (providerGroups.map((group) => (<ProviderAccordion- key={group.id}+ key={group.key}group={group}- expanded={expandedProviders.has(group.id)}+ expanded={expandedProviders.has(group.key)}current={props.current}- canToggleProvider={!!props.onToggleProvider}- onToggleExpand={() => toggleProvider(group.id)}+ canToggleProvider={!!props.onToggleProvider && group.key === group.id}+ onToggleExpand={() => toggleProvider(group.key)}onToggleProvider={props.onToggleProvider}onSelect={handleSelect}organizationProviderLabel={organizationProviderLabel}diff --git a/apps/app/src/react-app/domains/session/modals/use-model-picker.ts b/apps/app/src/react-app/domains/session/modals/use-model-picker.tsindex f127dcbf..5e850b45 100644--- a/apps/app/src/react-app/domains/session/modals/use-model-picker.ts+++ b/apps/app/src/react-app/domains/session/modals/use-model-picker.ts@@ -21,7 +21,7 @@ import {openModelPickerEvent,pendingModelPickerProviderIdsKey,} from "@/react-app/shell/new-providers-listener";-import { resolveModelDisplayName, resolveModelProviderDisplayName } from "@/app/utils";+import { resolveModelDisplayName, resolveModelProviderDisplayName, resolveOmniRushModelGroup } from "@/app/utils";import { isSupportedModelProvider } from "@/app/lib/provider-catalog";export type UseModelPickerInput = {@@ -136,11 +136,13 @@ export function useModelPicker(input: UseModelPickerInput) {for (const id of modelIds) {const model = provider.models[id];const summary = getModelBehaviorSummary(provider.id, model, null, provider.name);+ const group = resolveOmniRushModelGroup(provider.id, model.family);next.push({providerID: provider.id,modelID: id,title: resolveModelDisplayName(id, model.name),description: resolveModelProviderDisplayName(provider.id, id, provider.name, model.name),+ ...(group ? { group } : {}),behaviorTitle: summary.title,behaviorLabel: summary.label,behaviorDescription: summary.description,diff --git a/apps/app/src/react-app/kernel/model-config.ts b/apps/app/src/react-app/kernel/model-config.tsindex 747e00ec..008421ef 100644--- a/apps/app/src/react-app/kernel/model-config.ts+++ b/apps/app/src/react-app/kernel/model-config.ts@@ -157,8 +157,9 @@ export function readStoredDefaultModel(): ModelRef {const stored = window.localStorage.getItem(MODEL_PREF_KEY);const parsed = parseModelRef(stored);// Public OmniRush releases previously persisted a retired managed model.- // Keep external provider choices and every current omnirush.ai model, but- // migrate retired built-in routes to the default model.+ // Keep external provider choices and every omnirush.ai catalog model+ // (the catalog is the server's, not a list compiled in here), but migrate+ // retired routes to the default model.if (parsed?.providerID === "omnirush" && !isOmniRushModelID(parsed.modelID)) {writeStoredDefaultModel(DEFAULT_MODEL);return DEFAULT_MODEL;diff --git a/apps/app/tests/model-behavior.test.ts b/apps/app/tests/model-behavior.test.tsindex 0f842603..795eebcc 100644--- a/apps/app/tests/model-behavior.test.ts+++ b/apps/app/tests/model-behavior.test.ts@@ -1,7 +1,8 @@-import { describe, expect, test } from "bun:test";+import { afterEach, describe, expect, test } from "bun:test";import type { ProviderListItem } from "../src/app/types";-import { OMNIRUSH_REASONING_EFFORTS } from "../src/app/constants";+import { DEFAULT_MODEL, MODEL_PREF_KEY, OMNIRUSH_REASONING_EFFORTS } from "../src/app/constants";+import { readStoredDefaultModel } from "../src/react-app/kernel/model-config";import {getModelBehaviorOptions,getModelBehaviorSummary,@@ -13,6 +14,7 @@ import {resolveModelDisplayName,resolveModelProviderDisplayName,resolveModelProviderIconId,+ resolveOmniRushModelGroup,} from "../src/app/utils";import {isDirectModelProvider,@@ -119,29 +121,50 @@ describe("model behavior options", () => {}});- test("hides the effort levels the engine adds on its own to omnirush.ai models", () => {- expect([...OMNIRUSH_REASONING_EFFORTS]).toEqual(["low", "high", "xhigh", "max"]);+ test("offers each omnirush.ai model exactly the efforts the engine reports for it", () => {+ expect([...OMNIRUSH_REASONING_EFFORTS]).toEqual(["none", "minimal", "low", "medium", "high", "xhigh", "max"]);+ // The server declares every other effort disabled per model, so the+ // engine reports only the catalog's levels; anything outside the known+ // set (an engine default such as "ultra") still stays off the picker.+ const museSpark: ProviderModel = {+ ...omnirushModel("meta-muse-spark", "Meta Muse Spark"),+ family: "Meta Muse",+ variants: {+ minimal: { reasoning_effort: "minimal" },+ low: { reasoning_effort: "low" },+ medium: { reasoning_effort: "medium", reasoningEffort: "medium", reasoningSummary: "auto" },+ high: { reasoning_effort: "high" },+ xhigh: { reasoning_effort: "xhigh" },+ ultra: { reasoningEffort: "ultra" },+ },+ };+ const options = getModelBehaviorOptions("omnirush", museSpark, "omnirush.ai");+ expect(options.map((option) => option.value)).toEqual(["minimal", "low", "medium", "high", "xhigh"]);+ expect(getModelBehaviorSummary("omnirush", museSpark, null, "omnirush.ai").value).toBe("medium");+ expect(getModelBehaviorSummary("omnirush", museSpark, "xhigh", "omnirush.ai").value).toBe("xhigh");+ // An effort Muse does not offer (Astra's max) falls back to its default.+ expect(getModelBehaviorSummary("omnirush", museSpark, "max", "omnirush.ai").value).toBe("medium");+ expect(getModelBehaviorSummary("omnirush", museSpark, "ultra", "omnirush.ai").value).toBe("medium");++ // Astra and Sol keep their v1.0.9 levels and default.for (const internal of OMNIRUSH_MODELS) {- // What GET /config/providers reports once the engine has merged its- // OpenAI reasoning defaults into the configured variants.- const reported: ProviderModel = {- ...internal,- variants: {- ...internal.variants,- none: { reasoningEffort: "none", reasoningSummary: "auto" },- minimal: { reasoningEffort: "minimal" },- medium: { reasoningEffort: "medium", reasoningSummary: "auto" },- max: { reasoningEffort: "max" },- },- };- const options = getModelBehaviorOptions("omnirush", reported, "omnirush.ai");- expect(options.map((option) => option.value)).toEqual(["low", "high", "xhigh", "max"]);- expect(getModelBehaviorSummary("omnirush", reported, null, "omnirush.ai").value).toBe("high");- expect(getModelBehaviorSummary("omnirush", reported, "medium", "omnirush.ai").value).toBe("high");- expect(getModelBehaviorSummary("omnirush", reported, "max", "omnirush.ai").value).toBe("max");+ expect(getModelBehaviorOptions("omnirush", internal, "omnirush.ai").map((option) => option.value)).toEqual(["low", "high", "xhigh", "max"]);+ expect(getModelBehaviorSummary("omnirush", internal, null, "omnirush.ai").value).toBe("high");+ expect(getModelBehaviorSummary("omnirush", internal, "medium", "omnirush.ai").value).toBe("high");}});+ test("groups Meta Muse under its own family and keeps Astra and Sol under the provider", () => {+ expect(resolveOmniRushModelGroup("omnirush", "Meta Muse")).toBe("Meta Muse");+ expect(resolveOmniRushModelGroup("omnirush", undefined)).toBeUndefined();+ expect(resolveOmniRushModelGroup("omnirush", " ")).toBeUndefined();+ // Only the omnirush.ai catalog's families group; other providers keep theirs.+ expect(resolveOmniRushModelGroup("openai", "gpt")).toBeUndefined();+ expect(resolveModelDisplayName("meta-muse-spark", "Meta Muse Spark")).toBe("Meta Muse Spark");+ expect(resolveModelDisplayName("muse-spark-1.3", "Meta Muse Spark 1.3")).toBe("Meta Muse Spark 1.3");+ expect(resolveModelProviderDisplayName("omnirush", "muse-spark-1.3", "omnirush.ai")).toBe("omnirush.ai");+ });+test("shows both omnirush.ai models under the omnirush.ai provider with their display names", () => {expect(OMNIRUSH_MODELS.map((internal) => resolveModelDisplayName(internal.id, internal.name))).toEqual(["GPT 6 Astra", "GPT-5.6 Sol"]);@@ -226,3 +249,39 @@ describe("model behavior options", () => {expect(previousModelBehaviorValue([{ value: "high" }], "high")).toBeNull();});});++describe("stored default model", () => {+ const originalWindow = Object.getOwnPropertyDescriptor(globalThis, "window");+ afterEach(() => {+ if (originalWindow) Object.defineProperty(globalThis, "window", originalWindow);+ else Reflect.deleteProperty(globalThis, "window");+ });++ function storeDefault(value: string): Map<string, string> {+ const items = new Map([[MODEL_PREF_KEY, value]]);+ Object.defineProperty(globalThis, "window", {+ configurable: true,+ value: {+ localStorage: {+ getItem: (key: string) => items.get(key) ?? null,+ setItem: (key: string, next: string) => { items.set(key, next); },+ },+ dispatchEvent: () => true,+ },+ });+ return items;+ }++ test("keeps a Meta Muse default instead of resetting it to Astra", () => {+ const items = storeDefault("omnirush/meta-muse-spark");+ expect(readStoredDefaultModel()).toEqual({ providerID: "omnirush", modelID: "meta-muse-spark" });+ expect(items.get(MODEL_PREF_KEY)).toBe("omnirush/meta-muse-spark");+ });++ test("still moves a retired omnirush.ai route to the default, Astra", () => {+ const items = storeDefault("omnirush/z-ai/glm-5.2");+ expect(readStoredDefaultModel()).toEqual(DEFAULT_MODEL);+ expect(DEFAULT_MODEL).toEqual({ providerID: "omnirush", modelID: "gpt-6-astra" });+ expect(items.get(MODEL_PREF_KEY)).toBe("omnirush/gpt-6-astra");+ });+});