A plugin's UI lives inside someone else's page. It is rendered in the chat surface, sometimes in a floating window, sometimes in an iframe, sometimes at 390 pixels wide on a phone. This page is the set of rules that keeps a plugin readable in all of those places, and the metadata conventions that keep discovery sane.
Where the UI is rendered
There are three placements and they behave differently.
Hub menu. A small floating window opened from the ... menu on the sessions hub. The window is roughly 900 pixels wide on a desktop and full-width on a phone. Your page is loaded in an iframe.
Session card menu. The same floating window, opened for one session, with id=<session> in the URL.
Chat floating window. The same component again, with the plugin mounted beside the chat transcript. Width is tighter; assume 640 pixels and design for it.
None of these placements pass a viewport you control. Do not use a fixed page width, and do not use position: fixed for anything that is part of your layout — the frame's own scroll is what moves.
The embed flag
When the page is loaded inside one of those frames, scorpiox-server or the proxy may append ?embed=1. Your page must treat that as "no chrome of your own":
- no site header, no site footer, no page-level navigation,
- no outer margin or shadow that assumes you are a card on a larger page,
- body background transparent or matching
#0d0d10-class surfaces so the frame does not show a seam.
The starter handles this with a single body.embed class. That is enough: the page is the same document, and only the outer padding and the title bar change.
The four layout rules
1. Never exceed the frame width. A single element wider than the viewport produces a horizontal scrollbar in a 360-pixel phone frame and looks broken. Use max-width on the wrapper, grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) for KPI grids, and word-break: break-word on anything that prints a path or a hash.
2. Do not assume dark. Draw from CSS custom properties you define yourself, and provide a light variant under html[data-theme=light] or a prefers-color-scheme media query. The bot UI lets the user pick a theme; a plugin that paints #fff text on a #fff background in light mode is unreadable.
Check the rule with arithmetic, not with taste: if your body background is a variable and your text colour is a variable, the contrast is your choice in two places, and both are visible in the source.
3. Every number gets a label. A KPI is a label above a value, small caps and a monospace face for the value. Bare numbers floating in a grid are not readable in a narrow frame.
4. Loading and failure are visible states. Start with the badge reading loading, set it to live when the first API call resolves, and to offline when it rejects. A plugin that silently shows dashes forever looks like a plugin that is broken, and the user has no way to tell those apart.
Response size
Keep the HTML under roughly 60 KB. A plugin page travels through the node API, then the bot web proxy, then into an iframe. At 120 KB with a large inline stylesheet, first paint on a phone is visibly late, and the frame shows a blank rectangle while it loads.
The starter page is about 9 KB with its CSS and script inline. A page with ten cards and a table is still under 30 KB. If you find yourself past 100 KB, the content probably belongs in a JSON action rendered client-side, not in the server's HTML.
Escaping
Every value that reaches HTML must be escaped: &, <, >, ", '. Every value that reaches JSON must be escaped: ", \, and control characters as \u00XX. These are two different functions and mixing them up is the most common source of a plugin that renders correctly until someone's hostname contains an ampersand.
The starter has both: a json_str() for output and the HTML page emits only static markup. If your plugin interpolates data into HTML, add the escape before you add the feature.
Short metadata
Discovery reads --meta once per plugin, per scan. That means the output should be small and fast:
- two fields,
nameanddesc, descunder about 70 characters — it is a subtitle in a settings row, not a summary,- no trailing newline requirement (one is fine; two are not),
- no work before printing: do not read
/proc, do not shell out, do not touch the network.
A --meta that takes 200 milliseconds makes a directory of twenty plugins take four seconds to appear in Settings. The scanner does not time out gracefully; it just feels broken.
The name is the display title in the menu. Keep it under about 30 characters so it does not truncate. The desc should say what the plugin shows, not what it is: "Listening ports on this node" beats "A port inspector plugin".
Query handling in the page
The page is served at one of two URLs and must work from both:
/plugin_disks served directly by the node
/plugins?plugin=plugin_disks&node=<id>&pwd=... proxied by the bot web front
So the script reads plugin, node and pwd from its own query string and builds action URLs accordingly. It must also carry pwd on every fetch, because the node API's auth guard applies to every request including the one the page's own script makes.
A page opened in a fresh tab has no referer and therefore no inherited credentials. If pwd is absent, fall back to localStorage under a key scoped to the node, which is what the browser front stores when the user signs in. Do not fall back to an unscoped key: two nodes on one machine would then share a password.
Accessibility basics that cost nothing
<h1>once, at the top, containing the plugin name.- Buttons are
<button type="button">, not<div onclick>. - The live/offline badge is text, not only a colour.
- Every input has a
<label>or anaria-label. - Focus is visible: do not remove the outline without replacing it.
None of this needs a framework. All of it shows up in a screenshot test and none of it shows up in a code review unless you look.
What not to do
Do not load anything from the network. No CDN, no font, no analytics. A container may have no outbound access, and a plugin that waits on a font request renders blank for as long as the connection times out.
Do not use window.top or attempt to break out of the frame. The page is frameable by design; escaping it is a bug, not a feature.
Do not open a modal over the whole viewport. The frame is not the viewport. A "full-screen" overlay in a 640-pixel iframe covers the chat and nothing else, and the user cannot dismiss what they cannot see.
Do not auto-refresh on a timer without a visible control. A plugin that polls every second keeps the node executing a process every second for as long as the tab is open. If you need liveness, poll every ten seconds and stop when the document is hidden.
Read next
- The C99 Three-Mode Plugin SDK — the contract these rules decorate.
- Cross-Compiling for musl, MinGW and macOS — the build side of shipping a UI that has to look the same on four platforms.
- Why Plugins Are Untrusted — why a page that renders in your chat frame is still native code running as you.