// The console-hosted UI server (design §9, primary path). `servePluginUi` from the SDK owns the whole // plugin side — a loopback ephemeral port behind a per-boot secret, registration + lease renewal with // the host, and the console reverse-proxy contract — so we just hand it the built SPA directory and the // plugin-local API router. The operator signs into the console once; the "ROM Manager" nav entry // appears automatically. Zero human auth here. import { type PluginUiHandle, type Punktfunk, servePluginUi, } from "@punktfunk/host"; import { PLUGIN_NAME, UI_ICON, UI_TITLE } from "../const.js"; import type { Engine } from "../engine/index.js"; import { resolveUiDir } from "../paths.js"; import { makeRouter } from "./router.js"; /** Serve the UI through the console. The SPA dir resolves whether we run bundled or from source. */ export const serveConsoleUi = ( pf: Punktfunk, engine: Engine, opts?: { version?: string }, ): Promise => servePluginUi(pf, { id: PLUGIN_NAME, title: UI_TITLE, icon: UI_ICON, version: opts?.version, staticDir: resolveUiDir(import.meta.url), fetch: makeRouter(engine), });