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(plugin): distinguish staging from ChatGPT app install

Rahman172e277e3e47
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index c99f218d..0122d442 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -92,7 +92,7 @@ MSO uses several extension concepts because they own different authority. They a
| Term | What it owns | State / authority | Do not confuse with |
|---|---|---|---|
| **Skill** | Trusted reusable instructions and routing policy (`SKILL.md`, optional structured contract/resources). | Skill trust (`official / verified / local / untrusted`) controls whether instructions may be model-loaded. A skill does not grant credentials or tool permission. | MCP server, Integration, executable app. |
-| **OpenAI/Codex plugin package** | Distribution metadata for reviewed skills plus an optional registered-app mapping (`.codex-plugin/plugin.json` + `.app.json`). | Packaging only. The package does not authorize the live MSO MCP server. | MSO Project Plugin, registered app, MCP authorization. |
+| **OpenAI/Codex plugin package** | Distribution metadata for reviewed skills plus an optional registered-app mapping (`.codex-plugin/plugin.json` + `.app.json`). | Packaging only. Staging does not install/select the package in a ChatGPT client and does not authorize the live MSO MCP server. | MSO Project Plugin, registered app, MCP authorization. |
| **Registered app** | External platform identity referenced by `.app.json` when an exact real app registration exists. | Platform-owned install/connection/permission state. MSO keeps the mapping empty until an exact registration exists. | Generic MSO Integration or Project Plugin. |
| **Project Plugin** | A reviewed portable capability package that can declare skills and an MCP binding for one exact project. | Catalog presence never means installed. `project_mcp_manage` installs/removes only the selected project or explicit `@host` target with revision guards; no inheritance. | Global plugin install, Skill Market entry, Integration credential. |
| **MCP** | Protocol/transport boundary for structured tools. This includes MSO's own `/mcp` and project-declared MCP servers. | Tool schemas are discovered from the selected server; OAuth/project policy and call-time guards remain authoritative. | Package identity or credential storage. |
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index ae1eec63..ff43c464 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**
+- `plugin` distinguish staging from ChatGPT app install
- `memory` persist workflow and organization actions
- `browser` settle Camoufox viewer auth before reload
- `browser` keep Camoufox viewer transport clean
diff --git a/docs/CHATGPT-PLUGIN.md b/docs/CHATGPT-PLUGIN.md
index f9b366d8..330a4f9e 100644
--- a/docs/CHATGPT-PLUGIN.md
+++ b/docs/CHATGPT-PLUGIN.md
@@ -239,3 +239,7 @@ The source repository intentionally keeps `.app.json` free of maintainer-specifi
To obtain the ID, enable ChatGPT developer mode, register the installation's remote `/mcp` endpoint, complete **Scan Tools** and OAuth, then copy the **App ID** from the registered app details. A browser URL may expose the equivalent technical `plugin_asdk_app_...` identifier; MSO normalizes that to canonical `asdk_app_...`. The Version ID shown by ChatGPT is version-scoped metadata and is intentionally not stored or used by MSO.
Use `bun run plugin:stage-private` to create an owner-private plugin package at `~/.mso/private/plugin-packages/mso`. Its generated `.app.json` contains the selected installation's binding, while the Git checkout remains portable. `bun run plugin:link-app` without an explicit ID resolves the default private Integrations connection and redacts the ID from stdout. Explicit ID arguments remain only for compatibility/tests and should not be used for personal IDs in shell history.
+
+**Staging is preparation, not installation.** It does not install, publish, refresh, or select the app in ChatGPT. `bun run plugin:doctor-private` reports only redacted staging/install-state facts for the machine on which it runs. A local marketplace/plugin cache belongs to that client machine; staging on a remote VPS does not make a ChatGPT web or desktop conversation use that package.
+
+For native MCP Apps acceptance, start a new conversation through the registered MCP App/direct app context (or an actually installed plugin package that references it). A generic function, dynamic-tool, Code Mode, or plugin orchestration wrapper may preserve the tool schema while unwrapping the MCP result and omitting the host-owned app resource context. If `render_mso_block` returns only structured data in such a wrapper, that is not evidence that the server resource, HTML, CSP, or bridge is broken. Verify that the host invocation retains the app resource binding before changing renderer code. Only a visually mounted component and a real component action round-trip count as native UI acceptance.
diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md
index e8afac5f..87f6a220 100644
--- a/docs/PROGRESS.md
+++ b/docs/PROGRESS.md
@@ -25,6 +25,12 @@ password, cockpit cookie, or viewer asset access is broadened.
- Research boundary: adopts provider-neutral control-plane lessons from DeepSeek-V4.1-Flash (2609.19969), Hermes bounded frozen memory/on-demand recall, LongMemEval-V2 compact evidence gathering, and structured/evidence-aware ideas from Memory-R1, Hindsight, Mem0 and A-MEM. It does not import vendor model/KV code, require embeddings/graph storage, or weaken scope/promotion gates.
- New/updated gates: memory context unit coverage, compact workflow-start projection coverage, recipe recommendation-vs-route-match regression, 6/6 lexical retrieval, 4/4 stable-core/JIT, 3/3 two-hop, existing 8/8 lifecycle and typed-memory deterministic suites.
+## 2026-09-19 — Separate ChatGPT native-app context from plugin staging
+
+Post-refresh acceptance proved that ChatGPT has the latest MSO tool schema but the currently selected orchestration path still returns `render_mso_block` as decoded structured data rather than mounting the MCP App. The server-side descriptor/resource/result contracts remain unchanged: the new evidence is at the host/package boundary. The owner-private OpenAI package was validly staged with a redacted registered-app binding, but this machine had neither a personal marketplace declaration nor a cached MSO plugin install. Staging on the VPS therefore did not install, publish, refresh, or select anything in ChatGPT.
+
+Added `plugin:doctor-private` plus a post-stage doctor that verifies private modes, the `.app.json` link and canonical binding while never printing the binding value, and reports local marketplace/cache state separately. The ChatGPT plugin reference now makes the acceptance boundary explicit: direct registered-app/app-context or an actually installed package is required for native UI verification; a generic function/Code Mode wrapper returning the inner object is not visual MCP Apps evidence. No MCP UI HTML, CSP, resource URI, OAuth behavior, tool scope, or personal App ID changed.
+
## 2026-09-19 — Make compact MCP Apps standards-first and align plugin bindings with references
A live ChatGPT test showed MSO render tools returning valid structured data without a visible
diff --git a/package.json b/package.json
index 6c34c703..11e94385 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"skill:check": "bun scripts/check-skill-flows.mjs",
"plugin:link-app": "node scripts/link-openai-app.mjs",
"plugin:stage-private": "node scripts/stage-openai-plugin.mjs",
+ "plugin:doctor-private": "node scripts/openai-plugin-doctor.mjs",
"comparison": "node scripts/gen-comparison.mjs",
"bench:cognitive": "bun scripts/bench-cognitive-runtime.mjs",
"bench:memory": "bun scripts/bench-memory-retrieval.mjs",
diff --git a/scripts/openai-plugin-doctor.mjs b/scripts/openai-plugin-doctor.mjs
new file mode 100644
index 00000000..87f08a65
--- /dev/null
+++ b/scripts/openai-plugin-doctor.mjs
@@ -0,0 +1,131 @@
+#!/usr/bin/env node
+import { promises as fs } from "node:fs";
+import os from "node:os";
+import path from "node:path";
+
+const home = os.homedir();
+const argv = process.argv.slice(2);
+
+function option(name) {
+ const index = argv.indexOf(name);
+ if (index < 0) return undefined;
+ const value = argv[index + 1];
+ if (!value || value.startsWith("--")) throw new Error(name + " requires a path");
+ return value;
+}
+
+const stage = path.resolve(option("--stage") ?? process.env.MSO_OPENAI_PLUGIN_STAGE ?? path.join(home, ".mso", "private", "plugin-packages", "mso"));
+const marketplace = path.resolve(option("--marketplace") ?? path.join(home, ".agents", "plugins", "marketplace.json"));
+const cache = path.resolve(option("--cache") ?? path.join(home, ".codex", "plugins", "cache"));
+
+const canonicalId = (value) =>
+ /^(?:asdk_app_|connector_|templated_apps_)[A-Za-z0-9][A-Za-z0-9_-]*$/.test(String(value ?? ""));
+
+async function readJson(file) {
+ try {
+ return JSON.parse(await fs.readFile(file, "utf8"));
+ } catch (error) {
+ if (error?.code === "ENOENT") return null;
+ throw error;
+ }
+}
+
+async function isSafePrivatePath(target, expectedMode) {
+ try {
+ const st = await fs.stat(target);
+ return (st.mode & 0o777) === expectedMode;
+ } catch (error) {
+ if (error?.code === "ENOENT") return false;
+ throw error;
+ }
+}
+
+async function marketplaceDeclaresMso() {
+ const state = await readJson(marketplace);
+ if (!state || !Array.isArray(state.plugins)) return false;
+ return state.plugins.some((plugin) => plugin?.name === "mso");
+}
+
+async function cachedMsoInstalls() {
+ let marketplaces;
+ try {
+ marketplaces = await fs.readdir(cache, { withFileTypes: true });
+ } catch (error) {
+ if (error?.code === "ENOENT") return 0;
+ throw error;
+ }
+
+ let count = 0;
+ for (const market of marketplaces) {
+ if (!market.isDirectory()) continue;
+ const marketDir = path.join(cache, market.name);
+ let plugins = [];
+ try {
+ plugins = await fs.readdir(marketDir, { withFileTypes: true });
+ } catch {
+ continue;
+ }
+ for (const plugin of plugins) {
+ if (!plugin.isDirectory() || plugin.name !== "mso") continue;
+ const pluginDir = path.join(marketDir, plugin.name);
+ let versions = [];
+ try {
+ versions = await fs.readdir(pluginDir, { withFileTypes: true });
+ } catch {
+ continue;
+ }
+ for (const version of versions) {
+ if (!version.isDirectory()) continue;
+ const manifest = await readJson(path.join(pluginDir, version.name, ".codex-plugin", "plugin.json"));
+ if (manifest?.name === "mso") count += 1;
+ }
+ }
+ }
+ return count;
+}
+
+const pluginManifest = await readJson(path.join(stage, ".codex-plugin", "plugin.json"));
+const appManifest = await readJson(path.join(stage, ".app.json"));
+const binding = appManifest?.apps?.mso;
+const bindingValid = Boolean(binding && canonicalId(binding.id) && binding.required === true);
+const staged = Boolean(pluginManifest && appManifest);
+const stageModeSafe = await isSafePrivatePath(stage, 0o700);
+const appModeSafe = await isSafePrivatePath(path.join(stage, ".app.json"), 0o600);
+const manifestLinksApp = pluginManifest?.apps === "./.app.json";
+const marketplaceDeclared = await marketplaceDeclaresMso();
+const installedCacheCount = await cachedMsoInstalls();
+
+const status = {
+ staged,
+ stageModeSafe,
+ appModeSafe,
+ manifestLinksApp,
+ bindingPresent: Boolean(binding),
+ bindingValid,
+ marketplaceDeclared,
+ installedCacheCount,
+};
+
+console.log(
+ [
+ "openai-app: staged=" + (status.staged ? "yes" : "no"),
+ "private-modes=" + (status.stageModeSafe && status.appModeSafe ? "safe" : "check"),
+ "manifest-link=" + (status.manifestLinksApp ? "ok" : "missing"),
+ "binding=" + (status.bindingValid ? "present(redacted)" : status.bindingPresent ? "invalid(redacted)" : "missing"),
+ "marketplace-declared=" + (status.marketplaceDeclared ? "yes" : "no"),
+ "installed-cache=" + status.installedCacheCount,
+ ].join("; "),
+);
+
+if (!status.staged || !status.manifestLinksApp || !status.bindingValid || !status.stageModeSafe || !status.appModeSafe) {
+ console.error("openai-app: private package is not installation-ready; App ID remains redacted");
+ process.exitCode = 2;
+} else if (!status.marketplaceDeclared || status.installedCacheCount === 0) {
+ console.log(
+ "openai-app: package is staged only. Staging does not install or refresh ChatGPT. Native MCP Apps acceptance must run through the registered app/direct app context or an actually installed plugin package.",
+ );
+} else {
+ console.log(
+ "openai-app: a local marketplace declaration and cached MSO plugin install were detected on this machine; start a new client conversation before native MCP Apps acceptance.",
+ );
+}
diff --git a/scripts/openai-plugin-doctor.test.ts b/scripts/openai-plugin-doctor.test.ts
new file mode 100644
index 00000000..d042895a
--- /dev/null
+++ b/scripts/openai-plugin-doctor.test.ts
@@ -0,0 +1,95 @@
+import { afterEach, describe, expect, it } from "vitest";
+import { chmod, mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { execFileSync } from "node:child_process";
+import os from "node:os";
+import path from "node:path";
+
+const roots: string[] = [];
+afterEach(async () => {
+ await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
+});
+
+async function fixture() {
+ const root = await mkdtemp(path.join(os.tmpdir(), "mso-openai-plugin-doctor-"));
+ roots.push(root);
+ const stage = path.join(root, "stage");
+ const marketplace = path.join(root, "marketplace.json");
+ const cache = path.join(root, "cache");
+ const appId = "asdk_app_privatefixture_do_not_print";
+ await mkdir(path.join(stage, ".codex-plugin"), { recursive: true, mode: 0o700 });
+ await writeFile(
+ path.join(stage, ".codex-plugin", "plugin.json"),
+ JSON.stringify({ name: "mso", version: "0.2.21", apps: "./.app.json" }),
+ { mode: 0o600 },
+ );
+ await writeFile(
+ path.join(stage, ".app.json"),
+ JSON.stringify({ apps: { mso: { id: appId, required: true } } }),
+ { mode: 0o600 },
+ );
+ await chmod(stage, 0o700);
+ await chmod(path.join(stage, ".app.json"), 0o600);
+ return { root, stage, marketplace, cache, appId };
+}
+
+function runDoctor(stage: string, marketplace: string, cache: string) {
+ return execFileSync(
+ process.execPath,
+ [
+ path.resolve("scripts/openai-plugin-doctor.mjs"),
+ "--stage",
+ stage,
+ "--marketplace",
+ marketplace,
+ "--cache",
+ cache,
+ ],
+ {
+ cwd: path.resolve("."),
+ encoding: "utf8",
+ env: process.env,
+ },
+ );
+}
+
+describe("openai-plugin-doctor", () => {
+ it("reports staged-only state without exposing the private app id", async () => {
+ const { stage, marketplace, cache, appId } = await fixture();
+ const stdout = runDoctor(stage, marketplace, cache);
+ expect(stdout).toContain("staged=yes");
+ expect(stdout).toContain("private-modes=safe");
+ expect(stdout).toContain("manifest-link=ok");
+ expect(stdout).toContain("binding=present(redacted)");
+ expect(stdout).toContain("marketplace-declared=no");
+ expect(stdout).toContain("installed-cache=0");
+ expect(stdout).toContain("package is staged only");
+ expect(stdout).not.toContain(appId);
+ });
+
+ it("detects a local marketplace declaration and cached install without printing the binding", async () => {
+ const { stage, marketplace, cache, appId } = await fixture();
+ await mkdir(path.dirname(marketplace), { recursive: true });
+ await writeFile(
+ marketplace,
+ JSON.stringify({
+ name: "personal",
+ plugins: [
+ {
+ name: "mso",
+ source: { source: "local", path: "./mso" },
+ policy: { installation: "AVAILABLE", authentication: "ON_INSTALL" },
+ },
+ ],
+ }),
+ );
+ const installed = path.join(cache, "personal", "mso", "local", ".codex-plugin");
+ await mkdir(installed, { recursive: true });
+ await writeFile(path.join(installed, "plugin.json"), JSON.stringify({ name: "mso", version: "0.2.21" }));
+
+ const stdout = runDoctor(stage, marketplace, cache);
+ expect(stdout).toContain("marketplace-declared=yes");
+ expect(stdout).toContain("installed-cache=1");
+ expect(stdout).toContain("cached MSO plugin install");
+ expect(stdout).not.toContain(appId);
+ });
+});
diff --git a/scripts/stage-openai-plugin.mjs b/scripts/stage-openai-plugin.mjs
index 33577496..549e84d4 100755
--- a/scripts/stage-openai-plugin.mjs
+++ b/scripts/stage-openai-plugin.mjs
@@ -25,3 +25,16 @@ await fs.mkdir(path.dirname(stage),{recursive:true,mode:0o700});
await fs.rename(temp,stage);
await fs.chmod(stage,0o700);
console.log("openai-app: private plugin package staged at "+stage+"; App ID is redacted and the source repository was not modified");
+
+const doctor=spawnSync(process.execPath,[path.join(repo,"scripts","openai-plugin-doctor.mjs")],{
+ cwd:repo,
+ stdio:["ignore","pipe","pipe"],
+ encoding:"utf8",
+ env:{...process.env,MSO_OPENAI_PLUGIN_STAGE:stage},
+});
+if(doctor.status!==0){
+ process.stderr.write(doctor.stderr||"openai-app: staged package verification failed\n");
+ process.exit(doctor.status??2);
+}
+process.stdout.write(doctor.stdout);
+console.log("openai-app: no ChatGPT install or refresh was attempted; staging is preparation only");