Node-Side API

Lookup tables for the node side: DevframeDefinition fields, CLI options, storage scopes, RPC function types, broadcast options, streaming lifecycle, remote assets, diagnostics prefixes, and the auth surface.

Lookup tables for a devframe's node side. Each section links the guide page that teaches the concept.

Definition fields

The fields of a DevframeDefinitionDevframe Definition.

FieldTypeDescription
idstringRequired. Unique namespaced id (kebab-case); prefixes RPC/dock/MCP-tool names.
namestringRequired. Display name (dock, agent manifests).
versionstringRequired. Semver; shown in hub UIs, diagnostics.
packageNamestringRequired. npm package (@scope/my-tool).
importMetaUrlstringRecommended. Pass import.meta.url — the deps resolution base: default resolveFrom for remote assets and declared services.
homepagestringRequired. Homepage/docs URL.
descriptionstringRequired. One-line summary.
iconstring | { light, dark }Optional Iconify name or URL; light/dark pairs.
basePathstringOptional mount-path override. Default / standalone (cli/build), /__<id>/ hosted (vite/embedded).
duplicationStrategy'warn' | 'silent' | 'throw' | 'duplicate'Hub reaction when another devframe shares this id. Default 'warn'. See Duplication strategies; standalone adapters ignore it.
capabilities{ dev?, build? }Per-runtime feature flags. boolean = whole runtime; object = individual features.
servicesDevframeServiceInput[]Wire services consumed — descriptors ({ package, version?, required?, options? }) imported against the devframe's own deps, or ready definitions. See Cross-Devframe Services.
clientAssetsstring | RemoteAssetsBuilt SPA served as the UI — local dist dir or remote assets. Read by every UI-serving adapter (dev, build, vite, next, hub).
rpc{ snapshot?: (string | { method, inputs })[] }RPC config. rpc.snapshot opts an RPC this devframe doesn't own into the static dump. Bare method id bakes the no-arg call; { method, inputs } bakes one record per argument-tuple (inputs = tuples or async (ctx) => tuples). First tuple = fallback.
setup(ctx, info?) => void | Promise<void>Required. Server-side entry point, run in every runtime. Optional 2nd arg carries runtime metadata — notably parsed CLI flags under createCac.
cliDevframeCliOptionsCLI adapter defaults. See CLI options.

CLI options

The cli field's DevframeCliOptionsCLI options.

FieldTypeDescription
commandstringBinary name in --help. Default: the id.
portnumberPreferred dev-server port.
portRange[number, number]Port scan range (get-port-please).
randombooleanPrefer a random open port.
hoststringDefault bind host.
openboolean | stringtrue = origin, string = a path, false = off (--open/--no-open). With auth, embeds the OTP.
authbooleanDisable WS trust flow when localhost-only, single-user. Default true.
configure(cli: CAC) => voidContribute flags/commands before createCac's configureCli.

Storage scopes

The three classes ctx.host.getStorageDir(scope) places persisted state in — Storage scopes.

ScopePlacementFor
workspacecommittable, <workspaceRoot>/.devframe/team-shared: saved presets, config
projectper-checkout, <cwd>/node_modules/.<app>/devframe/caches, personal settings
globalper-user, ~/.<app>/devframe/auth tokens, machine-wide prefs

RPC function types

The type field of defineRpcFunctionRPC.

TypeDescriptionCachedStatic Dump
queryRead operation that can change over time.Opt-in via cacheableManual (declare dump)
staticData that never changes for a given input.IndefinitelyAutomatic
actionMutation with side effects.NeverNever
eventFire-and-forget; no response.NeverNever

Broadcast options

The options of rpc.broadcastBroadcasting.

OptionTypeDescription
methodbrowser-side RPC nameBrowser-side function to call.
argsanyArguments for the browser-side function.
optionalbooleanDon't throw if no RPC client is listening.
eventbooleanFire-and-forget.
filter(client) => booleanSkip specific RPC clients.

Streaming lifecycle

How each lifecycle event lands on both sides of a streaming channel — Streaming.

EventNode sideBrowser side
stream.close() / stream.error(err)broadcasts endfor await resolves or throws
reader.cancel()aborts stream.signal on last-subscriber cancelfor await ends
WS disconnectsaborts stream.signal on last-subscriber dropreader survives, resubscribes on re-trust
chat panel closescancels upstream

Remote assets options

The fields of a RemoteAssets source for clientAssets and hostStaticRemote assets.

FieldPurpose
packagenpm package with the built assets.
versionExact version, usually your pkg.version.
resolveFromLocal-path resolution base. Defaults to importMetaUrl; null skips to cache + CDN.
pathSubpath the assets live under (default dist).
provider'jsdelivr' (default), 'unpkg', or a custom provider (internal mirror).
offlinetrue serves only from local install or cache, never network.

Diagnostic code prefixes

Prefixes in use across the ecosystem — Structured Diagnostics.

PrefixOwner
DFdevframe
DTK@vitejs/devtools (Vite-specific)
RDDT@vitejs/devtools-rolldown
VDT@vitejs/devtools-vite (reserved)

Auth methods

The wire-level RPC methods of the trust handshake — Security.

RPC methodDirectionShape
anonymous:devframe:authclient → server{ authToken, ua, origin }{ isTrusted } — re-authenticate a stored token
anonymous:devframe:auth:exchangeclient → server{ code, ua, origin }{ authToken | null } — exchange a code for a token
devframe:auth:revokeclient → serverself-revoke the caller's own token
devframe:auth:revokedserver → clientevent — token revoked

Node auth primitives

The building blocks in devframe/node/authSecurity.

FunctionRole
getTempAuthCode() / refreshTempAuthCode()read / rotate the one-time code
exchangeTempAuthCode(code, session, { ua, origin }, storage)verify a code, mint + store the token, trust the session, return it (or null)
verifyAuthToken(token, session, storage)trust a session presenting a known token
buildOtpAuthUrl(origin, code?)build a magic-link URL embedding the code
revokeAuthToken(context, storage, token)delete a token and disconnect sessions using it

MCP CLI commands

The agent-facing CLI surface — Agent-Native Devframe.

CommandDescription
<your-app> mcpStart the MCP server on stdio.
<your-app> dev --mcpServe the agent-consumable API on /__mcp.
devframe connectDiscover running devframes and proxy their tools — see MCP adapter.