Hub API

Lookup tables for the hub: subsystems, launcher fields, duplication strategies, dock categories, the hub UI protocol, the namespace routes, the client runtime, the client context, and dock entry types.

Lookup tables for @devframes/hub: its node-side subsystems and its browser-side client runtime. Each section links the guide page that teaches the concept.

Hub subsystems

What DevframeHubContext adds to DevframeNodeContext: Hub.

SubsystemAPIPurpose
ctx.docksregister / update / values / activateDock entries (iframes, launchers, custom-render) and groups; activate(dockId, params?) sets the active dock (Cross-iframe dock activation).
ctx.terminalsregister / startChildProcess / startPtySessionAggregate terminal sessions, streaming output (Terminals).
ctx.messagesadd / update / remove / clearServer-side toast/notification queue (FIFO, capped at 1000).
ctx.commandsregister / execute / listHierarchical command palette with keybindings and when clauses.

Launcher fields

The optional launcher fields that make a type: 'launcher' dock entry a live process controller: Process-control launchers.

FieldPurpose
commandBound command id; out-of-process hub UI providers dispatch via hub:commands:execute (register a handler via ctx.commands).
terminalSessionIdTracked session id; a "view in terminal" action calls hub:docks:activate with the terminals dock id and { sessionId }.
digestLatest progress line, shown inline; patch via docks.update().

Duplication strategies

The duplicationStrategy values deciding what happens when a devframe shares an already-mounted id: Duplicate devframes.

StrategyBehavior
'warn' (default)Keep the first, drop the later, emit DF8105.
'silent'Drop the later one without warning.
'throw'Throw DF8105.
'duplicate'Every instance coexists under a disambiguated dock id (my-tool, my-tool-2, …).

Dock categories

DEFAULT_CATEGORIES_ORDER (from @devframes/hub, /node, /client, /constants) names the default dock-rail buckets: The dual role of category.

CategoryWeightTypical use
framework-100Framework internals.
default0Uncategorized.
app100App tools.
ui150Components, styling.
data250State, storage, queries.
web300Network, platform, a11y.
performance350Profiling, metrics.
advanced400Power-user tools.
docs500Documentation.
~builtin1000Built-in views; always last.

Hub UI protocol

The shared-state keys and RPC methods a hub UI provider renders from: The hub UI protocol.

ChannelTypeWhat it carries
devframe:docks shared stateDevframeDockEntry[]Every registered dock entry.
devframe:commands shared stateDevframeServerCommandEntry[]Serializable command list (handlers stripped).
devframe:user-settings shared stateDevframeDocksUserSettingsPersisted project-scope hub settings.
devframe:docks:active shared stateDevframeDocksActiveStateMost recent dock activation request.
hub:commands:execute RPC(id, ...args) => unknownServer-side command dispatch.
hub:docks:activate RPC({ dockId, params? }) => voidSwitch the active dock.

Hub namespace routes

What initHub() serves under its base: The namespace.

PathServes
/the ui.viewer SPA, or index document when headless
<id>/each devframe's SPA + own __connection.json → shared socket
embedded.jsthe ui.embedded bootstrap (404 if none)
__connection.jsonmeta for the shared RPC socket
__wsWebSocket upgrade route
__index.jsonmachine-readable index: mounted devframes, endpoints
__client-imports.jsdock client-script import map for hub UI providers
__mcpaggregate MCP endpoint over the tool registry (mcp: 'auto' default: mounted once agent tools exist)

Onboarding options and routes

What createOnboarding() from @devframes/hub-ui-onboard accepts and serves: Opt-in DevTools with Onboarding.

OptionDefaultMeaning
packagesrequiredPackage specs the Install button adds
base/__devframes/Mount base, shared with the hub that takes over later
cwdprocess.cwd()Project that receives the dependency and whose lockfile picks the package manager
stateDir<cwd>/node_modules/.devframeDirectory of the hub-ui-onboard.json state file
devtrueInstall as a devDependency
branding{}productName (default Devframes), logo (URL or { light, dark }), primaryColor
messagesderived from productNameOverrides for title, description, install, hide, disable, installing, restart, retry
onInstallednoneRuns after a verified install, or on the first request when the packages already exist; a returned handler takes over base
RouteServes
GET <base>embedded.jsthe floating button, a self-contained ES module
GET <base>__onboard/status{ state, command, branding, messages, error? }
POST <base>__onboard/installstarts the install (202), same-origin only
POST <base>__onboard/disablewrites the state file (204), same-origin only
stateMeaning
idlenothing installed yet; the panel offers Install
installingthe package manager is running; the button polls once a second
installedinstalled, no hub handler to hand off to; the panel asks for a restart
readyonInstalled returned a handler; the button loads the real embedded.js and removes itself
errorthe install or onInstalled failed; error.code is a DF90xx diagnostic
disabledthe user chose Disable entirely; the button renders nothing

