@devframes/hub 0.9.7 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.d.mts +72 -51
- package/dist/client/index.mjs +119 -44
- package/dist/{constants-DrF61GFx.mjs → constants-BUd6oMci.mjs} +9 -8
- package/dist/{constants-C5t0DeZ0.d.mts → constants-Coo1p3ja.d.mts} +12 -9
- package/dist/constants.d.mts +1 -1
- package/dist/constants.mjs +1 -1
- package/dist/{context-C3hUUCC1.mjs → context-D4L966cN.mjs} +233 -135
- package/dist/{context-D5JSW_X5.d.mts → context-Di-fhMKP.d.mts} +40 -18
- package/dist/{index-DhxIxS-Q.d.mts → index-faD2d5iX.d.mts} +2 -2
- package/dist/index.d.mts +4 -4
- package/dist/node/index.d.mts +28 -19
- package/dist/node/index.mjs +2 -2
- package/dist/node/initiate.d.mts +35 -30
- package/dist/node/initiate.mjs +80 -53
- package/dist/{remote-url-Bgc7gtsP.mjs → remote-url-UClKLQ5_.mjs} +34 -39
- package/dist/{settings-D7whfcx2.d.mts → settings-CWHPzCWS.d.mts} +65 -39
- package/dist/types/index.d.mts +4 -4
- package/package.json +6 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as DevframeViewIframe, T as DevframeDocksHost, b as DevframeDockEntryIcon, l as DevframeCommandsHost, m as DevframeDockActivation } from "./settings-CWHPzCWS.mjs";
|
|
2
2
|
import { CreateHostContextOptions } from "devframe/node";
|
|
3
3
|
import { DevframeDefinition, DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
|
|
4
4
|
import { ChildProcess } from "node:child_process";
|
|
@@ -154,13 +154,13 @@ interface DevframeMessageHandle {
|
|
|
154
154
|
dismiss: () => Promise<void>;
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
157
|
-
* Extra fields accepted by the per-level message shortcuts
|
|
157
|
+
* Extra fields accepted by the per-level message shortcuts:
|
|
158
158
|
* everything on {@link DevframeMessageEntryInput} except the
|
|
159
159
|
* `message` and `level` the shortcut itself provides.
|
|
160
160
|
*/
|
|
161
161
|
type DevframeMessageShortcutInput = Omit<DevframeMessageEntryInput, 'message' | 'level'>;
|
|
162
162
|
/**
|
|
163
|
-
* Per-level shortcuts shared by the client and the node host
|
|
163
|
+
* Per-level shortcuts shared by the client and the node host:
|
|
164
164
|
* `messages.info('...')` is `messages.add({ message: '...', level: 'info' })`.
|
|
165
165
|
*/
|
|
166
166
|
interface DevframeMessagesLevelShortcuts {
|
|
@@ -197,7 +197,7 @@ interface DevframeMessagesListDelta {
|
|
|
197
197
|
entries: DevframeMessageEntry[];
|
|
198
198
|
/** Ids removed since the cursor (empty when `full`) */
|
|
199
199
|
removedIds: string[];
|
|
200
|
-
/** The version cursor
|
|
200
|
+
/** The version cursor; pass back as `since` on the next call */
|
|
201
201
|
version: number;
|
|
202
202
|
/**
|
|
203
203
|
* When `true`, `entries` is the complete snapshot and any locally cached
|
|
@@ -262,7 +262,7 @@ interface DevframeTerminalsHost {
|
|
|
262
262
|
* {@link DevframePtyTerminalSession.resize}, TUI-capable. The session is
|
|
263
263
|
* marked `interactive`, so a hub-aware terminal UI (e.g. the terminals
|
|
264
264
|
* plugin) surfaces it as writable rather than read-only. Powered by
|
|
265
|
-
* `zigpty
|
|
265
|
+
* `zigpty`; where its native bindings can't load, it degrades to
|
|
266
266
|
* pipe-based terminal emulation.
|
|
267
267
|
*/
|
|
268
268
|
startPtySession: (executeOptions: DevframePtyExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframePtyTerminalSession>;
|
|
@@ -284,7 +284,7 @@ interface DevframeTerminalSessionBase {
|
|
|
284
284
|
/**
|
|
285
285
|
* Whether the session may be restarted in place (re-running its command).
|
|
286
286
|
* Defaults to `true`. Set `false` for sessions whose lifecycle is owned
|
|
287
|
-
* elsewhere
|
|
287
|
+
* elsewhere, e.g. a one-shot build, or a server (like code-server) that
|
|
288
288
|
* should be restarted through its own controls rather than by re-spawning
|
|
289
289
|
* the raw process. A hub-aware terminal UI hides its restart affordance for
|
|
290
290
|
* these, and `hub:terminals:restart` rejects them.
|
|
@@ -302,7 +302,7 @@ interface DevframeChildProcessExecuteOptions {
|
|
|
302
302
|
env?: Record<string, string>;
|
|
303
303
|
}
|
|
304
304
|
/**
|
|
305
|
-
* The settled outcome of a {@link DevframeChildProcessTerminalSession} run
|
|
305
|
+
* The settled outcome of a {@link DevframeChildProcessTerminalSession} run:
|
|
306
306
|
* stdout/stderr captured separately (unlike the session's merged display
|
|
307
307
|
* `stream`), plus the process's exit code (`undefined` if it was killed by a
|
|
308
308
|
* signal before exiting).
|
|
@@ -313,7 +313,7 @@ interface DevframeChildProcessOutput {
|
|
|
313
313
|
exitCode: number | undefined;
|
|
314
314
|
}
|
|
315
315
|
/**
|
|
316
|
-
* A live handle on a child process's outcome
|
|
316
|
+
* A live handle on a child process's outcome, mirroring the ergonomics of
|
|
317
317
|
* `tinyexec`'s `Result` (a promise-like paired with synchronous accessors) so
|
|
318
318
|
* callers migrating from a `tinyexec`/`execa`-based subprocess API (e.g.
|
|
319
319
|
* Nuxt DevTools' `startSubprocess().getResult()`) can adopt
|
|
@@ -334,11 +334,11 @@ interface DevframeChildProcessTerminalSession extends DevframeTerminalSession {
|
|
|
334
334
|
getChildProcess: () => ChildProcess | undefined;
|
|
335
335
|
/**
|
|
336
336
|
* Get a live handle on the current run's outcome. Reflects the most recent
|
|
337
|
-
* `restart()
|
|
337
|
+
* `restart()`; call it again after restarting to track the new run.
|
|
338
338
|
*/
|
|
339
339
|
getResult: () => DevframeChildProcessResult;
|
|
340
340
|
terminate: () => Promise<void>;
|
|
341
|
-
/** Throws `DF8206` once the session's output stream has closed (after a natural exit or `terminate()`)
|
|
341
|
+
/** Throws `DF8206` once the session's output stream has closed (after a natural exit or `terminate()`); drop it with `ctx.terminals.remove(session)` and start a fresh session instead. */
|
|
342
342
|
restart: () => Promise<void>;
|
|
343
343
|
}
|
|
344
344
|
interface DevframePtyExecuteOptions {
|
|
@@ -351,6 +351,23 @@ interface DevframePtyExecuteOptions {
|
|
|
351
351
|
/** Initial row count. Default: 24. */
|
|
352
352
|
rows?: number;
|
|
353
353
|
}
|
|
354
|
+
/**
|
|
355
|
+
* The settled outcome of a {@link DevframePtyTerminalSession} run. PTYs merge
|
|
356
|
+
* stdout and stderr into one terminal output stream, so the captured text is
|
|
357
|
+
* exposed as a single `output` value.
|
|
358
|
+
*/
|
|
359
|
+
interface DevframePtyOutput {
|
|
360
|
+
output: string;
|
|
361
|
+
exitCode: number | undefined;
|
|
362
|
+
signal: number | undefined;
|
|
363
|
+
}
|
|
364
|
+
/** A live handle on the current PTY run's merged output and process state. */
|
|
365
|
+
interface DevframePtyResult extends PromiseLike<DevframePtyOutput> {
|
|
366
|
+
readonly pid: number | undefined;
|
|
367
|
+
/** `undefined` while the process is running or after a signal kill. */
|
|
368
|
+
readonly exitCode: number | undefined;
|
|
369
|
+
readonly killed: boolean;
|
|
370
|
+
}
|
|
354
371
|
interface DevframePtyTerminalSession extends DevframeTerminalSession {
|
|
355
372
|
type: 'pty';
|
|
356
373
|
interactive: true;
|
|
@@ -361,8 +378,13 @@ interface DevframePtyTerminalSession extends DevframeTerminalSession {
|
|
|
361
378
|
resize: (cols: number, rows: number) => void;
|
|
362
379
|
/** Current foreground process name, when the backend can resolve it. */
|
|
363
380
|
getProcessName: () => string | undefined;
|
|
381
|
+
/**
|
|
382
|
+
* Get a live handle on the current run's outcome. Call it again after
|
|
383
|
+
* `restart()` to track the new run.
|
|
384
|
+
*/
|
|
385
|
+
getResult: () => DevframePtyResult;
|
|
364
386
|
terminate: () => Promise<void>;
|
|
365
|
-
/** Throws `DF8206` once the session's output stream has closed (after a natural exit or `terminate()`)
|
|
387
|
+
/** Throws `DF8206` once the session's output stream has closed (after a natural exit or `terminate()`); drop it with `ctx.terminals.remove(session)` and start a fresh session instead. */
|
|
366
388
|
restart: () => Promise<void>;
|
|
367
389
|
}
|
|
368
390
|
//#endregion
|
|
@@ -377,7 +399,7 @@ interface InstallDevframeOptions {
|
|
|
377
399
|
* this to customize the entry's `category`, override the icon, hide it
|
|
378
400
|
* via `when` (or only its dock-bar button via `visibility`), etc. Takes
|
|
379
401
|
* precedence over the definition's own {@link DevframeDefinition.dock}
|
|
380
|
-
* defaults. Cannot change `id`, `type`, or `url
|
|
402
|
+
* defaults. Cannot change `id`, `type`, or `url`, which are derived from
|
|
381
403
|
* the devframe definition.
|
|
382
404
|
*/
|
|
383
405
|
dock?: Partial<Omit<DevframeViewIframe, 'id' | 'type' | 'url'>>;
|
|
@@ -419,7 +441,7 @@ declare module 'devframe/types' {
|
|
|
419
441
|
* Ask the active viewer to switch its focused dock to `dockId`, optionally
|
|
420
442
|
* carrying `params` for the target dock to interpret (e.g.
|
|
421
443
|
* `{ sessionId }` for the terminals dock). Any connected client may call
|
|
422
|
-
* it
|
|
444
|
+
* it, so a mounted devframe in its own iframe steers the host shell's dock
|
|
423
445
|
* selection. Handled by {@link import('./rpc-builtins').hubDocksActivate}.
|
|
424
446
|
*/
|
|
425
447
|
'hub:docks:activate': (input: {
|
|
@@ -455,7 +477,7 @@ declare module 'devframe/types' {
|
|
|
455
477
|
}
|
|
456
478
|
}
|
|
457
479
|
/**
|
|
458
|
-
* Hub-augmented node context
|
|
480
|
+
* Hub-augmented node context that extends devframe's framework-neutral
|
|
459
481
|
* `DevframeNodeContext` with the hub-level subsystems (`docks`,
|
|
460
482
|
* `terminals`, `messages`, `commands`).
|
|
461
483
|
*
|
|
@@ -464,7 +486,7 @@ declare module 'devframe/types' {
|
|
|
464
486
|
* filesystem reveal, etc.) ship as kit-registered RPC functions rather
|
|
465
487
|
* than as part of this surface. JSON-render is an opt-in integration
|
|
466
488
|
* (`@devframes/json-render`) that augments any devframe context and
|
|
467
|
-
* contributes its own dock type
|
|
489
|
+
* contributes its own dock type; use `createJsonRenderView` from
|
|
468
490
|
* `@devframes/json-render/node`.
|
|
469
491
|
*/
|
|
470
492
|
interface DevframeHubContext extends DevframeNodeContext {
|
|
@@ -477,13 +499,13 @@ interface DevframeHubContext extends DevframeNodeContext {
|
|
|
477
499
|
* Install a {@link DevframeDefinition} into this hub: serve its SPA at the
|
|
478
500
|
* resolved base, synthesize an iframe dock from its metadata, and run its
|
|
479
501
|
* `setup(ctx)`. The imperative counterpart to `initHub`'s declarative
|
|
480
|
-
* `devframes` list
|
|
502
|
+
* `devframes` list. Call it from a hub host's `configure(ctx)`, or wherever
|
|
481
503
|
* you hold the context, to plug an extra devframe in.
|
|
482
504
|
*/
|
|
483
505
|
install: (devframe: DevframeDefinition, options?: InstallDevframeOptions) => Promise<void>;
|
|
484
506
|
}
|
|
485
507
|
/**
|
|
486
|
-
* Options for {@link createHubContext}
|
|
508
|
+
* Options for {@link createHubContext}: devframe's
|
|
487
509
|
* {@link CreateHostContextOptions} plus any hub-level additions kits layer on
|
|
488
510
|
* through declaration merging.
|
|
489
511
|
*/
|
|
@@ -496,4 +518,4 @@ interface CreateHubContextOptions extends CreateHostContextOptions {}
|
|
|
496
518
|
*/
|
|
497
519
|
declare function createHubContext(options: CreateHubContextOptions): Promise<DevframeHubContext>;
|
|
498
520
|
//#endregion
|
|
499
|
-
export {
|
|
521
|
+
export { DevframeMessagesLevelShortcuts as A, DevframeMessageEntryInput as C, DevframeMessageShortcutInput as D, DevframeMessageLevel as E, DevframeMessagesClient as O, DevframeMessageEntryFrom as S, DevframeMessageHandle as T, DevframeMessageAction as _, DevframeChildProcessExecuteOptions as a, DevframeMessageElementPosition as b, DevframeChildProcessTerminalSession as c, DevframePtyResult as d, DevframePtyTerminalSession as f, DevframeTerminalsHost as g, DevframeTerminalStatus as h, InstallDevframeOptions as i, DevframeMessagesListDelta as j, DevframeMessagesHost as k, DevframePtyExecuteOptions as l, DevframeTerminalSessionBase as m, DevframeHubContext as n, DevframeChildProcessOutput as o, DevframeTerminalSession as p, createHubContext as r, DevframeChildProcessResult as s, CreateHubContextOptions as t, DevframePtyOutput as u, DevframeMessageActivateAction as v, DevframeMessageFilePosition as w, DevframeMessageEntry as x, DevframeMessageCommandAction as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./context-
|
|
2
|
-
import "./settings-
|
|
1
|
+
import "./context-Di-fhMKP.mjs";
|
|
2
|
+
import "./settings-CWHPzCWS.mjs";
|
|
3
3
|
import { RpcDefinitionsFilter, RpcDefinitionsToFunctions } from "devframe/rpc";
|
|
4
4
|
import { ConnectionMeta as ConnectionMeta$1, DevframeCapabilities, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeHost as DevframeHost$1, DevframeNodeRpcSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeViewHost, EventEmitter as EventEmitter$1, EventUnsubscribe, EventsMap, RpcBroadcastOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost } from "devframe/types";
|
|
5
5
|
export { RpcStreamingHost as S, RpcFunctionsHost as _, DevframeHost$1 as a, RpcStreamingChannel as b, DevframeRpcServerFunctions as c, EventEmitter$1 as d, EventUnsubscribe as f, RpcDefinitionsToFunctions as g, RpcDefinitionsFilter as h, DevframeDiagnosticsLogger as i, DevframeRpcSharedStates as l, RpcBroadcastOptions as m, DevframeCapabilities as n, DevframeNodeRpcSession as o, EventsMap as p, DevframeDiagnosticsHost as r, DevframeRpcClientFunctions as s, ConnectionMeta$1 as t, DevframeViewHost as u, RpcSharedStateGetOptions as v, RpcStreamingChannelOptions as x, RpcSharedStateHost as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import { A as
|
|
3
|
-
import { S as RpcStreamingHost, _ as RpcFunctionsHost, a as DevframeHost, b as RpcStreamingChannel, c as DevframeRpcServerFunctions, d as EventEmitter, f as EventUnsubscribe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, i as DevframeDiagnosticsLogger, l as DevframeRpcSharedStates, m as RpcBroadcastOptions, n as DevframeCapabilities, o as DevframeNodeRpcSession, p as EventsMap, r as DevframeDiagnosticsHost, s as DevframeRpcClientFunctions, t as ConnectionMeta, u as DevframeViewHost, v as RpcSharedStateGetOptions, x as RpcStreamingChannelOptions, y as RpcSharedStateHost } from "./index-
|
|
1
|
+
import { A as DevframeMessagesLevelShortcuts, C as DevframeMessageEntryInput, D as DevframeMessageShortcutInput, E as DevframeMessageLevel, O as DevframeMessagesClient, S as DevframeMessageEntryFrom, T as DevframeMessageHandle, _ as DevframeMessageAction, a as DevframeChildProcessExecuteOptions, b as DevframeMessageElementPosition, c as DevframeChildProcessTerminalSession, d as DevframePtyResult, f as DevframePtyTerminalSession, g as DevframeTerminalsHost, h as DevframeTerminalStatus, j as DevframeMessagesListDelta, k as DevframeMessagesHost, l as DevframePtyExecuteOptions, m as DevframeTerminalSessionBase, n as DevframeHubContext, o as DevframeChildProcessOutput, p as DevframeTerminalSession, s as DevframeChildProcessResult, t as CreateHubContextOptions, u as DevframePtyOutput, v as DevframeMessageActivateAction, w as DevframeMessageFilePosition, x as DevframeMessageEntry, y as DevframeMessageCommandAction } from "./context-Di-fhMKP.mjs";
|
|
2
|
+
import { A as DevframeViewIframe, C as DevframeDockUserEntry, D as DevframeViewBuiltin, E as DevframeViewAction, F as RemoteConnectionInfo, I as RemoteDockOptions, M as DevframeViewLauncherStatus, N as FrameSubTabsConfig, O as DevframeViewCustomRender, P as NavTarget, S as DevframeDockPanelState, T as DevframeDocksHost, _ as DevframeDockEntry, a as DevframeCommandEntry, b as DevframeDockEntryIcon, c as DevframeCommandShortcutOverrides, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, g as DevframeDockEntriesGrouped, h as DevframeDockBadgeVariant, i as DevframeCommandBase, j as DevframeViewLauncher, k as DevframeViewGroup, l as DevframeCommandsHost, m as DevframeDockActivation, n as DevframeClientCommand, o as DevframeCommandHandle, p as ClientScriptEntry, r as DevframeCommandAgentOptions, s as DevframeCommandKeybinding, t as DevframeDocksUserSettings, u as DevframeCommandsHostEvents, v as DevframeDockEntryBase, w as DevframeDocksActiveState, x as DevframeDockEntryRegistry, y as DevframeDockEntryCategory } from "./settings-CWHPzCWS.mjs";
|
|
3
|
+
import { S as RpcStreamingHost, _ as RpcFunctionsHost, a as DevframeHost, b as RpcStreamingChannel, c as DevframeRpcServerFunctions, d as EventEmitter, f as EventUnsubscribe, g as RpcDefinitionsToFunctions, h as RpcDefinitionsFilter, i as DevframeDiagnosticsLogger, l as DevframeRpcSharedStates, m as RpcBroadcastOptions, n as DevframeCapabilities, o as DevframeNodeRpcSession, p as EventsMap, r as DevframeDiagnosticsHost, s as DevframeRpcClientFunctions, t as ConnectionMeta, u as DevframeViewHost, v as RpcSharedStateGetOptions, x as RpcStreamingChannelOptions, y as RpcSharedStateHost } from "./index-faD2d5iX.mjs";
|
|
4
4
|
import { WhenContext, WhenExpression } from "devframe/utils/when";
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineHubRpcFunction: <NAME extends string, TYPE extends import("devframe/rpc").RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends import("devframe/rpc").RpcArgsSchema | undefined = undefined, const RS extends import("devframe/rpc").RpcReturnSchema | undefined = undefined>(definition: import("devframe/rpc").RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>) => import("devframe/rpc").RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>;
|
|
@@ -12,4 +12,4 @@ declare function defineDockEntry<const T extends DevframeDockUserEntry, const W
|
|
|
12
12
|
visibility?: WhenExpression<WhenContext, V>;
|
|
13
13
|
}): T;
|
|
14
14
|
//#endregion
|
|
15
|
-
export { type ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, type DevframeChildProcessExecuteOptions, type DevframeChildProcessOutput, type DevframeChildProcessResult, type DevframeChildProcessTerminalSession, type DevframeClientCommand, type DevframeCommandAgentOptions, type DevframeCommandBase, type DevframeCommandEntry, type DevframeCommandHandle, type DevframeCommandKeybinding, type DevframeCommandShortcutOverrides, type DevframeCommandsHost, type DevframeCommandsHostEvents, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockActivation, type DevframeDockBadgeVariant, type DevframeDockEntriesGrouped, type DevframeDockEntry, type DevframeDockEntryBase, type DevframeDockEntryCategory, type DevframeDockEntryIcon, type DevframeDockEntryRegistry, type DevframeDockUserEntry, type DevframeDocksActiveState, type DevframeDocksHost, type DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, type DevframeMessageAction, type DevframeMessageActivateAction, type DevframeMessageCommandAction, type DevframeMessageElementPosition, type DevframeMessageEntry, type DevframeMessageEntryFrom, type DevframeMessageEntryInput, type DevframeMessageFilePosition, type DevframeMessageHandle, type DevframeMessageLevel, type DevframeMessageShortcutInput, type DevframeMessagesClient, type DevframeMessagesHost, type DevframeMessagesLevelShortcuts, type DevframeMessagesListDelta, type DevframeNodeRpcSession, type DevframePtyExecuteOptions, type DevframePtyTerminalSession, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeServerCommandEntry, type DevframeServerCommandInput, type DevframeTerminalSession, type DevframeTerminalSessionBase, type DevframeTerminalStatus, type DevframeTerminalsHost, type DevframeViewAction, type DevframeViewBuiltin, type DevframeViewCustomRender, type DevframeViewGroup, type DevframeViewHost, type DevframeViewIframe, type DevframeViewLauncher, type DevframeViewLauncherStatus, type EventEmitter, type EventUnsubscribe, type EventsMap, type FrameSubTabsConfig, type NavTarget, type RemoteConnectionInfo, type RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, defineCommand, defineDockEntry, defineHubRpcFunction };
|
|
15
|
+
export { type ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, type DevframeChildProcessExecuteOptions, type DevframeChildProcessOutput, type DevframeChildProcessResult, type DevframeChildProcessTerminalSession, type DevframeClientCommand, type DevframeCommandAgentOptions, type DevframeCommandBase, type DevframeCommandEntry, type DevframeCommandHandle, type DevframeCommandKeybinding, type DevframeCommandShortcutOverrides, type DevframeCommandsHost, type DevframeCommandsHostEvents, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockActivation, type DevframeDockBadgeVariant, type DevframeDockEntriesGrouped, type DevframeDockEntry, type DevframeDockEntryBase, type DevframeDockEntryCategory, type DevframeDockEntryIcon, type DevframeDockEntryRegistry, type DevframeDockPanelState, type DevframeDockUserEntry, type DevframeDocksActiveState, type DevframeDocksHost, type DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, type DevframeMessageAction, type DevframeMessageActivateAction, type DevframeMessageCommandAction, type DevframeMessageElementPosition, type DevframeMessageEntry, type DevframeMessageEntryFrom, type DevframeMessageEntryInput, type DevframeMessageFilePosition, type DevframeMessageHandle, type DevframeMessageLevel, type DevframeMessageShortcutInput, type DevframeMessagesClient, type DevframeMessagesHost, type DevframeMessagesLevelShortcuts, type DevframeMessagesListDelta, type DevframeNodeRpcSession, type DevframePtyExecuteOptions, type DevframePtyOutput, type DevframePtyResult, type DevframePtyTerminalSession, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeServerCommandEntry, type DevframeServerCommandInput, type DevframeTerminalSession, type DevframeTerminalSessionBase, type DevframeTerminalStatus, type DevframeTerminalsHost, type DevframeViewAction, type DevframeViewBuiltin, type DevframeViewCustomRender, type DevframeViewGroup, type DevframeViewHost, type DevframeViewIframe, type DevframeViewLauncher, type DevframeViewLauncherStatus, type EventEmitter, type EventUnsubscribe, type EventsMap, type FrameSubTabsConfig, type NavTarget, type RemoteConnectionInfo, type RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, defineCommand, defineDockEntry, defineHubRpcFunction };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as
|
|
2
|
-
import {
|
|
1
|
+
import { C as DevframeMessageEntryInput, D as DevframeMessageShortcutInput, T as DevframeMessageHandle, a as DevframeChildProcessExecuteOptions, c as DevframeChildProcessTerminalSession, f as DevframePtyTerminalSession, g as DevframeTerminalsHost$1, i as InstallDevframeOptions, j as DevframeMessagesListDelta, k as DevframeMessagesHost$1, l as DevframePtyExecuteOptions, m as DevframeTerminalSessionBase, n as DevframeHubContext, p as DevframeTerminalSession, r as createHubContext, t as CreateHubContextOptions, x as DevframeMessageEntry } from "../context-Di-fhMKP.mjs";
|
|
2
|
+
import { C as DevframeDockUserEntry, T as DevframeDocksHost$1, _ as DevframeDockEntry, d as DevframeServerCommandEntry, f as DevframeServerCommandInput, l as DevframeCommandsHost$1, o as DevframeCommandHandle, p as ClientScriptEntry, t as DevframeDocksUserSettings } from "../settings-CWHPzCWS.mjs";
|
|
3
3
|
import { RpcFunctionDefinitionAny } from "devframe/rpc";
|
|
4
4
|
import { SharedState } from "devframe/utils/shared-state";
|
|
5
5
|
//#region src/node/host-commands.d.ts
|
|
@@ -9,7 +9,7 @@ declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
|
9
9
|
readonly events: DevframeCommandsHost$1['events'];
|
|
10
10
|
/**
|
|
11
11
|
* Lazy agent projection: `ctx.agent` queries this provider at list/invoke
|
|
12
|
-
* time, deriving tools from {@link commands} on demand
|
|
12
|
+
* time, deriving tools from {@link commands} on demand, so the commands map
|
|
13
13
|
* stays the single source of truth, nothing is mirrored or kept in sync.
|
|
14
14
|
*/
|
|
15
15
|
private readonly agentProvider;
|
|
@@ -27,7 +27,7 @@ declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
|
27
27
|
* agent-flagged, handler-bearing command (children included) becomes a
|
|
28
28
|
* callable tool. Queried lazily by the provider registered in the
|
|
29
29
|
* constructor. `when` clauses evaluate client-side only and are not
|
|
30
|
-
* enforced here
|
|
30
|
+
* enforced here; opting in a `when`-gated command is a deliberate author
|
|
31
31
|
* decision (documented on `DevframeCommandAgentOptions`).
|
|
32
32
|
*/
|
|
33
33
|
private collectAgentTools;
|
|
@@ -52,7 +52,7 @@ declare class DevframeDocksHost implements DevframeDocksHost$1 {
|
|
|
52
52
|
update(view: DevframeDockUserEntry): void;
|
|
53
53
|
activate(dockId: string, params?: Record<string, unknown>): void;
|
|
54
54
|
/**
|
|
55
|
-
* Warn (don't throw
|
|
55
|
+
* Warn (don't throw, since a client-runtime `resolveClientModule` override may still cover
|
|
56
56
|
* it) when a dock declares a **bare-specifier** client script on a host
|
|
57
57
|
* that advertises no `staticConfig.dock.clientModuleResolution`: the
|
|
58
58
|
* browser cannot resolve a bare npm specifier natively, so the script is
|
|
@@ -79,7 +79,7 @@ declare class DevframeMessagesHost implements DevframeMessagesHost$1 {
|
|
|
79
79
|
private _clock;
|
|
80
80
|
/**
|
|
81
81
|
* The tick of the newest removal record dropped from the capped
|
|
82
|
-
* `removals` log
|
|
82
|
+
* `removals` log; cursors older than this can't get a reliable delta
|
|
83
83
|
* and fall back to a full snapshot in {@link listSince}.
|
|
84
84
|
*/
|
|
85
85
|
private _removalsTrimmedAt;
|
|
@@ -113,14 +113,23 @@ declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
|
|
|
113
113
|
private _channel?;
|
|
114
114
|
constructor(context: DevframeHubContext);
|
|
115
115
|
/**
|
|
116
|
-
* Lazily acquire the streaming channel
|
|
116
|
+
* Lazily acquire the streaming channel, since `context.rpc` isn't assigned
|
|
117
117
|
* until after every host is constructed, so we can't grab it in the
|
|
118
118
|
* constructor.
|
|
119
119
|
*/
|
|
120
120
|
private getStreamingChannel;
|
|
121
|
+
/**
|
|
122
|
+
* Per-run stream lifecycle shared by the child-process and PTY paths: guards
|
|
123
|
+
* the single-close/error transition and keeps the session's `status` in step
|
|
124
|
+
* with the process lifecycle (a hub-aware client sees `running` →
|
|
125
|
+
* `stopped`/`error` instead of a value frozen at spawn time).
|
|
126
|
+
*/
|
|
127
|
+
private createStreamLifecycle;
|
|
121
128
|
register(session: DevframeTerminalSession): DevframeTerminalSession;
|
|
122
129
|
update(patch: PartialWithoutId<DevframeTerminalSession>): void;
|
|
123
130
|
remove(session: DevframeTerminalSession): void;
|
|
131
|
+
/** Drain a session's output stream into its scrollback buffer and streaming sink. */
|
|
132
|
+
private pumpStream;
|
|
124
133
|
private bindStream;
|
|
125
134
|
startChildProcess(executeOptions: DevframeChildProcessExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>): Promise<DevframeChildProcessTerminalSession>;
|
|
126
135
|
startPtySession(executeOptions: DevframePtyExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>): Promise<DevframePtyTerminalSession>;
|
|
@@ -128,7 +137,7 @@ declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
|
|
|
128
137
|
//#endregion
|
|
129
138
|
//#region src/node/rpc-builtins.d.ts
|
|
130
139
|
/**
|
|
131
|
-
* `hub:commands:execute
|
|
140
|
+
* `hub:commands:execute`: Invoke a registered server command by id. The
|
|
132
141
|
* arguments after `id` are forwarded to the command's `handler(...)`.
|
|
133
142
|
* Returns whatever the handler returns.
|
|
134
143
|
*
|
|
@@ -151,7 +160,7 @@ declare const hubCommandsExecute: {
|
|
|
151
160
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>> | undefined;
|
|
152
161
|
};
|
|
153
162
|
/**
|
|
154
|
-
* `hub:messages:add
|
|
163
|
+
* `hub:messages:add`: Add a message from a browser client into the hub's
|
|
155
164
|
* messages subsystem. Marked `from: 'browser'`. Returns the serializable
|
|
156
165
|
* entry (the mutation handle stays server-side).
|
|
157
166
|
*
|
|
@@ -174,7 +183,7 @@ declare const hubMessagesAdd: {
|
|
|
174
183
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[input: DevframeMessageEntryInput], Promise<DevframeMessageEntry>>>> | undefined;
|
|
175
184
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[input: DevframeMessageEntryInput], Promise<DevframeMessageEntry>>> | undefined;
|
|
176
185
|
};
|
|
177
|
-
/** `hub:messages:update
|
|
186
|
+
/** `hub:messages:update`: Patch a message by id; returns the updated entry (or `undefined`). */
|
|
178
187
|
declare const hubMessagesUpdate: {
|
|
179
188
|
name: "hub:messages:update";
|
|
180
189
|
type?: "action" | undefined;
|
|
@@ -190,7 +199,7 @@ declare const hubMessagesUpdate: {
|
|
|
190
199
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, patch: Partial<DevframeMessageEntryInput>], Promise<DevframeMessageEntry | undefined>>>> | undefined;
|
|
191
200
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, patch: Partial<DevframeMessageEntryInput>], Promise<DevframeMessageEntry | undefined>>> | undefined;
|
|
192
201
|
};
|
|
193
|
-
/** `hub:messages:remove
|
|
202
|
+
/** `hub:messages:remove`: Remove a message by id. */
|
|
194
203
|
declare const hubMessagesRemove: {
|
|
195
204
|
name: "hub:messages:remove";
|
|
196
205
|
type?: "action" | undefined;
|
|
@@ -206,7 +215,7 @@ declare const hubMessagesRemove: {
|
|
|
206
215
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>> | undefined;
|
|
207
216
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
208
217
|
};
|
|
209
|
-
/** `hub:messages:clear
|
|
218
|
+
/** `hub:messages:clear`: Remove every message. */
|
|
210
219
|
declare const hubMessagesClear: {
|
|
211
220
|
name: "hub:messages:clear";
|
|
212
221
|
type?: "action" | undefined;
|
|
@@ -223,7 +232,7 @@ declare const hubMessagesClear: {
|
|
|
223
232
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[], Promise<void>>> | undefined;
|
|
224
233
|
};
|
|
225
234
|
/**
|
|
226
|
-
* `hub:terminals:write
|
|
235
|
+
* `hub:terminals:write`: Send input to an interactive PTY session spawned
|
|
227
236
|
* via `ctx.terminals.startPtySession`. Lets a hub-aware terminal UI (e.g. the
|
|
228
237
|
* terminals plugin) drive a session owned by another plugin.
|
|
229
238
|
*/
|
|
@@ -242,7 +251,7 @@ declare const hubTerminalsWrite: {
|
|
|
242
251
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, data: string], Promise<void>>>> | undefined;
|
|
243
252
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, data: string], Promise<void>>> | undefined;
|
|
244
253
|
};
|
|
245
|
-
/** `hub:terminals:resize
|
|
254
|
+
/** `hub:terminals:resize`: Resize an interactive PTY session by id. */
|
|
246
255
|
declare const hubTerminalsResize: {
|
|
247
256
|
name: "hub:terminals:resize";
|
|
248
257
|
type?: "action" | undefined;
|
|
@@ -259,7 +268,7 @@ declare const hubTerminalsResize: {
|
|
|
259
268
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, cols: number, rows: number], Promise<void>>> | undefined;
|
|
260
269
|
};
|
|
261
270
|
/**
|
|
262
|
-
* `hub:terminals:terminate
|
|
271
|
+
* `hub:terminals:terminate`: Kill a session's process while keeping the
|
|
263
272
|
* session registered (its output/scrollback stays). Works for both read-only
|
|
264
273
|
* child-process and interactive PTY sessions, letting a hub-aware terminal UI
|
|
265
274
|
* force-kill a session owned by another plugin.
|
|
@@ -280,7 +289,7 @@ declare const hubTerminalsTerminate: {
|
|
|
280
289
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
281
290
|
};
|
|
282
291
|
/**
|
|
283
|
-
* `hub:terminals:restart
|
|
292
|
+
* `hub:terminals:restart`: Re-run a session's command in place. Rejected for
|
|
284
293
|
* sessions registered with `restartable: false`, whose lifecycle is owned
|
|
285
294
|
* elsewhere.
|
|
286
295
|
*/
|
|
@@ -300,7 +309,7 @@ declare const hubTerminalsRestart: {
|
|
|
300
309
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
301
310
|
};
|
|
302
311
|
/**
|
|
303
|
-
* `hub:terminals:remove
|
|
312
|
+
* `hub:terminals:remove`: Kill a session's process (when it still owns one)
|
|
304
313
|
* and drop it from the registry, disposing its output stream. Lets a hub-aware
|
|
305
314
|
* terminal UI discard a stopped aggregated session.
|
|
306
315
|
*/
|
|
@@ -320,13 +329,13 @@ declare const hubTerminalsRemove: {
|
|
|
320
329
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
321
330
|
};
|
|
322
331
|
/**
|
|
323
|
-
* `hub:docks:activate
|
|
332
|
+
* `hub:docks:activate`: Ask the active viewer to switch its focused dock to
|
|
324
333
|
* `dockId`, optionally carrying `params` for the target dock to interpret
|
|
325
334
|
* (e.g. `{ sessionId }` for the terminals dock to focus a session).
|
|
326
335
|
*
|
|
327
336
|
* Any connected client may call it, which is the point: a mounted devframe
|
|
328
337
|
* running in its own iframe (on its own RPC client) can steer the host shell's
|
|
329
|
-
* dock selection
|
|
338
|
+
* dock selection, client-local state it otherwise can't reach. The hub
|
|
330
339
|
* broadcasts the request live to connected clients (the host shell switches)
|
|
331
340
|
* and mirrors it into the `devframe:docks:active` shared state (a dock that
|
|
332
341
|
* mounts in response still converges on it).
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { _ as DevframeDocksHost, a as hubMessagesAdd, c as hubMessagesUpdate, d as hubTerminalsRestart, f as hubTerminalsTerminate, g as DevframeMessagesHost, h as DevframeTerminalsHost, i as hubDocksActivate, l as hubTerminalsRemove, n as builtinHubRpcDeclarations, o as hubMessagesClear, p as hubTerminalsWrite, r as hubCommandsExecute, s as hubMessagesRemove, t as createHubContext, u as hubTerminalsResize, v as DevframeCommandsHost } from "../context-
|
|
1
|
+
import { _ as DevframeDocksHost, a as hubMessagesAdd, c as hubMessagesUpdate, d as hubTerminalsRestart, f as hubTerminalsTerminate, g as DevframeMessagesHost, h as DevframeTerminalsHost, i as hubDocksActivate, l as hubTerminalsRemove, n as builtinHubRpcDeclarations, o as hubMessagesClear, p as hubTerminalsWrite, r as hubCommandsExecute, s as hubMessagesRemove, t as createHubContext, u as hubTerminalsResize, v as DevframeCommandsHost } from "../context-D4L966cN.mjs";
|
|
2
2
|
import "ufo";
|
|
3
3
|
import "pathe";
|
|
4
4
|
import "node:process";
|
|
5
|
-
import { builtinModules } from "node:module";
|
|
6
5
|
import "node:fs";
|
|
6
|
+
import { builtinModules } from "node:module";
|
|
7
7
|
import "node:url";
|
|
8
8
|
import assert from "node:assert";
|
|
9
9
|
import "node:path";
|
package/dist/node/initiate.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as InstallDevframeOptions, n as DevframeHubContext, t as CreateHubContextOptions } from "../context-
|
|
2
|
-
import { r as DEVFRAMES_HUB_BASE } from "../constants-
|
|
1
|
+
import { i as InstallDevframeOptions, n as DevframeHubContext, t as CreateHubContextOptions } from "../context-Di-fhMKP.mjs";
|
|
2
|
+
import { r as DEVFRAMES_HUB_BASE } from "../constants-Coo1p3ja.mjs";
|
|
3
3
|
import { DevframeInstanceRecord } from "devframe/internal";
|
|
4
4
|
import { ConnectionMeta, DevframeDefinition, DevframeServiceInput, DevframeSseOptions, DevframeStorageScope, DevframeWsOptions, McpRouteOptions } from "devframe/types";
|
|
5
5
|
import { DevframeAuthHandler } from "devframe/node/auth";
|
|
@@ -20,14 +20,14 @@ type Arrayable<T> = T | readonly T[];
|
|
|
20
20
|
* One dock-type → prebuilt renderer-module registration for
|
|
21
21
|
* {@link InitHubOptions.renderers}. The hub serves the module at
|
|
22
22
|
* `<base>__renderers/<type>.mjs` and publishes it in the renderer manifest
|
|
23
|
-
* (the `devframe:dock-renderers` shared-state slot), so any viewer
|
|
24
|
-
* reference UI, a community viewer, a hand-rolled host page
|
|
23
|
+
* (the `devframe:dock-renderers` shared-state slot), so any viewer (the
|
|
24
|
+
* reference UI, a community viewer, a hand-rolled host page) lazily imports
|
|
25
25
|
* it the first time a dock of that `type` needs rendering.
|
|
26
26
|
*
|
|
27
27
|
* The module must be a **self-contained browser ES module** (its framework
|
|
28
28
|
* and styles bundled in) whose {@link DockRendererRegistration.importName}
|
|
29
29
|
* export is a ready `DockRenderer`. Renderer packages ship a node helper
|
|
30
|
-
* returning this shape
|
|
30
|
+
* returning this shape, e.g. `jsonRenderUiRenderer()` from
|
|
31
31
|
* `@devframes/json-render-ui/hub`.
|
|
32
32
|
*/
|
|
33
33
|
interface DockRendererRegistration {
|
|
@@ -43,7 +43,7 @@ interface DockRendererRegistration {
|
|
|
43
43
|
importName?: string;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
|
-
* The UI slot of a hub instance
|
|
46
|
+
* The UI slot of a hub instance: pure data, zero policy. The hub itself is
|
|
47
47
|
* headless: whoever fills this slot decides what a viewer looks like.
|
|
48
48
|
* `@devframes/hub-ui` ships the reference implementation (`createUi()`);
|
|
49
49
|
* Vite DevTools or any community viewer supplies its own object to the same
|
|
@@ -52,14 +52,14 @@ interface DockRendererRegistration {
|
|
|
52
52
|
interface DevframeHubUi {
|
|
53
53
|
/**
|
|
54
54
|
* A standalone viewer SPA (built with relative asset paths) served at the
|
|
55
|
-
* hub base itself
|
|
55
|
+
* hub base itself; open `<base>` in a tab and the devtools are there.
|
|
56
56
|
*/
|
|
57
57
|
viewer?: {
|
|
58
58
|
/** Directory of the prebuilt viewer SPA. */
|
|
59
59
|
distDir: string;
|
|
60
60
|
};
|
|
61
61
|
/**
|
|
62
|
-
* A prebuilt, self-contained script served at `<base>embedded.js
|
|
62
|
+
* A prebuilt, self-contained script served at `<base>embedded.js`: the
|
|
63
63
|
* floating-devtools bootstrap a host page loads with one
|
|
64
64
|
* `<script type="module" src="<base>embedded.js">` tag. Visibility policy
|
|
65
65
|
* (always-on, keyboard-summoned, …) belongs entirely to this entry.
|
|
@@ -77,8 +77,8 @@ interface DevframeHubUi {
|
|
|
77
77
|
*/
|
|
78
78
|
assets?: Record<string, () => string | Uint8Array>;
|
|
79
79
|
/**
|
|
80
|
-
* A setup hook run once during hub init with the hub context
|
|
81
|
-
* slot
|
|
80
|
+
* A setup hook run once during hub init with the hub context, giving the UI
|
|
81
|
+
* slot a chance to publish its own static, boot-time config through the
|
|
82
82
|
* generic `ctx.staticConfig` (serialized into `ConnectionMeta.configs`).
|
|
83
83
|
* The reference UI's `createUi()` uses it to set
|
|
84
84
|
* `ctx.staticConfig.ui = { branding, … }`, reaching every mounted frame and
|
|
@@ -98,7 +98,7 @@ interface InitHubOptions {
|
|
|
98
98
|
*/
|
|
99
99
|
version?: string;
|
|
100
100
|
/**
|
|
101
|
-
* Mount base the hub answers under
|
|
101
|
+
* Mount base the hub answers under, required so the mount path is
|
|
102
102
|
* explicit at the call site (pass the exported {@link DEVFRAMES_HUB_BASE}
|
|
103
103
|
* for the conventional `/__devframes/`). Every mounted devframe lives at
|
|
104
104
|
* `<base><id>/`, so the host app needs exactly one catch-all route. The
|
|
@@ -118,19 +118,19 @@ interface InitHubOptions {
|
|
|
118
118
|
* Host-level wire services to install, on top of whatever the mounted
|
|
119
119
|
* devframes declare. Constructed (option sets merged) at the pre-setup
|
|
120
120
|
* barrier, so every devframe's `setup` sees them ready. Reach for this to
|
|
121
|
-
* configure a shared service centrally
|
|
121
|
+
* configure a shared service centrally, e.g.
|
|
122
122
|
* `services: [createShikiService({ themes })]`.
|
|
123
123
|
*/
|
|
124
124
|
services?: DevframeServiceInput[];
|
|
125
125
|
/**
|
|
126
126
|
* Extra RPC declarations registered at context creation, alongside the
|
|
127
|
-
* hub built-ins
|
|
127
|
+
* hub built-ins, forwarded to `createHubContext`'s
|
|
128
128
|
* `builtinRpcDeclarations`. Declarative mode only (a pre-built `context`
|
|
129
129
|
* already made this choice).
|
|
130
130
|
*/
|
|
131
131
|
rpcDeclarations?: CreateHubContextOptions['builtinRpcDeclarations'];
|
|
132
132
|
/**
|
|
133
|
-
* Bring your own hub context instead of `devframes
|
|
133
|
+
* Bring your own hub context instead of `devframes`, for hosts that
|
|
134
134
|
* assemble `createHubContext` + `ctx.install` themselves (with their own
|
|
135
135
|
* `DevframeHost` serving the frames). The instance then serves only the
|
|
136
136
|
* hub-level endpoints (`__connection.json`, `__index.json`,
|
|
@@ -139,14 +139,14 @@ interface InitHubOptions {
|
|
|
139
139
|
*/
|
|
140
140
|
context?: DevframeHubContext;
|
|
141
141
|
/**
|
|
142
|
-
* Runs once the context exists and every `devframes` entry is mounted
|
|
142
|
+
* Runs once the context exists and every `devframes` entry is mounted;
|
|
143
143
|
* register docks, commands, terminals, and messages surfaces here.
|
|
144
144
|
*/
|
|
145
145
|
configure?: (ctx: DevframeHubContext) => void | Promise<void>;
|
|
146
|
-
/** See {@link DevframeHubUi}
|
|
146
|
+
/** See {@link DevframeHubUi}; omitted, the hub stays fully headless. */
|
|
147
147
|
ui?: DevframeHubUi;
|
|
148
148
|
/**
|
|
149
|
-
* Prebuilt dock-renderer modules to serve and advertise
|
|
149
|
+
* Prebuilt dock-renderer modules to serve and advertise: the composition
|
|
150
150
|
* seam that hands a renderer package (e.g. `@devframes/json-render-ui`) to
|
|
151
151
|
* a prebuilt viewer. Each {@link DockRendererRegistration} is served at
|
|
152
152
|
* `<base>__renderers/<type>.mjs` and published in the renderer manifest;
|
|
@@ -175,11 +175,11 @@ interface InitHubOptions {
|
|
|
175
175
|
* > `ws.sidecar` (auto-port side-car) > the host driving upgrades itself,
|
|
176
176
|
* while `url` overrides the advertisement (tunnel pattern) and `route`
|
|
177
177
|
* renames the upgrade segment (default `__ws`). Pass `false` to serve no
|
|
178
|
-
* WebSocket at all
|
|
178
|
+
* WebSocket at all, so clients connect over SSE instead (`backend: 'sse'`).
|
|
179
179
|
*/
|
|
180
180
|
ws?: DevframeWsOptions | false;
|
|
181
181
|
/**
|
|
182
|
-
* SSE RPC endpoint control, same contract as `initDevframe
|
|
182
|
+
* SSE RPC endpoint control, same contract as `initDevframe`, enabled by
|
|
183
183
|
* default at `<base>__sse` as the more portable transport alongside the
|
|
184
184
|
* WebSocket. Pass `false` to disable, or a {@link DevframeSseOptions} to
|
|
185
185
|
* rename the route.
|
|
@@ -195,9 +195,14 @@ interface InitHubOptions {
|
|
|
195
195
|
*/
|
|
196
196
|
auth?: boolean | DevframeAuthHandler;
|
|
197
197
|
/**
|
|
198
|
-
* Expose the **aggregate** MCP endpoint at `<base>__mcp
|
|
198
|
+
* Expose the **aggregate** MCP endpoint at `<base>__mcp`: one
|
|
199
199
|
* Streamable-HTTP server over the shared context's whole tool registry
|
|
200
|
-
* (ids are already namespaced per plugin). Disabled by default
|
|
200
|
+
* (ids are already namespaced per plugin). Disabled by default; `true`
|
|
201
|
+
* mounts it with the loopback origin gate (trusting same-machine callers),
|
|
202
|
+
* an object opts into an {@link McpRouteOptions.authorization} identity
|
|
203
|
+
* check. A mounted devframe's own `mcp` setting is ignored: the hub's
|
|
204
|
+
* aggregate route covers them all (`DF8005` warns when one asks for MCP
|
|
205
|
+
* while this is off).
|
|
201
206
|
*/
|
|
202
207
|
mcp?: boolean | McpRouteOptions;
|
|
203
208
|
/**
|
|
@@ -217,14 +222,14 @@ interface InitHubOptions {
|
|
|
217
222
|
register?: boolean | Partial<DevframeInstanceRecord>;
|
|
218
223
|
/**
|
|
219
224
|
* Advertise that this host runtime resolves **bare-specifier** client
|
|
220
|
-
* scripts (`ClientScriptEntry.importFrom` naming an npm module)
|
|
225
|
+
* scripts (`ClientScriptEntry.importFrom` naming an npm module): a URL
|
|
221
226
|
* template whose `{specifier}` token is replaced with the specifier,
|
|
222
227
|
* published as `ConnectionMeta.configs.dock.clientModuleResolution` and
|
|
223
228
|
* applied by every client-script loader. Declare it only when the host can
|
|
224
|
-
* actually serve npm modules to the browser
|
|
229
|
+
* actually serve npm modules to the browser; a Vite host passes
|
|
225
230
|
* `'/@id/{specifier}'` to route imports through its own module graph
|
|
226
231
|
* (`@devframes/vite/hub` does). Left undeclared, registering a
|
|
227
|
-
* bare-specifier client script warns `DF8111
|
|
232
|
+
* bare-specifier client script warns `DF8111`; ship a self-contained
|
|
228
233
|
* bundle and pass its URL instead.
|
|
229
234
|
*/
|
|
230
235
|
clientModuleResolution?: string;
|
|
@@ -240,12 +245,12 @@ interface InitHubOptions {
|
|
|
240
245
|
interface HubInstance {
|
|
241
246
|
/**
|
|
242
247
|
* The normalized mount base this hub answers under (leading and trailing
|
|
243
|
-
* slash, e.g. `/__devframes/`). Reference it when wiring the mount
|
|
244
|
-
* guards, middleware path checks
|
|
248
|
+
* slash, e.g. `/__devframes/`). Reference it when wiring the mount (route
|
|
249
|
+
* guards, middleware path checks) instead of repeating the string literal.
|
|
245
250
|
*/
|
|
246
251
|
base: string;
|
|
247
252
|
/**
|
|
248
|
-
* Web-standard request handler for the whole hub
|
|
253
|
+
* Web-standard request handler for the whole hub; mount it on one
|
|
249
254
|
* catch-all route under {@link HubInstance.base}.
|
|
250
255
|
*/
|
|
251
256
|
handler: (request: Request) => Promise<Response>;
|
|
@@ -253,7 +258,7 @@ interface HubInstance {
|
|
|
253
258
|
nodeMiddleware: (req: IncomingMessage, res: ServerResponse, next?: (err?: unknown) => void) => void;
|
|
254
259
|
/**
|
|
255
260
|
* Route a host server's `upgrade` events to the shared RPC socket,
|
|
256
|
-
* returning a detach function
|
|
261
|
+
* returning a detach function, the manual counterpart to the `server`
|
|
257
262
|
* option, for hosts that get their `node:http` server only after the hub
|
|
258
263
|
* exists. Available on the default tier; a configured transport (`server`,
|
|
259
264
|
* `ws.port`, `ws.sidecar`, `ws.url`) already owns the socket and reports
|
|
@@ -276,14 +281,14 @@ interface HubInstance {
|
|
|
276
281
|
close: () => Promise<void>;
|
|
277
282
|
}
|
|
278
283
|
/**
|
|
279
|
-
* Initiate a hub instance
|
|
284
|
+
* Initiate a hub instance: the whole multi-devframe devtools surface
|
|
280
285
|
* behind one framework-agnostic, web-standard handler. Every mounted
|
|
281
286
|
* devframe shares one context (merged RPC registry, shared state, docks /
|
|
282
287
|
* terminals / messages / commands), one WebSocket transport, and one Auth;
|
|
283
288
|
* the instance serves each frame's SPA at `<base><id>/`, the discovery
|
|
284
289
|
* endpoints (`__connection.json`, `__index.json`, `__client-imports.js`),
|
|
285
290
|
* the aggregate MCP route, and whatever the {@link DevframeHubUi} slot
|
|
286
|
-
* provides
|
|
291
|
+
* provides, while the hub itself stays headless.
|
|
287
292
|
*
|
|
288
293
|
* The factory is synchronous and initializes eagerly, and binds no port of
|
|
289
294
|
* its own: the WebSocket follows `server` / `ws` (see
|