Node-Side API

Lookup tables for the node side: DevframeDefinition fields, CLI options, storage scopes, RPC function types, broadcast options, streaming lifecycle, remote assets, the cross-devframe services surface, 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 DevframeDefinition: Devframe 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 DevframeCliOptions: CLI 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 defineRpcFunction: RPC.

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.broadcast: Broadcasting.

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 upstreamnone

Remote assets options

The fields of a RemoteAssets source for clientAssets and hostStatic: Remote 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.

DevframeServicesHost

The methods on ctx.services: Cross-Devframe Services.

MethodSignatureRole
provide(id, service) => revokePublish an in-process service under a namespaced id. Throws DF0037 if the id is taken.
get(id) => service | undefinedThe service currently provided under id (augmented type, else unknown).
has(id) => booleanWhether a service is provided under id.
whenAvailable(id, cb) => unsubscribeRun cb as soon as the service exists (now if provided, else on provide), and re-fire on revoke/re-provide.
keys() => string[]Ids of every currently-provided service.
install(input, options?) => Promise<api | undefined>Install a wire service at runtime (the dynamic escape hatch; the common path is declarative). options.resolveFrom is the descriptor's resolution base.
ready() => Promise<void>Internal. Construct every queued wire service before any setup runs. Adapters call it; application code uses declarative services.

Service tiers

The two tiers a service can take: Cross-Devframe Services.

TierShared howRegisters RPCAdvertised to clients
In-process service (provide/get)live object, node side onlyNoNo
Wire service (install / declarative services)npm package, node API + RPCYes, under its scopeYes, via devframe:services shared state

Wire-service definition fields

The fields of a DevframeServiceDefinition returned by a service package's create<X>Service factory: Shipping a wire service.

FieldTypeDescription
packagestringRequired. npm package name, also its registry key (ctx.services.has(pkg)).
versionstringRequired. Semver; advertised to clients, checked against declared ranges.
scopestringRequired. RPC namespace its functions register under (e.g. devframes:service:open); setup gets a context pre-scoped to it.
metaRecord<string, unknown>Extra advertised metadata (feature flags, defaults). Must be JSON-serializable.
optionsOptionsThis instance's own option set, baked in by its factory; joins the merge.
mergeOptions(sets: Options[]) => OptionsMerge multiple installers' option sets. Default: shallow, later wins.
setup(ctx, info) => apiRequired. Register RPC on the pre-scoped context; return the node API served from ctx.services.get(package).

Wire-service descriptor fields

The declarative reference form on DevframeDefinition.services / initHub({ services }): Declaring services.

FieldTypeDescription
packagestringRequired. npm package name; its default export is the factory the host imports.
versionstringAccepted semver range. Unsatisfied warns (DF0069), or throws (DF0068) when required.
requiredbooleanFail hard on a missing package (DF0067) or unsatisfied range. Default false: a missing service is skipped and clients see has() === false.
optionsOptionsOption set this installer contributes to the merge.

Advertised service meta

Each installed service's entry in the devframe:services shared state, mirrored to RPC clients as rpc.services: Feature-detecting on the RPC client.

FieldDescription
packagenpm package name, the registry key.
versionInstalled version of the service.
scopeRPC namespace its functions live under.
metaExtra service-declared metadata.

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
anonymous:devframe:auth:request-codeclient → server{ ua, origin, reissue? } → print the code banner in the server terminal (reissue: true rotates the code first)
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/auth: Security.

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.