Browser-based graphical shell and control plane for a Linux server you own — real terminal, file manager, live metrics and BYOK AI in one mobile-first workspace. Next.js 16 · React 19 · node-pty · Tailwind v4 · shadcn/ui. Public alpha, self-hosted.
TypeScript browser-shellcontrol-planefile-managerhomelabmobile-firstnextjsptyreactself-hostedserver-managementshadcn-uisysadmintailwindcssterminaltypescriptvpsweb-desktopweb-terminal
fix(mcp): open contextual MSO views
Rahman78a8e0cea85f
diff --git a/app/[[...slug]]/page.tsx b/app/[[...slug]]/page.tsxindex 07d47d57..f17dd803 100644--- a/app/[[...slug]]/page.tsx+++ b/app/[[...slug]]/page.tsx@@ -1,7 +1,8 @@import type { Metadata } from "next";-import { notFound } from "next/navigation";+import { notFound, redirect } from "next/navigation";import { OsRoot } from "../os-root";import { getSessionContext } from "@/lib/auth/require-session";+import { chatGptMcpLanding } from "../external-open";// Optional catch-all: the OS is one client shell, but every app is deep-linkable// (`/files/home/user`, `/code`, `/terminal`). The shell reads the path on the@@ -36,9 +37,21 @@ export async function generateMetadata({return { title: `${name} — MSO` };}-export default async function Page({ params }: { params: Promise<{ slug?: string[] }> }) {- const { slug } = await params;+export default async function Page({+ params,+ searchParams,+}: {+ params: Promise<{ slug?: string[] }>;+ searchParams: Promise<Record<string, string | string[] | undefined>>;+}) {+ const [{ slug }, query] = await Promise.all([params, searchParams]);if (isReserved(slug)) notFound();+ // ChatGPT's external-open bridge appends the conversation as `redirectUrl`.+ // A root landing with that marker is not a normal desktop launch: surface the+ // in-shell MCP activity immediately so "Open in MSO" has a visible result.+ // The callback is preserved for the host/browser; MSO never follows it.+ const externalLanding = chatGptMcpLanding(slug, query.redirectUrl);+ if (externalLanding) redirect(externalLanding);// Resolve the session on the server (reads the signed cookie) and inject it as// SessionProvider's initial state → the shell paints on the first render with// no client /api/auth/me probe and no Splash. cookies() makes this dynamic —diff --git a/app/external-open.test.ts b/app/external-open.test.tsnew file mode 100644index 00000000..344db5db--- /dev/null+++ b/app/external-open.test.ts@@ -0,0 +1,16 @@+import { describe, expect, it } from "vitest";+import { chatGptMcpLanding } from "./external-open";++describe("ChatGPT MCP external landing", () => {+ it("turns a root ChatGPT conversation redirect into the visible MCP activity deep-link", () => {+ const source = "https://chatgpt.com/c/6a996289-c858-83ec-b706-fedf850aa375";+ expect(chatGptMcpLanding(undefined, source)).toBe(`/assistant/mcp?redirectUrl=${encodeURIComponent(source)}`);+ });++ it("does not hijack normal MSO roots, app deep-links, or foreign redirect URLs", () => {+ expect(chatGptMcpLanding(undefined, undefined)).toBeNull();+ expect(chatGptMcpLanding(["files"], "https://chatgpt.com/c/abc")).toBeNull();+ expect(chatGptMcpLanding(undefined, "https://example.com/c/abc")).toBeNull();+ expect(chatGptMcpLanding(undefined, "https://chatgpt.com/g/gpt-id")).toBeNull();+ });+});diff --git a/app/external-open.ts b/app/external-open.tsnew file mode 100644index 00000000..ad3c1e28--- /dev/null+++ b/app/external-open.ts@@ -0,0 +1,17 @@+const CHATGPT_ORIGIN = "https://chatgpt.com";++export function chatGptMcpLanding(+ slug: readonly string[] | undefined,+ rawRedirectUrl: string | string[] | undefined,+): string | null {+ if (slug?.length) return null;+ const redirectUrl = Array.isArray(rawRedirectUrl) ? rawRedirectUrl[0] : rawRedirectUrl;+ if (!redirectUrl) return null;+ try {+ const parsed = new URL(redirectUrl);+ if (parsed.origin !== CHATGPT_ORIGIN || !parsed.pathname.startsWith("/c/")) return null;+ return `/assistant/mcp?redirectUrl=${encodeURIComponent(parsed.href)}`;+ } catch {+ return null;+ }+}diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.mdindex cd8a4d7d..d87fc74e 100644--- a/docs/CHANGELOG.md+++ b/docs/CHANGELOG.md@@ -15,6 +15,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.**Fixed**+- `mcp` open contextual MSO views- `runtime` prevent live Next build corruption- `mcp` harden Open in MSO navigation- `agent` calibrate correction memory semanticsdiff --git a/docs/PROGRESS.md b/docs/PROGRESS.mdindex 9ac7cd9e..5d0fb0c0 100644--- a/docs/PROGRESS.md+++ b/docs/PROGRESS.md@@ -1,4 +1,5 @@# mso — Progress Log+- **MCP App contextual landing hardening (2026-09-03):** `Open in MSO` no longer lands on an idle desktop. Workflow/VPS/project/diff cards target `/assistant/mcp`, `/monitor`, `/files`, and `/code`; the shell also recognizes ChatGPT's root `redirectUrl=https://chatgpt.com/c/...` handoff and redirects it to Alfa → MCP Activity so an already-cached v2 widget still produces a visible result. Assistant deep-link payloads now select their requested tab even when reusing an existing singleton window. MCP tool count, scopes, output schemas, and v2 resource URIs are unchanged.- **Live-build chunk corruption eliminated (2026-09-03):** a production browser repro proved the shell/Settings crash was not a Settings logic regression: an in-place `next build` in the active service checkout replaced `.next` while the old Next process still served its boot-time manifest, making all 19 root-referenced chunks disappear and one observed JS request return `500 text/plain`. Production was recovered through `mso deploy`; shell + Settings then passed real authenticated Playwright on desktop/mobile with zero failed requests/console errors. `bun run build` is now a fail-closed wrapper that holds the checkout exclusion and refuses a same-checkout live runtime; `mso build` remains the out-of-tree proof and guarded deploy/update lifecycles invoke raw Next only after quiescence. Post-replacement validation now checks every root-referenced JS/CSS asset status+MIME, not one CSS/chunk. The Fresh 3 smoke scratch path moved out of protected `~/.mso`, and recursive `fs_mkdir` now securely supports missing parents while rejecting symlink escapes.## 2026-09-03 — Cognitive Runtime P10 memory retention & lifecyclediff --git a/docs/TESTING-HANDOFF.md b/docs/TESTING-HANDOFF.mdindex 05ce7338..5528625d 100644--- a/docs/TESTING-HANDOFF.md+++ b/docs/TESTING-HANDOFF.md@@ -9,6 +9,7 @@ The current release target is **MSO CLI 1.12.0**, MCP server `1.8.2`, toolset `2Current verified behavior:- Fresh 3 current MCP contract: server `1.8.2` / toolset `2026.09.03.7`; ChatGPT receives **62 transport tools = 61 model/operator actions (32 read / 17 write / 12 exec) + app-only `workflow_status`**, while the full transport catalog is 86 tools / 85 model tools. Every ChatGPT action advertises `outputSchema`, the dedicated MCP Apps widget origin is `https://mso-ui.rahmanef.com`, and five official digest-verified Skills are exposed through the MCP Skills/resource extension. The four MCP Apps use v2 resource URIs and `Open in MSO` now has visible bridge status, `setOpenInAppUrl`, and a direct-link fallback for host navigation failures.+- MCP App navigation acceptance: a ChatGPT-opened root URL carrying `redirectUrl=https://chatgpt.com/c/...` must 307 to `/assistant/mcp`, then authenticated browser E2E must show the Alfa `MCP Activity` view. Contextual widget targets are workflow→`/assistant/mcp`, VPS→`/monitor`, project→`/files`, diff→`/code`. This changes no MCP tool/schema/resource URI, so existing Fresh 3 registrations remain compatible.- P10 memory retention/lifecycle: isolated fixtures now archive only cold finished claims before the hard 2,000-record / 2 MiB live-ledger limits. Trigger/target are 1,400 -> <=1,000 live records (or ~1.4 MiB -> ~1 MiB); archive segments are content-addressed, owner-only and archive-before-ledger atomic. `bench:memory:lifecycle` is **8/8 deterministic** with a 1,400-correction seed ending at **1,000 live + 401 archived / two segments** and a 56-byte resolved projection. It verifies explicit archived-history retrieval, historical temporal resolution, aggregate-only no-content telemetry, `0700/0600` permissions, interrupted-commit live-wins semantics, backdated replacement over immutable archive, and frozen session A / fresh session B / resume-copy behavior. The P10 retrieval gate is **4/6 lexical** (synonym + Indonesian/English misses remain explicit); P10D also calibrates the existing local `mso-local-hybrid-v1` encoder on the same rows and gets **3/6** with zero network calls / zero persisted memory vectors, so production vector storage stays blocked by measured non-improvement rather than assumption. **3/3 two-hop relationship fixtures** keep graph storage blocked. The exact-history crowding bug (`Runtime-1` vs `Runtime-10...`) is fixed by exact phrase/token scoring; legacy `bench:memory` remains 100%.- P9 memory calibration: isolated temporary-memory fixtures now cover repeated corrections, explicit-vs-observed authority, confidence/recency, future validity, forget, and history integrity. P9 fixed a real temporal privacy bug where `forget` could leave a future-scheduled claim that resurrected later; forget now closes all current/future-capable intervals while preserving already-ended history. Final 200-correction stress from source `d249da4`: **6/6 calibration scenarios**, existing memory benchmark **100%**, Cognitive Runtime memory gates **100%**; 200 ledger rows / 135,180 bytes resolve to 1 row / 58-byte compatibility projection (**99.96% smaller**) and history retrieval remains capped at 100. No calibrated case requires graph memory.- P8 calibration: repeat aggregation now reports descriptive per-run spread without inferential claims; three new complete nine-scenario runs from source `51ae31f` were **27/27 task + 27/27 scenario-policy and 3/3 perfect runs for both agents**, with 54/54 row identity/provider/model/token-arithmetic checks passing. Combined with P7, both agents are **5/5 perfect**; five-run means are MSO vs Hermes 16,907.6 vs 66,791.1 normalized tokens/attempt (~74.7% lower for MSO), 18,985.9 vs 21,779.8 ms average latency, and 14,130.8 vs 21,457.2 ms per-run p50. New `bench:cache-calibration` final 4-round/12K-prefix run was 8/8 success; MSO cache-read was zero on 4/4 while Hermes naturally reported positive cache reads on 2/4 (9,728 + 19,968), but cache frequency is unranked because request envelopes differ. P8 also fixes false token non-comparability when independently valid normalized proof shapes vary across cache/no-cache rows. Cost remains non-comparable because attribution is asymmetric.diff --git a/docs/integrations/CHATGPT-UI.md b/docs/integrations/CHATGPT-UI.mdindex bc5aade6..2ee047db 100644--- a/docs/integrations/CHATGPT-UI.md+++ b/docs/integrations/CHATGPT-UI.md@@ -50,7 +50,7 @@ The diff component receives only project/mode/SHA metadata, changed file names aThe VPS component receives bounded health/process/app/browser state and **masked** infrastructure readiness. Provider values are those already sanitized by the infrastructure summary layer; raw credentials are never added for UI rendering.-All four resources are self-contained: no external JavaScript, CSS, images, or direct `fetch()` calls. `Open in MSO` feature-detects the official ChatGPT `window.openai.openExternal` bridge, registers the same target with `window.openai.setOpenInAppUrl`, and shows a user-clickable `Open directly` fallback plus visible status when automatic navigation is unavailable. The widget CSP has no connect/resource domains and allowlists only `https://mso.rahmanef.com` as the dashboard redirect.+All four resources are self-contained: no external JavaScript, CSS, images, or direct `fetch()` calls. `Open in MSO` feature-detects the official ChatGPT `window.openai.openExternal` bridge, registers a contextual MSO deep-link with `window.openai.setOpenInAppUrl`, and shows a user-clickable `Open directly` fallback plus visible status when automatic navigation is unavailable. Workflow cards target `/assistant/mcp`, VPS cards `/monitor`, project cards `/files`, and diff cards `/code`. As a cache-safe fallback, a root MSO landing carrying ChatGPT's `redirectUrl=https://chatgpt.com/c/...` is server-redirected to `/assistant/mcp` while preserving the callback query; MSO never follows that callback itself. The widget CSP has no connect/resource domains and allowlists only `https://mso.rahmanef.com` as the dashboard redirect.## Flow@@ -77,7 +77,7 @@ Do not manually click through every model action. Cover the public contract with| Journey | Suggested prompt/action | Pass condition || --- | --- | --- |-| Workflow/UI bridge | Start a read-only workflow for `mso`, press `Refresh`, then `Open in MSO` | progress updates; automatic link opens or the explicit `Open directly` fallback is shown |+| Workflow/UI bridge | Start a read-only workflow for `mso`, press `Refresh`, then `Open in MSO` | progress updates; MSO opens visibly at Alfa → MCP Activity (`/assistant/mcp`), including when ChatGPT still uses a cached root-targeting widget; the explicit `Open directly` fallback targets the same view || VPS card | Ask for the current VPS status | `vps_status` renders CPU/memory/disk/apps/browser/infra and its refresh works || Project/Git | Ask to inspect project `mso`, then show its current diff/history | `project_get` and `project_diff` render the correct project/branch/changes without secrets || Safe filesystem CRUD | Create/read/copy/move/delete a disposable file under `~/mso-smoke-tests/` | content/hash round-trip succeeds and cleanup leaves no test file |diff --git a/frontend/slices/appshell/lib/store-multi.test.ts b/frontend/slices/appshell/lib/store-multi.test.tsindex e92d02bf..2fc7f836 100644--- a/frontend/slices/appshell/lib/store-multi.test.ts+++ b/frontend/slices/appshell/lib/store-multi.test.ts@@ -57,6 +57,14 @@ describe("focusApp", () => {expect(shellStore.getFocused()).toBeNull();});+ it("updates the reused window payload when a deep-link focuses it", () => {+ const assistant = openWindow("assistant", "Alfa", undefined, { path: "/chat" });+ openWindow("monitor", "Monitor");+ expect(focusApp("assistant", { path: "/mcp" })).toBe(true);+ expect(shellStore.getFocused()).toBe(assistant);+ expect(shellStore.getWindow(assistant)?.payload).toEqual({ path: "/mcp" });+ });+it("brings the front-most window of an existing app to focus (highest z wins)", () => {// Two `files` windows + one `monitor` between them, all spawned via openWindow.const f1 = openWindow("files", "Files", undefined, { path: "/a" }, { multi: true });diff --git a/frontend/slices/appshell/lib/store.ts b/frontend/slices/appshell/lib/store.tsindex edca71a5..3b33c3d9 100644--- a/frontend/slices/appshell/lib/store.ts+++ b/frontend/slices/appshell/lib/store.ts@@ -102,10 +102,11 @@ export function focusWindow(id: WinId) {// Reveal the front-most existing window of an app (restoring if minimized).// Returns false when none exist — callers then decide whether to open one.// Lets the URL sync focus an app without spawning a duplicate for `multi` apps.-export function focusApp(app: string): boolean {+export function focusApp(app: string, payload?: unknown): boolean {const ids = M.state.order.filter((id) => M.state.windows[id]?.app === app);if (!ids.length) return false;const top = ids.reduce((a, b) => (M.state.windows[a].z >= M.state.windows[b].z ? a : b));+ if (payload !== undefined) patch(top, { payload });if (M.state.windows[top].minimized) restoreWindow(top);focusWindow(top);return true;diff --git a/frontend/slices/appshell/runtime/use-url-sync.tsx b/frontend/slices/appshell/runtime/use-url-sync.tsxindex b2a00dff..92176e92 100644--- a/frontend/slices/appshell/runtime/use-url-sync.tsx+++ b/frontend/slices/appshell/runtime/use-url-sync.tsx@@ -105,12 +105,13 @@ export function UrlSync({ apps }: { apps: AppDescriptor[] }) {// Focus an existing window rather than spawn one — else a `multi` app (Files)// would open a duplicate on every back/forward (focusApp also restores a// minimized one, so back from "/" onto a dismissed app's slug reopens it).- if (focusApp(target.app.id)) return;+ const deepLinkPayload = target.path ? { path: target.path } : undefined;+ if (focusApp(target.app.id, deepLinkPayload)) return;openWindow(target.app.id,target.app.title,target.app.defaultSize,- target.path ? { path: target.path } : undefined,+ deepLinkPayload,);}, [pathname, apps]);diff --git a/frontend/slices/assistant/app.tsx b/frontend/slices/assistant/app.tsxindex ebfbc254..579f7d95 100644--- a/frontend/slices/assistant/app.tsx+++ b/frontend/slices/assistant/app.tsx@@ -2,7 +2,7 @@import { useCallback, useRef, useState } from "react";import { History } from "lucide-react";-import { AppFrame } from "@/features/appshell";+import { AppFrame, type AppProps } from "@/features/appshell";import { Button } from "@/components/ui/button";import { Tabs, TabsList, TabsTrigger } from "./components/tabs";import { usePublishInspector } from "./lib/host";@@ -17,8 +17,9 @@ import { ThreadList } from "./components/thread-list";import { LibraryGrid } from "./components/library-grid";import { SkillForm } from "./components/skill-form";import { McpActivityView } from "./components/mcp-activity-view";+import { assistantRouteFromPayload, type AssistantTab } from "./lib/navigation";-type Tab = "chat" | "agents" | "skills" | "automations" | "mcp";+type Tab = AssistantTab;type FormState =| { kind: "skill"; item?: Skill }| { kind: "agent"; item?: Agent }@@ -35,9 +36,15 @@ const TABS: [Tab, string][] = [// Alfa: tabbed assistant. Chat keeps the real Claude stream; the other tabs// manage agents/skills/automations entirely in localStorage (no Convex).-export default function Assistant() {+export default function Assistant({ payload }: AppProps) {const store = useAIStore();- const [tab, setTab] = useState<Tab>("chat");+ const route = assistantRouteFromPayload(payload);+ const [selection, setSelection] = useState<{ key: string; tab: Tab }>(() => route);+ // When the host payload changes, its deep-link tab wins without a synchronizing+ // effect. Once rendered for that route, user tab clicks own the selection until+ // another payload arrives.+ const tab = selection.key === route.key ? selection.tab : route.tab;+ const setTab = useCallback((next: Tab) => setSelection({ key: route.key, tab: next }), [route.key]);const [form, setForm] = useState<FormState>(null);const [historyOpen, setHistoryOpen] = useState(false);const chatRef = useRef<ChatHandle>(null);@@ -48,7 +55,7 @@ export default function Assistant() {const agent = store.agents.find((a) => a.id === auto.agentId);setTimeout(() => chatRef.current?.runSteps(auto, agent), 30);},- [store.agents],+ [store.agents, setTab],);// Surface Alfa's own library state to the shell AI Inspector. Called above thediff --git a/frontend/slices/assistant/lib/navigation.test.ts b/frontend/slices/assistant/lib/navigation.test.tsnew file mode 100644index 00000000..df3a5f46--- /dev/null+++ b/frontend/slices/assistant/lib/navigation.test.ts@@ -0,0 +1,13 @@+import { describe, expect, it } from "vitest";+import { assistantTabFromPayload } from "./navigation";++describe("assistant deep-link payload", () => {+ it("opens the MCP activity tab for /assistant/mcp", () => {+ expect(assistantTabFromPayload({ path: "/mcp" })).toBe("mcp");+ });++ it("fails back to chat for absent or unknown paths", () => {+ expect(assistantTabFromPayload(undefined)).toBe("chat");+ expect(assistantTabFromPayload({ path: "/unknown" })).toBe("chat");+ });+});diff --git a/frontend/slices/assistant/lib/navigation.ts b/frontend/slices/assistant/lib/navigation.tsnew file mode 100644index 00000000..909a242a--- /dev/null+++ b/frontend/slices/assistant/lib/navigation.ts@@ -0,0 +1,16 @@+export type AssistantTab = "chat" | "agents" | "skills" | "automations" | "mcp";++const TABS = new Set<AssistantTab>(["chat", "agents", "skills", "automations", "mcp"]);++export function assistantRouteFromPayload(payload: unknown): { key: string; tab: AssistantTab } {+ if (!payload || typeof payload !== "object") return { key: "", tab: "chat" };+ const path = (payload as { path?: unknown }).path;+ if (typeof path !== "string") return { key: "", tab: "chat" };+ const normalized = "/" + path.split("/").filter(Boolean).join("/");+ const segment = normalized.split("/").filter(Boolean)[0] as AssistantTab | undefined;+ return { key: normalized, tab: segment && TABS.has(segment) ? segment : "chat" };+}++export function assistantTabFromPayload(payload: unknown): AssistantTab {+ return assistantRouteFromPayload(payload).tab;+}diff --git a/lib/mcp/ui-navigation.ts b/lib/mcp/ui-navigation.tsindex b1358a3d..b33437b2 100644--- a/lib/mcp/ui-navigation.ts+++ b/lib/mcp/ui-navigation.ts@@ -1,18 +1,34 @@import { MSO_ORIGIN } from "./ui-config";-export function openInMsoControls(primaryClass = "primary"): string {+function safePath(path: string): string {+ return path.startsWith("/") && !path.startsWith("//") ? path : "/";+}++export function openInMsoControls(primaryClass = "primary", targetPath = "/"): string {const classAttr = primaryClass ? ` class="${primaryClass}"` : "";- return `<button${classAttr} type="button" id="open">Open in MSO ↗</button><a class="open-direct" id="open-direct" href="${MSO_ORIGIN}" target="_blank" rel="noopener noreferrer" hidden>Open directly ↗</a><span class="open-feedback" id="open-feedback" role="status" aria-live="polite"></span>`;+ const path = safePath(targetPath);+ const href = new URL(path, MSO_ORIGIN).href;+ return `<button${classAttr} type="button" id="open" data-mso-path="${path}">Open in MSO ↗</button><a class="open-direct" id="open-direct" href="${href}" target="_blank" rel="noopener noreferrer" hidden>Open directly ↗</a><span class="open-feedback" id="open-feedback" role="status" aria-live="polite"></span>`;}export const OPEN_IN_MSO_SCRIPT = String.raw`-const MSO_URL="${MSO_ORIGIN}";+const MSO_ORIGIN="${MSO_ORIGIN}";const openButton=document.getElementById("open");const openDirect=document.getElementById("open-direct");const openFeedback=document.getElementById("open-feedback");+function msoTargetUrl(){+ const path=openButton&&typeof openButton.dataset.msoPath==="string"?openButton.dataset.msoPath:"/";+ try{return new URL(path&&path.startsWith("/")&&!path.startsWith("//")?path:"/",MSO_ORIGIN).href}catch(_){return MSO_ORIGIN}+}+function setMsoTarget(path){+ const safe=typeof path==="string"&&path.startsWith("/")&&!path.startsWith("//")?path:"/";+ if(openButton)openButton.dataset.msoPath=safe;+ if(openDirect)openDirect.href=msoTargetUrl();+ configureOpenInApp();+}function configureOpenInApp(){try {- if(window.openai&&typeof window.openai.setOpenInAppUrl==="function") window.openai.setOpenInAppUrl({href:MSO_URL});+ if(window.openai&&typeof window.openai.setOpenInAppUrl==="function") window.openai.setOpenInAppUrl({href:msoTargetUrl()});} catch (_) {}}async function openMso(){@@ -22,7 +38,7 @@ async function openMso(){if(openFeedback)openFeedback.textContent="";try {if(!window.openai||typeof window.openai.openExternal!=="function") throw new Error("openExternal unavailable");- await window.openai.openExternal({href:MSO_URL,redirectUrl:false});+ await window.openai.openExternal({href:msoTargetUrl(),redirectUrl:false});openButton.textContent="Opened ✓";if(openFeedback)openFeedback.textContent="If no tab opened, use Open directly.";if(openDirect)openDirect.hidden=false;diff --git a/lib/mcp/ui-operator-resources.ts b/lib/mcp/ui-operator-resources.tsindex ed8c14d1..a29c4871 100644--- a/lib/mcp/ui-operator-resources.ts+++ b/lib/mcp/ui-operator-resources.ts@@ -7,10 +7,10 @@ export const VPS_STATUS_URI = "ui://mso/vps-status-v2.html";const MIME = "text/html;profile=mcp-app";-function shell(title: string, body: string, script: string) {+function shell(title: string, body: string, script: string, openPath: string) {return String.raw`<main class="mso-card"><style>:root{color-scheme:light dark;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}*{box-sizing:border-box}body{margin:0;background:transparent;color:CanvasText}.mso-card{padding:10px}.card{overflow:hidden;border:1px solid color-mix(in srgb,CanvasText 14%,transparent);border-radius:18px;background:color-mix(in srgb,Canvas 95%,transparent)}header{display:flex;align-items:center;gap:10px;padding:13px 14px;border-bottom:1px solid color-mix(in srgb,CanvasText 9%,transparent)}.mark{display:grid;place-items:center;width:30px;height:30px;border-radius:9px;background:color-mix(in srgb,#2563eb 16%,Canvas);font-weight:800}h2{margin:0;font-size:14px}.sub{margin:2px 0 0;color:color-mix(in srgb,CanvasText 58%,transparent);font-size:10px}.grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:1px;background:color-mix(in srgb,CanvasText 9%,transparent)}.cell{min-width:0;padding:10px 12px;background:Canvas}.cell span{display:block;font-size:9px;text-transform:uppercase;letter-spacing:.08em;color:color-mix(in srgb,CanvasText 52%,transparent)}.cell strong{display:block;margin-top:3px;font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.section{padding:10px 14px}.row{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:27px;border-top:1px solid color-mix(in srgb,CanvasText 8%,transparent);font-size:11px}.row:first-child{border-top:0}.mono{font-family:ui-monospace,SFMono-Regular,Menlo,monospace}.muted{color:color-mix(in srgb,CanvasText 52%,transparent)}.good{color:#16a34a}.bad{color:#dc2626}.files{margin:0;padding:0;list-style:none}.file{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;min-height:28px;align-items:center;border-top:1px solid color-mix(in srgb,CanvasText 8%,transparent);font-size:11px}.file:first-child{border-top:0}.file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.actions{display:flex;justify-content:flex-end;align-items:center;gap:7px;flex-wrap:wrap;padding:9px 12px;border-top:1px solid color-mix(in srgb,CanvasText 9%,transparent)}.open-direct{color:CanvasText;font-size:11px;text-decoration:none;border-bottom:1px solid currentColor}.open-feedback{width:100%;text-align:right;font-size:9px;color:color-mix(in srgb,CanvasText 55%,transparent)}button{border:1px solid color-mix(in srgb,CanvasText 14%,transparent);background:color-mix(in srgb,CanvasText 5%,Canvas);color:CanvasText;border-radius:10px;padding:7px 10px;font:inherit;font-size:11px;cursor:pointer}@media(max-width:440px){.mso-card{padding:6px}.grid{grid-template-columns:1fr 1fr}.wide{grid-column:1/-1}}-</style><section class="card"><header><div class="mark">M</div><div><h2>${title}</h2><p class="sub" id="subtitle">MSO</p></div></header>${body}<div class="actions"><button id="refresh" hidden>Refresh</button>${openInMsoControls("")}</div></section><script>${script}</script></main>`;+</style><section class="card"><header><div class="mark">M</div><div><h2>${title}</h2><p class="sub" id="subtitle">MSO</p></div></header>${body}<div class="actions"><button id="refresh" hidden>Refresh</button>${openInMsoControls("", openPath)}</div></section><script>${script}</script></main>`;}const sharedScript = String.raw`@@ -43,7 +43,7 @@ function meta(description: string) {}export const OPERATOR_UI_RESOURCES = [- { uri: PROJECT_STATUS_URI, name: "MSO project status", description: "Interactive project snapshot.", mimeType: MIME, text: shell("MSO project", projectBody, projectScript), _meta: meta("MSO project status card with bounded Git, Convex, knowledge and integration state.") },- { uri: DIFF_VIEW_URI, name: "MSO project diff", description: "Compact project diff summary.", mimeType: MIME, text: shell("MSO diff", diffBody, diffScript), _meta: meta("MSO project diff summary. Raw diff text remains in the tool fallback and is not injected as HTML.") },- { uri: VPS_STATUS_URI, name: "MSO VPS status", description: "Interactive bounded VPS overview.", mimeType: MIME, text: shell("MSO VPS", vpsBody, vpsScript), _meta: meta("MSO live bounded VPS overview for health, managed apps, browser and infrastructure readiness.") },+ { uri: PROJECT_STATUS_URI, name: "MSO project status", description: "Interactive project snapshot.", mimeType: MIME, text: shell("MSO project", projectBody, projectScript, "/files"), _meta: meta("MSO project status card with bounded Git, Convex, knowledge and integration state.") },+ { uri: DIFF_VIEW_URI, name: "MSO project diff", description: "Compact project diff summary.", mimeType: MIME, text: shell("MSO diff", diffBody, diffScript, "/code"), _meta: meta("MSO project diff summary. Raw diff text remains in the tool fallback and is not injected as HTML.") },+ { uri: VPS_STATUS_URI, name: "MSO VPS status", description: "Interactive bounded VPS overview.", mimeType: MIME, text: shell("MSO VPS", vpsBody, vpsScript, "/monitor"), _meta: meta("MSO live bounded VPS overview for health, managed apps, browser and infrastructure readiness.") },] as const;diff --git a/lib/mcp/ui-resources.test.ts b/lib/mcp/ui-resources.test.tsindex 67c1d5ad..9e95ee4c 100644--- a/lib/mcp/ui-resources.test.ts+++ b/lib/mcp/ui-resources.test.ts@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from "vitest";vi.mock("server-only", () => ({}));const { dispatch } = await import("./dispatch");-const { MCP_APP_MIME_TYPE, WORKFLOW_PROGRESS_URI, PROJECT_STATUS_URI, DIFF_VIEW_URI, VPS_STATUS_URI } = await import("./ui-resources");+const { MCP_APP_MIME_TYPE, WORKFLOW_PROGRESS_URI, PROJECT_STATUS_URI, DIFF_VIEW_URI, VPS_STATUS_URI, readUiResource } = await import("./ui-resources");const { MCP_UI_DOMAIN } = await import("./ui-config");const { activeWorkflowForActor } = await import("@/lib/workflow");@@ -64,6 +64,7 @@ describe("MCP Apps workflow progress UI", () => {expect(content.text).toContain("openExternal");expect(content.text).toContain("setOpenInAppUrl");expect(content.text).toContain("Open directly");+ expect(content.text).toContain("/assistant/mcp");expect(content.text).toContain("Automatic open unavailable");expect(WORKFLOW_PROGRESS_URI).toContain("-v2.html");expect(content.text).not.toContain("fetch(");@@ -139,6 +140,13 @@ describe("MCP Apps workflow progress UI", () => {expect(content._meta).toMatchObject({ ui: { domain: MCP_UI_DOMAIN, prefersBorder: true }, "openai/widgetDomain": MCP_UI_DOMAIN, "openai/widgetPrefersBorder": true });}});+ it("gives every MCP App a visible contextual MSO destination", () => {+ expect(readUiResource(WORKFLOW_PROGRESS_URI)?.text).toContain('data-mso-path="/assistant/mcp"');+ expect(readUiResource(PROJECT_STATUS_URI)?.text).toContain('data-mso-path="/files"');+ expect(readUiResource(DIFF_VIEW_URI)?.text).toContain('data-mso-path="/code"');+ expect(readUiResource(VPS_STATUS_URI)?.text).toContain('data-mso-path="/monitor"');+ });+it("rejects unknown UI resource URIs", async () => {const result = await dispatch({ id: 1, method: "resources/read", params: { uri: "ui://mso/not-real.html" } }, "read");expect(result.error).toMatchObject({ code: -32602 });diff --git a/lib/mcp/ui-resources.ts b/lib/mcp/ui-resources.tsindex e72298fd..88e4ae89 100644--- a/lib/mcp/ui-resources.ts+++ b/lib/mcp/ui-resources.ts@@ -64,7 +64,7 @@ const workflowProgressHtml = String.raw`<main class="mso-workflow" aria-live="po</div><div class="foot"><span class="connection" id="connection">Live status</span>- <div class="actions"><button type="button" id="refresh">Refresh</button>${openInMsoControls()}</div>+ <div class="actions"><button type="button" id="refresh">Refresh</button>${openInMsoControls("primary", "/assistant/mcp")}</div></div></section><script>diff --git a/scripts/e2e/shell.mjs b/scripts/e2e/shell.mjsindex 507b85c9..cb2891fe 100644--- a/scripts/e2e/shell.mjs+++ b/scripts/e2e/shell.mjs@@ -161,6 +161,21 @@ async function session(browser, { width, height, label, touch = width < 768, expcheck(viewportDelta <= 1, `root height follows the visual viewport (${viewportDelta.toFixed(1)}px delta)`);}+ // ── ChatGPT MCP App external-open contract. The platform appends the+ // conversation as redirectUrl even when an older cached widget still targets+ // the MSO root. That landing must visibly open Alfa → MCP Activity rather than+ // leave the user on an idle desktop. One desktop pass is enough; the generic+ // /assistant/mcp deep-link is covered by the same responsive shell below.+ if (width >= 1200) {+ const chatUrl = "https://chatgpt.com/c/6a996289-c858-83ec-b706-fedf850aa375";+ await page.goto(`${BASE}/?redirectUrl=${encodeURIComponent(chatUrl)}`, { waitUntil: "domcontentloaded" });+ await page.waitForURL((url) => url.pathname === "/assistant/mcp", { timeout: 5_000 });+ await page.locator("[data-window]").first().waitFor({ state: "visible", timeout: 5_000 });+ const mcpVisible = await page.getByText("MCP Activity", { exact: true }).first().isVisible().catch(() => false);+ check(page.url().includes("/assistant/mcp"), "ChatGPT Open in MSO lands on /assistant/mcp");+ check(mcpVisible, "ChatGPT Open in MSO visibly opens Alfa MCP Activity");+ }+// ── open every app by DEEP LINK rather than by clicking the dock.//// Deliberate: the URL is the documented contract ("the OS is addressable" —