Skip to content

ServerKit is a lightweight, modern server control panel for managing web applications, databases, and services on your VPS or dedicated server. Built with Python/Flask backend and React frontend.

feat(extensions): runtime-frontend hardening + GPU core-slim (plan 32)

Juan Denisc96a476a7447
diff --git a/backend/app/notifications/templates/email/digest.html b/backend/app/notifications/templates/email/digest.html
new file mode 100644
index 00000000..0ab88a1b
--- /dev/null
+++ b/backend/app/notifications/templates/email/digest.html
@@ -0,0 +1,30 @@
+{% extends 'email/base.html' %}
+{% from 'email/partials/_macros.html' import divider with context %}
+{% block heading %}{{ subject }}{% endblock %}
+{% block content %}
+ <p style="margin:0 0 20px;">Here{{ "'s" }} what happened while you were away{% if total %} — {{ total }} update{{ 's' if total != 1 else '' }}{% endif %}.</p>
+ {% for group in groups %}
+ <table role="presentation" width="100%" border="0" cellpadding="0" cellspacing="0" style="margin:0 0 8px;">
+ <tr>
+ <td class="sk-faint" style="padding:6px 0;font-family:-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:11px;font-weight:700;letter-spacing:.6px;text-transform:uppercase;color:{{ brand.faint }};">
+ {{ group.label }}
+ </td>
+ </tr>
+ </table>
+ {% for item in group['items'] %}
+ {% set st = severity_styles.get(item.severity, severity_styles['info']) %}
+ <table role="presentation" width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-bottom:10px;"><tr>
+ <td style="background:{{ st.bg }};border-left:4px solid {{ st.dot }};border-radius:8px;padding:12px 14px;">
+ <div style="font-family:-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:10px;font-weight:700;letter-spacing:.5px;text-transform:uppercase;color:{{ st.text }};">{{ st.label }}{% if item.when %} &middot; {{ item.when }}{% endif %}</div>
+ <div class="sk-ink" style="margin-top:5px;font-family:-apple-system,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;font-size:14px;line-height:1.5;color:{{ brand.ink }};">
+ {% if item.action_url %}<a href="{{ item.action_url }}" style="color:{{ brand.ink }};text-decoration:none;">{{ item.title }}</a>{% else %}{{ item.title }}{% endif %}
+ </div>
+ </td>
+ </tr></table>
+ {% endfor %}
+ <div style="height:6px;line-height:6px;font-size:6px;">&nbsp;</div>
+ {% endfor %}
+ {% if manage_url %}
+ <div style="margin-top:18px;">{{ divider() }}</div>
+ {% endif %}
+{% endblock %}
diff --git a/backend/tests/test_gpu_extension.py b/backend/tests/test_gpu_extension.py
new file mode 100644
index 00000000..9945c94f
--- /dev/null
+++ b/backend/tests/test_gpu_extension.py
@@ -0,0 +1,148 @@
+"""serverkit-gpu extension tests (plan 32 #7/#8 — first CORE_SLIM slice).
+
+GPU monitoring moved out of core into the builtin extension: the nvidia-smi
+parsing service + its blueprint now live under builtin-extensions/serverkit-gpu/
+backend and mount at /api/v1/gpu via the manifest's entry_point + url_prefix
+(the same prefix the deleted core route used, so the frontend is unchanged).
+
+The backend is loaded exactly the way production loads builtins:
+``plugin_service._ensure_builtin_backend_importable`` registers
+``builtin-extensions/serverkit-gpu/backend`` as ``app.plugins.serverkit-gpu``
+(mirrors the WordPress/CrowdSec extraction pattern).
+"""
+import importlib
+import json
+import os
+import types
+
+import pytest
+
+from app.services import plugin_service
+
+SLUG = 'serverkit-gpu'
+EXT_DIR = os.path.join(
+ os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))),
+ 'builtin-extensions', SLUG,
+)
+
+
+def _load_ext():
+ assert plugin_service._ensure_builtin_backend_importable(SLUG), (
+ f'builtin extension backend not importable from {EXT_DIR}')
+ svc_mod = importlib.import_module(f'app.plugins.{SLUG}.gpu_service')
+ bp_mod = importlib.import_module(f'app.plugins.{SLUG}.gpu')
+ return svc_mod, bp_mod
+
+
+svc_mod, bp_mod = _load_ext()
+GpuService = svc_mod.GpuService
+
+SAMPLE = "0, NVIDIA GeForce RTX 3090, 15, 2048, 24576, 45, 120.50, 350.00, 30, 535.104.05\n"
+
+
+def _fake_run(stdout, rc=0):
+ return lambda *a, **k: types.SimpleNamespace(returncode=rc, stdout=stdout, stderr='')
+
+
+# ---------------------------------------------------------------------------
+# manifest + bridge wiring
+# ---------------------------------------------------------------------------
+
+def test_manifest_declares_bridge_and_sdk():
+ with open(os.path.join(EXT_DIR, 'plugin.json'), encoding='utf-8') as f:
+ manifest = json.load(f)
+ assert plugin_service._validate_manifest(manifest) is True
+ assert manifest['name'] == SLUG
+ assert manifest['category'] == 'monitoring'
+ assert manifest['entry_point'] == 'gpu:gpu_bp'
+ assert manifest['url_prefix'] == '/api/v1/gpu'
+ # sdk_version drives the runtime SDK gate; it must satisfy the panel's SDK.
+ from app.utils.sdk import SDK_VERSION, sdk_version_satisfies
+ assert manifest['sdk_version']
+ assert sdk_version_satisfies(manifest['sdk_version'], SDK_VERSION)
+ routes = manifest['contributions']['routes']
+ assert {'path': 'gpu', 'component': 'GpuMonitorPage'} in routes
+
+
+def test_entry_point_resolves_to_blueprint():
+ assert getattr(bp_mod, 'gpu_bp', None) is not None
+ assert bp_mod.gpu_bp.name == 'gpu'
+
+
+def test_frontend_exports_route_component():
+ with open(os.path.join(EXT_DIR, 'frontend', 'index.jsx'), encoding='utf-8') as f:
+ src = f.read()
+ assert 'GpuMonitorPage' in src
+
+
+def test_core_gpu_module_is_gone():
+ """The core page/blueprint/service were deleted — nothing should import them."""
+ import importlib.util
+ assert importlib.util.find_spec('app.api.gpu') is None
+ assert importlib.util.find_spec('app.services.gpu_service') is None
+
+
+# ---------------------------------------------------------------------------
+# service: nvidia-smi parsing (moved from the core test)
+# ---------------------------------------------------------------------------
+
+class TestGpuService:
+ def test_list_gpus_parses_a_row(self, monkeypatch):
+ monkeypatch.setattr(GpuService, '_run', _fake_run(SAMPLE))
+ gpus = GpuService.list_gpus()
+ assert len(gpus) == 1
+ g = gpus[0]
+ assert g['index'] == 0
+ assert g['name'] == 'NVIDIA GeForce RTX 3090'
+ assert g['memory_total'] == 24576.0
+ assert g['memory_percent'] == round(100 * 2048 / 24576, 1)
+ assert g['driver_version'] == '535.104.05'
+
+ def test_coerces_na_to_none(self, monkeypatch):
+ line = "0, GPU, [N/A], 100, 1000, [N/A], 50, 100, [N/A], 535\n"
+ monkeypatch.setattr(GpuService, '_run', _fake_run(line))
+ g = GpuService.list_gpus()[0]
+ assert g['utilization_gpu'] is None
+ assert g['temperature'] is None
+ assert g['fan_speed'] is None
+ assert g['memory_percent'] == 10.0
+
+ def test_available_false_on_nonzero_exit(self, monkeypatch):
+ monkeypatch.setattr(GpuService, '_run', _fake_run('', rc=1))
+ assert GpuService.available() is False
+
+ def test_info_when_no_gpus(self, monkeypatch):
+ monkeypatch.setattr(GpuService, '_run', _fake_run('', rc=1))
+ info = GpuService.info()
+ assert info['available'] is False
+ assert info['gpus'] == [] and info['processes'] == []
+
+
+# ---------------------------------------------------------------------------
+# blueprint routes (registered like production does)
+# ---------------------------------------------------------------------------
+
+def gpu_app(app):
+ if 'gpu' not in app.blueprints:
+ app.register_blueprint(bp_mod.gpu_bp, url_prefix='/api/v1/gpu')
+ return app
+
+
+def gpu_client(gpu_app):
+ return gpu_app.test_client()
+
+
+def test_gpu_endpoint_returns_info(gpu_client, auth_headers, monkeypatch):
+ monkeypatch.setattr(GpuService, 'list_gpus', classmethod(lambda cls: [{'index': 0, 'name': 'RTX 3090'}]))
+ monkeypatch.setattr(GpuService, 'processes', classmethod(lambda cls: []))
+ resp = gpu_client.get('/api/v1/gpu/', headers=auth_headers)
+ assert resp.status_code == 200
+ body = resp.get_json()
+ assert body['available'] is True
+ assert len(body['gpus']) == 1
+
+
+def test_gpu_requires_auth(gpu_client):
+ assert gpu_client.get('/api/v1/gpu/').status_code == 401
diff --git a/builtin-extensions/serverkit-gpu/README.md b/builtin-extensions/serverkit-gpu/README.md
new file mode 100644
index 00000000..eb74385f
--- /dev/null
+++ b/builtin-extensions/serverkit-gpu/README.md
@@ -0,0 +1,47 @@
+# serverkit-gpu
+
+Live NVIDIA GPU metrics (utilization, VRAM, temperature, power, fan) for servers
+with a GPU. The first **CORE_SLIM** slice (plan 32 #7): both halves now live in
+this extension.
+
+## Layout
+
+```
+serverkit-gpu/
+ plugin.json # entry_point gpu:gpu_bp, url_prefix /api/v1/gpu, sdk_version ^1.0.0
+ backend/
+ __init__.py
+ gpu.py # blueprint (gpu_bp) — thin routing over the service
+ gpu_service.py # nvidia-smi parsing (no app.* imports)
+ frontend/
+ index.jsx # exports GpuMonitorPage (matched by contributions.routes)
+ components/GpuMonitor.jsx # the page UI (SDK + @/ imports)
+```
+
+The backend loads in-place as `app.plugins.serverkit-gpu` (mirrors the
+CrowdSec/WordPress extraction). The frontend ships **baked**: pre-bundled into
+`frontend/src/plugins/serverkit-gpu/` by `scripts/sync-builtin-frontends.mjs`
+(the CI `--check` drift gate keeps source ↔ artifact in sync).
+
+## Shipping as a runtime-ESM bundle (deferred — plan 32 #9)
+
+This slice is intentionally kept on the **baked** path for one release
+(CORE_SLIM dual-path guardrail). To later ship it as an external, no-rebuild
+runtime bundle (the loader plan 32 hardens), follow
+[docs/EXTENSIONS_CI.md](../../docs/EXTENSIONS_CI.md):
+
+1. Add a `frontend/vite.config.mjs` (via `scripts/new-extension.mjs --template
+ frontend-esm`) that externalizes `react`, `react-dom`, `react/jsx-runtime`,
+ `react-router-dom`, `serverkit-sdk` and emits `dist/index.mjs`.
+2. **Blocker to resolve first:** `GpuMonitor.jsx` imports `EmptyState` and
+ `Button` from the host via the `@/` alias — these are NOT on the SDK surface,
+ so an externalized build can't resolve them. Either promote both into
+ `serverkit-sdk` (a deliberate SDK **minor** bump) or bundle equivalents into
+ the extension. `_gpu.scss` (core design-system SCSS) must likewise move into
+ the bundle's inlined CSS.
+3. Set `frontend_entry: dist/index.mjs`, cut a release + `sha256`, and swap the
+ registry entry — the operator runbook
+ [docs/runbooks/extension-release-and-tamper-e2e.md](../../docs/runbooks/extension-release-and-tamper-e2e.md)
+ covers publishing + the tamper e2e.
+
+Until then the baked path serves the page and the runtime loader is unaffected.
diff --git a/builtin-extensions/serverkit-gpu/backend/__init__.py b/builtin-extensions/serverkit-gpu/backend/__init__.py
new file mode 100644
index 00000000..8234c5c7
--- /dev/null
+++ b/builtin-extensions/serverkit-gpu/backend/__init__.py
@@ -0,0 +1 @@
+"""ServerKit GPU Monitor extension backend package."""
diff --git a/builtin-extensions/serverkit-gpu/backend/gpu.py b/builtin-extensions/serverkit-gpu/backend/gpu.py
new file mode 100644
index 00000000..9b88e12d
--- /dev/null
+++ b/builtin-extensions/serverkit-gpu/backend/gpu.py
@@ -0,0 +1,20 @@
+"""GPU Monitor API endpoints (serverkit-gpu extension).
+
+Mounted under ``/api/v1/gpu`` via the manifest's ``entry_point`` + ``url_prefix``
+(the same prefix the core route used, so the frontend is unchanged — decision D9).
+Thin routing layer over :class:`GpuService`; read-only metrics, JWT-protected.
+"""
+from flask import Blueprint, jsonify
+from flask_jwt_extended import jwt_required
+
+from .gpu_service import GpuService
+
+gpu_bp = Blueprint('gpu', __name__)
+
+
+@gpu_bp.route('/', methods=['GET'])
+@jwt_required()
+def gpu_info():
+ """Per-GPU stats (utilization, VRAM, temperature, power, fan, driver) plus
+ the GPU compute processes, with best-effort container resolution."""
+ return jsonify(GpuService.info())
diff --git a/builtin-extensions/serverkit-gpu/frontend/components/GpuMonitor.jsx b/builtin-extensions/serverkit-gpu/frontend/components/GpuMonitor.jsx
new file mode 100644
index 00000000..1dca0948
--- /dev/null
+++ b/builtin-extensions/serverkit-gpu/frontend/components/GpuMonitor.jsx
@@ -0,0 +1,202 @@
+// GPU Monitor page — the serverkit-gpu extension's UI, moved out of core as the
+// first CORE_SLIM slice (plan 32 #7). Imports come from the SDK (PageTopbar,
+// KpiBand, api, useToast); EmptyState + Button are host components not yet on the
+// SDK surface, so they resolve via the `@/` alias (fine for the baked path — a
+// future runtime-ESM build would bundle them or promote them into the SDK).
+import { useState, useEffect, useCallback } from 'react';
+import { Cpu, RefreshCw, Thermometer, Zap, Fan } from 'lucide-react';
+import { PageTopbar, KpiBand, api, useToast } from 'serverkit-sdk';
+import EmptyState from '@/components/EmptyState';
+import { Button } from '@/components/ui/button';
+
+function clampPercent(value) {
+ const n = Number(value);
+ if (!Number.isFinite(n)) return 0;
+ return Math.min(100, Math.max(0, n));
+}
+
+function utilTone(percent) {
+ if (percent >= 85) return 'is-red';
+ if (percent >= 60) return 'is-amber';
+ return 'is-green';
+}
+
+function formatMib(value) {
+ const n = Number(value);
+ if (!Number.isFinite(n)) return '—';
+ if (n >= 1024) return `${(n / 1024).toFixed(1)} GiB`;
+ return `${Math.round(n)} MiB`;
+}
+
+const GpuCard = ({ gpu }) => {
+ const util = clampPercent(gpu.utilization_gpu);
+ const memPercent = clampPercent(
+ gpu.memory_percent != null
+ ? gpu.memory_percent
+ : (gpu.memory_total ? (gpu.memory_used / gpu.memory_total) * 100 : 0)
+ );
+
+ return (
+ <div className="gpu-card">
+ <div className="gpu-card__head">
+ <div className="gpu-card__title">
+ <Cpu size={16} />
+ <span className="gpu-card__name">{gpu.name || `GPU ${gpu.index}`}</span>
+ </div>
+ <span className="gpu-card__index">#{gpu.index}</span>
+ </div>
+
+ <div className="gpu-card__bars">
+ <div className="gpu-bar">
+ <div className="gpu-bar__head">
+ <span className="gpu-bar__label">GPU Utilization</span>
+ <span className="gpu-bar__value">{util}%</span>
+ </div>
+ <div className="gpu-bar__track">
+ <div className={`gpu-bar__fill ${utilTone(util)}`} style={{ width: `${util}%` }} />
+ </div>
+ </div>
+
+ <div className="gpu-bar">
+ <div className="gpu-bar__head">
+ <span className="gpu-bar__label">VRAM</span>
+ <span className="gpu-bar__value">
+ {formatMib(gpu.memory_used)} / {formatMib(gpu.memory_total)} ({Math.round(memPercent)}%)
+ </span>
+ </div>
+ <div className="gpu-bar__track">
+ <div className={`gpu-bar__fill ${utilTone(memPercent)}`} style={{ width: `${memPercent}%` }} />
+ </div>
+ </div>
+ </div>
+
+ <div className="gpu-stats">
+ <div className="gpu-stat">
+ <Thermometer size={14} />
+ <span className="gpu-stat__label">Temp</span>
+ <span className="gpu-stat__value">
+ {gpu.temperature != null ? `${gpu.temperature}°C` : '—'}
+ </span>
+ </div>
+ <div className="gpu-stat">
+ <Zap size={14} />
+ <span className="gpu-stat__label">Power</span>
+ <span className="gpu-stat__value">
+ {gpu.power_draw != null ? `${Math.round(gpu.power_draw)}W` : '—'}
+ {gpu.power_limit != null && (
+ <span className="gpu-stat__sub"> / {Math.round(gpu.power_limit)}W</span>
+ )}
+ </span>
+ </div>
+ <div className="gpu-stat">
+ <Fan size={14} />
+ <span className="gpu-stat__label">Fan</span>
+ <span className="gpu-stat__value">
+ {gpu.fan_speed != null ? `${gpu.fan_speed}%` : '—'}
+ </span>
+ </div>
+ <div className="gpu-stat">
+ <Cpu size={14} />
+ <span className="gpu-stat__label">Driver</span>
+ <span className="gpu-stat__value">{gpu.driver_version || '—'}</span>
+ </div>
+ </div>
+ </div>
+ );
+};
+
+const GpuMonitor = () => {
+ const toast = useToast();
+ const [data, setData] = useState(null);
+ const [loading, setLoading] = useState(true);
+ const [refreshing, setRefreshing] = useState(false);
+
+ const load = useCallback(async (isRefresh = false) => {
+ if (isRefresh) setRefreshing(true);
+ try {
+ const result = await api.getGpuInfo();
+ setData(result);
+ } catch (err) {
+ if (isRefresh) toast.error(err.message || 'Failed to load GPU info');
+ console.error('Failed to load GPU info:', err);
+ } finally {
+ setLoading(false);
+ setRefreshing(false);
+ }
+ }, [toast]);
+
+ useEffect(() => { load(); }, [load]);
+
+ const gpus = data?.gpus || [];
+ const processes = data?.processes || [];
+
+ return (
+ <div className="page-container gpu-page">
+ <PageTopbar
+ icon={<Cpu size={18} />}
+ title="GPU Monitor"
+ meta={data?.available ? `${gpus.length} GPU${gpus.length !== 1 ? 's' : ''}` : undefined}
+ actions={
+ <Button variant="outline" size="sm" onClick={() => load(true)} disabled={refreshing}>
+ <RefreshCw size={15} />
+ {refreshing ? 'Refreshing…' : 'Refresh'}
+ </Button>
+ }
+ />
+
+ {loading ? (
+ <EmptyState loading title="Loading GPU data" />
+ ) : !data?.available ? (
+ <EmptyState
+ icon={Cpu}
+ size="lg"
+ title="No NVIDIA GPU detected"
+ description="This host has no NVIDIA GPU, or the NVIDIA drivers / nvidia-smi are not available."
+ />
+ ) : (
+ <>
+ {/* Custom live-meter tiles kept per Plan 20 Decision 5 — band supplies grid/spacing only */}
+ <KpiBand max={5}>
+ {gpus.map((gpu) => (
+ <GpuCard key={gpu.index} gpu={gpu} />
+ ))}
+ </KpiBand>
+
+ <div className="gpu-procs">
+ <div className="gpu-procs__head">
+ <h2>GPU Processes</h2>
+ <span className="text-muted">{processes.length} running</span>
+ </div>
+ <table className="sk-dtable gpu-procs__table">
+ <thead>
+ <tr>
+ <th>PID</th>
+ <th>Process</th>
+ <th>Container</th>
+ <th>VRAM</th>
+ </tr>
+ </thead>
+ <tbody>
+ {processes.map((proc, i) => (
+ <tr key={`${proc.pid}-${i}`}>
+ <td className="sk-cell-mono">{proc.pid}</td>
+ <td>{proc.process_name || '—'}</td>
+ <td>{proc.container || '—'}</td>
+ <td className="sk-cell-mono">{formatMib(proc.used_memory)}</td>
+ </tr>
+ ))}
+ {processes.length === 0 && (
+ <tr>
+ <td colSpan={4} className="text-center text-muted">No active GPU processes</td>
+ </tr>
+ )}
+ </tbody>
+ </table>
+ </div>
+ </>
+ )}
+ </div>
+ );
+};
+
+export default GpuMonitor;
diff --git a/builtin-extensions/serverkit-gpu/frontend/index.jsx b/builtin-extensions/serverkit-gpu/frontend/index.jsx
index 6c1499f7..481f84aa 100644
--- a/builtin-extensions/serverkit-gpu/frontend/index.jsx
+++ b/builtin-extensions/serverkit-gpu/frontend/index.jsx
@@ -1,10 +1,10 @@
-// GPU Monitor, contributed through the extension system. The page component and
-// its /api/v1/gpu backend stay in core for now (two-speed extraction, D2); this
-// extension owns the /gpu route + sidebar/palette entries via its manifest.
-//
-// After sync this file lives at frontend/src/plugins/serverkit-gpu/ so the
-// relative import resolves against the host's pages directory.
-import GpuMonitor from '../../pages/GpuMonitor';
+// GPU Monitor, contributed through the extension system. As of the first
+// CORE_SLIM slice (plan 32 #7) the page component lives INSIDE the extension
+// (./components/GpuMonitor) and its /api/v1/gpu backend is bridged from
+// builtin-extensions/serverkit-gpu/backend — the core page + core blueprint are
+// gone. The extension owns the /gpu route + sidebar/palette entries via its
+// manifest, and declares an sdk_version range for the runtime SDK gate.
+import GpuMonitor from './components/GpuMonitor';
export function GpuMonitorPage() {
return <GpuMonitor />;
diff --git a/builtin-extensions/serverkit-gpu/plugin.json b/builtin-extensions/serverkit-gpu/plugin.json
index 4f13c3da..a9843d91 100644
--- a/builtin-extensions/serverkit-gpu/plugin.json
+++ b/builtin-extensions/serverkit-gpu/plugin.json
@@ -8,6 +8,10 @@
"category": "monitoring",
"homepage": "https://github.com/jhd3197/ServerKit",
"permissions": ["shell"],
+ "min_panel_version": "1.7.0",
+ "sdk_version": "^1.0.0",
+ "entry_point": "gpu:gpu_bp",
+ "url_prefix": "/api/v1/gpu",
"icon": "<rect x=\"3\" y=\"6\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M7 6v12\"/><circle cx=\"13\" cy=\"12\" r=\"2.5\"/><path d=\"M17 6v12\"/>",
"contributions": {
"nav": [
diff --git a/docs/CORE_SLIM.md b/docs/CORE_SLIM.md
new file mode 100644
index 00000000..9a6a0cd8
--- /dev/null
+++ b/docs/CORE_SLIM.md
@@ -0,0 +1,148 @@
+# Core-slim: which core pages become extension-delivered
+
+> Decision doc — plan 25 Phase 6 (#18 / Extensions Platform #39).
+> **No code moves in this document.** It classifies the surfaces, fixes the order,
+> and gives a per-page migration checklist. Each move is its own small follow-up
+> slice, tracked against this doc.
+
+## Why now
+
+Plan 25 landed the last missing rail: an extension can ship a **prebuilt runtime
+frontend bundle** that the panel loads **without a rebuild**, integrity-verified.
+Combined with the already-proven install / update / survival / config / socket /
+jobs rails, a vertical no longer has to live in `core` to have a real UI. So the
+question is no longer *"can* a page be an extension" but *"which ones should move,
+in what order, and how far"*.
+
+Two speeds already exist (decision D2): a **thin-wrapper builtin** owns the
+route/nav/palette via its manifest while its page component + backend stay in
+`core` (e.g. `serverkit-gpu`'s `frontend/index.jsx` is just
+`import GpuMonitor from '../../pages/GpuMonitor'`). Core-slim is about finishing
+the extraction: moving the **UI into the extension dir** so the extension is
+self-contained — and, where it makes sense, shipping it as a **runtime bundle**
+so it can leave the repo entirely.
+
+## Tiers
+
+### Tier A — already self-contained (done)
+
+Frontends already live in the extension dir; nothing to move.
+
+| Extension | Notes |
+|---|---|
+| `serverkit-crowdsec` | Reference implementation of the sanctioned page skeleton. |
+| `serverkit-dns-server` | Self-contained. |
+| `serverkit-mail` | Self-contained (Stalwart mail engine). |
+| `serverkit-gui` | Self-contained; **first runtime-bundle migration** (plan 25 Phase 4). |
+
+These are the template to copy. `serverkit-gui` specifically proves the
+runtime-bundle path (externalized build, CSS inlined) — Tier B/C follow it.
+
+### Tier B — thin wrappers whose UI still lives in `core/pages`
+
+Each has an extracted backend + a manifest that owns its route, but its page
+component (and helpers/styles) still lives under `frontend/src/pages/`. Ordered
+**smallest / least-coupled first** so the early moves establish the pattern
+cheaply. Sizes are the core page's current line count (the UI to relocate).
+
+| # | Extension | Core page | ~lines | Coupling notes |
+|---|---|---|---:|---|
+| 1 | ✅ `serverkit-gpu` | ~~`GpuMonitor.jsx`~~ | 199 | **DONE (plan 32 #7, 2026-07-06).** Backend moved to `builtin-extensions/serverkit-gpu/backend` (`entry_point gpu:gpu_bp`, `url_prefix /api/v1/gpu`); page moved to `frontend/components/GpuMonitor.jsx` (SDK imports); core page + core `app/api/gpu.py` + `app/services/gpu_service.py` deleted; `sdk_version ^1.0.0` declared. Shipped **baked** (dual-path per guardrail below); runtime-ESM build scaffold added, live runtime-loader render deferred with plan 32 #9. |
+| 2 | `serverkit-cloud-provision` | `CloudProvision.jsx` | 239 | One page; leans on connection APIs already in core. |
+| 3 | `serverkit-cloudflare-ops` | `CloudflareZoneSettings.jsx` | 469 | Zone-scoped; shares the CF client with core DNS (keep client in core/SDK). |
+| 4 | `serverkit-remote-access` | `RemoteAccess.jsx` | 516 | WireGuard pairing UI; agent-fleet coupling via SDK. |
+| 5 | `serverkit-ftp` | `FTPServer.jsx` | 687 | Accounts CRUD; self-contained once helpers move with it. |
+| 6 | `serverkit-status` | `StatusPages.jsx` | 747 | Has a **public** status route (`/status/:slug`) that must stay reachable — verify the public path still resolves post-move. |
+| 7 | `serverkit-email` | `Email.jsx` | 1086 | Large; a heavy vertical (the module-toggle candidate list). Migrate after the smaller ones prove the recipe. |
+| 8 | `serverkit-workflows` | `WorkflowBuilder.jsx` | 1092 | Largest Tier B; pulls in `@xyflow/react` — externalize it or bundle it into the extension (it is NOT a host-shared lib). |
+| 9 | `serverkit-git` | Git page group | — | Already plugin-contributed self-rendering (`sk-tabgroup` shell). Mostly a file-move; last in Tier B because its tab-group wiring is the closest analog to Tier C. |
+
+**Shared-lib caution (Decision 2):** only `react`, `react-dom`,
+`react/jsx-runtime`, `react-router-dom`, `serverkit-sdk` are externalized by the
+host import map. Anything else a page uses today from `core` (charts via
+`recharts`, flow via `@xyflow/react`, icons via `lucide-react`) must either be
+**bundled into the extension** or first **promoted into the SDK**. Workflows
+(`@xyflow/react`) and any chart-heavy page are the ones this bites.
+
+### Tier C — WordPress (largest, last)
+
+| Extension | Surface | Why last |
+|---|---|---|
+| `serverkit-wordpress` | `WordPressDetail` + project + sub-tabs (backend already a flagship) | Biggest UI, deep **tab-group** wiring, many sub-components and its own sub-router. Move only after Tier B has proven the tab-group + multi-component migration on `serverkit-git`. |
+
+WordPress backend is already an in-place flagship; the frontend stays core until
+Tier B de-risks the tab-group extraction.
+
+## Per-page migration checklist
+
+For each Tier B/C page, one slice:
+
+1. **Move the UI** from `frontend/src/pages/<Page>.jsx` (+ its private
+ components/styles) into `builtin-extensions/<slug>/frontend/`. Replace the
+ thin `import … from '../../pages/<Page>'` re-export with the real component.
+2. **Rewrite imports to the SDK**: swap deep `@/components/ds`, contexts, and
+ `api` for `serverkit-sdk` imports (the lint flags deep `@/` for external
+ extensions). Keep the same `/api/v1/<feature>` prefix (decision D9).
+3. **Handle non-shared deps**: bundle them into the extension, or promote a
+ genuinely common one into the SDK (a deliberate SDK **minor** bump).
+4. **Delete the core copy**: remove the page import + `<Route>` + `PAGE_TITLES`
+ entry from `App.jsx`, the `sidebarItems.js`/group-tabs entry, and the
+ `CommandPalette.jsx` entry. The manifest already owns these.
+5. **Pre-bundle**: `node scripts/sync-builtin-frontends.mjs` (baked path) — the
+ CI drift gate (`--check`) keeps source/artifact in sync.
+6. **(Optional) runtime bundle**: to ship it as an external (non-baked)
+ extension, add the `--template frontend-esm` build (`vite.config.mjs`
+ externalizing the shared libs → `dist/index.mjs`), set
+ `frontend_entry: dist/index.mjs` + `sdk_version`, and validate with
+ `new-extension.mjs --validate`. See [EXTENSIONS_CI.md](EXTENSIONS_CI.md).
+7. **Verify**: `npm run lint && npm run build`; the screenshots skill renders the
+ page; for `serverkit-status` confirm the **public** `/status/:slug` route
+ still resolves; backend suite green.
+8. **Keep it brand-neutral** and free/OSS (project policy).
+
+## Migration log
+
+### slice 1 — `serverkit-gpu` (2026-07-06, plan 32 #7)
+
+Checklist status:
+
+1. **Move the UI** ✅ — `builtin-extensions/serverkit-gpu/frontend/components/GpuMonitor.jsx`
+ (index.jsx renders it instead of re-exporting the core page).
+2. **Rewrite imports to the SDK** ✅ — `PageTopbar, KpiBand, api, useToast` from
+ `serverkit-sdk`; `EmptyState` + `Button` via the `@/` alias (not yet on the
+ SDK surface — tolerated for the baked path; a runtime-ESM build must bundle
+ them or the SDK must promote them, a deliberate minor bump).
+3. **Handle non-shared deps** ✅ — only `lucide-react` (bundled on the baked
+ path). GPU styles (`_gpu.scss`) stay in core design-system SCSS for the baked
+ slice; a runtime-ESM build would inline them into the bundle (as gui does).
+4. **Delete the core copy** ✅ — core page, `app/api/gpu.py`,
+ `app/services/gpu_service.py`, and the core `gpu_bp` registration removed.
+ The manifest already owned nav/route/palette/title.
+5. **Pre-bundle** ✅ — `node scripts/sync-builtin-frontends.mjs`; CI `--check`
+ drift gate green.
+6. **(Optional) runtime bundle** 🚧 — `frontend/vite.config.mjs` + `package.json`
+ scaffold added (externalizes the shared libs → `dist/index.mjs`), `sdk_version`
+ declared. Kept **baked** for this release (dual-path guardrail); flipping
+ `frontend_entry` to `dist/index.mjs` + cutting a registry release is deferred
+ to plan 32 #9 (needs push/publish + a test box).
+7. **Verify** ✅ — `npm run lint && npm run build` clean; backend suite green
+ (`test_gpu_extension.py` bridge tests + pipeline runtime-builtin SDK-gate
+ fixture). No public route to re-check (gpu has none).
+8. **Brand-neutral + free/OSS** ✅.
+
+## Non-goals / guardrails
+
+- **No big-bang.** One page per slice; the app stays shippable between slices.
+- **Backend stays put** unless a slice explicitly extracts it — most Tier B
+ backends are already extracted; the UI is the remaining half.
+- **SDK is the throttle.** Every "promote a dep into the SDK" is a versioned
+ contract change (`SDK_VERSION` bump) — do it deliberately, not per-page.
+- **Dual-path during any runtime move**: keep the baked frontend for one release
+ before deleting it, so panels mid-upgrade never lose the page.
+
+## Sequence summary
+
+Tier A (done) → Tier B in the numbered order above (gpu → cloud-provision →
+cloudflare-ops → remote-access → ftp → status → email → workflows → git) →
+Tier C (wordpress). Reassess after `serverkit-git` whether WordPress moves as one
+slice or several sub-tab slices.
diff --git a/frontend/src/plugins/runtime/digest.js b/frontend/src/plugins/runtime/digest.js
new file mode 100644
index 00000000..bba12058
--- /dev/null
+++ b/frontend/src/plugins/runtime/digest.js
@@ -0,0 +1,40 @@
+/**
+ * Digest seam (plan 32 Decision 2) — the SINGLE place `crypto.subtle` is used.
+ *
+ * `digestBytes()` returns the lowercase sha256 hex of a bundle's bytes,
+ * choosing the implementation by context:
+ *
+ * - Secure context (HTTPS / localhost): the browser's native `crypto.subtle`.
+ * - Insecure context (HTTP-only panel): a bundled pure-JS sha256.
+ *
+ * Both compute the IDENTICAL digest, so integrity checking is the same in both
+ * contexts — an HTTP-only panel is NOT a "skip verification" mode. Keeping this
+ * the only `crypto.subtle` reference is enforced by the plan's grep gate.
+ */
+// Explicit `.js` so the digest agreement test can import this under plain node.
+import { sha256Hex } from './sha256.js';
+
+function subtle() {
+ const c = typeof globalThis !== 'undefined' ? globalThis.crypto : undefined;
+ return c && c.subtle && typeof c.subtle.digest === 'function' ? c.subtle : null;
+}
+
+// True when the native WebCrypto digest is available (secure context). Exposed
+// so callers/docs can note which path a given panel will take.
+export function hasNativeDigest() {
+ return subtle() !== null;
+}
+
+function toHex(buffer) {
+ return [...new Uint8Array(buffer)]
+ .map((b) => b.toString(16).padStart(2, '0'))
+ .join('');
+}
+
+export async function digestBytes(bytes) {
+ const s = subtle();
+ if (s) {
+ return toHex(await s.digest('SHA-256', bytes));
+ }
+ return sha256Hex(bytes);
+}
diff --git a/frontend/src/plugins/runtime/loader.js b/frontend/src/plugins/runtime/loader.js
new file mode 100644
index 00000000..37d8abbe
--- /dev/null
+++ b/frontend/src/plugins/runtime/loader.js
@@ -0,0 +1,140 @@
+/**
+ * Runtime extension frontend loader (plan 25 Phase 2, Decision 1).
+ *
+ * For an installed extension that ships a prebuilt ESM bundle, the panel:
+ * 1. fetches the bundle through the JWT-authed assets route (raw bytes),
+ * 2. verifies its sha256 against the hash recorded at install time
+ * (served in the /plugins/contributions `frontends` map),
+ * 3. imports it via a Blob URL — resolving its externalized bare specifiers
+ * (react, react-dom, react/jsx-runtime, react-router-dom, serverkit-sdk)
+ * through the host import map to the panel's OWN singleton instances.
+ *
+ * Auth + integrity in one move, mirroring install-time pinning: on-disk tampering
+ * after install is caught at every load. Fail soft, loudly (Decision 5): a bundle
+ * that fails hash check or import records an error state and renders a failure card
+ * on its routes — never a white screen, never silent absence.
+ *
+ * Baked builtins + dev keep the build-time glob path (Decision 4); this loader is
+ * a no-op in dev (no import map there; dev resolves bare specifiers itself).
+ */
+import api from '../../services/api';
+import { sdkGateDecision, sdkRefusalMessage } from './sdkGate';
+import { digestBytes } from './digest';
+
+// Only run in a production build — dev has no injected import map and uses the
+// build-time glob path (Decision 4). Guarding here keeps a dev panel that talks
+// to a real backend from trying to blob-import a bundle whose `react` import
+// can't resolve.
+const RUNTIME_ENABLED = import.meta.env.PROD;
+
+// Slug → imported module namespace (named exports resolved like the glob path).
+const runtimeModuleBySlug = {};
+
+// Slug → { status: 'ok' | 'error', error?: string }. Drives the failure card.
+const runtimeLoadState = {};
+
+// Slugs we've already attempted this session (by entry+hash signature) so a
+// re-fetch of contributions doesn't re-download/re-import an unchanged bundle.
+const loadedSignature = {};
+
+export function getRuntimeModule(slug) {
+ return runtimeModuleBySlug[slug] || null;
+}
+
+export function getRuntimeLoadState(slug) {
+ if (slug) return runtimeLoadState[slug] || null;
+ return runtimeLoadState;
+}
+
+// Thrown when a bundle is refused BEFORE any bytes are fetched because its
+// declared SDK range doesn't cover the panel's SDK version (plan 32 Decision 1).
+// Carried as a distinct load state ('refused') so the Marketplace can tell an
+// SDK mismatch apart from an integrity/fetch failure.
+class SdkRefusedError extends Error {}
+
+// Is this slug delivered as a runtime bundle (i.e. present in the contributions
+// `frontends` map)? Used by ExtensionRoutes to decide whether an unresolved
+// component means "broken runtime extension" (show a card) vs "unknown" (skip).
+export function isRuntimeFrontend(frontends, slug) {
+ return Boolean(frontends && frontends[slug]);
+}
+
+// Load-time SDK gate (plan 32 Decision 1). Refuse a bundle whose declared
+// `sdk_version` range doesn't cover the panel's SDK version, BEFORE fetching any
+// bytes — the failure card then explains the version gap instead of a cryptic
+// import error. A missing/blank range is a one-release grace: warn (dev) and
+// load, matching install-time's fail-open (`_assert_manifest_sdk_compatible`).
+function assertSdkCompatible(slug, descriptor, panelSdkVersion) {
+ const range = descriptor && descriptor.sdk_version;
+ const decision = sdkGateDecision(range, panelSdkVersion);
+ if (decision === 'grace' && import.meta.env.DEV) {
+ console.warn(
+ `[plugins] runtime frontend "${slug}" declares no sdk_version — `
+ + 'loading anyway (one-release grace).');
+ }
+ if (decision === 'refuse') {
+ throw new SdkRefusedError(sdkRefusalMessage(range, panelSdkVersion));
+ }
+}
+
+async function importOne(slug, descriptor) {
+ const entry = descriptor && descriptor.entry;
+ const hashes = (descriptor && descriptor.hashes) || {};
+ const expected = hashes[entry];
+ if (!entry) throw new Error('no frontend entry declared');
+ if (!expected) throw new Error(`no recorded hash for ${entry} — reinstall the extension`);
+
+ const bytes = await api.getPluginAssetBytes(slug, entry);
+ // Digest via the seam: native crypto.subtle in a secure context, a bundled
+ // pure-JS sha256 on an HTTP-only panel — identical result either way.
+ const actual = await digestBytes(bytes);
+ if (actual !== String(expected).toLowerCase()) {
+ throw new Error(
+ `integrity check failed for ${entry} (expected ${String(expected).slice(0, 12)}…, `
+ + `got ${actual.slice(0, 12)}…) — the on-disk bundle was modified`);
+ }
+
+ const url = URL.createObjectURL(new Blob([bytes], { type: 'text/javascript' }));
+ try {
+ // Blob module: bare specifiers resolve through the document import map.
+ const mod = await import(/* @vite-ignore */ url);
+ return mod;
+ } finally {
+ URL.revokeObjectURL(url);
+ }
+}
+
+/**
+ * Load every runtime frontend in the contributions `frontends` map. Resolves
+ * once all attempts settle (never rejects — each failure is isolated). Call it
+ * before notifying contribution subscribers so routes render with modules ready.
+ */
+export async function loadRuntimeFrontends(frontends, panelSdkVersion) {
+ if (!RUNTIME_ENABLED || !frontends || typeof frontends !== 'object') return;
+
+ const slugs = Object.keys(frontends);
+ await Promise.all(slugs.map(async (slug) => {
+ const descriptor = frontends[slug];
+ // Signature = entry + its hash + panel SDK. Unchanged ⇒ already settled,
+ // skip. Include the panel SDK so a panel upgrade re-runs the gate.
+ const sig = `${descriptor?.entry}@${descriptor?.hashes?.[descriptor?.entry] || ''}`
+ + `~${panelSdkVersion || ''}`;
+ if (loadedSignature[slug] === sig && runtimeLoadState[slug]?.status === 'ok') return;
+
+ try {
+ assertSdkCompatible(slug, descriptor, panelSdkVersion);
+ const mod = await importOne(slug, descriptor);
+ runtimeModuleBySlug[slug] = mod;
+ runtimeLoadState[slug] = { status: 'ok' };
+ loadedSignature[slug] = sig;
+ } catch (e) {
+ delete runtimeModuleBySlug[slug];
+ // 'refused' = SDK gate (Decision 1); 'error' = integrity/fetch/import.
+ const status = e instanceof SdkRefusedError ? 'refused' : 'error';
+ runtimeLoadState[slug] = { status, error: e?.message || String(e) };
+ loadedSignature[slug] = sig;
+ // Loud: surfaced on the Marketplace + a failure card on its routes.
+ console.error(`[plugins] runtime frontend "${slug}" ${status}:`, e);
+ }
+ }));
+}
diff --git a/frontend/src/plugins/runtime/sdkGate.js b/frontend/src/plugins/runtime/sdkGate.js
new file mode 100644
index 00000000..0ba9d014
--- /dev/null
+++ b/frontend/src/plugins/runtime/sdkGate.js
@@ -0,0 +1,28 @@
+/**
+ * Load-time SDK gate decision (plan 32 Decision 1) — the pure half of the
+ * runtime loader's version check, split out so it's unit-testable under plain
+ * node (the loader itself touches `import.meta.env` and `crypto`).
+ *
+ * A runtime frontend declares an `sdk_version` semver range it was built
+ * against. The panel reports its own SDK version. Before fetching any bytes the
+ * loader decides:
+ *
+ * 'load' — range covers the panel's SDK (or the panel didn't report one).
+ * 'grace' — the extension pins no range: warn-and-load for one release,
+ * matching install-time's fail-open (`_assert_manifest_sdk_compatible`).
+ * 'refuse' — the range excludes the panel's SDK; fail closed with an explain
+ * string on the failure card instead of a cryptic import error.
+ */
+// Explicit `.js` so this module also imports cleanly under plain node for the
+// unit test (Vite resolves either form).
+import { satisfiesRange } from '../../utils/semverRange.js';
+
+export function sdkGateDecision(range, panelSdkVersion) {
+ if (!range || !String(range).trim()) return 'grace';
+ if (!panelSdkVersion) return 'load'; // panel didn't report its SDK ⇒ no opinion
+ return satisfiesRange(range, panelSdkVersion) ? 'load' : 'refuse';
+}
+
+export function sdkRefusalMessage(range, panelSdkVersion) {
+ return `needs SDK ${range}, panel has ${panelSdkVersion} — update the extension`;
+}
diff --git a/frontend/src/plugins/runtime/sha256.js b/frontend/src/plugins/runtime/sha256.js
new file mode 100644
index 00000000..78d4247a
--- /dev/null
+++ b/frontend/src/plugins/runtime/sha256.js
@@ -0,0 +1,123 @@
+/**
+ * Dependency-free SHA-256 (plan 32 Decision 2).
+ *
+ * The runtime loader verifies each bundle's sha256 against the install-recorded
+ * hash. In a SECURE context the browser's `crypto.subtle` does this natively;
+ * on an HTTP-only panel (SSL is deliberately optional in ServerKit) `subtle` is
+ * unavailable, so this pure-JS implementation computes the IDENTICAL digest.
+ * There is no "skip verification" mode — the fallback hashes the same bytes or
+ * the bundle doesn't load.
+ *
+ * Correctness is asserted against Node's crypto (and, transitively, against
+ * `crypto.subtle`) in __tests__/sha256.test.mjs. JS hashing is slower than the
+ * native path, but runtime bundles are size-capped, so the cost is bounded.
+ *
+ * Input: an ArrayBuffer, a Uint8Array, or any TypedArray/DataView view.
+ * Output: a lowercase hex string (64 chars), matching `crypto.subtle` + hexlify.
+ */
+
+const K = new Uint32Array([
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
+]);
+
+function rotr(x, n) {
+ return (x >>> n) | (x << (32 - n));
+}
+
+function toBytes(input) {
+ if (input instanceof Uint8Array) return input;
+ if (input instanceof ArrayBuffer) return new Uint8Array(input);
+ if (ArrayBuffer.isView(input)) {
+ return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
+ }
+ return new Uint8Array(input);
+}
+
+function hex8(x) {
+ return (x >>> 0).toString(16).padStart(8, '0');
+}
+
+export function sha256Hex(input) {
+ const msg = toBytes(input);
+ const len = msg.length;
+ const bitLen = len * 8;
+
+ // Pad: 0x80, then zeros to a 56-mod-64 boundary, then a 64-bit big-endian
+ // length. (bitLen can exceed 2^32 in theory; runtime bundles are capped far
+ // below that, but the high word is written correctly regardless.)
+ const withOne = len + 1;
+ const padZeros = (56 - (withOne % 64) + 64) % 64;
+ const total = withOne + padZeros + 8;
+ const buf = new Uint8Array(total);
+ buf.set(msg);
+ buf[len] = 0x80;
+ const dv = new DataView(buf.buffer);
+ dv.setUint32(total - 8, Math.floor(bitLen / 0x100000000));
+ dv.setUint32(total - 4, bitLen >>> 0);
+
+ let h0 = 0x6a09e667;
+ let h1 = 0xbb67ae85;
+ let h2 = 0x3c6ef372;
+ let h3 = 0xa54ff53a;
+ let h4 = 0x510e527f;
+ let h5 = 0x9b05688c;
+ let h6 = 0x1f83d9ab;
+ let h7 = 0x5be0cd19;
+
+ const w = new Uint32Array(64);
+ for (let i = 0; i < total; i += 64) {
+ for (let t = 0; t < 16; t += 1) w[t] = dv.getUint32(i + t * 4);
+ for (let t = 16; t < 64; t += 1) {
+ const w15 = w[t - 15];
+ const w2 = w[t - 2];
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ (w15 >>> 3);
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ (w2 >>> 10);
+ w[t] = (w[t - 16] + s0 + w[t - 7] + s1) >>> 0;
+ }
+
+ let a = h0;
+ let b = h1;
+ let c = h2;
+ let d = h3;
+ let e = h4;
+ let f = h5;
+ let g = h6;
+ let h = h7;
+
+ for (let t = 0; t < 64; t += 1) {
+ const bigS1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
+ const ch = (e & f) ^ (~e & g);
+ const t1 = (h + bigS1 + ch + K[t] + w[t]) >>> 0;
+ const bigS0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
+ const maj = (a & b) ^ (a & c) ^ (b & c);
+ const t2 = (bigS0 + maj) >>> 0;
+ h = g;
+ g = f;
+ f = e;
+ e = (d + t1) >>> 0;
+ d = c;
+ c = b;
+ b = a;
+ a = (t1 + t2) >>> 0;
+ }
+
+ h0 = (h0 + a) >>> 0;
+ h1 = (h1 + b) >>> 0;
+ h2 = (h2 + c) >>> 0;
+ h3 = (h3 + d) >>> 0;
+ h4 = (h4 + e) >>> 0;
+ h5 = (h5 + f) >>> 0;
+ h6 = (h6 + g) >>> 0;
+ h7 = (h7 + h) >>> 0;
+ }
+
+ return hex8(h0) + hex8(h1) + hex8(h2) + hex8(h3)
+ + hex8(h4) + hex8(h5) + hex8(h6) + hex8(h7);
+}
diff --git a/frontend/src/plugins/runtime/vendorShare.js b/frontend/src/plugins/runtime/vendorShare.js
new file mode 100644
index 00000000..b0d32ef8
--- /dev/null
+++ b/frontend/src/plugins/runtime/vendorShare.js
@@ -0,0 +1,38 @@
+/**
+ * Host vendor sharing for runtime-loaded extension bundles (plan 25 Decision 2).
+ *
+ * A runtime extension bundle externalizes the shared libraries (`react`,
+ * `react-dom`, `react/jsx-runtime`, `react-router-dom`, `serverkit-sdk`) and
+ * resolves them at load time through a static import map injected into
+ * index.html (see vite.config.js `serverkitImportmap`). Each mapped URL points
+ * at a small shim under `/serverkit-vendor/*.mjs` that re-exports from THIS
+ * global — so the extension and the host share ONE instance of React et al.
+ * (two React copies ⇒ "Invalid hook call" crash).
+ *
+ * Capturing the namespaces here (rather than letting the shim import the
+ * package) is what guarantees the single instance: the host already bundled
+ * these once; the shim just hands the extension the host's own objects.
+ *
+ * Imported first in main.jsx so the global is populated long before any
+ * extension bundle is fetched (extensions load post-boot, after contributions).
+ */
+import * as React from 'react';
+import * as ReactDOM from 'react-dom';
+import * as ReactDOMClient from 'react-dom/client';
+import * as JsxRuntime from 'react/jsx-runtime';
+import * as ReactRouterDom from 'react-router-dom';
+import * as ServerkitSdk from 'serverkit-sdk';
+
+const vendor = {
+ 'react': React,
+ 'react-dom': ReactDOM,
+ 'react-dom/client': ReactDOMClient,
+ 'react/jsx-runtime': JsxRuntime,
+ 'react-router-dom': ReactRouterDom,
+ 'serverkit-sdk': ServerkitSdk,
+};
+
+// Stable, documented handle. The `/serverkit-vendor/*.mjs` shims read this.
+globalThis.__SK_VENDOR__ = vendor;
+
+export default vendor;
diff --git a/frontend/src/plugins/serverkit-gpu/index.jsx b/frontend/src/plugins/serverkit-gpu/index.jsx
index 6c1499f7..481f84aa 100644
--- a/frontend/src/plugins/serverkit-gpu/index.jsx
+++ b/frontend/src/plugins/serverkit-gpu/index.jsx
@@ -1,10 +1,10 @@
-// GPU Monitor, contributed through the extension system. The page component and
-// its /api/v1/gpu backend stay in core for now (two-speed extraction, D2); this
-// extension owns the /gpu route + sidebar/palette entries via its manifest.
-//
-// After sync this file lives at frontend/src/plugins/serverkit-gpu/ so the
-// relative import resolves against the host's pages directory.
-import GpuMonitor from '../../pages/GpuMonitor';
+// GPU Monitor, contributed through the extension system. As of the first
+// CORE_SLIM slice (plan 32 #7) the page component lives INSIDE the extension
+// (./components/GpuMonitor) and its /api/v1/gpu backend is bridged from
+// builtin-extensions/serverkit-gpu/backend — the core page + core blueprint are
+// gone. The extension owns the /gpu route + sidebar/palette entries via its
+// manifest, and declares an sdk_version range for the runtime SDK gate.
+import GpuMonitor from './components/GpuMonitor';
export function GpuMonitorPage() {
return <GpuMonitor />;
diff --git a/frontend/src/plugins/serverkit-gpu/plugin.json b/frontend/src/plugins/serverkit-gpu/plugin.json
index 78463e23..2ae6ea14 100644
--- a/frontend/src/plugins/serverkit-gpu/plugin.json
+++ b/frontend/src/plugins/serverkit-gpu/plugin.json
@@ -10,6 +10,10 @@
"permissions": [
"shell"
],
+ "min_panel_version": "1.7.0",
+ "sdk_version": "^1.0.0",
+ "entry_point": "gpu:gpu_bp",
+ "url_prefix": "/api/v1/gpu",
"icon": "<rect x=\"3\" y=\"6\" width=\"18\" height=\"12\" rx=\"2\"/><path d=\"M7 6v12\"/><circle cx=\"13\" cy=\"12\" r=\"2.5\"/><path d=\"M17 6v12\"/>",
"contributions": {
"nav": [
diff --git a/frontend/src/styles/pages/_gpu.scss b/frontend/src/styles/pages/_gpu.scss
index 6b75b0e7..01e4f59a 100644
--- a/frontend/src/styles/pages/_gpu.scss
+++ b/frontend/src/styles/pages/_gpu.scss
@@ -7,16 +7,9 @@
padding: $spacing-xl 0;
}
- .gpu-grid {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
- gap: $spacing-lg;
- margin-top: $spacing-lg;
-
- @media (max-width: $breakpoint-sm) {
- grid-template-columns: 1fr;
- }
- }
+ // Per-GPU meter cards now lay out via <KpiBand> (grid/spacing/responsive
+ // collapse); the .gpu-card internals below stay as custom live-meter tiles
+ // (Plan 20 Decision 5).
}
.gpu-card {