@devframes/hub 0.7.4 → 0.7.6
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 +64 -4
- package/dist/client/index.mjs +43 -0
- package/dist/constants.d.mts +1 -1
- package/dist/{context-vip-UA-J.d.mts → context-ChGTyDu-.d.mts} +16 -8
- package/dist/{define-Dp-x6d09.mjs → define-Ceekw2EO.mjs} +1 -4
- package/dist/{index-BvRGGB3C.d.mts → index-BCVXXhEH.d.mts} +2 -2
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -2
- package/dist/node/index.d.mts +64 -3
- package/dist/node/index.mjs +68 -22
- package/dist/{settings-qfQQ1nTD.d.mts → settings-ywInLQJ3.d.mts} +27 -36
- package/dist/types/index.d.mts +4 -4
- package/package.json +5 -5
package/dist/client/index.d.mts
CHANGED
|
@@ -1,11 +1,58 @@
|
|
|
1
|
-
import { S as DevframeMessagesClient, _ as DevframeMessageEntryInput } from "../context-
|
|
2
|
-
import { A as RemoteConnectionInfo, h as DevframeDockEntry, i as DevframeCommandEntry, m as DevframeDockEntriesGrouped, n as DevframeClientCommand, o as DevframeCommandKeybinding, t as DevframeDocksUserSettings
|
|
3
|
-
import "../index-
|
|
1
|
+
import { S as DevframeMessagesClient, _ as DevframeMessageEntryInput } from "../context-ChGTyDu-.mjs";
|
|
2
|
+
import { A as RemoteConnectionInfo, b as DevframeDockUserEntry, h as DevframeDockEntry, i as DevframeCommandEntry, m as DevframeDockEntriesGrouped, n as DevframeClientCommand, o as DevframeCommandKeybinding, t as DevframeDocksUserSettings } from "../settings-ywInLQJ3.mjs";
|
|
3
|
+
import "../index-BCVXXhEH.mjs";
|
|
4
4
|
import { DevframeClientRpcHost, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientOptions, DevframeRpcContext, RpcClientEvents, RpcClientEvents as RpcClientEvents$1 } from "devframe/client";
|
|
5
5
|
import { EventEmitter } from "devframe/types";
|
|
6
6
|
import { SharedState } from "devframe/utils/shared-state";
|
|
7
7
|
import { WhenContext } from "devframe/utils/when";
|
|
8
8
|
export * from "devframe/client";
|
|
9
|
+
//#region src/client/renderers.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Options handed to a dock renderer when the client host mounts a dock entry.
|
|
12
|
+
*/
|
|
13
|
+
interface DockRendererMountOptions {
|
|
14
|
+
/** The dock entry being rendered (carries the entry's serializable payload). */
|
|
15
|
+
entry: DevframeDockEntry;
|
|
16
|
+
/** The DOM element the renderer should mount into. */
|
|
17
|
+
container: HTMLElement;
|
|
18
|
+
/** The assembled client host context (rpc, docks, commands, …). */
|
|
19
|
+
context: DevframeClientContext;
|
|
20
|
+
}
|
|
21
|
+
/** A mounted renderer instance the host can tear down. */
|
|
22
|
+
interface DockRendererInstance {
|
|
23
|
+
/** Tear down the mounted UI and release its subscriptions. */
|
|
24
|
+
dispose?: () => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* A renderer for a dock `type`. The headless hub is renderer-agnostic — a
|
|
28
|
+
* host application registers renderers at boot (e.g. injecting
|
|
29
|
+
* `@devframes/json-render-ui` for the `'json-render'` type). The renderer
|
|
30
|
+
* owns its framework (Vue, React, …); the hub only routes a dock type to it
|
|
31
|
+
* and disposes it on deactivation.
|
|
32
|
+
*/
|
|
33
|
+
type DockRenderer = (options: DockRendererMountOptions) => DockRendererInstance | Promise<DockRendererInstance>;
|
|
34
|
+
/**
|
|
35
|
+
* The dock-renderer registry surfaced on the client host context. A viewer
|
|
36
|
+
* calls {@link DockRenderersContext.mount} to render a dock whose `type` has a
|
|
37
|
+
* registered renderer into a container it owns; the host tracks the instance
|
|
38
|
+
* and disposes it when the entry deactivates.
|
|
39
|
+
*/
|
|
40
|
+
interface DockRenderersContext {
|
|
41
|
+
/** Register a renderer for a dock `type`. Returns an unregister function. */
|
|
42
|
+
register: (type: string, renderer: DockRenderer) => () => void;
|
|
43
|
+
/** Look up the renderer registered for a dock `type`, if any. */
|
|
44
|
+
get: (type: string) => DockRenderer | undefined;
|
|
45
|
+
/** Whether a renderer is registered for a dock `type`. */
|
|
46
|
+
has: (type: string) => boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Mount the entry's registered renderer into `container`. Resolves to a
|
|
49
|
+
* disposer; the same instance is also disposed automatically when the entry
|
|
50
|
+
* deactivates. Warns and resolves to a no-op disposer when no renderer is
|
|
51
|
+
* registered for the entry's type.
|
|
52
|
+
*/
|
|
53
|
+
mount: (entry: DevframeDockEntry, container: HTMLElement) => Promise<() => void>;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
9
56
|
//#region src/client/docks.d.ts
|
|
10
57
|
interface DockPanelStorage {
|
|
11
58
|
mode: 'float' | 'edge';
|
|
@@ -48,6 +95,12 @@ interface DocksContext extends DevframeRpcContext {
|
|
|
48
95
|
* instead of each plugin surfacing its own.
|
|
49
96
|
*/
|
|
50
97
|
readonly connection: DocksConnectionContext;
|
|
98
|
+
/**
|
|
99
|
+
* The dock-renderer registry. Routes a dock `type` to a host-registered
|
|
100
|
+
* renderer (e.g. `@devframes/json-render-ui` for `'json-render'`). The hub
|
|
101
|
+
* itself ships no renderers.
|
|
102
|
+
*/
|
|
103
|
+
readonly renderers: DockRenderersContext;
|
|
51
104
|
}
|
|
52
105
|
interface DocksConnectionContext {
|
|
53
106
|
/** The current connection status. */
|
|
@@ -195,6 +248,13 @@ interface DevframeClientHostOptions {
|
|
|
195
248
|
* `custom-render`, and iframe `clientScript`). Default `true`.
|
|
196
249
|
*/
|
|
197
250
|
loadClientScripts?: boolean;
|
|
251
|
+
/**
|
|
252
|
+
* Dock renderers to register at boot, keyed by dock `type`. The host
|
|
253
|
+
* application injects the ones it wants (e.g.
|
|
254
|
+
* `{ 'json-render': createJsonRenderDockRenderer() }` from
|
|
255
|
+
* `@devframes/json-render-ui`). The hub ships none by default.
|
|
256
|
+
*/
|
|
257
|
+
renderers?: Record<string, DockRenderer>;
|
|
198
258
|
}
|
|
199
259
|
interface DevframeClientHost {
|
|
200
260
|
/** The assembled, globally-registered client host context. */
|
|
@@ -252,4 +312,4 @@ declare function parseRemoteConnection(input?: string): RemoteConnectionInfo | n
|
|
|
252
312
|
*/
|
|
253
313
|
declare function connectRemoteDevframe(options?: ConnectRemoteDevframeOptions): Promise<DevframeRpcClient>;
|
|
254
314
|
//#endregion
|
|
255
|
-
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 };
|
|
315
|
+
export { CLIENT_CONTEXT_KEY, CommandsContext, ConnectRemoteDevframeOptions, DevframeClientContext, DevframeClientHost, DevframeClientHostOptions, type DevframeClientRpcHost, DockClientScriptContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DockRenderer, DockRendererInstance, DockRendererMountOptions, DockRenderersContext, DocksConnectionContext, DocksContext, DocksEntriesContext, DocksPanelContext, MessagesClientOptions, type RpcClientEvents, WhenClauseContext, connectRemoteDevframe, createDevframeClientHost, createMessagesClient, getDevframeClientContext, parseRemoteConnection, setDevframeClientContext };
|
package/dist/client/index.mjs
CHANGED
|
@@ -90,6 +90,7 @@ const DOCKS_ACTIVATE_EVENT = "devframe:docks:activate";
|
|
|
90
90
|
async function createDevframeClientHost(options = {}) {
|
|
91
91
|
const clientType = options.clientType ?? "standalone";
|
|
92
92
|
const rpc = options.rpc ?? await connectDevframe(options.connect);
|
|
93
|
+
let mountedRenderers;
|
|
93
94
|
const [docksState, commandsState, settings] = await Promise.all([
|
|
94
95
|
rpc.sharedState.get(DOCKS_STATE_KEY, { initialValue: [] }),
|
|
95
96
|
rpc.sharedState.get(COMMANDS_STATE_KEY, { initialValue: [] }),
|
|
@@ -106,6 +107,7 @@ async function createDevframeClientHost(options = {}) {
|
|
|
106
107
|
panel,
|
|
107
108
|
docks,
|
|
108
109
|
commands,
|
|
110
|
+
renderers: createRenderersContext(),
|
|
109
111
|
when: { get context() {
|
|
110
112
|
return {
|
|
111
113
|
clientType,
|
|
@@ -153,6 +155,7 @@ async function createDevframeClientHost(options = {}) {
|
|
|
153
155
|
context,
|
|
154
156
|
dispose() {
|
|
155
157
|
for (const off of disposers.splice(0)) off();
|
|
158
|
+
if (mountedRenderers) for (const disposeMount of [...mountedRenderers]) disposeMount();
|
|
156
159
|
if (getDevframeClientContext() === context) setDevframeClientContext(void 0);
|
|
157
160
|
}
|
|
158
161
|
};
|
|
@@ -246,6 +249,46 @@ async function createDevframeClientHost(options = {}) {
|
|
|
246
249
|
paletteOpen: false
|
|
247
250
|
};
|
|
248
251
|
}
|
|
252
|
+
function createRenderersContext() {
|
|
253
|
+
const rendererMap = /* @__PURE__ */ new Map();
|
|
254
|
+
for (const [type, renderer] of Object.entries(options.renderers ?? {})) rendererMap.set(type, renderer);
|
|
255
|
+
const mountedDisposers = /* @__PURE__ */ new Set();
|
|
256
|
+
mountedRenderers = mountedDisposers;
|
|
257
|
+
return {
|
|
258
|
+
register(type, renderer) {
|
|
259
|
+
rendererMap.set(type, renderer);
|
|
260
|
+
return () => {
|
|
261
|
+
if (rendererMap.get(type) === renderer) rendererMap.delete(type);
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
get: (type) => rendererMap.get(type),
|
|
265
|
+
has: (type) => rendererMap.has(type),
|
|
266
|
+
async mount(entry, container) {
|
|
267
|
+
const renderer = rendererMap.get(entry.type);
|
|
268
|
+
if (!renderer) {
|
|
269
|
+
console.warn(`[@devframes/hub] no renderer registered for dock type "${entry.type}" (entry "${entry.id}")`);
|
|
270
|
+
return () => {};
|
|
271
|
+
}
|
|
272
|
+
const instance = await renderer({
|
|
273
|
+
entry,
|
|
274
|
+
container,
|
|
275
|
+
context
|
|
276
|
+
});
|
|
277
|
+
let disposed = false;
|
|
278
|
+
let offDeactivate;
|
|
279
|
+
const dispose = () => {
|
|
280
|
+
if (disposed) return;
|
|
281
|
+
disposed = true;
|
|
282
|
+
mountedDisposers.delete(dispose);
|
|
283
|
+
offDeactivate?.();
|
|
284
|
+
instance.dispose?.();
|
|
285
|
+
};
|
|
286
|
+
mountedDisposers.add(dispose);
|
|
287
|
+
offDeactivate = entryToStateMap.get(entry.id)?.events.on("entry:deactivated", dispose);
|
|
288
|
+
return dispose;
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
249
292
|
function clientScriptOf(entry) {
|
|
250
293
|
return entry.action ?? entry.renderer ?? entry.clientScript;
|
|
251
294
|
}
|
package/dist/constants.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as DevframeDocksUserSettings } from "./settings-
|
|
1
|
+
import { t as DevframeDocksUserSettings } from "./settings-ywInLQJ3.mjs";
|
|
2
2
|
export * from "devframe/constants";
|
|
3
3
|
//#region src/constants.d.ts
|
|
4
4
|
declare const DEFAULT_CATEGORIES_ORDER: Record<string, number>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as DevframeDocksHost, c as DevframeCommandsHost, p as DevframeDockActivation, v as DevframeDockEntryIcon } from "./settings-ywInLQJ3.mjs";
|
|
2
2
|
import { CreateHostContextOptions } from "devframe/node";
|
|
3
3
|
import { DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
|
|
4
4
|
import { ChildProcess } from "node:child_process";
|
|
@@ -203,6 +203,8 @@ interface DevframeTerminalsHost {
|
|
|
203
203
|
}>;
|
|
204
204
|
register: (session: DevframeTerminalSession) => DevframeTerminalSession;
|
|
205
205
|
update: (session: DevframeTerminalSession) => void;
|
|
206
|
+
/** Drop a session from the registry, disposing its bound output stream. */
|
|
207
|
+
remove: (session: DevframeTerminalSession) => void;
|
|
206
208
|
/**
|
|
207
209
|
* Spawn a read-only child process (pipe-backed, output only). Use this for
|
|
208
210
|
* long-running logs and dev servers that don't need input.
|
|
@@ -233,6 +235,15 @@ interface DevframeTerminalSessionBase {
|
|
|
233
235
|
* decide whether to enable stdin and wire resize.
|
|
234
236
|
*/
|
|
235
237
|
interactive?: boolean;
|
|
238
|
+
/**
|
|
239
|
+
* Whether the session may be restarted in place (re-running its command).
|
|
240
|
+
* Defaults to `true`. Set `false` for sessions whose lifecycle is owned
|
|
241
|
+
* elsewhere — e.g. a one-shot build, or a server (like code-server) that
|
|
242
|
+
* should be restarted through its own controls rather than by re-spawning
|
|
243
|
+
* the raw process. A hub-aware terminal UI hides its restart affordance for
|
|
244
|
+
* these, and `hub:terminals:restart` rejects them.
|
|
245
|
+
*/
|
|
246
|
+
restartable?: boolean;
|
|
236
247
|
}
|
|
237
248
|
interface DevframeTerminalSession extends DevframeTerminalSessionBase {
|
|
238
249
|
buffer?: string[];
|
|
@@ -381,13 +392,14 @@ declare module 'devframe/types' {
|
|
|
381
392
|
/**
|
|
382
393
|
* Hub-augmented node context — extends devframe's framework-neutral
|
|
383
394
|
* `DevframeNodeContext` with the hub-level subsystems (`docks`,
|
|
384
|
-
* `terminals`, `messages`, `commands`)
|
|
385
|
-
* factory.
|
|
395
|
+
* `terminals`, `messages`, `commands`).
|
|
386
396
|
*
|
|
387
397
|
* Framework kits further extend this with their own slots (e.g.
|
|
388
398
|
* `viteConfig`, `viteServer`). Host-specific capabilities (editor open,
|
|
389
399
|
* filesystem reveal, etc.) ship as kit-registered RPC functions rather
|
|
390
|
-
* than as part of this surface.
|
|
400
|
+
* than as part of this surface. JSON-render is not part of the hub: it is
|
|
401
|
+
* an opt-in integration (`@devframes/json-render`) that augments any
|
|
402
|
+
* devframe context and contributes its own dock type.
|
|
391
403
|
*/
|
|
392
404
|
interface DevframeHubContext extends DevframeNodeContext {
|
|
393
405
|
readonly host: DevframeHost;
|
|
@@ -395,10 +407,6 @@ interface DevframeHubContext extends DevframeNodeContext {
|
|
|
395
407
|
terminals: DevframeTerminalsHost;
|
|
396
408
|
messages: DevframeMessagesHost;
|
|
397
409
|
commands: DevframeCommandsHost;
|
|
398
|
-
/**
|
|
399
|
-
* Create a JsonRenderer handle for building json-render powered UIs.
|
|
400
|
-
*/
|
|
401
|
-
createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
|
|
402
410
|
}
|
|
403
411
|
/**
|
|
404
412
|
* Options for {@link createHubContext} — devframe's
|
|
@@ -7,8 +7,5 @@ function defineCommand(command) {
|
|
|
7
7
|
function defineDockEntry(entry) {
|
|
8
8
|
return entry;
|
|
9
9
|
}
|
|
10
|
-
function defineJsonRenderSpec(spec) {
|
|
11
|
-
return spec;
|
|
12
|
-
}
|
|
13
10
|
//#endregion
|
|
14
|
-
export {
|
|
11
|
+
export { defineDockEntry as n, defineHubRpcFunction as r, defineCommand as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "./context-
|
|
2
|
-
import "./settings-
|
|
1
|
+
import "./context-ChGTyDu-.mjs";
|
|
2
|
+
import "./settings-ywInLQJ3.mjs";
|
|
3
3
|
import { RpcDefinitionsFilter, RpcDefinitionsToFunctions } from "devframe/rpc";
|
|
4
4
|
import { ConnectionMeta as ConnectionMeta$1, DevframeCapabilities, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeHost as DevframeHost$1, DevframeNodeRpcSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeViewHost, EntriesToObject, EventEmitter as EventEmitter$1, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable } from "devframe/types";
|
|
5
5
|
export { RpcStreamingChannel as C, Thenable as E, RpcSharedStateHost as S, RpcStreamingHost as T, RpcBroadcastOptions as _, DevframeDiagnosticsLogger as a, RpcFunctionsHost as b, DevframeRpcClientFunctions as c, DevframeViewHost as d, EntriesToObject as f, PartialWithoutId as g, EventsMap as h, DevframeDiagnosticsHost as i, DevframeRpcServerFunctions as l, EventUnsubscribe as m, DevframeCapabilities as n, DevframeHost$1 as o, EventEmitter$1 as p, DevframeDiagnosticsDefinition as r, DevframeNodeRpcSession as s, ConnectionMeta$1 as t, DevframeRpcSharedStates as u, RpcDefinitionsFilter as v, RpcStreamingChannelOptions as w, RpcSharedStateGetOptions as x, RpcDefinitionsToFunctions as y };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
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-
|
|
2
|
-
import { A as RemoteConnectionInfo, C as
|
|
3
|
-
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-
|
|
1
|
+
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-ChGTyDu-.mjs";
|
|
2
|
+
import { A as RemoteConnectionInfo, C as DevframeViewAction, D as DevframeViewIframe, E as DevframeViewGroup, O as DevframeViewLauncher, S as DevframeDocksHost, T as DevframeViewCustomRender, _ as DevframeDockEntryCategory, a as DevframeCommandHandle, b as DevframeDockUserEntry, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryBase, h as DevframeDockEntry, i as DevframeCommandEntry, j as RemoteDockOptions, k as DevframeViewLauncherStatus, l as DevframeCommandsHostEvents, m as DevframeDockEntriesGrouped, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockActivation, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockEntryIcon, w as DevframeViewBuiltin, x as DevframeDocksActiveState, y as DevframeDockEntryRegistry } from "./settings-ywInLQJ3.mjs";
|
|
3
|
+
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-BCVXXhEH.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>;
|
|
@@ -10,6 +10,5 @@ declare function defineCommand<const W extends string = ''>(command: Omit<Devfra
|
|
|
10
10
|
declare function defineDockEntry<const T extends DevframeDockUserEntry, const W extends string = ''>(entry: Omit<T, 'when'> & {
|
|
11
11
|
when?: WhenExpression<WhenContext, W>;
|
|
12
12
|
}): T;
|
|
13
|
-
declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
|
|
14
13
|
//#endregion
|
|
15
|
-
export { type ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, type DevframeChildProcessExecuteOptions, type DevframeChildProcessOutput, type DevframeChildProcessResult, type DevframeChildProcessTerminalSession, type DevframeClientCommand, type DevframeCommandBase, type DevframeCommandEntry, type DevframeCommandHandle, type DevframeCommandKeybinding, type DevframeCommandShortcutOverrides, type DevframeCommandsHost, type DevframeCommandsHostEvents, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockActivation, type DevframeDockEntriesGrouped, type DevframeDockEntry, type DevframeDockEntryBase, type DevframeDockEntryCategory, type DevframeDockEntryIcon, type DevframeDockUserEntry, type DevframeDocksActiveState, type DevframeDocksHost, type DevframeDocksUserSettings, type DevframeHost, type DevframeHubContext, 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
|
|
14
|
+
export { type ClientScriptEntry, type ConnectionMeta, type CreateHubContextOptions, type DevframeCapabilities, type DevframeChildProcessExecuteOptions, type DevframeChildProcessOutput, type DevframeChildProcessResult, type DevframeChildProcessTerminalSession, type DevframeClientCommand, type DevframeCommandBase, type DevframeCommandEntry, type DevframeCommandHandle, type DevframeCommandKeybinding, type DevframeCommandShortcutOverrides, type DevframeCommandsHost, type DevframeCommandsHostEvents, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockActivation, 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 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 EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type PartialWithoutId, type RemoteConnectionInfo, type RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type Thenable, defineCommand, defineDockEntry, defineHubRpcFunction };
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { defineCommand, defineDockEntry, defineHubRpcFunction
|
|
1
|
+
import { n as defineDockEntry, r as defineHubRpcFunction, t as defineCommand } from "./define-Ceekw2EO.mjs";
|
|
2
|
+
export { defineCommand, defineDockEntry, defineHubRpcFunction };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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-
|
|
2
|
-
import {
|
|
1
|
+
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-ChGTyDu-.mjs";
|
|
2
|
+
import { D as DevframeViewIframe, S as DevframeDocksHost$1, a as DevframeCommandHandle, b as DevframeDockUserEntry, c as DevframeCommandsHost$1, d as DevframeServerCommandInput, f as ClientScriptEntry, h as DevframeDockEntry, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry } from "../settings-ywInLQJ3.mjs";
|
|
3
3
|
import { RpcFunctionDefinitionAny } from "devframe/rpc";
|
|
4
4
|
import { DevframeDefinition } from "devframe/types";
|
|
5
5
|
import { SharedState } from "devframe/utils/shared-state";
|
|
@@ -261,6 +261,67 @@ declare const hubTerminalsResize: {
|
|
|
261
261
|
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, cols: number, rows: number], Promise<void>>>> | undefined;
|
|
262
262
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, cols: number, rows: number], Promise<void>>> | undefined;
|
|
263
263
|
};
|
|
264
|
+
/**
|
|
265
|
+
* `hub:terminals:terminate` — Kill a session's process while keeping the
|
|
266
|
+
* session registered (its output/scrollback stays). Works for both read-only
|
|
267
|
+
* child-process and interactive PTY sessions, letting a hub-aware terminal UI
|
|
268
|
+
* force-kill a session owned by another plugin.
|
|
269
|
+
*/
|
|
270
|
+
declare const hubTerminalsTerminate: {
|
|
271
|
+
name: "hub:terminals:terminate";
|
|
272
|
+
type?: "action" | undefined;
|
|
273
|
+
cacheable?: boolean;
|
|
274
|
+
args?: undefined;
|
|
275
|
+
returns?: undefined;
|
|
276
|
+
jsonSerializable?: boolean;
|
|
277
|
+
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
278
|
+
setup?: ((context: DevframeHubContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>) | undefined;
|
|
279
|
+
handler?: ((id: string) => Promise<void>) | undefined;
|
|
280
|
+
dump?: import("devframe/rpc").RpcDump<[id: string], Promise<void>, DevframeHubContext> | undefined;
|
|
281
|
+
snapshot?: boolean;
|
|
282
|
+
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>> | undefined;
|
|
283
|
+
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
284
|
+
};
|
|
285
|
+
/**
|
|
286
|
+
* `hub:terminals:restart` — Re-run a session's command in place. Rejected for
|
|
287
|
+
* sessions registered with `restartable: false`, whose lifecycle is owned
|
|
288
|
+
* elsewhere.
|
|
289
|
+
*/
|
|
290
|
+
declare const hubTerminalsRestart: {
|
|
291
|
+
name: "hub:terminals:restart";
|
|
292
|
+
type?: "action" | undefined;
|
|
293
|
+
cacheable?: boolean;
|
|
294
|
+
args?: undefined;
|
|
295
|
+
returns?: undefined;
|
|
296
|
+
jsonSerializable?: boolean;
|
|
297
|
+
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
298
|
+
setup?: ((context: DevframeHubContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>) | undefined;
|
|
299
|
+
handler?: ((id: string) => Promise<void>) | undefined;
|
|
300
|
+
dump?: import("devframe/rpc").RpcDump<[id: string], Promise<void>, DevframeHubContext> | undefined;
|
|
301
|
+
snapshot?: boolean;
|
|
302
|
+
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>> | undefined;
|
|
303
|
+
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
304
|
+
};
|
|
305
|
+
/**
|
|
306
|
+
* `hub:terminals:remove` — Kill a session's process (when it still owns one)
|
|
307
|
+
* and drop it from the registry, disposing its output stream. Lets a hub-aware
|
|
308
|
+
* terminal UI discard a stopped aggregated session.
|
|
309
|
+
*/
|
|
310
|
+
declare const hubTerminalsRemove: {
|
|
311
|
+
name: "hub:terminals:remove";
|
|
312
|
+
type?: "action" | undefined;
|
|
313
|
+
cacheable?: boolean;
|
|
314
|
+
args?: undefined;
|
|
315
|
+
returns?: undefined;
|
|
316
|
+
jsonSerializable?: boolean;
|
|
317
|
+
agent?: import("devframe").RpcFunctionAgentOptions;
|
|
318
|
+
setup?: ((context: DevframeHubContext) => import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>) | undefined;
|
|
319
|
+
handler?: ((id: string) => Promise<void>) | undefined;
|
|
320
|
+
dump?: import("devframe/rpc").RpcDump<[id: string], Promise<void>, DevframeHubContext> | undefined;
|
|
321
|
+
snapshot?: boolean;
|
|
322
|
+
__cache?: WeakMap<object, import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>>> | undefined;
|
|
323
|
+
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
324
|
+
};
|
|
264
325
|
/**
|
|
265
326
|
* `hub:docks:activate` — Ask the active viewer to switch its focused dock to
|
|
266
327
|
* `dockId`, optionally carrying `params` for the target dock to interpret
|
|
@@ -321,4 +382,4 @@ declare const builtinHubRpcDeclarations: readonly RpcFunctionDefinitionAny[];
|
|
|
321
382
|
*/
|
|
322
383
|
declare function createSimpleClientScript(fn: string | ((ctx: any) => void)): ClientScriptEntry;
|
|
323
384
|
//#endregion
|
|
324
|
-
export { CreateHubContextOptions, DevframeCommandsHost, DevframeDocksHost, DevframeHubContext, DevframeMessagesHost, DevframeTerminalsHost, MountDevframeOptions, builtinHubRpcDeclarations, createHubContext, createSimpleClientScript, hubCommandsExecute, hubDocksActivate, hubMessagesAdd, hubMessagesClear, hubMessagesRemove, hubMessagesUpdate, hubTerminalsResize, hubTerminalsWrite, mountDevframe };
|
|
385
|
+
export { CreateHubContextOptions, DevframeCommandsHost, DevframeDocksHost, DevframeHubContext, DevframeMessagesHost, DevframeTerminalsHost, MountDevframeOptions, builtinHubRpcDeclarations, createHubContext, createSimpleClientScript, hubCommandsExecute, hubDocksActivate, hubMessagesAdd, hubMessagesClear, hubMessagesRemove, hubMessagesUpdate, hubTerminalsRemove, hubTerminalsResize, hubTerminalsRestart, hubTerminalsTerminate, hubTerminalsWrite, mountDevframe };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as defineHubRpcFunction } from "../define-
|
|
1
|
+
import { r as defineHubRpcFunction } from "../define-Ceekw2EO.mjs";
|
|
2
2
|
import { DEFAULT_STATE_USER_SETTINGS } from "../constants.mjs";
|
|
3
3
|
import { REMOTE_CONNECTION_KEY } from "devframe/constants";
|
|
4
4
|
import { createEventEmitter } from "devframe/utils/events";
|
|
@@ -68,6 +68,14 @@ const diagnostics = defineDiagnostics({
|
|
|
68
68
|
fix: "Spawn it via ctx.terminals.startPtySession() to get an interactive, writable session."
|
|
69
69
|
},
|
|
70
70
|
DF8203: { why: (p) => `Failed to spawn PTY session for "${p.command}": ${p.reason}` },
|
|
71
|
+
DF8204: {
|
|
72
|
+
why: (p) => `Terminal session "${p.id}" cannot be controlled (no lifecycle handle)`,
|
|
73
|
+
fix: "Spawn it via ctx.terminals.startChildProcess() or startPtySession() — sessions added with a bare register() expose no terminate/restart handle."
|
|
74
|
+
},
|
|
75
|
+
DF8205: {
|
|
76
|
+
why: (p) => `Terminal session "${p.id}" is not restartable`,
|
|
77
|
+
fix: "It was registered with `restartable: false`; restart it through its owner's controls, or spawn it with `restartable: true` (the default) to allow in-place restarts."
|
|
78
|
+
},
|
|
71
79
|
DF8400: { why: (p) => `Command "${p.id}" is already registered` },
|
|
72
80
|
DF8401: { why: "Cannot change the id of a command. Use register() to add new commands" },
|
|
73
81
|
DF8402: { why: (p) => `Command "${p.id}" is not registered` },
|
|
@@ -822,6 +830,17 @@ function resolveInteractiveSession(sessions, id) {
|
|
|
822
830
|
return session;
|
|
823
831
|
}
|
|
824
832
|
/**
|
|
833
|
+
* Resolve a session that can be terminated/restarted (spawned via
|
|
834
|
+
* `startChildProcess` or `startPtySession`), or throw. Sessions added with a
|
|
835
|
+
* bare `register()` carry no lifecycle handle and are rejected.
|
|
836
|
+
*/
|
|
837
|
+
function resolveControllableSession(sessions, id) {
|
|
838
|
+
const session = sessions.get(id);
|
|
839
|
+
if (!session) throw diagnostics.DF8201({ id });
|
|
840
|
+
if (typeof session.terminate !== "function") throw diagnostics.DF8204({ id });
|
|
841
|
+
return session;
|
|
842
|
+
}
|
|
843
|
+
/**
|
|
825
844
|
* `hub:commands:execute` — Invoke a registered server command by id. The
|
|
826
845
|
* arguments after `id` are forwarded to the command's `handler(...)`.
|
|
827
846
|
* Returns whatever the handler returns.
|
|
@@ -902,6 +921,49 @@ const hubTerminalsResize = defineHubRpcFunction({
|
|
|
902
921
|
} })
|
|
903
922
|
});
|
|
904
923
|
/**
|
|
924
|
+
* `hub:terminals:terminate` — Kill a session's process while keeping the
|
|
925
|
+
* session registered (its output/scrollback stays). Works for both read-only
|
|
926
|
+
* child-process and interactive PTY sessions, letting a hub-aware terminal UI
|
|
927
|
+
* force-kill a session owned by another plugin.
|
|
928
|
+
*/
|
|
929
|
+
const hubTerminalsTerminate = defineHubRpcFunction({
|
|
930
|
+
name: "hub:terminals:terminate",
|
|
931
|
+
type: "action",
|
|
932
|
+
setup: (context) => ({ async handler(id) {
|
|
933
|
+
await resolveControllableSession(context.terminals.sessions, id).terminate();
|
|
934
|
+
} })
|
|
935
|
+
});
|
|
936
|
+
/**
|
|
937
|
+
* `hub:terminals:restart` — Re-run a session's command in place. Rejected for
|
|
938
|
+
* sessions registered with `restartable: false`, whose lifecycle is owned
|
|
939
|
+
* elsewhere.
|
|
940
|
+
*/
|
|
941
|
+
const hubTerminalsRestart = defineHubRpcFunction({
|
|
942
|
+
name: "hub:terminals:restart",
|
|
943
|
+
type: "action",
|
|
944
|
+
setup: (context) => ({ async handler(id) {
|
|
945
|
+
const session = resolveControllableSession(context.terminals.sessions, id);
|
|
946
|
+
if (session.restartable === false) throw diagnostics.DF8205({ id });
|
|
947
|
+
await session.restart();
|
|
948
|
+
} })
|
|
949
|
+
});
|
|
950
|
+
/**
|
|
951
|
+
* `hub:terminals:remove` — Kill a session's process (when it still owns one)
|
|
952
|
+
* and drop it from the registry, disposing its output stream. Lets a hub-aware
|
|
953
|
+
* terminal UI discard a stopped aggregated session.
|
|
954
|
+
*/
|
|
955
|
+
const hubTerminalsRemove = defineHubRpcFunction({
|
|
956
|
+
name: "hub:terminals:remove",
|
|
957
|
+
type: "action",
|
|
958
|
+
setup: (context) => ({ async handler(id) {
|
|
959
|
+
const session = context.terminals.sessions.get(id);
|
|
960
|
+
if (!session) throw diagnostics.DF8201({ id });
|
|
961
|
+
const controllable = session;
|
|
962
|
+
if (typeof controllable.terminate === "function") await controllable.terminate();
|
|
963
|
+
context.terminals.remove(session);
|
|
964
|
+
} })
|
|
965
|
+
});
|
|
966
|
+
/**
|
|
905
967
|
* `hub:docks:activate` — Ask the active viewer to switch its focused dock to
|
|
906
968
|
* `dockId`, optionally carrying `params` for the target dock to interpret
|
|
907
969
|
* (e.g. `{ sessionId }` for the terminals dock to focus a session).
|
|
@@ -934,7 +996,10 @@ const builtinHubRpcDeclarations = [
|
|
|
934
996
|
hubMessagesRemove,
|
|
935
997
|
hubMessagesClear,
|
|
936
998
|
hubTerminalsWrite,
|
|
937
|
-
hubTerminalsResize
|
|
999
|
+
hubTerminalsResize,
|
|
1000
|
+
hubTerminalsTerminate,
|
|
1001
|
+
hubTerminalsRestart,
|
|
1002
|
+
hubTerminalsRemove
|
|
938
1003
|
];
|
|
939
1004
|
//#endregion
|
|
940
1005
|
//#region src/node/context.ts
|
|
@@ -958,25 +1023,6 @@ async function createHubContext(options) {
|
|
|
958
1023
|
context.messages = messages;
|
|
959
1024
|
context.commands = commands;
|
|
960
1025
|
await docks.init();
|
|
961
|
-
let jrCounter = 0;
|
|
962
|
-
context.createJsonRenderer = (initialSpec) => {
|
|
963
|
-
const stateKey = `devframe:json-render:${jrCounter++}`;
|
|
964
|
-
const statePromise = context.rpc.sharedState.get(stateKey, { initialValue: initialSpec });
|
|
965
|
-
return {
|
|
966
|
-
_stateKey: stateKey,
|
|
967
|
-
async updateSpec(spec) {
|
|
968
|
-
(await statePromise).mutate(() => spec);
|
|
969
|
-
},
|
|
970
|
-
async updateState(newState) {
|
|
971
|
-
(await statePromise).mutate((draft) => {
|
|
972
|
-
draft.state = {
|
|
973
|
-
...draft.state,
|
|
974
|
-
...newState
|
|
975
|
-
};
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
};
|
|
979
|
-
};
|
|
980
1026
|
const debounceMs = options.mode === "build" ? 0 : 10;
|
|
981
1027
|
const docksSharedState = await context.rpc.sharedState.get("devframe:docks", { initialValue: [] });
|
|
982
1028
|
const refreshDocks = debounce(() => {
|
|
@@ -6546,4 +6592,4 @@ function createSimpleClientScript(fn) {
|
|
|
6546
6592
|
};
|
|
6547
6593
|
}
|
|
6548
6594
|
//#endregion
|
|
6549
|
-
export { DevframeCommandsHost, DevframeDocksHost, DevframeMessagesHost, DevframeTerminalsHost, builtinHubRpcDeclarations, createHubContext, createSimpleClientScript, hubCommandsExecute, hubDocksActivate, hubMessagesAdd, hubMessagesClear, hubMessagesRemove, hubMessagesUpdate, hubTerminalsResize, hubTerminalsWrite, mountDevframe };
|
|
6595
|
+
export { DevframeCommandsHost, DevframeDocksHost, DevframeMessagesHost, DevframeTerminalsHost, builtinHubRpcDeclarations, createHubContext, createSimpleClientScript, hubCommandsExecute, hubDocksActivate, hubMessagesAdd, hubMessagesClear, hubMessagesRemove, hubMessagesUpdate, hubTerminalsRemove, hubTerminalsResize, hubTerminalsRestart, hubTerminalsTerminate, hubTerminalsWrite, mountDevframe };
|
|
@@ -1,33 +1,4 @@
|
|
|
1
1
|
import { ConnectionMeta, EventEmitter } from "devframe/types";
|
|
2
|
-
//#region src/types/json-render.d.ts
|
|
3
|
-
interface JsonRenderElement {
|
|
4
|
-
type: string;
|
|
5
|
-
props?: Record<string, unknown>;
|
|
6
|
-
children?: string[];
|
|
7
|
-
/** json-render event bindings (e.g. `{ press: { action: "my:action" } }`) */
|
|
8
|
-
on?: Record<string, unknown>;
|
|
9
|
-
/** json-render visibility condition */
|
|
10
|
-
visible?: unknown;
|
|
11
|
-
/** json-render repeat binding */
|
|
12
|
-
repeat?: unknown;
|
|
13
|
-
/** Allow additional json-render element fields */
|
|
14
|
-
[key: string]: unknown;
|
|
15
|
-
}
|
|
16
|
-
interface JsonRenderSpec {
|
|
17
|
-
root: string;
|
|
18
|
-
elements: Record<string, JsonRenderElement>;
|
|
19
|
-
/** Initial client-side state model for $state/$bindState expressions */
|
|
20
|
-
state?: Record<string, unknown>;
|
|
21
|
-
}
|
|
22
|
-
interface JsonRenderer {
|
|
23
|
-
/** Replace the entire spec */
|
|
24
|
-
updateSpec: (spec: JsonRenderSpec) => void | Promise<void>;
|
|
25
|
-
/** Update json-render state values (shallow merge into spec.state) */
|
|
26
|
-
updateState: (state: Record<string, unknown>) => void | Promise<void>;
|
|
27
|
-
/** Internal: shared state key used by the client to subscribe */
|
|
28
|
-
readonly _stateKey: string;
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
2
|
//#region src/types/docks.d.ts
|
|
32
3
|
interface DevframeDocksHost {
|
|
33
4
|
readonly views: Map<string, DevframeDockUserEntry>;
|
|
@@ -255,11 +226,6 @@ interface DevframeViewBuiltin extends DevframeDockEntryBase {
|
|
|
255
226
|
type: '~builtin';
|
|
256
227
|
id: string;
|
|
257
228
|
}
|
|
258
|
-
interface DevframeViewJsonRender extends DevframeDockEntryBase {
|
|
259
|
-
type: 'json-render';
|
|
260
|
-
/** JsonRenderer handle created by ctx.createJsonRenderer() */
|
|
261
|
-
ui: JsonRenderer;
|
|
262
|
-
}
|
|
263
229
|
/**
|
|
264
230
|
* A dock group: a single dock-bar button that collapses every entry whose
|
|
265
231
|
* {@link DevframeDockEntryBase.groupId} matches this group's `id`.
|
|
@@ -281,7 +247,32 @@ interface DevframeViewGroup extends DevframeDockEntryBase {
|
|
|
281
247
|
*/
|
|
282
248
|
defaultChildId?: string;
|
|
283
249
|
}
|
|
284
|
-
|
|
250
|
+
/**
|
|
251
|
+
* The **open** registry of dock entry variants, keyed by their `type`
|
|
252
|
+
* discriminator. The hub ships the framework-neutral built-ins; opt-in
|
|
253
|
+
* integrations contribute their own variants through declaration merging —
|
|
254
|
+
* e.g. `@devframes/json-render/hub` adds a `'json-render'` entry. The hub
|
|
255
|
+
* itself stays agnostic: it hard-codes no integration-specific variant.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* // in an opt-in integration package
|
|
260
|
+
* declare module '@devframes/hub/types' {
|
|
261
|
+
* interface DevframeDockEntryRegistry {
|
|
262
|
+
* 'my-view': MyDockEntry
|
|
263
|
+
* }
|
|
264
|
+
* }
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
interface DevframeDockEntryRegistry {
|
|
268
|
+
'iframe': DevframeViewIframe;
|
|
269
|
+
'action': DevframeViewAction;
|
|
270
|
+
'custom-render': DevframeViewCustomRender;
|
|
271
|
+
'launcher': DevframeViewLauncher;
|
|
272
|
+
'group': DevframeViewGroup;
|
|
273
|
+
'~builtin': DevframeViewBuiltin;
|
|
274
|
+
}
|
|
275
|
+
type DevframeDockUserEntry = DevframeDockEntryRegistry[keyof DevframeDockEntryRegistry];
|
|
285
276
|
type DevframeDockEntry = DevframeDockUserEntry;
|
|
286
277
|
type DevframeDockEntriesGrouped = [category: string, entries: DevframeDockEntry[]][];
|
|
287
278
|
//#endregion
|
|
@@ -414,4 +405,4 @@ interface DevframeDocksUserSettings {
|
|
|
414
405
|
commandShortcuts: DevframeCommandShortcutOverrides;
|
|
415
406
|
}
|
|
416
407
|
//#endregion
|
|
417
|
-
export { RemoteConnectionInfo as A,
|
|
408
|
+
export { RemoteConnectionInfo as A, DevframeViewAction as C, DevframeViewIframe as D, DevframeViewGroup as E, DevframeViewLauncher as O, DevframeDocksHost as S, DevframeViewCustomRender as T, DevframeDockEntryCategory as _, DevframeCommandHandle as a, DevframeDockUserEntry as b, DevframeCommandsHost as c, DevframeServerCommandInput as d, ClientScriptEntry as f, DevframeDockEntryBase as g, DevframeDockEntry as h, DevframeCommandEntry as i, RemoteDockOptions as j, DevframeViewLauncherStatus as k, DevframeCommandsHostEvents as l, DevframeDockEntriesGrouped as m, DevframeClientCommand as n, DevframeCommandKeybinding as o, DevframeDockActivation as p, DevframeCommandBase as r, DevframeCommandShortcutOverrides as s, DevframeDocksUserSettings as t, DevframeServerCommandEntry as u, DevframeDockEntryIcon as v, DevframeViewBuiltin as w, DevframeDocksActiveState as x, DevframeDockEntryRegistry as y };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
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-
|
|
2
|
-
import { A as RemoteConnectionInfo, C as
|
|
3
|
-
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-
|
|
4
|
-
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, DevframeDockActivation, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockUserEntry, DevframeDocksActiveState, 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,
|
|
1
|
+
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-ChGTyDu-.mjs";
|
|
2
|
+
import { A as RemoteConnectionInfo, C as DevframeViewAction, D as DevframeViewIframe, E as DevframeViewGroup, O as DevframeViewLauncher, S as DevframeDocksHost, T as DevframeViewCustomRender, _ as DevframeDockEntryCategory, a as DevframeCommandHandle, b as DevframeDockUserEntry, c as DevframeCommandsHost, d as DevframeServerCommandInput, f as ClientScriptEntry, g as DevframeDockEntryBase, h as DevframeDockEntry, i as DevframeCommandEntry, j as RemoteDockOptions, k as DevframeViewLauncherStatus, l as DevframeCommandsHostEvents, m as DevframeDockEntriesGrouped, n as DevframeClientCommand, o as DevframeCommandKeybinding, p as DevframeDockActivation, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry, v as DevframeDockEntryIcon, w as DevframeViewBuiltin, x as DevframeDocksActiveState, y as DevframeDockEntryRegistry } from "../settings-ywInLQJ3.mjs";
|
|
3
|
+
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-BCVXXhEH.mjs";
|
|
4
|
+
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, DevframeDockActivation, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockEntryRegistry, DevframeDockUserEntry, DevframeDocksActiveState, 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, DevframeViewLauncher, DevframeViewLauncherStatus, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, type RpcBroadcastOptions, type RpcDefinitionsFilter, type RpcDefinitionsToFunctions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type Thenable };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/hub",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.6",
|
|
5
5
|
"description": "Framework-neutral hub layer for devframe — docks, terminals, messages, commands.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,12 +33,12 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"devframe": "0.7.
|
|
36
|
+
"devframe": "0.7.6"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"birpc": "^4.0.0",
|
|
40
40
|
"destr": "^2.0.5",
|
|
41
|
-
"nostics": "^1.
|
|
41
|
+
"nostics": "^1.2.0",
|
|
42
42
|
"pathe": "^2.0.3",
|
|
43
43
|
"perfect-debounce": "^2.1.0",
|
|
44
44
|
"tinyexec": "^1.2.4",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^26.1.1",
|
|
49
49
|
"mlly": "^1.8.2",
|
|
50
|
-
"tsdown": "^0.22.
|
|
51
|
-
"devframe": "0.7.
|
|
50
|
+
"tsdown": "^0.22.12",
|
|
51
|
+
"devframe": "0.7.6"
|
|
52
52
|
},
|
|
53
53
|
"scripts": {
|
|
54
54
|
"build": "tsdown",
|