🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@devframes/hub

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@devframes/hub - npm Package Compare versions

Comparing version
0.6.2
to
0.7.0
+368
dist/context-CfJPSLH2.d.mts
import { M as JsonRenderer, _ as DevframeDockEntryIcon, c as DevframeCommandsHost, j as JsonRenderSpec, y as DevframeDocksHost } from "./settings-CzbUEsyC.mjs";
import { CreateHostContextOptions } from "devframe/node";
import { DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
import { ChildProcess } from "node:child_process";
//#region src/types/messages.d.ts
type DevframeMessageLevel = 'info' | 'warn' | 'error' | 'success' | 'debug';
type DevframeMessageEntryFrom = 'server' | 'browser';
interface DevframeMessageElementPosition {
/** CSS selector for the element */
selector?: string;
/** Bounding box of the element */
boundingBox?: {
x: number;
y: number;
width: number;
height: number;
};
/** Human-readable description of the element */
description?: string;
}
interface DevframeMessageFilePosition {
/** Absolute or relative file path */
file: string;
/** Line number (1-based) */
line?: number;
/** Column number (1-based) */
column?: number;
}
interface DevframeMessageEntry {
/**
* Unique identifier for this message entry (auto-generated if not provided)
*/
id: string;
/**
* Short title or summary of the message
*/
message: string;
/**
* Optional detailed description or explanation
*/
description?: string;
/**
* Severity level, determines color and icon
*/
level: DevframeMessageLevel;
/**
* Optional stack trace string
*/
stacktrace?: string;
/**
* Optional DOM element position info (e.g., for a11y issues)
*/
elementPosition?: DevframeMessageElementPosition;
/**
* Optional source file position info (e.g., for lint errors)
*/
filePosition?: DevframeMessageFilePosition;
/**
* Whether this message should also appear as a toast notification
*/
notify?: boolean;
/**
* Origin of the message entry, automatically set by the context
*/
from: DevframeMessageEntryFrom;
/**
* Grouping category (e.g., 'a11y', 'lint', 'runtime', 'test')
*/
category?: string;
/**
* Optional tags/labels for filtering
*/
labels?: string[];
/**
* Time in ms to auto-dismiss the toast notification (client-side)
*/
autoDismiss?: number;
/**
* Time in ms to auto-delete this message entry (server-side)
*/
autoDelete?: number;
/**
* Timestamp when the message was created (auto-generated if not provided)
*/
timestamp: number;
/**
* Status of the message entry (e.g., 'loading' while an operation is in progress).
* Defaults to 'idle' when not specified.
*/
status?: 'loading' | 'idle';
}
/**
* Input type for creating a message entry.
* `id`, `timestamp`, and `from` are auto-filled by the host.
*/
type DevframeMessageEntryInput = Omit<DevframeMessageEntry, 'id' | 'timestamp' | 'from'> & {
id?: string;
timestamp?: number;
};
interface DevframeMessageHandle {
/** The underlying message entry data */
readonly entry: DevframeMessageEntry;
/** Shortcut to entry.id */
readonly id: string;
/** Partial update of this message entry */
update: (patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
/** Remove this message entry */
dismiss: () => Promise<void>;
}
/**
* Extra fields accepted by the per-level message shortcuts —
* everything on {@link DevframeMessageEntryInput} except the
* `message` and `level` the shortcut itself provides.
*/
type DevframeMessageShortcutInput = Omit<DevframeMessageEntryInput, 'message' | 'level'>;
/**
* Per-level shortcuts shared by the client and the node host —
* `messages.info('...')` is `messages.add({ message: '...', level: 'info' })`.
*/
interface DevframeMessagesLevelShortcuts {
/** Shortcut for `add({ message, level: 'info', ...extra })` */
info: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'warn', ...extra })` */
warn: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'error', ...extra })` */
error: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'success', ...extra })` */
success: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'debug', ...extra })` */
debug: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
}
interface DevframeMessagesClient extends DevframeMessagesLevelShortcuts {
/**
* Add a message entry. Returns a Promise resolving to a handle for subsequent updates/dismissal.
* Can be used without `await` for fire-and-forget usage.
*/
add: (input: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
/** Remove a message entry by id */
remove: (id: string) => Promise<void>;
/** Clear all message entries */
clear: () => Promise<void>;
}
/**
* A snapshot or delta of the message list, as returned by
* {@link DevframeMessagesHost.listSince}. Consumers apply `removedIds`
* first, then upsert `entries`, and pass `version` back as `since` on the
* next call.
*/
interface DevframeMessagesListDelta {
/** Entries added or updated since the cursor (or all entries when `full`) */
entries: DevframeMessageEntry[];
/** Ids removed since the cursor (empty when `full`) */
removedIds: string[];
/** The version cursor — pass back as `since` on the next call */
version: number;
/**
* When `true`, `entries` is the complete snapshot and any locally cached
* list must be reset before applying it.
*/
full: boolean;
}
interface DevframeMessagesHost extends DevframeMessagesLevelShortcuts {
readonly entries: Map<string, DevframeMessageEntry>;
readonly events: EventEmitter<{
'message:added': (entry: DevframeMessageEntry) => void;
'message:updated': (entry: DevframeMessageEntry) => void;
'message:removed': (id: string) => void;
'message:cleared': () => void;
}>;
/**
* Add a new message entry. If an entry with the same `id` already exists, it will be updated instead.
* Returns a handle for subsequent updates/dismissal. Can be used without `await` for fire-and-forget.
*/
add: (entry: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
/**
* Update an existing message entry by id (partial update)
*/
update: (id: string, patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
/**
* Remove a message entry by id
*/
remove: (id: string) => Promise<void>;
/**
* Clear all message entries
*/
clear: () => Promise<void>;
/**
* Read the message list incrementally. Pass the `version` from the
* previous result as `since` to receive only the entries modified and the
* ids removed after that point; pass `null`/`undefined` for the initial
* full snapshot. When the host can no longer compute a reliable delta for
* the given cursor (trimmed removal history, or a cursor from another host
* incarnation), the result carries `full: true` with the complete list.
*/
listSince: (since?: number | null) => DevframeMessagesListDelta;
}
//#endregion
//#region src/types/terminals.d.ts
interface DevframeTerminalsHost {
readonly sessions: Map<string, DevframeTerminalSession>;
readonly events: EventEmitter<{
'terminal:session:updated': (session: DevframeTerminalSession) => void;
}>;
register: (session: DevframeTerminalSession) => DevframeTerminalSession;
update: (session: DevframeTerminalSession) => void;
/**
* Spawn a read-only child process (pipe-backed, output only). Use this for
* long-running logs and dev servers that don't need input.
*/
startChildProcess: (executeOptions: DevframeChildProcessExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframeChildProcessTerminalSession>;
/**
* Spawn a fully interactive pseudo-terminal (PTY) any plugin can drive:
* keystrokes via {@link DevframePtyTerminalSession.write}, live layout via
* {@link DevframePtyTerminalSession.resize}, TUI-capable. The session is
* marked `interactive`, so a hub-aware terminal UI (e.g. the terminals
* plugin) surfaces it as writable rather than read-only. Powered by
* `zigpty` — where its native bindings can't load, it degrades to
* pipe-based terminal emulation.
*/
startPtySession: (executeOptions: DevframePtyExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframePtyTerminalSession>;
}
type DevframeTerminalStatus = 'running' | 'stopped' | 'error';
interface DevframeTerminalSessionBase {
id: string;
title: string;
description?: string;
status: DevframeTerminalStatus;
icon?: DevframeDockEntryIcon;
/**
* Whether the session accepts input (keystrokes + resize). `true` for
* {@link DevframeTerminalsHost.startPtySession} sessions; absent/`false`
* for pipe-backed, output-only ones. A hub-aware terminal UI reads this to
* decide whether to enable stdin and wire resize.
*/
interactive?: boolean;
}
interface DevframeTerminalSession extends DevframeTerminalSessionBase {
buffer?: string[];
stream?: ReadableStream<string>;
}
interface DevframeChildProcessExecuteOptions {
command: string;
args: string[];
cwd?: string;
env?: Record<string, string>;
}
/**
* The settled outcome of a {@link DevframeChildProcessTerminalSession} run —
* stdout/stderr captured separately (unlike the session's merged display
* `stream`), plus the process's exit code (`undefined` if it was killed by a
* signal before exiting).
*/
interface DevframeChildProcessOutput {
stdout: string;
stderr: string;
exitCode: number | undefined;
}
/**
* A live handle on a child process's outcome — mirrors the ergonomics of
* `tinyexec`'s `Result` (a promise-like paired with synchronous accessors) so
* callers migrating from a `tinyexec`/`execa`-based subprocess API (e.g.
* Nuxt DevTools' `startSubprocess().getResult()`) can adopt
* {@link DevframeTerminalsHost.startChildProcess} with minimal changes.
* `await`ing it (or calling `.then()`) resolves once the process exits, with
* the full captured {@link DevframeChildProcessOutput}.
*/
interface DevframeChildProcessResult extends PromiseLike<DevframeChildProcessOutput> {
readonly pid: number | undefined;
/** `undefined` while the process is still running. */
readonly exitCode: number | undefined;
readonly killed: boolean;
kill: (signal?: NodeJS.Signals | number) => boolean;
}
interface DevframeChildProcessTerminalSession extends DevframeTerminalSession {
type: 'child-process';
executeOptions: DevframeChildProcessExecuteOptions;
getChildProcess: () => ChildProcess | undefined;
/**
* Get a live handle on the current run's outcome. Reflects the most recent
* `restart()` — call it again after restarting to track the new run.
*/
getResult: () => DevframeChildProcessResult;
terminate: () => Promise<void>;
restart: () => Promise<void>;
}
interface DevframePtyExecuteOptions {
command: string;
args?: string[];
cwd?: string;
env?: Record<string, string>;
/** Initial column count. Default: 80. */
cols?: number;
/** Initial row count. Default: 24. */
rows?: number;
}
interface DevframePtyTerminalSession extends DevframeTerminalSession {
type: 'pty';
interactive: true;
executeOptions: DevframePtyExecuteOptions;
/** Send keystrokes / raw input to the PTY. */
write: (data: string) => void;
/** Resize the PTY (emits SIGWINCH so TUIs relayout). */
resize: (cols: number, rows: number) => void;
/** Current foreground process name, when the backend can resolve it. */
getProcessName: () => string | undefined;
terminate: () => Promise<void>;
restart: () => Promise<void>;
}
//#endregion
//#region src/node/context.d.ts
declare module 'devframe/types' {
interface DevframeRpcClientFunctions {
/**
* Server→client notification that terminal sessions changed. Broadcast
* by the hub context; a hub-aware client re-reads terminal state in
* response. Do not register manually.
*
* @internal
*/
'devframe:terminals:updated': () => Promise<void>;
/**
* Server→client notification that the message list changed. Broadcast
* by the hub context; a hub-aware client re-reads message state in
* response. Do not register manually.
*
* @internal
*/
'devframe:messages:updated': () => Promise<void>;
}
}
/**
* Hub-augmented node context — extends devframe's framework-neutral
* `DevframeNodeContext` with the hub-level subsystems (`docks`,
* `terminals`, `messages`, `commands`) and the `createJsonRenderer`
* factory.
*
* Framework kits further extend this with their own slots (e.g.
* `viteConfig`, `viteServer`). Host-specific capabilities (editor open,
* filesystem reveal, etc.) ship as kit-registered RPC functions rather
* than as part of this surface.
*/
interface DevframeHubContext extends DevframeNodeContext {
readonly host: DevframeHost;
docks: DevframeDocksHost;
terminals: DevframeTerminalsHost;
messages: DevframeMessagesHost;
commands: DevframeCommandsHost;
/**
* Create a JsonRenderer handle for building json-render powered UIs.
*/
createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
}
/**
* Options for {@link createHubContext} — devframe's
* {@link CreateHostContextOptions} plus any hub-level additions kits layer on
* through declaration merging.
*/
interface CreateHubContextOptions extends CreateHostContextOptions {}
/**
* Create a hub-level node context: wraps devframe's `createHostContext`,
* attaches the hub hosts (`docks`, `terminals`, `messages`, `commands`),
* registers the hub's built-in RPC commands, and wires the shared-state
* synchronization that powers a hub-aware client UI.
*/
declare function createHubContext(options: CreateHubContextOptions): Promise<DevframeHubContext>;
//#endregion
export { DevframeMessagesHost as C, DevframeMessagesClient as S, DevframeMessagesListDelta as T, DevframeMessageEntryInput as _, DevframeChildProcessOutput as a, DevframeMessageLevel as b, DevframePtyExecuteOptions as c, DevframeTerminalSessionBase as d, DevframeTerminalStatus as f, DevframeMessageEntryFrom as g, DevframeMessageEntry as h, DevframeChildProcessExecuteOptions as i, DevframePtyTerminalSession as l, DevframeMessageElementPosition as m, DevframeHubContext as n, DevframeChildProcessResult as o, DevframeTerminalsHost as p, createHubContext as r, DevframeChildProcessTerminalSession as s, CreateHubContextOptions as t, DevframeTerminalSession as u, DevframeMessageFilePosition as v, DevframeMessagesLevelShortcuts as w, DevframeMessageShortcutInput as x, DevframeMessageHandle as y };
import { ConnectionMeta, EventEmitter } from "devframe/types";
//#region src/types/json-render.d.ts
interface JsonRenderElement {
type: string;
props?: Record<string, unknown>;
children?: string[];
/** json-render event bindings (e.g. `{ press: { action: "my:action" } }`) */
on?: Record<string, unknown>;
/** json-render visibility condition */
visible?: unknown;
/** json-render repeat binding */
repeat?: unknown;
/** Allow additional json-render element fields */
[key: string]: unknown;
}
interface JsonRenderSpec {
root: string;
elements: Record<string, JsonRenderElement>;
/** Initial client-side state model for $state/$bindState expressions */
state?: Record<string, unknown>;
}
interface JsonRenderer {
/** Replace the entire spec */
updateSpec: (spec: JsonRenderSpec) => void | Promise<void>;
/** Update json-render state values (shallow merge into spec.state) */
updateState: (state: Record<string, unknown>) => void | Promise<void>;
/** Internal: shared state key used by the client to subscribe */
readonly _stateKey: string;
}
//#endregion
//#region src/types/docks.d.ts
interface DevframeDocksHost {
readonly views: Map<string, DevframeDockUserEntry>;
readonly events: EventEmitter<{
'dock:entry:updated': (entry: DevframeDockUserEntry) => void;
}>;
register: <T extends DevframeDockUserEntry>(entry: T, force?: boolean) => {
update: (patch: Partial<T>) => void;
};
update: (entry: DevframeDockUserEntry) => void;
values: () => DevframeDockEntry[];
}
type DevframeDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~builtin' | (string & {});
type DevframeDockEntryIcon = string | {
light: string;
dark: string;
};
interface DevframeDockEntryBase {
id: string;
title: string;
icon: DevframeDockEntryIcon;
/**
* The default order of the entry in the dock.
* The higher the number the earlier it appears.
* @default 0
*/
defaultOrder?: number;
/**
* The category of the entry
* @default 'default'
*/
category?: DevframeDockEntryCategory;
/**
* Conditional visibility expression.
* When set, the dock entry is only visible when the expression evaluates to true.
* Uses the same syntax as command `when` clauses.
*
* Set to `'false'` to unconditionally hide the entry.
*
* @example 'clientType == embedded'
* @see {@link import('devframe/utils/when').evaluateWhen}
*/
when?: string;
/**
* Badge text to display on the dock icon (e.g., unread count)
*/
badge?: string;
/**
* Id of the group this entry belongs to. When set, hosts collapse this entry
* under the matching group's button instead of showing it directly on the
* dock bar.
*
* This is a flat pointer — membership, not containment. The entry stays an
* independently-registered, top-level entry; only its rendering is grouped
* downstream. If the referenced group is never registered, the entry renders
* as a normal top-level entry (orphan tolerance).
*
* @see {@link DevframeViewGroup}
*/
groupId?: string;
}
interface ClientScriptEntry {
/**
* The filepath or module name to import from
*/
importFrom: string;
/**
* The name to import the module as
*
* @default 'default'
*/
importName?: string;
}
interface DevframeViewIframe extends DevframeDockEntryBase {
type: 'iframe';
url: string;
/**
* The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
*
* When not provided, it would be treated as a unique frame.
*/
frameId?: string;
/**
* Optional client script to import into the iframe
*/
clientScript?: ClientScriptEntry;
/**
* Enable remote-UI mode: the hub injects a connection descriptor
* (WS URL + pre-approved auth token) into the iframe URL so a hosted
* page can connect back via `connectRemoteDevframe()` from
* `@devframes/hub/client` — without needing to ship a dist with the
* plugin.
*
* Requires dev mode (no effect in build mode — no WS server exists).
* When enabled, the dock is automatically hidden in build mode unless
* the author provides an explicit `when` clause.
*/
remote?: boolean | RemoteDockOptions;
}
interface RemoteDockOptions {
/**
* How to pass the connection descriptor to the hosted page.
*
* - `'fragment'` (default): appended as a URL fragment.
* Not sent in HTTP requests or Referer headers — safest for auth tokens.
* - `'query'`: appended as a URL query parameter. Use when your hosting
* platform rewrites fragments or your SPA router repurposes the fragment
* for navigation. The token will appear in server access logs and
* outbound Referer headers.
*
* @default 'fragment'
*/
transport?: 'fragment' | 'query';
/**
* Reject WS handshakes whose `Origin` header doesn't match the dock URL
* origin. Turn off when the same hosted app is served from multiple
* origins (e.g. preview deploys).
*
* @default true
*/
originLock?: boolean;
}
interface RemoteConnectionInfo extends ConnectionMeta {
backend: 'websocket';
websocket: string;
v: 1;
authToken: string;
origin: string;
}
type DevframeViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
interface DevframeViewLauncher extends DevframeDockEntryBase {
type: 'launcher';
launcher: {
icon?: DevframeDockEntryIcon;
title: string;
status?: DevframeViewLauncherStatus;
error?: string;
description?: string;
buttonStart?: string;
buttonLoading?: string;
onLaunch: () => Promise<void>;
};
}
interface DevframeViewAction extends DevframeDockEntryBase {
type: 'action';
action: ClientScriptEntry;
}
interface DevframeViewCustomRender extends DevframeDockEntryBase {
type: 'custom-render';
renderer: ClientScriptEntry;
}
/**
* A view rendered natively by the viewer rather than by a plugin — the
* settings panel, the terminals feed, the messages feed, etc. A high-level
* integration registers the built-in views it wants; the viewer recognizes the
* reserved `id` and renders its own UI for it.
*
* Its {@link DevframeDockEntryBase.category} defaults to `'~builtin'` when
* omitted, so built-in views group together and sort last without every
* integration repeating it.
*/
interface DevframeViewBuiltin extends DevframeDockEntryBase {
type: '~builtin';
id: string;
}
interface DevframeViewJsonRender extends DevframeDockEntryBase {
type: 'json-render';
/** JsonRenderer handle created by ctx.createJsonRenderer() */
ui: JsonRenderer;
}
/**
* A dock group: a single dock-bar button that collapses every entry whose
* {@link DevframeDockEntryBase.groupId} matches this group's `id`.
*
* A group carries its own `title`/`icon`/`category`/`defaultOrder`/`when`
* (inherited from {@link DevframeDockEntryBase}) and has no view payload of its
* own — hosts render its members in a popover / sub-navigation. It flows
* through the same `register`/`update`/`values` machinery as every other entry,
* keyed by `id`.
*
* Grouping is one level deep: a group entry must not itself set `groupId`.
*/
interface DevframeViewGroup extends DevframeDockEntryBase {
type: 'group';
/**
* Member id auto-opened when the group button is activated. When unset,
* activating the group only reveals its members (popover-only); no view
* opens until a member is chosen.
*/
defaultChildId?: string;
}
type DevframeDockUserEntry = DevframeViewIframe | DevframeViewAction | DevframeViewCustomRender | DevframeViewLauncher | DevframeViewJsonRender | DevframeViewGroup | DevframeViewBuiltin;
type DevframeDockEntry = DevframeDockUserEntry;
type DevframeDockEntriesGrouped = [category: string, entries: DevframeDockEntry[]][];
//#endregion
//#region src/types/commands.d.ts
interface DevframeCommandKeybinding {
/**
* Keyboard shortcut string.
* Use "Mod" for platform-aware modifier (Cmd on macOS, Ctrl elsewhere).
* Examples: "Mod+K", "Mod+Shift+P", "Alt+N"
*/
key: string;
}
interface DevframeCommandBase {
/**
* Unique namespaced ID, e.g. "vite:open-in-editor"
*/
id: string;
title: string;
description?: string;
/**
* Icon for the command. Either an Iconify icon string (e.g. "ph:pencil-duotone")
* or a theme-specific pair `{ light, dark }` — the same shape as dock icons.
*/
icon?: DevframeDockEntryIcon;
category?: string;
/**
* Whether to show in command palette. Default: true
*
* - `true` — show the command and flatten its children into search results
* - `false` — hide the command entirely from the palette
* - `'without-children'` — show the command but don't flatten children into top-level search (children are still accessible via drill-down)
*/
showInPalette?: boolean | 'without-children';
/**
* Optional context expression for conditional visibility.
* When set, the command is only shown in the palette and only executable
* when the expression evaluates to true.
*/
when?: string;
/**
* Default keyboard shortcut(s) for this command
*/
keybindings?: DevframeCommandKeybinding[];
}
/**
* Server command input — what plugins pass to `ctx.commands.register()`.
*/
interface DevframeServerCommandInput extends DevframeCommandBase {
/**
* Handler for this command. Optional if the command only serves as a group for children.
*/
handler?: (...args: any[]) => any | Promise<any>;
/**
* Static sub-commands. Two levels max (parent → children).
* Each child must have a globally unique `id`.
*/
children?: DevframeServerCommandInput[];
}
/**
* Serializable server command entry — sent over RPC (no handler).
*/
interface DevframeServerCommandEntry extends DevframeCommandBase {
source: 'server';
children?: DevframeServerCommandEntry[];
}
/**
* Client command — registered in the webcomponent context.
*/
interface DevframeClientCommand extends DevframeCommandBase {
source: 'client';
/**
* Action for this command. Optional if the command only serves as a group for children.
* Return sub-commands for dynamic nested palette menus (runtime submenus).
*/
action?: (...args: any[]) => void | DevframeClientCommand[] | Promise<void | DevframeClientCommand[]>;
/**
* Static sub-commands. Two levels max (parent → children).
*/
children?: DevframeClientCommand[];
}
/**
* Union of command entries visible in the palette.
*/
type DevframeCommandEntry = DevframeServerCommandEntry | DevframeClientCommand;
interface DevframeCommandHandle {
readonly id: string;
update: (patch: Partial<Omit<DevframeServerCommandInput, 'id'>>) => void;
unregister: () => void;
}
interface DevframeCommandsHostEvents {
'command:registered': (command: DevframeServerCommandEntry) => void;
'command:unregistered': (id: string) => void;
}
interface DevframeCommandsHost {
readonly commands: Map<string, DevframeServerCommandInput>;
readonly events: EventEmitter<DevframeCommandsHostEvents>;
/**
* Register a command (with optional children).
*/
register: (command: DevframeServerCommandInput) => DevframeCommandHandle;
/**
* Unregister a command by ID (removes parent and all children).
*/
unregister: (id: string) => boolean;
/**
* Execute a command by ID. Searches top-level and children.
* Throws if not found or if command has no handler.
*/
execute: (id: string, ...args: any[]) => Promise<unknown>;
/**
* Returns serializable list (no handlers), preserving tree structure.
*/
list: () => DevframeServerCommandEntry[];
}
interface DevframeCommandShortcutOverrides {
/**
* Command ID → keybinding overrides. Empty array = shortcut disabled.
*/
[commandId: string]: DevframeCommandKeybinding[];
}
//#endregion
//#region src/types/settings.d.ts
interface DevframeDocksUserSettings {
docksHidden: string[];
docksCategoriesHidden: string[];
docksPinned: string[];
docksCustomOrder: Record<string, number>;
showIframeAddressBar: boolean;
closeOnOutsideClick: boolean;
commandShortcuts: DevframeCommandShortcutOverrides;
}
//#endregion
export { JsonRenderElement as A, DevframeViewGroup as C, DevframeViewLauncherStatus as D, DevframeViewLauncher as E, JsonRenderer as M, RemoteConnectionInfo as O, DevframeViewCustomRender as S, DevframeViewJsonRender as T, DevframeDockEntryIcon as _, DevframeCommandHandle as a, DevframeViewAction as b, DevframeCommandsHost as c, DevframeServerCommandInput as d, ClientScriptEntry as f, DevframeDockEntryCategory as g, DevframeDockEntryBase as h, DevframeCommandEntry as i, JsonRenderSpec as j, RemoteDockOptions as k, DevframeCommandsHostEvents as l, DevframeDockEntry as m, DevframeClientCommand as n, DevframeCommandKeybinding as o, DevframeDockEntriesGrouped as p, DevframeCommandBase as r, DevframeCommandShortcutOverrides as s, DevframeDocksUserSettings as t, DevframeServerCommandEntry as u, DevframeDockUserEntry as v, DevframeViewIframe as w, DevframeViewBuiltin as x, DevframeDocksHost as y };
+21
-4

@@ -1,4 +0,4 @@

import { S as DevframeMessagesClient, _ as DevframeMessageEntryInput } from "../context-BVliVH77.mjs";
import { O as RemoteConnectionInfo, i as DevframeCommandEntry, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, t as DevframeDocksUserSettings, v as DevframeDockUserEntry } from "../settings-ZM591NEp.mjs";
import { DevframeClientRpcHost, DevframeRpcClient, DevframeRpcClientOptions, DevframeRpcContext, RpcClientEvents } from "devframe/client";
import { S as DevframeMessagesClient, _ as DevframeMessageEntryInput } from "../context-CfJPSLH2.mjs";
import { O as RemoteConnectionInfo, i as DevframeCommandEntry, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, t as DevframeDocksUserSettings, v as DevframeDockUserEntry } from "../settings-CzbUEsyC.mjs";
import { DevframeClientRpcHost, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientOptions, DevframeRpcContext, RpcClientEvents, RpcClientEvents as RpcClientEvents$1 } from "devframe/client";
import { EventEmitter } from "devframe/types";

@@ -45,3 +45,20 @@ import { SharedState } from "devframe/utils/shared-state";

readonly when: WhenClauseContext;
/**
* The live connection status of the underlying devframe client, so a viewer
* can render one central connection indicator for every docked plugin
* instead of each plugin surfacing its own.
*/
readonly connection: DocksConnectionContext;
}
interface DocksConnectionContext {
/** The current connection status. */
readonly status: DevframeConnectionStatus;
/** The most recent connection-level error, or `null` when healthy. */
readonly error: Error | null;
/**
* The client's event emitter — subscribe to `connection:status`,
* `connection:error`, and `rpc:error` to react to changes.
*/
readonly events: EventEmitter<RpcClientEvents$1>;
}
interface WhenClauseContext {

@@ -239,2 +256,2 @@ /**

//#endregion
export { CLIENT_CONTEXT_KEY, CommandsContext, ConnectRemoteDevframeOptions, DevframeClientContext, DevframeClientHost, DevframeClientHostOptions, type DevframeClientRpcHost, DockClientScriptContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DocksContext, DocksEntriesContext, DocksPanelContext, MessagesClientOptions, type RpcClientEvents, WhenClauseContext, connectRemoteDevframe, createDevframeClientHost, createMessagesClient, getDevframeClientContext, parseRemoteConnection, setDevframeClientContext };
export { CLIENT_CONTEXT_KEY, CommandsContext, ConnectRemoteDevframeOptions, DevframeClientContext, DevframeClientHost, DevframeClientHostOptions, type DevframeClientRpcHost, DockClientScriptContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DocksConnectionContext, DocksContext, DocksEntriesContext, DocksPanelContext, MessagesClientOptions, type RpcClientEvents, WhenClauseContext, connectRemoteDevframe, createDevframeClientHost, createMessagesClient, getDevframeClientContext, parseRemoteConnection, setDevframeClientContext };

@@ -115,3 +115,12 @@ import { DEFAULT_CATEGORIES_ORDER, DEFAULT_STATE_USER_SETTINGS } from "../constants.mjs";

};
} }
} },
connection: {
get status() {
return rpc.status;
},
get error() {
return rpc.connectionError;
},
events: rpc.events
}
};

@@ -118,0 +127,0 @@ const disposers = [];

+1
-1

@@ -1,2 +0,2 @@

import { t as DevframeDocksUserSettings } from "./settings-ZM591NEp.mjs";
import { t as DevframeDocksUserSettings } from "./settings-CzbUEsyC.mjs";
export * from "devframe/constants";

@@ -3,0 +3,0 @@

@@ -1,3 +0,3 @@

import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "./context-BVliVH77.mjs";
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "./settings-ZM591NEp.mjs";
import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "./context-CfJPSLH2.mjs";
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "./settings-CzbUEsyC.mjs";
import { C as RpcStreamingChannel, E as Thenable, S as RpcSharedStateHost, T as RpcStreamingHost, _ as RpcBroadcastOptions, a as DevframeDiagnosticsLogger, b as RpcFunctionsHost, c as DevframeRpcClientFunctions, d as DevframeViewHost, f as EntriesToObject, g as PartialWithoutId, h as EventsMap, i as DevframeDiagnosticsHost, l as DevframeRpcServerFunctions, m as EventUnsubscribe, n as DevframeCapabilities, o as DevframeHost, p as EventEmitter, r as DevframeDiagnosticsDefinition, s as DevframeNodeRpcSession, t as ConnectionMeta, u as DevframeRpcSharedStates, v as RpcDefinitionsFilter, w as RpcStreamingChannelOptions, x as RpcSharedStateGetOptions, y as RpcDefinitionsToFunctions } from "./index-Dic9q4eN.mjs";

@@ -4,0 +4,0 @@ import { WhenContext, WhenExpression } from "devframe/utils/when";

@@ -1,3 +0,3 @@

import { C as DevframeMessagesHost$1, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, n as DevframeHubContext, p as DevframeTerminalsHost$1, r as createHubContext, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-BVliVH77.mjs";
import { a as DevframeCommandHandle, c as DevframeCommandsHost$1, d as DevframeServerCommandInput, f as ClientScriptEntry, m as DevframeDockEntry, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, y as DevframeDocksHost$1 } from "../settings-ZM591NEp.mjs";
import { C as DevframeMessagesHost$1, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, n as DevframeHubContext, p as DevframeTerminalsHost$1, r as createHubContext, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-CfJPSLH2.mjs";
import { a as DevframeCommandHandle, c as DevframeCommandsHost$1, d as DevframeServerCommandInput, f as ClientScriptEntry, m as DevframeDockEntry, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, y as DevframeDocksHost$1 } from "../settings-CzbUEsyC.mjs";
import { RpcFunctionDefinitionAny } from "devframe/rpc";

@@ -38,8 +38,2 @@ import { DevframeDefinition } from "devframe/types";

update(view: DevframeDockUserEntry): void;
/**
* `~builtin` views default their category to `~builtin` so the viewer's
* native views group together and sort last — a high-level integration
* registering one needn't repeat the category.
*/
private withBuiltinCategory;
private validateGroupMembership;

@@ -119,6 +113,7 @@ private prepareRemoteRegistration;

/**
* Overrides for the auto-synthesized iframe dock entry. Use this to
* customize the entry's `category`, override the icon, hide it via
* `when`, etc. Cannot change `id`, `type`, or `url` — those are
* derived from the devframe definition.
* Per-mount overrides for the auto-synthesized iframe dock entry. Use
* this to customize the entry's `category`, override the icon, hide it
* via `when`, etc. Takes precedence over the definition's own
* {@link DevframeDefinition.dock} defaults. Cannot change `id`, `type`,
* or `url` — those are derived from the devframe definition.
*/

@@ -125,0 +120,0 @@ dock?: Partial<Omit<DevframeViewIframe, 'id' | 'type' | 'url'>>;

@@ -1,4 +0,4 @@

import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-BVliVH77.mjs";
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "../settings-ZM591NEp.mjs";
import { C as DevframeMessagesHost, S as DevframeMessagesClient, T as DevframeMessagesListDelta, _ as DevframeMessageEntryInput, a as DevframeChildProcessOutput, b as DevframeMessageLevel, c as DevframePtyExecuteOptions, d as DevframeTerminalSessionBase, f as DevframeTerminalStatus, g as DevframeMessageEntryFrom, h as DevframeMessageEntry, i as DevframeChildProcessExecuteOptions, l as DevframePtyTerminalSession, m as DevframeMessageElementPosition, n as DevframeHubContext, o as DevframeChildProcessResult, p as DevframeTerminalsHost, s as DevframeChildProcessTerminalSession, t as CreateHubContextOptions, u as DevframeTerminalSession, v as DevframeMessageFilePosition, w as DevframeMessagesLevelShortcuts, x as DevframeMessageShortcutInput, y as DevframeMessageHandle } from "../context-CfJPSLH2.mjs";
import { A as JsonRenderElement, C as DevframeViewGroup, D as DevframeViewLauncherStatus, E as DevframeViewLauncher, M as JsonRenderer, O as RemoteConnectionInfo, S as DevframeViewCustomRender, T as DevframeViewJsonRender, _ as DevframeDockEntryIcon, a as DevframeCommandHandle, b as DevframeViewAction, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryCategory, h as DevframeDockEntryBase, i as DevframeCommandEntry, j as JsonRenderSpec, k as RemoteDockOptions, l as DevframeCommandsHostEvents, m as DevframeDockEntry, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockEntriesGrouped, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockUserEntry, w as DevframeViewIframe, x as DevframeViewBuiltin, y as DevframeDocksHost } from "../settings-CzbUEsyC.mjs";
import { C as RpcStreamingChannel, E as Thenable, S as RpcSharedStateHost, T as RpcStreamingHost, _ as RpcBroadcastOptions, a as DevframeDiagnosticsLogger, b as RpcFunctionsHost, c as DevframeRpcClientFunctions, d as DevframeViewHost, f as EntriesToObject, g as PartialWithoutId, h as EventsMap, i as DevframeDiagnosticsHost, l as DevframeRpcServerFunctions, m as EventUnsubscribe, n as DevframeCapabilities, o as DevframeHost, p as EventEmitter, r as DevframeDiagnosticsDefinition, s as DevframeNodeRpcSession, t as ConnectionMeta, u as DevframeRpcSharedStates, v as RpcDefinitionsFilter, w as RpcStreamingChannelOptions, x as RpcSharedStateGetOptions, y as RpcDefinitionsToFunctions } from "../index-Dic9q4eN.mjs";
export { ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, DevframeChildProcessExecuteOptions, DevframeChildProcessOutput, DevframeChildProcessResult, DevframeChildProcessTerminalSession, DevframeClientCommand, DevframeCommandBase, DevframeCommandEntry, DevframeCommandHandle, DevframeCommandKeybinding, DevframeCommandShortcutOverrides, DevframeCommandsHost, DevframeCommandsHostEvents, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockUserEntry, DevframeDocksHost, DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, DevframeMessageElementPosition, DevframeMessageEntry, DevframeMessageEntryFrom, DevframeMessageEntryInput, DevframeMessageFilePosition, DevframeMessageHandle, DevframeMessageLevel, DevframeMessageShortcutInput, DevframeMessagesClient, DevframeMessagesHost, DevframeMessagesLevelShortcuts, DevframeMessagesListDelta, type DevframeNodeRpcSession, DevframePtyExecuteOptions, DevframePtyTerminalSession, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, DevframeServerCommandEntry, DevframeServerCommandInput, DevframeTerminalSession, DevframeTerminalSessionBase, DevframeTerminalStatus, DevframeTerminalsHost, DevframeViewAction, DevframeViewBuiltin, DevframeViewCustomRender, DevframeViewGroup, type DevframeViewHost, DevframeViewIframe, DevframeViewJsonRender, DevframeViewLauncher, DevframeViewLauncherStatus, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, type PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type Thenable };
{
"name": "@devframes/hub",
"type": "module",
"version": "0.6.2",
"version": "0.7.0",
"description": "Framework-neutral hub layer for devframe — docks, terminals, messages, commands.",

@@ -36,3 +36,3 @@ "author": "Anthony Fu <anthonyfu117@hotmail.com>",

"peerDependencies": {
"devframe": "0.6.2"
"devframe": "0.7.0"
},

@@ -52,3 +52,3 @@ "dependencies": {

"tsdown": "^0.22.3",
"devframe": "0.6.2"
"devframe": "0.7.0"
},

@@ -55,0 +55,0 @@ "scripts": {

import { M as JsonRenderer, _ as DevframeDockEntryIcon, c as DevframeCommandsHost, j as JsonRenderSpec, y as DevframeDocksHost } from "./settings-ZM591NEp.mjs";
import { CreateHostContextOptions } from "devframe/node";
import { DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
import { ChildProcess } from "node:child_process";
//#region src/types/messages.d.ts
type DevframeMessageLevel = 'info' | 'warn' | 'error' | 'success' | 'debug';
type DevframeMessageEntryFrom = 'server' | 'browser';
interface DevframeMessageElementPosition {
/** CSS selector for the element */
selector?: string;
/** Bounding box of the element */
boundingBox?: {
x: number;
y: number;
width: number;
height: number;
};
/** Human-readable description of the element */
description?: string;
}
interface DevframeMessageFilePosition {
/** Absolute or relative file path */
file: string;
/** Line number (1-based) */
line?: number;
/** Column number (1-based) */
column?: number;
}
interface DevframeMessageEntry {
/**
* Unique identifier for this message entry (auto-generated if not provided)
*/
id: string;
/**
* Short title or summary of the message
*/
message: string;
/**
* Optional detailed description or explanation
*/
description?: string;
/**
* Severity level, determines color and icon
*/
level: DevframeMessageLevel;
/**
* Optional stack trace string
*/
stacktrace?: string;
/**
* Optional DOM element position info (e.g., for a11y issues)
*/
elementPosition?: DevframeMessageElementPosition;
/**
* Optional source file position info (e.g., for lint errors)
*/
filePosition?: DevframeMessageFilePosition;
/**
* Whether this message should also appear as a toast notification
*/
notify?: boolean;
/**
* Origin of the message entry, automatically set by the context
*/
from: DevframeMessageEntryFrom;
/**
* Grouping category (e.g., 'a11y', 'lint', 'runtime', 'test')
*/
category?: string;
/**
* Optional tags/labels for filtering
*/
labels?: string[];
/**
* Time in ms to auto-dismiss the toast notification (client-side)
*/
autoDismiss?: number;
/**
* Time in ms to auto-delete this message entry (server-side)
*/
autoDelete?: number;
/**
* Timestamp when the message was created (auto-generated if not provided)
*/
timestamp: number;
/**
* Status of the message entry (e.g., 'loading' while an operation is in progress).
* Defaults to 'idle' when not specified.
*/
status?: 'loading' | 'idle';
}
/**
* Input type for creating a message entry.
* `id`, `timestamp`, and `from` are auto-filled by the host.
*/
type DevframeMessageEntryInput = Omit<DevframeMessageEntry, 'id' | 'timestamp' | 'from'> & {
id?: string;
timestamp?: number;
};
interface DevframeMessageHandle {
/** The underlying message entry data */
readonly entry: DevframeMessageEntry;
/** Shortcut to entry.id */
readonly id: string;
/** Partial update of this message entry */
update: (patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
/** Remove this message entry */
dismiss: () => Promise<void>;
}
/**
* Extra fields accepted by the per-level message shortcuts —
* everything on {@link DevframeMessageEntryInput} except the
* `message` and `level` the shortcut itself provides.
*/
type DevframeMessageShortcutInput = Omit<DevframeMessageEntryInput, 'message' | 'level'>;
/**
* Per-level shortcuts shared by the client and the node host —
* `messages.info('...')` is `messages.add({ message: '...', level: 'info' })`.
*/
interface DevframeMessagesLevelShortcuts {
/** Shortcut for `add({ message, level: 'info', ...extra })` */
info: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'warn', ...extra })` */
warn: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'error', ...extra })` */
error: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'success', ...extra })` */
success: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
/** Shortcut for `add({ message, level: 'debug', ...extra })` */
debug: (message: string, extra?: DevframeMessageShortcutInput) => Promise<DevframeMessageHandle>;
}
interface DevframeMessagesClient extends DevframeMessagesLevelShortcuts {
/**
* Add a message entry. Returns a Promise resolving to a handle for subsequent updates/dismissal.
* Can be used without `await` for fire-and-forget usage.
*/
add: (input: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
/** Remove a message entry by id */
remove: (id: string) => Promise<void>;
/** Clear all message entries */
clear: () => Promise<void>;
}
/**
* A snapshot or delta of the message list, as returned by
* {@link DevframeMessagesHost.listSince}. Consumers apply `removedIds`
* first, then upsert `entries`, and pass `version` back as `since` on the
* next call.
*/
interface DevframeMessagesListDelta {
/** Entries added or updated since the cursor (or all entries when `full`) */
entries: DevframeMessageEntry[];
/** Ids removed since the cursor (empty when `full`) */
removedIds: string[];
/** The version cursor — pass back as `since` on the next call */
version: number;
/**
* When `true`, `entries` is the complete snapshot and any locally cached
* list must be reset before applying it.
*/
full: boolean;
}
interface DevframeMessagesHost extends DevframeMessagesLevelShortcuts {
readonly entries: Map<string, DevframeMessageEntry>;
readonly events: EventEmitter<{
'message:added': (entry: DevframeMessageEntry) => void;
'message:updated': (entry: DevframeMessageEntry) => void;
'message:removed': (id: string) => void;
'message:cleared': () => void;
}>;
/**
* Add a new message entry. If an entry with the same `id` already exists, it will be updated instead.
* Returns a handle for subsequent updates/dismissal. Can be used without `await` for fire-and-forget.
*/
add: (entry: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
/**
* Update an existing message entry by id (partial update)
*/
update: (id: string, patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
/**
* Remove a message entry by id
*/
remove: (id: string) => Promise<void>;
/**
* Clear all message entries
*/
clear: () => Promise<void>;
/**
* Read the message list incrementally. Pass the `version` from the
* previous result as `since` to receive only the entries modified and the
* ids removed after that point; pass `null`/`undefined` for the initial
* full snapshot. When the host can no longer compute a reliable delta for
* the given cursor (trimmed removal history, or a cursor from another host
* incarnation), the result carries `full: true` with the complete list.
*/
listSince: (since?: number | null) => DevframeMessagesListDelta;
}
//#endregion
//#region src/types/terminals.d.ts
interface DevframeTerminalsHost {
readonly sessions: Map<string, DevframeTerminalSession>;
readonly events: EventEmitter<{
'terminal:session:updated': (session: DevframeTerminalSession) => void;
}>;
register: (session: DevframeTerminalSession) => DevframeTerminalSession;
update: (session: DevframeTerminalSession) => void;
/**
* Spawn a read-only child process (pipe-backed, output only). Use this for
* long-running logs and dev servers that don't need input.
*/
startChildProcess: (executeOptions: DevframeChildProcessExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframeChildProcessTerminalSession>;
/**
* Spawn a fully interactive pseudo-terminal (PTY) any plugin can drive:
* keystrokes via {@link DevframePtyTerminalSession.write}, live layout via
* {@link DevframePtyTerminalSession.resize}, TUI-capable. The session is
* marked `interactive`, so a hub-aware terminal UI (e.g. the terminals
* plugin) surfaces it as writable rather than read-only. Powered by
* `zigpty` — where its native bindings can't load, it degrades to
* pipe-based terminal emulation.
*/
startPtySession: (executeOptions: DevframePtyExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframePtyTerminalSession>;
}
type DevframeTerminalStatus = 'running' | 'stopped' | 'error';
interface DevframeTerminalSessionBase {
id: string;
title: string;
description?: string;
status: DevframeTerminalStatus;
icon?: DevframeDockEntryIcon;
/**
* Whether the session accepts input (keystrokes + resize). `true` for
* {@link DevframeTerminalsHost.startPtySession} sessions; absent/`false`
* for pipe-backed, output-only ones. A hub-aware terminal UI reads this to
* decide whether to enable stdin and wire resize.
*/
interactive?: boolean;
}
interface DevframeTerminalSession extends DevframeTerminalSessionBase {
buffer?: string[];
stream?: ReadableStream<string>;
}
interface DevframeChildProcessExecuteOptions {
command: string;
args: string[];
cwd?: string;
env?: Record<string, string>;
}
/**
* The settled outcome of a {@link DevframeChildProcessTerminalSession} run —
* stdout/stderr captured separately (unlike the session's merged display
* `stream`), plus the process's exit code (`undefined` if it was killed by a
* signal before exiting).
*/
interface DevframeChildProcessOutput {
stdout: string;
stderr: string;
exitCode: number | undefined;
}
/**
* A live handle on a child process's outcome — mirrors the ergonomics of
* `tinyexec`'s `Result` (a promise-like paired with synchronous accessors) so
* callers migrating from a `tinyexec`/`execa`-based subprocess API (e.g.
* Nuxt DevTools' `startSubprocess().getResult()`) can adopt
* {@link DevframeTerminalsHost.startChildProcess} with minimal changes.
* `await`ing it (or calling `.then()`) resolves once the process exits, with
* the full captured {@link DevframeChildProcessOutput}.
*/
interface DevframeChildProcessResult extends PromiseLike<DevframeChildProcessOutput> {
readonly pid: number | undefined;
/** `undefined` while the process is still running. */
readonly exitCode: number | undefined;
readonly killed: boolean;
kill: (signal?: NodeJS.Signals | number) => boolean;
}
interface DevframeChildProcessTerminalSession extends DevframeTerminalSession {
type: 'child-process';
executeOptions: DevframeChildProcessExecuteOptions;
getChildProcess: () => ChildProcess | undefined;
/**
* Get a live handle on the current run's outcome. Reflects the most recent
* `restart()` — call it again after restarting to track the new run.
*/
getResult: () => DevframeChildProcessResult;
terminate: () => Promise<void>;
restart: () => Promise<void>;
}
interface DevframePtyExecuteOptions {
command: string;
args?: string[];
cwd?: string;
env?: Record<string, string>;
/** Initial column count. Default: 80. */
cols?: number;
/** Initial row count. Default: 24. */
rows?: number;
}
interface DevframePtyTerminalSession extends DevframeTerminalSession {
type: 'pty';
interactive: true;
executeOptions: DevframePtyExecuteOptions;
/** Send keystrokes / raw input to the PTY. */
write: (data: string) => void;
/** Resize the PTY (emits SIGWINCH so TUIs relayout). */
resize: (cols: number, rows: number) => void;
/** Current foreground process name, when the backend can resolve it. */
getProcessName: () => string | undefined;
terminate: () => Promise<void>;
restart: () => Promise<void>;
}
//#endregion
//#region src/node/context.d.ts
declare module 'devframe/types' {
interface DevframeRpcClientFunctions {
/**
* Server→client notification that terminal sessions changed. Broadcast
* by the hub context; a hub-aware client re-reads terminal state in
* response. Do not register manually.
*
* @internal
*/
'devframe:terminals:updated': () => Promise<void>;
/**
* Server→client notification that the message list changed. Broadcast
* by the hub context; a hub-aware client re-reads message state in
* response. Do not register manually.
*
* @internal
*/
'devframe:messages:updated': () => Promise<void>;
}
}
/**
* Hub-augmented node context — extends devframe's framework-neutral
* `DevframeNodeContext` with the hub-level subsystems (`docks`,
* `terminals`, `messages`, `commands`) and the `createJsonRenderer`
* factory.
*
* Framework kits further extend this with their own slots (e.g.
* `viteConfig`, `viteServer`). Host-specific capabilities (editor open,
* filesystem reveal, etc.) ship as kit-registered RPC functions rather
* than as part of this surface.
*/
interface DevframeHubContext extends DevframeNodeContext {
readonly host: DevframeHost;
docks: DevframeDocksHost;
terminals: DevframeTerminalsHost;
messages: DevframeMessagesHost;
commands: DevframeCommandsHost;
/**
* Create a JsonRenderer handle for building json-render powered UIs.
*/
createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
}
/**
* Options for {@link createHubContext} — devframe's
* {@link CreateHostContextOptions} plus any hub-level additions kits layer on
* through declaration merging.
*/
interface CreateHubContextOptions extends CreateHostContextOptions {}
/**
* Create a hub-level node context: wraps devframe's `createHostContext`,
* attaches the hub hosts (`docks`, `terminals`, `messages`, `commands`),
* registers the hub's built-in RPC commands, and wires the shared-state
* synchronization that powers a hub-aware client UI.
*/
declare function createHubContext(options: CreateHubContextOptions): Promise<DevframeHubContext>;
//#endregion
export { DevframeMessagesHost as C, DevframeMessagesClient as S, DevframeMessagesListDelta as T, DevframeMessageEntryInput as _, DevframeChildProcessOutput as a, DevframeMessageLevel as b, DevframePtyExecuteOptions as c, DevframeTerminalSessionBase as d, DevframeTerminalStatus as f, DevframeMessageEntryFrom as g, DevframeMessageEntry as h, DevframeChildProcessExecuteOptions as i, DevframePtyTerminalSession as l, DevframeMessageElementPosition as m, DevframeHubContext as n, DevframeChildProcessResult as o, DevframeTerminalsHost as p, createHubContext as r, DevframeChildProcessTerminalSession as s, CreateHubContextOptions as t, DevframeTerminalSession as u, DevframeMessageFilePosition as v, DevframeMessagesLevelShortcuts as w, DevframeMessageShortcutInput as x, DevframeMessageHandle as y };
import { ConnectionMeta, EventEmitter } from "devframe/types";
//#region src/types/json-render.d.ts
interface JsonRenderElement {
type: string;
props?: Record<string, unknown>;
children?: string[];
/** json-render event bindings (e.g. `{ press: { action: "my:action" } }`) */
on?: Record<string, unknown>;
/** json-render visibility condition */
visible?: unknown;
/** json-render repeat binding */
repeat?: unknown;
/** Allow additional json-render element fields */
[key: string]: unknown;
}
interface JsonRenderSpec {
root: string;
elements: Record<string, JsonRenderElement>;
/** Initial client-side state model for $state/$bindState expressions */
state?: Record<string, unknown>;
}
interface JsonRenderer {
/** Replace the entire spec */
updateSpec: (spec: JsonRenderSpec) => void | Promise<void>;
/** Update json-render state values (shallow merge into spec.state) */
updateState: (state: Record<string, unknown>) => void | Promise<void>;
/** Internal: shared state key used by the client to subscribe */
readonly _stateKey: string;
}
//#endregion
//#region src/types/docks.d.ts
interface DevframeDocksHost {
readonly views: Map<string, DevframeDockUserEntry>;
readonly events: EventEmitter<{
'dock:entry:updated': (entry: DevframeDockUserEntry) => void;
}>;
register: <T extends DevframeDockUserEntry>(entry: T, force?: boolean) => {
update: (patch: Partial<T>) => void;
};
update: (entry: DevframeDockUserEntry) => void;
values: () => DevframeDockEntry[];
}
type DevframeDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~builtin' | (string & {});
type DevframeDockEntryIcon = string | {
light: string;
dark: string;
};
interface DevframeDockEntryBase {
id: string;
title: string;
icon: DevframeDockEntryIcon;
/**
* The default order of the entry in the dock.
* The higher the number the earlier it appears.
* @default 0
*/
defaultOrder?: number;
/**
* The category of the entry
* @default 'default'
*/
category?: DevframeDockEntryCategory;
/**
* Conditional visibility expression.
* When set, the dock entry is only visible when the expression evaluates to true.
* Uses the same syntax as command `when` clauses.
*
* Set to `'false'` to unconditionally hide the entry.
*
* @example 'clientType == embedded'
* @see {@link import('devframe/utils/when').evaluateWhen}
*/
when?: string;
/**
* Badge text to display on the dock icon (e.g., unread count)
*/
badge?: string;
/**
* Id of the group this entry belongs to. When set, hosts collapse this entry
* under the matching group's button instead of showing it directly on the
* dock bar.
*
* This is a flat pointer — membership, not containment. The entry stays an
* independently-registered, top-level entry; only its rendering is grouped
* downstream. If the referenced group is never registered, the entry renders
* as a normal top-level entry (orphan tolerance).
*
* @see {@link DevframeViewGroup}
*/
groupId?: string;
}
interface ClientScriptEntry {
/**
* The filepath or module name to import from
*/
importFrom: string;
/**
* The name to import the module as
*
* @default 'default'
*/
importName?: string;
}
interface DevframeViewIframe extends DevframeDockEntryBase {
type: 'iframe';
url: string;
/**
* The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
*
* When not provided, it would be treated as a unique frame.
*/
frameId?: string;
/**
* Optional client script to import into the iframe
*/
clientScript?: ClientScriptEntry;
/**
* Enable remote-UI mode: the hub injects a connection descriptor
* (WS URL + pre-approved auth token) into the iframe URL so a hosted
* page can connect back via `connectRemoteDevframe()` from
* `@devframes/hub/client` — without needing to ship a dist with the
* plugin.
*
* Requires dev mode (no effect in build mode — no WS server exists).
* When enabled, the dock is automatically hidden in build mode unless
* the author provides an explicit `when` clause.
*/
remote?: boolean | RemoteDockOptions;
}
interface RemoteDockOptions {
/**
* How to pass the connection descriptor to the hosted page.
*
* - `'fragment'` (default): appended as a URL fragment.
* Not sent in HTTP requests or Referer headers — safest for auth tokens.
* - `'query'`: appended as a URL query parameter. Use when your hosting
* platform rewrites fragments or your SPA router repurposes the fragment
* for navigation. The token will appear in server access logs and
* outbound Referer headers.
*
* @default 'fragment'
*/
transport?: 'fragment' | 'query';
/**
* Reject WS handshakes whose `Origin` header doesn't match the dock URL
* origin. Turn off when the same hosted app is served from multiple
* origins (e.g. preview deploys).
*
* @default true
*/
originLock?: boolean;
}
interface RemoteConnectionInfo extends ConnectionMeta {
backend: 'websocket';
websocket: string;
v: 1;
authToken: string;
origin: string;
}
type DevframeViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
interface DevframeViewLauncher extends DevframeDockEntryBase {
type: 'launcher';
launcher: {
icon?: DevframeDockEntryIcon;
title: string;
status?: DevframeViewLauncherStatus;
error?: string;
description?: string;
buttonStart?: string;
buttonLoading?: string;
onLaunch: () => Promise<void>;
};
}
interface DevframeViewAction extends DevframeDockEntryBase {
type: 'action';
action: ClientScriptEntry;
}
interface DevframeViewCustomRender extends DevframeDockEntryBase {
type: 'custom-render';
renderer: ClientScriptEntry;
}
/**
* A view rendered natively by the viewer rather than by a plugin — the
* settings panel, the terminals feed, the messages feed, etc. A high-level
* integration registers the built-in views it wants; the viewer recognizes the
* reserved `id` and renders its own UI for it.
*
* Its {@link DevframeDockEntryBase.category} defaults to `'~builtin'` when
* omitted, so built-in views group together and sort last without every
* integration repeating it.
*/
interface DevframeViewBuiltin extends DevframeDockEntryBase {
type: '~builtin';
id: '~terminals' | '~messages' | '~client-auth-notice' | '~settings' | '~popup';
}
interface DevframeViewJsonRender extends DevframeDockEntryBase {
type: 'json-render';
/** JsonRenderer handle created by ctx.createJsonRenderer() */
ui: JsonRenderer;
}
/**
* A dock group: a single dock-bar button that collapses every entry whose
* {@link DevframeDockEntryBase.groupId} matches this group's `id`.
*
* A group carries its own `title`/`icon`/`category`/`defaultOrder`/`when`
* (inherited from {@link DevframeDockEntryBase}) and has no view payload of its
* own — hosts render its members in a popover / sub-navigation. It flows
* through the same `register`/`update`/`values` machinery as every other entry,
* keyed by `id`.
*
* Grouping is one level deep: a group entry must not itself set `groupId`.
*/
interface DevframeViewGroup extends DevframeDockEntryBase {
type: 'group';
/**
* Member id auto-opened when the group button is activated. When unset,
* activating the group only reveals its members (popover-only); no view
* opens until a member is chosen.
*/
defaultChildId?: string;
}
type DevframeDockUserEntry = DevframeViewIframe | DevframeViewAction | DevframeViewCustomRender | DevframeViewLauncher | DevframeViewJsonRender | DevframeViewGroup | DevframeViewBuiltin;
type DevframeDockEntry = DevframeDockUserEntry;
type DevframeDockEntriesGrouped = [category: string, entries: DevframeDockEntry[]][];
//#endregion
//#region src/types/commands.d.ts
interface DevframeCommandKeybinding {
/**
* Keyboard shortcut string.
* Use "Mod" for platform-aware modifier (Cmd on macOS, Ctrl elsewhere).
* Examples: "Mod+K", "Mod+Shift+P", "Alt+N"
*/
key: string;
}
interface DevframeCommandBase {
/**
* Unique namespaced ID, e.g. "vite:open-in-editor"
*/
id: string;
title: string;
description?: string;
/**
* Icon for the command. Either an Iconify icon string (e.g. "ph:pencil-duotone")
* or a theme-specific pair `{ light, dark }` — the same shape as dock icons.
*/
icon?: DevframeDockEntryIcon;
category?: string;
/**
* Whether to show in command palette. Default: true
*
* - `true` — show the command and flatten its children into search results
* - `false` — hide the command entirely from the palette
* - `'without-children'` — show the command but don't flatten children into top-level search (children are still accessible via drill-down)
*/
showInPalette?: boolean | 'without-children';
/**
* Optional context expression for conditional visibility.
* When set, the command is only shown in the palette and only executable
* when the expression evaluates to true.
*/
when?: string;
/**
* Default keyboard shortcut(s) for this command
*/
keybindings?: DevframeCommandKeybinding[];
}
/**
* Server command input — what plugins pass to `ctx.commands.register()`.
*/
interface DevframeServerCommandInput extends DevframeCommandBase {
/**
* Handler for this command. Optional if the command only serves as a group for children.
*/
handler?: (...args: any[]) => any | Promise<any>;
/**
* Static sub-commands. Two levels max (parent → children).
* Each child must have a globally unique `id`.
*/
children?: DevframeServerCommandInput[];
}
/**
* Serializable server command entry — sent over RPC (no handler).
*/
interface DevframeServerCommandEntry extends DevframeCommandBase {
source: 'server';
children?: DevframeServerCommandEntry[];
}
/**
* Client command — registered in the webcomponent context.
*/
interface DevframeClientCommand extends DevframeCommandBase {
source: 'client';
/**
* Action for this command. Optional if the command only serves as a group for children.
* Return sub-commands for dynamic nested palette menus (runtime submenus).
*/
action?: (...args: any[]) => void | DevframeClientCommand[] | Promise<void | DevframeClientCommand[]>;
/**
* Static sub-commands. Two levels max (parent → children).
*/
children?: DevframeClientCommand[];
}
/**
* Union of command entries visible in the palette.
*/
type DevframeCommandEntry = DevframeServerCommandEntry | DevframeClientCommand;
interface DevframeCommandHandle {
readonly id: string;
update: (patch: Partial<Omit<DevframeServerCommandInput, 'id'>>) => void;
unregister: () => void;
}
interface DevframeCommandsHostEvents {
'command:registered': (command: DevframeServerCommandEntry) => void;
'command:unregistered': (id: string) => void;
}
interface DevframeCommandsHost {
readonly commands: Map<string, DevframeServerCommandInput>;
readonly events: EventEmitter<DevframeCommandsHostEvents>;
/**
* Register a command (with optional children).
*/
register: (command: DevframeServerCommandInput) => DevframeCommandHandle;
/**
* Unregister a command by ID (removes parent and all children).
*/
unregister: (id: string) => boolean;
/**
* Execute a command by ID. Searches top-level and children.
* Throws if not found or if command has no handler.
*/
execute: (id: string, ...args: any[]) => Promise<unknown>;
/**
* Returns serializable list (no handlers), preserving tree structure.
*/
list: () => DevframeServerCommandEntry[];
}
interface DevframeCommandShortcutOverrides {
/**
* Command ID → keybinding overrides. Empty array = shortcut disabled.
*/
[commandId: string]: DevframeCommandKeybinding[];
}
//#endregion
//#region src/types/settings.d.ts
interface DevframeDocksUserSettings {
docksHidden: string[];
docksCategoriesHidden: string[];
docksPinned: string[];
docksCustomOrder: Record<string, number>;
showIframeAddressBar: boolean;
closeOnOutsideClick: boolean;
commandShortcuts: DevframeCommandShortcutOverrides;
}
//#endregion
export { JsonRenderElement as A, DevframeViewGroup as C, DevframeViewLauncherStatus as D, DevframeViewLauncher as E, JsonRenderer as M, RemoteConnectionInfo as O, DevframeViewCustomRender as S, DevframeViewJsonRender as T, DevframeDockEntryIcon as _, DevframeCommandHandle as a, DevframeViewAction as b, DevframeCommandsHost as c, DevframeServerCommandInput as d, ClientScriptEntry as f, DevframeDockEntryCategory as g, DevframeDockEntryBase as h, DevframeCommandEntry as i, JsonRenderSpec as j, RemoteDockOptions as k, DevframeCommandsHostEvents as l, DevframeDockEntry as m, DevframeClientCommand as n, DevframeCommandKeybinding as o, DevframeDockEntriesGrouped as p, DevframeCommandBase as r, DevframeCommandShortcutOverrides as s, DevframeDocksUserSettings as t, DevframeServerCommandEntry as u, DevframeDockUserEntry as v, DevframeViewIframe as w, DevframeViewBuiltin as x, DevframeDocksHost as y };

Sorry, the diff of this file is too big to display