A desktop coding agent with free access to frontier models.
TypeScript
fix(security): run the bundled UI-control MCP and stop trusting unregistered domains
ogsamrat7833cc01958a
diff --git a/.devcontainer/test-on-daytona.sh b/.devcontainer/test-on-daytona.shindex 3ba4c716..b335bcd2 100644--- a/.devcontainer/test-on-daytona.sh+++ b/.devcontainer/test-on-daytona.sh@@ -84,6 +84,13 @@ while [ "$#" -gt 0 ]; doshiftdone+# There is no hosted Den to fall back to: any Den-dependent option needs an+# explicit --den-base-url.+if [ -z "$DEN_BASE_URL" ] && { [ -n "$DEN_API_BASE_URL" ] || [ "$DEN_REQUIRE_SIGNIN" = 1 ]; }; then+ echo "--den-api-base-url and --require-signin need --den-base-url <your Den web origin>; omnirush.ai runs no hosted Den." >&2+ exit 1+fi+if [ -z "$REF" ]; thenREF="$(git branch --show-current 2>/dev/null || true)"REF="${REF:-$(git rev-parse HEAD)}"@@ -221,7 +228,7 @@ daytona exec "$SANDBOX" -- "bash -lc 'set -euo pipefail; cd /workspace; REF=\"$Recho ""echo "==> Starting OmniRush.ai sandbox dev stack..."-daytona exec "$SANDBOX" -- "bash -lc 'set -euo pipefail; cd /workspace; DEN_BASE_URL=\"$DEN_BASE_URL\"; DEN_API_BASE_URL=\"$DEN_API_BASE_URL\"; DEN_REQUIRE_SIGNIN=\"$DEN_REQUIRE_SIGNIN\"; if [ -n \"\$DEN_BASE_URL\" ] || [ -n \"\$DEN_API_BASE_URL\" ] || [ \"\$DEN_REQUIRE_SIGNIN\" = 1 ]; then mkdir -p /workspace/.omnirush-daytona; DEN_BASE_URL=\"\$DEN_BASE_URL\" DEN_API_BASE_URL=\"\$DEN_API_BASE_URL\" DEN_REQUIRE_SIGNIN=\"\$DEN_REQUIRE_SIGNIN\" node -e '\''const fs = require(\"node:fs\"); const baseUrl = process.env.DEN_BASE_URL || \"https://app.omnirushlabs.com\"; const apiBaseUrl = process.env.DEN_API_BASE_URL || null; const requireSignin = process.env.DEN_REQUIRE_SIGNIN === \"1\"; fs.writeFileSync(\"/workspace/.omnirush-daytona/desktop-bootstrap.json\", JSON.stringify({ baseUrl, apiBaseUrl, requireSignin }, null, 2) + \"\\n\");'\''; fi; export DAYTONA_SECRETS_ENV=\"$DAYTONA_SECRETS_ENV\" DAYTONA_ELECTRON_EXTRA_LAUNCH_ARGS=\"$DAYTONA_ELECTRON_EXTRA_LAUNCH_ARGS\" OMNIRUSH_ELECTRON_REMOTE_DEBUG_PORT=$CDP_PORT OMNIRUSH_ELECTRON_FAKE_MEDIA=\"$OMNIRUSH_ELECTRON_FAKE_MEDIA\" OMNIRUSH_WORKSPACE_DIR=/workspace OMNIRUSH_GOOGLE_WORKSPACE_ALLOW_PLAINTEXT_VAULT=1; if [ -f /workspace/.omnirush-daytona/desktop-bootstrap.json ]; then export OMNIRUSH_DESKTOP_BOOTSTRAP_PATH=/workspace/.omnirush-daytona/desktop-bootstrap.json; fi; pnpm dev:sandbox'"+daytona exec "$SANDBOX" -- "bash -lc 'set -euo pipefail; cd /workspace; DEN_BASE_URL=\"$DEN_BASE_URL\"; DEN_API_BASE_URL=\"$DEN_API_BASE_URL\"; DEN_REQUIRE_SIGNIN=\"$DEN_REQUIRE_SIGNIN\"; if [ -n \"\$DEN_BASE_URL\" ] || [ -n \"\$DEN_API_BASE_URL\" ] || [ \"\$DEN_REQUIRE_SIGNIN\" = 1 ]; then mkdir -p /workspace/.omnirush-daytona; DEN_BASE_URL=\"\$DEN_BASE_URL\" DEN_API_BASE_URL=\"\$DEN_API_BASE_URL\" DEN_REQUIRE_SIGNIN=\"\$DEN_REQUIRE_SIGNIN\" node -e '\''const fs = require(\"node:fs\"); const baseUrl = process.env.DEN_BASE_URL; const apiBaseUrl = process.env.DEN_API_BASE_URL || null; const requireSignin = process.env.DEN_REQUIRE_SIGNIN === \"1\"; fs.writeFileSync(\"/workspace/.omnirush-daytona/desktop-bootstrap.json\", JSON.stringify({ baseUrl, apiBaseUrl, requireSignin }, null, 2) + \"\\n\");'\''; fi; export DAYTONA_SECRETS_ENV=\"$DAYTONA_SECRETS_ENV\" DAYTONA_ELECTRON_EXTRA_LAUNCH_ARGS=\"$DAYTONA_ELECTRON_EXTRA_LAUNCH_ARGS\" OMNIRUSH_ELECTRON_REMOTE_DEBUG_PORT=$CDP_PORT OMNIRUSH_ELECTRON_FAKE_MEDIA=\"$OMNIRUSH_ELECTRON_FAKE_MEDIA\" OMNIRUSH_WORKSPACE_DIR=/workspace OMNIRUSH_GOOGLE_WORKSPACE_ALLOW_PLAINTEXT_VAULT=1; if [ -f /workspace/.omnirush-daytona/desktop-bootstrap.json ]; then export OMNIRUSH_DESKTOP_BOOTSTRAP_PATH=/workspace/.omnirush-daytona/desktop-bootstrap.json; fi; pnpm dev:sandbox'"echo ""echo "==> Waiting for Electron CDP on port $CDP_PORT (up to ${MAX_WAIT}s)..."diff --git a/.github/workflows/ci-omnirush-ui-mcp.yml b/.github/workflows/ci-omnirush-ui-mcp.ymlindex e2be6525..ccdfb433 100644--- a/.github/workflows/ci-omnirush-ui-mcp.yml+++ b/.github/workflows/ci-omnirush-ui-mcp.yml@@ -1,13 +1,16 @@name: omnirush-ui-mcp+# omnirush-ui-mcp is a private workspace package. The desktop build bundles it+# into the app (apps/desktop/scripts/prepare-ui-mcp.mjs) and runs it by path,+# so there is deliberately no npm publish job: nothing should ever be launched+# as `npx omnirush-ui-mcp`.+on:push:branches: [dev]paths:- "packages/omnirush-ui-mcp/**"- ".github/workflows/ci-omnirush-ui-mcp.yml"- tags:- - "omnirush-ui-mcp-v*"pull_request:branches: [dev]paths:@@ -23,7 +26,7 @@ defaults:jobs:check:- name: Syntax & dry-run publish+ name: Syntax checkruns-on: ubuntu-lateststeps:@@ -34,54 +37,9 @@ jobs:uses: actions/setup-node@v4with:node-version: 24- registry-url: https://registry.npmjs.org-- - name: Setup pnpm- uses: pnpm/action-setup@v4- with:- version: 11.4.0-- - name: Install dependencies- run: pnpm install --frozen-lockfile --ignore-scripts-- - name: Syntax check- run: node --check index.mjs-- - name: Dry-run publish- run: npm publish --dry-run --access public-- publish:- name: Publish to npm- needs: check- if: startsWith(github.ref, 'refs/tags/omnirush-ui-mcp-v')- runs-on: ubuntu-latest-- permissions:- contents: read- id-token: write-- steps:- - name: Checkout- uses: actions/checkout@v4-- - name: Setup Node- uses: actions/setup-node@v4- with:- node-version: 24- registry-url: https://registry.npmjs.org-- - name: Setup pnpm- uses: pnpm/action-setup@v4- with:- version: 11.4.0-- - name: Install dependencies- run: pnpm install --frozen-lockfile --ignore-scripts- name: Syntax checkrun: node --check index.mjs- - name: Publish- run: npm publish --access public --provenance- env:- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}+ - name: Stays private+ run: node -e "const p=require('./package.json'); if (p.private !== true || p.publishConfig) { console.error('omnirush-ui-mcp must stay private and unpublished'); process.exit(1); }"diff --git a/.opencode/skills/omnirush-models/SKILL.md b/.opencode/skills/omnirush-models/SKILL.mdindex 1a2dcf10..c4464c2e 100644--- a/.opencode/skills/omnirush-models/SKILL.md+++ b/.opencode/skills/omnirush-models/SKILL.md@@ -22,8 +22,10 @@ Managed file:`ee/apps/inference/scripts/build-models.mjs` reads `omnirush-models.json` andgenerates the OmniRush.ai provider overlay in memory. It selects the API URL from-`OMNIRUSH_DEV_MODE`: dev uses `http://127.0.0.1:8791/api/v1`, otherwise prod-uses `https://inference.omnirushlabs.com/api/v1`.+`OMNIRUSH_DEV_MODE`: dev uses `http://127.0.0.1:8791/api/v1`; the non-dev value+hard-coded there points at the retired hosted `inference.omnirushlabs.com`+domain, which omnirush.ai no longer owns. Do not treat that origin as a live+endpoint or copy it into new configuration.Do not inspect the full `base.json` in chat. Use the scripts so the large sourcemodel body stays out of context.diff --git a/apps/app/src/app/constants.ts b/apps/app/src/app/constants.tsindex 508cc202..edb1fbc0 100644--- a/apps/app/src/app/constants.ts+++ b/apps/app/src/app/constants.ts@@ -197,8 +197,10 @@ export const MCP_QUICK_CONNECT: McpDirectoryInfo[] = [serverName: "omnirush-ui",get description() { return t("mcp.quick_connect_omnirush_ui_desc"); },type: "local",- // Dev builds replace this with the local checkout path before writing config.- command: ["npx", "-y", "omnirush-ui-mcp"],+ // Resolved by the desktop at connect time (getOmniRushUiMcpCommand): the+ // MCP ships inside the app and runs under the app's own binary. It is not+ // published on npm, so there is deliberately no `npx` fallback here.+ command: [],oauth: false,kind: "ui-control",iconSrc: "/omnirush-mark.png",diff --git a/apps/app/src/react-app/design-system/extension-detail-modal.tsx b/apps/app/src/react-app/design-system/extension-detail-modal.tsxindex 0102c59c..7f37d662 100644--- a/apps/app/src/react-app/design-system/extension-detail-modal.tsx+++ b/apps/app/src/react-app/design-system/extension-detail-modal.tsx@@ -125,14 +125,22 @@ const taxonomyDesc: Record<ExtensionTaxonomy, string> = {plugin: "Extends omnirush.ai with additional capabilities managed by your organization.",};-const uiControlClientConfig = `{- "mcpServers": {- "omnirush-ui": {- "command": "npx",- "args": ["-y", "omnirush-ui-mcp"]- }- }-}`;+// The UI-control MCP ships inside the desktop app and is not published on+// npm, so client snippets are built from the desktop's own launch command.+function uiControlClientConfig(command: string[], environment?: Record<string, string>) {+ const [executable, ...args] = command;+ return JSON.stringify({+ mcpServers: {+ "omnirush-ui": {+ command: executable,+ args,+ ...(environment ? { env: environment } : {}),+ },+ },+ }, null, 2);+}++const uiControlLaunchUnavailable = "Open this page in the omnirush.ai desktop app to see the launch command.";function uiControlOpencodeConfig(command: string[], environment?: Record<string, string>) {return JSON.stringify({@@ -147,18 +155,6 @@ function uiControlOpencodeConfig(command: string[], environment?: Record<string,}, null, 2);}-const fallbackUiControlCommand = ["npx", "-y", "omnirush-ui-mcp"];--const fallbackUiControlOpencodeConfig = `{- "mcp": {- "omnirush-ui": {- "type": "local",- "command": ["npx", "-y", "omnirush-ui-mcp"],- "enabled": true- }- }-}`;-/*** Strip YAML-like frontmatter from the beginning of a skill content string.* Handles both `---` delimited blocks and bare `key: value` lines at the top.@@ -492,7 +488,7 @@ export function ExtensionDetailModal({{uiControl ? (<div className="flex items-center justify-between text-sm"><span className="text-muted-foreground">Launch</span>- <span className="max-w-[300px] truncate font-mono text-xs text-card-foreground">{(launchCommand ?? fallbackUiControlCommand).join(" ")}</span>+ <span className="max-w-[300px] truncate font-mono text-xs text-card-foreground">{launchCommand?.length ? launchCommand.join(" ") : "Desktop app only"}</span></div>) : null}@@ -773,7 +769,9 @@ interface UiControlConnectionDetailsProps {function UiControlConnectionDetails(props: UiControlConnectionDetailsProps) {"use memo";- const opencodeConfig = props.launchCommand ? uiControlOpencodeConfig(props.launchCommand, props.environment) : fallbackUiControlOpencodeConfig;+ const launchCommand = props.launchCommand?.length ? props.launchCommand : null;+ const clientConfig = launchCommand ? uiControlClientConfig(launchCommand, props.environment) : uiControlLaunchUnavailable;+ const opencodeConfig = launchCommand ? uiControlOpencodeConfig(launchCommand, props.environment) : uiControlLaunchUnavailable;return (<div className="space-y-4">@@ -784,7 +782,7 @@ function UiControlConnectionDetails(props: UiControlConnectionDetailsProps) {<CardContent><div className="flex flex-col gap-2 text-sm leading-relaxed text-muted-foreground"><div>omnirush.ai desktop starts a private localhost bridge automatically.</div>- <div>Your MCP client starts <span className="font-mono text-card-foreground">omnirush-ui-mcp</span> over stdio; the wrapper discovers the bridge and proxies UI tools to it.</div>+ <div>Your MCP client starts the UI-control MCP bundled with omnirush.ai over stdio; it discovers the bridge and proxies UI tools to it. It is not an npm package, so never install it with npx.</div><div>Do not point clients at the random localhost bridge URL directly.</div></div></CardContent>@@ -796,7 +794,7 @@ function UiControlConnectionDetails(props: UiControlConnectionDetailsProps) {</CardHeader><CardContent><pre className="max-h-[180px] overflow-x-auto rounded-xl border border-border p-3 text-xs leading-relaxed text-card-foreground">- <code>{uiControlClientConfig}</code>+ <code>{clientConfig}</code></pre></CardContent></Card>diff --git a/apps/app/src/react-app/domains/connections/store.ts b/apps/app/src/react-app/domains/connections/store.tsindex b0861ca5..846b7f1b 100644--- a/apps/app/src/react-app/domains/connections/store.ts+++ b/apps/app/src/react-app/domains/connections/store.ts@@ -73,6 +73,8 @@ type SetStateAction<T> = T | ((current: T) => T);// was written and every sync tick re-wrote the MCP config.const CLOUD_MCP_REFRESH_MARGIN_MS = 24 * 60 * 60 * 1000;const LOCAL_OMNIRUSH_SERVER_RECOVERY_TIMEOUT_MS = 30_000;+const OMNIRUSH_UI_MCP_UNAVAILABLE = "UI control requires the omnirush.ai desktop app. Restart omnirush.ai or reinstall the app.";+const COMPUTER_USE_HELPER_UNAVAILABLE = "Computer Use helper app is unavailable. Restart omnirush.ai or reinstall the app.";async function withLocalOmniRushServerRecoveryTimeout<T>(task: Promise<T>,@@ -378,7 +380,7 @@ export function createConnectionsStore(options: {if (config?.type === "local" && config.enabled !== false && Array.isArray(command)&& typeof command[0] === "string" && command[0].endsWith("/ComputerUse")&& ((command.length === 2 && command[1] === "mcp") || (command.length === 3 && command[1] === "relay"))) {- const currentCommand = await resolveDesktopCommand("getComputerUseMcpCommand", false);+ const currentCommand = await resolveDesktopCommand("getComputerUseMcpCommand", COMPUTER_USE_HELPER_UNAVAILABLE);const bundled = currentCommand && (command[0] === currentCommand[0]|| command[0].endsWith("/omnirush.ai Computer Use.app/Contents/MacOS/ComputerUse"));if (bundled && JSON.stringify(command) !== JSON.stringify(currentCommand)) {@@ -437,52 +439,60 @@ export function createConnectionsStore(options: {};};- const resolveDesktopCommand = async (commandName: "getComputerUseMcpCommand" | "getOmniRushUiMcpCommand", fallbackOnError = true) => {+ const resolveDesktopCommand = async (+ commandName: "getComputerUseMcpCommand" | "getOmniRushUiMcpCommand",+ unavailableMessage: string,+ ) => {try {const command = await window.__OMNIRUSH_ELECTRON__?.invokeDesktop?.(commandName);if (Array.isArray(command) && command.every((part) => typeof part === "string") && command.length > 0) {return command;}} catch (error) {- if (!fallbackOnError) {- throw error instanceof Error- ? error- : new Error("Computer Use helper app is unavailable. Restart omnirush.ai or reinstall the app.");- }- // Fall through to the published package command in the manifest/catalog.+ // Built-in local MCPs ship inside the desktop app. Never fall back to a+ // catalog command that would resolve a package from a registry.+ throw error instanceof Error ? error : new Error(unavailableMessage);}return null;};+ const isOmniRushUiMcpEntry = (entry: McpDirectoryInfo) =>+ extensionResource(entry.extensionManifest, "mcp")?.localCommandRef === "omnirush.uiMcp"+ || entry.serverName === "omnirush-ui";+const resolveLocalMcpCommand = async (entry: McpDirectoryInfo) => {const mcpResource = extensionResource(entry.extensionManifest, "mcp");if (mcpResource?.localCommandRef === "omnirush.computerUseMcp") {- const command = await resolveDesktopCommand("getComputerUseMcpCommand", false);+ const command = await resolveDesktopCommand("getComputerUseMcpCommand", COMPUTER_USE_HELPER_UNAVAILABLE);if (!command) throw new Error("Computer Use requires the bundled omnirush.ai helper on macOS.");return command;}- if (mcpResource?.localCommandRef === "omnirush.uiMcp" || entry.serverName === "omnirush-ui") {- const command = await resolveDesktopCommand("getOmniRushUiMcpCommand");- return command ?? entry.command;+ if (isOmniRushUiMcpEntry(entry)) {+ const command = await resolveDesktopCommand("getOmniRushUiMcpCommand", OMNIRUSH_UI_MCP_UNAVAILABLE);+ if (!command) throw new Error(OMNIRUSH_UI_MCP_UNAVAILABLE);+ return command;}return entry.command;};const resolveLocalMcpEnvironment = async (entry: McpDirectoryInfo) => {- if (entry.serverName !== "omnirush-ui") return undefined;+ if (!isOmniRushUiMcpEntry(entry)) return undefined;+ // Required, not best-effort: packaged launches run the app's own binary and+ // need ELECTRON_RUN_AS_NODE=1 from this environment to act as Node.+ let environment: unknown;try {- const environment = await window.__OMNIRUSH_ELECTRON__?.invokeDesktop?.("getOmniRushUiMcpEnvironment");- if (environment && typeof environment === "object" && !Array.isArray(environment)) {- return Object.fromEntries(- Object.entries(environment).filter((entry): entry is [string, string] =>- typeof entry[0] === "string" && typeof entry[1] === "string"- ),- );- }- } catch {- // Discovery fallback in omnirush-ui-mcp still handles normal launches.+ environment = await window.__OMNIRUSH_ELECTRON__?.invokeDesktop?.("getOmniRushUiMcpEnvironment");+ } catch (error) {+ throw error instanceof Error ? error : new Error(OMNIRUSH_UI_MCP_UNAVAILABLE);}- return undefined;+ if (!environment || typeof environment !== "object" || Array.isArray(environment)) {+ throw new Error(OMNIRUSH_UI_MCP_UNAVAILABLE);+ }+ return Object.fromEntries(+ Object.entries(environment).filter((item): item is [string, string] =>+ typeof item[0] === "string" && typeof item[1] === "string"+ ),+ );};/**@@ -1008,6 +1018,11 @@ export function createConnectionsStore(options: {: {type: "local" as const,command: (mcpEntryConfig["command"] as string[]) ?? entry.command!,+ // Keep the resolved environment: the bundled UI-control MCP+ // runs the app binary and needs ELECTRON_RUN_AS_NODE=1.+ ...(mcpEntryConfig["environment"]+ ? { environment: mcpEntryConfig["environment"] as Record<string, string> }+ : {}),enabled: true,};diff --git a/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx b/apps/app/src/react-app/domains/settings/pages/mcp-view.tsxindex b9e7139c..c3b9d709 100644--- a/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx+++ b/apps/app/src/react-app/domains/settings/pages/mcp-view.tsx@@ -784,6 +784,8 @@ export function McpView(props: McpViewProps) {useEffect(() => {if (!isDesktopRuntime()) return;void (async () => {+ // The bundled UI-control MCP can be missing from a broken build; that+ // must not hide the Computer Use launch details, so resolve separately.try {const command = await window.__OMNIRUSH_ELECTRON__?.invokeDesktop?.("getOmniRushUiMcpCommand");if (Array.isArray(command) && command.every((part) => typeof part === "string")) {@@ -797,13 +799,16 @@ export function McpView(props: McpViewProps) {),));}+ } catch {+ setOmniRushUiMcpCommand(null);+ setOmniRushUiMcpEnvironment(null);+ }+ try {const computerUseCommand = await window.__OMNIRUSH_ELECTRON__?.invokeDesktop?.("getComputerUseMcpCommand");if (Array.isArray(computerUseCommand) && computerUseCommand.every((part) => typeof part === "string")) {setComputerUseMcpCommand(computerUseCommand);}} catch {- setOmniRushUiMcpCommand(null);- setOmniRushUiMcpEnvironment(null);setComputerUseMcpCommand(null);}})();diff --git a/apps/app/tests/den-mcp-url.test.ts b/apps/app/tests/den-mcp-url.test.tsindex cb917ecd..31d9d215 100644--- a/apps/app/tests/den-mcp-url.test.ts+++ b/apps/app/tests/den-mcp-url.test.ts@@ -71,7 +71,7 @@ describe("getDenMcpUrl", () => {describe("isLegacyWebAppMcpUrl", () => {test("flags the legacy bare web-app MCP URL", () => {expect(isLegacyWebAppMcpUrl("https://app.omnirush.example.com/mcp")).toBe(true);- expect(isLegacyWebAppMcpUrl("https://app.omnirush.software/mcp/")).toBe(true);+ expect(isLegacyWebAppMcpUrl("https://app.den.example.com/mcp/")).toBe(true);});test("accepts valid MCP URLs", () => {@@ -87,8 +87,8 @@ describe("isLegacyWebAppMcpUrl", () => {describe("resolveCloudMcpResourceUrl", () => {test("heals legacy web-app resources through the /api/den proxy", () => {- expect(resolveCloudMcpResourceUrl("https://app.omnirush.software/mcp/")).toBe(- "https://app.omnirush.software/api/den/mcp",+ expect(resolveCloudMcpResourceUrl("https://app.den.example.com/mcp/")).toBe(+ "https://app.den.example.com/api/den/mcp",);});diff --git a/apps/app/tests/mcp-local-server-recovery.test.ts b/apps/app/tests/mcp-local-server-recovery.test.tsindex 634674c4..4bae8457 100644--- a/apps/app/tests/mcp-local-server-recovery.test.ts+++ b/apps/app/tests/mcp-local-server-recovery.test.ts@@ -119,3 +119,99 @@ describe("bundled Computer Use setup", () => {expect(saved).toEqual([]);});});++describe("bundled UI-control setup", () => {+ const bundledCommand = [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ];+ const bundledEnvironment = {+ ELECTRON_RUN_AS_NODE: "1",+ OMNIRUSH_UI_CONTROL_DISCOVERY: "/Users/me/Library/Application Support/ai.omnirush.desktop/omnirush-ui-control.json",+ };++ async function connectUiControl(desktop: {+ command?: () => Promise<unknown>;+ environment?: () => Promise<unknown>;+ } | null) {+ Object.defineProperty(globalThis, "window", {+ configurable: true,+ value: {+ __OMNIRUSH_ELECTRON__: desktop+ ? {+ invokeDesktop: async (name: string) => {+ if (name === "getOmniRushUiMcpCommand") return desktop.command ? desktop.command() : null;+ if (name === "getOmniRushUiMcpEnvironment") return desktop.environment ? desktop.environment() : null;+ return null;+ },+ }+ : {},+ },+ });+ const server = createOmniRushServerStore({+ startupPreference: () => "server", documentVisible: () => true, developerMode: () => false,+ runtimeWorkspaceId: () => "setup-workspace", activeClient: () => null,+ selectedWorkspaceDisplay: () => ({ id: "setup-workspace", name: "Setup", path: "/tmp/setup", preset: "starter", workspaceType: "local" }),+ restartLocalServer: async () => false, createRemoteWorkspaceFlow: async () => false,+ });+ const saved: Array<Parameters<ReturnType<typeof createOmniRushServerClient>["addMcp"]>[1]> = [];+ const client = {+ ...createOmniRushServerClient({ baseUrl: "http://127.0.0.1:1" }),+ addMcp: async (_workspace: string, payload: Parameters<ReturnType<typeof createOmniRushServerClient>["addMcp"]>[1]) => { saved.push(payload); return { items: [] }; },+ listMcp: async () => ({ items: [] }),+ };+ const getSnapshot: typeof server.getSnapshot = () => ({ ...server.getSnapshot(), omnirushServerStatus: "connected", omnirushServerClient: client });+ const store = createConnectionsStore({+ checkDesktopAppRestriction: () => false, client: () => null, setClient: () => {},+ projectDir: () => "/tmp/setup", selectedWorkspaceId: () => "setup-workspace", selectedWorkspaceRoot: () => "/tmp/setup",+ workspaceType: () => "local", omnirushServer: { ...server, getSnapshot }, runtimeWorkspaceId: () => "setup-workspace", developerMode: () => false,+ });+ const entry = MCP_QUICK_CONNECT.find((item) => item.serverName === "omnirush-ui");+ if (!entry) throw new Error("UI-control catalog entry missing");+ const result = await store.connectMcp(entry);+ return { entry, result, saved };+ }++ test("the catalog carries no npx fallback for the unpublished package", () => {+ const entry = MCP_QUICK_CONNECT.find((item) => item.serverName === "omnirush-ui");+ expect(entry?.command).toEqual([]);+ expect(JSON.stringify(MCP_QUICK_CONNECT)).not.toContain("omnirush-ui-mcp");+ });++ test("saves the bundled desktop launch with its Node-mode environment", async () => {+ const { result, saved } = await connectUiControl({+ command: async () => bundledCommand,+ environment: async () => bundledEnvironment,+ });+ expect(result).toEqual({ ok: true });+ expect(saved).toEqual([{+ name: "omnirush-ui",+ config: { type: "local", enabled: true, command: bundledCommand, environment: bundledEnvironment },+ }]);+ expect(JSON.stringify(saved)).not.toContain("npx");+ });++ test("a missing bundle fails without saving an npx command", async () => {+ const { result, saved } = await connectUiControl({+ command: async () => { throw new Error("The OmniRush.ai UI-control MCP is missing from this build. Reinstall OmniRush.ai."); },+ environment: async () => bundledEnvironment,+ });+ expect(result).toEqual({ ok: false, error: "The OmniRush.ai UI-control MCP is missing from this build. Reinstall OmniRush.ai." });+ expect(saved).toEqual([]);+ });++ test("outside the desktop app it fails without saving anything", async () => {+ const { result, saved } = await connectUiControl(null);+ expect(result.ok).toBe(false);+ expect(saved).toEqual([]);+ });++ test("never saves the app binary without ELECTRON_RUN_AS_NODE", async () => {+ const { result, saved } = await connectUiControl({+ command: async () => bundledCommand,+ environment: async () => { throw new Error("bridge unavailable"); },+ });+ expect(result).toEqual({ ok: false, error: "bridge unavailable" });+ expect(saved).toEqual([]);+ });+});diff --git a/apps/desktop/electron-builder.base.yml b/apps/desktop/electron-builder.base.ymlindex 4f294f1d..16d7afbe 100644--- a/apps/desktop/electron-builder.base.yml+++ b/apps/desktop/electron-builder.base.yml@@ -12,6 +12,12 @@ files:extraResources:- from: .electron-runtime/omnirush-sentry.jsonto: omnirush-sentry.json+ # Bundled UI-control MCP (scripts/prepare-ui-mcp.mjs). Launched with the app's+ # own binary and ELECTRON_RUN_AS_NODE=1; never fetched from a registry.+ - from: .electron-runtime/omnirush-ui-mcp+ to: omnirush-ui-mcp+ filter:+ - index.mjs- from: ../app/distto: app-dist- from: server/dist/opencode-pluginsdiff --git a/apps/desktop/electron/main.mjs b/apps/desktop/electron/main.mjsindex 0a6dcd12..9f001ea5 100644--- a/apps/desktop/electron/main.mjs+++ b/apps/desktop/electron/main.mjs@@ -32,6 +32,7 @@ import {openComputerUseSetupApp,} from "./computer-use.mjs";import { createUiControlServer } from "./ui-control-server.mjs";+import { resolveOmniRushUiMcpLaunch } from "./omnirush-ui-mcp.mjs";import { createApplicationMenu } from "./app-menu.mjs";import { applyBrandAppName } from "./brand-app-name.mjs";import { createBrowserLoginSync } from "./browser-login-sync.mjs";@@ -1315,9 +1316,30 @@ const omnirushAccountStore = createDesktopOmniRushAccountStore({loadSafeStorage: () => require("electron").safeStorage,});+function omnirushUiMcpLaunch() {+ return resolveOmniRushUiMcpLaunch({+ devMode: process.env.OMNIRUSH_DEV_MODE === "1",+ packaged: app.isPackaged,+ execPath: process.execPath,+ resourcesPath: process.resourcesPath,+ repoRoot: path.resolve(__dirname, "../../.."),+ userDataPath: app.getPath("userData"),+ });+}+const runtimeManager = createRuntimeManager({app,desktopRoot: path.resolve(__dirname, ".."),+ // Rewrites persisted `npx -y omnirush-ui-mcp` entries to the bundled launch+ // before the engine starts. Null (bundle missing) removes them instead.+ omnirushUiMcpLaunch: () => {+ try {+ return omnirushUiMcpLaunch();+ } catch (error) {+ console.warn("[ui-control] bundled UI-control MCP unavailable", error);+ return null;+ }+ },listLocalWorkspacePaths: () => workspaceStore.listLocalWorkspacePaths(),// When OMNIRUSH_ENCRYPTION_KEY is set, skip the safeStorage provider so it does not shadow the documented env override used by CI/headless/enterprise.localManagedMcpVaultKey: process.env.OMNIRUSH_ENCRYPTION_KEY?.trim()@@ -1918,10 +1940,7 @@ const desktopCommandHandlers = {}},"getOmniRushUiMcpCommand": async (event, ...args) => {- if (process.env.OMNIRUSH_DEV_MODE === "1") {- return ["node", path.resolve(__dirname, "../../..", "packages/omnirush-ui-mcp/index.mjs")];- }- return ["npx", "-y", "omnirush-ui-mcp"];+ return omnirushUiMcpLaunch().command;},"getComputerUseState": async () => getComputerUseState(),"computerUseAction": async (event, value) => {@@ -1951,9 +1970,9 @@ const desktopCommandHandlers = {return checkComputerUsePermissions();},"getOmniRushUiMcpEnvironment": async (event, ...args) => {- return {- OMNIRUSH_UI_CONTROL_DISCOVERY: path.join(app.getPath("userData"), "omnirush-ui-control.json"),- };+ // Carries ELECTRON_RUN_AS_NODE=1 for packaged launches: the command is+ // this app's own binary, which must run the bundled MCP as plain Node.+ return omnirushUiMcpLaunch().environment;},"getDesktopBootstrapConfig": async (event, ...args) => {return workspaceStore.getDesktopBootstrapConfig();diff --git a/apps/desktop/electron/omnirush-ui-mcp.mjs b/apps/desktop/electron/omnirush-ui-mcp.mjsnew file mode 100644index 00000000..cdfc0ef8--- /dev/null+++ b/apps/desktop/electron/omnirush-ui-mcp.mjs@@ -0,0 +1,69 @@+// Launch command for the built-in UI-control MCP (packages/omnirush-ui-mcp).+//+// Packaged builds ship a self-contained bundle of the MCP under+// <resources>/omnirush-ui-mcp/index.mjs (see scripts/prepare-ui-mcp.mjs and+// electron-builder.base.yml) and run it with the app's own Electron binary in+// Node mode. The package name is not published on npm, so resolving it through+// `npx` would execute whatever a third party publishes under that name: this+// module never returns an npx command, and a packaged build without the bundle+// fails closed instead.+import { existsSync } from "node:fs";+import path from "node:path";++export const OMNIRUSH_UI_MCP_RESOURCE_DIR = "omnirush-ui-mcp";+export const OMNIRUSH_UI_MCP_ENTRY = "index.mjs";+export const OMNIRUSH_UI_CONTROL_DISCOVERY_FILE = "omnirush-ui-control.json";++export function bundledOmniRushUiMcpPath(resourcesPath) {+ return path.join(resourcesPath, OMNIRUSH_UI_MCP_RESOURCE_DIR, OMNIRUSH_UI_MCP_ENTRY);+}++/**+ * Resolve how the engine launches the UI-control MCP.+ *+ * - Dev mode (OMNIRUSH_DEV_MODE=1): the checkout's source entry under the+ * developer's `node`, unchanged from before.+ * - Packaged: the bundled entry under this app's Electron binary with+ * ELECTRON_RUN_AS_NODE=1, so no system Node or package registry is involved.+ * - Unpackaged non-dev runs: the checkout's source entry under this Electron+ * binary in Node mode.+ *+ * @param {{+ * devMode: boolean;+ * packaged: boolean;+ * execPath: string;+ * resourcesPath?: string | null;+ * repoRoot: string;+ * userDataPath: string;+ * exists?: (filePath: string) => boolean;+ * }} input+ * @returns {{ command: string[]; environment: Record<string, string> }}+ */+export function resolveOmniRushUiMcpLaunch(input) {+ const exists = input.exists ?? existsSync;+ const discovery = { OMNIRUSH_UI_CONTROL_DISCOVERY: path.join(input.userDataPath, OMNIRUSH_UI_CONTROL_DISCOVERY_FILE) };+ const sourceEntry = path.join(input.repoRoot, "packages", "omnirush-ui-mcp", OMNIRUSH_UI_MCP_ENTRY);++ if (input.devMode) {+ return { command: ["node", sourceEntry], environment: discovery };+ }++ if (input.packaged) {+ const bundled = input.resourcesPath ? bundledOmniRushUiMcpPath(input.resourcesPath) : null;+ if (!bundled || !exists(bundled)) {+ throw new Error("The OmniRush.ai UI-control MCP is missing from this build. Reinstall OmniRush.ai.");+ }+ return {+ command: [input.execPath, bundled],+ environment: { ...discovery, ELECTRON_RUN_AS_NODE: "1" },+ };+ }++ if (!exists(sourceEntry)) {+ throw new Error("The OmniRush.ai UI-control MCP source is missing from this checkout.");+ }+ return {+ command: [input.execPath, sourceEntry],+ environment: { ...discovery, ELECTRON_RUN_AS_NODE: "1" },+ };+}diff --git a/apps/desktop/electron/omnirush-ui-mcp.test.mjs b/apps/desktop/electron/omnirush-ui-mcp.test.mjsnew file mode 100644index 00000000..b344e01b--- /dev/null+++ b/apps/desktop/electron/omnirush-ui-mcp.test.mjs@@ -0,0 +1,174 @@+import assert from "node:assert/strict";+import { spawnSync } from "node:child_process";+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";+import { createRequire } from "node:module";+import { tmpdir } from "node:os";+import path from "node:path";+import { after, describe, it } from "node:test";+import { fileURLToPath } from "node:url";+import asar from "@electron/asar";+import YAML from "yaml";++import { bundledOmniRushUiMcpPath, resolveOmniRushUiMcpLaunch } from "./omnirush-ui-mcp.mjs";++const require = createRequire(import.meta.url);+const { nonBuiltinImports, verifyBundledUiMcp } = require("../scripts/ui-mcp-bundle.cjs");++const dirname = path.dirname(fileURLToPath(import.meta.url));+const desktopRoot = path.resolve(dirname, "..");+const temporaryRoots = [];++after(() => {+ for (const root of temporaryRoots) rmSync(root, { recursive: true, force: true });+});++function temporaryRoot() {+ const root = mkdtempSync(path.join(tmpdir(), "omnirush-ui-mcp-"));+ temporaryRoots.push(root);+ return root;+}++const EXEC_PATH = "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai";+const RESOURCES = "/Applications/OmniRush.ai.app/Contents/Resources";+const USER_DATA = "/Users/me/Library/Application Support/ai.omnirush.desktop";+const REPO = "/src/omnirush";++describe("UI-control MCP launch command", () => {+ it("launches the bundled resource with the app's own binary in packaged builds", () => {+ const launch = resolveOmniRushUiMcpLaunch({+ devMode: false,+ packaged: true,+ execPath: EXEC_PATH,+ resourcesPath: RESOURCES,+ repoRoot: REPO,+ userDataPath: USER_DATA,+ exists: (filePath) => filePath === bundledOmniRushUiMcpPath(RESOURCES),+ });+ assert.deepEqual(launch, {+ command: [EXEC_PATH, path.join(RESOURCES, "omnirush-ui-mcp", "index.mjs")],+ environment: {+ ELECTRON_RUN_AS_NODE: "1",+ OMNIRUSH_UI_CONTROL_DISCOVERY: path.join(USER_DATA, "omnirush-ui-control.json"),+ },+ });+ assert.ok(!launch.command.includes("npx"));+ });++ it("fails closed instead of falling back to npx when the bundle is missing", () => {+ assert.throws(+ () => resolveOmniRushUiMcpLaunch({+ devMode: false,+ packaged: true,+ execPath: EXEC_PATH,+ resourcesPath: RESOURCES,+ repoRoot: REPO,+ userDataPath: USER_DATA,+ exists: () => false,+ }),+ /missing from this build/,+ );+ assert.throws(+ () => resolveOmniRushUiMcpLaunch({+ devMode: false,+ packaged: true,+ execPath: EXEC_PATH,+ resourcesPath: null,+ repoRoot: REPO,+ userDataPath: USER_DATA,+ exists: () => true,+ }),+ /missing from this build/,+ );+ });++ it("keeps the dev-mode checkout path under the developer's node", () => {+ const launch = resolveOmniRushUiMcpLaunch({+ devMode: true,+ packaged: false,+ execPath: "/repo/node_modules/electron/dist/Electron",+ resourcesPath: "/repo/node_modules/electron/dist/Resources",+ repoRoot: REPO,+ userDataPath: USER_DATA,+ exists: () => false,+ });+ assert.deepEqual(launch.command, ["node", path.join(REPO, "packages", "omnirush-ui-mcp", "index.mjs")]);+ assert.equal(launch.environment.ELECTRON_RUN_AS_NODE, undefined);+ });++ it("runs the checkout source under this Electron binary for unpackaged non-dev launches", () => {+ const electronBinary = "/repo/node_modules/electron/dist/Electron";+ const launch = resolveOmniRushUiMcpLaunch({+ devMode: false,+ packaged: false,+ execPath: electronBinary,+ resourcesPath: "/repo/node_modules/electron/dist/Resources",+ repoRoot: REPO,+ userDataPath: USER_DATA,+ exists: () => true,+ });+ assert.deepEqual(launch.command, [electronBinary, path.join(REPO, "packages", "omnirush-ui-mcp", "index.mjs")]);+ assert.equal(launch.environment.ELECTRON_RUN_AS_NODE, "1");+ });++ it("no longer references the unpublished npm package from the main process", () => {+ const main = readFileSync(path.join(dirname, "main.mjs"), "utf8");+ assert.doesNotMatch(main, /["']npx["']/);+ assert.doesNotMatch(main, /["']omnirush-ui-mcp["']\s*\]/);+ });+});++describe("bundled UI-control MCP packaging", () => {+ it("ships the bundle as an extra resource on every platform", async () => {+ const config = YAML.parse(readFileSync(path.join(desktopRoot, "electron-builder.base.yml"), "utf8"));+ assert.ok(config.extraResources.some((entry) => (+ entry.from === ".electron-runtime/omnirush-ui-mcp"+ && entry.to === "omnirush-ui-mcp"+ && entry.filter?.includes("index.mjs")+ )));+ const build = readFileSync(path.join(desktopRoot, "scripts", "electron-build.mjs"), "utf8");+ assert.match(build, /prepare-ui-mcp\.mjs/);+ });++ it("rejects bundles that still import npm packages", () => {+ assert.deepEqual(nonBuiltinImports([+ 'import { readFile } from "node:fs/promises";',+ 'import process2 from "node:process";',+ 'const codegen = `require("ajv/dist/runtime/equal").default`;',+ ].join("\n")), []);+ assert.deepEqual(nonBuiltinImports([+ 'import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";',+ 'import { z } from "zod";',+ 'const lazy = await import("undici");',+ ].join("\n")), ["@modelcontextprotocol/sdk/server/mcp.js", "undici", "zod"]);+ });++ it("verify-packaged-imports fails the build when the bundled MCP is missing", async () => {+ const root = temporaryRoot();+ const appSource = path.join(root, "app-source");+ mkdirSync(appSource, { recursive: true });+ writeFileSync(path.join(appSource, "package.json"), JSON.stringify({ name: "fixture", main: "main.mjs" }));+ writeFileSync(path.join(appSource, "main.mjs"), 'import "./helper.mjs";\n');+ writeFileSync(path.join(appSource, "helper.mjs"), "export {};\n");+ const resources = path.join(root, "Resources");+ mkdirSync(resources, { recursive: true });+ const archive = path.join(resources, "app.asar");+ await asar.createPackage(appSource, archive);+ const verifier = path.join(desktopRoot, "scripts", "verify-packaged-imports.mjs");++ const missing = spawnSync(process.execPath, [verifier, archive], { encoding: "utf8" });+ assert.equal(missing.status, 1, missing.stdout);+ assert.match(missing.stderr, /missing bundled UI-control MCP/);+ assert.deepEqual(verifyBundledUiMcp(resources).length, 1);++ mkdirSync(path.join(resources, "omnirush-ui-mcp"), { recursive: true });+ writeFileSync(path.join(resources, "omnirush-ui-mcp", "index.mjs"), 'import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";\n');+ const unbundled = spawnSync(process.execPath, [verifier, archive], { encoding: "utf8" });+ assert.equal(unbundled.status, 1, unbundled.stdout);+ assert.match(unbundled.stderr, /imports packages that are not shipped: @modelcontextprotocol\/sdk\/server\/mcp\.js/);++ writeFileSync(path.join(resources, "omnirush-ui-mcp", "index.mjs"), 'import { readFile } from "node:fs/promises";\nvoid readFile;\n');+ const present = spawnSync(process.execPath, [verifier, archive], { encoding: "utf8" });+ assert.equal(present.status, 0, present.stderr);+ assert.match(present.stdout, /bundled UI-control MCP is present and self-contained/);+ });+});diff --git a/apps/desktop/electron/runtime.mjs b/apps/desktop/electron/runtime.mjsindex 2a959c5e..37e30696 100644--- a/apps/desktop/electron/runtime.mjs+++ b/apps/desktop/electron/runtime.mjs@@ -1381,6 +1381,7 @@ export function createRuntimeManager({localManagedMcpVaultKey,omnirushGatewayCredentials = null,appVersion = null,+ omnirushUiMcpLaunch = () => null,workspaceMkdir = mkdir,workspacePlatform = process.platform,}) {@@ -2000,6 +2001,9 @@ export function createRuntimeManager({opencodeCwd: managedOpencodeWorkdir(),localManagedMcpVaultKey,appVersion: typeof appVersion === "string" && appVersion.trim() ? appVersion.trim() : undefined,+ // Bundled UI-control MCP launch for the startup migration of persisted+ // `npx -y omnirush-ui-mcp` entries; null removes those entries instead.+ omnirushUiMcp: omnirushUiMcpLaunch() ?? null,omnirushGatewayCredentials: gatewayCredentials? {...gatewayCredentials,diff --git a/apps/desktop/electron/workspace-store.mjs b/apps/desktop/electron/workspace-store.mjsindex 751a74d4..dd9517ee 100644--- a/apps/desktop/electron/workspace-store.mjs+++ b/apps/desktop/electron/workspace-store.mjs@@ -120,12 +120,17 @@ const LEGACY_DESKTOP_BOOTSTRAP_PATH = resolveLegacyDesktopBootstrapPath({ homeDi// hosts no longer resolve in DNS: older builds materialized them as the// bootstrap default, so a file that still points at them is a stale artifact,// not a configuration. It is rejected on read (defaults apply instead) and on-// write, and nothing here ever contacts these hosts.+// write, and nothing here ever contacts these hosts. The omnirush.software+// hosts are the upstream product's hosted origins; they were never ours and+// have no DNS, so they are rejected the same way.const RETIRED_HOSTED_CONTROL_PLANE_HOSTS = new Set(["omnirushlabs.com","app.omnirushlabs.com","api.omnirushlabs.com","api.app.omnirushlabs.com",+ "omnirush.software",+ "app.omnirush.software",+ "api.omnirush.software",]);export function isRetiredHostedControlPlaneUrl(value) {diff --git a/apps/desktop/electron/workspace-store.test.mjs b/apps/desktop/electron/workspace-store.test.mjsindex a4ecf526..5932d845 100644--- a/apps/desktop/electron/workspace-store.test.mjs+++ b/apps/desktop/electron/workspace-store.test.mjs@@ -570,6 +570,12 @@ test("a bootstrap that points at the retired hosted control plane is rejected onstore.setDesktopBootstrapConfig({ baseUrl: "https://den.example.com", apiBaseUrl: "https://api.omnirushlabs.com", requireSignin: false }),/retired hosted control plane/,);+ for (const foreign of ["https://app.omnirush.software", "https://api.omnirush.software/v1"]) {+ await assert.rejects(+ store.setDesktopBootstrapConfig({ baseUrl: foreign, requireSignin: false }),+ /retired hosted control plane/,+ );+ }});});diff --git a/apps/desktop/package.json b/apps/desktop/package.jsonindex bec7c511..4397df9e 100644--- a/apps/desktop/package.json+++ b/apps/desktop/package.json@@ -27,7 +27,7 @@"prepare:sidecar": "node ./scripts/prepare-sidecar.mjs","pretest": "pnpm --filter @omnirush/headless-threads build","test:omnirush-account": "node --test electron/omnirush-account.test.mjs",- "test": "node --test scripts/prepare-server-constants.test.mjs scripts/verify-update-manifest.test.mjs electron/after-pack-paths.test.mjs electron/agent-context-diagnostics-fetch.test.mjs electron/automation-runner.test.mjs electron/binary-transfer.test.mjs electron/blank-slate-profile.test.mjs electron/blank-slate-profile-isolation.test.mjs electron/brand-app-name.test.mjs electron/brand-icon-darwin.test.mjs electron/brand-icon-windows.test.mjs electron/browser-login-sync.test.mjs electron/browser-panel.test.mjs electron/connect-link.test.mjs electron/desktop-distribution.test.mjs electron/dev-profile.test.mjs electron/electron-builder-config.test.mjs electron/linux-desktop-integration.test.mjs electron/no-bare-external-fetch.test.mjs electron/nuke.test.mjs electron/open-external.test.mjs electron/process-resilience.test.mjs electron/runtime.test.mjs electron/runtime-ca.test.mjs electron/runtime-chain-repair.test.mjs electron/sentry.test.mjs electron/server-dependency-mirror.test.mjs electron/secure-vault-key.test.mjs electron/stdio-errors.test.mjs electron/ui-control-server.test.mjs electron/updater.test.mjs electron/remote-workspace.test.mjs electron/workspace-archive.test.mjs electron/workspace-store.test.mjs",+ "test": "node --test scripts/prepare-server-constants.test.mjs scripts/verify-update-manifest.test.mjs electron/after-pack-paths.test.mjs electron/agent-context-diagnostics-fetch.test.mjs electron/automation-runner.test.mjs electron/binary-transfer.test.mjs electron/blank-slate-profile.test.mjs electron/blank-slate-profile-isolation.test.mjs electron/brand-app-name.test.mjs electron/brand-icon-darwin.test.mjs electron/brand-icon-windows.test.mjs electron/browser-login-sync.test.mjs electron/browser-panel.test.mjs electron/connect-link.test.mjs electron/desktop-distribution.test.mjs electron/dev-profile.test.mjs electron/electron-builder-config.test.mjs electron/linux-desktop-integration.test.mjs electron/no-bare-external-fetch.test.mjs electron/nuke.test.mjs electron/omnirush-ui-mcp.test.mjs electron/open-external.test.mjs electron/process-resilience.test.mjs electron/runtime.test.mjs electron/runtime-ca.test.mjs electron/runtime-chain-repair.test.mjs electron/sentry.test.mjs electron/server-dependency-mirror.test.mjs electron/secure-vault-key.test.mjs electron/stdio-errors.test.mjs electron/ui-control-server.test.mjs electron/updater.test.mjs electron/remote-workspace.test.mjs electron/workspace-archive.test.mjs electron/workspace-store.test.mjs","test:core": "node --test scripts/prepare-server-constants.test.mjs electron/workspace-store.test.mjs electron/workspace-archive.test.mjs electron/connect-link.test.mjs electron/open-external.test.mjs electron/secure-vault-key.test.mjs electron/process-resilience.test.mjs electron/stdio-errors.test.mjs electron/runtime-ca.test.mjs electron/runtime-chain-repair.test.mjs electron/automation-runner.test.mjs","pretest:core": "pnpm --filter @omnirush/headless-threads build"},diff --git a/apps/desktop/scripts/electron-after-pack.cjs b/apps/desktop/scripts/electron-after-pack.cjsindex 2d39cae2..d4e095e5 100644--- a/apps/desktop/scripts/electron-after-pack.cjs+++ b/apps/desktop/scripts/electron-after-pack.cjs@@ -2,6 +2,7 @@ const fs = require("node:fs");const path = require("node:path");const { spawnSync } = require("node:child_process");const asar = require("@electron/asar");+const { verifyBundledUiMcp } = require("./ui-mcp-bundle.cjs");const computerUseHelperAppName = "OmniRush.ai Computer Use.app";@@ -53,6 +54,23 @@ function resolveAppAsarPath(context) {return path.join(context.appOutDir, "resources", "app.asar");}+function resolveResourcesDir(context) {+ if (context.electronPlatformName === "darwin") {+ const appPath = resolveMacAppPath(context);+ return appPath ? path.join(appPath, "Contents", "Resources") : null;+ }+ return path.join(context.appOutDir, "resources");+}++// The UI-control extension launches <resources>/omnirush-ui-mcp/index.mjs with+// the app's own binary; a package without it must not ship.+function verifyUiControlMcpBundle(context) {+ const resourcesDir = resolveResourcesDir(context);+ if (!resourcesDir) throw new Error(`Missing packaged resources directory under ${context.appOutDir}`);+ const problems = verifyBundledUiMcp(resourcesDir);+ if (problems.length) throw new Error(problems.join("\n"));+}+function normalizeAsarEntryPath(entry, separator) {return entry.split(separator).join("/");}@@ -139,6 +157,7 @@ function copyExecutableTargetToAlias(sidecarsDir, targetName, aliasName) {async function afterPack(context) {verifyRuntimeDependencies(context);+ verifyUiControlMcpBundle(context);const triple = targetTriple(context.electronPlatformName, context.arch);if (!triple) return;diff --git a/apps/desktop/scripts/electron-build.mjs b/apps/desktop/scripts/electron-build.mjsindex b7f34e67..a37d1da6 100644--- a/apps/desktop/scripts/electron-build.mjs+++ b/apps/desktop/scripts/electron-build.mjs@@ -12,6 +12,7 @@ const electronHelperDir = resolve(desktopRoot, "resources", "helpers");const electronRoot = resolve(desktopRoot, "electron");const packagedServerRoot = resolve(desktopRoot, "server");const packagedRuntimeRoot = resolve(desktopRoot, ".electron-runtime", "node_modules");+const packagedUiMcpRoot = resolve(desktopRoot, ".electron-runtime", "omnirush-ui-mcp");const sentryBuildConfigPath = resolve(desktopRoot, ".electron-runtime", "omnirush-sentry.json");const pnpmCmd = process.platform === "win32" ? "pnpm.cmd" : "pnpm";@@ -49,6 +50,9 @@ function writeSentryBuildConfig() {run(nodeCmd, [resolve(__dirname, "prepare-sidecar.mjs"), "--force", "--outdir", electronSidecarDir], desktopRoot);run(nodeCmd, [resolve(__dirname, "prepare-computer-use-helper.mjs"), "--force", "--outdir", electronHelperDir], desktopRoot);run(nodeCmd, [resolve(__dirname, "prepare-runtime-node-modules.mjs"), "--outdir", packagedRuntimeRoot], desktopRoot);+// The built-in UI-control MCP ships inside the app as one bundled module and+// runs under the app's own binary; packaged builds never resolve it from npm.+run(nodeCmd, [resolve(__dirname, "prepare-ui-mcp.mjs"), "--outdir", packagedUiMcpRoot], desktopRoot);writeSentryBuildConfig();// Build the server TS → JS so Electron can import it in-process// CI already compiles this exact checkout in the required build job.diff --git a/apps/desktop/scripts/prepare-ui-mcp.mjs b/apps/desktop/scripts/prepare-ui-mcp.mjsnew file mode 100644index 00000000..74a13f5f--- /dev/null+++ b/apps/desktop/scripts/prepare-ui-mcp.mjs@@ -0,0 +1,54 @@+// Bundle the built-in UI-control MCP (packages/omnirush-ui-mcp) into one+// self-contained ES module that electron-builder ships as an extra resource+// (<resources>/omnirush-ui-mcp/index.mjs). The packaged app launches it with its+// own Electron binary in Node mode, so the bundle may import only Node+// built-ins: every npm dependency is inlined here, at build time.+//+// Usage: node scripts/prepare-ui-mcp.mjs [--outdir <dir>]+import { spawnSync } from "node:child_process";+import { existsSync, mkdirSync, rmSync } from "node:fs";+import { createRequire } from "node:module";+import { dirname, join, resolve } from "node:path";+import { fileURLToPath } from "node:url";++const { verifyUiMcpBundleFile, UI_MCP_ENTRY } = createRequire(import.meta.url)("./ui-mcp-bundle.cjs");++const scriptsDir = dirname(fileURLToPath(import.meta.url));+const desktopRoot = resolve(scriptsDir, "..");+const repoRoot = resolve(desktopRoot, "../..");+const entry = resolve(repoRoot, "packages", "omnirush-ui-mcp", "index.mjs");+const defaultOutdir = resolve(desktopRoot, ".electron-runtime", "omnirush-ui-mcp");++function parseOutdir(argv) {+ const index = argv.indexOf("--outdir");+ return index >= 0 && argv[index + 1] ? resolve(argv[index + 1]) : defaultOutdir;+}++export function prepareUiMcp(outdir = defaultOutdir) {+ if (!existsSync(entry)) throw new Error(`UI-control MCP entry is missing: ${entry}`);+ rmSync(outdir, { recursive: true, force: true });+ mkdirSync(outdir, { recursive: true });+ const outfile = join(outdir, UI_MCP_ENTRY);+ // Bun already builds the server's OpenCode plugins; CI installs it for every+ // desktop packaging job.+ const result = spawnSync("bun", [+ "build",+ entry,+ "--target", "node",+ "--format", "esm",+ "--outfile", outfile,+ ], { cwd: repoRoot, stdio: "inherit" });+ if (result.error) throw result.error;+ if (result.status !== 0) throw new Error(`bun build failed for the UI-control MCP (status ${result.status}).`);++ const problems = verifyUiMcpBundleFile(outfile);+ if (problems.length) throw new Error(problems.join("\n"));+ const check = spawnSync(process.execPath, ["--check", outfile], { stdio: "inherit" });+ if (check.status !== 0) throw new Error("The UI-control MCP bundle failed node --check.");+ return outfile;+}++if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {+ const outfile = prepareUiMcp(parseOutdir(process.argv.slice(2)));+ process.stdout.write(`[prepare-ui-mcp] bundled ${outfile}\n`);+}diff --git a/apps/desktop/scripts/ui-mcp-bundle.cjs b/apps/desktop/scripts/ui-mcp-bundle.cjsnew file mode 100644index 00000000..8879628b--- /dev/null+++ b/apps/desktop/scripts/ui-mcp-bundle.cjs@@ -0,0 +1,63 @@+// Shared checks for the bundled UI-control MCP resource. Used by the bundler+// (prepare-ui-mcp.mjs), the electron-builder afterPack hook, and+// verify-packaged-imports.mjs so a package without a runnable bundle fails the+// build instead of shipping a UI-control extension that cannot start.+const fs = require("node:fs");+const path = require("node:path");++const UI_MCP_RESOURCE_DIR = "omnirush-ui-mcp";+const UI_MCP_ENTRY = "index.mjs";++/** Module specifiers the bundle imports statically or dynamically. */+function bundleImportSpecifiers(source) {+ const specifiers = new Set();+ const patterns = [+ /^\s*import\s+(?:[^"';]*?\s+from\s+)?["']([^"']+)["']/gm,+ /^\s*export\s+[^"';]*?\s+from\s+["']([^"']+)["']/gm,+ /\bimport\(\s*["']([^"']+)["']\s*\)/g,+ ];+ for (const pattern of patterns) {+ for (const match of source.matchAll(pattern)) specifiers.add(match[1]);+ }+ return [...specifiers].sort();+}++/** Everything the bundle imports must be a Node built-in: npm packages are inlined at build time. */+function nonBuiltinImports(source) {+ return bundleImportSpecifiers(source).filter((specifier) => !specifier.startsWith("node:"));+}++function bundledUiMcpPath(resourcesDir) {+ return path.join(resourcesDir, UI_MCP_RESOURCE_DIR, UI_MCP_ENTRY);+}++/** Problems with the bundled UI-control MCP under a packaged resources directory; empty when it is shippable. */+function verifyBundledUiMcp(resourcesDir) {+ return verifyUiMcpBundleFile(bundledUiMcpPath(resourcesDir));+}++/** Problems with one bundled UI-control MCP file; empty when it is shippable. */+function verifyUiMcpBundleFile(bundlePath) {+ let source;+ try {+ source = fs.readFileSync(bundlePath, "utf8");+ } catch {+ return [`missing bundled UI-control MCP at ${bundlePath}`];+ }+ if (!source.trim()) return [`empty bundled UI-control MCP at ${bundlePath}`];+ const external = nonBuiltinImports(source);+ if (external.length) {+ return [`bundled UI-control MCP at ${bundlePath} imports packages that are not shipped: ${external.join(", ")}`];+ }+ return [];+}++module.exports = {+ UI_MCP_ENTRY,+ UI_MCP_RESOURCE_DIR,+ bundleImportSpecifiers,+ bundledUiMcpPath,+ nonBuiltinImports,+ verifyBundledUiMcp,+ verifyUiMcpBundleFile,+};diff --git a/apps/desktop/scripts/verify-packaged-imports.mjs b/apps/desktop/scripts/verify-packaged-imports.mjsindex da59d63b..c0a910f6 100644--- a/apps/desktop/scripts/verify-packaged-imports.mjs+++ b/apps/desktop/scripts/verify-packaged-imports.mjs@@ -8,13 +8,21 @@// This walks every JavaScript module inside each app.asar and verifies that// every relative import target exists inside the same archive.//+// It also verifies that the resources directory next to each app.asar ships+// the bundled UI-control MCP (omnirush-ui-mcp/index.mjs) as a self-contained+// module: the app launches that file with its own binary and never falls back+// to resolving the package from npm.+//// Usage: node apps/desktop/scripts/verify-packaged-imports.mjs [app.asar ...]// With no arguments it scans apps/desktop/dist-electron/** for app.asar files.import { readdirSync, statSync } from "node:fs";+import { createRequire } from "node:module";import { dirname, join, posix, resolve } from "node:path";import { fileURLToPath } from "node:url";import asar from "@electron/asar";+const { verifyBundledUiMcp } = createRequire(import.meta.url)("./ui-mcp-bundle.cjs");+const here = dirname(fileURLToPath(import.meta.url));const distElectron = resolve(here, "..", "dist-electron");@@ -103,5 +111,12 @@ for (const target of targets) {} else {console.log(`[verify-packaged-imports] ${target}: ${modules} modules, all relative imports resolve inside the archive`);}+ const uiMcpProblems = verifyBundledUiMcp(dirname(target));+ if (uiMcpProblems.length) {+ failed = true;+ for (const line of uiMcpProblems) console.error(`[verify-packaged-imports] ${target}: ${line}`);+ } else {+ console.log(`[verify-packaged-imports] ${target}: bundled UI-control MCP is present and self-contained`);+ }}process.exit(failed ? 1 : 0);diff --git a/apps/server/src/agent-context-cloud-probe.test.ts b/apps/server/src/agent-context-cloud-probe.test.tsindex 0a2a93e9..4e61ab54 100644--- a/apps/server/src/agent-context-cloud-probe.test.ts+++ b/apps/server/src/agent-context-cloud-probe.test.ts@@ -10,7 +10,17 @@ import {} from "./agent-context-cloud-probe.js";const TOKEN = "Bearer ow_diagnostics_token_abcdefghijklmnopqrstuvwxyz";-const ENDPOINT = "https://app.omnirushlabs.com/api/den/mcp/agent";+/** Administrator-activated enterprise Den origin: the only non-loopback origin trusted by default. */+const DEN_ORIGIN = "https://den.example.com";+const ENDPOINT = `${DEN_ORIGIN}/api/den/mcp/agent`;+/** Retired hosted Den origins that used to be trusted as built-ins. */+const RETIRED_HOSTED_ORIGINS = [+ "https://app.omnirushlabs.com",+ "https://api.omnirushlabs.com",+ "https://api.app.omnirushlabs.com",+ "https://app.omnirush.software",+ "https://api.omnirush.software",+];const SESSION_ID = "diagnostics-session-id";const PROTOCOL_VERSION = "2025-06-18";@@ -31,6 +41,7 @@ function input(overrides: Partial<ProbeOmniRushCloudCatalogInput> = {}): ProbeOmengineRegistration: { status: "connected", source: "engine_status", recordAgeMs: 1_000 },requestId: "11111111-1111-4111-8111-111111111111",env: {},+ activatedEnterpriseOrigin: DEN_ORIGIN,...values,...(fetchImpl ? { fetchImpl: withCompletedHandshake(fetchImpl) } : {}),};@@ -186,8 +197,8 @@ describe("OmniRush.ai Cloud catalog probe", () => {status: "observed",stage: "complete",code: "catalog_observed",- trustSource: "builtin-cloud",- enterpriseActivationPresent: false,+ trustSource: "enterprise-activation",+ enterpriseActivationPresent: true,networkCode: null,retryable: false,runtimeFamily: "bun",@@ -293,11 +304,11 @@ describe("OmniRush.ai Cloud catalog probe", () => {[{ config: null }, "cloud_mcp_missing"],[{ config: { type: "local", enabled: true } }, "cloud_mcp_not_remote"],[{ config: { type: "remote", enabled: false, url: ENDPOINT } }, "cloud_mcp_disabled"],- [{ config: { type: "remote", enabled: true, url: "https://app.omnirushlabs.com/api/den/mcp/agent?token=secret", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],- [{ config: { type: "remote", enabled: true, url: "https://app.omnirushlabs.com/api/den/mcp/agent/", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],- [{ config: { type: "remote", enabled: true, url: "https://app.omnirushlabs.com/api/den/mcp/agent/status", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],- [{ config: { type: "remote", enabled: true, url: "https://app.omnirushlabs.com/api/den/mcp/agentish", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],- [{ config: { type: "remote", enabled: true, url: "http://app.omnirushlabs.com/mcp/agent", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],+ [{ config: { type: "remote", enabled: true, url: "https://den.example.com/api/den/mcp/agent?token=secret", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],+ [{ config: { type: "remote", enabled: true, url: "https://den.example.com/api/den/mcp/agent/", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],+ [{ config: { type: "remote", enabled: true, url: "https://den.example.com/api/den/mcp/agent/status", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],+ [{ config: { type: "remote", enabled: true, url: "https://den.example.com/api/den/mcp/agentish", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],+ [{ config: { type: "remote", enabled: true, url: "http://den.example.com/mcp/agent", headers: { Authorization: TOKEN } } }, "invalid_endpoint"],[{ config: { type: "remote", enabled: true, url: "https://localhost.evil/mcp/agent", headers: { Authorization: TOKEN } } }, "untrusted_endpoint"],];for (const [overrides, code] of cases) {@@ -335,6 +346,34 @@ describe("OmniRush.ai Cloud catalog probe", () => {}});+ test("rejects the retired hosted Den origins that used to be built-in", async () => {+ let calls = 0;+ const fetchImpl: CloudCatalogProbeFetch = async () => {+ calls += 1;+ return jsonResponse("unused");+ };+ for (const activatedEnterpriseOrigin of [null, DEN_ORIGIN]) {+ for (const origin of RETIRED_HOSTED_ORIGINS) {+ for (const path of ["/mcp/agent", "/api/den/mcp/agent"]) {+ const blocked = await probeOmniRushCloudCatalog(input({+ requestId: "retired-origin",+ activatedEnterpriseOrigin,+ config: { type: "remote", enabled: true, url: `${origin}${path}`, headers: { Authorization: TOKEN } },+ fetchImpl,+ }));+ expect(blocked).toMatchObject({+ performed: false,+ status: "not-performed",+ stage: "eligibility",+ code: "untrusted_endpoint",+ trustSource: "untrusted",+ });+ }+ }+ }+ expect(calls).toBe(0);+ });+test("allows exact loopback and explicitly configured HTTPS origins only", async () => {let blockedCalls = 0;const blocked = await probeOmniRushCloudCatalog(input({@@ -1003,8 +1042,8 @@ describe("OmniRush.ai Cloud catalog probe", () => {retryable: false,runtimeFamily: "bun",transport: "test-seam",- trustSource: "builtin-cloud",- enterpriseActivationPresent: false,+ trustSource: "enterprise-activation",+ enterpriseActivationPresent: true,httpStatus: 200,durationMs: 1,toolsListPerformed: true,@@ -1078,12 +1117,7 @@ describe("OmniRush.ai Cloud catalog probe", () => {enterpriseEndpoint,enterpriseEndpoint,]);- const omniRushHostedOrigins = new Set([- "https://omnirushlabs.com",- "https://api.omnirushlabs.com",- "https://app.omnirushlabs.com",- ]);- expect(requestedUrls.some((url) => omniRushHostedOrigins.has(new URL(url).origin))).toBe(false);+ expect(requestedUrls.some((url) => RETIRED_HOSTED_ORIGINS.includes(new URL(url).origin))).toBe(false);expect(activated).toMatchObject({performed: true,status: "observed",@@ -1116,6 +1150,7 @@ describe("OmniRush.ai Cloud catalog probe", () => {const unactivated = await probeOmniRushCloudCatalog(input({requestId: "enterprise-absent",config: enterpriseConfig,+ activatedEnterpriseOrigin: null,fetchImpl: async () => {unactivatedCalls += 1;return jsonResponse("enterprise-absent");diff --git a/apps/server/src/agent-context-cloud-probe.ts b/apps/server/src/agent-context-cloud-probe.tsindex 01a54799..7f459b88 100644--- a/apps/server/src/agent-context-cloud-probe.ts+++ b/apps/server/src/agent-context-cloud-probe.ts@@ -26,10 +26,6 @@ const REQUIRED_TOOL_IDS = ["search_capabilities", "execute_capability"] as constconst BEARER = /^Bearer [A-Za-z0-9\-._~+/]+=*$/;const REQUEST_ID = /^[A-Za-z0-9_.:-]{1,128}$/;const REQUIRED_TERMINAL_PATH = "/mcp/agent";-const DEFAULT_TRUSTED_ORIGINS = new Set([- "https://app.omnirushlabs.com",- "https://api.omnirushlabs.com",-]);export type CloudCatalogProbeStatus = "observed" | "not-performed" | "failed";@@ -139,7 +135,6 @@ export type CloudRuntimeEngineDifferential =* misconfiguration — without the report ever carrying a hostname.*/export type CloudEndpointTrustSource =- | "builtin-cloud"| "loopback"| "administrator-env"| "enterprise-activation"@@ -261,7 +256,6 @@ function resolveTrustSource(activatedEnterpriseOrigin?: string | null,): CloudEndpointTrustSource {if (isLoopbackHostname(endpoint.hostname)) return "loopback";- if (DEFAULT_TRUSTED_ORIGINS.has(endpoint.origin)) return "builtin-cloud";if (activatedEnterpriseOrigin && endpoint.origin === activatedEnterpriseOrigin) {return "enterprise-activation";}@@ -295,14 +289,13 @@ function isLoopbackHostname(hostname: string): boolean {}/**- * Origins the credentialed diagnostic request may reach: built-in OmniRush.ai- * Cloud origins plus exact administrator-configured diagnostic origins. An- * enterprise/on-prem Den origin must be provisioned through the same explicit- * administrator setting; the desktop bootstrap's Den activation state is not- * visible to this server process, so it can never widen this list implicitly.+ * Origins the credentialed diagnostic request may reach: the activated+ * enterprise/on-prem Den origin plus exact administrator-configured diagnostic+ * origins. There are no built-in hosted origins: omnirush.ai runs no hosted+ * Den, and the retired hosted Den domains are not ours to send credentials to.*/function configuredTrustedOrigins(activatedEnterpriseOrigin?: string | null): Set<string> {- const origins = new Set(DEFAULT_TRUSTED_ORIGINS);+ const origins = new Set<string>();// The activated enterprise/on-prem control-plane origin is administrator// provisioned (written only after a signed activation claim verifies), so// it joins the allowlist as an exact origin without an explicit override.diff --git a/apps/server/src/agent-context-diagnostics.test.ts b/apps/server/src/agent-context-diagnostics.test.tsindex e7ecff32..5c8dcf7a 100644--- a/apps/server/src/agent-context-diagnostics.test.ts+++ b/apps/server/src/agent-context-diagnostics.test.ts@@ -1085,12 +1085,7 @@ describe("agent context diagnostics analyzer", () => {"https://den.customer.example/custom/mcp/agent","https://den.customer.example/custom/mcp/agent",]);- const omniRushHostedOrigins = new Set([- "https://omnirushlabs.com",- "https://api.omnirushlabs.com",- "https://app.omnirushlabs.com",- ]);- expect(fetchCalls.some((call) => omniRushHostedOrigins.has(new URL(call.url).origin))).toBe(false);+ expect(fetchCalls.some((call) => new URL(call.url).origin !== "https://den.customer.example")).toBe(false);expect(report.mcps).toContainEqual(expect.objectContaining({name: "omnirush-cloud",source: "config.remote",@@ -1132,6 +1127,43 @@ describe("agent context diagnostics analyzer", () => {expect(JSON.stringify(report)).not.toContain("den.other.example");});+ test("treats the retired hosted Den origins as untrusted", async () => {+ const retiredEndpoints = [+ "https://app.omnirushlabs.com/api/den/mcp/agent",+ "https://api.omnirushlabs.com/mcp/agent",+ "https://api.app.omnirushlabs.com/mcp/agent",+ "https://app.omnirush.software/api/den/mcp/agent",+ "https://api.omnirush.software/mcp/agent",+ ];+ for (const url of retiredEndpoints) {+ for (const activatedOrigin of [null, "https://den.customer.example"]) {+ const runtime = diagnosticRuntimeConfig();+ if (!runtime.mcp) throw new Error("Expected the diagnostics MCP fixture.");+ runtime.mcp["omnirush-cloud"] = { ...cloudConfig(), url };+ const fixture = await createFixture({ runtime });+ const fetchCalls: CatalogFetchCall[] = [];++ const report = agentContextDiagnosticsReportSchema.parse(await runAgentContextDiagnostics({+ config: fixture.config,+ workspace: fixture.workspace,+ request: emptyObservedRequest,+ inspectRegistration: () => "connected",+ dependencies: {+ fetchImpl: catalogFetch(["search_capabilities", "execute_capability"], fetchCalls),+ inspectEffectiveEngine: effectiveEngineInspection(runtime),+ readActivatedEnterpriseOrigin: async () => activatedOrigin,+ },+ }));++ expect(checkById(report, "cloud-tool-catalog")).toMatchObject({+ code: "untrusted_endpoint",+ details: { requestPerformed: false, trustSource: "untrusted" },+ });+ expect(fetchCalls).toEqual([]);+ }+ }+ });+test("fails closed when the effective engine response is invalid or unavailable", async () => {const fixture = await createFixture();const fetchCalls: CatalogFetchCall[] = [];diff --git a/apps/server/src/agent-context-engine-inspection.test.ts b/apps/server/src/agent-context-engine-inspection.test.tsindex 4ed288df..94abd7b3 100644--- a/apps/server/src/agent-context-engine-inspection.test.ts+++ b/apps/server/src/agent-context-engine-inspection.test.ts@@ -24,7 +24,7 @@ describe("agent diagnostics effective engine inspection", () => {mcp: {"omnirush-cloud": {type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: "https://den.example.com/mcp/agent",headers: { Authorization: "Bearer NOT_REPORTED" },},},diff --git a/apps/server/src/cli.ts b/apps/server/src/cli.tsindex b4d43aec..4be595da 100644--- a/apps/server/src/cli.ts+++ b/apps/server/src/cli.ts@@ -26,6 +26,7 @@ import { findManagedEngineWorkspace } from "./workspaces.js";import { keepOmniRushRuntimeConfigFileFresh, writeOmniRushRuntimeConfigFile } from "./omnirush-runtime-config.js";import { migrateOmniRushCloudMcpRuntimeConfig } from "./cloud-mcp-health.js";import { migrateWorkspaceRuntimeConfigToEngineGlobal } from "./runtime-opencode-config-store.js";+import { migrateLegacyOmniRushUiMcpCommand } from "./omnirush-ui-mcp-migration.js";import { resolveOpencodeModelsEnv } from "./opencode-models-url.js";import { assertOpencodeConfigCompat } from "./opencode-config-compat.js";import { startWorkerActivityHeartbeat } from "./worker-activity-heartbeat.js";@@ -52,6 +53,10 @@ let enginePool: EnginePool | null = null;if (!config.readOnly) {await ensureLocalWorkspaceFiles(config.workspaces);+ // A standalone server has no bundled UI-control MCP: remove any persisted+ // `npx -y omnirush-ui-mcp` entry rather than letting the engine resolve it.+ // First among the runtime-DB migrations (see migrateLegacyOmniRushUiMcpCommand).+ await migrateLegacyOmniRushUiMcpCommand(config, null);await migrateOmniRushCloudMcpRuntimeConfig(config);await migrateWorkspaceRuntimeConfigToEngineGlobal(config);}diff --git a/apps/server/src/cloud-mcp-health.test.ts b/apps/server/src/cloud-mcp-health.test.tsindex a3714dc6..68e6a056 100644--- a/apps/server/src/cloud-mcp-health.test.ts+++ b/apps/server/src/cloud-mcp-health.test.ts@@ -1,6 +1,6 @@-import { afterEach, describe, expect, test } from "bun:test";+import { afterEach, beforeEach, describe, expect, test } from "bun:test";import { createOpencodeClient } from "@opencode-ai/sdk/v2/client";-import { mkdtemp, rm } from "node:fs/promises";+import { mkdtemp, rm, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";import {@@ -9,6 +9,7 @@ import {calculateCloudMcpDesiredRevision,clearOmniRushCloudMcpProbeFlights,cloudMcpTokenHealthFromConfig,+ isTrustedCloudMcpEndpointForGlobalPersist,OMNIRUSH_CLOUD_EXPECTED_TOOLS,OMNIRUSH_CLOUD_PLUGIN_CANARIES,migrateOmniRushCloudMcpRuntimeConfig,@@ -34,7 +35,10 @@ const workspace: WorkspaceInfo = {};const previousRuntimeDb = process.env.OMNIRUSH_RUNTIME_DB;+const previousBootstrapPath = process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;const previousFetch = globalThis.fetch;+/** Administrator-activated enterprise Den origin used by trusted fixtures. */+const DEN = "https://den.example.com";const roots: string[] = [];const runtimeDbRoots: string[] = [];const stops: Array<() => void> = [];@@ -60,6 +64,22 @@ afterEach(async () => {}if (previousRuntimeDb === undefined) delete process.env.OMNIRUSH_RUNTIME_DB;else process.env.OMNIRUSH_RUNTIME_DB = previousRuntimeDb;+ if (previousBootstrapPath === undefined) delete process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;+ else process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = previousBootstrapPath;+});++async function activateEnterpriseDen(origin: string | null): Promise<void> {+ const root = await createRoot("omnirush-cloud-mcp-bootstrap-");+ const path = join(root, "desktop-bootstrap.json");+ await writeFile(path, JSON.stringify(origin+ ? { baseUrl: origin, enterpriseActivation: { activatedAt: "2026-09-22T00:00:00.000Z", denBaseUrl: origin } }+ : {}), "utf8");+ process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = path;+}++beforeEach(async () => {+ // Trust decisions read desktop activation state; never read the real one.+ await activateEnterpriseDen(DEN);});async function createRoot(prefix: string): Promise<string> {@@ -328,7 +348,7 @@ describe("cloud MCP health foundation", () => {test("desired revisions detect token changes without exposing reusable auth fingerprints", async () => {const config = {type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: `${DEN}/mcp/agent`,headers: { Authorization: "Bearer owt_super_secret" },oauth: false,};@@ -397,7 +417,7 @@ describe("cloud MCP health foundation", () => {process.env.OMNIRUSH_RUNTIME_DB = await createRuntimeDbPath("omnirush-cloud-migration-runtime-");// Trusted origins: promotion to account-global scope refuses anything else.const older = { type: "remote", url: "http://127.0.0.1:4801/mcp/agent", enabled: true, headers: { Authorization: "Bearer older" }, oauth: false };- const newer = { ...older, url: "https://api.omnirushlabs.com/mcp/agent", headers: { Authorization: "Bearer newer" } };+ const newer = { ...older, url: `${DEN}/mcp/agent`, headers: { Authorization: "Bearer newer" } };await writeRuntimeOpencodeConfig(config, workspaceA.id, () => ({plugin: ["keep-a"],mcp: { "omnirush-cloud": older, posthog: { type: "remote", url: "https://posthog.example/mcp" } },@@ -453,6 +473,48 @@ describe("cloud MCP health foundation", () => {expect((await readRuntimeOpencodeConfig(config, workspaceA.id)).mcp?.["omnirush-cloud"]).toEqual(untrusted);});+ test("does not promote a retired hosted endpoint to account-global scope", async () => {+ await activateEnterpriseDen(null);+ const root = await createRoot("omnirush-cloud-migration-retired-");+ const workspaceA = { ...workspace, id: "ws_a", path: join(root, "a") };+ const config = serverConfig(root, workspaceA);+ config.workspaces = [workspaceA];+ process.env.OMNIRUSH_RUNTIME_DB = await createRuntimeDbPath("omnirush-cloud-migration-retired-runtime-");+ const retired = { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent", enabled: true, headers: { Authorization: "Bearer stale" }, oauth: false };+ await writeRuntimeOpencodeConfig(config, workspaceA.id, () => ({ mcp: { "omnirush-cloud": retired } }));++ expect(await migrateOmniRushCloudMcpRuntimeConfig(config)).toEqual({ config: null, changed: false });+ expect((await readGlobalRuntimeOpencodeConfig(config)).mcp?.["omnirush-cloud"]).toBeUndefined();+ expect((await readRuntimeOpencodeConfig(config, workspaceA.id)).mcp?.["omnirush-cloud"]).toEqual(retired);+ });++ test("trusts only loopback and the activated Den origin for a global Connect endpoint", async () => {+ expect(await isTrustedCloudMcpEndpointForGlobalPersist(`${DEN}/mcp/agent`)).toBe(true);+ expect(await isTrustedCloudMcpEndpointForGlobalPersist(`${DEN}/api/den/mcp/agent`)).toBe(true);+ expect(await isTrustedCloudMcpEndpointForGlobalPersist("http://127.0.0.1:4801/mcp/agent")).toBe(true);+ expect(await isTrustedCloudMcpEndpointForGlobalPersist("https://evil.example/mcp/agent")).toBe(false);++ const retired = [+ "https://api.omnirushlabs.com/mcp/agent",+ "https://api.app.omnirushlabs.com/mcp/agent",+ "https://app.omnirushlabs.com/api/den/mcp/agent",+ "https://api.omnirush.software/mcp/agent",+ "https://app.omnirush.software/api/den/mcp/agent",+ ];+ for (const activation of [DEN, null]) {+ await activateEnterpriseDen(activation);+ for (const url of retired) {+ expect(await isTrustedCloudMcpEndpointForGlobalPersist(url)).toBe(false);+ }+ }++ // The app-gateway endpoint is no longer rewritten onto the retired api+ // host: it keeps its own origin, so trusting that api host (the old+ // rewrite target) does not make the gateway endpoint trusted.+ await activateEnterpriseDen("https://api.app.omnirushlabs.com");+ expect(await isTrustedCloudMcpEndpointForGlobalPersist("https://app.omnirushlabs.com/api/den/mcp/agent")).toBe(false);+ });+test("does not mutate legacy rows while the server is read-only", async () => {const root = await createRoot("omnirush-cloud-readonly-migration-");const config = serverConfig(root, workspace);diff --git a/apps/server/src/cloud-mcp-health.ts b/apps/server/src/cloud-mcp-health.tsindex c995891f..2ba36aa1 100644--- a/apps/server/src/cloud-mcp-health.ts+++ b/apps/server/src/cloud-mcp-health.ts@@ -676,11 +676,6 @@ function normalizeCloudEndpointUrl(value: string): string | null {if (url.search || url.hash) return null;const normalizedPath = url.pathname.replace(/\/+$/, "") || "/";if (!normalizedPath.endsWith("/mcp/agent")) return null;- if (url.protocol === "https:" && url.hostname.toLowerCase() === "app.omnirushlabs.com" && normalizedPath === "/api/den/mcp/agent") {- url.hostname = "api.app.omnirushlabs.com";- url.pathname = "/mcp/agent";- return url.toString();- }url.pathname = normalizedPath;return url.toString();} catch {@@ -694,11 +689,6 @@ function canonicalizeCloudMcpConfig(config: Record<string, unknown>): Record<strreturn normalizedUrl ? { ...config, url: normalizedUrl } : config;}-const BUILT_IN_CLOUD_MCP_ORIGINS = new Set([- "https://api.omnirushlabs.com",- "https://api.app.omnirushlabs.com",-]);-function isLoopbackHostname(hostname: string): boolean {const normalized = hostname.toLowerCase();return normalized === "localhost" || normalized === "127.0.0.1" || normalized === "[::1]" || normalized === "::1";@@ -709,9 +699,10 @@ function isLoopbackHostname(hostname: string): boolean {* account-global desired config by a collaborator-scoped client.** The desired config is global: one write reconfigures Connect for every- * workspace this server hosts. Built-in OmniRush.ai Cloud origins, the- * administrator-activated enterprise Den origin, and loopback (local- * development Dens) are trusted; anything else requires owner scope so a+ * workspace this server hosts. Only the administrator-activated enterprise Den+ * origin and loopback (local development Dens) are trusted. There are no+ * built-in hosted origins (omnirush.ai runs no hosted Den and the retired+ * hosted Den domains are not ours); anything else requires owner scope so a* collaborator on one shared workspace cannot silently redirect every other* workspace's Connect tools to an attacker-controlled endpoint.*/@@ -729,7 +720,6 @@ export async function isTrustedCloudMcpEndpointForGlobalPersist(rawUrl: string):}if (isLoopbackHostname(url.hostname)) return true;if (url.protocol !== "https:") return false;- if (BUILT_IN_CLOUD_MCP_ORIGINS.has(url.origin)) return true;const { readActivatedEnterpriseDenOrigin } = await import("./enterprise-den-origin.js");const enterpriseOrigin = await readActivatedEnterpriseDenOrigin();return enterpriseOrigin !== null && url.origin === enterpriseOrigin;diff --git a/apps/server/src/cloud-mcp-reconcile.e2e.test.ts b/apps/server/src/cloud-mcp-reconcile.e2e.test.tsindex 0a6a27f6..6377a27b 100644--- a/apps/server/src/cloud-mcp-reconcile.e2e.test.ts+++ b/apps/server/src/cloud-mcp-reconcile.e2e.test.ts@@ -1,4 +1,4 @@-import { afterEach, describe, expect, test } from "bun:test";+import { afterEach, beforeEach, describe, expect, test } from "bun:test";import { mkdtemp, rm, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";@@ -52,6 +52,9 @@ const HOST_TOKEN = "owt_cloud_mcp_host";const APP_HOST_AUTHORIZATION = "Bearer owt_secret_app_host_token";const previousRuntimeDb = process.env.OMNIRUSH_RUNTIME_DB;const previousDevMode = process.env.OMNIRUSH_DEV_MODE;+const previousBootstrapPath = process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;+/** Administrator-activated enterprise Den origin: trusted for collaborator reconciles. */+const DEN = "https://den.example.com";const stops: Array<() => void | Promise<void>> = [];const roots: string[] = [];const runtimeDbRoots: string[] = [];@@ -74,6 +77,19 @@ afterEach(async () => {else process.env.OMNIRUSH_RUNTIME_DB = previousRuntimeDb;if (previousDevMode === undefined) delete process.env.OMNIRUSH_DEV_MODE;else process.env.OMNIRUSH_DEV_MODE = previousDevMode;+ if (previousBootstrapPath === undefined) delete process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;+ else process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = previousBootstrapPath;+});++beforeEach(async () => {+ // Trust decisions read desktop activation state; never read the real one.+ const root = await createRoot("omnirush-cloud-mcp-bootstrap-");+ const path = join(root, "desktop-bootstrap.json");+ await writeFile(path, JSON.stringify({+ baseUrl: DEN,+ enterpriseActivation: { activatedAt: "2026-09-22T00:00:00.000Z", denBaseUrl: DEN },+ }), "utf8");+ process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = path;});async function createRoot(prefix = "omnirush-cloud-mcp-"): Promise<string> {@@ -281,7 +297,7 @@ function delivery(body: Record<string, unknown>): Record<string, unknown> {const CLOUD_CONFIG: CloudConfig = {type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: `${DEN}/mcp/agent`,enabled: true,headers: { Authorization: "Bearer owt_secret_cloud_token" },oauth: false,@@ -442,7 +458,7 @@ describe("omnirush-cloud MCP strict reconcile", () => {const omnirush = await startOmniRush([workspace("ws_1", root, `http://127.0.0.1:${mock.server.port}`)]);const cases: Array<{ config: Record<string, unknown>; code: string }> = [- { config: { ...CLOUD_CONFIG, url: "https://api.omnirushlabs.com/mcp" }, code: "cloud_endpoint_invalid" },+ { config: { ...CLOUD_CONFIG, url: `${DEN}/mcp` }, code: "cloud_endpoint_invalid" },{ config: { ...CLOUD_CONFIG, enabled: false }, code: "cloud_mcp_disabled" },{ config: { ...CLOUD_CONFIG, headers: {} }, code: "invalid_mcp_token" },{ config: { ...CLOUD_CONFIG, oauth: {} }, code: "invalid_mcp_token" },@@ -484,6 +500,29 @@ describe("omnirush-cloud MCP strict reconcile", () => {expect(mock.requests.some((request) => request.method === "POST" && request.pathname === "/mcp")).toBe(false);});+ test("a collaborator token cannot globally persist a retired hosted Cloud MCP endpoint", async () => {+ const root = await createRoot();+ const mock = startMockOpencode();+ const omnirush = await startOmniRush([workspace("ws_1", root, `http://127.0.0.1:${mock.server.port}`)]);++ // These hosted origins were built-in trusted before the hosted Den was+ // retired; they are not ours any more and need the owner like any other.+ for (const url of [+ "https://api.omnirushlabs.com/mcp/agent",+ "https://api.app.omnirushlabs.com/mcp/agent",+ "https://app.omnirushlabs.com/api/den/mcp/agent",+ "https://api.omnirush.software/mcp/agent",+ "https://app.omnirush.software/api/den/mcp/agent",+ ]) {+ const response = await reconcile(omnirush.base, "ws_1", { config: { ...CLOUD_CONFIG, url } });+ expect(response.status).toBe(403);+ }++ expect((await readGlobalRuntimeOpencodeConfig(omnirush.config)).mcp?.["omnirush-cloud"]).toBeUndefined();+ expect((await readRuntimeOpencodeConfig(omnirush.config, "ws_1")).mcp?.["omnirush-cloud"]).toBeUndefined();+ expect(mock.requests.some((request) => request.method === "POST" && request.pathname === "/mcp")).toBe(false);+ });+test("normalizes a harmless trailing slash on the Cloud MCP endpoint", async () => {const root = await createRoot();const mock = startMockOpencode();@@ -503,7 +542,7 @@ describe("omnirush-cloud MCP strict reconcile", () => {const omnirush = await startOmniRush([workspace("ws_1", root, `http://127.0.0.1:${mock.server.port}`)]);await writeRuntimeOpencodeConfig(omnirush.config, "ws_1", (current) => ({...current,- mcp: { "omnirush-cloud": { ...CLOUD_CONFIG, url: "https://api.omnirushlabs.com/mcp" } },+ mcp: { "omnirush-cloud": { ...CLOUD_CONFIG, url: `${DEN}/mcp` } },}));const body = await responseRecord(await getHealth(omnirush.base));diff --git a/apps/server/src/connect-mcp-server-catalog.test.ts b/apps/server/src/connect-mcp-server-catalog.test.tsindex d3e32ba3..b53f84dc 100644--- a/apps/server/src/connect-mcp-server-catalog.test.ts+++ b/apps/server/src/connect-mcp-server-catalog.test.ts@@ -1,5 +1,5 @@-import { afterEach, describe, expect, test } from "bun:test";-import { mkdtemp, rm } from "node:fs/promises";+import { afterEach, beforeEach, describe, expect, test } from "bun:test";+import { mkdtemp, rm, writeFile } from "node:fs/promises";import { tmpdir } from "node:os";import { join } from "node:path";@@ -22,11 +22,41 @@ import type { ServerConfig } from "./types.js";const roots: string[] = [];const previousRuntimeDb = process.env.OMNIRUSH_RUNTIME_DB;+const previousBootstrapPath = process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;++/** The administrator-activated enterprise Den origin every trusted fixture uses. */+const DEN = "https://den.example.com";++/** Hosted Den origins that are retired and must never be trusted by default. */+const RETIRED_HOSTED_ORIGINS = [+ "https://api.omnirushlabs.com",+ "https://app.omnirushlabs.com",+ "https://api.app.omnirushlabs.com",+ "https://api.omnirush.software",+ "https://app.omnirush.software",+];++async function activateEnterpriseDen(origin: string | null): Promise<void> {+ const root = await mkdtemp(join(tmpdir(), "omnirush-connect-mcp-bootstrap-"));+ roots.push(root);+ const path = join(root, "desktop-bootstrap.json");+ await writeFile(path, JSON.stringify(origin+ ? { baseUrl: origin, enterpriseActivation: { activatedAt: "2026-09-22T00:00:00.000Z", denBaseUrl: origin } }+ : {}), "utf8");+ process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = path;+}++beforeEach(async () => {+ // Never read the real desktop-bootstrap.json of whoever runs the tests.+ await activateEnterpriseDen(DEN);+});afterEach(async () => {while (roots.length) await rm(roots.pop() ?? "", { recursive: true, force: true });if (previousRuntimeDb === undefined) delete process.env.OMNIRUSH_RUNTIME_DB;else process.env.OMNIRUSH_RUNTIME_DB = previousRuntimeDb;+ if (previousBootstrapPath === undefined) delete process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH;+ else process.env.OMNIRUSH_DESKTOP_BOOTSTRAP_PATH = previousBootstrapPath;});async function fixtureConfig(): Promise<ServerConfig> {@@ -58,7 +88,7 @@ function indexFetcher(connectionId: "emc_01k28e8q8pf8r9sff9mhyqxved",name: "Project Atlas",description: null,- url: "https://api.omnirushlabs.com/mcp/agent/connections/emc_01k28e8q8pf8r9sff9mhyqxved",+ url: "https://den.example.com/mcp/agent/connections/emc_01k28e8q8pf8r9sff9mhyqxved",}],) {return async (url: string, init?: RequestInit) => {@@ -90,7 +120,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const requests: Array<{ url: string; headers: Headers; body: Record<string, unknown> }> = [];const index = await readOmniRushConnectMcpServerIndex({type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: "https://den.example.com/mcp/agent",headers: { Authorization: "Bearer member-token" },}, "Bearer private-app-host-token", indexFetcher(requests));@@ -105,22 +135,85 @@ describe("OmniRush.ai Connect MCP server catalog", () => {=== CONNECT_MCP_APP_HOST_CAPABILITY)).toBe(true);});- test("keeps hosted api-origin provider proxies on the credential-bound app gateway origin", async () => {+ test("keeps same-origin provider proxies below a Den gateway prefix", async () => {const index = await readOmniRushConnectMcpServerIndex({type: "remote",- url: "https://app.omnirushlabs.com/api/den/mcp/agent",- }, "Bearer private-app-host-token", indexFetcher([]));+ url: `${DEN}/api/den/mcp/agent`,+ }, "Bearer private-app-host-token", indexFetcher([], [{+ connectionId: "emc_01k28e8q8pf8r9sff9mhyqxved",+ name: "Project Atlas",+ description: null,+ url: `${DEN}/api/den/mcp/agent/connections/emc_01k28e8q8pf8r9sff9mhyqxved`,+ }]));expect(index?.servers[0]?.url).toBe(- "https://app.omnirushlabs.com/api/den/mcp/agent/connections/emc_01k28e8q8pf8r9sff9mhyqxved",+ `${DEN}/api/den/mcp/agent/connections/emc_01k28e8q8pf8r9sff9mhyqxved`,);});+ test("never sends the App-host credential to a retired hosted origin", async () => {+ // No activation: the retired hosts used to be trusted without one.+ await activateEnterpriseDen(null);+ for (const origin of RETIRED_HOSTED_ORIGINS) {+ for (const path of ["/mcp/agent", "/api/den/mcp/agent"]) {+ const requests: Array<{ url: string; headers: Headers; body: Record<string, unknown> }> = [];+ const index = await readOmniRushConnectMcpServerIndex({+ type: "remote",+ url: `${origin}${path}`,+ headers: { Authorization: "Bearer member-token" },+ }, "Bearer private-app-host-token", indexFetcher(requests, [{+ connectionId: "emc_01retired",+ name: "Retired",+ description: null,+ url: `${origin}/mcp/agent/connections/emc_01retired`,+ }]));+ expect(index).toBeNull();+ expect(requests).toEqual([]);+ }+ }++ const config = await fixtureConfig();+ for (const origin of RETIRED_HOSTED_ORIGINS) {+ let requests = 0;+ const result = await reconcileOmniRushConnectMcpServers({+ config,+ workspace: config.workspaces[0]!,+ cloudMcp: { type: "remote", url: `${origin}/mcp/agent`, headers: { Authorization: "Bearer member-token" } },+ appHostAuthorization: "Bearer private-app-host-token",+ fetcher: async () => {+ requests += 1;+ return new Response(null, { status: 500 });+ },+ });+ expect(requests).toBe(0);+ expect(result.status).toBe("unavailable");+ expect((await readOmniRushConnectMcpAppHostCatalog(config, "ws_1")).servers).toEqual([]);+ }+ });++ test("the activated Den origin is trusted and a retired hosted origin next to it is not", async () => {+ const trusted: Array<{ url: string; headers: Headers; body: Record<string, unknown> }> = [];+ expect(await readOmniRushConnectMcpServerIndex(+ { type: "remote", url: `${DEN}/mcp/agent` },+ "Bearer private-app-host-token",+ indexFetcher(trusted),+ )).not.toBeNull();+ expect(trusted.length).toBeGreaterThan(0);++ const retired: Array<{ url: string; headers: Headers; body: Record<string, unknown> }> = [];+ expect(await readOmniRushConnectMcpServerIndex(+ { type: "remote", url: `${RETIRED_HOSTED_ORIGINS[0]}/mcp/agent` },+ "Bearer private-app-host-token",+ indexFetcher(retired),+ )).toBeNull();+ expect(retired).toEqual([]);+ });+test("reconciles only OmniRush.ai-owned proxy entries and preserves user MCPs", async () => {const config = await fixtureConfig();await writeRuntimeOpencodeConfig(config, "ws_1", () => ({mcp: {- "omnirush-cloud": { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ "omnirush-cloud": { type: "remote", url: "https://den.example.com/mcp/agent" },"user-server": { type: "remote", url: "https://user.example/mcp" },"omnirush-connect-stale": { type: "remote", url: "https://cloud.example/stale" },},@@ -131,7 +224,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {workspace: config.workspaces[0]!,cloudMcp: {type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: "https://den.example.com/mcp/agent",headers: { Authorization: "Bearer member-token" },},appHostAuthorization: "Bearer private-app-host-token",@@ -145,7 +238,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {directNames: [],removedNames: ["omnirush-connect-stale"],});- expect(runtime.mcp?.["omnirush-cloud"]).toEqual({ type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" });+ expect(runtime.mcp?.["omnirush-cloud"]).toEqual({ type: "remote", url: "https://den.example.com/mcp/agent" });expect(runtime.mcp?.["user-server"]).toEqual({ type: "remote", url: "https://user.example/mcp" });expect(runtime.mcp?.["omnirush-connect-stale"]).toBeUndefined();expect(Object.keys(runtime.mcp ?? {}).some((name) => name.startsWith("omnirush-connect-"))).toBe(false);@@ -156,7 +249,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {connectionId,name: "Project Atlas",description: null,- url: `https://api.omnirushlabs.com/mcp/agent/connections/${connectionId}`,+ url: `https://den.example.com/mcp/agent/connections/${connectionId}`,exposeDirectly: false,}],});@@ -172,12 +265,12 @@ describe("OmniRush.ai Connect MCP server catalog", () => {await writeRuntimeOpencodeConfig(config, "ws_1", () => ({mcp: {"user-server": { type: "remote", url: "https://user.example/mcp" },- "omnirush-direct-revoked-abc123": { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent/connections/emc_01revoked" },+ "omnirush-direct-revoked-abc123": { type: "remote", url: "https://den.example.com/mcp/agent/connections/emc_01revoked" },},}));const cloudMcp = {type: "remote",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: "https://den.example.com/mcp/agent",enabled: true,headers: { Authorization: "Bearer member-token" },};@@ -187,8 +280,8 @@ describe("OmniRush.ai Connect MCP server catalog", () => {cloudMcp,appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], [- { ...direct, description: null, url: `https://api.omnirushlabs.com/mcp/agent/connections/${directId}`, exposeDirectly: true },- { connectionId: boundedId, name: "Bounded", description: null, url: `https://api.omnirushlabs.com/mcp/agent/connections/${boundedId}` },+ { ...direct, description: null, url: `https://den.example.com/mcp/agent/connections/${directId}`, exposeDirectly: true },+ { connectionId: boundedId, name: "Bounded", description: null, url: `https://den.example.com/mcp/agent/connections/${boundedId}` },]),});@@ -201,7 +294,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const runtime = await readRuntimeOpencodeConfig(config, "ws_1");expect(runtime.mcp?.[directName]).toEqual({type: "remote",- url: `https://api.omnirushlabs.com/mcp/agent/connections/${directId}`,+ url: `https://den.example.com/mcp/agent/connections/${directId}`,enabled: true,headers: { Authorization: "Bearer member-token" },oauth: false,@@ -218,7 +311,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {cloudMcp,appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], [- { ...direct, description: null, url: `https://api.omnirushlabs.com/mcp/agent/connections/${directId}`, exposeDirectly: false },+ { ...direct, description: null, url: `https://den.example.com/mcp/agent/connections/${directId}`, exposeDirectly: false },]),});expect(revoked.directNames).toEqual([]);@@ -232,10 +325,10 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], [- { connectionId: directId, name: "Linear", description: null, url: `https://api.omnirushlabs.com/mcp/agent/connections/${directId}`, exposeDirectly: true },+ { connectionId: directId, name: "Linear", description: null, url: `https://den.example.com/mcp/agent/connections/${directId}`, exposeDirectly: true },]),});expect(result.status).toBe("synced");@@ -246,12 +339,12 @@ describe("OmniRush.ai Connect MCP server catalog", () => {test("an unavailable index purges directly exposed entries instead of trusting a stale catalog", async () => {const config = await fixtureConfig();await writeRuntimeOpencodeConfig(config, "ws_1", () => ({- mcp: { "omnirush-direct-linear-abc123": { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent/connections/emc_01x" } },+ mcp: { "omnirush-direct-linear-abc123": { type: "remote", url: "https://den.example.com/mcp/agent/connections/emc_01x" } },}));const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },fetcher: async () => new Response(null, { status: 404 }),});expect(result).toEqual({@@ -269,14 +362,14 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const requests: Array<{ url: string; headers: Headers; body: Record<string, unknown> }> = [];await writeRuntimeOpencodeConfig(config, "ws_1", () => ({mcp: {- "omnirush-cloud": { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ "omnirush-cloud": { type: "remote", url: "https://den.example.com/mcp/agent" },},}));await writeOmniRushConnectMcpAppHostAuthorization(config,"ws_1","Bearer private-app-host-token",- "https://api.omnirushlabs.com/mcp/agent",+ "https://den.example.com/mcp/agent",);const result = await refreshOmniRushConnectMcpAppHostCatalog(config, "ws_1", indexFetcher(requests));@@ -291,14 +384,14 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const connectionId = "emc_01lastknowngood";await writeRuntimeOpencodeConfig(config, "ws_1", () => ({mcp: {- "omnirush-cloud": { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ "omnirush-cloud": { type: "remote", url: "https://den.example.com/mcp/agent" },},}));await writeOmniRushConnectMcpAppHostAuthorization(config,"ws_1","Bearer private-app-host-token",- "https://api.omnirushlabs.com/mcp/agent",+ "https://den.example.com/mcp/agent",);await writeOmniRushConnectMcpAppHostCatalog(config, "ws_1", {schemaVersion: "omnirush.connect/mcp-servers/1",@@ -306,7 +399,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {connectionId,name: "Last known good",description: null,- url: `https://api.omnirushlabs.com/mcp/agent/connections/${connectionId}`,+ url: `https://den.example.com/mcp/agent/connections/${connectionId}`,exposeDirectly: false,}],});@@ -329,7 +422,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },fetcher: async () => new Response(null, { status: 404 }),});expect(result).toEqual({@@ -353,7 +446,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], []),});@@ -375,7 +468,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher(trustedRequests),});@@ -402,7 +495,7 @@ describe("OmniRush.ai Connect MCP server catalog", () => {const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://api.omnirushlabs.com/mcp/agent" },+ cloudMcp: { type: "remote", url: "https://den.example.com/mcp/agent" },appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], [{connectionId: "emc_01crossorigin",@@ -416,18 +509,18 @@ describe("OmniRush.ai Connect MCP server catalog", () => {expect((await readOmniRushConnectMcpAppHostCatalog(config, "ws_1")).servers).toEqual([]);});- test("rejects a hosted api-origin descriptor that is not the exact connection proxy", async () => {+ test("rejects a connection proxy on a sibling api origin instead of translating it", async () => {const config = await fixtureConfig();const result = await reconcileOmniRushConnectMcpServers({config,workspace: config.workspaces[0]!,- cloudMcp: { type: "remote", url: "https://app.omnirushlabs.com/api/den/mcp/agent" },+ cloudMcp: { type: "remote", url: `${DEN}/api/den/mcp/agent` },appHostAuthorization: "Bearer private-app-host-token",fetcher: indexFetcher([], [{connectionId: "emc_01crossorigin",- name: "Wrong proxy path",+ name: "Sibling api origin",description: null,- url: "https://api.omnirushlabs.com/mcp/agent/connections/another-connection",+ url: "https://api.den.example.com/mcp/agent/connections/emc_01crossorigin",}]),});diff --git a/apps/server/src/connect-mcp-server-catalog.ts b/apps/server/src/connect-mcp-server-catalog.tsindex 4ef0d631..95c17894 100644--- a/apps/server/src/connect-mcp-server-catalog.ts+++ b/apps/server/src/connect-mcp-server-catalog.ts@@ -26,18 +26,6 @@ export const CONNECT_DIRECT_MCP_SERVER_NAME_PREFIX = "omnirush-direct-";export const CONNECT_MCP_APP_HOST_CAPABILITY_HEADER = "x-omnirush-mcp-client-capabilities";export const CONNECT_MCP_APP_HOST_CAPABILITY = "mcp-app-host-v1";-const BUILTIN_APP_HOST_CLOUD_ORIGINS = new Set([- "https://api.omnirushlabs.com",- "https://app.omnirushlabs.com",- "https://api.omnirush.software",- "https://app.omnirush.software",-]);--const BUILTIN_APP_HOST_GATEWAY_PROXY_ORIGINS = new Map([- ["https://app.omnirushlabs.com", "https://api.omnirushlabs.com"],- ["https://app.omnirush.software", "https://api.omnirush.software"],-]);-const indexSchema = z.object({schemaVersion: z.literal(CONNECT_MCP_SERVER_INDEX_SCHEMA_VERSION),servers: z.array(z.object({@@ -124,20 +112,10 @@ function normalizeAppHostProxyUrl(}if (cloudEndpoint.username || cloudEndpoint.password || serverEndpoint.username || serverEndpoint.password) return null;if (serverEndpoint.search || serverEndpoint.hash) return null;- if (serverEndpoint.origin === cloudEndpoint.origin) return serverEndpoint.toString();-- // Hosted Desktop talks to Den through the app-origin gateway, while Den's- // authenticated member index names its canonical api-origin proxy. Keep the- // credential on the configured app origin by translating only this exact,- // built-in proxy pair and exact per-connection path. Arbitrary cross-origin- // descriptors still fail closed.- if (BUILTIN_APP_HOST_GATEWAY_PROXY_ORIGINS.get(cloudEndpoint.origin) !== serverEndpoint.origin) return null;- const cloudTerminalPath = "/mcp/agent";- if (!cloudEndpoint.pathname.endsWith(cloudTerminalPath) || cloudEndpoint.search || cloudEndpoint.hash) return null;- const expectedServerPath = `/mcp/agent/connections/${encodeURIComponent(server.connectionId)}`;- if (serverEndpoint.pathname !== expectedServerPath) return null;- const gatewayPrefix = cloudEndpoint.pathname.slice(0, -cloudTerminalPath.length);- return new URL(`${gatewayPrefix}${serverEndpoint.pathname}`, cloudEndpoint.origin).toString();+ // The private App-host credential stays on the trusted Cloud MCP origin.+ // The built-in hosted app/api proxy pairs were retired with the hosted Den+ // domains, so a descriptor on any other origin fails closed.+ return serverEndpoint.origin === cloudEndpoint.origin ? serverEndpoint.toString() : null;}function isLoopbackHostname(hostname: string): boolean {@@ -156,7 +134,10 @@ async function trustedAppHostCloudEndpoint(cloudMcp: Record<string, unknown>): Preturn false;}if (endpoint.username || endpoint.password || endpoint.search || endpoint.hash) return false;- if (BUILTIN_APP_HOST_CLOUD_ORIGINS.has(endpoint.origin)) return true;+ // No built-in hosted origins: omnirush.ai runs no hosted Den and the+ // retired hosted Den domains are not ours. Only loopback (development) and+ // the administrator-activated Den origin may receive the private App-host+ // credential.if (process.env.OMNIRUSH_DEV_MODE === "1" && isLoopbackHostname(endpoint.hostname)) return true;const activatedEnterpriseOrigin = await readActivatedEnterpriseDenOrigin();return activatedEnterpriseOrigin !== null && endpoint.origin === activatedEnterpriseOrigin;diff --git a/apps/server/src/embedded.ts b/apps/server/src/embedded.tsindex 3ae8efac..9a2860a2 100644--- a/apps/server/src/embedded.ts+++ b/apps/server/src/embedded.ts@@ -37,6 +37,7 @@ import { findManagedEngineWorkspace } from "./workspaces.js";import { keepOmniRushRuntimeConfigFileFresh, writeOmniRushRuntimeConfigFile } from "./omnirush-runtime-config.js";import { migrateOmniRushCloudMcpRuntimeConfig } from "./cloud-mcp-health.js";import { migrateWorkspaceRuntimeConfigToEngineGlobal } from "./runtime-opencode-config-store.js";+import { migrateLegacyOmniRushUiMcpCommand, type OmniRushUiMcpLaunch } from "./omnirush-ui-mcp-migration.js";import { resolveOpencodeModelsEnv } from "./opencode-models-url.js";import { assertOpencodeConfigCompat } from "./opencode-config-compat.js";import type { ServeResult } from "./serve-node.js";@@ -56,6 +57,12 @@ export type EmbeddedServerOptions = CliArgs & {resumeInterruptedTasks?: boolean;/** Version of the embedding desktop app, reported as environment.app_version by the collector. */appVersion?: string;+ /**+ * How the embedding desktop launches its bundled UI-control MCP. Persisted+ * entries still using `npx -y omnirush-ui-mcp` are rewritten to it before+ * the engine starts; without it they are removed instead.+ */+ omnirushUiMcp?: OmniRushUiMcpLaunch | null;};export type EmbeddedServerHandle = {@@ -186,6 +193,9 @@ export async function startEmbeddedServer(options: EmbeddedServerOptions): Promiif (!config.readOnly) {await ensureLocalWorkspaceFiles(config.workspaces);+ // First among the runtime-DB migrations: the store drops leftover+ // registry launches on any write, before this could rewrite them.+ await migrateLegacyOmniRushUiMcpCommand(config, options.omnirushUiMcp ?? null);await migrateOmniRushCloudMcpRuntimeConfig(config);await migrateWorkspaceRuntimeConfigToEngineGlobal(config);}diff --git a/apps/server/src/mcp.ts b/apps/server/src/mcp.tsindex c4af3751..2deba882 100644--- a/apps/server/src/mcp.ts+++ b/apps/server/src/mcp.ts@@ -5,6 +5,8 @@ import { sanitizeDiagnosticString } from "./diagnostic-sanitizer.js";import { readJsoncFile } from "./jsonc.js";import { opencodeConfigPath } from "./workspace-files.js";import { validateMcpConfig, validateMcpName, validateUserMcpName } from "./validators.js";+import { ApiError } from "./errors.js";+import { isOmniRushUiMcpRegistryEntry, OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE } from "./omnirush-ui-mcp-command.js";import {readRuntimeOpencodeConfig,runtimeMcpMap,@@ -703,6 +705,15 @@ export async function setMcpEnabled(if (!Object.prototype.hasOwnProperty.call(mcpMap, name)) return false;const current = mcpMap[name];if (!current || typeof current !== "object" || Array.isArray(current)) return false;+ if (isOmniRushUiMcpRegistryEntry(current)) {+ // Never re-enable a registry launch of omnirush-ui-mcp. Disabling one+ // removes it: the runtime store does not keep such entries and the+ // engine never receives them, so there is nothing left to toggle.+ if (enabled) throw new ApiError(400, "unsafe_mcp_command", OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE);+ delete mcpMap[name];+ await writeRuntimeOpencodeConfig(serverConfig, workspaceId, (currentConfig) => ({ ...currentConfig, mcp: mcpMap }));+ return true;+ }try {validateMcpConfig({ ...(current as Record<string, unknown>), enabled });} catch {diff --git a/apps/server/src/omnirush-runtime-config.test.ts b/apps/server/src/omnirush-runtime-config.test.tsindex 517b78b4..a10dd7fd 100644--- a/apps/server/src/omnirush-runtime-config.test.ts+++ b/apps/server/src/omnirush-runtime-config.test.ts@@ -271,6 +271,25 @@ describe("omnirush runtime config file", () => {expect(mcp.posthog).toBeUndefined();});+ test("never injects a registry launch of omnirush-ui-mcp, whatever the snapshot holds", () => {+ const bundled = {+ type: "local",+ command: [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ],+ environment: { ELECTRON_RUN_AS_NODE: "1" },+ };+ const built = buildOmniRushRuntimeConfigObjectFromSnapshot({+ mcp: {+ "omnirush-ui": { type: "local", command: ["npx", "-y", "omnirush-ui-mcp"], enabled: true },+ "ui-bunx": { type: "local", command: ["bunx", "omnirush-ui-mcp@latest"] },+ "ui-bundled": bundled,+ },+ });+ expect(built.mcp).toEqual({ "ui-bundled": bundled });+ });+test("omnirush prompt states identity, repo memory, artifacts, and Connect routing once, without the removed Memory Bank", async () => {const { config } = await setup();await writeOmniRushRuntimeConfigFile(config);diff --git a/apps/server/src/omnirush-runtime-config.ts b/apps/server/src/omnirush-runtime-config.tsindex 6f532412..6679859b 100644--- a/apps/server/src/omnirush-runtime-config.ts+++ b/apps/server/src/omnirush-runtime-config.ts@@ -43,6 +43,7 @@ import {type RuntimeOpencodeConfig,} from "./runtime-opencode-config-store.js";import { CONNECT_MCP_SERVER_NAME_PREFIX } from "./connect-mcp-server-catalog.js";+import { isOmniRushUiMcpRegistryEntry } from "./omnirush-ui-mcp-command.js";import { OMNIRUSH_AGENT_PROMPT } from "./omnirush-agent-prompt.js";const INTERNAL_PROVIDER_ID = "omnirush";@@ -223,8 +224,11 @@ export function buildOmniRushRuntimeConfigObjectFromSnapshot(...runtimePluginList(runtimeConfig),],...(disabledProviders.length ? { disabled_providers: disabledProviders } : {}),+ // Registry launches of omnirush-ui-mcp are never delivered, whatever the+ // runtime DB holds: the MCP ships inside the desktop app, not on npm.mcp: Object.fromEntries(Object.entries(runtimeMcpMap(runtimeConfig))- .filter(([name]) => !name.startsWith(CONNECT_MCP_SERVER_NAME_PREFIX))),+ .filter(([name, entry]) => !name.startsWith(CONNECT_MCP_SERVER_NAME_PREFIX)+ && !isOmniRushUiMcpRegistryEntry(entry))),...(Object.keys(provider).length ? { provider } : {}),};}diff --git a/apps/server/src/omnirush-ui-mcp-command.test.ts b/apps/server/src/omnirush-ui-mcp-command.test.tsnew file mode 100644index 00000000..f7757e9f--- /dev/null+++ b/apps/server/src/omnirush-ui-mcp-command.test.ts@@ -0,0 +1,73 @@+import { describe, expect, test } from "bun:test";++import {+ isOmniRushUiMcpRegistryCommand,+ isOmniRushUiMcpRegistryEntry,+ withoutOmniRushUiMcpRegistryEntries,+} from "./omnirush-ui-mcp-command.js";++describe("registry launches of omnirush-ui-mcp", () => {+ test("matches every command that resolves the package by name", () => {+ for (const command of [+ ["npx", "-y", "omnirush-ui-mcp"],+ ["npx", "omnirush-ui-mcp"],+ ["npx", "--yes", "omnirush-ui-mcp@latest"],+ ["npx", "-y", "[email protected]", "--flag"],+ ["npx", "--package=omnirush-ui-mcp", "omnirush-ui"],+ ["npx", "-p", "omnirush-ui-mcp", "omnirush-ui"],+ ["/usr/local/bin/npx", "-y", "omnirush-ui-mcp"],+ ["C:\\Program Files\\nodejs\\npx.cmd", "-y", "omnirush-ui-mcp"],+ ["bunx", "omnirush-ui-mcp"],+ ["bun", "x", "omnirush-ui-mcp"],+ ["pnpm", "dlx", "omnirush-ui-mcp"],+ ["pnpx", "omnirush-ui-mcp"],+ ["yarn", "dlx", "omnirush-ui-mcp"],+ ["npm", "exec", "--yes", "--", "omnirush-ui-mcp"],+ ["npx", "-y", "npm:omnirush-ui-mcp"],+ ["npx", "-y", "OMNIRUSH-UI-MCP"],+ ["omnirush-ui-mcp"],+ ["sh", "-c", "npx -y omnirush-ui-mcp"],+ ["bash", "-lc", "cd /tmp && npx -y 'omnirush-ui-mcp'"],+ ["cmd", "/c", "npx", "-y", "omnirush-ui-mcp"],+ ]) {+ expect({ command, match: isOmniRushUiMcpRegistryCommand(command) }).toEqual({ command, match: true });+ }+ });++ test("does not match the bundled launch, a checkout path, or other packages", () => {+ for (const command of [+ [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ],+ [+ "C:\\Users\\me\\AppData\\Local\\Programs\\OmniRush.ai\\OmniRush.ai.exe",+ "C:\\Users\\me\\AppData\\Local\\Programs\\OmniRush.ai\\resources\\omnirush-ui-mcp\\index.mjs",+ ],+ ["node", "/Users/me/OmniRush.ai/packages/omnirush-ui-mcp/index.mjs"],+ ["node", "packages/omnirush-ui-mcp"],+ ["npx", "-y", "@modelcontextprotocol/server-everything"],+ ["npx", "-y", "omnirush-ui-mcp-helper"],+ ["npx", "-y", "@acme/omnirush-ui-mcp"],+ [],+ ]) {+ expect({ command, match: isOmniRushUiMcpRegistryCommand(command) }).toEqual({ command, match: false });+ }+ expect(isOmniRushUiMcpRegistryCommand("npx -y omnirush-ui-mcp")).toBe(false);+ expect(isOmniRushUiMcpRegistryCommand(undefined)).toBe(false);+ });++ test("checks entries by command and filters them out of an MCP map", () => {+ const legacy = { type: "local", command: ["npx", "-y", "omnirush-ui-mcp"], enabled: false };+ const safe = { type: "local", command: ["node", "/opt/mcp/index.mjs"] };+ const remote = { type: "remote", url: "https://mcp.example.com/mcp" };+ expect(isOmniRushUiMcpRegistryEntry(legacy)).toBe(true);+ expect(isOmniRushUiMcpRegistryEntry(safe)).toBe(false);+ expect(isOmniRushUiMcpRegistryEntry(remote)).toBe(false);+ expect(isOmniRushUiMcpRegistryEntry(null)).toBe(false);++ const clean = { safe, remote };+ expect(withoutOmniRushUiMcpRegistryEntries(clean)).toBe(clean);+ expect(withoutOmniRushUiMcpRegistryEntries({ "omnirush-ui": legacy, ...clean })).toEqual(clean);+ });+});diff --git a/apps/server/src/omnirush-ui-mcp-command.ts b/apps/server/src/omnirush-ui-mcp-command.tsnew file mode 100644index 00000000..767fde5a--- /dev/null+++ b/apps/server/src/omnirush-ui-mcp-command.ts@@ -0,0 +1,55 @@+/**+ * `omnirush-ui-mcp` is not a package OmniRush.ai publishes on npm, yet desktop+ * releases 1.0.0 to 1.0.8 configured the built-in UI-control MCP as+ * `npx -y omnirush-ui-mcp`. Whoever registers that name gets code execution+ * on every host that resolves it from a registry. The desktop now bundles the+ * MCP and launches it by absolute path, so no legitimate command names the+ * package: any command that does is refused on write and never delivered to+ * the engine.+ *+ * Kept free of other server imports so validators, the runtime config store,+ * and the engine config builder can all share it without import cycles.+ */++/**+ * A bare package reference: `omnirush-ui-mcp`, `omnirush-ui-mcp@<version|tag>`,+ * `npm:omnirush-ui-mcp`, or `--package=omnirush-ui-mcp`. A path to the+ * bundled file (`.../omnirush-ui-mcp/index.mjs`) never matches.+ */+const PACKAGE_REFERENCE = /^(?:--package=|-p=)?(?:npm:)?omnirush-ui-mcp(?:@\S*)?$/i;++/** Shell word and statement separators, so `sh -c "npx -y omnirush-ui-mcp"` is caught too. */+const TOKEN_SEPARATORS = /[\s"'`;&|()<>]+/;++export const OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE =+ "omnirush-ui-mcp is not published on npm and cannot be launched through npx, bunx, pnpm dlx or another package runner. "+ + "Connect UI control from Settings > Extensions in the omnirush.ai desktop app, which runs the copy bundled with the app.";++/**+ * True when a local MCP command resolves `omnirush-ui-mcp` by package name+ * (npx, bunx, pnpm dlx, yarn dlx, npm exec, bun x, a PATH lookup of a global+ * install, or any of these inside a shell string) rather than running the+ * bundled file by path.+ */+export function isOmniRushUiMcpRegistryCommand(command: unknown): boolean {+ if (!Array.isArray(command)) return false;+ return command.some((part) =>+ typeof part === "string"+ && part.split(TOKEN_SEPARATORS).some((token) => PACKAGE_REFERENCE.test(token))+ );+}++/** True for an MCP entry whose `command` is a registry launch of `omnirush-ui-mcp`. */+export function isOmniRushUiMcpRegistryEntry(entry: unknown): boolean {+ return typeof entry === "object"+ && entry !== null+ && !Array.isArray(entry)+ && isOmniRushUiMcpRegistryCommand((entry as Record<string, unknown>).command);+}++/** Drops registry launches of `omnirush-ui-mcp` from an MCP map; returns the same map when there are none. */+export function withoutOmniRushUiMcpRegistryEntries<T>(mcp: Record<string, T>): Record<string, T> {+ const blocked = Object.keys(mcp).filter((name) => isOmniRushUiMcpRegistryEntry(mcp[name]));+ if (blocked.length === 0) return mcp;+ return Object.fromEntries(Object.entries(mcp).filter(([name]) => !blocked.includes(name)));+}diff --git a/apps/server/src/omnirush-ui-mcp-guard.e2e.test.ts b/apps/server/src/omnirush-ui-mcp-guard.e2e.test.tsnew file mode 100644index 00000000..ea8f0716--- /dev/null+++ b/apps/server/src/omnirush-ui-mcp-guard.e2e.test.ts@@ -0,0 +1,191 @@+import { afterEach, describe, expect, test } from "bun:test";+import { Database } from "bun:sqlite";+import { mkdtemp, readFile, rm } from "node:fs/promises";+import { tmpdir } from "node:os";+import { join } from "node:path";++import { omnirushRuntimeConfigFilePath, writeOmniRushRuntimeConfigFile } from "./omnirush-runtime-config.js";+import {+ ENGINE_GLOBAL_RUNTIME_CONFIG_ID,+ readEffectiveRuntimeOpencodeConfig,+ readRuntimeOpencodeConfig,+ runtimeDbPath,+ writeRuntimeOpencodeConfig,+ type RuntimeOpencodeConfig,+} from "./runtime-opencode-config-store.js";+import { registerTrustedOpencodeProcess, startServer, syncAllWorkspacesRuntimeMcpToEngine } from "./server.js";+import type { ServerConfig } from "./types.js";++// Whatever reaches the stored config, a registry launch of omnirush-ui-mcp+// (desktop 1.0.x wrote `npx -y omnirush-ui-mcp`) must never be accepted by a+// write route or handed to the engine.++type EngineRequest = { method: string; pathname: string; body: unknown };++const LEGACY = { type: "local", command: ["npx", "-y", "omnirush-ui-mcp"], enabled: true };+const SAFE = { type: "local", command: ["node", "/opt/tools/mcp.mjs"], enabled: true };++const stops: Array<() => void | Promise<void>> = [];+const roots: string[] = [];+const previousRuntimeDb = process.env.OMNIRUSH_RUNTIME_DB;+let processGeneration = 0;++afterEach(async () => {+ while (stops.length) await stops.pop()?.();+ while (roots.length) await rm(roots.pop() ?? "", { recursive: true, force: true });+ if (previousRuntimeDb === undefined) delete process.env.OMNIRUSH_RUNTIME_DB;+ else process.env.OMNIRUSH_RUNTIME_DB = previousRuntimeDb;+});++function startMockEngine() {+ const requests: EngineRequest[] = [];+ const server = Bun.serve({+ hostname: "127.0.0.1",+ port: 0,+ async fetch(request) {+ const url = new URL(request.url);+ const body = request.method === "POST" ? await request.json().catch(() => null) : null;+ requests.push({ method: request.method, pathname: url.pathname, body });+ if (url.pathname === "/mcp" && request.method === "POST") {+ const name = (body as { name?: string } | null)?.name ?? "";+ return Response.json({ [name]: { status: "connected" } });+ }+ if (url.pathname === "/mcp") return Response.json({});+ if (url.pathname === "/session/status") return Response.json({});+ if (url.pathname === "/instance/dispose") return Response.json(true);+ return Response.json({ code: "not_found", message: "Not found" }, { status: 404 });+ },+ });+ stops.push(() => server.stop(true));+ const pushedNames = () => requests+ .filter((entry) => entry.method === "POST" && entry.pathname === "/mcp")+ .map((entry) => (entry.body as { name?: string } | null)?.name);+ return { baseUrl: `http://127.0.0.1:${server.port}`, pushedNames };+}++async function fixture() {+ const root = await mkdtemp(join(tmpdir(), "omnirush-ui-mcp-guard-"));+ roots.push(root);+ process.env.OMNIRUSH_RUNTIME_DB = join(root, "runtime.sqlite");+ const engine = startMockEngine();+ const config: ServerConfig = {+ host: "127.0.0.1",+ port: 0,+ token: "owt_test_token",+ hostToken: "owt_host_token",+ configPath: join(root, "server.json"),+ approval: { mode: "auto", timeoutMs: 1000 },+ corsOrigins: ["*"],+ workspaces: [+ { id: "ws_1", name: "Workspace", path: root, preset: "starter", workspaceType: "local", baseUrl: engine.baseUrl },+ ],+ authorizedRoots: [root],+ readOnly: false,+ startedAt: Date.now(),+ tokenSource: "cli",+ hostTokenSource: "cli",+ logFormat: "pretty",+ logRequests: false,+ };+ return { config, engine };+}++async function start(config: ServerConfig, engineBaseUrl: string) {+ registerTrustedOpencodeProcess(config, {+ baseUrl: engineBaseUrl,+ identity: `omnirush-ui-mcp-guard-${++processGeneration}`,+ isAlive: () => true,+ });+ const server = await startServer(config);+ stops.push(() => server.stop());+ const base = `http://127.0.0.1:${server.port}`;+ const call = (method: string, path: string, body?: unknown) => fetch(`${base}${path}`, {+ method,+ headers: { Authorization: `Bearer ${config.token}`, "Content-Type": "application/json" },+ ...(body === undefined ? {} : { body: JSON.stringify(body) }),+ });+ return { call };+}++/** Stores a row the way desktop 1.0.x left it; the store itself now refuses to. */+async function seedRuntimeRow(config: ServerConfig, workspaceId: string, value: RuntimeOpencodeConfig) {+ await writeRuntimeOpencodeConfig(config, workspaceId, () => ({}));+ const sqlite = new Database(runtimeDbPath(config));+ try {+ sqlite.query("UPDATE runtime_opencode_configs SET config_json = ?, updated_at = ? WHERE workspace_id = ?")+ .run(JSON.stringify(value), Date.now(), workspaceId);+ } finally {+ sqlite.close();+ }+}++describe("registry launches of omnirush-ui-mcp", () => {+ test("POST /workspace/:id/mcp refuses one with 400 and nothing reaches the engine", async () => {+ const { config, engine } = await fixture();+ const { call } = await start(config, engine.baseUrl);++ for (const command of [+ ["npx", "-y", "omnirush-ui-mcp"],+ ["bunx", "omnirush-ui-mcp"],+ ["pnpm", "dlx", "omnirush-ui-mcp"],+ ]) {+ const response = await call("POST", "/workspace/ws_1/mcp", {+ name: "omnirush-ui",+ config: { type: "local", command, enabled: true },+ });+ expect(response.status).toBe(400);+ expect(await response.json()).toMatchObject({ code: "unsafe_mcp_command" });+ }+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp).toBeUndefined();+ expect(engine.pushedNames()).toEqual([]);+ });++ test("PATCH /workspace/:id/config refuses one with 400 and stores nothing", async () => {+ const { config, engine } = await fixture();+ const { call } = await start(config, engine.baseUrl);++ const response = await call("PATCH", "/workspace/ws_1/config", {+ opencode: { mcp: { "omnirush-ui": LEGACY, "user-tool": SAFE } },+ });+ expect(response.status).toBe(400);+ expect(await response.json()).toMatchObject({ code: "unsafe_mcp_command" });+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp).toBeUndefined();++ // The same patch without it goes through.+ const safe = await call("PATCH", "/workspace/ws_1/config", { opencode: { mcp: { "user-tool": SAFE } } });+ expect(safe.status).toBe(200);+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp).toEqual({ "user-tool": SAFE });+ });++ test("enabling a stored one over HTTP is refused and not pushed", async () => {+ const { config, engine } = await fixture();+ await seedRuntimeRow(config, "ws_1", { mcp: { "omnirush-ui": { ...LEGACY, enabled: false } } });+ const { call } = await start(config, engine.baseUrl);++ const response = await call("POST", "/workspace/ws_1/mcp/omnirush-ui/enabled", { enabled: true });+ expect(response.status).toBe(400);+ expect(await response.json()).toMatchObject({ code: "unsafe_mcp_command" });+ expect(engine.pushedNames()).toEqual([]);+ });++ test("the dynamic engine push and the injected config file skip stored ones", async () => {+ const { config, engine } = await fixture();+ await seedRuntimeRow(config, "ws_1", { mcp: { "omnirush-ui": LEGACY, "user-tool": SAFE } });+ await seedRuntimeRow(config, ENGINE_GLOBAL_RUNTIME_CONFIG_ID, {+ mcp: { "global-ui": { type: "local", command: ["sh", "-c", "npx -y omnirush-ui-mcp"] }, "global-tool": SAFE },+ });+ await start(config, engine.baseUrl);++ await syncAllWorkspacesRuntimeMcpToEngine(config);+ expect(engine.pushedNames().sort()).toEqual(["global-tool", "user-tool"]);++ expect(Object.keys((await readEffectiveRuntimeOpencodeConfig(config, "ws_1")).mcp ?? {}).sort())+ .toEqual(["global-tool", "user-tool"]);+ await writeOmniRushRuntimeConfigFile(config);+ const injected = JSON.parse(await readFile(omnirushRuntimeConfigFilePath(config), "utf8")) as { mcp?: Record<string, unknown> };+ expect(Object.keys(injected.mcp ?? {})).toEqual(["global-tool"]);++ // Filtered on delivery, not by a hidden write: the rows are unchanged.+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp?.["omnirush-ui"]).toEqual(LEGACY);+ });+});diff --git a/apps/server/src/omnirush-ui-mcp-migration.test.ts b/apps/server/src/omnirush-ui-mcp-migration.test.tsnew file mode 100644index 00000000..ab857db0--- /dev/null+++ b/apps/server/src/omnirush-ui-mcp-migration.test.ts@@ -0,0 +1,271 @@+import { afterEach, describe, expect, test } from "bun:test";+import { Database } from "bun:sqlite";+import { mkdtemp, rm } from "node:fs/promises";+import { tmpdir } from "node:os";+import { join } from "node:path";++import { addMcp, setMcpEnabled } from "./mcp.js";+import {+ migrateLegacyOmniRushUiMcpCommand,+ normalizeOmniRushUiMcpLaunch,+} from "./omnirush-ui-mcp-migration.js";+import {+ ENGINE_GLOBAL_RUNTIME_CONFIG_ID,+ readRuntimeOpencodeConfig,+ runtimeDbPath,+ writeRuntimeOpencodeConfig,+ type RuntimeOpencodeConfig,+} from "./runtime-opencode-config-store.js";+import type { ServerConfig } from "./types.js";++const roots: string[] = [];+const previousRuntimeDb = process.env.OMNIRUSH_RUNTIME_DB;++afterEach(async () => {+ if (process.platform !== "win32") {+ while (roots.length) await rm(roots.pop() ?? "", { recursive: true, force: true });+ } else {+ roots.length = 0;+ }+ if (previousRuntimeDb === undefined) delete process.env.OMNIRUSH_RUNTIME_DB;+ else process.env.OMNIRUSH_RUNTIME_DB = previousRuntimeDb;+});++async function fixtureConfig(): Promise<ServerConfig> {+ const root = await mkdtemp(join(tmpdir(), "omnirush-ui-mcp-migration-"));+ roots.push(root);+ process.env.OMNIRUSH_RUNTIME_DB = join(root, "runtime.sqlite");+ return {+ host: "127.0.0.1",+ port: 0,+ token: "test",+ hostToken: "host",+ configPath: join(root, "omnirush.json"),+ approval: { mode: "auto", timeoutMs: 1_000 },+ corsOrigins: ["*"],+ workspaces: [{ id: "ws_1", name: "One", path: root, preset: "starter", workspaceType: "local" }],+ authorizedRoots: [root],+ readOnly: false,+ startedAt: Date.now(),+ tokenSource: "cli",+ hostTokenSource: "cli",+ logFormat: "pretty",+ logRequests: false,+ };+}++/**+ * Stores a runtime row the way desktop 1.0.x left it. The runtime store now+ * refuses to write registry launches, so the row is seeded with SQL.+ */+async function seedRuntimeRow(config: ServerConfig, workspaceId: string, value: RuntimeOpencodeConfig): Promise<void> {+ // Creates the database and table through the store first.+ await writeRuntimeOpencodeConfig(config, workspaceId, () => ({}));+ const sqlite = new Database(runtimeDbPath(config));+ try {+ sqlite.query("UPDATE runtime_opencode_configs SET config_json = ?, updated_at = ? WHERE workspace_id = ?")+ .run(JSON.stringify(value), Date.now(), workspaceId);+ } finally {+ sqlite.close();+ }+}++async function rejection(operation: Promise<unknown>): Promise<unknown> {+ try {+ await operation;+ } catch (error) {+ return error;+ }+ throw new Error("expected the operation to fail");+}++const LEGACY = ["npx", "-y", "omnirush-ui-mcp"];+const NOTHING_TO_DO = { changed: false, rewritten: [], refreshed: [], removed: [] };+const BUNDLED = {+ command: [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ],+ environment: {+ ELECTRON_RUN_AS_NODE: "1",+ OMNIRUSH_UI_CONTROL_DISCOVERY: "/Users/me/Library/Application Support/ai.omnirush.desktop/omnirush-ui-control.json",+ },+};++describe("legacy UI-control MCP command migration", () => {+ test("never accepts a package-runner command as the replacement launch", () => {+ expect(normalizeOmniRushUiMcpLaunch({ command: LEGACY })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch({ command: ["npx", "-y", "something-else"] })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch({ command: ["bunx", "something-else"] })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch({ command: ["C:\\Program Files\\nodejs\\npx.cmd", "-y", "x"] })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch({ command: ["pnpm", "dlx", "omnirush-ui-mcp"] })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch({ command: [] })).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch(null)).toBeNull();+ expect(normalizeOmniRushUiMcpLaunch(BUNDLED)).toEqual(BUNDLED);+ });++ test("rewrites stored registry launches to the bundled launch in every runtime row", async () => {+ const config = await fixtureConfig();+ await seedRuntimeRow(config, "ws_1", {+ mcp: {+ "omnirush-ui": {+ type: "local",+ command: LEGACY,+ enabled: true,+ environment: { OMNIRUSH_UI_CONTROL_DISCOVERY: "/stale/omnirush-ui-control.json", KEEP_ME: "1" },+ },+ "ui-control-bunx": { type: "local", command: ["bunx", "omnirush-ui-mcp@latest"], enabled: true },+ "user-tool": { type: "local", command: ["npx", "-y", "@modelcontextprotocol/server-everything"], enabled: true },+ "user-remote": { type: "remote", url: "https://mcp.example.com/mcp" },+ },+ });+ await seedRuntimeRow(config, ENGINE_GLOBAL_RUNTIME_CONFIG_ID, {+ mcp: { "ui-control-renamed": { type: "local", command: LEGACY, enabled: false } },+ });++ const result = await migrateLegacyOmniRushUiMcpCommand(config, BUNDLED);++ expect(result.changed).toBe(true);+ expect(result.removed).toEqual([]);+ expect(result.rewritten).toHaveLength(3);+ expect(result.rewritten).toEqual(expect.arrayContaining([+ { workspaceId: "ws_1", name: "omnirush-ui" },+ { workspaceId: "ws_1", name: "ui-control-bunx" },+ { workspaceId: ENGINE_GLOBAL_RUNTIME_CONFIG_ID, name: "ui-control-renamed" },+ ]));+ const workspace = await readRuntimeOpencodeConfig(config, "ws_1");+ expect(workspace.mcp?.["omnirush-ui"]).toEqual({+ type: "local",+ command: BUNDLED.command,+ enabled: true,+ environment: { ...BUNDLED.environment, KEEP_ME: "1" },+ });+ // Other registry launches of the package move to the bundled launch too.+ expect(workspace.mcp?.["ui-control-bunx"]).toEqual({+ type: "local",+ command: BUNDLED.command,+ enabled: true,+ environment: BUNDLED.environment,+ });+ // User-authored entries, including other npx commands, are untouched.+ expect(workspace.mcp?.["user-tool"]).toEqual({+ type: "local",+ command: ["npx", "-y", "@modelcontextprotocol/server-everything"],+ enabled: true,+ });+ expect(workspace.mcp?.["user-remote"]).toEqual({ type: "remote", url: "https://mcp.example.com/mcp" });+ // Enablement is preserved: a disabled entry stays disabled after rewrite.+ expect((await readRuntimeOpencodeConfig(config, ENGINE_GLOBAL_RUNTIME_CONFIG_ID)).mcp?.["ui-control-renamed"]).toEqual({+ type: "local",+ command: BUNDLED.command,+ enabled: false,+ environment: BUNDLED.environment,+ });++ // One-time: a second run finds nothing left to rewrite.+ expect(await migrateLegacyOmniRushUiMcpCommand(config, BUNDLED)).toEqual(NOTHING_TO_DO);+ });++ test("removes stored registry launches when no bundled launch is available, so the toggle cannot revive them", async () => {+ const config = await fixtureConfig();+ await seedRuntimeRow(config, "ws_1", {+ mcp: {+ "omnirush-ui": { type: "local", command: LEGACY, enabled: true },+ "already-off": { type: "local", command: ["pnpm", "dlx", "omnirush-ui-mcp"], enabled: false },+ "user-tool": { type: "local", command: ["node", "/opt/tools/mcp.mjs"], enabled: true },+ },+ });++ // cli.ts (standalone server) runs the migration without a bundled launch.+ expect(await migrateLegacyOmniRushUiMcpCommand(config, null)).toEqual({+ changed: true,+ rewritten: [],+ refreshed: [],+ removed: [+ { workspaceId: "ws_1", name: "omnirush-ui" },+ { workspaceId: "ws_1", name: "already-off" },+ ],+ });+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp).toEqual({+ "user-tool": { type: "local", command: ["node", "/opt/tools/mcp.mjs"], enabled: true },+ });+ expect(await migrateLegacyOmniRushUiMcpCommand(config, null)).toEqual(NOTHING_TO_DO);++ // Flipping the MCP switch finds no entry (the route answers 404) and does+ // not bring the npx command back.+ expect(await setMcpEnabled(config, "ws_1", "omnirush-ui", true)).toBe(false);+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp?.["omnirush-ui"]).toBeUndefined();++ // Re-adding the old command after the migration (a 1.0.x desktop against+ // an updated server, a pasted snippet, a plugin import) is refused.+ expect(await rejection(addMcp(config, "ws_1", "omnirush-ui", { type: "local", command: LEGACY, enabled: true })))+ .toMatchObject({ status: 400, code: "unsafe_mcp_command" });+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp?.["omnirush-ui"]).toBeUndefined();+ });++ test("refuses to enable a registry launch that is still stored; disabling it removes it", async () => {+ const config = await fixtureConfig();+ await seedRuntimeRow(config, "ws_1", {+ mcp: {+ "omnirush-ui": { type: "local", command: LEGACY, enabled: false },+ "ui-copy": { type: "local", command: LEGACY, enabled: true },+ },+ });++ expect(await rejection(setMcpEnabled(config, "ws_1", "omnirush-ui", true)))+ .toMatchObject({ status: 400, code: "unsafe_mcp_command" });+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp?.["omnirush-ui"])+ .toEqual({ type: "local", command: LEGACY, enabled: false });++ expect(await setMcpEnabled(config, "ws_1", "ui-copy", false)).toBe(true);+ // The write also drops the other leftover registry launch in the row.+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp).toBeUndefined();+ });++ test("does not touch runtime rows while the server is read-only", async () => {+ const config = await fixtureConfig();+ await seedRuntimeRow(config, "ws_1", {+ mcp: { "omnirush-ui": { type: "local", command: LEGACY, enabled: true } },+ });+ config.readOnly = true;++ expect(await migrateLegacyOmniRushUiMcpCommand(config, BUNDLED)).toEqual(NOTHING_TO_DO);+ expect((await readRuntimeOpencodeConfig(config, "ws_1")).mcp?.["omnirush-ui"]?.command).toEqual(LEGACY);+ });++ test("refreshes a bundled launch whose app path moved and leaves current ones alone", async () => {+ const config = await fixtureConfig();+ const moved = [+ "/Users/me/Downloads/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Users/me/Downloads/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ];+ const windowsLaunch = [+ "C:\\Users\\me\\AppData\\Local\\Programs\\OmniRush.ai\\OmniRush.ai.exe",+ "C:\\Users\\me\\AppData\\Local\\Programs\\OmniRush.ai\\resources\\omnirush-ui-mcp\\index.mjs",+ ];+ await writeRuntimeOpencodeConfig(config, "ws_1", () => ({+ mcp: {+ "omnirush-ui": { type: "local", command: moved, enabled: true, environment: { ELECTRON_RUN_AS_NODE: "1" } },+ "windows-ui": { type: "local", command: windowsLaunch, enabled: true },+ "current-ui": { type: "local", command: BUNDLED.command, enabled: true, environment: BUNDLED.environment },+ "other-index": { type: "local", command: ["node", "/opt/tools/other-mcp/index.mjs"], enabled: true },+ },+ }));++ const result = await migrateLegacyOmniRushUiMcpCommand(config, BUNDLED);++ expect(result.rewritten).toEqual([]);+ expect(result.refreshed).toEqual([+ { workspaceId: "ws_1", name: "omnirush-ui" },+ { workspaceId: "ws_1", name: "windows-ui" },+ ]);+ const mcp = (await readRuntimeOpencodeConfig(config, "ws_1")).mcp ?? {};+ expect(mcp["omnirush-ui"]).toEqual({ type: "local", command: BUNDLED.command, enabled: true, environment: BUNDLED.environment });+ expect(mcp["windows-ui"]).toEqual({ type: "local", command: BUNDLED.command, enabled: true, environment: BUNDLED.environment });+ expect(mcp["current-ui"]).toEqual({ type: "local", command: BUNDLED.command, enabled: true, environment: BUNDLED.environment });+ expect(mcp["other-index"]).toEqual({ type: "local", command: ["node", "/opt/tools/other-mcp/index.mjs"], enabled: true });++ // Without a bundled launch, already-bundled entries are left as they are.+ expect(await migrateLegacyOmniRushUiMcpCommand(config, null)).toEqual(NOTHING_TO_DO);+ });+});diff --git a/apps/server/src/omnirush-ui-mcp-migration.ts b/apps/server/src/omnirush-ui-mcp-migration.tsnew file mode 100644index 00000000..ee7c99da--- /dev/null+++ b/apps/server/src/omnirush-ui-mcp-migration.ts@@ -0,0 +1,163 @@+import { isOmniRushUiMcpRegistryCommand } from "./omnirush-ui-mcp-command.js";+import {+ listRuntimeOpencodeConfigRows,+ runtimeMcpMap,+ writeRuntimeOpencodeConfig,+} from "./runtime-opencode-config-store.js";+import type { ServerConfig } from "./types.js";+import { isRecord } from "./workspace-kv-store.js";++/*+ * Desktop 1.0.0 to 1.0.8 persisted `npx -y omnirush-ui-mcp` as the launch+ * command of the built-in UI-control MCP. `omnirush-ui-mcp` is not a package+ * OmniRush.ai publishes on npm, so whoever registers that name would get code+ * execution through `npx`. Entries launching it from a registry (that command+ * and every variant isOmniRushUiMcpRegistryCommand matches) are rewritten on+ * load and never launched as-is.+ */++/** How the embedding desktop launches its bundled UI-control MCP. */+export type OmniRushUiMcpLaunch = {+ command: string[];+ environment?: Record<string, string>;+};++export type OmniRushUiMcpMigrationResult = {+ changed: boolean;+ /** Legacy npx entries moved to the bundled launch. */+ rewritten: Array<{ workspaceId: string; name: string }>;+ /** Earlier bundled launches whose app path moved (app relocated, AppImage remount, update). */+ refreshed: Array<{ workspaceId: string; name: string }>;+ /** Legacy npx entries removed because no bundled launch was available. */+ removed: Array<{ workspaceId: string; name: string }>;+};++const PACKAGE_RUNNERS = new Set(["npx", "bunx", "pnpx"]);++function runsPackageRunner(executable: string): boolean {+ const base = executable.split(/[\\/]/).pop()?.toLowerCase().replace(/\.(?:cmd|exe|ps1|bat)$/, "") ?? "";+ return PACKAGE_RUNNERS.has(base);+}++const BUNDLED_ENTRY_SUFFIXES = ["/omnirush-ui-mcp/index.mjs", "\\omnirush-ui-mcp\\index.mjs"];++/** `[<runtime>, <...>/omnirush-ui-mcp/index.mjs]` as written by an earlier desktop launch. */+export function isBundledOmniRushUiMcpCommand(value: unknown): boolean {+ return Array.isArray(value)+ && value.length === 2+ && value.every((part) => typeof part === "string" && part.length > 0)+ && BUNDLED_ENTRY_SUFFIXES.some((suffix) => (value[1] as string).endsWith(suffix));+}++function sameCommand(left: unknown, right: readonly string[]): boolean {+ return Array.isArray(left) && left.length === right.length && left.every((part, index) => part === right[index]);+}++function stringRecord(value: unknown): Record<string, string> {+ if (!isRecord(value)) return {};+ return Object.fromEntries(+ Object.entries(value).filter((entry): entry is [string, string] => typeof entry[1] === "string"),+ );+}++/** Accepts only a concrete, non-npx launch; anything else is treated as "no bundled MCP". */+export function normalizeOmniRushUiMcpLaunch(value: unknown): OmniRushUiMcpLaunch | null {+ if (!isRecord(value)) return null;+ const command = value.command;+ if (!Array.isArray(command) || command.length === 0) return null;+ if (!command.every((part) => typeof part === "string" && part.length > 0)) return null;+ if (runsPackageRunner(command[0]) || isOmniRushUiMcpRegistryCommand(command)) return null;+ const environment = stringRecord(value.environment);+ return {+ command: [...command],+ ...(Object.keys(environment).length ? { environment } : {}),+ };+}++function withLaunch(entry: Record<string, unknown>, launch: OmniRushUiMcpLaunch): Record<string, unknown> {+ const environment = { ...stringRecord(entry.environment), ...(launch.environment ?? {}) };+ const { environment: _previousEnvironment, ...rest } = entry;+ return {+ ...rest,+ command: [...launch.command],+ ...(Object.keys(environment).length ? { environment } : {}),+ };+}++function launchIsCurrent(entry: Record<string, unknown>, launch: OmniRushUiMcpLaunch): boolean {+ const environment = stringRecord(entry.environment);+ return sameCommand(entry.command, launch.command)+ && Object.entries(launch.environment ?? {}).every(([key, value]) => environment[key] === value);+}++/**+ * Rewrites every MCP entry that launches `omnirush-ui-mcp` from a registry.+ * With a bundled launch the entry keeps its name, enablement, and other+ * fields and gets the bundled command plus its environment. Without one (a+ * standalone server, or a desktop build missing the bundle) the entry is+ * removed: disabling alone would leave a command the MCP toggle could turn+ * back on. UI control is reconnected from the desktop app, which writes the+ * bundled launch.+ *+ * Entries that already use an earlier bundled launch are refreshed to the+ * current one: the launch carries absolute app paths, which change when the+ * app is moved or an AppImage is remounted.+ */+export function rewriteLegacyOmniRushUiMcpEntries(+ mcp: Record<string, Record<string, unknown>>,+ launch: OmniRushUiMcpLaunch | null,+): { mcp: Record<string, Record<string, unknown>>; rewritten: string[]; refreshed: string[]; removed: string[] } {+ const next: Record<string, Record<string, unknown>> = {};+ const rewritten: string[] = [];+ const refreshed: string[] = [];+ const removed: string[] = [];+ for (const [name, entry] of Object.entries(mcp)) {+ if (isRecord(entry) && isOmniRushUiMcpRegistryCommand(entry.command)) {+ if (launch) {+ next[name] = withLaunch(entry, launch);+ rewritten.push(name);+ } else {+ removed.push(name);+ }+ continue;+ }+ if (launch && isRecord(entry) && isBundledOmniRushUiMcpCommand(entry.command) && !launchIsCurrent(entry, launch)) {+ next[name] = withLaunch(entry, launch);+ refreshed.push(name);+ continue;+ }+ next[name] = entry;+ }+ return { mcp: next, rewritten, refreshed, removed };+}++/**+ * Idempotent startup migration of persisted runtime MCP entries that still+ * launch the UI-control MCP through `npx -y omnirush-ui-mcp` (and refresh of+ * stale bundled launches). Runs before the engine starts, and before any+ * other startup writer: the runtime store drops leftover registry launches on+ * any write, which would lose the entry this migration can still rewrite.+ */+export async function migrateLegacyOmniRushUiMcpCommand(+ config: ServerConfig,+ launchInput: unknown,+): Promise<OmniRushUiMcpMigrationResult> {+ const result: OmniRushUiMcpMigrationResult = { changed: false, rewritten: [], refreshed: [], removed: [] };+ if (config.readOnly) return result;+ const launch = normalizeOmniRushUiMcpLaunch(launchInput);+ const rows = await listRuntimeOpencodeConfigRows(config);+ for (const row of rows) {+ const pending = rewriteLegacyOmniRushUiMcpEntries(runtimeMcpMap(row.value), launch);+ if (!pending.rewritten.length && !pending.refreshed.length && !pending.removed.length) continue;+ let migrated = pending;+ const write = await writeRuntimeOpencodeConfig(config, row.workspaceId, (current) => {+ migrated = rewriteLegacyOmniRushUiMcpEntries(runtimeMcpMap(current), launch);+ return { ...current, mcp: migrated.mcp };+ });+ result.changed = write.changed || result.changed;+ result.rewritten.push(...migrated.rewritten.map((name) => ({ workspaceId: row.workspaceId, name })));+ result.refreshed.push(...migrated.refreshed.map((name) => ({ workspaceId: row.workspaceId, name })));+ result.removed.push(...migrated.removed.map((name) => ({ workspaceId: row.workspaceId, name })));+ }+ return result;+}diff --git a/apps/server/src/runtime-opencode-config-store.ts b/apps/server/src/runtime-opencode-config-store.tsindex 870f6afc..eaca29cd 100644--- a/apps/server/src/runtime-opencode-config-store.ts+++ b/apps/server/src/runtime-opencode-config-store.ts@@ -1,6 +1,12 @@import { desktopConfigSchema, type DesktopConfig } from "@omnirush/types/den/desktop-policies-runtime";import { existsSync } from "node:fs";import { parseApprovalMode, type ApprovalMode } from "./approval-mode.js";+import { ApiError } from "./errors.js";+import {+ isOmniRushUiMcpRegistryEntry,+ OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE,+ withoutOmniRushUiMcpRegistryEntries,+} from "./omnirush-ui-mcp-command.js";import { importNodeSqlite, runtimeDbPath } from "./runtime-db.js";import type { ServerConfig } from "./types.js";import { createWorkspaceKvStore, isRecord } from "./workspace-kv-store.js";@@ -275,18 +281,36 @@ export function mergeRuntimeOpencodeConfigLayers(});}+/**+ * The runtime config with every MCP entry that launches `omnirush-ui-mcp`+ * from a package registry removed. Whatever an older build or a direct DB+ * edit left behind, such an entry is never handed to the engine.+ */+export function withoutRegistryOmniRushUiMcp(config: RuntimeOpencodeConfig): RuntimeOpencodeConfig {+ const mcp = runtimeMcpMap(config);+ const allowed = withoutOmniRushUiMcpRegistryEntries(mcp);+ if (allowed === mcp) return config;+ const { mcp: _mcp, ...rest } = config;+ return { ...rest, ...(Object.keys(allowed).length ? { mcp: allowed } : {}) };+}++/**+ * The runtime config the engine actually runs with (ENGINE_GLOBAL row plus+ * the workspace row). The dynamic engine MCP push reads MCP entries from+ * here, so registry launches of `omnirush-ui-mcp` are filtered out.+ */export async function readEffectiveRuntimeOpencodeConfig(config: ServerConfig,workspaceId: string,): Promise<RuntimeOpencodeConfig> {if (isEngineGlobalRuntimeConfigId(workspaceId)) {- return await readRuntimeOpencodeConfig(config, workspaceId);+ return withoutRegistryOmniRushUiMcp(await readRuntimeOpencodeConfig(config, workspaceId));}const [globalRuntime, workspaceRuntime] = await Promise.all([readGlobalRuntimeOpencodeConfig(config),readRuntimeOpencodeConfig(config, workspaceId),]);- return mergeRuntimeOpencodeConfigLayers(globalRuntime, workspaceRuntime);+ return withoutRegistryOmniRushUiMcp(mergeRuntimeOpencodeConfigLayers(globalRuntime, workspaceRuntime));}/**@@ -524,6 +548,29 @@ export async function inspectRuntimeOpencodeConfig(return (await inspectRuntimeOpencodeConfigState(config, workspaceId, options)).config;}+/**+ * No writer may store an MCP entry that launches `omnirush-ui-mcp` from a+ * package registry (addMcp, the MCP toggle, the workspace config PATCH route,+ * plugin imports and migrations all write through here). A write that adds+ * one fails with 400. One already in the row before this build (it survives+ * only if the startup migration could not run) is dropped on the next write+ * instead, so unrelated writes keep working and the row converges to clean.+ */+function refuseRegistryOmniRushUiMcp(+ previous: RuntimeOpencodeConfig,+ next: RuntimeOpencodeConfig,+): RuntimeOpencodeConfig {+ const mcp = runtimeMcpMap(next);+ const blocked = Object.keys(mcp).filter((name) => isOmniRushUiMcpRegistryEntry(mcp[name]));+ if (blocked.length === 0) return next;+ const previousMcp = runtimeMcpMap(previous);+ const added = blocked.filter((name) => !isOmniRushUiMcpRegistryEntry(previousMcp[name]));+ if (added.length > 0) {+ throw new ApiError(400, "unsafe_mcp_command", OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE, { mcp: added });+ }+ return normalizeRuntimeOpencodeConfig(withoutRegistryOmniRushUiMcp(next));+}+// All runtime writers share this queue. A provider refresh cannot overwrite a// newer Den policy, and ordinary config edits cannot replace managed policy.const runtimeWrites = new WeakMap<ServerConfig, Promise<unknown>>();@@ -535,7 +582,8 @@ function updateRuntimeConfig(const pending = runtimeWrites.get(config) ?? Promise.resolve();const result = pending.catch(() => undefined).then(async () => {const row = await runtimeOpencodeConfigStore.getRow(config, workspaceId);- const next = normalizeRuntimeOpencodeConfig(updater(row?.value ?? {}));+ const current = row?.value ?? {};+ const next = refuseRegistryOmniRushUiMcp(current, normalizeRuntimeOpencodeConfig(updater(current)));const configJson = runtimeOpencodeConfigStore.serialize(next);if (row?.valueJson === configJson) return { config: next, changed: false };await runtimeOpencodeConfigStore.setSerialized(config, workspaceId, configJson, Date.now());diff --git a/apps/server/src/validators.test.ts b/apps/server/src/validators.test.tsindex 97ccf8d1..c12b7d41 100644--- a/apps/server/src/validators.test.ts+++ b/apps/server/src/validators.test.ts@@ -144,6 +144,35 @@ describe("validateMcpConfig", () => {expect(() => validateMcpConfig({ type: "remote", url: "javascript:alert(1)" })).toThrow();});+ test("rejects a registry launch of omnirush-ui-mcp with 400 unsafe_mcp_command", () => {+ for (const command of [+ ["npx", "-y", "omnirush-ui-mcp"],+ ["bunx", "omnirush-ui-mcp@latest"],+ ["pnpm", "dlx", "omnirush-ui-mcp"],+ ["sh", "-c", "npx -y omnirush-ui-mcp"],+ ]) {+ let error: unknown;+ try {+ validateMcpConfig({ type: "local", command, enabled: true });+ } catch (caught) {+ error = caught;+ }+ expect(error).toMatchObject({ status: 400, code: "unsafe_mcp_command" });+ }+ // The command is checked whatever the declared type.+ expect(() => validateMcpConfig({ type: "remote", url: "https://example.com", command: ["npx", "-y", "omnirush-ui-mcp"] }))+ .toThrow("not published on npm");+ // The bundled launch runs the file by path and stays valid.+ expect(() => validateMcpConfig({+ type: "local",+ command: [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs",+ ],+ environment: { ELECTRON_RUN_AS_NODE: "1" },+ })).not.toThrow();+ });+test("rejects local without command", () => {expect(() => validateMcpConfig({ type: "local" })).toThrow();expect(() => validateMcpConfig({ type: "local", command: [] })).toThrow();diff --git a/apps/server/src/validators.ts b/apps/server/src/validators.tsindex b5cfff25..96f3e893 100644--- a/apps/server/src/validators.ts+++ b/apps/server/src/validators.ts@@ -1,4 +1,5 @@import { ApiError } from "./errors.js";+import { isOmniRushUiMcpRegistryCommand, OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE } from "./omnirush-ui-mcp-command.js";const SKILL_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;const COMMAND_NAME_REGEX = /^[A-Za-z0-9_-]+$/;@@ -64,6 +65,12 @@ export function validateMcpConfig(config: Record<string, unknown>): void {throw new ApiError(400, "invalid_mcp_config", "Local MCP requires command array");}}+ // Checked for any entry carrying a command, whatever its type. OmniRush.ai+ // does not publish omnirush-ui-mcp, so resolving it from a registry would+ // run whatever someone else published under that name.+ if (isOmniRushUiMcpRegistryCommand(config.command)) {+ throw new ApiError(400, "unsafe_mcp_command", OMNIRUSH_UI_MCP_REGISTRY_COMMAND_MESSAGE);+ }if (type === "remote") {const url = config.url;if (!url || typeof url !== "string" || url.trim().length === 0) {diff --git a/docs/enterprise/outbound-access.json b/docs/enterprise/outbound-access.jsonindex fd29468b..371233ef 100644--- a/docs/enterprise/outbound-access.json+++ b/docs/enterprise/outbound-access.json@@ -45,51 +45,6 @@"blockedEffect": "Direct OpenAI voice, image, or native model requests fail for users who configured OpenAI.","override": null},- {- "host": "api.omnirush.software",- "kind": "fetched",- "components": ["server"],- "purpose": "Legacy hosted Connect API origin inherited from the upstream product and not operated by omnirush.ai. It remains only in a built-in Connect endpoint trust list.",- "requirement": "optional",- "blockedEffect": "None for omnirush.ai installs; only configurations that still point at this legacy origin are affected.",- "override": "self-hosted Den API origin"- },- {- "host": "api.omnirushlabs.com",- "kind": "fetched",- "components": ["installer", "server"],- "purpose": "Retired hosted Den public API origin. It remains only in built-in endpoint trust lists and the bootstrap CLI default, and is contacted only if a configuration points at it.",- "requirement": "optional",- "blockedEffect": "None. Retired hosted service: omnirush.ai runs no hosted Den and this host no longer resolves.",- "override": "installer apiUrl / self-hosted Den API origin"- },- {- "host": "api.app.omnirushlabs.com",- "kind": "fetched",- "components": ["desktop", "renderer", "server"],- "purpose": "Retired hosted Den API origin. It remains only in a built-in Connect endpoint trust list and is contacted only if a Den configuration points at it.",- "requirement": "optional",- "blockedEffect": "None. Retired hosted service: omnirush.ai runs no hosted Den and this host no longer resolves.",- "override": "desktop apiBaseUrl / self-hosted Den API origin"- },- {- "host": "app.omnirush.software",- "kind": "fetched",- "components": ["server"],- "purpose": "Legacy hosted Cloud web origin inherited from the upstream product and not operated by omnirush.ai. It remains only in a built-in Connect endpoint trust list.",- "requirement": "optional",- "blockedEffect": "None for omnirush.ai installs; only configurations that still point at this legacy origin are affected.",- "override": "desktop base URL (self-hosted Den replaces this host)"- },- {- "host": "app.omnirushlabs.com",- "kind": "fetched",- "components": ["desktop", "renderer", "bootstrap"],- "purpose": "Retired hosted Den web origin. It remains only in built-in endpoint trust lists and the bootstrap CLI default; the desktop has no default Den and contacts it only if someone configures it as the Den base URL.",- "requirement": "optional",- "blockedEffect": "None. Retired hosted service: omnirush.ai runs no hosted Den and this host no longer resolves.",- "override": "desktop base URL (self-hosted Den replaces this host)"- },{"host": "cdn.simpleicons.org","kind": "fetched",@@ -301,9 +256,9 @@"host": "registry.npmjs.org","kind": "subprocess","components": ["desktop", "renderer"],- "purpose": "npx package resolution for omnirush-ui-mcp and development-only MCP helper commands.",- "requirement": "required-in-practice",- "blockedEffect": "The OmniRush.ai UI-control MCP is silently unavailable when npx cannot download omnirush-ui-mcp.",+ "purpose": "npx package resolution for local MCP servers a user or administrator configures with an npx command. The built-in UI-control MCP is bundled with the desktop app and never uses npx.",+ "requirement": "opt-in",+ "blockedEffect": "User-configured npx MCP servers cannot download their packages.","override": "npm registry configuration used by npx"},{diff --git a/docs/mcp-ui-control-profile.md b/docs/mcp-ui-control-profile.mdindex 602b84d1..77a20417 100644--- a/docs/mcp-ui-control-profile.md+++ b/docs/mcp-ui-control-profile.md@@ -53,28 +53,46 @@ Inside OmniRush.ai, agents control the app through the semantic tools (`omnirush## Install-```bash-npm install -g omnirush-ui-mcp-```--Or run without installing:+Nothing to install. The UI-control MCP ships inside the OmniRush.ai desktop app+as a single bundled file and runs with the app's own binary in Node mode:```bash-npx omnirush-ui-mcp+ELECTRON_RUN_AS_NODE=1 "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai" \+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs"```-> The package is [`omnirush-ui-mcp` on npm](https://www.npmjs.com/package/omnirush-ui-mcp).+The paths above are the macOS default. **Settings -> Extensions -> UI Control**+shows the exact command, environment, and client config for your installation.++> `omnirush-ui-mcp` is **not** published on npm. Never configure it as+> `npx omnirush-ui-mcp` or install it with `npm install`: a package with that+> name on a public registry is not the UI-control MCP. omnirush-server refuses+> to store or launch any MCP command that resolves `omnirush-ui-mcp` by name+> (`npx`, `bunx`, `pnpm dlx`, `yarn dlx`, `npm exec`, a global install). On+> startup the desktop app rewrites a stored `npx -y omnirush-ui-mcp` command to+> the bundled one; a standalone server removes it, and UI control is+> reconnected from the desktop app.+>+> Configs outside the app are not migrated. If desktop 1.0.8 or earlier gave+> you the `npx` snippet for Claude Desktop, Cursor, or OpenCode, or wrote it+> into a workspace `opencode.json`, replace it with the command shown in+> **Settings -> Extensions -> UI Control**.## Add to OpenCode-Add the MCP server to your workspace or global `opencode.json`:+Add the MCP server to your workspace or global `opencode.json`, using the+command shown in the app:```json{"mcp": {"omnirush-ui": {"type": "local",- "command": ["npx", "-y", "omnirush-ui-mcp"],+ "command": [+ "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs"+ ],+ "environment": { "ELECTRON_RUN_AS_NODE": "1" },"enabled": true}}@@ -95,8 +113,9 @@ Both use the same MCP config shape. Add to your `claude_desktop_config.json` or{"mcpServers": {"omnirush-ui": {- "command": "npx",- "args": ["-y", "omnirush-ui-mcp"]+ "command": "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ "args": ["/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs"],+ "env": { "ELECTRON_RUN_AS_NODE": "1" }}}}@@ -113,8 +132,9 @@ import { Client } from "@modelcontextprotocol/sdk/client/index.js";import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";const transport = new StdioClientTransport({- command: "npx",- args: ["-y", "omnirush-ui-mcp"],+ command: "/Applications/OmniRush.ai.app/Contents/MacOS/OmniRush.ai",+ args: ["/Applications/OmniRush.ai.app/Contents/Resources/omnirush-ui-mcp/index.mjs"],+ env: { ...process.env, ELECTRON_RUN_AS_NODE: "1" },});const client = new Client({ name: "my-app", version: "1.0.0" });await client.connect(transport);@@ -252,4 +272,4 @@ The exact list depends on the current OmniRush.ai route and state. Common action3. `omnirush-ui-mcp` reads the discovery file, proxies MCP tool calls to the bridge, and returns structured results.4. The bridge calls `window.__omnirushControl` inside the Electron renderer to snapshot state and execute actions.-The bridge and discovery file are implementation details — you never need to touch them directly. Just point your MCP client at `omnirush-ui-mcp`.+The bridge and discovery file are implementation details — you never need to touch them directly. Just point your MCP client at the bundled `omnirush-ui-mcp/index.mjs` shown in the app.diff --git a/ee/apps/den-api/test/agent-plugin-v1.test.ts b/ee/apps/den-api/test/agent-plugin-v1.test.tsindex c46d7a29..9d145002 100644--- a/ee/apps/den-api/test/agent-plugin-v1.test.ts+++ b/ee/apps/den-api/test/agent-plugin-v1.test.ts@@ -28,7 +28,7 @@ describe("Agent Plugins v1", () => {entries: [{config: {type: "streamable-http",- url: "https://api.omnirushlabs.com/mcp/agent",+ url: "https://replace-with-your-den-api-origin.invalid/mcp/agent",},name: "omnirush",valid: true,diff --git a/evals/drivers/desktop-policies-two-surface.mts b/evals/drivers/desktop-policies-two-surface.mtsindex 4892522b..38896312 100644--- a/evals/drivers/desktop-policies-two-surface.mts+++ b/evals/drivers/desktop-policies-two-surface.mts@@ -34,7 +34,7 @@ const DEN_API = "http://localhost:8790";const DEN_WEB = "http://localhost:3005";const ADMIN_EMAIL = "[email protected]";const ADMIN_PASSWORD = "OmniRushDemo123!";-const DEMO_LOGO = "https://omnirushlabs.com/favicon.ico";+const DEMO_LOGO = "https://omnirush.ai/omnirush-mark.png";const __dirname = dirname(fileURLToPath(import.meta.url));const runId = new Date().toISOString().replace(/[:.]/g, "-");diff --git a/evals/specs/den-sdk.test.ts b/evals/specs/den-sdk.test.tsindex 62527cd2..073bd88a 100644--- a/evals/specs/den-sdk.test.ts+++ b/evals/specs/den-sdk.test.ts@@ -12,18 +12,22 @@ test.skipIf(!available)(async ({ evidence, place }) => {console.log(`placement: ${place.kind} (PR lane resolved by testkit)`);await using den = await server({ place, web: false, org: { name: "SDK integration", members: {} } });- let defaultUrl = "";- const defaultClient = createDenClient({+ // There is no hosted Den, so the SDK has no default origin and refuses to+ // build a client without one.+ expect(() => createDenClient({} as Parameters<typeof createDenClient>[0])).toThrow(/explicit baseUrl/);+ let transportUrl = "";+ const transportClient = createDenClient({+ baseUrl: "https://den.example.com",fetch: async (input, init) => {const request = new Request(input, init);- defaultUrl = request.url;- // Route the default production URL to the isolated test server.+ transportUrl = request.url;+ // Route the configured origin to the isolated test server.return fetch(new Request(`${den.ref.apiUrl}${new URL(request.url).pathname}`, request));},});- const defaultHealth = await defaultClient.getHealth();- expect(defaultUrl).toBe("https://api.omnirushlabs.com/health");- expect(defaultHealth.response.status).toBe(200);+ const transportHealth = await transportClient.getHealth();+ expect(transportUrl).toBe("https://den.example.com/health");+ expect(transportHealth.response.status).toBe(200);const anonymous = createDenClient({ baseUrl: den.ref.apiUrl });const health = await anonymous.getHealth();expect(health.response.status).toBe(200);@@ -32,8 +36,8 @@ test.skipIf(!available)(expect(denied.data).toBeUndefined();evidence.recordAssertionEvidence("Public health and protected identity", "Health succeeds without credentials; identity returns 401 with no data.",health.response.status === 200 && denied.response.status === 401 && denied.data === undefined);- evidence.recordAssertionEvidence("Default URL and custom transport", "The default HTTPS health URL is passed to the custom fetch, which reaches the isolated Den successfully.",- defaultUrl === "https://api.omnirushlabs.com/health" && defaultHealth.response.status === 200);+ evidence.recordAssertionEvidence("Explicit base URL and custom transport", "A client without a base URL is refused; the configured HTTPS health URL is passed to the custom fetch, which reaches the isolated Den successfully.",+ transportUrl === "https://den.example.com/health" && transportHealth.response.status === 200);const session = createDenClient({ baseUrl: den.ref.apiUrl, token: den.admin.token });const identity = await session.getV1Me({ throwOnError: true });diff --git a/evals/specs/first-run-cloud-share.e2e.test.ts b/evals/specs/first-run-cloud-share.e2e.test.tsindex 5a78c3f8..1fd560b8 100644--- a/evals/specs/first-run-cloud-share.e2e.test.ts+++ b/evals/specs/first-run-cloud-share.e2e.test.ts@@ -62,7 +62,7 @@ test("first run signs in through the browser, then shares a skill with a colleagappName: "OmniRush.ai", clientName: "Install Journey", requireSignin: true,logoUrl: null, iconUrl: null, desktopVersion: "0.18.0", distribution: "cloud",// A session-backed local/preview install must not jump to a configured hosted default.- webUrl: url.searchParams.has("token") ? `${webUrl}/ignored-config-path` : "https://app.omnirushlabs.com",+ webUrl: url.searchParams.has("token") ? `${webUrl}/ignored-config-path` : "https://configured-default.example.com",apiUrl,});};diff --git a/evals/specs/prod-den-signup-invites.live.test.ts b/evals/specs/prod-den-signup-invites.live.test.tsindex 166c8f87..f0d7a7d2 100644--- a/evals/specs/prod-den-signup-invites.live.test.ts+++ b/evals/specs/prod-den-signup-invites.live.test.ts@@ -332,7 +332,8 @@ test(title, { timeout: 240_000 }, async ({ evidence }) => {needs(requirements);const apiUrl = requiredEnv("OMNIRUSH_EVAL_LIVE_DEN_API_URL").replace(/\/+$/, "");const agentMailApiKey = requiredEnv("AGENTMAIL_API_KEY");- const webUrl = apiUrl === "https://api.omnirushlabs.com" ? "https://app.omnirushlabs.com" : apiUrl;+ // No hosted Den: a split web origin must be configured explicitly.+ const webUrl = (process.env.OMNIRUSH_EVAL_LIVE_DEN_WEB_URL?.trim() || apiUrl).replace(/\/+$/, "");const den: DenRef = { apiUrl, webUrl };const runStartedAt = new Date().toISOString();const timestamp = runStartedAt.replace(/\D/g, "");diff --git a/integrations/agent-plugins/omnirush-connect/README.md b/integrations/agent-plugins/omnirush-connect/README.mdindex a96039c1..df3bd213 100644--- a/integrations/agent-plugins/omnirush-connect/README.md+++ b/integrations/agent-plugins/omnirush-connect/README.md@@ -4,10 +4,21 @@ This directory is the portable OmniRush.ai Connect package for the publishedAgent Plugins 1.0.0 specification. Install or copy the complete directorythrough an Agent Plugins-compatible client. The package installs:-- the remote OmniRush.ai MCP endpoint;+- the remote OmniRush.ai MCP endpoint of your organization's Den;- guidance for the `search_capabilities` and `execute_capability` workflow;- no credentials or client-specific authentication configuration.+## Set your Den endpoint before installing++omnirush.ai runs no hosted Den, so this package has no working default+endpoint. `mcp.json` ships with the placeholder+`https://replace-with-your-den-api-origin.invalid/mcp/agent`. The `.invalid`+top-level domain is reserved and never resolves, so an unedited package fails+closed instead of sending anything to a host you do not control. Replace the+URL with your Den API origin followed by `/mcp/agent`, for example+`https://den.example.com/mcp/agent`, before you install or distribute the+package.+The MCP client discovers OmniRush.ai OAuth from the endpoint and opens the normalbrowser sign-in flow. Access remains scoped to the selected organization andthe signed-in member's grants.diff --git a/integrations/agent-plugins/omnirush-connect/mcp.json b/integrations/agent-plugins/omnirush-connect/mcp.jsonindex 5d5a29d8..b38deda4 100644--- a/integrations/agent-plugins/omnirush-connect/mcp.json+++ b/integrations/agent-plugins/omnirush-connect/mcp.json@@ -3,7 +3,7 @@"mcpServers": {"omnirush": {"type": "streamable-http",- "url": "https://api.omnirushlabs.com/mcp/agent"+ "url": "https://replace-with-your-den-api-origin.invalid/mcp/agent"}}}diff --git a/package.json b/package.jsonindex fed31792..5416bfe9 100644--- a/package.json+++ b/package.json@@ -21,7 +21,7 @@"dev:den:mysql": "docker compose -p omnirush-den-local -f packaging/docker/docker-compose.web-local.yml up -d --wait mysql redis","dev:den:mysql:down": "docker compose -p omnirush-den-local -f packaging/docker/docker-compose.web-local.yml down","dev:den:db-push": "DATABASE_URL=${DATABASE_URL:-mysql://root:[email protected]:3306/omnirush_den} DEN_DB_ENCRYPTION_KEY=${DEN_DB_ENCRYPTION_KEY:-local-dev-db-encryption-key-please-change-1234567890} pnpm --filter @omnirush-ee/den-db db:push",- "dev:den:api": "DEN_WEB_PORT=${DEN_WEB_PORT:-3005}; OMNIRUSH_APP_PORT=${OMNIRUSH_APP_PORT:-5173}; DEN_LOCAL_ORIGINS=http://localhost:$DEN_WEB_PORT,http://127.0.0.1:$DEN_WEB_PORT,http://localhost:$OMNIRUSH_APP_PORT,http://127.0.0.1:$OMNIRUSH_APP_PORT; OMNIRUSH_DEV_MODE=1 DEN_PASSWORD_BREACH_SCREENING_ENABLED=${DEN_PASSWORD_BREACH_SCREENING_ENABLED:-false} PORT=${DEN_API_PORT:-8790} DATABASE_URL=${DATABASE_URL:-mysql://root:[email protected]:3306/omnirush_den} DATABASE_REDIS_URL=${DATABASE_REDIS_URL:-redis://127.0.0.1:6379} DEN_DB_ENCRYPTION_KEY=${DEN_DB_ENCRYPTION_KEY:-local-dev-db-encryption-key-please-change-1234567890} BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-local-dev-secret-not-for-production-use!!} DEN_BASE_URL=${DEN_BASE_URL:-http://localhost:$DEN_WEB_PORT} DEN_BETTER_AUTH_TRUSTED_ORIGINS=${DEN_BETTER_AUTH_TRUSTED_ORIGINS:-$DEN_LOCAL_ORIGINS} CORS_ORIGINS=${CORS_ORIGINS:-$DEN_LOCAL_ORIGINS} DEN_DIAGNOSTICS_ORIGIN=${DEN_DIAGNOSTICS_ORIGIN:-https://diagnostic.omnirushlabs.com} DEN_DIAGNOSTICS_BEARER_TOKEN=${DEN_DIAGNOSTICS_BEARER_TOKEN:-OmniRushDiagnosticsToken!} PROVISIONER_MODE=${PROVISIONER_MODE:-stub} pnpm --filter @omnirush-ee/den-api dev:local",+ "dev:den:api": "DEN_WEB_PORT=${DEN_WEB_PORT:-3005}; OMNIRUSH_APP_PORT=${OMNIRUSH_APP_PORT:-5173}; DEN_LOCAL_ORIGINS=http://localhost:$DEN_WEB_PORT,http://127.0.0.1:$DEN_WEB_PORT,http://localhost:$OMNIRUSH_APP_PORT,http://127.0.0.1:$OMNIRUSH_APP_PORT; OMNIRUSH_DEV_MODE=1 DEN_PASSWORD_BREACH_SCREENING_ENABLED=${DEN_PASSWORD_BREACH_SCREENING_ENABLED:-false} PORT=${DEN_API_PORT:-8790} DATABASE_URL=${DATABASE_URL:-mysql://root:[email protected]:3306/omnirush_den} DATABASE_REDIS_URL=${DATABASE_REDIS_URL:-redis://127.0.0.1:6379} DEN_DB_ENCRYPTION_KEY=${DEN_DB_ENCRYPTION_KEY:-local-dev-db-encryption-key-please-change-1234567890} BETTER_AUTH_SECRET=${BETTER_AUTH_SECRET:-local-dev-secret-not-for-production-use!!} DEN_BASE_URL=${DEN_BASE_URL:-http://localhost:$DEN_WEB_PORT} DEN_BETTER_AUTH_TRUSTED_ORIGINS=${DEN_BETTER_AUTH_TRUSTED_ORIGINS:-$DEN_LOCAL_ORIGINS} CORS_ORIGINS=${CORS_ORIGINS:-$DEN_LOCAL_ORIGINS} DEN_DIAGNOSTICS_ORIGIN=${DEN_DIAGNOSTICS_ORIGIN:-https://diagnostics.invalid} DEN_DIAGNOSTICS_BEARER_TOKEN=${DEN_DIAGNOSTICS_BEARER_TOKEN:-OmniRushDiagnosticsToken!} PROVISIONER_MODE=${PROVISIONER_MODE:-stub} pnpm --filter @omnirush-ee/den-api dev:local","dev:den:inference": "DEN_WEB_PORT=${DEN_WEB_PORT:-3005}; OMNIRUSH_APP_PORT=${OMNIRUSH_APP_PORT:-5173}; INFERENCE_PORT=${INFERENCE_PORT:-8791}; DEN_LOCAL_ORIGINS=http://localhost:$DEN_WEB_PORT,http://127.0.0.1:$DEN_WEB_PORT,http://localhost:$OMNIRUSH_APP_PORT,http://127.0.0.1:$OMNIRUSH_APP_PORT; OMNIRUSH_DEV_MODE=1 PORT=$INFERENCE_PORT DATABASE_URL=${DATABASE_URL:-mysql://root:[email protected]:3306/omnirush_den} DEN_DB_ENCRYPTION_KEY=${DEN_DB_ENCRYPTION_KEY:-local-dev-db-encryption-key-please-change-1234567890} CORS_ORIGINS=${CORS_ORIGINS:-$DEN_LOCAL_ORIGINS} INFERENCE_PROXY_BASE_URL=${INFERENCE_PROXY_BASE_URL:-http://localhost:$INFERENCE_PORT} INFERENCE_ADMIN_TOKEN=${INFERENCE_ADMIN_TOKEN:-local-dev-admin-token} INFERENCE_WEBHOOK_SECRET=${INFERENCE_WEBHOOK_SECRET:-local-dev-webhook-secret} pnpm --filter @omnirush-ee/inference dev:local","dev:den:web": "DEN_API_PORT=${DEN_API_PORT:-8790}; DEN_WEB_PORT=${DEN_WEB_PORT:-3005}; OMNIRUSH_DEV_MODE=1 NEXT_PUBLIC_POSTHOG_KEY= NEXT_PUBLIC_POSTHOG_API_KEY= DEN_API_BASE=${DEN_API_BASE:-http://localhost:$DEN_API_PORT} DEN_BASE_URL=${DEN_BASE_URL:-http://localhost:$DEN_WEB_PORT} DEN_AUTH_ORIGIN=${DEN_AUTH_ORIGIN:-http://localhost:$DEN_WEB_PORT} DEN_AUTH_FALLBACK_BASE=${DEN_AUTH_FALLBACK_BASE:-http://localhost:$DEN_API_PORT} pnpm --filter @omnirush-ee/den-web dev:local","email:dev": "pnpm --filter @omnirush/email dev",diff --git a/packages/docs/model-context-protocol/agent-plugins.mdx b/packages/docs/model-context-protocol/agent-plugins.mdxindex 0488ee03..a655208b 100644--- a/packages/docs/model-context-protocol/agent-plugins.mdx+++ b/packages/docs/model-context-protocol/agent-plugins.mdx@@ -15,12 +15,15 @@ The package contains:- `plugin.json`, targeting the published Agent Plugins 1.0.0 schema for broadclient compatibility;-- `mcp.json`, pointing at the OmniRush.ai Connect Streamable HTTP endpoint;+- `mcp.json`, with a placeholder OmniRush.ai Connect Streamable HTTP endpoint+ (`https://replace-with-your-den-api-origin.invalid/mcp/agent`) that you+ replace with your Den API origin plus `/mcp/agent`. The reserved `.invalid`+ domain never resolves, so an unedited package fails closed;- an `omnirush-connect` skill that teaches the agent to search for an exactorganizational capability before executing it.-Install or copy the complete package directory using your client's Agent-Plugins workflow. The standard does not define a registry or one universal+Set the endpoint in `mcp.json`, then install or copy the complete package+directory using your client's Agent Plugins workflow. The standard does not define a registry or one universalinstallation command, so the last installation step depends on the client.The package does not contain credentials or an `Authorization` header. Yourdiff --git a/packages/docs/start-here/air-gapped-deployment.mdx b/packages/docs/start-here/air-gapped-deployment.mdxindex b1c09004..f36ba1a6 100644--- a/packages/docs/start-here/air-gapped-deployment.mdx+++ b/packages/docs/start-here/air-gapped-deployment.mdx@@ -38,7 +38,7 @@ See [Installer delivery](/start-here/installer-delivery) for the exact filenames### Desktop runtime dependencies- The desktop fetches no model catalog by default: the engine uses the model list bundled with it. To refresh model metadata, point `OPENCODE_MODELS_URL` at an internal mirror of the model catalog (an `api.json` in the models.dev format).-- The packaged desktop can start the UI-control MCP with `npx -y omnirush-ui-mcp`. In a fully isolated environment, provide an internal npm registry or npm mirror that can serve that package to `npx`. OmniRush.ai does not currently document a separate OmniRush.ai-specific registry override for this package; use standard npm configuration for the runtime account.+- The UI-control MCP ships inside the packaged desktop and runs with the app's own binary, so it needs no npm registry. Only MCP servers you configure yourself with an `npx` command need an internal npm registry or mirror.- Disable, mirror, or manage desktop updates and GitHub release assets through your internal release process. Do not assume a built-in updater mirror setting unless it has been verified for the desktop release you ship.### Feature dependenciesdiff --git a/packages/docs/start-here/outbound-network-access.mdx b/packages/docs/start-here/outbound-network-access.mdxindex 7c811b5a..ce287a0f 100644--- a/packages/docs/start-here/outbound-network-access.mdx+++ b/packages/docs/start-here/outbound-network-access.mdx@@ -14,7 +14,6 @@ omnirush.aigithub.comrelease-assets.githubusercontent.comobjects.githubusercontent.com-registry.npmjs.org```If the desktop connects to a self-hosted Den, also allow its web origin (and its API origin when that is separate). omnirush.ai does not run a hosted Den.@@ -22,7 +21,7 @@ If the desktop connects to a self-hosted Den, also allow its web origin (and itsCommon misses:- GitHub release downloads redirect away from `github.com`. Allow `release-assets.githubusercontent.com`, which is the current verified GitHub release-asset host, and `objects.githubusercontent.com`, which is kept for older clients and rollback paths.-- `registry.npmjs.org` is used when packaged desktop builds start `npx -y omnirush-ui-mcp`. If it is blocked, the desktop can still open, but UI-control MCP is unavailable.+- The built-in UI-control MCP ships inside the desktop app and runs with the app's own binary, so it needs no npm registry access. `registry.npmjs.org` is only reached by MCP servers you configure yourself with an `npx` command.- The desktop fetches no model catalog by default; the engine uses the model list bundled with it. Set `OPENCODE_MODELS_URL` to an approved internal mirror if you need fresher model metadata.## Desktop and local runtime destinations@@ -35,7 +34,7 @@ Common misses:| `github.com` | Required in practice unless mirrored | Installer/updater release URLs, GitHub issue links, and GitHub plugin source URLs. | Install/update downloads cannot start; GitHub links may not open. || `release-assets.githubusercontent.com` | Required in practice unless mirrored | Current GitHub release-asset redirect target. | Downloads start from `github.com` and fail partway through. || `objects.githubusercontent.com` | Required in practice for legacy/rollback | Legacy GitHub release-asset redirect target. | Older clients or rollback downloads can fail partway through. |-| `registry.npmjs.org` | Required in practice unless npm is mirrored | `npx` package resolution for `omnirush-ui-mcp` and development-only helper commands. | OmniRush.ai UI-control MCP is unavailable. |+| `registry.npmjs.org` | Opt-in | `npx` package resolution for local MCP servers a user or administrator configures with an `npx` command. The built-in UI-control MCP is bundled with the app and never uses it. | User-configured `npx` MCP servers cannot download their packages. || Your model catalog mirror, if configured | Optional | Model catalog passed to the engine as `OPENCODE_MODELS_URL`. There is no default catalog. | The engine keeps the model list bundled with it. || `cdn.simpleicons.org` | Optional | Provider icons when no local icon exists. | Some icons are missing. || `www.google.com` | Optional | Favicon image service and embedded browser new-tab page. | Favicons or the browser panel new tab may not load. |diff --git a/packages/email/src/templates/organization-invite.tsx b/packages/email/src/templates/organization-invite.tsxindex f1e36f33..a18de3d1 100644--- a/packages/email/src/templates/organization-invite.tsx+++ b/packages/email/src/templates/organization-invite.tsx@@ -1,7 +1,8 @@import React, { type CSSProperties } from "react"import { Body, Button, Container, Head, Heading, Hr, Html, Img, Preview, Section, Text } from "@react-email/components"-const LOGO_URL = "https://omnirushlabs.com/email/omnirush-mark.png"+// Served by the console app at the omnirush.ai edge (512x512 PNG).+const LOGO_URL = "https://omnirush.ai/omnirush-mark.png"export type OrganizationInviteEmailProps = {inviteLink: string@@ -27,7 +28,7 @@ export function OrganizationInviteEmail({<Body style={styles.body}><Container style={styles.frame}><Section style={styles.brand}>- <Img src={LOGO_URL} width="31" height="24" alt="OmniRush.ai" style={styles.brandLogo} />+ <Img src={LOGO_URL} width="24" height="24" alt="OmniRush.ai" style={styles.brandLogo} /><span style={styles.brandName}>OmniRush.ai</span></Section><Section style={styles.card}>diff --git a/packages/omnirush-bootstrap/bin/omnirush.mjs b/packages/omnirush-bootstrap/bin/omnirush.mjsindex 0ebc2c79..46665c89 100644--- a/packages/omnirush-bootstrap/bin/omnirush.mjs+++ b/packages/omnirush-bootstrap/bin/omnirush.mjs@@ -85,11 +85,12 @@ function printHelp() {" not print claim links preemptively.","","Options:",+ " --base-url Your Den API origin. Required for cloud commands:",+ " omnirush.ai runs no hosted Den, so there is no default."," --web-base-url Browser-facing origin written into --prepare-desktop's"," config (used for the app's Sign In button and claim",- " links). Defaults to https://app.omnirushlabs.com when",- " --base-url is the hosted API (api.omnirushlabs.com);",- " set explicitly for self-hosted/custom deployments.",+ " links). Defaults to --base-url; set it explicitly when",+ " the Den web app is served from a different origin."," --json Print machine-readable JSON"," --version Print version"," --help Show help",@@ -145,24 +146,20 @@ function defaultDeviceKeyPath() {// The desktop app's `desktop-bootstrap.json` `baseUrl` field is the WEB origin// it opens in the user's browser for sign-in (e.g. for "Sign in" and claim-// links) - it is a different host than the API origin used for CLI/API calls-// (`--base-url`, `apiBaseUrl`). Reusing the API host here breaks sign-in: the-// browser opens `https://api.omnirushlabs.com/?mode=sign-in...` and shows raw-// API JSON instead of the sign-in page. Derive the correct web host instead-// of assuming it equals the API host.+// links). It can differ from the API origin used for CLI/API calls+// (`--base-url`, `apiBaseUrl`); when it does, pass --web-base-url so the+// browser does not land on raw API JSON. There is no hosted Den to special+// case, so without --web-base-url the web origin defaults to the API origin+// (a self-hosted den-web that proxies the API on the same origin).function deriveWebBaseUrl(apiBaseUrl) {- try {- const url = new URL(apiBaseUrl)- if (url.hostname === "api.omnirushlabs.com") {- return "https://app.omnirushlabs.com"- }- // Local/self-hosted dev: den-web commonly proxies the API at a different- // port on the same host (see ee/apps/den-web's /api/den proxy). Callers- // that need this to be exact should pass --web-base-url explicitly.- return apiBaseUrl- } catch {- return apiBaseUrl- }+ return apiBaseUrl+}++function missingRequiredFlagMessage(name) {+ const flag = `--${name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`+ return name === "baseUrl"+ ? `missing_required_flag: ${flag} (your Den API origin, e.g. https://den.example.com; omnirush.ai runs no hosted Den)`+ : `missing_required_flag: ${flag}`}function slugifySkillName(value) {@@ -796,7 +793,7 @@ async function runCloudOnboard(args) {const webBaseUrl = getFlag(args.flags, "web-base-url", deriveWebBaseUrl(baseUrl))?.replace(/\/$/, "")for (const [name, value] of Object.entries({ baseUrl, ownerEmail, ownerPassword, orgName, inviteEmail })) {- if (!value) throw new Error(`missing_required_flag: --${name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`)+ if (!value) throw new Error(missingRequiredFlagMessage(name))}const health = await request(baseUrl, "/health", { method: "GET" })@@ -868,7 +865,7 @@ async function runCloudOnboard(args) {async function runCloudBootstrapWorkspace(args) {const json = hasFlag(args.flags, "json")- const baseUrl = getFlag(args.flags, "base-url", "https://api.omnirushlabs.com")?.replace(/\/$/, "")+ const baseUrl = getFlag(args.flags, "base-url")?.replace(/\/$/, "")const workspaceName = getFlag(args.flags, "workspace-name")const skillName = getFlag(args.flags, "skill-name", "First OmniRush.ai Skill")const ownerEmail = getFlag(args.flags, "owner-email")@@ -887,7 +884,7 @@ async function runCloudBootstrapWorkspace(args) {.filter(Boolean)for (const [name, value] of Object.entries({ baseUrl, workspaceName })) {- if (!value) throw new Error(`missing_required_flag: --${name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)}`)+ if (!value) throw new Error(missingRequiredFlagMessage(name))}const health = await request(baseUrl, "/health", { method: "GET" })diff --git a/packages/omnirush-bootstrap/start.md b/packages/omnirush-bootstrap/start.mdindex 988e9178..9b1e9b3e 100644--- a/packages/omnirush-bootstrap/start.md+++ b/packages/omnirush-bootstrap/start.md@@ -24,13 +24,16 @@ node packages/omnirush-bootstrap/bin/omnirush.mjs install \--json```-In production, download the bootstrap script, inspect it, then run it. Do not-pipe remote scripts directly into a shell. The script downloads the+Otherwise, download the bootstrap script from the install origin your+organization's administrator gave you, inspect it, then run it. Do not pipe+remote scripts directly into a shell. The script downloads the`omnirush-bootstrap` CLI (a single dependency-free Node file) and installs it-into `$HOME/.local/bin` - no npm or npx required.+into `$HOME/.local/bin` - no npm or npx required. There is no public hosted+install origin: the former hosted domain is retired, so never substitute a+guessed URL.```bash-curl -fsSLo /tmp/omnirush-install.sh https://omnirushlabs.com/install.sh+curl -fsSLo /tmp/omnirush-install.sh https://<your-install-origin>/install.shless /tmp/omnirush-install.shsh /tmp/omnirush-install.sh```@@ -47,7 +50,7 @@ Install the desktop app for this OS from the manifest:```bashomnirush-bootstrap install app \- --manifest https://omnirushlabs.com/install-manifest.json \+ --manifest https://<your-install-origin>/install-manifest.json \--json```@@ -71,9 +74,12 @@ for teammate email addresses to invite. Invites only go out once the workspaceis claimed (a provisional workspace has no authenticated owner yet to send themas) - they fire automatically the moment a human claims ownership.+`--base-url` is required and must be your organization's Den API origin;+omnirush.ai runs no hosted Den.+```bashomnirush-bootstrap cloud bootstrap-workspace \- --base-url https://api.omnirushlabs.com \+ --base-url https://<your-den-api-origin> \--workspace-name "<workspace-name>" \--skill-name "First OmniRush.ai Skill" \--claim-roles owner \@@ -126,13 +132,13 @@ If the user says yes:the agent they are currently using. The server URL is:```text- https://api.omnirushlabs.com/mcp/agent+ https://<your-den-api-origin>/mcp/agent```3. For Codex, run:```bash- codex mcp add omnirush --url https://api.omnirushlabs.com/mcp/agent+ codex mcp add omnirush --url https://<your-den-api-origin>/mcp/agentcodex mcp login omnirush```diff --git a/packages/omnirush-bootstrap/test/omnirush-bootstrap.test.mjs b/packages/omnirush-bootstrap/test/omnirush-bootstrap.test.mjsindex 5053c3cd..24a0e06a 100644--- a/packages/omnirush-bootstrap/test/omnirush-bootstrap.test.mjs+++ b/packages/omnirush-bootstrap/test/omnirush-bootstrap.test.mjs@@ -83,13 +83,13 @@ try {writeFileSync(bootstrapPath,JSON.stringify({- baseUrl: "https://api.omnirushlabs.com",- apiBaseUrl: "https://api.omnirushlabs.com",+ baseUrl: "https://den.example.com",+ apiBaseUrl: "https://den.example.com",requireSignin: false,prepared: { orgId: "org_test", orgName: "Test Org", skillId: "cob_test", skillTitle: "Test Skill", skillPath: "/tmp/skill.md" },claimLinks: [- { id: "wcl_owner", role: "owner", token: "test-owner-token", url: "https://app.omnirushlabs.com/workspace-claim?token=test-owner-token", expiresAt: "2030-01-01T00:00:00.000Z" },- { id: "wcl_member", role: "member", token: "test-member-token", url: "https://app.omnirushlabs.com/workspace-claim?token=test-member-token", expiresAt: "2030-01-01T00:00:00.000Z" },+ { id: "wcl_owner", role: "owner", token: "test-owner-token", url: "https://den.example.com/workspace-claim?token=test-owner-token", expiresAt: "2030-01-01T00:00:00.000Z" },+ { id: "wcl_member", role: "member", token: "test-member-token", url: "https://den.example.com/workspace-claim?token=test-member-token", expiresAt: "2030-01-01T00:00:00.000Z" },],}),"utf8",@@ -110,7 +110,7 @@ try {const claimLinkByRoleJson = JSON.parse(claimLinkByRole.stdout)assert.equal(claimLinkByRoleJson.claimLinks.length, 1)assert.equal(claimLinkByRoleJson.claimLinks[0].role, "owner")- assert.equal(claimLinkByRoleJson.claimLinks[0].url, "https://app.omnirushlabs.com/workspace-claim?token=test-owner-token")+ assert.equal(claimLinkByRoleJson.claimLinks[0].url, "https://den.example.com/workspace-claim?token=test-owner-token")const claimLinkMissingRole = spawnSync(process.execPath, [cli, "cloud", "claim-link", "--desktop-bootstrap-path", bootstrapPath, "--role", "admin"], {encoding: "utf8",@@ -181,13 +181,23 @@ try {},)+ // cloud bootstrap-workspace has no default Den: omnirush.ai runs no hosted+ // Den, so omitting --base-url must fail before any network request.+ const withoutBaseUrl = spawnSync(+ process.execPath,+ [cli, "cloud", "bootstrap-workspace", "--workspace-name", "No Base URL", "--json"],+ { encoding: "utf8", env: { ...process.env, HTTPS_PROXY: "http://127.0.0.1:9", HTTP_PROXY: "http://127.0.0.1:9" } },+ )+ assert.notEqual(withoutBaseUrl.status, 0)+ assert.match(withoutBaseUrl.stderr, /missing_required_flag: --base-url/)+ assert.doesNotMatch(withoutBaseUrl.stderr, /den_api_unhealthy|fetch failed/)+// Regression test: the desktop-bootstrap.json `baseUrl` field is the// browser-facing web origin (used by the app's Sign In button / claim- // links). It must NOT silently become the API origin. Previously- // --prepare-desktop wrote the same `--base-url` value into both `baseUrl`- // and `apiBaseUrl`, so a normal `--base-url https://api.omnirushlabs.com`- // run broke the desktop app's Sign In flow (it opened- // `https://api.omnirushlabs.com/?mode=sign-in...` and showed raw API JSON).+ // links), which can differ from the API origin. An explicit --web-base-url+ // must be written as `baseUrl` and never collapse into `apiBaseUrl`+ // (a split deployment otherwise opens `<api-origin>/?mode=sign-in...` and+ // shows raw API JSON).await withStubDenApi(() => ({ok: true,diff --git a/packages/omnirush-ui-mcp/index.mjs b/packages/omnirush-ui-mcp/index.mjsindex 9ee38314..6a72b646 100644--- a/packages/omnirush-ui-mcp/index.mjs+++ b/packages/omnirush-ui-mcp/index.mjs@@ -9,18 +9,15 @@** Requires OmniRush.ai desktop running with the local UI control bridge active.*- * Usage:- * npx omnirush-ui-mcp+ * This package is not published on npm and must never be launched through+ * `npx`: anyone could register the name. The desktop build bundles this file+ * with its dependencies (apps/desktop/scripts/prepare-ui-mcp.mjs) into+ * <resources>/omnirush-ui-mcp/index.mjs and runs it with the app's own binary:*- * MCP config (OpenCode / Claude Desktop / Cursor / etc.):- * {- * "mcpServers": {- * "omnirush-ui": {- * "command": "npx",- * "args": ["-y", "omnirush-ui-mcp"]- * }- * }- * }+ * ELECTRON_RUN_AS_NODE=1 "<OmniRush.ai binary>" "<resources>/omnirush-ui-mcp/index.mjs"+ *+ * Settings -> Extensions -> UI Control shows the exact command and MCP client+ * config for this installation. From a checkout: node packages/omnirush-ui-mcp/index.mjs*/import { readFile } from "node:fs/promises";diff --git a/packages/omnirush-ui-mcp/package.json b/packages/omnirush-ui-mcp/package.jsonindex f03e85b2..0d74000a 100644--- a/packages/omnirush-ui-mcp/package.json+++ b/packages/omnirush-ui-mcp/package.json@@ -1,6 +1,7 @@{"name": "omnirush-ui-mcp","version": "0.2.0",+ "private": true,"description": "MCP server for OmniRush.ai app context and semantic UI control","author": "OmniRush.ai <[email protected]>","license": "MIT",@@ -20,9 +21,6 @@"url": "git+https://github.com/omnirush-ai/omnirush-gui.git","directory": "packages/omnirush-ui-mcp"},- "publishConfig": {- "access": "public"- },"dependencies": {"@modelcontextprotocol/sdk": "^1.29.0","zod": "^3.25.76"diff --git a/packages/sdk/README.md b/packages/sdk/README.mdindex fc695a92..e8f6fe46 100644--- a/packages/sdk/README.md+++ b/packages/sdk/README.md@@ -10,8 +10,8 @@ import { createDenClient } from "@omnirush/sdk";const den = createDenClient({apiKey: process.env.DEN_API_KEY,orgId: process.env.DEN_ORG_ID,- // Always set this to your self-hosted Den API origin: omnirush.ai runs no- // hosted Den, so the built-in default does not resolve.+ // Required: your self-hosted Den API origin. omnirush.ai runs no hosted Den,+ // so there is no default and createDenClient throws without one.baseUrl: "https://api.omnirush.example.com",});diff --git a/packages/sdk/script/generate.mjs b/packages/sdk/script/generate.mjsindex 3a33bf84..0a3a5bec 100644--- a/packages/sdk/script/generate.mjs+++ b/packages/sdk/script/generate.mjs@@ -36,7 +36,9 @@ try {plugins: [{ name: "@hey-api/typescript", exportFromIndex: false },{ name: "@hey-api/sdk", instance: "DenClient", exportFromIndex: false, auth: false, paramsStructure: "flat" },- { name: "@hey-api/client-fetch", exportFromIndex: false, baseUrl: "https://api.omnirushlabs.com" },+ // No default base URL: omnirush.ai runs no hosted Den, so callers must+ // pass their own Den API origin (createDenClient enforces it).+ { name: "@hey-api/client-fetch", exportFromIndex: false, baseUrl: false },],});const generatedFiles = await files(output);diff --git a/packages/sdk/src/client.ts b/packages/sdk/src/client.tsindex a3810ead..65db8c4f 100644--- a/packages/sdk/src/client.ts+++ b/packages/sdk/src/client.ts@@ -6,6 +6,11 @@ export * from "./gen/types.gen.js";export { DenClient };export type DenClientConfig = Config & {+ /**+ * Your Den API origin, e.g. `https://den.example.com`. Required: omnirush.ai+ * runs no hosted Den, so there is no default to fall back to.+ */+ baseUrl: string;/** Den user session token. Session-only operations require this credential. */token?: string;/** Organization API key, sent verbatim in x-api-key. */@@ -14,9 +19,24 @@ export type DenClientConfig = Config & {orgId?: string;};-export function createDenClient(config: DenClientConfig = {}) {- const { token, apiKey, orgId, ...options } = config;- const client = createClient({ baseUrl: "https://api.omnirushlabs.com", ...options });+export const MISSING_DEN_BASE_URL_MESSAGE =+ "createDenClient requires an explicit baseUrl (your Den API origin, e.g. https://den.example.com). omnirush.ai runs no hosted Den, so there is no default.";++function requireBaseUrl(value: unknown): string {+ if (typeof value !== "string" || !value.trim()) throw new Error(MISSING_DEN_BASE_URL_MESSAGE);+ const baseUrl = value.trim();+ try {+ const url = new URL(baseUrl);+ if (url.protocol !== "https:" && url.protocol !== "http:") throw new Error("unsupported protocol");+ } catch {+ throw new Error(`${MISSING_DEN_BASE_URL_MESSAGE} Received: ${JSON.stringify(baseUrl)}`);+ }+ return baseUrl;+}++export function createDenClient(config: DenClientConfig) {+ const { token, apiKey, orgId, ...options } = config ?? ({} as DenClientConfig);+ const client = createClient({ ...options, baseUrl: requireBaseUrl(options.baseUrl) });// Interceptors preserve all supported header forms and per-request overrides.client.interceptors.request.use((request) => {if (token && !request.headers.has("authorization")) request.headers.set("authorization", `Bearer ${token}`);diff --git a/packages/sdk/src/gen/client.gen.ts b/packages/sdk/src/gen/client.gen.tsindex 31d7d8b0..df44f7ff 100644--- a/packages/sdk/src/gen/client.gen.ts+++ b/packages/sdk/src/gen/client.gen.ts@@ -15,4 +15,4 @@ export type CreateClientConfig<T extends ClientOptions = ClientOptions2> = (override?: Config<ClientOptions & T>,) => Config<Required<ClientOptions> & T>;-export const client = createClient(createConfig<ClientOptions2>({ baseUrl: "https://api.omnirushlabs.com" }));+export const client = createClient(createConfig<ClientOptions2>());diff --git a/packages/world/src/headless-web-helpers.ts b/packages/world/src/headless-web-helpers.tsindex c913979d..272a59b1 100644--- a/packages/world/src/headless-web-helpers.ts+++ b/packages/world/src/headless-web-helpers.ts@@ -50,8 +50,18 @@ export function buildDetachedRespawnArgs(argv: string[]): string[] {return argv.filter((arg) => arg !== "--detach");}+/**+ * Reduce a Den proxy target to its origin. There is no default: omnirush.ai+ * runs no hosted Den, so callers must pass the Den web origin explicitly+ * (OMNIRUSH_DEV_DEN_PROXY_TARGET for the headless web launcher).+ */export function normalizeDenTarget(value: string | undefined): string {- const raw = (value ?? "https://app.omnirushlabs.com").trim();+ const raw = (value ?? "").trim();+ if (!raw) {+ throw new Error(+ "A Den proxy target is required (set OMNIRUSH_DEV_DEN_PROXY_TARGET to your Den web origin, e.g. http://127.0.0.1:3005). omnirush.ai runs no hosted Den, so there is no default.",+ );+ }const withProtocol = /^https?:\/\//i.test(raw) ? raw : `https://${raw}`;return new URL(withProtocol).origin;}diff --git a/packages/world/src/headless-web.ts b/packages/world/src/headless-web.tsindex ce8a207e..fe6c2d0c 100644--- a/packages/world/src/headless-web.ts+++ b/packages/world/src/headless-web.ts@@ -31,7 +31,6 @@ import { assertWorldName } from "./store.ts";const DEFAULT_WEB_PORT = "5178";const DEFAULT_SERVER_PORT = "8778";-const DEFAULT_DEN_TARGET = "https://app.omnirushlabs.com";export interface HeadlessWebLaunchOptions {repoRoot: string;@@ -772,8 +771,10 @@ export async function launchHeadlessWeb(options: HeadlessWebLaunchOptions): Promconst headlessLogPath = runtimePaths.headlessLogPath;const omnirushUrl = `http://${clientHost}:${omnirushPort}`;const webUrl = `http://${clientHost}:${webPort}`;+ // There is no hosted Den to proxy by default: the Den proxy is wired only+ // when a target is given. Forcing it on without a target is an error.const denProxyEnabled = env.OMNIRUSH_DEV_HEADLESS_WEB_DEN_PROXY === undefined- ? true+ ? Boolean(env.OMNIRUSH_DEV_DEN_PROXY_TARGET?.trim()): readBool(env.OMNIRUSH_DEV_HEADLESS_WEB_DEN_PROXY);const denTarget = denProxyEnabled ? normalizeDenTarget(env.OMNIRUSH_DEV_DEN_PROXY_TARGET) : null;const denApiUrl = denTarget ? `${webUrl}/api/den` : null;@@ -797,7 +798,7 @@ export async function launchHeadlessWeb(options: HeadlessWebLaunchOptions): Prom...(denTarget && denApiUrl ? {OMNIRUSH_DEV_HEADLESS_DEN_TARGET: denTarget,VITE_DEN_API_BASE_URL: env.VITE_DEN_API_BASE_URL ?? denApiUrl,- ...(denTarget === DEFAULT_DEN_TARGET ? {} : { VITE_DEN_BASE_URL: env.VITE_DEN_BASE_URL ?? denTarget }),+ VITE_DEN_BASE_URL: env.VITE_DEN_BASE_URL ?? denTarget,} : {}),};const headlessEnv: NodeJS.ProcessEnv = {diff --git a/scripts/dev-headless-web.test.ts b/scripts/dev-headless-web.test.tsindex 9f8da5af..12d0b491 100644--- a/scripts/dev-headless-web.test.ts+++ b/scripts/dev-headless-web.test.ts@@ -168,7 +168,7 @@ describe("dev-headless-web helpers", () => {runtimeManifestPath: "/repo/tmp/dev-headless-web.json",webLogPath: "/repo/tmp/dev-web.log",headlessLogPath: "/repo/tmp/dev-headless.log",- denTarget: "https://app.omnirushlabs.com",+ denTarget: "https://den.example.com",pid: 42,webPid: 43,omnirushServerPid: 44,@@ -177,7 +177,7 @@ describe("dev-headless-web helpers", () => {expect(manifest.mode).toBe("local-server");expect(manifest.healthUrl).toBe("http://127.0.0.1:8778/health");- expect(manifest.denTarget).toBe("https://app.omnirushlabs.com");+ expect(manifest.denTarget).toBe("https://den.example.com");expect(manifest.denApiUrl).toBe("http://127.0.0.1:5178/api/den");expect(manifest.token).toBe("client-token");expect(manifest.notes).toContain("same-origin");@@ -203,13 +203,18 @@ describe("dev-headless-web helpers", () => {});test("normalizes Den targets to origins", () => {- expect(normalizeDenTarget("https://app.omnirushlabs.com/api/den")).toBe(- "https://app.omnirushlabs.com",+ expect(normalizeDenTarget("https://den.example.com/api/den")).toBe(+ "https://den.example.com",);expect(normalizeDenTarget("http://127.0.0.1:3005")).toBe("http://127.0.0.1:3005",);- expect(normalizeDenTarget(undefined)).toBe("https://app.omnirushlabs.com");+ expect(normalizeDenTarget("den.example.com")).toBe("https://den.example.com");+ });++ test("requires an explicit Den target instead of defaulting to a hosted Den", () => {+ expect(() => normalizeDenTarget(undefined)).toThrow(/OMNIRUSH_DEV_DEN_PROXY_TARGET/);+ expect(() => normalizeDenTarget(" ")).toThrow(/no hosted Den/);});test("detached respawn forwards args except --detach", () => {