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): reconcile parallel shell and SC worktree fixes

Rahmane63f96655e97
diff --cc app/integrations/route.test.ts
index 7ba60846,33b7618a..a1c79ad1
--- a/app/integrations/route.test.ts
+++ b/app/integrations/route.test.ts
@@@ -1,3 -1,3 +1,4 @@@
++import { GET as standaloneGET } from "./route";
import { describe, expect, it, vi } from "vitest";
import { NextRequest } from "next/server";
vi.mock("server-only", () => ({}));
@@@ -12,13 -13,14 +13,17 @@@ describe("friendly native Integrations
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"));
++ it("preserves the earlier embed=shell alias and keeps standalone framing denied", () => {
++ expect(standaloneGET(new Request("https://mso.example.com/integrations?embed=shell")).headers.get("content-security-policy")).toContain("frame-ancestors 'self'");
++ expect(standaloneGET(new Request("https://mso.example.com/integrations")).headers.get("x-frame-options")).toBe("DENY");
++ });
+ it("limits the embedded manager to the same origin", () => {
+ const response = GET();
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" } }));
+ const read = await proxy(new NextRequest("https://mso.example.com/integrations/manager", { headers: { host: "mso.example.com" } }));
expect(read.headers.get("content-security-policy")).toBeNull();
const write = await proxy(new NextRequest("https://mso.example.com/api/v1/infra/setup", { method: "POST", headers: { host: "mso.example.com", origin: "https://evil.invalid", "sec-fetch-site": "cross-site" }, body: "{}" }));
expect(write.status).toBe(403);
diff --cc docs/ARCHITECTURE.md
index 6fc88a95,baddcd63..47b2df43
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@@ -62,7 -62,7 +62,8 @@@ frontend/slices/ vertical a
appshell/ generic shell framework
features/ shell features
os-shell/ MSO manifest + capability adapters
- infrastructure/ Integrations, Dokploy and Cloudflare default feature apps
+ infrastructure/ Dokploy and Cloudflare default feature apps
++ integrations/ Native connection manager shell app
lib/auth/ login/session/device approval + live roles
lib/host/ bounded host capability implementation
lib/mcp/ OAuth/MCP tool catalog and dispatcher
diff --cc docs/CHANGELOG.md
index 81afef0e,62d80de5..55e8fcb6
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@@ -8,7 -8,7 +8,8 @@@ this is the *what*, and it is what Sett
**Fixed**
+- `integrations` expose native shell and managed SC project bindings
+ - `integrations` add shell app and detect SC worktrees
- `mcp` fall back when project MCP discover returns -32601
## 2026-09-12
diff --cc docs/INTEGRATIONS.md
index 25793253,50bf8010..30f050bb
--- a/docs/INTEGRATIONS.md
+++ b/docs/INTEGRATIONS.md
@@@ -51,45 -51,6 +51,45 @@@ and holds a short operation lease again
Provider-MCP OAuth is completed in the provider's client. Returning that route does
not prove the external session is authorized, and MSO never falls back to a local key.
+## Ownership and managed SI-Coder
+
+MSO Integrations owns provider/account authority. Batonly owns project plans, task state,
+project-to-connection bindings, QA and delivery evidence; it must not mirror provider secrets.
+SI-Coder remains optional portable developer tooling. Its standalone store is unchanged.
+
+The shell now exposes **Integrations** in Dock, Launchpad and the App Store, with a pinned
+mobile shortcut. `/connections` opens the addressable shell window; `/integrations` remains
+the standalone compatibility entrypoint for secure setup links and terminal workflows. Its same-origin
+`/integrations/manager` document reuses the existing native service/form and nonce policy;
- only that internal document permits same-origin framing. Other origins remain blocked.
++only that internal document and the compatibility alias `/integrations?embed=shell` permit same-origin framing. Other origins remain blocked.
+Transfer and private setup fragment handoffs remain supported without copying field values.
+
+Settings → MCP → Plugins / Registry separates a declaration from a project binding.
+Enter an exact project, inspect the revision, then explicitly activate/deactivate a built-in.
+Custom manifests remain declarations only. The browser's registry is not runtime authority;
+`.mcp.json` is the project binding. A configured row is deliberately **not** labelled verified.
+Use `project_mcp_tools` and then `project_mcp_call` to verify real discovery/execution.
+
+For an MSO-managed SC binding, use `project_mcp_manage` with `plugin: "si-coder"` instead
+of `url`, retaining the revision returned by `action: "inspect"`. The portable binding is:
+
+```json
+{"mcpServers":{"si-coder":{"plugin":"si-coder","credentialAuthority":"mso"}}}
+```
+
+The installed package is resolved by its declared package/bin identity, not the name of a
+worktree directory. An unrelated system command named `sc` is never executed as SI-Coder.
+This mode exposes reviewed workspace utilities and redirects supported SC account/catalog/
+connection-status/verification functions to native MSO. Verification requires explicit
+`user`, `provider`, and `connection`; there is no fallback to standalone SC accounts.
+SC store mutations, import/export and unaudited flow execution are not exposed in managed
+mode. Provider deployment operations continue through `integration_execute`; credentials
+are neither copied nor silently synchronized. Standalone SC retains its complete own surface.
+
+This is not an operating-system sandbox for installed code. Activating and calling a local
+MCP still requires trust in the installed package and the existing MSO exec-scope approval.
+The managed dispatch boundary prevents accidental use of SC's parallel credential workflow.
+
## Browser and ChatGPT
Open `/integrations`. Public instructions are readable before sign-in; an Owner
diff --cc docs/PROGRESS.md
index 950a433e,fac3d111..d6fa8572
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@@ -1,21 -1,33 +1,58 @@@
+ ## 2026-09-14 — Integrations is a first-class shell app and SI-Coder worktrees are detected safely
+
++## 2026-09-14 — Reconcile parallel Integrations work
++
++The two concurrent implementations are consolidated into one `integrations` feature slice,
++not two app descriptors or managers. The native window uses `/connections` and the internal
++manager endpoint; the earlier `embed=shell` compatibility alias is retained with same-origin
++framing only. Both standalone deny-framing and package-entrypoint spoof regression tests
++remain. An explicit invalid `MSO_SC_BIN` never falls back to another user's/default CLI.
++
++
+ 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
+ `/home/rahman/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
+## 2026-09-14 — Native Integrations shell and project-scoped SC activation
+
+Before: Integrations had a standalone page but no app descriptor/catalog entry; plugin
+registry declarations looked disconnected from runtime; SC detection assumed its checkout
+folder was named `si-coder-agent`. After: a pinned native Integrations shell window reuses
+the existing manager, reviewed built-ins can be explicitly bound to exact projects from
+Settings, and package/bin identity accepts legitimate renamed worktrees without invoking
+an unrelated system `sc`. Managed SC account/status/verification calls resolve through MSO
+Integrations; standalone SC remains unchanged and no credential synchronization is applied.
+
+The registry distinguishes configured from verified. Existing project MCP discovery/call
+tools remain the verification path; no new privileged browser execution endpoint is added.
+Batonly remains project/task/evidence authority. See `docs/INTEGRATIONS.md` for the managed
+binding contract and the explicit limits on SC's exposed managed tool surface.
+
+
`project_mcp_tools` probed modern `server/discover` and treated only HTTP 400/404/405
as unsupported. A legacy-only HTTP MCP that answers JSON-RPC method-not-found on HTTP 200
— the usual JSON-RPC wire — entered the fallback branch and then threw `-32601` because
diff --cc docs/SLICE-CATALOG.md
index fa09f3d9,fa09f3d9..4335ee86
--- a/docs/SLICE-CATALOG.md
+++ b/docs/SLICE-CATALOG.md
@@@ -3,12 -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,6 +24,7 @@@
| `image-editor` | Layered raster image editor |
| `image-picker` | Reusable image/wallpaper picker |
| `infrastructure` | Dokploy/Cloudflare provider configuration and live inventory apps |
++| `integrations` | Native connection manager shell window using the existing Integrations service |
| `managed-apps` | Hermes/OpenClaw install/lifecycle/update/backup/proxy |
| `media-studio` | Image/media studio surface |
| `media-viewer` | Preview/Quick Look-style media viewer |
diff --cc frontend/slices/integrations/app.test.ts
index d382a3e9,00000000..26c680ff
mode 100644,000000..100644
--- a/frontend/slices/integrations/app.test.ts
+++ b/frontend/slices/integrations/app.test.ts
@@@ -1,18 -1,0 +1,18 @@@
+import { readFileSync } from "node:fs";
+import { describe, expect, it } from "vitest";
- import { managerLocation } from "./integrations-app";
++import { managerLocation } from "./app";
+import { integrationsApp } from "./index";
+
+describe("native Integrations shell app", () => {
+ it("has a dockable descriptor and a matching app catalog entry", () => {
+ expect(integrationsApp.id).toBe("integrations");
+ expect(integrationsApp.noDock).not.toBe(true);
+ expect(readFileSync("frontend/slices/app-store/lib/system-catalog.ts", "utf8")).toContain('id: "integrations", title: "Integrations", kind: "app"');
+ const manifest = readFileSync("frontend/slices/os-shell/shell.manifest.ts", "utf8");
+ expect(manifest).toContain('pin(withSlug(integrationsApp, "connections"))');
+ });
+ it("keeps transfer and private fragment handoffs inside the existing manager", () => {
+ expect(managerLocation("?transfer=1&untrusted=ignore", "#example-capability")).toBe("/integrations/manager?transfer=1#example-capability");
+ expect(managerLocation("?target=https://untrusted.invalid")).toBe("/integrations/manager");
+ });
+});
diff --cc frontend/slices/integrations/index.ts
index 00000000,23689b45..1a1305d0
mode 000000,100644..100644
--- a/frontend/slices/integrations/index.ts
+++ b/frontend/slices/integrations/index.ts
@@@ -1,0 -1,12 +1,12 @@@
-import { Cable } from "lucide-react";
++import { Plug } 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)",
++ icon: Plug,
++ gradient: "var(--primary)",
+ load: () => import("./app"),
+ defaultSize: { w: 1040, h: 720 },
+ };
diff --cc lib/infra/setup-page.ts
index 065d8b65,5ad3ad06..10b9faa2
--- a/lib/infra/setup-page.ts
+++ b/lib/infra/setup-page.ts
@@@ -6,16 -6,15 +6,16 @@@ import { INTEGRATION_FORM_SCRIPT, INTEG
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(embedded=false) {
+export function integrationSetupPage(embedded = false) {
const nonce = randomBytes(18).toString("base64");
const catalog = JSON.stringify(connectionCatalog()).replace(/</g,"\\u003c");
- 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'"}` };
+ 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)}${embedded ? "body{padding:var(--space-4)}.site-bar{display:none}" : ""}</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(request?:Request) {
- const embedded=request?new URL(request.url).searchParams.get("embed")==="shell":false;
+function integrationResponse(embedded: boolean) {
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"}});
+ 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"}});
}
+
- export const integrationPageResponse = () => integrationResponse(false);
++export const integrationPageResponse = (request?: Request) => integrationResponse(request ? new URL(request.url).searchParams.get("embed") === "shell" : false);
+export const integrationManagerResponse = () => integrationResponse(true);
diff --cc lib/mcp/local-agent-two-way.test.ts
index d125f00f,d125f00f..2da4e199
--- a/lib/mcp/local-agent-two-way.test.ts
+++ b/lib/mcp/local-agent-two-way.test.ts
@@@ -48,7 -48,7 +48,9 @@@ describe("two-way Local Agent MCP recei
const contextA = { principal, sessionId: a.id };
const contextB = { principal, sessionId: b.id };
-- const receiveB = dispatch(call("local_agent_inbox", { wait_ms: 1000 }), "read", "mcp:b", contextB);
++ // Coverage under concurrent builds can exceed 1s; keep the real receiver
++ // alive while asserting the same delivered/acknowledged semantics.
++ const receiveB = dispatch(call("local_agent_inbox", { wait_ms: 10000 }), "read", "mcp:b", contextB);
await waitForSubscriber(b.id);
const sent = await dispatch(call("local_agent_message_send", {
@@@ -63,7 -63,7 +65,7 @@@
expect(inboxB[0]).toMatchObject({ text: "PING_FROM_A", intent: "request" });
expect(events.localAgentSubscriberCount(b.id)).toBe(0);
-- const receiveA = dispatch(call("local_agent_inbox", { wait_ms: 1000 }), "read", "mcp:a", contextA);
++ const receiveA = dispatch(call("local_agent_inbox", { wait_ms: 10000 }), "read", "mcp:a", contextA);
await waitForSubscriber(a.id);
const replied = await dispatch(call("local_agent_reply", {
@@@ -80,7 -80,7 +82,7 @@@
replyToMessageId: inboxB[0].id,
});
expect(events.localAgentSubscriberCount(a.id)).toBe(0);
-- });
++ }, 20000);
it("preserves immediate reads when wait_ms is omitted", async () => {
const subscribe = vi.spyOn(events, "subscribeLocalAgentMessages");
diff --cc next.config.mjs
index d24c1964,59567cde..a1ccbc98
--- a/next.config.mjs
+++ b/next.config.mjs
@@@ -130,9 -130,6 +130,10 @@@ const nextConfig =
// Private API responses must never be cached by any intermediary — they
// carry host bytes (fs/read), auth state, and per-session data.
{ source: "/api/:path*", headers: [{ key: "Cache-Control", value: "no-store" }] },
+ // Only the internal manager is same-origin embeddable; its nonce CSP also
+ // restricts frame-ancestors to self. The standalone page/shell retain DENY.
++ { source: "/integrations", has: [{ type: "query", key: "embed", value: "shell" }], headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }] },
+ { source: "/integrations/manager", headers: [{ key: "X-Frame-Options", value: "SAMEORIGIN" }, { key: "Cache-Control", value: "no-store" }, { key: "Referrer-Policy", value: "no-referrer" }] },
{ source: "/integrations", headers: [{ key: "Cache-Control", value: "no-store" }, { key: "Referrer-Policy", value: "no-referrer" }] },
{ source: "/api/integrations/:path*", headers: [{ key: "Referrer-Policy", value: "no-referrer" }] },
// Named brand/wallpaper assets are effectively immutable but, unlike
diff --cc scripts/mso-cli-integrations-sc.sh
index e94e8216,3261bad9..70ced6af
--- a/scripts/mso-cli-integrations-sc.sh
+++ b/scripts/mso-cli-integrations-sc.sh
@@@ -3,11 -3,18 +3,11 @@@
# 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 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
- 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
+ local c detected
- for c in "${MSO_SC_BIN-}" "$HOME/.local/bin/sc"; do
++ for c in "${MSO_SC_BIN:-$HOME/.local/bin/sc}"; do
+ [ -n "$c" ] && [ -x "$c" ] || continue
+ detected=$(node "$ROOT/lib/host/sc-installation.mjs" "$c" 2>/dev/null) || continue
+ printf '%s' "$detected"; return 0
done
return 1
}
diff --cc scripts/mso-cli-integrations-sc.test.ts
index 6cf56ac9,c1565419..193a5644
--- a/scripts/mso-cli-integrations-sc.test.ts
+++ b/scripts/mso-cli-integrations-sc.test.ts
@@@ -4,6 -4,7 +4,7 @@@ import {describe,expect,it} from "vites
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("rejects an explicit binary that does not match its package entrypoint without default fallback",()=>{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 --cc scripts/test-support/integrations-sc-harness.sh
index 68a60161,7e51e7eb..9fc4f1ae
--- a/scripts/test-support/integrations-sc-harness.sh
+++ b/scripts/test-support/integrations-sc-harness.sh
@@@ -1,10 -1,9 +1,11 @@@
#!/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
- printf '%s' '{"name":"si-coder-agent","version":"0.9.3","bin":{"sc":"sc"}}' >"$TMP/package.json"
- chmod 600 "$TMP/package.json"
- 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"
++printf '%s' '{"name":"si-coder-agent","version":"0.9.8","bin":{"sc":"bin/sc-entry.js"}}' >"$SRC/package.json"
++chmod 600 "$SRC/package.json"
+ FAKE="$SRC/bin/sc-entry.js";LINK="$TMP/sc";LOG="$TMP/log";:>"$LOG"
cat >"$FAKE" <<'SC'
#!/usr/bin/env bash
set -euo pipefail
@@@ -28,6 -27,7 +29,7 @@@ jpost(){ local route="$1" body="$2";pri
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;;
++ spoof) printf '%s' '{"name":"si-coder-agent","version":"0.9.8","bin":{"sc":"bin/other.js"}}' >"$SRC/package.json";printf '%s' '// unrelated synthetic entrypoint' >"$SRC/bin/other.js";integration_sc_probe;;
preview) integration_sc_preview;;
*) exit 4;;
esac