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(integrations): add shell app and detect SC worktrees

Rahman0cb2af219fa9
diff --git a/app/integrations/route.test.ts b/app/integrations/route.test.ts
index 6d6927df..33b7618a 100644
--- a/app/integrations/route.test.ts
+++ b/app/integrations/route.test.ts
@@ -8,10 +8,17 @@ describe("friendly native Integrations page", () => {
const response = GET(), html = await response.text();
expect(response.status).toBe(200); expect(response.headers.get("referrer-policy")).toBe("no-referrer");
expect(response.headers.get("cache-control")).toContain("no-store");
+ expect(response.headers.get("x-frame-options")).toBe("DENY"); expect(response.headers.get("content-security-policy")).toContain("frame-ancestors 'none'");
expect(html).toContain("INTEGRATIONS_CATALOG"); expect(html).toContain('"id":"supabase"');
expect(html).toContain("How to get this credential / authorization"); expect(html).not.toContain("si-coder");
expect(() => new Function(html.match(/<script nonce="[^"]+">([\s\S]*)<\/script>/)![1])).not.toThrow();
});
+ it("allows only same-origin framing for the explicit shell embed mode", async () => {
+ const response = GET(new NextRequest("https://mso.example.com/integrations?embed=shell"));
+ expect(response.headers.get("x-frame-options")).toBe("SAMEORIGIN");
+ expect(response.headers.get("content-security-policy")).toContain("frame-ancestors 'self'");
+ expect(response.headers.get("content-security-policy")).not.toContain("frame-ancestors 'none'");
+ });
it("lets the trusted HTML endpoint own its nonce while retaining owner mutation CSRF checks", async () => {
const read = await proxy(new NextRequest("https://mso.example.com/integrations", { headers: { host: "mso.example.com" } }));
expect(read.headers.get("content-security-policy")).toBeNull();
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 0c8f8c8f..62d80de5 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -4,6 +4,13 @@
Newest first. `docs/PROGRESS.md` is the source of truth for *why* a change was made;
this is the *what*, and it is what Settings → About shows as “What's new”.
+## 2026-09-14
+
+**Fixed**
+
+- `integrations` add shell app and detect SC worktrees
+- `mcp` fall back when project MCP discover returns -32601
+
## 2026-09-12
**Added**
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index cb0b36fe..374f7d85 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -1,3 +1,31 @@
+## 2026-09-14 — Integrations is a first-class shell app and SI-Coder worktrees are detected safely
+
+The native Integrations workbench existed as a browser/Page/CLI surface but was absent from the
+OS-shell app manifest, so it could not behave like the other dock/launcher features. Integrations
+now has its own feature-slice `AppDescriptor`, is pinned by the MSO consumer manifest, and reuses
+the canonical `/integrations` manager instead of duplicating credential state or actions. The
+ordinary browser route remains anti-frame (`DENY` / `frame-ancestors 'none'`). Only the explicit
+`?embed=shell` mode permits same-origin framing (`SAMEORIGIN` / `frame-ancestors 'self'`), so the
+new window does not widen cross-origin framing policy.
+
+Local SI-Coder migration discovery previously required the version-reported source path to contain
+`si-coder-agent`. The installed SC 0.9.8 currently resolves to a legitimate worktree named
+`~/worktrees/sc-flow-merge-main`, so that name check produced a false unavailable state.
+Discovery now validates that the resolved SC executable lives inside the absolute checkout reported
+by `sc version --json`, treats an explicit `MSO_SC_BIN` override as authoritative, and additionally
+validates the exported Integration Bundle v1 producer/mode before reading metadata. Arbitrary
+binaries that merely claim another source tree are rejected. The bridge remains optional,
+metadata-only for automatic discovery, and is still an explicit snapshot/import path rather than
+live bidirectional credential replication. The real installed probe now reports 10 users and 72
+named connections without exposing credential values.
+
+Verification: the focused Integrations/SC/security-capability suite passed 12/12, TypeScript passed,
+repository-wide ESLint passed with zero warnings, and the safe out-of-tree `mso build` completed its
+isolated Next production build plus mandatory release journeys. Browser release checks passed the
+reviewed desktop/mobile demos, 45 MCP Page assertions, production smoke 4/4, public responsive
+journeys, Sessions/MCP accessibility, Add MCP/project-flow CRUD, and authentication/role/file/exec
+boundaries. The live checkout was not rebuilt in place during verification.
+
## 2026-09-14 — Project MCP HTTP discover falls back on JSON-RPC -32601
`project_mcp_tools` probed modern `server/discover` and treated only HTTP 400/404/405
diff --git a/docs/SLICE-CATALOG.md b/docs/SLICE-CATALOG.md
index fa09f3d9..e63ca83f 100644
--- a/docs/SLICE-CATALOG.md
+++ b/docs/SLICE-CATALOG.md
@@ -3,12 +3,12 @@
> **Current reference.** Counts are checked against the directory tree by
> `scripts/check-docs.mjs`; the directory remains the final authority.
-<!-- slice-catalog: slices=22 appshell-features=10 -->
+<!-- slice-catalog: slices=23 appshell-features=10 -->
Every application is a vertical slice under `frontend/slices/`. Host-facing slices use the
shared API/host seam rather than reaching arbitrary Node host APIs from client code.
-## Slices (22)
+## Slices (23)
| Slug | Purpose |
|---|---|
@@ -24,6 +24,7 @@ shared API/host seam rather than reaching arbitrary Node host APIs from client c
| `image-editor` | Layered raster image editor |
| `image-picker` | Reusable image/wallpaper picker |
| `infrastructure` | Dokploy/Cloudflare provider configuration and live inventory apps |
+| `integrations` | First-class shell window for the canonical native Integrations workbench |
| `managed-apps` | Hermes/OpenClaw install/lifecycle/update/backup/proxy |
| `media-studio` | Image/media studio surface |
| `media-viewer` | Preview/Quick Look-style media viewer |
diff --git a/frontend/slices/integrations/app.tsx b/frontend/slices/integrations/app.tsx
new file mode 100644
index 00000000..8337ef9d
--- /dev/null
+++ b/frontend/slices/integrations/app.tsx
@@ -0,0 +1,21 @@
+"use client";
+
+import { AppFrame } from "@/features/appshell";
+
+/**
+ * Shell window for the canonical owner Integrations workbench.
+ * The iframe reuses /integrations so browser, MCP Page, CLI and the desktop app
+ * continue to share one credential-management implementation and policy surface.
+ */
+export default function IntegrationsApp() {
+ return (
+ <AppFrame safeArea={false} bodyClassName="overflow-hidden bg-background">
+ <iframe
+ src="/integrations?embed=shell"
+ title="MSO Integrations"
+ className="h-full w-full border-0 bg-background"
+ referrerPolicy="same-origin"
+ />
+ </AppFrame>
+ );
+}
diff --git a/frontend/slices/integrations/index.ts b/frontend/slices/integrations/index.ts
new file mode 100644
index 00000000..23689b45
--- /dev/null
+++ b/frontend/slices/integrations/index.ts
@@ -0,0 +1,12 @@
+import { Cable } from "lucide-react";
+import type { AppDescriptor } from "@/features/appshell";
+
+/** First-class shell descriptor for MSO's canonical Integrations workbench. */
+export const integrationsApp: AppDescriptor = {
+ id: "integrations",
+ title: "Integrations",
+ icon: Cable,
+ gradient: "linear-gradient(160deg,#0f172a,#2563eb)",
+ load: () => import("./app"),
+ defaultSize: { w: 1040, h: 720 },
+};
diff --git a/frontend/slices/os-shell/shell.manifest.ts b/frontend/slices/os-shell/shell.manifest.ts
index e7fee2f6..009f3768 100644
--- a/frontend/slices/os-shell/shell.manifest.ts
+++ b/frontend/slices/os-shell/shell.manifest.ts
@@ -20,6 +20,7 @@ import { hermesApp, nineRouterApp, openclawApp } from "@/features/managed-apps";
import { osSettingsApp } from "@/features/os-settings";
import { quicklinksApp } from "@/features/quicklinks";
import { docsApp } from "@/features/docs";
+import { integrationsApp } from "@/features/integrations";
import { cloudflareApp, dokployApp } from "@/features/infrastructure";
import { themeQuickPickerFeature } from "./theme-quick-picker";
import { APP_MARKS } from "./brand-marks";
@@ -64,6 +65,7 @@ export const BUILTIN_APPS: AppDescriptor[] = [
withSlug(withArtwork(hermesApp), "hermes"),
withSlug(withArtwork(openclawApp), "openclaw"),
withSlug(withArtwork(nineRouterApp), "9router"),
+ pin(withSlug(withArtwork(integrationsApp), "integrations")),
withSlug(withArtwork(dokployApp), "dokploy"),
withSlug(withArtwork(cloudflareApp), "cloudflare"),
withSlug(withArtwork(quicklinksApp), "links"),
diff --git a/lib/infra/setup-page.ts b/lib/infra/setup-page.ts
index 2a68047e..5ad3ad06 100644
--- a/lib/infra/setup-page.ts
+++ b/lib/infra/setup-page.ts
@@ -6,13 +6,15 @@ import { INTEGRATION_FORM_SCRIPT, INTEGRATION_FORM_STYLE } from "./setup-ui";
import { CONNECTION_MANAGER_SCRIPT, CONNECTION_MANAGER_STYLE } from "./connection-ui";
import { INTEGRATION_BROWSER_SCRIPT } from "./setup-browser";
import { connectionCatalog } from "./connection-registry";
-export function integrationSetupPage() {
+export function integrationSetupPage(embedded=false) {
const nonce = randomBytes(18).toString("base64");
const catalog = JSON.stringify(connectionCatalog()).replace(/</g,"\\u003c");
- const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="referrer" content="no-referrer"><title>Integrations · MSO</title><style nonce="${nonce}">${MSO_WIDGET_TOKENS}${INTEGRATION_FORM_STYLE}${CONNECTION_MANAGER_STYLE}${PORTABILITY_STYLE}*{box-sizing:border-box}body{margin:0;background:var(--surface);padding:clamp(var(--space-4),3vw,40px);font-family:var(--font-body);color:var(--text)}.site-bar{max-width:1180px;margin:0 auto 26px;font-size:var(--type-small);display:flex;justify-content:space-between;gap:var(--space-3)}.site-bar strong{display:flex;align-items:center;gap:var(--space-3);font-weight:750}.site-bar svg{width:30px;height:30px}.site-bar span{color:var(--text-dim)}button{border:var(--stroke) solid var(--sep-strong);border-radius:var(--radius-control);background:var(--field);color:var(--text);padding:var(--space-2) var(--space-3);cursor:pointer}a{color:var(--os-accent)}</style></head><body><header class="site-bar"><strong>${MSO_LOGO_SVG} MSO</strong><span>Your service connections</span></header><main id="setup" class="integration"><h1>Integrations</h1><p>Preparing the native provider catalog…</p><noscript>Enable JavaScript to open the secure credential form. Credentials can also be entered through the MSO terminal.</noscript></main><script nonce="${nonce}">const INTEGRATIONS_CATALOG=${catalog};${INTEGRATION_FORM_SCRIPT}${CONNECTION_MANAGER_SCRIPT}${PORTABILITY_SCRIPT}${INTEGRATION_BROWSER_SCRIPT}</script></body></html>`;
- return { html, csp: `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; connect-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors 'none'` };
+ const bodyPadding=embedded?"var(--space-4)":"clamp(var(--space-4),3vw,40px)";
+ const html = `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="referrer" content="no-referrer"><title>Integrations · MSO</title><style nonce="${nonce}">${MSO_WIDGET_TOKENS}${INTEGRATION_FORM_STYLE}${CONNECTION_MANAGER_STYLE}${PORTABILITY_STYLE}*{box-sizing:border-box}body{margin:0;background:var(--surface);padding:${bodyPadding};font-family:var(--font-body);color:var(--text)}.site-bar{max-width:1180px;margin:0 auto 26px;font-size:var(--type-small);display:flex;justify-content:space-between;gap:var(--space-3)}.site-bar strong{display:flex;align-items:center;gap:var(--space-3);font-weight:750}.site-bar svg{width:30px;height:30px}.site-bar span{color:var(--text-dim)}button{border:var(--stroke) solid var(--sep-strong);border-radius:var(--radius-control);background:var(--field);color:var(--text);padding:var(--space-2) var(--space-3);cursor:pointer}a{color:var(--os-accent)}</style></head><body><header class="site-bar"><strong>${MSO_LOGO_SVG} MSO</strong><span>Your service connections</span></header><main id="setup" class="integration"><h1>Integrations</h1><p>Preparing the native provider catalog…</p><noscript>Enable JavaScript to open the secure credential form. Credentials can also be entered through the MSO terminal.</noscript></main><script nonce="${nonce}">const INTEGRATIONS_CATALOG=${catalog};${INTEGRATION_FORM_SCRIPT}${CONNECTION_MANAGER_SCRIPT}${PORTABILITY_SCRIPT}${INTEGRATION_BROWSER_SCRIPT}</script></body></html>`;
+ return { html, csp: `default-src 'none'; script-src 'nonce-${nonce}'; style-src 'nonce-${nonce}'; connect-src 'self'; form-action 'none'; base-uri 'none'; frame-ancestors ${embedded?"'self'":"'none'"}` };
}
-export function integrationPageResponse() {
- const page = integrationSetupPage();
- return new Response(page.html,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Security-Policy":page.csp,"Cache-Control":"no-store, private","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff","X-Frame-Options":"DENY"}});
+export function integrationPageResponse(request?:Request) {
+ const embedded=request?new URL(request.url).searchParams.get("embed")==="shell":false;
+ const page = integrationSetupPage(embedded);
+ return new Response(page.html,{headers:{"Content-Type":"text/html; charset=utf-8","Content-Security-Policy":page.csp,"Cache-Control":"no-store, private","Referrer-Policy":"no-referrer","X-Content-Type-Options":"nosniff","X-Frame-Options":embedded?"SAMEORIGIN":"DENY"}});
}
diff --git a/scripts/mso-cli-integrations-sc.sh b/scripts/mso-cli-integrations-sc.sh
index c557a2ab..3261bad9 100755
--- a/scripts/mso-cli-integrations-sc.sh
+++ b/scripts/mso-cli-integrations-sc.sh
@@ -3,11 +3,17 @@
# MSO remains standalone: this file is inert when SI-Coder is absent. Only metadata is
# auto-detected; direct credential values require the existing encrypted/manual transfer.
integration_sc_binary(){
- local c meta
- for c in "${MSO_SC_BIN-}" "$HOME/.local/bin/sc"; do
- [ -n "$c" ] && [ -x "$c" ] || continue
+ local c meta source source_real resolved
+ local -a candidates
+ if [ -n "${MSO_SC_BIN-}" ]; then candidates=("$MSO_SC_BIN"); else candidates=("$HOME/.local/bin/sc"); fi
+ for c in "${candidates[@]}"; do
+ [ -x "$c" ] || continue
meta=$("$c" version --json 2>/dev/null) || continue
- jq -e '.version and (.source|type=="string") and (.source|test("(^|/)si-coder-agent($|/)"))' >/dev/null 2>&1 <<<"$meta" || continue
+ source=$(jq -er 'select((.version|type)=="string" and (.version|length)>0) | .source | select(type=="string" and startswith("/"))' <<<"$meta") || continue
+ source_real=$(readlink -f -- "$source" 2>/dev/null) || continue
+ resolved=$(readlink -f -- "$c" 2>/dev/null) || continue
+ [ -d "$source_real" ] || continue
+ case "$resolved" in "$source_real"/*) ;; *) continue;; esac
printf '%s' "$c"; return 0
done
return 1
@@ -18,7 +24,11 @@ integration_sc_bundle(){
dir=$(mktemp -d "${TMPDIR:-/tmp}/mso-sc-migration.XXXXXX") || return 1
chmod 700 "$dir"; out="$dir/sc.integration-bundle.json"
"$bin" data export --out "$out" >/dev/null 2>&1 || rc=$?
- if [ "$rc" -eq 0 ]; then cat "$out"; fi
+ if [ "$rc" -eq 0 ] && jq -e '.format=="integration-bundle" and .version==1 and .producer.name=="si-coder" and .mode=="metadata" and (.users|type=="array")' "$out" >/dev/null 2>&1; then
+ cat "$out"
+ else
+ rc=1
+ fi
[ ! -e "$out" ] || { : >"$out"; unlink "$out"; }
rmdir "$dir" 2>/dev/null || true
return "$rc"
diff --git a/scripts/mso-cli-integrations-sc.test.ts b/scripts/mso-cli-integrations-sc.test.ts
index 6cf56ac9..c1565419 100644
--- a/scripts/mso-cli-integrations-sc.test.ts
+++ b/scripts/mso-cli-integrations-sc.test.ts
@@ -4,6 +4,7 @@ import {describe,expect,it} from "vitest";
const harness=path.join(__dirname,"test-support/integrations-sc-harness.sh");
const run=(mode:string)=>execFileSync("bash",[harness,mode],{encoding:"utf8"});
describe("optional SI-Coder local migration bridge",()=>{
- it("detects the canonical SI-Coder CLI through its public version/export contract",()=>{expect(JSON.parse(run("probe"))).toMatchObject({available:true,producer:"si-coder",userCount:1,connectionCount:1,mode:"metadata"})});
+ it("detects an installed SI-Coder CLI from a legitimate worktree through its public version/export contract",()=>{expect(JSON.parse(run("probe"))).toMatchObject({available:true,producer:"si-coder",userCount:1,connectionCount:1,mode:"metadata"})});
+ it("rejects a binary whose resolved target is outside its claimed source checkout",()=>{expect(JSON.parse(run("spoof"))).toEqual({available:false})});
it("previews metadata-only Integration Bundle import without transporting credential values",()=>{const text=run("preview"),p=JSON.parse(text);expect(p).toMatchObject({producer:"si-coder",canApply:true});expect(text).not.toContain("synthetic-secret");expect(text).not.toContain("values");});
});
diff --git a/scripts/test-support/integrations-sc-harness.sh b/scripts/test-support/integrations-sc-harness.sh
index f4f9e3af..7e51e7eb 100755
--- a/scripts/test-support/integrations-sc-harness.sh
+++ b/scripts/test-support/integrations-sc-harness.sh
@@ -1,12 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
-TMP="$(mktemp -d)";trap 'find "$TMP" -type f -delete 2>/dev/null||true;rmdir "$TMP" 2>/dev/null||true' EXIT
-FAKE="$TMP/sc";LOG="$TMP/log";:>"$LOG"
+TMP="$(mktemp -d)";trap 'find "$TMP" -type f -o -type l | xargs -r rm -f; find "$TMP" -depth -type d -empty -delete 2>/dev/null||true' EXIT
+SRC="$TMP/worktrees/sc-flow-merge-main";mkdir -p "$SRC/bin"
+FAKE="$SRC/bin/sc-entry.js";LINK="$TMP/sc";LOG="$TMP/log";:>"$LOG"
cat >"$FAKE" <<'SC'
#!/usr/bin/env bash
set -euo pipefail
-if [ "${1-}" = version ];then printf '%s' '{"version":"0.9.3","source":"/synthetic/si-coder-agent"}';exit;fi
+if [ "${1-}" = version ];then printf '{"version":"0.9.8","source":"%s"}' "$FAKE_SC_SOURCE";exit;fi
if [ "${1-}" = data ]&&[ "${2-}" = export ];then
out='';shift 2
while [ $# -gt 0 ];do case "$1" in --out)out="$2";shift 2;;*)exit 9;;esac;done
@@ -17,8 +18,8 @@ JSON
fi
exit 8
SC
-chmod +x "$FAKE"
-export MSO_SC_BIN="$FAKE"
+chmod +x "$FAKE";ln -s "$FAKE" "$LINK"
+export MSO_SC_BIN="$LINK" FAKE_SC_SOURCE="$SRC"
die(){ printf '%s\n' "$*" >&2;exit 2; }
tty_ok(){ return 1; }
tty_line(){ REPLY=n; }
@@ -26,6 +27,7 @@ jpost(){ local route="$1" body="$2";printf '%s\t%s\n' "$route" "$body">>"$LOG";i
source "$ROOT/scripts/mso-cli-integrations-sc.sh"
case "${1-}" in
probe) integration_sc_probe;;
+ spoof) FAKE_SC_SOURCE="$TMP/elsewhere";export FAKE_SC_SOURCE;integration_sc_probe;;
preview) integration_sc_preview;;
*) exit 4;;
esac