PrismDesk

Plugin Development Guide

PrismDesk uses a “One manifest.json + Three Open Extension Tracks” architecture so you can plug existing scripts, APIs, and web panels into one desktop workbench without building a desktop shell.


1. Three Extension Tracks

Track Best For Tech Stack Isolation Model
Track A: MCP Services Backend queries, diagnostics, business APIs, ticket creation, notifications Any language (Python / Node / Go / Java / Rust) Remote Streamable HTTP (Recommended) or guarded Local stdio
Track B: Sandboxed Web Micro-Apps Dedicated sidebar panels (topology graphs, triage tools, helper forms) Any Web stack (React / Vue / Vanilla HTML) sandbox: true + persist:plugin-<id> isolated partition
Track C: Page Scripts & Skills Lightweight page enhancements and team analysis SOPs Isolated IIFE JS + Markdown Isolated script injection; Skills auto-injected into Agent Prompt

2. manifest.json & Permission Tiers

Every plugin manifest is validated strictly against the schema and enforces least privilege:

{
  "id": "com.ops.alert-copilot",
  "name": "Alert Triage Copilot",
  "version": "1.0.0",
  "description": "Correlate page alerts with deployments and file guarded tickets",
  "minHostVersion": "0.1.0",
  "activation": {
    "urlMatches": ["https://monitor.internal/*"],
    "onStartup": false
  },
  "contributes": {
    "mcpServers": [
      {
        "id": "ops-http",
        "transport": "streamable-http",
        "url": "http://127.0.0.1:3102/mcp",
        "timeoutMs": 30000
      }
    ],
    "uiPanels": [
      {
        "id": "triage-panel",
        "slot": "sidebar",
        "title": "Alert Triage Panel",
        "entry": "./ui/index.html"
      }
    ],
    "pageScripts": [
      {
        "matches": ["https://monitor.internal/*"],
        "script": "./extractors/page-badge.js",
        "runAt": "document_idle"
      }
    ],
    "skills": [
      {
        "id": "ops-sop",
        "title": "Incident Triage SOP",
        "urlMatches": ["https://monitor.internal/*"],
        "file": "./skills/triage-sop.md"
      }
    ]
  },
  "permissions": [
    "page:read:https://monitor.internal/*",
    "ai:invoke",
    "tools:call:com.ops.alert-copilot/*"
  ]
}

Permission Tiers (L0 – L3)

  • L0 Safe (host:theme, storage:*, ui:toast): Auto-allowed with isolated per-plugin storage.
  • L1 Scoped Read (page:read:<urlPattern>, ai:invoke, read-only MCP): Strictly bound to URL patterns and the Global Privacy Switch.
  • L2 Guarded Write (network:sniff, page:action, write MCP): Mandatory HITL Approval Card on every invocation.
  • L3 Local High-Risk (local:stdio, fs:*, shell:*): High-risk warning with concurrency caps and timeout circuit breakers.

3. Track A: Standard MCP Services

  1. Automatic Namespacing: Mounted tools receive <pluginShortId>__<toolName> prefixes so teams never collide.
  2. Accurate annotations:
    • Set readOnlyHint: true, destructiveHint: false for read-only lookups → auto-allowed.
    • Set readOnlyHint: false for any state change or notification → mandatory HITL approval card.
  3. 3-Tier Dynamic Tool Router: Tools activate automatically via URL matching, explicit @plugin mentions, or on-demand discover_tools queries.
from mcp.server.fastmcp import FastMCP
from mcp.types import ToolAnnotations

mcp = FastMCP("python-data-copilot", host="127.0.0.1", port=3102)

@mcp.tool(annotations=ToolAnnotations(readOnlyHint=True, destructiveHint=False))
def detect_metric_anomalies(values: list[float], threshold_z: float = 2.0) -> dict:
    """Run Z-Score anomaly detection on metric series (read-only)"""
    mean = sum(values) / len(values)
    std = (sum((v - mean) ** 2 for v in values) / len(values)) ** 0.5
    return {"mean": mean, "anomalies": [v for v in values if std and abs((v - mean) / std) >= threshold_z]}

if __name__ == "__main__":
    mcp.run(transport="streamable-http")

4. Track B: Sandboxed Web Micro-Apps

Sidebar micro-apps run under sandbox: true, contextIsolation: true, nodeIntegration: false, and persist:plugin-<id>. They cannot access Node.js or business session cookies; all host APIs flow through window.__WORKBENCH_BRIDGE__.invoke(method, params) gated by PermGate:

const bridge = window.__WORKBENCH_BRIDGE__;

// 1. Read active business page tables (requires page:read:<domain>)
const ctx = await bridge.invoke('page.extractContext', {
  includeTables: true,
  includeNetworkJson: true,
});

// 2. Highlight target table on the host page (L4)
if (ctx.tables[0]?.axRefId) {
  await bridge.invoke('page.highlightElement', { axRefId: ctx.tables[0].axRefId });
}

// 3. Reuse host AI models without storing API keys
const reply = await bridge.invoke('ai.complete', { prompt: 'Summarize root cause' });

// 4. Plugin-isolated persistent KV storage
await bridge.invoke('storage.set', { key: 'last_filter', value: { severity: 'P0' } });

5. Track C: Page Scripts & Domain Skills

  • Page Scripts (pageScripts): Wrapped in an isolated IIFE on matching URLs without leaking globals; immediately respects the Global Privacy Switch.
  • Domain Skills (skills): Standard Markdown SOPs automatically injected into the AI System Prompt whenever matching URLs are active.

6. Local Hot Reload & Live Debugging

  1. Quick MCP Connection: Open MCP Tools → Add MCP Server and enter any Streamable HTTP URL or local stdio command.
  2. Local Folder Dev Mode: Open Plugin Market → Developer Mode, load any directory containing manifest.json, reload changes in one click, and watch live Bridge allow/deny decisions with execution latency below.