Skip to content

armgit / mso

Public Imported from GitHub
0

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.

fix(mcp): harden Open in MSO navigation

Rahmana3ba5b34dc07
diff --git a/CLAUDE.md b/CLAUDE.md
index e7a70455..3016a09d 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -348,7 +348,7 @@ the real runtime and working analogue before changing a tool or skill contract.
it AND `tools/call` re-checks it — a client can call a name it was never shown.
- **Tool names are an MSO public API contract.** Keep global names MSO-owned and generic.
Project-owned MCP names are data behind `project_mcp_tools` / `project_mcp_call`; never copy them into the global catalog.
- <!-- mcp-toolset: server=1.8.1 version=2026.09.03.6 tools=85 read=41 write=25 exec=19 -->
+ <!-- mcp-toolset: server=1.8.2 version=2026.09.03.7 tools=85 read=41 write=25 exec=19 -->
The full MSO transport exposes **73 tools**: **72 model/operator tools** (34 read, 24 write, 14 exec) plus app-only `workflow_status`.
ChatGPT receives a deliberately smaller static profile; hidden full-catalog names are rejected at call time, not merely omitted from `tools/list`.
- Store is `~/.mso/mcp.json`, **sha256 only**, same atomic-write + fail-loud-on-corrupt
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index b430f1de..2631f8b2 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -160,7 +160,7 @@ park a visible Approve/Deny card. The complete semantic contract is
**MCP** is for external clients such as ChatGPT, Claude.ai and Cursor. Its catalog lives in
`lib/mcp/`; access is controlled by the OAuth token scope rather than Alfa approval cards.
-<!-- mcp-toolset: server=1.8.1 version=2026.09.03.6 tools=85 read=41 write=25 exec=19 -->
+<!-- mcp-toolset: server=1.8.2 version=2026.09.03.7 tools=85 read=41 write=25 exec=19 -->
The full transport exposes **73 tools**: **72 model/operator tools** (34 read, 24 write, 14 exec) plus app-only `workflow_status`. ChatGPT gets a compact client profile rather than the full set. Project function/MCP names remain data behind `project_capabilities`, `project_function_call`, `project_mcp_tools`, and `project_mcp_call`; they never rewrite the global tool prefix. `GET /mcp` reports both full and ChatGPT signatures.
See `docs/MCP.md` for protocol/security internals, `docs/A2A.md` for peer-agent delegation, and `docs/CHATGPT-PLUGIN.md` for the
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index e6ea0f71..fd2e2a22 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -14,6 +14,7 @@ this is the *what*, and it is what Settings → About shows as “What's new”.
**Fixed**
+- `mcp` harden Open in MSO navigation
- `agent` calibrate correction memory semantics
- `agent` compare normalized token proofs per row
- `mcp` advertise implemented protocol era
diff --git a/docs/CHATGPT-PLUGIN.md b/docs/CHATGPT-PLUGIN.md
index a7795127..4a03623d 100644
--- a/docs/CHATGPT-PLUGIN.md
+++ b/docs/CHATGPT-PLUGIN.md
@@ -4,9 +4,9 @@
>
> ChatGPT's Developer Mode/App UI can change independently of MSO. Use the current OpenAI MCP/App documentation for exact menu labels, and use MSO Settings → MCP / `GET /mcp` for the live server/profile signatures.
-<!-- mcp-chatgpt-profile: server=1.8.1 version=2026.09.03.6 tools=61 read=32 write=17 exec=12 app-only=1 total=62 -->
+<!-- mcp-chatgpt-profile: server=1.8.2 version=2026.09.03.7 tools=61 read=32 write=17 exec=12 app-only=1 total=62 -->
-MSO server **1.8.1**, toolset **2026.09.03.6** exposes the full generic catalog for MCP clients, while a registered ChatGPT client receives **62 transport tools**: **61 model/operator tools** (32 read, 17 write, 12 exec) plus app-only `workflow_status`.
+MSO server **1.8.2**, toolset **2026.09.03.7** exposes the full generic catalog for MCP clients, while a registered ChatGPT client receives **62 transport tools**: **61 model/operator tools** (32 read, 17 write, 12 exec) plus app-only `workflow_status`.
Browser-hosted MCP probes from ChatGPT are allowed only when they target the configured public `OS_PUBLIC_ORIGIN`; arbitrary origins and ChatGPT-origin requests aimed at loopback remain denied. Additional trusted browser hosts can be added explicitly with comma-separated `OS_MCP_BROWSER_ORIGINS`. Public OAuth discovery and DCR responses carry CORS metadata; authenticated `/mcp` echoes only an approved exact origin.
diff --git a/docs/MCP.md b/docs/MCP.md
index d624bd82..f9385380 100644
--- a/docs/MCP.md
+++ b/docs/MCP.md
@@ -116,9 +116,9 @@ The catalog has a stable server version plus a schema-derived toolset signature.
Settings → MCP shows the current version/hash/count and stores a browser-local acknowledgement when the operator marks ChatGPT refreshed. A later signature change becomes an explicit stale-snapshot warning. This does not mutate ChatGPT remotely; it makes the required refresh visible instead of relying on memory.
-<!-- mcp-toolset: server=1.8.1 version=2026.09.03.6 tools=85 read=41 write=25 exec=19 -->
+<!-- mcp-toolset: server=1.8.2 version=2026.09.03.7 tools=85 read=41 write=25 exec=19 -->
-Current full transport catalog: **86 tools**, server `1.8.1` / toolset `2026.09.03.6`.
+Current full transport catalog: **86 tools**, server `1.8.2` / toolset `2026.09.03.7`.
The model/operator catalog is **85 tools** (41 read, 25 write, 19 exec); `workflow_status` is the one app-only MCP Apps bridge. ChatGPT receives a smaller client profile rather than this full set; see [`CHATGPT-PLUGIN.md`](./CHATGPT-PLUGIN.md).
`agent_memory_search` is the typed-memory retrieval surface. It resolves semantic/episodic/procedural claims at an optional point in time, returns confidence/provenance and competing effective claims, and can expose superseded/retracted history when explicitly requested. `agent_memory_remember` remains the write surface and now accepts typed metadata; raw ChatGPT conversation ids are never stored as provenance.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index 31663734..ec5eeda1 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,4 +1,5 @@
# mso — Progress Log
+- **MCP Apps navigation hardening (2026-09-03):** server `1.8.2` / toolset `2026.09.03.7` bumps all four UI resources to v2 and makes `Open in MSO` self-diagnosing: official `openExternal` + `setOpenInAppUrl`, visible success/failure feedback, and a user-clickable direct-link fallback. No tool count or security-scope changes.
## 2026-09-03 — Cognitive Runtime P9 memory calibration
- **Repeated-correction calibration instead of graph expansion:** added `bench:memory:calibration`, which runs only against an isolated temporary agent-memory root and exercises explicit authority, confidence/recency, future replacement, forget semantics, finished-history integrity and deep repeated corrections.
diff --git a/docs/TESTING-HANDOFF.md b/docs/TESTING-HANDOFF.md
index 37cab39a..5e34c48c 100644
--- a/docs/TESTING-HANDOFF.md
+++ b/docs/TESTING-HANDOFF.md
@@ -4,10 +4,10 @@ Update this file at the end of every manual or automated test session. Keep it f
## Current status
-The current release target is **MSO CLI 1.12.0**, MCP server `1.8.1`, toolset `2026.09.03.6`; use `mso --version` plus `/api/health` for the exact Git build because documentation-only release commits also advance that identity. The v1.10/v1.11 findings and the v1.12 sectioned-terminal/recoverable-error work below are resolved and retained as historical test evidence. Do not re-open a resolved finding from prose alone: reproduce it against the current build first. There is no known 1.12 release blocker in this handoff.
+The current release target is **MSO CLI 1.12.0**, MCP server `1.8.2`, toolset `2026.09.03.7`; use `mso --version` plus `/api/health` for the exact Git build because documentation-only release commits also advance that identity. The v1.10/v1.11 findings and the v1.12 sectioned-terminal/recoverable-error work below are resolved and retained as historical test evidence. Do not re-open a resolved finding from prose alone: reproduce it against the current build first. There is no known 1.12 release blocker in this handoff.
Current verified behavior:
-- Fresh 3 current MCP contract: server `1.8.1` / toolset `2026.09.03.6`; 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.
+- 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.
- 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.
- P7 repeatability gate: `bench:corpus:repeat` adds explicit/deterministic seeds, alternating starting-agent order, and strict per-run/per-agent scenario + provider/model identity checks before any cross-run ranking. The first two complete 9-scenario runs from source `5bd5788` on `openai-codex/gpt-5.6-terra` were 18/18 task + 18/18 scenario-policy for both agents and 2/2 perfect runs each. Aggregate MSO vs Hermes: 17,271.3 vs 65,073.3 normalized tokens/attempt (~73.5% lower for MSO), 18,922.6 vs 21,077.4 ms average latency, and 13,761 vs 20,513.5 ms p50. All 36 token-proof arithmetic checks passed. This is a bounded two-run baseline, not statistical reliability proof; cost remains non-comparable.
diff --git a/docs/integrations/CHATGPT-UI.md b/docs/integrations/CHATGPT-UI.md
index 9b0e10a0..5b423ead 100644
--- a/docs/integrations/CHATGPT-UI.md
+++ b/docs/integrations/CHATGPT-UI.md
@@ -20,10 +20,10 @@ Official references:
| Experience | Entry tool | Resource | Refresh behavior |
| --- | --- | --- | --- |
-| Workflow progress | `workflow_start` | `ui://mso/workflow-progress-v1.html` | app-only `workflow_status` |
-| Project status | `project_get` | `ui://mso/project-status-v1.html` | widget calls `project_get` again |
-| Git diff summary | `project_diff` | `ui://mso/project-diff-v1.html` | static result; request a new diff for changed state |
-| VPS/operator status | `vps_status` | `ui://mso/vps-status-v1.html` | widget calls `vps_status` again |
+| Workflow progress | `workflow_start` | `ui://mso/workflow-progress-v2.html` | app-only `workflow_status` |
+| Project status | `project_get` | `ui://mso/project-status-v2.html` | widget calls `project_get` again |
+| Git diff summary | `project_diff` | `ui://mso/project-diff-v2.html` | static result; request a new diff for changed state |
+| VPS/operator status | `vps_status` | `ui://mso/vps-status-v2.html` | widget calls `vps_status` again |
Source boundaries:
@@ -48,7 +48,7 @@ The diff component receives only project/mode/SHA metadata, changed file names a
The 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` uses the host navigation bridge to `https://mso.rahmanef.com`. The widget CSP has no connect/resource domains and allowlists only that 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 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.
## Flow
@@ -69,6 +69,22 @@ All four templates declare `_meta.ui.domain = https://mso-ui.rahmanef.com` and t
The reproducible Traefik route is stored in `ops/traefik/mso-ui.yml` and forwards only to the same local MSO service through the existing HTTPS/Let's Encrypt ingress. Widget CSP still allows no network/static-resource domains and only permits `Open in MSO` to redirect to `https://mso.rahmanef.com`.
+## Manual ChatGPT smoke journeys
+
+Do not manually click through every model action. Cover the public contract with a small set of journeys that compose multiple primitives:
+
+| 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 |
+| 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 |
+| Convex | Check database status/tools for a known Convex project such as CareerPack | provider is Convex, project boundary is preserved, no env credential tools appear |
+| Project agent | Run `project_agent_run` in `plan_mode=true` for a harmless project inspection | returns a bounded plan/message id without modifying the repo |
+| Operator integrations | Check `browser_status` + `infra_providers_list` | read-only state is returned without starting browser/app or exposing provider secrets |
+
+This seven-journey suite is the preferred human acceptance test after a Scan Tools refresh. Full automated contract/coverage/build gates remain mandatory before release.
+
## Deployment / refresh
After a UI/schema release:
diff --git a/lib/mcp/toolset.ts b/lib/mcp/toolset.ts
index 14cb7bbf..8937e71f 100644
--- a/lib/mcp/toolset.ts
+++ b/lib/mcp/toolset.ts
@@ -3,9 +3,9 @@ import type { Scope } from "./scope";
import type { McpTool } from "./tool-kit";
import { toolDescriptor, type McpToolProfile } from "./tool-contract";
-export const MCP_SERVER_VERSION = "1.8.1";
-export const MCP_TOOLSET_VERSION = "2026.09.03.6";
-export const MCP_TOOLSET_CHANGED_AT = "2026-09-03T14:04:10Z";
+export const MCP_SERVER_VERSION = "1.8.2";
+export const MCP_TOOLSET_VERSION = "2026.09.03.7";
+export const MCP_TOOLSET_CHANGED_AT = "2026-09-03T14:51:00Z";
export type McpToolsetInfo = {
serverVersion: string;
diff --git a/lib/mcp/ui-navigation.ts b/lib/mcp/ui-navigation.ts
new file mode 100644
index 00000000..b1358a3d
--- /dev/null
+++ b/lib/mcp/ui-navigation.ts
@@ -0,0 +1,40 @@
+import { MSO_ORIGIN } from "./ui-config";
+
+export function openInMsoControls(primaryClass = "primary"): 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>`;
+}
+
+export const OPEN_IN_MSO_SCRIPT = String.raw`
+const MSO_URL="${MSO_ORIGIN}";
+const openButton=document.getElementById("open");
+const openDirect=document.getElementById("open-direct");
+const openFeedback=document.getElementById("open-feedback");
+function configureOpenInApp(){
+ try {
+ if(window.openai&&typeof window.openai.setOpenInAppUrl==="function") window.openai.setOpenInAppUrl({href:MSO_URL});
+ } catch (_) {}
+}
+async function openMso(){
+ if(!openButton)return;
+ openButton.disabled=true;
+ openButton.textContent="Opening…";
+ 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});
+ openButton.textContent="Opened ✓";
+ if(openFeedback)openFeedback.textContent="If no tab opened, use Open directly.";
+ if(openDirect)openDirect.hidden=false;
+ } catch (_) {
+ openButton.textContent="Try again";
+ if(openFeedback)openFeedback.textContent="Automatic open unavailable. Use Open directly.";
+ if(openDirect)openDirect.hidden=false;
+ } finally {
+ openButton.disabled=false;
+ }
+}
+if(openButton)openButton.addEventListener("click",openMso);
+configureOpenInApp();
+window.addEventListener("openai:set_globals",configureOpenInApp,{passive:true});
+`;
diff --git a/lib/mcp/ui-operator-resources.ts b/lib/mcp/ui-operator-resources.ts
index 07c02220..ed8c14d1 100644
--- a/lib/mcp/ui-operator-resources.ts
+++ b/lib/mcp/ui-operator-resources.ts
@@ -1,23 +1,24 @@
-import { MSO_ORIGIN, widgetResourceMeta } from "./ui-config";
+import { widgetResourceMeta } from "./ui-config";
+import { OPEN_IN_MSO_SCRIPT, openInMsoControls } from "./ui-navigation";
-export const PROJECT_STATUS_URI = "ui://mso/project-status-v1.html";
-export const DIFF_VIEW_URI = "ui://mso/project-diff-v1.html";
-export const VPS_STATUS_URI = "ui://mso/vps-status-v1.html";
+export const PROJECT_STATUS_URI = "ui://mso/project-status-v2.html";
+export const DIFF_VIEW_URI = "ui://mso/project-diff-v2.html";
+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) {
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;gap:7px;padding:9px 12px;border-top:1px solid color-mix(in srgb,CanvasText 9%,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><button id="open">Open MSO ↗</button></div></section><script>${script}</script></main>`;
+: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>`;
}
const sharedScript = String.raw`
-const MSO_URL="${MSO_ORIGIN}";const $=id=>document.getElementById(id);let last=null;
+const $=id=>document.getElementById(id);let last=null;
const txt=(v,f="—")=>v===undefined||v===null||v===""?f:String(v);const esc=v=>txt(v);
function output(){return window.openai&&window.openai.toolOutput?window.openai.toolOutput:null}
-async function openMso(){if(window.openai&&typeof window.openai.openExternal==="function")await window.openai.openExternal({href:MSO_URL,redirectUrl:false});else window.open(MSO_URL,"_blank","noopener,noreferrer")}
-$("open").addEventListener("click",openMso);window.addEventListener("openai:set_globals",()=>{const v=output();if(v)render(v)},{passive:true});window.addEventListener("message",e=>{if(e.source!==window.parent)return;const m=e.data;if(m&&m.method==="ui/notifications/tool-result"&&m.params&&m.params.structuredContent)render(m.params.structuredContent)},{passive:true});
+${OPEN_IN_MSO_SCRIPT}
+window.addEventListener("openai:set_globals",()=>{const v=output();if(v)render(v)},{passive:true});window.addEventListener("message",e=>{if(e.source!==window.parent)return;const m=e.data;if(m&&m.method==="ui/notifications/tool-result"&&m.params&&m.params.structuredContent)render(m.params.structuredContent)},{passive:true});
`;
const projectBody = String.raw`<div class="grid"><div class="cell wide"><span>Project</span><strong id="project">—</strong></div><div class="cell"><span>Branch</span><strong id="branch">—</strong></div><div class="cell"><span>HEAD</span><strong class="mono" id="head">—</strong></div><div class="cell"><span>Working tree</span><strong id="clean">—</strong></div></div><div class="section"><div class="row"><span>Package</span><strong id="package">—</strong></div><div class="row"><span>Database</span><strong id="database">—</strong></div><div class="row"><span>Project MCP</span><strong id="mcp">0</strong></div><div class="row"><span>Knowledge</span><strong id="knowledge">—</strong></div></div>`;
diff --git a/lib/mcp/ui-resources.test.ts b/lib/mcp/ui-resources.test.ts
index bd1715b1..e821cf0a 100644
--- a/lib/mcp/ui-resources.test.ts
+++ b/lib/mcp/ui-resources.test.ts
@@ -61,6 +61,11 @@ describe("MCP Apps workflow progress UI", () => {
expect(content.mimeType).toBe(MCP_APP_MIME_TYPE);
expect(content.text).toContain("workflow_status");
expect(content.text).toContain("Open in MSO");
+ expect(content.text).toContain("openExternal");
+ expect(content.text).toContain("setOpenInAppUrl");
+ expect(content.text).toContain("Open directly");
+ expect(content.text).toContain("Automatic open unavailable");
+ expect(WORKFLOW_PROGRESS_URI).toContain("-v2.html");
expect(content.text).not.toContain("fetch(");
expect(content._meta).toMatchObject({
ui: { domain: MCP_UI_DOMAIN, prefersBorder: true },
@@ -127,6 +132,10 @@ describe("MCP Apps workflow progress UI", () => {
expect(content.mimeType).toBe(MCP_APP_MIME_TYPE);
expect(content.text).toContain(marker);
expect(content.text).not.toContain("fetch(");
+ expect(content.text).toContain("openExternal");
+ expect(content.text).toContain("setOpenInAppUrl");
+ expect(content.text).toContain("Open directly");
+ expect(uri).toContain("-v2.html");
expect(content._meta).toMatchObject({ ui: { domain: MCP_UI_DOMAIN, prefersBorder: true }, "openai/widgetDomain": MCP_UI_DOMAIN, "openai/widgetPrefersBorder": true });
}
});
diff --git a/lib/mcp/ui-resources.ts b/lib/mcp/ui-resources.ts
index 0a72335a..e72298fd 100644
--- a/lib/mcp/ui-resources.ts
+++ b/lib/mcp/ui-resources.ts
@@ -1,7 +1,8 @@
import { OPERATOR_UI_RESOURCES } from "./ui-operator-resources";
-import { MSO_ORIGIN, widgetResourceMeta } from "./ui-config";
+import { widgetResourceMeta } from "./ui-config";
+import { OPEN_IN_MSO_SCRIPT, openInMsoControls } from "./ui-navigation";
export { PROJECT_STATUS_URI, DIFF_VIEW_URI, VPS_STATUS_URI } from "./ui-operator-resources";
-export const WORKFLOW_PROGRESS_URI = "ui://mso/workflow-progress-v1.html";
+export const WORKFLOW_PROGRESS_URI = "ui://mso/workflow-progress-v2.html";
export const MCP_APP_MIME_TYPE = "text/html;profile=mcp-app";
const workflowProgressHtml = String.raw`<main class="mso-workflow" aria-live="polite">
@@ -38,7 +39,9 @@ const workflowProgressHtml = String.raw`<main class="mso-workflow" aria-live="po
.empty { padding: 8px 0 10px; color: color-mix(in srgb, CanvasText 52%, transparent); font-size: 11px; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 10px 14px; }
.connection { color: color-mix(in srgb, CanvasText 52%, transparent); font-size: 10px; }
- .actions { display: flex; gap: 6px; }
+ .actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
+ .open-direct { color: CanvasText; font-size: 10px; text-decoration: none; border-bottom: 1px solid currentColor; }
+ .open-feedback { width: 100%; text-align: right; color: color-mix(in srgb, CanvasText 52%, transparent); font-size: 9px; }
button { appearance: none; border: 1px solid color-mix(in srgb, CanvasText 16%, transparent); background: color-mix(in srgb, CanvasText 6%, Canvas); color: CanvasText; border-radius: 10px; padding: 7px 10px; min-height: 32px; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
button.primary { background: color-mix(in srgb, #7c3aed 17%, Canvas); }
button:focus-visible { outline: 2px solid Highlight; outline-offset: 2px; }
@@ -61,12 +64,11 @@ 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><button class="primary" type="button" id="open">Open in MSO ↗</button></div>
+ <div class="actions"><button type="button" id="refresh">Refresh</button>${openInMsoControls()}</div>
</div>
</section>
<script>
(() => {
- const MSO_URL = "https://mso.rahmanef.com";
const stateEl = document.getElementById("state");
const intentEl = document.getElementById("intent");
const projectEl = document.getElementById("project");
@@ -77,7 +79,6 @@ const workflowProgressHtml = String.raw`<main class="mso-workflow" aria-live="po
const updatedEl = document.getElementById("updated");
const connectionEl = document.getElementById("connection");
const refreshButton = document.getElementById("refresh");
- const openButton = document.getElementById("open");
let workflowId = "";
let startedAt = "";
let active = true;
@@ -191,13 +192,7 @@ const workflowProgressHtml = String.raw`<main class="mso-workflow" aria-live="po
}, { passive: true });
window.addEventListener("openai:set_globals", readHostOutput, { passive: true });
refreshButton.addEventListener("click", callStatus);
- openButton.addEventListener("click", async () => {
- if (window.openai && typeof window.openai.openExternal === "function") {
- await window.openai.openExternal({ href: MSO_URL, redirectUrl: false });
- } else {
- window.open(MSO_URL, "_blank", "noopener,noreferrer");
- }
- });
+ ${OPEN_IN_MSO_SCRIPT}
const clock = window.setInterval(() => { elapsedEl.textContent = formatDuration(elapsedMs()); }, 1000);
window.addEventListener("pagehide", () => { stopPolling(); window.clearInterval(clock); }, { once: true });
readHostOutput();