buildHub options

The options of buildHub() from @devframes/hub/build: Static builds. devframes, services, rpcDeclarations, configure, ui, renderers, name, version, cwd, and getStorageDir carry the same contracts as their initHub counterparts.

OptionPurpose
outDirOutput directory for the hub subtree; corresponds to base at serve time (build base: '/__devframes/' into dist/__devframes). A mount served outside the hub base (a devframe SPA or asset dir kept as a sibling of it) is written to this directory's parent (the deploy root) by its absolute path.
baseMount base baked into every absolute URL the build emits. Default /__devframes/.
contextAn already-mounted DevframeHubContext to bake instead of devframes (the build counterpart of initHub({ context })); reads ctx.frames and ctx.views.buildStaticDirs. Mutually exclusive with devframes.
cleanRemove outDir before writing. Default true; set false to bake beside an app's own build output.
prettyPretty-print RPC dump JSON shards. Default false (minified).

Client runtime options

The options of createDevframeClientRuntime(): The client runtime.

OptionDescription
rpcAn already-connected DevframeRpcClient; when omitted, created via connectDevframe(connect).
connectForwarded to connectDevframe when rpc is omitted (e.g. baseURL).
clientType'standalone' (default) owns the page; 'embedded' runs inside a user app alongside a panel.
loadClientScriptsImport and run dock client scripts (default true).
renderersDock renderers registered at boot, keyed by dock type; local wins over the hub's renderer manifest.

Client context properties

The properties of DevframeClientContext: The client context.

PropertyDescription
rpcThe RPC client: server/client functions, shared state.
clientType'embedded' (inside the user app) or 'standalone' (independent hub page).
docksentries, selected, groupedEntries, switchEntry(), toggleEntry(), getStateById(), register() / update() for client-only docks.
panelCurrent state, local events, session, position, size, and drag/resize state for the dock panel.
commandsCommand palette: register(), execute(), getKeybindings(), paletteOpen, paletteScopeId, openPalette(atCommandId?). Passing an id opens the palette drilled into that command's children (Activating a group).
renderersDock-renderer registry: register(), get(), has(), mount(entry, container). Routes a dock type to a renderer (local boot or the hub's manifest; local wins). mount() resolves a status: mounted (with dispose), missing-renderer, or load-error (with error).
whenThe when-clause context.
connectionLive connection status: status, error, events.

Dock client script fields

Which ClientScriptEntry field carries an entry's client script, and when it runs: Dock client scripts.

Entry kindFieldRuns
actionactionwhen the dock button is activated
custom-renderrendererto render the entry's panel
iframeclientScript (optional)inside the host page on first activation

ClientScriptEntry.eager defaults to false. Set it to true on an iframe clientScript or an action to initialize it after RPC trust, before dock activation. A custom-render renderer needs its mounted panel, so it always initializes on activation regardless of eager. Setup is cached per RPC connection and dock; action clicks execute on every activation.

Frame-nav messages

The origin-locked postMessage protocol on devframe:frame-nav: Shared-iframe soft navigation.

MessageDirectionMeaning
ready / manifestiframe → host pagetab list ({ tabs, current }), on load and change
navigatehost page → iframeshow a view ({ tabId, navTarget }); the SPA routes client-side
navigatediframe → host pagethe SPA navigated internally; the hub UI provider highlights the dock

Dock entry types

The built-in variants of the open dock union (DevframeDockEntryRegistry, @devframes/hub/types) a hub UI provider renders: Build Your Own Hub UI. Each entry's icon takes any of the icon values. Each entry's title has an optional titleLocales map of translations, resolved with resolveTitle(entry, locale) from @devframes/hub/client; commands and launchers carry the same pair.

TypeThe hub UI provider renders
iframethe entry's url in a kept-alive iframe (per frameId when shared); honor subTabs soft nav; show the existing address bar with addressBar: true, or configure Back, Reload, and Open externally by passing an addressBar object
actiona dock-rail button; activating runs its client script
custom-rendera container its client script mounts into
launchera launch call-to-action reflecting launcher.status
groupone dock-rail button collapsing its member entries
~builtinyour native views (settings, feeds) for reserved ids