A desktop coding agent with free access to frontier models.
TypeScript
feat: finish account-aware Astra desktop
Samrat Talukdarf35f7ee2f1dc
diff --git a/apps/app/src/app/constants.test.ts b/apps/app/src/app/constants.test.tsindex 36dcb20c..bceda495 100644--- a/apps/app/src/app/constants.test.ts+++ b/apps/app/src/app/constants.test.ts@@ -5,6 +5,7 @@ declare const expect: (value: unknown) => {};import {+ DEFAULT_MODEL,OMNIRUSH_EXTENSION_CATALOG,filterOmniRushExtensionCatalogForPlatform,resolveOmniRushExtensionCatalogPlatform,@@ -16,6 +17,10 @@ function filteredIds(platform: "darwin" | "linux" | "windows" | "web") {}describe("OmniRush.ai extension catalog platform filter", () => {+ test("defaults new conversations to the internal Astra route", () => {+ expect(DEFAULT_MODEL).toEqual({ providerID: "omnirush", modelID: "gpt-6-astra" });+ });+test("resolves browser runtime to web and desktop runtime to OS", () => {expect(resolveOmniRushExtensionCatalogPlatform("web", "macos")).toEqual("web");expect(resolveOmniRushExtensionCatalogPlatform("desktop", "macos")).toEqual("darwin");diff --git a/apps/app/src/app/constants.ts b/apps/app/src/app/constants.tsindex e014f445..2c6ab8db 100644--- a/apps/app/src/app/constants.ts+++ b/apps/app/src/app/constants.ts@@ -20,7 +20,7 @@ export const HIDE_TITLEBAR_PREF_KEY = "omnirush.hideTitlebar";export const DEFAULT_MODEL: ModelRef = {providerID: "omnirush",- modelID: "z-ai/glm-5.2",+ modelID: "gpt-6-astra",};export const SUGGESTED_PLUGINS: SuggestedPlugin[] = [];diff --git a/apps/app/src/app/utils/index.ts b/apps/app/src/app/utils/index.tsindex dbd95e32..2e042140 100644--- a/apps/app/src/app/utils/index.ts+++ b/apps/app/src/app/utils/index.ts@@ -35,6 +35,7 @@ export function modelEquals(a: ModelRef, b: ModelRef) {* Used when the backend doesn't return a provider name.*/export const FRIENDLY_PROVIDER_LABELS: Record<string, string> = {+ omnirush: "omnirush.ai",opencode: "OpenCode",openai: "OpenAI",anthropic: "Anthropic",@@ -57,6 +58,7 @@ export const FRIENDLY_PROVIDER_LABELS: Record<string, string> = {*/export const FRIENDLY_MODEL_LABELS: [pattern: string, label: string][] = [// OpenAI. Keep display names faithful to the provider and runtime model.+ ["gpt-6-astra", "GPT 6 Astra"],["gpt-5.6-sol", "GPT-5.6 Sol"],["gpt-5.6-terra", "GPT-5.6 Terra"],["gpt-5.5", "GPT-5.5"],diff --git a/apps/app/src/components/model-select.tsx b/apps/app/src/components/model-select.tsxindex 5a2c538e..2b863c51 100644--- a/apps/app/src/components/model-select.tsx+++ b/apps/app/src/components/model-select.tsx@@ -118,11 +118,16 @@ function useModelOptions(}),);- return filterEntitledModelOptions(filterCloudManagedModelOptions(- mergeModelOptions(options, fallbackOptions).filter((option) =>- isSupportedModelProvider(option.providerID)),- cloudProvidersEnabled,- ), {+ const mergedOptions = mergeModelOptions(options, fallbackOptions).filter((option) =>+ isSupportedModelProvider(option.providerID));+ const visibleOptions = cloudProvidersEnabled+ ? mergedOptions+ : mergeModelOptions(+ options.filter((option) => option.providerID.trim().toLowerCase() === "omnirush"),+ filterCloudManagedModelOptions(mergedOptions, false),+ );++ return filterEntitledModelOptions(visibleOptions, {restrictToCloud,checkRestriction: checkDesktopRestriction,});@@ -302,6 +307,17 @@ export function ModelSelect({modelID: option.modelID,}),);+ const selectedModelTitle = selectedOption?.title ?? resolveModelDisplayName(value.modelID);+ const selectedProviderTitle = selectedOption?.description+ ?? resolveModelProviderDisplayName(value.providerID, value.modelID);+ // The first-party desktop route is authenticated by the native OmniRush+ // account, not the separate Den/cloud session. Never hide a valid local+ // OmniRush selection merely because the latter is signed out.+ const selectedValueHidden = hideValue || (+ !denAuth.isSignedIn+ && isCloudManagedProviderKey(value.providerID)+ && value.providerID.trim().toLowerCase() !== "omnirush"+ );const optionsByKey = React.useMemo(() => new Map(modelOptions.map((option) => [modelRefKey(option), option])),@@ -435,10 +451,13 @@ export function ModelSelect({><span className="flex min-w-0 max-w-56 items-center gap-1.5"><span className="truncate">- {hideValue || (!denAuth.isSignedIn && isCloudManagedProviderKey(value.providerID))+ {selectedValueHidden || !value.modelID? "Select model"- : (selectedOption?.title ?? value.modelID ?? "Select model")}+ : selectedModelTitle}</span>+ {!selectedValueHidden && value.modelID && selectedProviderTitle ? (+ <span className="hidden shrink-0 text-xs text-gray-9 sm:inline">· {selectedProviderTitle}</span>+ ) : null}{showBehavior ? (<span className="shrink-0 text-gray-9">· {effectiveBehaviorLabel}</span>) : null}diff --git a/apps/app/src/react-app/domains/cloud/brand-theme.tsx b/apps/app/src/react-app/domains/cloud/brand-theme.tsxindex a3211e7d..b162750d 100644--- a/apps/app/src/react-app/domains/cloud/brand-theme.tsx+++ b/apps/app/src/react-app/domains/cloud/brand-theme.tsx@@ -86,7 +86,7 @@ export function useBrandLogoUrl(): string | undefined {/** Organization-managed display name. It does not change the signed app identity. */export function useBrandAppName(): string {- return useOrgRestrictions().brandAppName ?? "OmniRush.ai";+ return useOrgRestrictions().brandAppName ?? "omnirush.ai";}const POLICY_NOTIFICATION_DEDUPE = "desktop-policy-active";diff --git a/apps/app/src/react-app/domains/session/chat/new-task-composer.tsx b/apps/app/src/react-app/domains/session/chat/new-task-composer.tsxindex 9729e1c2..bddf7558 100644--- a/apps/app/src/react-app/domains/session/chat/new-task-composer.tsx+++ b/apps/app/src/react-app/domains/session/chat/new-task-composer.tsx@@ -8,6 +8,7 @@ import type { OmniRushServerClient } from "@/app/lib/omnirush-server";import type { ComposerAttachment, McpServerEntry, McpStatusMap, ModelOption, ModelRef, SkillCard, SlashCommandOption } from "@/app/types";import { t } from "@/i18n";import type { ComposerSettingsSection } from "@/react-app/domains/settings/library";+import { DEFAULT_MODEL } from "@/app/constants";import { ReactSessionComposer } from "@/react-app/domains/session/surface/composer/composer";import { WorkspaceRunModeMenu } from "@/react-app/domains/session/surface/composer/workspace-run-mode-menu";import {@@ -104,7 +105,7 @@ const noop = () => {};const emptyAgents = async (): Promise<Agent[]> => [];const emptyCommands = async (): Promise<SlashCommandOption[]> => [];const emptyFiles = async (): Promise<string[]> => [];-const FALLBACK_MODEL: ModelRef = { providerID: "", modelID: "" };+const FALLBACK_MODEL: ModelRef = DEFAULT_MODEL;/*** The real session composer, reused for the "What do you need done?" emptydiff --git a/apps/app/src/react-app/domains/session/chat/session-page.tsx b/apps/app/src/react-app/domains/session/chat/session-page.tsxindex 0a948e58..ed63e544 100644--- a/apps/app/src/react-app/domains/session/chat/session-page.tsx+++ b/apps/app/src/react-app/domains/session/chat/session-page.tsx@@ -299,7 +299,7 @@ function workspaceTitleForId(groups: WorkspaceSessionGroup[], workspaceId: strin|| workspace?.name?.trim()|| workspace?.path?.trim()|| workspaceId;- return title === "OmniRush.ai Chat" ? "OmniRush.ai Chat" : title;+ return /^(?:OmniRush\.ai Chat|omnirush\.ai)$/i.test(title) ? "omnirush.ai" : title;}function WorkbenchPaneHeader(props: {@@ -932,7 +932,9 @@ export function SessionPage(props: SessionPageProps) {props.selectedWorkspaceDisplay.displayName?.trim() ||props.selectedWorkspaceDisplay.name?.trim() ||t("session.workspace_fallback");- const workspaceName = workspaceNameRaw === "OmniRush.ai Chat" ? "OmniRush.ai Chat" : workspaceNameRaw;+ const workspaceName = /^(?:OmniRush\.ai Chat|omnirush\.ai)$/i.test(workspaceNameRaw)+ ? "omnirush.ai"+ : workspaceNameRaw;useEffect(() => {if (pendingConversationHistoryNavigation) {if (diff --git a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsxindex ef1a5b86..bd51e1dd 100644--- a/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx+++ b/apps/app/src/react-app/domains/session/sidebar/app-sidebar.tsx@@ -29,13 +29,15 @@ import {FolderOpen,SquarePen,Tag,+ UserRound,X,Workflow,} from "lucide-react";import { LazyMotion, Reorder, domMax, m, useDragControls } from "motion/react";import { getDisplaySessionTitle } from "../../../../app/lib/session-title";-import type { WorkspaceInfo } from "../../../../app/lib/desktop";+import { omnirushAccountStatus, type WorkspaceInfo } from "../../../../app/lib/desktop";+import { isDesktopRuntime } from "../../../../app/lib/runtime-env";import { OmniRushDenHelpLink } from "../../workspace/omnirush-den-help-link";import { NotificationBell } from "../../../shell/notification-center";import { useUiStateStore } from "../../../shell/ui-state-store";@@ -955,6 +957,107 @@ export type AppSidebarProps = {status: Omit<AccountStatusMenuProps, "onOpenAccountSettings">;};+type NativeAccountStatus = Awaited<ReturnType<typeof omnirushAccountStatus>>;++function OmniRushWordmark({ className }: { className?: string }) {+ return (+ <span className={className} aria-label="omnirush.ai">+ <span>omnirush</span><span className="text-[#b9f45a]">.ai</span>+ </span>+ );+}++function compactTokenCount(value: number): string {+ return new Intl.NumberFormat(undefined, {+ notation: "compact",+ maximumFractionDigits: 1,+ }).format(Math.max(0, value));+}++function NativeAccountFooter({ onOpenAccountSettings }: { onOpenAccountSettings: () => void }) {+ const [status, setStatus] = React.useState<NativeAccountStatus | null>(null);++ React.useEffect(() => {+ let active = true;+ const refresh = () => {+ void omnirushAccountStatus()+ .then((next) => { if (active) setStatus(next); })+ .catch(() => { if (active) setStatus({ connected: false, gatewayConfigured: false }); });+ };+ refresh();+ window.addEventListener("focus", refresh);+ return () => {+ active = false;+ window.removeEventListener("focus", refresh);+ };+ }, []);++ const connected = status?.connected === true;+ const accountLabel = connected+ ? status?.displayName?.trim() || status?.email?.trim() || "Your account"+ : "sign in to omnirush.ai";+ const usage = connected ? status?.usage : null;+ const usagePercent = usage && usage.tokenLimit > 0+ ? Math.min(100, Math.max(0, (usage.usedTokens / usage.tokenLimit) * 100))+ : 0;+ const accountDetail = usage+ ? `${compactTokenCount(usage.remainingTokens)} tokens left today`+ : connected+ ? "Astra ready"+ : status?.reauthorizationRequired+ ? "Sign in again to continue"+ : "Use Astra with your account";++ return (+ <SidebarFooter className="border-t border-sidebar-border/60 p-1.5 pe-0">+ <SidebarMenu>+ <SidebarMenuItem>+ <SidebarMenuButton+ type="button"+ className="h-auto min-h-12 py-1.5"+ onClick={onOpenAccountSettings}+ tooltip={connected ? accountLabel : "Sign in to omnirush.ai"}+ aria-label={connected ? `${accountLabel} account` : "Sign in to omnirush.ai"}+ data-testid="native-account-profile"+ >+ <span className="relative flex size-6 shrink-0 items-center justify-center rounded-full border border-sidebar-border bg-sidebar-accent">+ <UserRound className="size-3.5" />+ <span+ className={cn(+ "absolute -bottom-0.5 -right-0.5 size-2 rounded-full border border-sidebar",+ connected ? "bg-[#b9f45a]" : "bg-muted-foreground/50",+ )}+ />+ </span>+ <span className="min-w-0 flex-1 text-left">+ <span className="block truncate text-xs font-medium">{accountLabel}</span>+ <span className="block truncate text-[10.5px] text-muted-foreground">+ {accountDetail}+ </span>+ {usage ? (+ <span className="mt-1 block h-0.5 overflow-hidden rounded-full bg-sidebar-border" aria-hidden="true">+ <span className="block h-full rounded-full bg-[#b9f45a]" style={{ width: `${usagePercent}%` }} />+ </span>+ ) : null}+ </span>+ </SidebarMenuButton>+ </SidebarMenuItem>+ <SidebarMenuItem>+ <SidebarMenuButton+ type="button"+ onClick={onOpenAccountSettings}+ tooltip="Settings"+ aria-label="Settings"+ >+ <Settings className="size-4" />+ <span>Settings</span>+ </SidebarMenuButton>+ </SidebarMenuItem>+ </SidebarMenu>+ </SidebarFooter>+ );+}+function isSessionActivityStatus(status: string | undefined): status is SessionActivityStatus {return status === "idle" || status === "thinking" || status === "responding" || status === "error" || status === "compacting" || status === "waiting";}@@ -1137,7 +1240,11 @@ export function AppSidebar(props: AppSidebarProps) {) : (<div data-sidebar-brand className="flex h-11 shrink-0 items-center gap-2 px-4 mac:titlebar-drag"><img src={resolveExtensionIconSrc("/omnirush-mark.png")} alt="" className="size-5 shrink-0 object-contain dark:invert" />- <span className="truncate text-[15px] font-medium tracking-[-0.4px]" title={brandAppName}>{brandAppName}</span>+ {brandAppName.toLowerCase() === "omnirush.ai" ? (+ <OmniRushWordmark className="truncate text-[15px] font-medium tracking-[-0.4px]" />+ ) : (+ <span className="truncate text-[15px] font-medium tracking-[-0.4px]" title={brandAppName}>{brandAppName}</span>+ )}</div>)}{props.conversationHistory ? (@@ -1345,21 +1452,11 @@ export function AppSidebar(props: AppSidebarProps) {<SidebarFooter className="border-t border-sidebar-border/60 p-1.5 pe-0"><AccountStatusMenu {...props.status} onOpenAccountSettings={props.onOpenAccountSettings} /></SidebarFooter>+ ) : props.onOpenAccountSettings && isDesktopRuntime() ? (+ <NativeAccountFooter onOpenAccountSettings={props.onOpenAccountSettings} />) : props.onOpenAccountSettings ? (<SidebarFooter className="border-t border-sidebar-border/60 p-1.5 pe-0">- <SidebarMenu>- <SidebarMenuItem>- <SidebarMenuButton- type="button"- onClick={props.onOpenAccountSettings}- tooltip="Settings"- aria-label="Settings"- >- <Settings className="size-4" />- <span>Settings</span>- </SidebarMenuButton>- </SidebarMenuItem>- </SidebarMenu>+ <SidebarMenu><SidebarMenuItem><SidebarMenuButton type="button" onClick={props.onOpenAccountSettings} tooltip="Settings" aria-label="Settings"><Settings className="size-4" /><span>Settings</span></SidebarMenuButton></SidebarMenuItem></SidebarMenu></SidebarFooter>) : null}diff --git a/apps/app/src/react-app/domains/session/sidebar/utils.ts b/apps/app/src/react-app/domains/session/sidebar/utils.tsindex 5cb90687..d50cd886 100644--- a/apps/app/src/react-app/domains/session/sidebar/utils.ts+++ b/apps/app/src/react-app/domains/session/sidebar/utils.ts@@ -156,7 +156,7 @@ export const workspaceLabel = (workspace: WorkspaceInfo) => {workspace.name?.trim() ||workspace.path?.trim() ||t("workspace_list.workspace_fallback");- return label === "OmniRush.ai Chat" ? "OmniRush.ai Chat" : label;+ return /^(?:OmniRush\.ai Chat|omnirush\.ai)$/i.test(label) ? "omnirush.ai" : label;};export const workspaceKindLabel = (workspace: WorkspaceInfo) =>diff --git a/apps/app/src/react-app/domains/settings/pages/general-view.tsx b/apps/app/src/react-app/domains/settings/pages/general-view.tsxindex 1091daac..27a8da95 100644--- a/apps/app/src/react-app/domains/settings/pages/general-view.tsx+++ b/apps/app/src/react-app/domains/settings/pages/general-view.tsx@@ -26,6 +26,8 @@ export type GeneralSettingsViewProps = {developerMode: boolean;};+type NativeAccountStatus = Awaited<ReturnType<typeof omnirushAccountStatus>>;+type SettingsCardDefinition = { tab: SettingsTab; icon: typeof Sparkles } & (| { title: string; desc: string }| { titleKey: string; descKey: string }@@ -76,8 +78,15 @@ function SettingsCard(props: {);}+function compactTokenCount(value: number): string {+ return new Intl.NumberFormat(undefined, {+ notation: "compact",+ maximumFractionDigits: 1,+ }).format(Math.max(0, value));+}+export function GeneralSettingsView(props: GeneralSettingsViewProps) {- const [account, setAccount] = useState<{ connected: boolean; gatewayConfigured: boolean } | null>(null);+ const [account, setAccount] = useState<NativeAccountStatus | null>(null);const [accountBusy, setAccountBusy] = useState(false);const [accountMessage, setAccountMessage] = useState("");@@ -92,7 +101,7 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {try {await omnirushAccountConnect();setAccount(await omnirushAccountStatus());- setAccountMessage("Account connected. Astra routing is ready.");+ setAccountMessage("Account connected. Astra is ready.");} catch (error) {setAccountMessage(error instanceof Error ? error.message : "The account could not be connected.");} finally {@@ -116,7 +125,7 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {{isElectronRuntime() && account && (<div className="space-y-3"><div className="text-[11px] font-semibold uppercase tracking-[0.15em] text-dls-secondary">- OmniRush account+ Account</div><div className="flex items-center gap-4 rounded-2xl border border-dls-border bg-dls-surface p-4"><div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-xl border border-dls-border bg-dls-hover">@@ -124,15 +133,30 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {</div><div className="min-w-0 flex-1"><div className="text-[13px] font-medium text-dls-text">- {account.connected ? "Connected" : "Connect your account"}+ {account.connected ? account.displayName || account.email || "Connected" : "Sign in to your account"}</div>- <div className="text-[11px] text-dls-secondary">+ {account.connected && account.email ? (+ <div className="truncate text-[11px] text-dls-secondary">{account.email}</div>+ ) : null}+ <div className="mt-0.5 text-[11px] text-dls-secondary">{accountMessage || (account.connected- ? "Secure model access and usage are linked to this Mac."+ ? account.usage+ ? `${compactTokenCount(account.usage.remainingTokens)} of ${compactTokenCount(account.usage.tokenLimit)} tokens left today`+ : "Astra is ready on this Mac.": account.gatewayConfigured- ? "Sign in in your browser, then return here."- : "The OmniRush account service has not been configured for this build.")}+ ? account.reauthorizationRequired+ ? "Your session expired. Sign in again to continue."+ : "Sign in in your browser, then return here."+ : "The omnirush.ai account service has not been configured for this build.")}</div>+ {account.connected && account.usage?.tokenLimit ? (+ <div className="mt-2 h-1.5 overflow-hidden rounded-full bg-dls-hover" aria-label={`${account.usage.usedTokens} tokens used today`}>+ <div+ className="h-full rounded-full bg-[#b9f45a]"+ style={{ width: `${Math.min(100, Math.max(0, (account.usage.usedTokens / account.usage.tokenLimit) * 100))}%` }}+ />+ </div>+ ) : null}</div>{account.connected ? (<button type="button" disabled={accountBusy} onClick={() => void signOutAccount()} className="rounded-lg border border-dls-border px-3 py-2 text-[12px] text-dls-secondary hover:bg-dls-hover disabled:opacity-50">@@ -140,7 +164,7 @@ export function GeneralSettingsView(props: GeneralSettingsViewProps) {</button>) : (<button type="button" disabled={accountBusy || !account.gatewayConfigured} onClick={() => void connectAccount()} className="rounded-lg bg-dls-text px-3 py-2 text-[12px] font-medium text-dls-bg disabled:opacity-50">- {accountBusy ? "Waiting…" : "Connect"}+ {accountBusy ? "Waiting…" : "Sign in"}</button>)}</div>diff --git a/apps/app/src/react-app/kernel/model-config.ts b/apps/app/src/react-app/kernel/model-config.tsindex 9cc70742..a00a56d1 100644--- a/apps/app/src/react-app/kernel/model-config.ts+++ b/apps/app/src/react-app/kernel/model-config.ts@@ -155,6 +155,12 @@ export function readStoredDefaultModel(): ModelRef {try {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, but migrate the built-in route to Astra.+ if (parsed?.providerID === "omnirush" && parsed.modelID !== DEFAULT_MODEL.modelID) {+ writeStoredDefaultModel(DEFAULT_MODEL);+ return DEFAULT_MODEL;+ }return parsed && isSupportedModelProvider(parsed.providerID) ? parsed : DEFAULT_MODEL;} catch {return DEFAULT_MODEL;diff --git a/apps/app/src/react-app/shell/route-workspaces.ts b/apps/app/src/react-app/shell/route-workspaces.tsindex ce2bfeed..9755e605 100644--- a/apps/app/src/react-app/shell/route-workspaces.ts+++ b/apps/app/src/react-app/shell/route-workspaces.ts@@ -116,7 +116,7 @@ export function workspaceLabel(workspace: OmniRushWorkspaceInfo) {workspace.path?.trim() ||t("session.workspace_fallback"));- return label === "OmniRush.ai Chat" ? "OmniRush.ai Chat" : label;+ return /^(?:OmniRush\.ai Chat|omnirush\.ai)$/i.test(label) ? "omnirush.ai" : label;}export function workspaceExportFilename(workspace: OmniRushWorkspaceInfo) {diff --git a/apps/app/src/react-app/shell/session-route.tsx b/apps/app/src/react-app/shell/session-route.tsxindex 0c346f2d..390d326b 100644--- a/apps/app/src/react-app/shell/session-route.tsx+++ b/apps/app/src/react-app/shell/session-route.tsx@@ -3152,7 +3152,7 @@ export function SessionRoute() {handleOpenCreateWorkspace();throw new Error("Choose a workspace before sending this message.");}- const folder = await joinDesktopPath(home, "OmniRush.ai Chat").catch(() => "");+ const folder = await joinDesktopPath(home, "omnirush.ai").catch(() => "");if (!folder) {handleOpenCreateWorkspace();throw new Error("Choose a workspace before sending this message.");diff --git a/apps/app/src/react-app/shell/shell-config.tsx b/apps/app/src/react-app/shell/shell-config.tsxindex 5b63ad08..20162b8c 100644--- a/apps/app/src/react-app/shell/shell-config.tsx+++ b/apps/app/src/react-app/shell/shell-config.tsx@@ -39,7 +39,7 @@ export type ShellConfig = {/* ------------------------------------------------------------------ */export const DEFAULT_SHELL_CONFIG: ShellConfig = {- appName: "OmniRush.ai",+ appName: "omnirush.ai",statusBar: true,sidebar: true,docsButton: true,diff --git a/apps/app/tests/composer-model-controls.test.ts b/apps/app/tests/composer-model-controls.test.tsindex 3c405fa4..6e173006 100644--- a/apps/app/tests/composer-model-controls.test.ts+++ b/apps/app/tests/composer-model-controls.test.ts@@ -36,6 +36,9 @@ describe("composer model controls", () => {expect(modelSelectSource).not.toContain("setThinkingOpen(true)");expect(modelSelectSource).toContain('data-slot="model-thinking-submenu"');expect(modelSelectSource).not.toContain("onMouseEnter");+ expect(modelSelectSource).toContain('value.providerID.trim().toLowerCase() !== "omnirush"');+ expect(modelSelectSource).toContain("selectedModelTitle");+ expect(modelSelectSource).toContain("selectedProviderTitle");});test("tracks steering until the active run stops streaming", () => {diff --git a/apps/app/tests/model-behavior.test.ts b/apps/app/tests/model-behavior.test.tsindex 656d6064..c2a364c9 100644--- a/apps/app/tests/model-behavior.test.ts+++ b/apps/app/tests/model-behavior.test.ts@@ -89,6 +89,8 @@ describe("model behavior options", () => {});test("keeps model and provider identities truthful", () => {+ expect(resolveModelDisplayName("gpt-6-astra", "GPT-6 Astra")).toBe("GPT 6 Astra");+ expect(resolveModelProviderDisplayName("omnirush", "gpt-6-astra")).toBe("omnirush.ai");expect(resolveModelDisplayName("gpt-5.6-sol", "GPT-5.6 Sol")).toBe("GPT-5.6 Sol");expect(resolveModelDisplayName("gpt-5.6-terra", "GPT-5.6 Terra")).toBe("GPT-5.6 Terra");expect(resolveModelDisplayName("claude-sonnet-4", "Claude Sonnet 4")).toBe("Claude Sonnet 4");diff --git a/apps/desktop/electron/desktop-distribution.mjs b/apps/desktop/electron/desktop-distribution.mjsindex e82e38b2..79499b78 100644--- a/apps/desktop/electron/desktop-distribution.mjs+++ b/apps/desktop/electron/desktop-distribution.mjs@@ -1,6 +1,6 @@export const PUBLIC_DESKTOP_DISTRIBUTION = Object.freeze({flavor: "public",- appName: "OmniRush.ai",+ appName: "omnirush.ai",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: false,@@ -9,7 +9,7 @@ export const PUBLIC_DESKTOP_DISTRIBUTION = Object.freeze({export const CLOUD_DESKTOP_DISTRIBUTION = Object.freeze({flavor: "cloud",- appName: "OmniRush.ai Cloud",+ appName: "omnirush.ai Cloud",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: true,@@ -18,7 +18,7 @@ export const CLOUD_DESKTOP_DISTRIBUTION = Object.freeze({export const ENTERPRISE_DESKTOP_DISTRIBUTION = Object.freeze({flavor: "enterprise",- appName: "OmniRush.ai Enterprise",+ appName: "omnirush.ai Enterprise",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: true,diff --git a/apps/desktop/electron/desktop-distribution.test.mjs b/apps/desktop/electron/desktop-distribution.test.mjsindex f9088590..68620945 100644--- a/apps/desktop/electron/desktop-distribution.test.mjs+++ b/apps/desktop/electron/desktop-distribution.test.mjs@@ -15,7 +15,7 @@ describe("resolveDesktopDistribution", () => {it("brands the local public desktop build as OmniRush.ai", () => {assert.deepEqual(PUBLIC_DESKTOP_DISTRIBUTION, {flavor: "public",- appName: "OmniRush.ai",+ appName: "omnirush.ai",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: false,@@ -32,7 +32,7 @@ describe("resolveDesktopDistribution", () => {}),{flavor: "cloud",- appName: "OmniRush.ai Cloud",+ appName: "omnirush.ai Cloud",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: true,@@ -50,7 +50,7 @@ describe("resolveDesktopDistribution", () => {assert.deepEqual(distribution, {flavor: "enterprise",- appName: "OmniRush.ai Enterprise",+ appName: "omnirush.ai Enterprise",appIdentifier: "ai.omnirush.desktop",protocolScheme: "omnirush",requireSignin: true,diff --git a/apps/desktop/electron/omnirush-account.mjs b/apps/desktop/electron/omnirush-account.mjsindex 8c032126..d3451823 100644--- a/apps/desktop/electron/omnirush-account.mjs+++ b/apps/desktop/electron/omnirush-account.mjs@@ -38,6 +38,48 @@ function validCredentials(value) {return { gatewayUrl, accessToken, refreshToken };}+function controlPlaneBase(gatewayUrl) {+ const base = new URL(gatewayUrl);+ base.pathname = base.pathname.replace(/\/+$/, "").replace(/\/v1$/, "");+ return base;+}++function displayNameFromEmail(email) {+ const localPart = String(email).split("@", 1)[0] ?? "";+ const withoutCommonPrefix = localPart.replace(/^i[._-]?am(?=[a-z])/i, "");+ const words = withoutCommonPrefix+ .replace(/\d+$/, "")+ .replace(/[._-]+/g, " ")+ .trim()+ .split(/\s+/)+ .filter(Boolean);+ if (!words.length) return null;+ return words+ .map((word) => `${word.charAt(0).toUpperCase()}${word.slice(1).toLowerCase()}`)+ .join(" ");+}++function accountProfile(value) {+ if (!value || typeof value !== "object") return null;+ const email = normalizeCredential(value.email);+ if (!email) return null;+ const usage = value.usage && typeof value.usage === "object"+ ? {+ tokenLimit: Number(value.usage.token_limit) || 0,+ usedTokens: Number(value.usage.used_tokens) || 0,+ remainingTokens: Number(value.usage.remaining_tokens) || 0,+ }+ : null;+ return {+ email,+ displayName: normalizeCredential(value.display_name) ?? displayNameFromEmail(email),+ status: normalizeCredential(value.status),+ usage,+ };+}++class InvalidAccountCredentialsError extends Error {}+async function readMacKeychain(service, platform) {if (platform !== "darwin") return null;try {@@ -131,12 +173,51 @@ export function createDesktopOmniRushAccountStore({?? (env.OMNIRUSH_DEV_MODE === "1" ? DEV_GATEWAY_URL : DEFAULT_GATEWAY_URL);}+ async function refresh(credentials) {+ const refreshUrl = controlPlaneBase(credentials.gatewayUrl);+ refreshUrl.pathname += "/device/refresh";+ const response = await fetchImpl(refreshUrl, {+ method: "POST",+ headers: { "Content-Type": "application/json" },+ body: JSON.stringify({ refresh_token: credentials.refreshToken }),+ signal: AbortSignal.timeout(20_000),+ });+ if (!response.ok) return null;+ const payload = await response.json();+ const refreshed = validCredentials({+ gatewayUrl: payload.gateway_url ?? credentials.gatewayUrl,+ accessToken: payload.access_token,+ refreshToken: payload.refresh_token,+ });+ if (!refreshed) return null;+ await save(refreshed);+ return refreshed;+ }++ async function fetchProfile(credentials, allowRefresh = true) {+ const profileUrl = controlPlaneBase(credentials.gatewayUrl);+ profileUrl.pathname += "/device/me";+ const response = await fetchImpl(profileUrl, {+ headers: { Authorization: `Bearer ${credentials.accessToken}` },+ signal: AbortSignal.timeout(20_000),+ });+ if (response.status === 401 && allowRefresh) {+ const refreshed = await refresh(credentials);+ if (!refreshed) throw new InvalidAccountCredentialsError("Device session expired");+ return fetchProfile(refreshed, false);+ }+ if (response.status === 401 || response.status === 403) {+ throw new InvalidAccountCredentialsError("Device session expired");+ }+ if (!response.ok) return null;+ return accountProfile(await response.json());+ }+async function authorize({ gatewayUrl, deviceName, openVerification }) {const explicitGateway = normalizeCredential(gatewayUrl);const configured = explicitGateway ? normalizeGatewayUrl(explicitGateway) : await configuredGatewayUrl();if (!configured) throw new Error("OmniRush account service is not configured");- const base = new URL(configured);- base.pathname = base.pathname.replace(/\/+$/, "").replace(/\/v1$/, "");+ const base = controlPlaneBase(configured);const authorizeUrl = new URL(base);authorizeUrl.pathname += "/device/authorize";const issuedResponse = await fetchImpl(authorizeUrl, {@@ -178,7 +259,42 @@ export function createDesktopOmniRushAccountStore({}async function status() {- return { connected: Boolean(await load()), gatewayConfigured: Boolean(await configuredGatewayUrl()) };+ const credentials = await load();+ const gatewayConfigured = Boolean(await configuredGatewayUrl());+ if (!credentials) return { connected: false, gatewayConfigured };+ try {+ const profile = await fetchProfile(credentials);+ return {+ connected: true,+ gatewayConfigured,+ email: profile?.email ?? null,+ displayName: profile?.displayName ?? null,+ accountStatus: profile?.status ?? null,+ usage: profile?.usage ?? null,+ };+ } catch (error) {+ if (error instanceof InvalidAccountCredentialsError) {+ return {+ connected: false,+ gatewayConfigured,+ reauthorizationRequired: true,+ email: null,+ displayName: null,+ accountStatus: null,+ usage: null,+ };+ }+ // Offline profile lookup must not make a securely stored account look+ // signed out. Model requests will still use the broker's refresh path.+ return {+ connected: true,+ gatewayConfigured,+ email: null,+ displayName: null,+ accountStatus: null,+ usage: null,+ };+ }}async function clear() {diff --git a/apps/desktop/electron/omnirush-account.test.mjs b/apps/desktop/electron/omnirush-account.test.mjsindex b427f859..00196bce 100644--- a/apps/desktop/electron/omnirush-account.test.mjs+++ b/apps/desktop/electron/omnirush-account.test.mjs@@ -33,6 +33,13 @@ test("device authorization polls, encrypts, and restores the account", async ()const options = await storeOptions({fetchImpl: async (url) => {requests.push(new URL(url).pathname);+ if (String(url).endsWith("/device/me")) {+ return Response.json({+ email: "[email protected]",+ status: "active",+ usage: { token_limit: 100000, used_tokens: 1234, remaining_tokens: 98766 },+ });+ }if (String(url).endsWith("/device/authorize")) {return Response.json({device_code: "device-code",@@ -60,16 +67,63 @@ test("device authorization polls, encrypts, and restores the account", async ()});assert.deepEqual(result, { connected: true, userCode: "ABCD-EFGH" });assert.deepEqual(opened, ["http://localhost:5175/console?code=ABCD-EFGH"]);+ const status = await store.status();+ assert.equal(status.connected, true);+ assert.equal(status.displayName, "Person");+ assert.match(await readFile(options.filePath, "utf8"), /access-token/);++ const restored = createDesktopOmniRushAccountStore(options);+ assert.equal((await restored.status()).connected, true);assert.deepEqual(requests, ["/omnirush/device/authorize","/omnirush/device/token","/omnirush/device/token",+ "/omnirush/device/me",+ "/omnirush/device/me",]);- assert.equal((await store.status()).connected, true);- assert.match(await readFile(options.filePath, "utf8"), /access-token/);+});- const restored = createDesktopOmniRushAccountStore(options);- assert.equal((await restored.status()).connected, true);+test("profile lookup refreshes an expired device credential and persists the rotation", async () => {+ const options = await storeOptions({+ env: {+ OMNIRUSH_DEV_MODE: "1",+ OMNIRUSH_GATEWAY_URL: "http://localhost:8090/omnirush/v1",+ OMNIRUSH_ACCESS_TOKEN: "expired-access",+ OMNIRUSH_REFRESH_TOKEN: "current-refresh",+ },+ fetchImpl: async (url, init = {}) => {+ const pathname = new URL(url).pathname;+ if (pathname.endsWith("/device/me")) {+ const authorization = new Headers(init.headers).get("authorization");+ if (authorization === "Bearer expired-access") {+ return Response.json({ detail: "device_token_invalid" }, { status: 401 });+ }+ assert.equal(authorization, "Bearer rotated-access");+ return Response.json({+ email: "[email protected]",+ status: "active",+ usage: { token_limit: 100000, used_tokens: 12, remaining_tokens: 99988 },+ });+ }+ if (pathname.endsWith("/device/refresh")) {+ assert.deepEqual(JSON.parse(init.body), { refresh_token: "current-refresh" });+ return Response.json({+ gateway_url: "http://localhost:8090/omnirush/v1",+ access_token: "rotated-access",+ refresh_token: "rotated-refresh",+ });+ }+ throw new Error(`Unexpected request ${pathname}`);+ },+ });++ const store = createDesktopOmniRushAccountStore(options);+ const status = await store.status();+ assert.equal(status.connected, true);+ assert.equal(status.email, "[email protected]");+ assert.equal(status.displayName, "Person");+ assert.equal(status.usage.remainingTokens, 99988);+ assert.match(await readFile(options.filePath, "utf8"), /rotated-refresh/);});test("sign out prevents legacy credentials from being imported again", async () => {@@ -80,6 +134,16 @@ test("sign out prevents legacy credentials from being imported again", async ()OMNIRUSH_ACCESS_TOKEN: "legacy-access",OMNIRUSH_REFRESH_TOKEN: "legacy-refresh",},+ fetchImpl: async (url) => {+ if (new URL(url).pathname.endsWith("/device/me")) {+ return Response.json({+ email: "[email protected]",+ status: "active",+ usage: { token_limit: 100000, used_tokens: 0, remaining_tokens: 100000 },+ });+ }+ throw new Error(`Unexpected request ${url}`);+ },});const store = createDesktopOmniRushAccountStore(options);assert.equal((await store.status()).connected, true);@@ -88,6 +152,28 @@ test("sign out prevents legacy credentials from being imported again", async ()assert.equal((await restarted.status()).connected, false);});+test("marks an irrecoverably expired device session as signed out", async () => {+ const options = await storeOptions({+ env: {+ OMNIRUSH_DEV_MODE: "1",+ OMNIRUSH_GATEWAY_URL: "http://localhost:8090/omnirush/v1",+ OMNIRUSH_ACCESS_TOKEN: "expired-access",+ OMNIRUSH_REFRESH_TOKEN: "expired-refresh",+ },+ fetchImpl: async (url) => {+ const pathname = new URL(url).pathname;+ if (pathname.endsWith("/device/me") || pathname.endsWith("/device/refresh")) {+ return Response.json({ detail: "device_token_invalid" }, { status: 401 });+ }+ throw new Error(`Unexpected request ${pathname}`);+ },+ });++ const status = await createDesktopOmniRushAccountStore(options).status();+ assert.equal(status.connected, false);+ assert.equal(status.reauthorizationRequired, true);+});+test("rejects an insecure non-loopback account endpoint", async () => {let requested = false;const options = await storeOptions({diff --git a/apps/desktop/electron/runtime.mjs b/apps/desktop/electron/runtime.mjsindex c46d73f7..e7993efc 100644--- a/apps/desktop/electron/runtime.mjs+++ b/apps/desktop/electron/runtime.mjs@@ -1924,9 +1924,13 @@ export function createRuntimeManager({// Inject user env vars so the server and managed OpenCode inherit them.const serverEnv = await buildChildEnv({});Object.assign(process.env, serverEnv);- if (gatewayCredentials) {- // The refresh grant belongs to the Electron account store and loopback- // broker. Never let it flow into the managed OpenCode child or plugins.+ if (omnirushGatewayCredentials) {+ // The desktop account store is authoritative. Clear inherited or stale+ // account variables before every restart so sign-out cannot recreate a+ // broker from process-global credentials. Current credentials are passed+ // directly to the embedded server below and never reach OpenCode.+ delete process.env.OMNIRUSH_GATEWAY_URL;+ delete process.env.OMNIRUSH_ACCESS_TOKEN;delete process.env.OMNIRUSH_REFRESH_TOKEN;}diff --git a/apps/desktop/electron/workspace-store.mjs b/apps/desktop/electron/workspace-store.mjsindex 74aed52f..e0f8c93a 100644--- a/apps/desktop/electron/workspace-store.mjs+++ b/apps/desktop/electron/workspace-store.mjs@@ -927,7 +927,7 @@ export function createWorkspaceStore({const home = process.env.OMNIRUSH_DEV_MODE === "1" && process.env.OMNIRUSH_DEV_SHARED_STATE !== "1"? path.join(app.getPath("userData"), "omnirush-dev-data", "home"): os.homedir();- const folderPath = await normalizeLocalWorkspacePath(path.join(home, "OmniRush.ai Chat"));+ const folderPath = await normalizeLocalWorkspacePath(path.join(home, "omnirush.ai"));try {await createWorkspace({ folderPath });return null;diff --git a/apps/desktop/electron/workspace-store.test.mjs b/apps/desktop/electron/workspace-store.test.mjsindex 775cc0b6..85e36fcb 100644--- a/apps/desktop/electron/workspace-store.test.mjs+++ b/apps/desktop/electron/workspace-store.test.mjs@@ -237,11 +237,11 @@ test("first-launch bootstrap creates and selects the chat folder, but ordinary rconst state = await store.readWorkspaceState();assert.equal(state.workspaces.length, 0);- await assert.rejects(readFile(path.join(userData, "omnirush-dev-data", "home", "OmniRush.ai Chat", ".opencode", "omnirush.json"), "utf8"));+ await assert.rejects(readFile(path.join(userData, "omnirush-dev-data", "home", "omnirush.ai", ".opencode", "omnirush.json"), "utf8"));await store.bootstrapFirstLaunchWorkspace();const created = await store.readWorkspaceState();- const folder = path.join(userData, "omnirush-dev-data", "home", "OmniRush.ai Chat");+ const folder = path.join(userData, "omnirush-dev-data", "home", "omnirush.ai");assert.equal(created.workspaces.length, 1);assert.equal(created.workspaces[0].path, folder);assert.equal(created.workspaces[0].workspaceType, "local");@@ -261,7 +261,7 @@ test("first-launch bootstrap creates and selects the chat folder, but ordinary rtest("first-launch bootstrap preserves existing folders and their model configuration", async () => {await withIsolatedBootstrapStore(async ({ store, root }) => {- const folder = path.join(root, "home", "OmniRush.ai Chat");+ const folder = path.join(root, "home", "omnirush.ai");const config = { version: 1, authorizedRoots: [folder], workspace: { name: "Existing chat" } };await store.writeWorkspaceOmniRushConfig(folder, config);const modelConfigPath = path.join(folder, "opencode.json");@@ -277,7 +277,7 @@ test("first-launch bootstrap preserves existing folders and their model configurtest("a blocked default folder reports the error and allows a different authorized workspace", async () => {await withIsolatedBootstrapStore(async ({ store, root }) => {- const folder = path.join(root, "home", "OmniRush.ai Chat");+ const folder = path.join(root, "home", "omnirush.ai");await mkdir(path.dirname(folder), { recursive: true });await writeFile(folder, "keep this file", "utf8");@@ -299,7 +299,7 @@ test("a non-writable default folder reports a recoverable permission error", {skip: process.platform === "win32" || process.getuid?.() === 0,}, async () => {await withIsolatedBootstrapStore(async ({ store, root }) => {- const folder = path.join(root, "home", "OmniRush.ai Chat");+ const folder = path.join(root, "home", "omnirush.ai");await mkdir(folder, { recursive: true });await chmod(folder, 0o500);try {diff --git a/apps/server/src/embedded.ts b/apps/server/src/embedded.tsindex 17535d11..ddbeb354 100644--- a/apps/server/src/embedded.ts+++ b/apps/server/src/embedded.ts@@ -226,6 +226,9 @@ export async function startEmbeddedServer(options: EmbeddedServerOptions): Promiconst engineEnv: Record<string, string | undefined> = {...(process.env.OMNIRUSH_DEV_MODE ? { OMNIRUSH_DEV_MODE: process.env.OMNIRUSH_DEV_MODE } : {}),...(process.env.OMNIRUSH_UI_CONTROL_DISCOVERY ? { OMNIRUSH_UI_CONTROL_DISCOVERY: process.env.OMNIRUSH_UI_CONTROL_DISCOVERY } : {}),+ ...(config.omnirushGatewayCredentials && config.omnirushEngineToken+ ? { OMNIRUSH_ACCESS_TOKEN: config.omnirushEngineToken }+ : {}),OMNIRUSH_SERVER_URL: serverUrl,OMNIRUSH_SERVER_TOKEN: config.token,OMNIRUSH_POLICY_TOKEN: managedDesktopPolicy(config).evaluationToken,diff --git a/apps/server/src/omnirush-agent-prompt.ts b/apps/server/src/omnirush-agent-prompt.tsindex f3d4f48a..76036dfd 100644--- a/apps/server/src/omnirush-agent-prompt.ts+++ b/apps/server/src/omnirush-agent-prompt.ts@@ -8,13 +8,13 @@* Kept dependency-free so tests and specs can import it without the runtime* database.*/-export const OMNIRUSH_AGENT_PROMPT = `You are OmniRush.ai.+export const OMNIRUSH_AGENT_PROMPT = `You are omnirush.ai.-When the user refers to "you", they mean the OmniRush.ai app and the current workspace.+When the user refers to "you", they mean the omnirush.ai app and the current workspace.## Identity-When asked what app or agent the user is working with, answer "I'm OmniRush.ai."+When asked what app or agent the user is working with, answer "I'm omnirush.ai."When asked which model or provider is running, report the exact selected model and provider from runtime context when it is available. Never rename one vendor's model as another vendor's model, invent a model identity, or conceal a known selection. If runtime context does not include the selection, say you cannot see it rather than guessing.@@ -36,6 +36,7 @@ Hard rule: never copy private memory into repo files. Store only redacted summar- If required setup or credentials are missing, ask one targeted question and continue once provided.- If you change code, run the smallest meaningful test.- Use the task tool to delegate bounded, independent work to subagents when parallel exploration, implementation, or review will materially improve the result. Keep delegated activity visible in the session and synthesize it before answering.+- When the user explicitly asks to spawn, use, or delegate to a specific number of agents, make that many distinct task-tool calls. Use the general subagent unless a more specialized subagent is clearly better. Never replace an explicit delegation request with a simulated multi-role answer, and never claim subagents are unavailable while the task tool is present. Wait for every delegated task and then synthesize their actual results.- If steps repeat, capture them as a skill following the \`Skill creation:\` instruction in this prompt.- Prefer clear, practical steps over abstract explanations.diff --git a/apps/server/src/omnirush-runtime-config.test.ts b/apps/server/src/omnirush-runtime-config.test.tsindex 9b7ad0d9..a35221bd 100644--- a/apps/server/src/omnirush-runtime-config.test.ts+++ b/apps/server/src/omnirush-runtime-config.test.ts@@ -120,7 +120,7 @@ describe("omnirush runtime config file", () => {expect(parsed.model).toBe("omnirush/gpt-6-astra");expect(providers.omnirush).toMatchObject({npm: "@ai-sdk/openai",- name: "OmniRush.ai",+ name: "omnirush.ai",env: ["OMNIRUSH_ACCESS_TOKEN"],options: { baseURL: "http://127.0.0.1:8090/omnirush/v1" },models: {@@ -134,6 +134,46 @@ describe("omnirush runtime config file", () => {expect(JSON.stringify(parsed)).not.toContain("access-token");});+ test("derives the desktop loopback gateway from the server config without process-global credentials", async () => {+ const { config } = await setup();+ config.port = 48123;+ config.omnirushEngineToken = "ephemeral-engine-token";+ config.omnirushGatewayCredentials = {+ gatewayUrl: "https://api.example.test/omnirush/v1",+ accessToken: "device-access-token",+ refreshToken: "device-refresh-token",+ };+ const previous = {+ engineGateway: process.env.OMNIRUSH_ENGINE_GATEWAY_URL,+ gateway: process.env.OMNIRUSH_GATEWAY_URL,+ access: process.env.OMNIRUSH_ACCESS_TOKEN,+ };+ try {+ delete process.env.OMNIRUSH_ENGINE_GATEWAY_URL;+ delete process.env.OMNIRUSH_GATEWAY_URL;+ delete process.env.OMNIRUSH_ACCESS_TOKEN;++ const parsed = JSON.parse(await buildOmniRushRuntimeConfig(config)) as Record<string, unknown>;+ const providers = parsed.provider as Record<string, Record<string, unknown>>;++ expect(parsed.model).toBe("omnirush/gpt-6-astra");+ expect(providers.omnirush).toMatchObject({+ env: ["OMNIRUSH_ACCESS_TOKEN"],+ options: { baseURL: "http://127.0.0.1:48123/omnirush-gateway/v1" },+ });+ expect(JSON.stringify(parsed)).not.toContain("device-access-token");+ expect(JSON.stringify(parsed)).not.toContain("device-refresh-token");+ expect(JSON.stringify(parsed)).not.toContain("ephemeral-engine-token");+ } finally {+ if (previous.engineGateway === undefined) delete process.env.OMNIRUSH_ENGINE_GATEWAY_URL;+ else process.env.OMNIRUSH_ENGINE_GATEWAY_URL = previous.engineGateway;+ if (previous.gateway === undefined) delete process.env.OMNIRUSH_GATEWAY_URL;+ else process.env.OMNIRUSH_GATEWAY_URL = previous.gateway;+ if (previous.access === undefined) delete process.env.OMNIRUSH_ACCESS_TOKEN;+ else process.env.OMNIRUSH_ACCESS_TOKEN = previous.access;+ }+ });+test("reserves the internal provider id for the account-scoped gateway", () => {const parsed = buildOmniRushRuntimeConfigObjectFromSnapshot({provider: {@@ -173,11 +213,14 @@ describe("omnirush runtime config file", () => {const agent = parsed.agent as Record<string, { prompt?: string }>;const prompt = agent.omnirush?.prompt ?? "";- expect(prompt.startsWith("You are OmniRush.ai.")).toBe(true);+ expect(prompt.startsWith("You are omnirush.ai.")).toBe(true);expect(prompt).toContain("## Memory\n");expect(prompt).toContain("## OmniRush.ai Artifacts");expect(prompt).toContain("## Connected work");expect(prompt).toContain("delegate bounded, independent work to subagents");+ expect(prompt).toContain("make that many distinct task-tool calls");+ expect(prompt).toContain("Never replace an explicit delegation request with a simulated multi-role answer");+ expect(prompt).toContain("Wait for every delegated task");// Den removed the Memory Bank; the prompt must not teach capabilities that// the live catalog can no longer return.expect(prompt).not.toContain("Memory Bank");diff --git a/apps/server/src/omnirush-runtime-config.ts b/apps/server/src/omnirush-runtime-config.tsindex 58fa07f3..ff353289 100644--- a/apps/server/src/omnirush-runtime-config.ts+++ b/apps/server/src/omnirush-runtime-config.ts@@ -69,6 +69,21 @@ function resolveInternalGatewayRuntime(return { baseUrl: url.toString().replace(/\/$/, "") };}+function resolveConfiguredInternalGatewayRuntime(+ config: ServerConfig | undefined,+ env: NodeJS.ProcessEnv = process.env,+): InternalGatewayRuntime | undefined {+ if (config?.omnirushGatewayCredentials && config.omnirushEngineToken) {+ const rawHostname = config.host === "0.0.0.0" ? "127.0.0.1" : config.host;+ const hostname = rawHostname.includes(":") && !rawHostname.startsWith("[")+ ? `[${rawHostname}]`+ : rawHostname;+ const baseUrl = `http://${hostname}:${config.port}/omnirush-gateway/v1`;+ return { baseUrl };+ }+ return resolveInternalGatewayRuntime(env);+}+function internalGatewayProvider(runtime: InternalGatewayRuntime): Record<string, unknown> {return {// The native OpenAI provider uses the Responses API, which preserves@@ -76,7 +91,7 @@ function internalGatewayProvider(runtime: InternalGatewayRuntime): Record<string// compatibility provider only emits /chat/completions and loses those// Astra capabilities.npm: "@ai-sdk/openai",- name: "OmniRush.ai",+ name: "omnirush.ai",env: ["OMNIRUSH_ACCESS_TOKEN"],options: { baseURL: runtime.baseUrl },models: {@@ -104,7 +119,7 @@ export async function buildOmniRushRuntimeConfigObject(const runtimeConfig = config ? await readGlobalRuntimeOpencodeConfig(config) : {};return buildOmniRushRuntimeConfigObjectFromSnapshot(runtimeConfig,- resolveInternalGatewayRuntime(),+ resolveConfiguredInternalGatewayRuntime(config),);}@@ -134,7 +149,7 @@ export function buildOmniRushRuntimeConfigObjectFromSnapshot(default_agent: runtimeConfig.default_agent ?? "omnirush",agent: {omnirush: {- description: "OmniRush.ai default agent",+ description: "omnirush.ai default agent",mode: "primary",temperature: 0.2,prompt: OMNIRUSH_AGENT_PROMPT,diff --git a/packages/types/src/desktop-ipc.ts b/packages/types/src/desktop-ipc.tsindex 65524f86..e97b966c 100644--- a/packages/types/src/desktop-ipc.ts+++ b/packages/types/src/desktop-ipc.ts@@ -512,7 +512,18 @@ export type DesktopCommandMap = {// OmniRush.ai server sidecaromnirushServerInfo: { args: []; result: OmniRushServerInfo };- omnirushAccountStatus: { args: []; result: { connected: boolean; gatewayConfigured: boolean } };+ omnirushAccountStatus: {+ args: [];+ result: {+ connected: boolean;+ gatewayConfigured: boolean;+ reauthorizationRequired?: boolean;+ email?: string | null;+ displayName?: string | null;+ accountStatus?: string | null;+ usage?: { tokenLimit: number; usedTokens: number; remainingTokens: number } | null;+ };+ };omnirushAccountConnect: {args: [options?: { gatewayUrl?: string; deviceName?: string }];result: { connected: true; userCode: string };