@devframes/hub 0.5.1 → 0.5.3

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.
@@ -0,0 +1,433 @@
1
+ import { c as DevframeCommandsHost } from "./settings-Bp5Ax6Os.mjs";
2
+ import { CreateHostContextOptions } from "devframe/node";
3
+ import { ConnectionMeta, DevframeHost, DevframeNodeContext, EventEmitter } from "devframe/types";
4
+ import { ChildProcess } from "node:child_process";
5
+
6
+ //#region src/types/messages.d.ts
7
+ type DevframeMessageLevel = 'info' | 'warn' | 'error' | 'success' | 'debug';
8
+ type DevframeMessageEntryFrom = 'server' | 'browser';
9
+ interface DevframeMessageElementPosition {
10
+ /** CSS selector for the element */
11
+ selector?: string;
12
+ /** Bounding box of the element */
13
+ boundingBox?: {
14
+ x: number;
15
+ y: number;
16
+ width: number;
17
+ height: number;
18
+ };
19
+ /** Human-readable description of the element */
20
+ description?: string;
21
+ }
22
+ interface DevframeMessageFilePosition {
23
+ /** Absolute or relative file path */
24
+ file: string;
25
+ /** Line number (1-based) */
26
+ line?: number;
27
+ /** Column number (1-based) */
28
+ column?: number;
29
+ }
30
+ interface DevframeMessageEntry {
31
+ /**
32
+ * Unique identifier for this message entry (auto-generated if not provided)
33
+ */
34
+ id: string;
35
+ /**
36
+ * Short title or summary of the message
37
+ */
38
+ message: string;
39
+ /**
40
+ * Optional detailed description or explanation
41
+ */
42
+ description?: string;
43
+ /**
44
+ * Severity level, determines color and icon
45
+ */
46
+ level: DevframeMessageLevel;
47
+ /**
48
+ * Optional stack trace string
49
+ */
50
+ stacktrace?: string;
51
+ /**
52
+ * Optional DOM element position info (e.g., for a11y issues)
53
+ */
54
+ elementPosition?: DevframeMessageElementPosition;
55
+ /**
56
+ * Optional source file position info (e.g., for lint errors)
57
+ */
58
+ filePosition?: DevframeMessageFilePosition;
59
+ /**
60
+ * Whether this message should also appear as a toast notification
61
+ */
62
+ notify?: boolean;
63
+ /**
64
+ * Origin of the message entry, automatically set by the context
65
+ */
66
+ from: DevframeMessageEntryFrom;
67
+ /**
68
+ * Grouping category (e.g., 'a11y', 'lint', 'runtime', 'test')
69
+ */
70
+ category?: string;
71
+ /**
72
+ * Optional tags/labels for filtering
73
+ */
74
+ labels?: string[];
75
+ /**
76
+ * Time in ms to auto-dismiss the toast notification (client-side)
77
+ */
78
+ autoDismiss?: number;
79
+ /**
80
+ * Time in ms to auto-delete this message entry (server-side)
81
+ */
82
+ autoDelete?: number;
83
+ /**
84
+ * Timestamp when the message was created (auto-generated if not provided)
85
+ */
86
+ timestamp: number;
87
+ /**
88
+ * Status of the message entry (e.g., 'loading' while an operation is in progress).
89
+ * Defaults to 'idle' when not specified.
90
+ */
91
+ status?: 'loading' | 'idle';
92
+ }
93
+ /**
94
+ * Input type for creating a message entry.
95
+ * `id`, `timestamp`, and `from` are auto-filled by the host.
96
+ */
97
+ type DevframeMessageEntryInput = Omit<DevframeMessageEntry, 'id' | 'timestamp' | 'from'> & {
98
+ id?: string;
99
+ timestamp?: number;
100
+ };
101
+ interface DevframeMessageHandle {
102
+ /** The underlying message entry data */
103
+ readonly entry: DevframeMessageEntry;
104
+ /** Shortcut to entry.id */
105
+ readonly id: string;
106
+ /** Partial update of this message entry */
107
+ update: (patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
108
+ /** Remove this message entry */
109
+ dismiss: () => Promise<void>;
110
+ }
111
+ interface DevframeMessagesClient {
112
+ /**
113
+ * Add a message entry. Returns a Promise resolving to a handle for subsequent updates/dismissal.
114
+ * Can be used without `await` for fire-and-forget usage.
115
+ */
116
+ add: (input: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
117
+ /** Remove a message entry by id */
118
+ remove: (id: string) => Promise<void>;
119
+ /** Clear all message entries */
120
+ clear: () => Promise<void>;
121
+ }
122
+ interface DevframeMessagesHost {
123
+ readonly entries: Map<string, DevframeMessageEntry>;
124
+ readonly events: EventEmitter<{
125
+ 'message:added': (entry: DevframeMessageEntry) => void;
126
+ 'message:updated': (entry: DevframeMessageEntry) => void;
127
+ 'message:removed': (id: string) => void;
128
+ 'message:cleared': () => void;
129
+ }>;
130
+ /**
131
+ * Add a new message entry. If an entry with the same `id` already exists, it will be updated instead.
132
+ * Returns a handle for subsequent updates/dismissal. Can be used without `await` for fire-and-forget.
133
+ */
134
+ add: (entry: DevframeMessageEntryInput) => Promise<DevframeMessageHandle>;
135
+ /**
136
+ * Update an existing message entry by id (partial update)
137
+ */
138
+ update: (id: string, patch: Partial<DevframeMessageEntryInput>) => Promise<DevframeMessageEntry | undefined>;
139
+ /**
140
+ * Remove a message entry by id
141
+ */
142
+ remove: (id: string) => Promise<void>;
143
+ /**
144
+ * Clear all message entries
145
+ */
146
+ clear: () => Promise<void>;
147
+ }
148
+ //#endregion
149
+ //#region src/types/json-render.d.ts
150
+ interface JsonRenderElement {
151
+ type: string;
152
+ props?: Record<string, unknown>;
153
+ children?: string[];
154
+ /** json-render event bindings (e.g. `{ press: { action: "my:action" } }`) */
155
+ on?: Record<string, unknown>;
156
+ /** json-render visibility condition */
157
+ visible?: unknown;
158
+ /** json-render repeat binding */
159
+ repeat?: unknown;
160
+ /** Allow additional json-render element fields */
161
+ [key: string]: unknown;
162
+ }
163
+ interface JsonRenderSpec {
164
+ root: string;
165
+ elements: Record<string, JsonRenderElement>;
166
+ /** Initial client-side state model for $state/$bindState expressions */
167
+ state?: Record<string, unknown>;
168
+ }
169
+ interface JsonRenderer {
170
+ /** Replace the entire spec */
171
+ updateSpec: (spec: JsonRenderSpec) => void | Promise<void>;
172
+ /** Update json-render state values (shallow merge into spec.state) */
173
+ updateState: (state: Record<string, unknown>) => void | Promise<void>;
174
+ /** Internal: shared state key used by the client to subscribe */
175
+ readonly _stateKey: string;
176
+ }
177
+ //#endregion
178
+ //#region src/types/docks.d.ts
179
+ interface DevframeDocksHost {
180
+ readonly views: Map<string, DevframeDockUserEntry>;
181
+ readonly events: EventEmitter<{
182
+ 'dock:entry:updated': (entry: DevframeDockUserEntry) => void;
183
+ }>;
184
+ register: <T extends DevframeDockUserEntry>(entry: T, force?: boolean) => {
185
+ update: (patch: Partial<T>) => void;
186
+ };
187
+ update: (entry: DevframeDockUserEntry) => void;
188
+ values: (options?: {
189
+ includeBuiltin?: boolean;
190
+ }) => DevframeDockEntry[];
191
+ }
192
+ type DevframeDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~builtin' | (string & {});
193
+ type DevframeDockEntryIcon = string | {
194
+ light: string;
195
+ dark: string;
196
+ };
197
+ interface DevframeDockEntryBase {
198
+ id: string;
199
+ title: string;
200
+ icon: DevframeDockEntryIcon;
201
+ /**
202
+ * The default order of the entry in the dock.
203
+ * The higher the number the earlier it appears.
204
+ * @default 0
205
+ */
206
+ defaultOrder?: number;
207
+ /**
208
+ * The category of the entry
209
+ * @default 'default'
210
+ */
211
+ category?: DevframeDockEntryCategory;
212
+ /**
213
+ * Conditional visibility expression.
214
+ * When set, the dock entry is only visible when the expression evaluates to true.
215
+ * Uses the same syntax as command `when` clauses.
216
+ *
217
+ * Set to `'false'` to unconditionally hide the entry.
218
+ *
219
+ * @example 'clientType == embedded'
220
+ * @see {@link import('devframe/utils/when').evaluateWhen}
221
+ */
222
+ when?: string;
223
+ /**
224
+ * Badge text to display on the dock icon (e.g., unread count)
225
+ */
226
+ badge?: string;
227
+ /**
228
+ * Id of the group this entry belongs to. When set, hosts collapse this entry
229
+ * under the matching group's button instead of showing it directly on the
230
+ * dock bar.
231
+ *
232
+ * This is a flat pointer — membership, not containment. The entry stays an
233
+ * independently-registered, top-level entry; only its rendering is grouped
234
+ * downstream. If the referenced group is never registered, the entry renders
235
+ * as a normal top-level entry (orphan tolerance).
236
+ *
237
+ * @see {@link DevframeViewGroup}
238
+ */
239
+ groupId?: string;
240
+ }
241
+ interface ClientScriptEntry {
242
+ /**
243
+ * The filepath or module name to import from
244
+ */
245
+ importFrom: string;
246
+ /**
247
+ * The name to import the module as
248
+ *
249
+ * @default 'default'
250
+ */
251
+ importName?: string;
252
+ }
253
+ interface DevframeViewIframe extends DevframeDockEntryBase {
254
+ type: 'iframe';
255
+ url: string;
256
+ /**
257
+ * The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
258
+ *
259
+ * When not provided, it would be treated as a unique frame.
260
+ */
261
+ frameId?: string;
262
+ /**
263
+ * Optional client script to import into the iframe
264
+ */
265
+ clientScript?: ClientScriptEntry;
266
+ /**
267
+ * Enable remote-UI mode: the hub injects a connection descriptor
268
+ * (WS URL + pre-approved auth token) into the iframe URL so a hosted
269
+ * page can connect back via `connectRemoteDevframe()` from
270
+ * `@devframes/hub/client` — without needing to ship a dist with the
271
+ * plugin.
272
+ *
273
+ * Requires dev mode (no effect in build mode — no WS server exists).
274
+ * When enabled, the dock is automatically hidden in build mode unless
275
+ * the author provides an explicit `when` clause.
276
+ */
277
+ remote?: boolean | RemoteDockOptions;
278
+ }
279
+ interface RemoteDockOptions {
280
+ /**
281
+ * How to pass the connection descriptor to the hosted page.
282
+ *
283
+ * - `'fragment'` (default): appended as a URL fragment.
284
+ * Not sent in HTTP requests or Referer headers — safest for auth tokens.
285
+ * - `'query'`: appended as a URL query parameter. Use when your hosting
286
+ * platform rewrites fragments or your SPA router repurposes the fragment
287
+ * for navigation. The token will appear in server access logs and
288
+ * outbound Referer headers.
289
+ *
290
+ * @default 'fragment'
291
+ */
292
+ transport?: 'fragment' | 'query';
293
+ /**
294
+ * Reject WS handshakes whose `Origin` header doesn't match the dock URL
295
+ * origin. Turn off when the same hosted app is served from multiple
296
+ * origins (e.g. preview deploys).
297
+ *
298
+ * @default true
299
+ */
300
+ originLock?: boolean;
301
+ }
302
+ interface RemoteConnectionInfo extends ConnectionMeta {
303
+ backend: 'websocket';
304
+ websocket: string;
305
+ v: 1;
306
+ authToken: string;
307
+ origin: string;
308
+ }
309
+ type DevframeViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
310
+ interface DevframeViewLauncher extends DevframeDockEntryBase {
311
+ type: 'launcher';
312
+ launcher: {
313
+ icon?: DevframeDockEntryIcon;
314
+ title: string;
315
+ status?: DevframeViewLauncherStatus;
316
+ error?: string;
317
+ description?: string;
318
+ buttonStart?: string;
319
+ buttonLoading?: string;
320
+ onLaunch: () => Promise<void>;
321
+ };
322
+ }
323
+ interface DevframeViewAction extends DevframeDockEntryBase {
324
+ type: 'action';
325
+ action: ClientScriptEntry;
326
+ }
327
+ interface DevframeViewCustomRender extends DevframeDockEntryBase {
328
+ type: 'custom-render';
329
+ renderer: ClientScriptEntry;
330
+ }
331
+ interface DevframeViewBuiltin extends DevframeDockEntryBase {
332
+ type: '~builtin';
333
+ id: '~terminals' | '~messages' | '~client-auth-notice' | '~settings' | '~popup';
334
+ }
335
+ interface DevframeViewJsonRender extends DevframeDockEntryBase {
336
+ type: 'json-render';
337
+ /** JsonRenderer handle created by ctx.createJsonRenderer() */
338
+ ui: JsonRenderer;
339
+ }
340
+ /**
341
+ * A dock group: a single dock-bar button that collapses every entry whose
342
+ * {@link DevframeDockEntryBase.groupId} matches this group's `id`.
343
+ *
344
+ * A group carries its own `title`/`icon`/`category`/`defaultOrder`/`when`
345
+ * (inherited from {@link DevframeDockEntryBase}) and has no view payload of its
346
+ * own — hosts render its members in a popover / sub-navigation. It flows
347
+ * through the same `register`/`update`/`values` machinery as every other entry,
348
+ * keyed by `id`.
349
+ *
350
+ * Grouping is one level deep: a group entry must not itself set `groupId`.
351
+ */
352
+ interface DevframeViewGroup extends DevframeDockEntryBase {
353
+ type: 'group';
354
+ /**
355
+ * Member id auto-opened when the group button is activated. When unset,
356
+ * activating the group only reveals its members (popover-only); no view
357
+ * opens until a member is chosen.
358
+ */
359
+ defaultChildId?: string;
360
+ }
361
+ type DevframeDockUserEntry = DevframeViewIframe | DevframeViewAction | DevframeViewCustomRender | DevframeViewLauncher | DevframeViewJsonRender | DevframeViewGroup;
362
+ type DevframeDockEntry = DevframeDockUserEntry | DevframeViewBuiltin;
363
+ type DevframeDockEntriesGrouped = [category: string, entries: DevframeDockEntry[]][];
364
+ //#endregion
365
+ //#region src/types/terminals.d.ts
366
+ interface DevframeTerminalsHost {
367
+ readonly sessions: Map<string, DevframeTerminalSession>;
368
+ readonly events: EventEmitter<{
369
+ 'terminal:session:updated': (session: DevframeTerminalSession) => void;
370
+ }>;
371
+ register: (session: DevframeTerminalSession) => DevframeTerminalSession;
372
+ update: (session: DevframeTerminalSession) => void;
373
+ startChildProcess: (executeOptions: DevframeChildProcessExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>) => Promise<DevframeChildProcessTerminalSession>;
374
+ }
375
+ type DevframeTerminalStatus = 'running' | 'stopped' | 'error';
376
+ interface DevframeTerminalSessionBase {
377
+ id: string;
378
+ title: string;
379
+ description?: string;
380
+ status: DevframeTerminalStatus;
381
+ icon?: DevframeDockEntryIcon;
382
+ }
383
+ interface DevframeTerminalSession extends DevframeTerminalSessionBase {
384
+ buffer?: string[];
385
+ stream?: ReadableStream<string>;
386
+ }
387
+ interface DevframeChildProcessExecuteOptions {
388
+ command: string;
389
+ args: string[];
390
+ cwd?: string;
391
+ env?: Record<string, string>;
392
+ }
393
+ interface DevframeChildProcessTerminalSession extends DevframeTerminalSession {
394
+ type: 'child-process';
395
+ executeOptions: DevframeChildProcessExecuteOptions;
396
+ getChildProcess: () => ChildProcess | undefined;
397
+ terminate: () => Promise<void>;
398
+ restart: () => Promise<void>;
399
+ }
400
+ //#endregion
401
+ //#region src/node/context.d.ts
402
+ /**
403
+ * Hub-augmented node context — extends devframe's framework-neutral
404
+ * `DevframeNodeContext` with the hub-level subsystems (`docks`,
405
+ * `terminals`, `messages`, `commands`) and the `createJsonRenderer`
406
+ * factory.
407
+ *
408
+ * Framework kits further extend this with their own slots (e.g.
409
+ * `viteConfig`, `viteServer`). Host-specific capabilities (editor open,
410
+ * filesystem reveal, etc.) ship as kit-registered RPC functions rather
411
+ * than as part of this surface.
412
+ */
413
+ interface DevframeHubContext extends DevframeNodeContext {
414
+ readonly host: DevframeHost;
415
+ docks: DevframeDocksHost;
416
+ terminals: DevframeTerminalsHost;
417
+ messages: DevframeMessagesHost;
418
+ commands: DevframeCommandsHost;
419
+ /**
420
+ * Create a JsonRenderer handle for building json-render powered UIs.
421
+ */
422
+ createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
423
+ }
424
+ interface CreateHubContextOptions extends CreateHostContextOptions {}
425
+ /**
426
+ * Create a hub-level node context: wraps devframe's `createHostContext`,
427
+ * attaches the hub hosts (`docks`, `terminals`, `messages`, `commands`),
428
+ * registers the hub's built-in RPC commands, and wires the shared-state
429
+ * synchronization that powers a hub-aware client UI.
430
+ */
431
+ declare function createHubContext(options: CreateHubContextOptions): Promise<DevframeHubContext>;
432
+ //#endregion
433
+ export { JsonRenderer as A, DevframeViewJsonRender as C, RemoteDockOptions as D, RemoteConnectionInfo as E, DevframeMessageFilePosition as F, DevframeMessageHandle as I, DevframeMessageLevel as L, DevframeMessageEntry as M, DevframeMessageEntryFrom as N, JsonRenderElement as O, DevframeMessageEntryInput as P, DevframeMessagesClient as R, DevframeViewIframe as S, DevframeViewLauncherStatus as T, DevframeDocksHost as _, DevframeChildProcessTerminalSession as a, DevframeViewCustomRender as b, DevframeTerminalStatus as c, DevframeDockEntriesGrouped as d, DevframeDockEntry as f, DevframeDockUserEntry as g, DevframeDockEntryIcon as h, DevframeChildProcessExecuteOptions as i, DevframeMessageElementPosition as j, JsonRenderSpec as k, DevframeTerminalsHost as l, DevframeDockEntryCategory as m, DevframeHubContext as n, DevframeTerminalSession as o, DevframeDockEntryBase as p, createHubContext as r, DevframeTerminalSessionBase as s, CreateHubContextOptions as t, ClientScriptEntry as u, DevframeViewAction as v, DevframeViewLauncher as w, DevframeViewGroup as x, DevframeViewBuiltin as y, DevframeMessagesHost as z };
@@ -0,0 +1,14 @@
1
+ import { createDefineWrapperWithContext } from "devframe/rpc";
2
+ //#region src/define.ts
3
+ const defineHubRpcFunction = createDefineWrapperWithContext();
4
+ function defineCommand(command) {
5
+ return command;
6
+ }
7
+ function defineDockEntry(entry) {
8
+ return entry;
9
+ }
10
+ function defineJsonRenderSpec(spec) {
11
+ return spec;
12
+ }
13
+ //#endregion
14
+ export { defineJsonRenderSpec as i, defineDockEntry as n, defineHubRpcFunction as r, defineCommand as t };
@@ -0,0 +1,3 @@
1
+ import { RpcDefinitionsFilter, RpcDefinitionsToFunctions } from "devframe/rpc";
2
+ 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";
3
+ 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 };
@@ -0,0 +1,17 @@
1
+ import { A as JsonRenderer, C as DevframeViewJsonRender, D as RemoteDockOptions, E as RemoteConnectionInfo, F as DevframeMessageFilePosition, I as DevframeMessageHandle, L as DevframeMessageLevel, M as DevframeMessageEntry, N as DevframeMessageEntryFrom, O as JsonRenderElement, P as DevframeMessageEntryInput, R as DevframeMessagesClient, S as DevframeViewIframe, T as DevframeViewLauncherStatus, _ as DevframeDocksHost, a as DevframeChildProcessTerminalSession, b as DevframeViewCustomRender, c as DevframeTerminalStatus, d as DevframeDockEntriesGrouped, f as DevframeDockEntry, g as DevframeDockUserEntry, h as DevframeDockEntryIcon, i as DevframeChildProcessExecuteOptions, j as DevframeMessageElementPosition, k as JsonRenderSpec, l as DevframeTerminalsHost, m as DevframeDockEntryCategory, n as DevframeHubContext, o as DevframeTerminalSession, p as DevframeDockEntryBase, s as DevframeTerminalSessionBase, t as CreateHubContextOptions, u as ClientScriptEntry, v as DevframeViewAction, w as DevframeViewLauncher, x as DevframeViewGroup, y as DevframeViewBuiltin, z as DevframeMessagesHost } from "./context-Dox-G9vt.mjs";
2
+ import { a as DevframeCommandHandle, c as DevframeCommandsHost, d as DevframeServerCommandInput, i as DevframeCommandEntry, l as DevframeCommandsHostEvents, n as DevframeClientCommand, o as DevframeCommandKeybinding, r as DevframeCommandBase, s as DevframeCommandShortcutOverrides, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry } from "./settings-Bp5Ax6Os.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-BWTfvdqa.mjs";
4
+ import * as _$devframe_rpc0 from "devframe/rpc";
5
+ import { WhenContext, WhenExpression } from "devframe/utils/when";
6
+
7
+ //#region src/define.d.ts
8
+ declare const defineHubRpcFunction: <NAME extends string, TYPE extends _$devframe_rpc0.RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends _$devframe_rpc0.RpcArgsSchema | undefined = undefined, const RS extends _$devframe_rpc0.RpcReturnSchema | undefined = undefined>(definition: _$devframe_rpc0.RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>) => _$devframe_rpc0.RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeHubContext>;
9
+ declare function defineCommand<const W extends string = ''>(command: Omit<DevframeServerCommandInput, 'when'> & {
10
+ when?: WhenExpression<WhenContext, W>;
11
+ }): DevframeServerCommandInput;
12
+ declare function defineDockEntry<const T extends DevframeDockUserEntry, const W extends string = ''>(entry: Omit<T, 'when'> & {
13
+ when?: WhenExpression<WhenContext, W>;
14
+ }): T;
15
+ declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
16
+ //#endregion
17
+ export { ClientScriptEntry, ConnectionMeta, CreateHubContextOptions, DevframeCapabilities, DevframeChildProcessExecuteOptions, DevframeChildProcessTerminalSession, DevframeClientCommand, DevframeCommandBase, DevframeCommandEntry, DevframeCommandHandle, DevframeCommandKeybinding, DevframeCommandShortcutOverrides, DevframeCommandsHost, DevframeCommandsHostEvents, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockUserEntry, DevframeDocksHost, DevframeDocksUserSettings, DevframeHost, DevframeHubContext, DevframeMessageElementPosition, DevframeMessageEntry, DevframeMessageEntryFrom, DevframeMessageEntryInput, DevframeMessageFilePosition, DevframeMessageHandle, DevframeMessageLevel, DevframeMessagesClient, DevframeMessagesHost, DevframeNodeRpcSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeServerCommandEntry, DevframeServerCommandInput, DevframeTerminalSession, DevframeTerminalSessionBase, DevframeTerminalStatus, DevframeTerminalsHost, DevframeViewAction, DevframeViewBuiltin, DevframeViewCustomRender, DevframeViewGroup, DevframeViewHost, DevframeViewIframe, DevframeViewJsonRender, DevframeViewLauncher, DevframeViewLauncherStatus, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, RpcBroadcastOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineCommand, defineDockEntry, defineHubRpcFunction, defineJsonRenderSpec };
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { i as defineJsonRenderSpec, n as defineDockEntry, r as defineHubRpcFunction, t as defineCommand } from "./define-tHP6fX6A.mjs";
2
+ export { defineCommand, defineDockEntry, defineHubRpcFunction, defineJsonRenderSpec };
@@ -0,0 +1,165 @@
1
+ import { I as DevframeMessageHandle, M as DevframeMessageEntry, P as DevframeMessageEntryInput, S as DevframeViewIframe, _ as DevframeDocksHost$1, a as DevframeChildProcessTerminalSession, f as DevframeDockEntry, g as DevframeDockUserEntry, i as DevframeChildProcessExecuteOptions, l as DevframeTerminalsHost$1, n as DevframeHubContext, o as DevframeTerminalSession, r as createHubContext, s as DevframeTerminalSessionBase, t as CreateHubContextOptions, u as ClientScriptEntry, z as DevframeMessagesHost$1 } from "../context-Dox-G9vt.mjs";
2
+ import { a as DevframeCommandHandle, c as DevframeCommandsHost$1, d as DevframeServerCommandInput, t as DevframeDocksUserSettings, u as DevframeServerCommandEntry } from "../settings-Bp5Ax6Os.mjs";
3
+ import * as _$devframe_rpc0 from "devframe/rpc";
4
+ import { RpcFunctionDefinitionAny } from "devframe/rpc";
5
+ import { DevframeDefinition } from "devframe/types";
6
+ import { SharedState } from "devframe/utils/shared-state";
7
+ import * as _$devframe from "devframe";
8
+
9
+ //#region src/node/host-commands.d.ts
10
+ declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
11
+ readonly context: DevframeHubContext;
12
+ readonly commands: DevframeCommandsHost$1['commands'];
13
+ readonly events: DevframeCommandsHost$1['events'];
14
+ constructor(context: DevframeHubContext);
15
+ register(command: DevframeServerCommandInput): DevframeCommandHandle;
16
+ unregister(id: string): boolean;
17
+ execute(id: string, ...args: any[]): Promise<unknown>;
18
+ list(): DevframeServerCommandEntry[];
19
+ private findCommand;
20
+ private toSerializable;
21
+ }
22
+ //#endregion
23
+ //#region src/node/host-docks.d.ts
24
+ declare class DevframeDocksHost implements DevframeDocksHost$1 {
25
+ readonly context: DevframeHubContext;
26
+ readonly views: DevframeDocksHost$1['views'];
27
+ readonly events: DevframeDocksHost$1['events'];
28
+ userSettings: SharedState<DevframeDocksUserSettings>;
29
+ /** Dock-id → allocated remote token + resolved options. */
30
+ private readonly remoteDocks;
31
+ constructor(context: DevframeHubContext);
32
+ init(): Promise<void>;
33
+ values({
34
+ includeBuiltin
35
+ }?: {
36
+ includeBuiltin?: boolean;
37
+ }): DevframeDockEntry[];
38
+ private projectView;
39
+ private resolveDevServerOrigin;
40
+ register<T extends DevframeDockUserEntry>(view: T, force?: boolean): {
41
+ update: (patch: Partial<T>) => void;
42
+ };
43
+ update(view: DevframeDockUserEntry): void;
44
+ private validateGroupMembership;
45
+ private prepareRemoteRegistration;
46
+ }
47
+ //#endregion
48
+ //#region src/node/host-messages.d.ts
49
+ declare class DevframeMessagesHost implements DevframeMessagesHost$1 {
50
+ readonly context: DevframeHubContext;
51
+ readonly entries: DevframeMessagesHost$1['entries'];
52
+ readonly events: DevframeMessagesHost$1['events'];
53
+ /** Tracks when each entry was last added or updated (monotonic) */
54
+ readonly lastModified: Map<string, number>;
55
+ /** Tracks recently removed entry IDs with their removal time */
56
+ readonly removals: Array<{
57
+ id: string;
58
+ time: number;
59
+ }>;
60
+ private _autoDeleteTimers;
61
+ private _clock;
62
+ private _tick;
63
+ constructor(context: DevframeHubContext);
64
+ add(input: DevframeMessageEntryInput): Promise<DevframeMessageHandle>;
65
+ update(id: string, patch: Partial<DevframeMessageEntryInput>): Promise<DevframeMessageEntry | undefined>;
66
+ remove(id: string): Promise<void>;
67
+ clear(): Promise<void>;
68
+ private _createHandle;
69
+ }
70
+ //#endregion
71
+ //#region src/node/host-terminals.d.ts
72
+ type PartialWithoutId<T extends {
73
+ id: string;
74
+ }> = Partial<T> & {
75
+ id: string;
76
+ };
77
+ declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
78
+ readonly context: DevframeHubContext;
79
+ readonly sessions: DevframeTerminalsHost$1['sessions'];
80
+ readonly events: DevframeTerminalsHost$1['events'];
81
+ private _boundStreams;
82
+ private _channel?;
83
+ constructor(context: DevframeHubContext);
84
+ /**
85
+ * Lazily acquire the streaming channel — `context.rpc` isn't assigned
86
+ * until after every host is constructed, so we can't grab it in the
87
+ * constructor.
88
+ */
89
+ private getStreamingChannel;
90
+ register(session: DevframeTerminalSession): DevframeTerminalSession;
91
+ update(patch: PartialWithoutId<DevframeTerminalSession>): void;
92
+ remove(session: DevframeTerminalSession): void;
93
+ private bindStream;
94
+ startChildProcess(executeOptions: DevframeChildProcessExecuteOptions, terminal: Omit<DevframeTerminalSessionBase, 'status'>): Promise<DevframeChildProcessTerminalSession>;
95
+ }
96
+ //#endregion
97
+ //#region src/node/mount-devframe.d.ts
98
+ interface MountDevframeOptions {
99
+ /**
100
+ * Mount path override. Defaults to `d.basePath` or `/__${d.id}/`.
101
+ */
102
+ base?: string;
103
+ /**
104
+ * Overrides for the auto-synthesized iframe dock entry. Use this to
105
+ * customize the entry's `category`, override the icon, hide it via
106
+ * `when`, etc. Cannot change `id`, `type`, or `url` — those are
107
+ * derived from the devframe definition.
108
+ */
109
+ dock?: Partial<Omit<DevframeViewIframe, 'id' | 'type' | 'url'>>;
110
+ }
111
+ /**
112
+ * Framework-neutral primitive — mounts a {@link DevframeDefinition} as a
113
+ * dock inside a hub-aware context: serves the devframe's SPA at the
114
+ * resolved base path, synthesizes an iframe dock entry from the
115
+ * definition's metadata, and runs the definition's `setup(ctx)`.
116
+ *
117
+ * Framework kits wrap this with their own plugin/middleware machinery —
118
+ * e.g. `@vitejs/devtools-kit`'s `createPluginFromDevframe` returns a
119
+ * Vite `Plugin` whose `devtools.setup` ultimately delegates here.
120
+ */
121
+ declare function mountDevframe(ctx: DevframeHubContext, d: DevframeDefinition, options?: MountDevframeOptions): Promise<void>;
122
+ //#endregion
123
+ //#region src/node/rpc-builtins.d.ts
124
+ /**
125
+ * `hub:commands:execute` — Invoke a registered server command by id. The
126
+ * arguments after `id` are forwarded to the command's `handler(...)`.
127
+ * Returns whatever the handler returns.
128
+ *
129
+ * Pairs with the `devframe:commands` shared state: clients read the list
130
+ * from the shared state and dispatch by id via this RPC.
131
+ */
132
+ declare const hubCommandsExecute: {
133
+ name: "hub:commands:execute";
134
+ type?: "action" | undefined;
135
+ cacheable?: boolean;
136
+ args?: undefined;
137
+ returns?: undefined;
138
+ jsonSerializable?: boolean;
139
+ agent?: _$devframe.RpcFunctionAgentOptions;
140
+ setup?: ((context: DevframeHubContext) => _$devframe_rpc0.Thenable<_$devframe_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>>) | undefined;
141
+ handler?: ((id: string, ...args: any[]) => Promise<unknown>) | undefined;
142
+ dump?: _$devframe_rpc0.RpcDump<[id: string, ...args: any[]], Promise<unknown>, DevframeHubContext> | undefined;
143
+ snapshot?: boolean;
144
+ __cache?: WeakMap<object, _$devframe_rpc0.Thenable<_$devframe_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>>> | undefined;
145
+ __promise?: _$devframe_rpc0.Thenable<_$devframe_rpc0.RpcFunctionSetupResult<[id: string, ...args: any[]], Promise<unknown>>> | undefined;
146
+ };
147
+ /**
148
+ * Framework-neutral RPC declarations auto-registered by
149
+ * {@link createHubContext}. Provide additional RPCs by passing your own
150
+ * array via `CreateHubContextOptions.builtinRpcDeclarations`; the hub's
151
+ * list is prepended automatically.
152
+ */
153
+ declare const builtinHubRpcDeclarations: readonly RpcFunctionDefinitionAny[];
154
+ //#endregion
155
+ //#region src/node/utils.d.ts
156
+ /**
157
+ * Create a quick `ClientScriptEntry` from an inline function or
158
+ * stringified code. Useful for prototyping `action` / `renderer`
159
+ * dock entries without setting up a separate importable module.
160
+ *
161
+ * @experimental Prefer a proper importable module for production use.
162
+ */
163
+ declare function createSimpleClientScript(fn: string | ((ctx: any) => void)): ClientScriptEntry;
164
+ //#endregion
165
+ export { CreateHubContextOptions, DevframeCommandsHost, DevframeDocksHost, DevframeHubContext, DevframeMessagesHost, DevframeTerminalsHost, MountDevframeOptions, builtinHubRpcDeclarations, createHubContext, createSimpleClientScript, hubCommandsExecute, mountDevframe };