Skip to main content

Module cockpit

Module cockpit 

Source
Expand description

The Cockpit: the human-facing projection of the registry, server-rendered.

It is a projection and not an application. Every page is laid out from what a capability answered, through the same executor MCP and the HTTP routes call; the navigation’s catalogues come from the registry, the index and the graph derivations; the runner’s form comes from the input schema. Nothing here holds a list of capabilities, routes, kinds or graphs, and adding one to the registry adds it here.

           capability! ─── registry ────┬──── MCP tools and resources
                   declarative objects ─┤──── HTTP routes ── OpenAPI ── Swagger UI
                                        ├──── the command line
                                        └──── Cockpit ── pages, navigation, runner, graphs

The routes it serves are the projection’s own, like /swagger and /openapi.json: they are not capabilities, they declare no schema, and they are listed as infrastructure in the OpenAPI document rather than as operations.

What the browser adds is an enhancement in the strict sense. The pages are complete HTML; the scripts add a command palette, a runner, a graph drawing and two optional visual views. With no JavaScript at all, every page still shows everything it knows.

Modules§

assets
The Cockpit’s static files, served from the distribution’s share/cockpit/.
html
Markup that cannot be unescaped by accident. There is no template engine here and no template string: a page is a tree of El values, and the only way text reaches the output is through a method that escapes it.

Structs§

Cockpit
The Cockpit over the repository as it is now. Cheap to clone into every worker thread: the assets are shared and the view of the repository is an Arc.

Constants§

PREFIX
Every Cockpit route starts here.
SHELL_SCRIPTS
The script modules every page loads. cockpit.js is not among them: the palette imports it, so it is in the graph of every page anyway. Every module that imports it names it by the one digested URL the server rewrites the import to (assets.rs), so a <script> tag here would add nothing but a second request.
STATIC_ROUTES
Every route the dispatcher answers without an identifier in the path, and the area each one belongs to — "" for a page that belongs to none, which the sidebar does not carry.
STYLESHEET
The stylesheet the shell links.
SURFACE
The Cockpit’s identity in the web topology (web.surfaces).

Functions§

base64
Standard base64, for the one digest the policy names. Four characters per three bytes, padded; no dependency for twenty lines.
csp
The content-security policy every page carries. Scripts come from this origin and from nowhere else; the one inline script is allowed by the digest of its own bytes, so an injected inline script is refused even if one ever got through the escaping. No unsafe-eval, no remote origin, and nothing may frame the page.