@devframes/hub 0.9.11 → 0.9.15
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/{assemble-BvY5jfgi.mjs → assemble-B-ISfDe5.mjs} +1 -1
- package/dist/client/index.d.mts +59 -59
- package/dist/client/index.mjs +3 -1
- package/dist/{context-Cdrtg-Kk.mjs → context-C7AFekjP.mjs} +4 -26
- package/dist/index.d.mts +4 -4
- package/dist/node/build.d.mts +7 -5
- package/dist/node/build.mjs +14 -5
- package/dist/node/index.d.mts +18 -18
- package/dist/node/index.mjs +1 -1
- package/dist/node/initiate.d.mts +20 -8
- package/dist/node/initiate.mjs +11 -3
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as resolveClientModuleSpecifier } from "./remote-url-UClKLQ5_.mjs";
|
|
2
|
-
import { v as prepareDevframe, y as diagnostics } from "./context-
|
|
2
|
+
import { v as prepareDevframe, y as diagnostics } from "./context-C7AFekjP.mjs";
|
|
3
3
|
import { joinURL, withTrailingSlash } from "ufo";
|
|
4
4
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_WS_ROUTE } from "devframe/constants";
|
|
5
5
|
import { existsSync } from "node:fs";
|
package/dist/client/index.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ export * from "devframe/client";
|
|
|
17
17
|
* viewer. With neither, it stays unchanged, since a page import map may
|
|
18
18
|
* still cover it.
|
|
19
19
|
*/
|
|
20
|
-
declare function resolveClientModuleSpecifier(specifier: string, options?: {
|
|
20
|
+
export declare function resolveClientModuleSpecifier(specifier: string, options?: {
|
|
21
21
|
resolveClientModule?: (specifier: string) => string | undefined;
|
|
22
22
|
template?: string;
|
|
23
23
|
metaBaseUrl?: string;
|
|
@@ -28,13 +28,13 @@ declare function resolveClientModuleSpecifier(specifier: string, options?: {
|
|
|
28
28
|
* declared specifier, `specifier` what was actually imported (after
|
|
29
29
|
* {@link resolveClientModuleSpecifier}).
|
|
30
30
|
*/
|
|
31
|
-
declare function clientScriptFailureHint(importFrom: string, specifier: string): string;
|
|
31
|
+
export declare function clientScriptFailureHint(importFrom: string, specifier: string): string;
|
|
32
32
|
//#endregion
|
|
33
33
|
//#region src/client/renderers.d.ts
|
|
34
34
|
/**
|
|
35
35
|
* Options handed to a dock renderer when the client host mounts a dock entry.
|
|
36
36
|
*/
|
|
37
|
-
interface DockRendererMountOptions<Entry extends DevframeDockEntry = DevframeDockEntry> {
|
|
37
|
+
export interface DockRendererMountOptions<Entry extends DevframeDockEntry = DevframeDockEntry> {
|
|
38
38
|
/** The dock entry being rendered (carries the entry's serializable payload). */
|
|
39
39
|
entry: Entry;
|
|
40
40
|
/**
|
|
@@ -50,7 +50,7 @@ interface DockRendererMountOptions<Entry extends DevframeDockEntry = DevframeDoc
|
|
|
50
50
|
context: DevframeClientContext;
|
|
51
51
|
}
|
|
52
52
|
/** A mounted renderer instance the host can tear down. */
|
|
53
|
-
interface DockRendererInstance {
|
|
53
|
+
export interface DockRendererInstance {
|
|
54
54
|
/** Tear down the mounted UI and release its subscriptions. */
|
|
55
55
|
dispose?: () => void;
|
|
56
56
|
}
|
|
@@ -66,14 +66,14 @@ interface DockRendererInstance {
|
|
|
66
66
|
* e.g. `@devframes/json-render/hub` exports
|
|
67
67
|
* `JsonRenderDockRenderer = DockRenderer<DevframeJsonRenderDockEntry>`.
|
|
68
68
|
*/
|
|
69
|
-
type DockRenderer<Entry extends DevframeDockEntry = DevframeDockEntry> = (options: DockRendererMountOptions<Entry>) => DockRendererInstance | Promise<DockRendererInstance>;
|
|
69
|
+
export type DockRenderer<Entry extends DevframeDockEntry = DevframeDockEntry> = (options: DockRendererMountOptions<Entry>) => DockRendererInstance | Promise<DockRendererInstance>;
|
|
70
70
|
/**
|
|
71
71
|
* The outcome of {@link DockRenderersContext.mount}. A missing renderer is an
|
|
72
72
|
* expected, non-exceptional state: a viewer renders its "no renderer for this
|
|
73
73
|
* dock type" fallback from `missing-renderer`, and its error variant (with a
|
|
74
74
|
* retry affordance) from `load-error`.
|
|
75
75
|
*/
|
|
76
|
-
type DockRendererMountResult = {
|
|
76
|
+
export type DockRendererMountResult = {
|
|
77
77
|
status: 'mounted';
|
|
78
78
|
dispose: () => void;
|
|
79
79
|
} | {
|
|
@@ -89,7 +89,7 @@ type DockRendererMountResult = {
|
|
|
89
89
|
* hub's renderer manifest) into a container it owns; the host tracks the
|
|
90
90
|
* instance and disposes it when the entry deactivates.
|
|
91
91
|
*/
|
|
92
|
-
interface DockRenderersContext {
|
|
92
|
+
export interface DockRenderersContext {
|
|
93
93
|
/**
|
|
94
94
|
* Register a renderer for a dock `type`. Returns an unregister function.
|
|
95
95
|
* Accepts a renderer narrowed to any specific entry variant (e.g. a
|
|
@@ -125,9 +125,9 @@ interface DockRenderersContext {
|
|
|
125
125
|
* convention: the module's `importName` export (default `'default'`) is a
|
|
126
126
|
* ready {@link DockRenderer}.
|
|
127
127
|
*/
|
|
128
|
-
type DockRendererManifest = Record<string, ClientScriptEntry>;
|
|
128
|
+
export type DockRendererManifest = Record<string, ClientScriptEntry>;
|
|
129
129
|
/** Options for {@link createDockRenderersContext}. */
|
|
130
|
-
interface CreateDockRenderersContextOptions {
|
|
130
|
+
export interface CreateDockRenderersContextOptions {
|
|
131
131
|
/** The assembled client context handed to renderers at mount. */
|
|
132
132
|
context: () => DevframeClientContext;
|
|
133
133
|
/** Renderers registered locally at boot; these win over manifest modules. */
|
|
@@ -148,10 +148,10 @@ interface CreateDockRenderersContextOptions {
|
|
|
148
148
|
* (`@devframes/hub-ui`) both delegate here so local-first resolution, lazy
|
|
149
149
|
* manifest imports, and the typed mount result behave identically everywhere.
|
|
150
150
|
*/
|
|
151
|
-
declare function createDockRenderersContext(options: CreateDockRenderersContextOptions): DockRenderersContext;
|
|
151
|
+
export declare function createDockRenderersContext(options: CreateDockRenderersContextOptions): DockRenderersContext;
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/client/docks.d.ts
|
|
154
|
-
interface DockPanelStorage {
|
|
154
|
+
export interface DockPanelStorage {
|
|
155
155
|
mode: 'float' | 'edge';
|
|
156
156
|
width: number;
|
|
157
157
|
height: number;
|
|
@@ -170,7 +170,7 @@ interface DockPanelStorage {
|
|
|
170
170
|
* the same dev server each keep their own selection rather than fighting over a
|
|
171
171
|
* shared one. Every field is serializable.
|
|
172
172
|
*/
|
|
173
|
-
interface DockSessionStorage {
|
|
173
|
+
export interface DockSessionStorage {
|
|
174
174
|
/** Whether the dock panel is open. */
|
|
175
175
|
open: boolean;
|
|
176
176
|
/** The currently selected dock entry id, or `null` when nothing is open. */
|
|
@@ -203,8 +203,8 @@ interface DockSessionStorage {
|
|
|
203
203
|
*/
|
|
204
204
|
groupLastChildIds?: Record<string, string>;
|
|
205
205
|
}
|
|
206
|
-
type DockClientType = 'embedded' | 'standalone';
|
|
207
|
-
interface DocksContext extends DevframeRpcContext {
|
|
206
|
+
export type DockClientType = 'embedded' | 'standalone';
|
|
207
|
+
export interface DocksContext extends DevframeRpcContext {
|
|
208
208
|
/**
|
|
209
209
|
* Type of the client environment
|
|
210
210
|
*
|
|
@@ -241,7 +241,7 @@ interface DocksContext extends DevframeRpcContext {
|
|
|
241
241
|
*/
|
|
242
242
|
readonly renderers: DockRenderersContext;
|
|
243
243
|
}
|
|
244
|
-
interface DocksConnectionContext {
|
|
244
|
+
export interface DocksConnectionContext {
|
|
245
245
|
/** The current connection status. */
|
|
246
246
|
readonly status: DevframeConnectionStatus;
|
|
247
247
|
/** The most recent connection-level error, or `null` when healthy. */
|
|
@@ -252,18 +252,18 @@ interface DocksConnectionContext {
|
|
|
252
252
|
*/
|
|
253
253
|
readonly events: EventEmitter<RpcClientEvents$1>;
|
|
254
254
|
}
|
|
255
|
-
interface WhenClauseContext {
|
|
255
|
+
export interface WhenClauseContext {
|
|
256
256
|
/**
|
|
257
257
|
* Get the current when-clause context snapshot.
|
|
258
258
|
* Returns a reactive object with built-in variables and any custom plugin variables.
|
|
259
259
|
*/
|
|
260
260
|
readonly context: WhenContext;
|
|
261
261
|
}
|
|
262
|
-
type DevframeClientContext = DocksContext;
|
|
263
|
-
interface DocksPanelEvents {
|
|
262
|
+
export type DevframeClientContext = DocksContext;
|
|
263
|
+
export interface DocksPanelEvents {
|
|
264
264
|
'panel:state:changed': (panelState: DevframeDockPanelState) => void;
|
|
265
265
|
}
|
|
266
|
-
interface DocksPanelContext {
|
|
266
|
+
export interface DocksPanelContext {
|
|
267
267
|
/** The current panel state snapshot. */
|
|
268
268
|
readonly state: DevframeDockPanelState;
|
|
269
269
|
/** Subscribe to panel state changes after the current snapshot. */
|
|
@@ -289,7 +289,7 @@ interface DocksPanelContext {
|
|
|
289
289
|
*/
|
|
290
290
|
consumeBootRoute?: (id: string) => string | null;
|
|
291
291
|
}
|
|
292
|
-
interface DocksEntriesContext {
|
|
292
|
+
export interface DocksEntriesContext {
|
|
293
293
|
selectedId: string | null;
|
|
294
294
|
selectedRoute: string | null;
|
|
295
295
|
readonly selected: DevframeDockEntry | null;
|
|
@@ -341,7 +341,7 @@ interface DocksEntriesContext {
|
|
|
341
341
|
*/
|
|
342
342
|
update: (entry: DevframeDockUserEntry) => void;
|
|
343
343
|
}
|
|
344
|
-
interface DockRegistration<T extends DevframeDockEntry = DevframeDockEntry> {
|
|
344
|
+
export interface DockRegistration<T extends DevframeDockEntry = DevframeDockEntry> {
|
|
345
345
|
/**
|
|
346
346
|
* Patch the registered client dock in place. The `id` is immutable, so passing
|
|
347
347
|
* a differing `id` throws.
|
|
@@ -350,7 +350,7 @@ interface DockRegistration<T extends DevframeDockEntry = DevframeDockEntry> {
|
|
|
350
350
|
/** Remove the client dock from the local merge. */
|
|
351
351
|
dispose: () => void;
|
|
352
352
|
}
|
|
353
|
-
interface DockEntryState {
|
|
353
|
+
export interface DockEntryState {
|
|
354
354
|
entryMeta: DevframeDockEntry;
|
|
355
355
|
readonly isActive: boolean;
|
|
356
356
|
domElements: {
|
|
@@ -359,14 +359,14 @@ interface DockEntryState {
|
|
|
359
359
|
};
|
|
360
360
|
events: EventEmitter<DockEntryStateEvents>;
|
|
361
361
|
}
|
|
362
|
-
interface DockEntryStateEvents {
|
|
362
|
+
export interface DockEntryStateEvents {
|
|
363
363
|
'entry:activated': () => void;
|
|
364
364
|
'entry:deactivated': () => void;
|
|
365
365
|
'entry:updated': (newMeta: DevframeDockUserEntry) => void;
|
|
366
366
|
'dom:panel:mounted': (panel: HTMLDivElement) => void;
|
|
367
367
|
'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
|
|
368
368
|
}
|
|
369
|
-
interface CommandsContext {
|
|
369
|
+
export interface CommandsContext {
|
|
370
370
|
/**
|
|
371
371
|
* All commands (server + client)
|
|
372
372
|
*/
|
|
@@ -415,7 +415,7 @@ interface CommandsContext {
|
|
|
415
415
|
/**
|
|
416
416
|
* Context for client scripts running in dock entries
|
|
417
417
|
*/
|
|
418
|
-
interface DockClientScriptContext extends DocksContext {
|
|
418
|
+
export interface DockClientScriptContext extends DocksContext {
|
|
419
419
|
/**
|
|
420
420
|
* The state of the current dock entry
|
|
421
421
|
*/
|
|
@@ -432,13 +432,13 @@ declare const CLIENT_CONTEXT_KEY = "__DEVFRAME_HUB_CLIENT_CONTEXT__";
|
|
|
432
432
|
/**
|
|
433
433
|
* Get the global Devframe client context, or `undefined` if not yet initialized.
|
|
434
434
|
*/
|
|
435
|
-
declare function getDevframeClientContext(): DevframeClientContext | undefined;
|
|
435
|
+
export declare function getDevframeClientContext(): DevframeClientContext | undefined;
|
|
436
436
|
/**
|
|
437
437
|
* Publish the global Devframe client context (or clear it with `undefined`).
|
|
438
438
|
* Called by {@link import('./host').createDevframeClientRuntime}; a dock client
|
|
439
439
|
* script or a hub UI provider reads it back with {@link getDevframeClientContext}.
|
|
440
440
|
*/
|
|
441
|
-
declare function setDevframeClientContext(ctx: DevframeClientContext | undefined): void;
|
|
441
|
+
export declare function setDevframeClientContext(ctx: DevframeClientContext | undefined): void;
|
|
442
442
|
//#endregion
|
|
443
443
|
//#region src/client/dock-resources.d.ts
|
|
444
444
|
/**
|
|
@@ -446,9 +446,9 @@ declare function setDevframeClientContext(ctx: DevframeClientContext | undefined
|
|
|
446
446
|
* dock entry. This keeps root-relative and dot-relative paths on the host
|
|
447
447
|
* server when an external viewer renders the hub.
|
|
448
448
|
*/
|
|
449
|
-
declare function resolveDockUrl(url: string, connection: DevframeConnection): string;
|
|
449
|
+
export declare function resolveDockUrl(url: string, connection: DevframeConnection): string;
|
|
450
450
|
/** Resolve URL-backed dock icons while preserving Iconify names and data URLs. */
|
|
451
|
-
declare function resolveDockIcon(icon: DevframeDockEntryIcon, connection: DevframeConnection): DevframeDockEntryIcon;
|
|
451
|
+
export declare function resolveDockIcon(icon: DevframeDockEntryIcon, connection: DevframeConnection): DevframeDockEntryIcon;
|
|
452
452
|
//#endregion
|
|
453
453
|
//#region src/client/frame-location.d.ts
|
|
454
454
|
/**
|
|
@@ -481,12 +481,12 @@ declare function resolveDockIcon(icon: DevframeDockEntryIcon, connection: Devfra
|
|
|
481
481
|
* so the caller keeps the last URL it knew.
|
|
482
482
|
*/
|
|
483
483
|
/** The minimal `history` surface the watcher wraps. Injectable for tests. */
|
|
484
|
-
interface FrameLocationHistory {
|
|
484
|
+
export interface FrameLocationHistory {
|
|
485
485
|
pushState: (...args: any[]) => void;
|
|
486
486
|
replaceState: (...args: any[]) => void;
|
|
487
487
|
}
|
|
488
488
|
/** The minimal frame-window surface the watcher reads and subscribes to. */
|
|
489
|
-
interface FrameLocationWindow {
|
|
489
|
+
export interface FrameLocationWindow {
|
|
490
490
|
readonly location: {
|
|
491
491
|
readonly href: string;
|
|
492
492
|
};
|
|
@@ -500,12 +500,12 @@ interface FrameLocationWindow {
|
|
|
500
500
|
removeEventListener: (type: 'popstate' | 'hashchange', listener: () => void) => void;
|
|
501
501
|
}
|
|
502
502
|
/** The minimal iframe surface the watcher needs. Injectable for tests. */
|
|
503
|
-
interface FrameLocationTarget {
|
|
503
|
+
export interface FrameLocationTarget {
|
|
504
504
|
readonly contentWindow: FrameLocationWindow | null;
|
|
505
505
|
addEventListener: (type: 'load', listener: () => void) => void;
|
|
506
506
|
removeEventListener: (type: 'load', listener: () => void) => void;
|
|
507
507
|
}
|
|
508
|
-
interface WatchFrameLocationOptions {
|
|
508
|
+
export interface WatchFrameLocationOptions {
|
|
509
509
|
/** The live iframe whose location is tracked. */
|
|
510
510
|
iframe: FrameLocationTarget;
|
|
511
511
|
/** Called with the frame's `location.href` on each observed change. */
|
|
@@ -521,7 +521,7 @@ interface WatchFrameLocationOptions {
|
|
|
521
521
|
* detaches every listener and restores any wrapped `history` method, leaving the
|
|
522
522
|
* embedded page as it was found.
|
|
523
523
|
*/
|
|
524
|
-
declare function watchFrameLocation(options: WatchFrameLocationOptions): () => void;
|
|
524
|
+
export declare function watchFrameLocation(options: WatchFrameLocationOptions): () => void;
|
|
525
525
|
//#endregion
|
|
526
526
|
//#region src/client/frame-nav.d.ts
|
|
527
527
|
/**
|
|
@@ -544,11 +544,11 @@ declare function watchFrameLocation(options: WatchFrameLocationOptions): () => v
|
|
|
544
544
|
* decoupled, so the embedded app takes no hub/RPC dependency, only the shim.
|
|
545
545
|
*/
|
|
546
546
|
/** `postMessage` channel tag shared by both halves of the protocol. */
|
|
547
|
-
declare const FRAME_NAV_CHANNEL: string;
|
|
547
|
+
export declare const FRAME_NAV_CHANNEL: string;
|
|
548
548
|
/** Protocol version. */
|
|
549
|
-
declare const FRAME_NAV_VERSION = 1;
|
|
549
|
+
export declare const FRAME_NAV_VERSION = 1;
|
|
550
550
|
/** Envelope every frame-nav message carries. */
|
|
551
|
-
interface FrameNavEnvelope {
|
|
551
|
+
export interface FrameNavEnvelope {
|
|
552
552
|
channel: typeof FRAME_NAV_CHANNEL;
|
|
553
553
|
v: typeof FRAME_NAV_VERSION;
|
|
554
554
|
frameId: string;
|
|
@@ -559,7 +559,7 @@ interface FrameNavEnvelope {
|
|
|
559
559
|
* One tab in the manifest the shim reports. Maps directly onto a dock entry, so
|
|
560
560
|
* a materialized member dock is first-class.
|
|
561
561
|
*/
|
|
562
|
-
interface FrameTab {
|
|
562
|
+
export interface FrameTab {
|
|
563
563
|
/** Unique within the frame. The member dock id becomes `<frameId>:<id>`. */
|
|
564
564
|
id: string;
|
|
565
565
|
title: string;
|
|
@@ -579,7 +579,7 @@ interface FrameTab {
|
|
|
579
579
|
groupId?: string;
|
|
580
580
|
}
|
|
581
581
|
/** Host → frame message payloads (without the {@link FrameNavEnvelope}). */
|
|
582
|
-
type FrameNavHostPayload = {
|
|
582
|
+
export type FrameNavHostPayload = {
|
|
583
583
|
type: 'hello';
|
|
584
584
|
} | {
|
|
585
585
|
type: 'navigate';
|
|
@@ -587,11 +587,11 @@ type FrameNavHostPayload = {
|
|
|
587
587
|
navTarget: NavTarget;
|
|
588
588
|
};
|
|
589
589
|
/** Host → frame messages. */
|
|
590
|
-
type FrameNavHostMessage = FrameNavEnvelope & {
|
|
590
|
+
export type FrameNavHostMessage = FrameNavEnvelope & {
|
|
591
591
|
from: 'host';
|
|
592
592
|
} & FrameNavHostPayload;
|
|
593
593
|
/** Frame → host messages. */
|
|
594
|
-
type FrameNavFrameMessage = FrameNavEnvelope & {
|
|
594
|
+
export type FrameNavFrameMessage = FrameNavEnvelope & {
|
|
595
595
|
from: 'frame';
|
|
596
596
|
} & ({
|
|
597
597
|
type: 'ready';
|
|
@@ -607,11 +607,11 @@ type FrameNavFrameMessage = FrameNavEnvelope & {
|
|
|
607
607
|
navTarget?: NavTarget;
|
|
608
608
|
});
|
|
609
609
|
/** Minimal window surface the adapter listens on (injectable for tests). */
|
|
610
|
-
interface FrameNavListenTarget {
|
|
610
|
+
export interface FrameNavListenTarget {
|
|
611
611
|
addEventListener: (type: 'message', listener: (ev: MessageEvent) => void) => void;
|
|
612
612
|
removeEventListener: (type: 'message', listener: (ev: MessageEvent) => void) => void;
|
|
613
613
|
}
|
|
614
|
-
interface FrameNavClientOptions {
|
|
614
|
+
export interface FrameNavClientOptions {
|
|
615
615
|
/** The shared frame id (defaults to the anchor's, else the anchor id). */
|
|
616
616
|
frameId: string;
|
|
617
617
|
/** The anchor iframe dock entry, supplying url/icon/groupId defaults. */
|
|
@@ -630,7 +630,7 @@ interface FrameNavClientOptions {
|
|
|
630
630
|
/** @default 3000 */
|
|
631
631
|
handshakeTimeoutMs?: number;
|
|
632
632
|
}
|
|
633
|
-
interface FrameNavClient {
|
|
633
|
+
export interface FrameNavClient {
|
|
634
634
|
/** Whether the shim has completed its `ready` handshake. */
|
|
635
635
|
readonly ready: boolean;
|
|
636
636
|
/** The tab id currently shown in the frame, or `null`. */
|
|
@@ -642,10 +642,10 @@ interface FrameNavClient {
|
|
|
642
642
|
* exposing readiness/current state and a `dispose()` that removes every member
|
|
643
643
|
* dock it registered and detaches its listener.
|
|
644
644
|
*/
|
|
645
|
-
declare function attachFrameNavClient(options: FrameNavClientOptions): FrameNavClient;
|
|
645
|
+
export declare function attachFrameNavClient(options: FrameNavClientOptions): FrameNavClient;
|
|
646
646
|
//#endregion
|
|
647
647
|
//#region src/client/host.d.ts
|
|
648
|
-
interface DevframeClientRuntimeOptions {
|
|
648
|
+
export interface DevframeClientRuntimeOptions {
|
|
649
649
|
/**
|
|
650
650
|
* An already-connected RPC client. When omitted, one is created via
|
|
651
651
|
* `connectDevframe(connect)`, so pass `connect.baseURL` to point at the hub's
|
|
@@ -707,7 +707,7 @@ interface DevframeClientRuntimeOptions {
|
|
|
707
707
|
*/
|
|
708
708
|
categoryOrder?: Record<string, number>;
|
|
709
709
|
}
|
|
710
|
-
interface DevframeClientRuntime {
|
|
710
|
+
export interface DevframeClientRuntime {
|
|
711
711
|
/** The assembled, globally-registered client context. */
|
|
712
712
|
context: DevframeClientContext;
|
|
713
713
|
/** Tear down listeners and stop tracking newly-registered client scripts. */
|
|
@@ -723,16 +723,16 @@ interface DevframeClientRuntime {
|
|
|
723
723
|
* A hub UI provider keeps rendering its own dock UI (reading the same shared state); this
|
|
724
724
|
* runtime is what gives plugin client scripts a live host context to run in.
|
|
725
725
|
*/
|
|
726
|
-
declare function createDevframeClientRuntime(options?: DevframeClientRuntimeOptions): Promise<DevframeClientRuntime>;
|
|
726
|
+
export declare function createDevframeClientRuntime(options?: DevframeClientRuntimeOptions): Promise<DevframeClientRuntime>;
|
|
727
727
|
/** @deprecated Renamed; use {@link DevframeClientRuntimeOptions}. */
|
|
728
|
-
type DevframeClientHostOptions = DevframeClientRuntimeOptions;
|
|
728
|
+
export type DevframeClientHostOptions = DevframeClientRuntimeOptions;
|
|
729
729
|
/** @deprecated Renamed; use {@link DevframeClientRuntime}. */
|
|
730
|
-
type DevframeClientHost = DevframeClientRuntime;
|
|
730
|
+
export type DevframeClientHost = DevframeClientRuntime;
|
|
731
731
|
/** @deprecated Renamed; use {@link createDevframeClientRuntime}. */
|
|
732
|
-
declare const createDevframeClientHost: typeof createDevframeClientRuntime;
|
|
732
|
+
export declare const createDevframeClientHost: typeof createDevframeClientRuntime;
|
|
733
733
|
//#endregion
|
|
734
734
|
//#region src/client/messages.d.ts
|
|
735
|
-
interface MessagesClientOptions {
|
|
735
|
+
export interface MessagesClientOptions {
|
|
736
736
|
/**
|
|
737
737
|
* Default fields merged beneath every `add()` input. The client host passes
|
|
738
738
|
* `{ category: entry.id }` to scope a dock client script's messages to its
|
|
@@ -746,20 +746,20 @@ interface MessagesClientOptions {
|
|
|
746
746
|
* returned by `add` proxies `update`/`dismiss` back through the same RPCs, so a
|
|
747
747
|
* dock client script reports into the very feed the server writes to.
|
|
748
748
|
*/
|
|
749
|
-
declare function createMessagesClient(rpc: DevframeRpcClient, options?: MessagesClientOptions): DevframeMessagesClient;
|
|
749
|
+
export declare function createMessagesClient(rpc: DevframeRpcClient, options?: MessagesClientOptions): DevframeMessagesClient;
|
|
750
750
|
//#endregion
|
|
751
751
|
//#region src/remote-url.d.ts
|
|
752
752
|
/** Remove the remote connection descriptor from a URL before displaying or copying it. */
|
|
753
|
-
declare function stripRemoteConnectionFromUrl(input: string): string;
|
|
753
|
+
export declare function stripRemoteConnectionFromUrl(input: string): string;
|
|
754
754
|
//#endregion
|
|
755
755
|
//#region src/client/remote.d.ts
|
|
756
|
-
type ConnectRemoteDevframeOptions = Omit<DevframeRpcClientOptions, 'connectionMeta' | 'authToken'>;
|
|
756
|
+
export type ConnectRemoteDevframeOptions = Omit<DevframeRpcClientOptions, 'connectionMeta' | 'authToken'>;
|
|
757
757
|
/**
|
|
758
758
|
* Build an external viewer URL from an existing trusted Devframe connection.
|
|
759
759
|
* Returns the original URL if the connection has no auth token, does not use
|
|
760
760
|
* WebSockets, or has an invalid metadata URL.
|
|
761
761
|
*/
|
|
762
|
-
declare function buildRemoteDevframeUrl(url: string, connection: DevframeConnection): string;
|
|
762
|
+
export declare function buildRemoteDevframeUrl(url: string, connection: DevframeConnection): string;
|
|
763
763
|
/**
|
|
764
764
|
* Parse a {@link RemoteConnectionInfo} descriptor from the current page's URL
|
|
765
765
|
* (or a provided URL/string). Checks the URL fragment first, then the query.
|
|
@@ -767,7 +767,7 @@ declare function buildRemoteDevframeUrl(url: string, connection: DevframeConnect
|
|
|
767
767
|
* Returns `null` if no descriptor is present.
|
|
768
768
|
* Throws if the descriptor is malformed or its schema version is unsupported.
|
|
769
769
|
*/
|
|
770
|
-
declare function parseRemoteConnection(input?: string): RemoteConnectionInfo | null;
|
|
770
|
+
export declare function parseRemoteConnection(input?: string): RemoteConnectionInfo | null;
|
|
771
771
|
/**
|
|
772
772
|
* One-liner for a hosted Devframe page: reads the connection descriptor from
|
|
773
773
|
* the current URL and returns a connected {@link DevframeRpcClient}.
|
|
@@ -777,6 +777,6 @@ declare function parseRemoteConnection(input?: string): RemoteConnectionInfo | n
|
|
|
777
777
|
*
|
|
778
778
|
* @throws if no descriptor is present in the URL.
|
|
779
779
|
*/
|
|
780
|
-
declare function connectRemoteDevframe(options?: ConnectRemoteDevframeOptions): Promise<DevframeRpcClient>;
|
|
780
|
+
export declare function connectRemoteDevframe(options?: ConnectRemoteDevframeOptions): Promise<DevframeRpcClient>;
|
|
781
781
|
//#endregion
|
|
782
|
-
export { CLIENT_CONTEXT_KEY,
|
|
782
|
+
export { CLIENT_CONTEXT_KEY, type DevframeClientRpcHost, type RpcClientEvents };
|
package/dist/client/index.mjs
CHANGED
|
@@ -48,8 +48,8 @@ const diagnostics = defineDiagnostics({
|
|
|
48
48
|
fix: "A hub exposes one aggregate MCP endpoint over every mounted devframe, so per-devframe `mcp` settings are ignored. Drop `mcp: false` from `initHub` (the `'auto'` default mounts the aggregate route once agent tools exist) to surface this devframe's tools, or drop `mcp` from the devframe to silence this warning."
|
|
49
49
|
},
|
|
50
50
|
DF8006: {
|
|
51
|
-
why: (p) => `A static hub build
|
|
52
|
-
fix: "buildHub maps
|
|
51
|
+
why: (p) => `A static hub build writes each mount either under its base ("${p.base}") or as an absolute-path sibling of it, but "${p.urlBase}" is neither.`,
|
|
52
|
+
fix: "buildHub maps a mount under the hub base into its `outDir`, and any other mount to the deploy root (`outDir`'s parent) by its absolute path. Give the mount an absolute base (starting with `/`) so it resolves to one of those."
|
|
53
53
|
},
|
|
54
54
|
DF8100: {
|
|
55
55
|
why: (p) => `Dock with id "${p.id}" is already registered`,
|
|
@@ -162,29 +162,6 @@ async function resolvePageScriptClientScript(ctx, clientScript, base) {
|
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
* Framework-neutral primitive backing {@link DevframeHubContext.install} -
|
|
166
|
-
* installs a {@link DevframeDefinition} as a dock inside a hub-aware context:
|
|
167
|
-
* serves the devframe's SPA at the resolved base path, synthesizes an iframe
|
|
168
|
-
* dock entry from the definition's metadata, and runs the definition's
|
|
169
|
-
* `setup(ctx)`. Reach for it through `ctx.install(devframe)` rather than
|
|
170
|
-
* calling it directly.
|
|
171
|
-
*
|
|
172
|
-
* Framework kits wrap `ctx.install` with their own plugin/middleware
|
|
173
|
-
* machinery, e.g. `@vitejs/devtools-kit`'s `createPluginFromDevframe`
|
|
174
|
-
* returns a Vite `Plugin` whose `devtools.setup` ultimately delegates here.
|
|
175
|
-
*/
|
|
176
|
-
/**
|
|
177
|
-
* Phase one of an install: run the duplication guard, serve the SPA + meta,
|
|
178
|
-
* register the iframe dock, and queue the definition's declarative wire
|
|
179
|
-
* services, everything up to (but not including) `setup(ctx)`. Returns a
|
|
180
|
-
* deferred setup thunk, or `null` when the devframe was deduplicated.
|
|
181
|
-
*
|
|
182
|
-
* The hub's initial batch uses this to collect every devframe's services
|
|
183
|
-
* across the whole hub, `ready()` them once, and only then run the setups,
|
|
184
|
-
* so services are ready before any setup, and a plugin can consume a service
|
|
185
|
-
* another plugin declared regardless of mount order.
|
|
186
|
-
*/
|
|
187
|
-
/**
|
|
188
165
|
* Serve a devframe's SPA (and the hub's connection meta) under `base`, if the
|
|
189
166
|
* definition ships client assets.
|
|
190
167
|
*/
|
|
@@ -792,7 +769,8 @@ var DevframeTerminalsHost = class {
|
|
|
792
769
|
const result = await reader.read();
|
|
793
770
|
if (isDisposed() || result.done) break;
|
|
794
771
|
sessionBuffer.push(result.value);
|
|
795
|
-
if (sessionBuffer.length
|
|
772
|
+
if (sessionBuffer.length === 1001) sessionBuffer.shift();
|
|
773
|
+
else if (sessionBuffer.length > TERMINAL_BUFFER_LIMIT) sessionBuffer.splice(0, sessionBuffer.length - TERMINAL_BUFFER_LIMIT);
|
|
796
774
|
sink?.write(result.value);
|
|
797
775
|
}
|
|
798
776
|
if (!isDisposed() && sink && !sink.closed) sink.close();
|
package/dist/index.d.mts
CHANGED
|
@@ -3,13 +3,13 @@ import { A as DevframeViewIframe, C as DevframeDockUserEntry, D as DevframeViewB
|
|
|
3
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-Dv8iu9St.mjs";
|
|
4
4
|
import { WhenContext, WhenExpression } from "devframe/utils/when";
|
|
5
5
|
//#region src/define.d.ts
|
|
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>;
|
|
7
|
-
declare function defineCommand<const W extends string = ''>(command: Omit<DevframeServerCommandInput, 'when'> & {
|
|
6
|
+
export 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>;
|
|
7
|
+
export declare function defineCommand<const W extends string = ''>(command: Omit<DevframeServerCommandInput, 'when'> & {
|
|
8
8
|
when?: WhenExpression<WhenContext, W>;
|
|
9
9
|
}): DevframeServerCommandInput;
|
|
10
|
-
declare function defineDockEntry<const T extends DevframeDockUserEntry, const W extends string = '', const V extends string = ''>(entry: Omit<T, 'when' | 'visibility'> & {
|
|
10
|
+
export declare function defineDockEntry<const T extends DevframeDockUserEntry, const W extends string = '', const V extends string = ''>(entry: Omit<T, 'when' | 'visibility'> & {
|
|
11
11
|
when?: WhenExpression<WhenContext, W>;
|
|
12
12
|
visibility?: WhenExpression<WhenContext, V>;
|
|
13
13
|
}): T;
|
|
14
14
|
//#endregion
|
|
15
|
-
export {
|
|
15
|
+
export type { ClientScriptEntry, ConnectionMeta, CreateHubContextOptions, DevframeCapabilities, DevframeChildProcessExecuteOptions, DevframeChildProcessOutput, DevframeChildProcessResult, DevframeChildProcessTerminalSession, DevframeClientCommand, DevframeCommandAgentOptions, DevframeCommandBase, DevframeCommandEntry, DevframeCommandHandle, DevframeCommandKeybinding, DevframeCommandShortcutOverrides, DevframeCommandsHost, DevframeCommandsHostEvents, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockActivation, DevframeDockBadgeVariant, DevframeDockEntriesGrouped, DevframeDockEntry, DevframeDockEntryBase, DevframeDockEntryCategory, DevframeDockEntryIcon, DevframeDockEntryRegistry, DevframeDockPanelState, DevframeDockUserEntry, DevframeDocksActiveState, DevframeDocksHost, DevframeDocksUserSettings, DevframeHost, DevframeHubContext, DevframeMessageAction, DevframeMessageActivateAction, DevframeMessageCommandAction, DevframeMessageElementPosition, DevframeMessageEntry, DevframeMessageEntryFrom, DevframeMessageEntryInput, DevframeMessageFilePosition, DevframeMessageHandle, DevframeMessageLevel, DevframeMessageShortcutInput, DevframeMessagesClient, DevframeMessagesHost, DevframeMessagesLevelShortcuts, DevframeMessagesListDelta, DevframeNodeRpcSession, DevframePtyExecuteOptions, DevframePtyOutput, DevframePtyResult, DevframePtyTerminalSession, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeServerCommandEntry, DevframeServerCommandInput, DevframeTerminalSession, DevframeTerminalSessionBase, DevframeTerminalStatus, DevframeTerminalsHost, DevframeViewAction, DevframeViewBuiltin, DevframeViewCustomRender, DevframeViewGroup, DevframeViewHost, DevframeViewIframe, DevframeViewLauncher, DevframeViewLauncherStatus, EventEmitter, EventUnsubscribe, EventsMap, FrameSubTabsConfig, NavTarget, RemoteConnectionInfo, RemoteDockOptions, RpcBroadcastOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost };
|
package/dist/node/build.d.mts
CHANGED
|
@@ -2,12 +2,15 @@ import { n as DevframeHubContext, t as CreateHubContextOptions } from "../contex
|
|
|
2
2
|
import { DevframeHubUi, DevframesInput, DockRendererRegistration } from "./initiate.mjs";
|
|
3
3
|
import { DevframeServiceInput, DevframeStorageScope } from "devframe/types";
|
|
4
4
|
//#region src/node/build.d.ts
|
|
5
|
-
interface BuildHubOptions {
|
|
5
|
+
export interface BuildHubOptions {
|
|
6
6
|
/**
|
|
7
7
|
* Output directory the hub subtree is written into. It corresponds to the
|
|
8
8
|
* hub {@link BuildHubOptions.base} at serve time: building with
|
|
9
9
|
* `base: '/__devframes/'` into `dist/__devframes` makes the deployed app's
|
|
10
|
-
* `dist/` servable as-is by any static file server.
|
|
10
|
+
* `dist/` servable as-is by any static file server. A mount served outside
|
|
11
|
+
* the hub base (a devframe SPA or asset dir kept as a sibling of it) is
|
|
12
|
+
* written to this directory's parent (the deploy root) by its absolute path,
|
|
13
|
+
* so `dist/` still serves the whole layout.
|
|
11
14
|
*/
|
|
12
15
|
outDir: string;
|
|
13
16
|
/**
|
|
@@ -88,6 +91,5 @@ interface BuildHubOptions {
|
|
|
88
91
|
* Reads work from the baked dump; live writes (messages, terminals, commands
|
|
89
92
|
* execution) have no server and degrade to no-ops in the clients.
|
|
90
93
|
*/
|
|
91
|
-
declare function buildHub(options: BuildHubOptions): Promise<void>;
|
|
92
|
-
//#endregion
|
|
93
|
-
export { BuildHubOptions, buildHub };
|
|
94
|
+
export declare function buildHub(options: BuildHubOptions): Promise<void>;
|
|
95
|
+
//#endregion
|
package/dist/node/build.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY } from "../constants-Da23JxCZ.mjs";
|
|
2
|
-
import { t as createHubContext, y as diagnostics } from "../context-
|
|
3
|
-
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-
|
|
2
|
+
import { t as createHubContext, y as diagnostics } from "../context-C7AFekjP.mjs";
|
|
3
|
+
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-B-ISfDe5.mjs";
|
|
4
4
|
import { joinURL } from "ufo";
|
|
5
5
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME } from "devframe/constants";
|
|
6
6
|
import { existsSync } from "node:fs";
|
|
@@ -45,13 +45,22 @@ async function buildHub(options) {
|
|
|
45
45
|
await options.ui?.setup?.(ctx);
|
|
46
46
|
if (options.clean !== false && existsSync(outDir)) await fs.rm(outDir, { recursive: true });
|
|
47
47
|
await fs.mkdir(outDir, { recursive: true });
|
|
48
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Map a served URL base to its on-disk location. A base under the hub
|
|
50
|
+
* {@link base} writes into the hub subtree at `outDir` (so `outDir`
|
|
51
|
+
* corresponds to the hub base). A base outside it is a deploy-root sibling:
|
|
52
|
+
* `outDir`'s parent is the deploy root, and the base resolves under it by its
|
|
53
|
+
* absolute path. This is the layout Vite DevTools serves, where devframe SPAs
|
|
54
|
+
* and assets sit beside `/__devtools/` rather than under it.
|
|
55
|
+
*/
|
|
56
|
+
const deployRoot = dirname(outDir);
|
|
49
57
|
const resolveOutPath = (urlBase) => {
|
|
50
|
-
if (
|
|
58
|
+
if (urlBase.startsWith(base)) return resolve(outDir, urlBase.slice(base.length));
|
|
59
|
+
if (!urlBase.startsWith("/")) throw diagnostics.DF8006({
|
|
51
60
|
urlBase,
|
|
52
61
|
base
|
|
53
62
|
});
|
|
54
|
-
return resolve(
|
|
63
|
+
return resolve(deployRoot, urlBase.slice(1));
|
|
55
64
|
};
|
|
56
65
|
await copyBuildStatics(ctx, resolveOutPath);
|
|
57
66
|
await publishRendererManifest(ctx, rendererRegistrations, base, outDir);
|
package/dist/node/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ import { C as DevframeDockUserEntry, T as DevframeDocksHost$1, _ as DevframeDock
|
|
|
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
|
|
6
|
-
declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
6
|
+
export declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
7
7
|
readonly context: DevframeHubContext;
|
|
8
8
|
readonly commands: DevframeCommandsHost$1['commands'];
|
|
9
9
|
readonly events: DevframeCommandsHost$1['events'];
|
|
@@ -34,7 +34,7 @@ declare class DevframeCommandsHost implements DevframeCommandsHost$1 {
|
|
|
34
34
|
}
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region src/node/host-docks.d.ts
|
|
37
|
-
declare class DevframeDocksHost implements DevframeDocksHost$1 {
|
|
37
|
+
export declare class DevframeDocksHost implements DevframeDocksHost$1 {
|
|
38
38
|
readonly context: DevframeHubContext;
|
|
39
39
|
readonly views: DevframeDocksHost$1['views'];
|
|
40
40
|
readonly events: DevframeDocksHost$1['events'];
|
|
@@ -64,7 +64,7 @@ declare class DevframeDocksHost implements DevframeDocksHost$1 {
|
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
66
|
//#region src/node/host-messages.d.ts
|
|
67
|
-
declare class DevframeMessagesHost implements DevframeMessagesHost$1 {
|
|
67
|
+
export declare class DevframeMessagesHost implements DevframeMessagesHost$1 {
|
|
68
68
|
readonly context: DevframeHubContext;
|
|
69
69
|
readonly entries: DevframeMessagesHost$1['entries'];
|
|
70
70
|
readonly events: DevframeMessagesHost$1['events'];
|
|
@@ -105,7 +105,7 @@ type PartialWithoutId<T extends {
|
|
|
105
105
|
}> = Partial<T> & {
|
|
106
106
|
id: string;
|
|
107
107
|
};
|
|
108
|
-
declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
|
|
108
|
+
export declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
|
|
109
109
|
readonly context: DevframeHubContext;
|
|
110
110
|
readonly sessions: DevframeTerminalsHost$1['sessions'];
|
|
111
111
|
readonly events: DevframeTerminalsHost$1['events'];
|
|
@@ -144,7 +144,7 @@ declare class DevframeTerminalsHost implements DevframeTerminalsHost$1 {
|
|
|
144
144
|
* Pairs with the `devframe:commands` shared state: clients read the list
|
|
145
145
|
* from the shared state and dispatch by id via this RPC.
|
|
146
146
|
*/
|
|
147
|
-
declare const hubCommandsExecute: {
|
|
147
|
+
export declare const hubCommandsExecute: {
|
|
148
148
|
name: "hub:commands:execute";
|
|
149
149
|
type?: "action" | undefined;
|
|
150
150
|
cacheable?: boolean;
|
|
@@ -168,7 +168,7 @@ declare const hubCommandsExecute: {
|
|
|
168
168
|
* context, whose `messages` client dispatches through these built-ins so a
|
|
169
169
|
* dock client script can report into the same feed the server writes to.
|
|
170
170
|
*/
|
|
171
|
-
declare const hubMessagesAdd: {
|
|
171
|
+
export declare const hubMessagesAdd: {
|
|
172
172
|
name: "hub:messages:add";
|
|
173
173
|
type?: "action" | undefined;
|
|
174
174
|
cacheable?: boolean;
|
|
@@ -184,7 +184,7 @@ declare const hubMessagesAdd: {
|
|
|
184
184
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[input: DevframeMessageEntryInput], Promise<DevframeMessageEntry>>> | undefined;
|
|
185
185
|
};
|
|
186
186
|
/** `hub:messages:update`: Patch a message by id; returns the updated entry (or `undefined`). */
|
|
187
|
-
declare const hubMessagesUpdate: {
|
|
187
|
+
export declare const hubMessagesUpdate: {
|
|
188
188
|
name: "hub:messages:update";
|
|
189
189
|
type?: "action" | undefined;
|
|
190
190
|
cacheable?: boolean;
|
|
@@ -200,7 +200,7 @@ declare const hubMessagesUpdate: {
|
|
|
200
200
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, patch: Partial<DevframeMessageEntryInput>], Promise<DevframeMessageEntry | undefined>>> | undefined;
|
|
201
201
|
};
|
|
202
202
|
/** `hub:messages:remove`: Remove a message by id. */
|
|
203
|
-
declare const hubMessagesRemove: {
|
|
203
|
+
export declare const hubMessagesRemove: {
|
|
204
204
|
name: "hub:messages:remove";
|
|
205
205
|
type?: "action" | undefined;
|
|
206
206
|
cacheable?: boolean;
|
|
@@ -216,7 +216,7 @@ declare const hubMessagesRemove: {
|
|
|
216
216
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string], Promise<void>>> | undefined;
|
|
217
217
|
};
|
|
218
218
|
/** `hub:messages:clear`: Remove every message. */
|
|
219
|
-
declare const hubMessagesClear: {
|
|
219
|
+
export declare const hubMessagesClear: {
|
|
220
220
|
name: "hub:messages:clear";
|
|
221
221
|
type?: "action" | undefined;
|
|
222
222
|
cacheable?: boolean;
|
|
@@ -236,7 +236,7 @@ declare const hubMessagesClear: {
|
|
|
236
236
|
* via `ctx.terminals.startPtySession`. Lets a hub-aware terminal UI (e.g. the
|
|
237
237
|
* terminals plugin) drive a session owned by another plugin.
|
|
238
238
|
*/
|
|
239
|
-
declare const hubTerminalsWrite: {
|
|
239
|
+
export declare const hubTerminalsWrite: {
|
|
240
240
|
name: "hub:terminals:write";
|
|
241
241
|
type?: "action" | undefined;
|
|
242
242
|
cacheable?: boolean;
|
|
@@ -252,7 +252,7 @@ declare const hubTerminalsWrite: {
|
|
|
252
252
|
__promise?: import("devframe/rpc").Thenable<import("devframe/rpc").RpcFunctionSetupResult<[id: string, data: string], Promise<void>>> | undefined;
|
|
253
253
|
};
|
|
254
254
|
/** `hub:terminals:resize`: Resize an interactive PTY session by id. */
|
|
255
|
-
declare const hubTerminalsResize: {
|
|
255
|
+
export declare const hubTerminalsResize: {
|
|
256
256
|
name: "hub:terminals:resize";
|
|
257
257
|
type?: "action" | undefined;
|
|
258
258
|
cacheable?: boolean;
|
|
@@ -273,7 +273,7 @@ declare const hubTerminalsResize: {
|
|
|
273
273
|
* child-process and interactive PTY sessions, letting a hub-aware terminal UI
|
|
274
274
|
* force-kill a session owned by another plugin.
|
|
275
275
|
*/
|
|
276
|
-
declare const hubTerminalsTerminate: {
|
|
276
|
+
export declare const hubTerminalsTerminate: {
|
|
277
277
|
name: "hub:terminals:terminate";
|
|
278
278
|
type?: "action" | undefined;
|
|
279
279
|
cacheable?: boolean;
|
|
@@ -293,7 +293,7 @@ declare const hubTerminalsTerminate: {
|
|
|
293
293
|
* sessions registered with `restartable: false`, whose lifecycle is owned
|
|
294
294
|
* elsewhere.
|
|
295
295
|
*/
|
|
296
|
-
declare const hubTerminalsRestart: {
|
|
296
|
+
export declare const hubTerminalsRestart: {
|
|
297
297
|
name: "hub:terminals:restart";
|
|
298
298
|
type?: "action" | undefined;
|
|
299
299
|
cacheable?: boolean;
|
|
@@ -313,7 +313,7 @@ declare const hubTerminalsRestart: {
|
|
|
313
313
|
* and drop it from the registry, disposing its output stream. Lets a hub-aware
|
|
314
314
|
* terminal UI discard a stopped aggregated session.
|
|
315
315
|
*/
|
|
316
|
-
declare const hubTerminalsRemove: {
|
|
316
|
+
export declare const hubTerminalsRemove: {
|
|
317
317
|
name: "hub:terminals:remove";
|
|
318
318
|
type?: "action" | undefined;
|
|
319
319
|
cacheable?: boolean;
|
|
@@ -340,7 +340,7 @@ declare const hubTerminalsRemove: {
|
|
|
340
340
|
* and mirrors it into the `devframe:docks:active` shared state (a dock that
|
|
341
341
|
* mounts in response still converges on it).
|
|
342
342
|
*/
|
|
343
|
-
declare const hubDocksActivate: {
|
|
343
|
+
export declare const hubDocksActivate: {
|
|
344
344
|
name: "hub:docks:activate";
|
|
345
345
|
type?: "action" | undefined;
|
|
346
346
|
cacheable?: boolean;
|
|
@@ -376,7 +376,7 @@ declare const hubDocksActivate: {
|
|
|
376
376
|
* array via `CreateHubContextOptions.builtinRpcDeclarations`; the hub's
|
|
377
377
|
* list is prepended automatically.
|
|
378
378
|
*/
|
|
379
|
-
declare const builtinHubRpcDeclarations: readonly RpcFunctionDefinitionAny[];
|
|
379
|
+
export declare const builtinHubRpcDeclarations: readonly RpcFunctionDefinitionAny[];
|
|
380
380
|
//#endregion
|
|
381
381
|
//#region src/node/utils.d.ts
|
|
382
382
|
/**
|
|
@@ -386,6 +386,6 @@ declare const builtinHubRpcDeclarations: readonly RpcFunctionDefinitionAny[];
|
|
|
386
386
|
*
|
|
387
387
|
* @experimental Prefer a proper importable module for production use.
|
|
388
388
|
*/
|
|
389
|
-
declare function createSimpleClientScript(fn: string | ((ctx: any) => void)): ClientScriptEntry;
|
|
389
|
+
export declare function createSimpleClientScript(fn: string | ((ctx: any) => void)): ClientScriptEntry;
|
|
390
390
|
//#endregion
|
|
391
|
-
export { CreateHubContextOptions,
|
|
391
|
+
export { CreateHubContextOptions, DevframeHubContext, HubMountedFrame, type InstallDevframeOptions, createHubContext };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as DevframeCommandsHost, a as hubMessagesAdd, c as hubMessagesUpdate, d as hubTerminalsRestart, f as hubTerminalsTerminate, g as DevframeDocksHost, h as DevframeMessagesHost, i as hubDocksActivate, l as hubTerminalsRemove, m as DevframeTerminalsHost, n as builtinHubRpcDeclarations, o as hubMessagesClear, p as hubTerminalsWrite, r as hubCommandsExecute, s as hubMessagesRemove, t as createHubContext, u as hubTerminalsResize } from "../context-
|
|
1
|
+
import { _ as DevframeCommandsHost, a as hubMessagesAdd, c as hubMessagesUpdate, d as hubTerminalsRestart, f as hubTerminalsTerminate, g as DevframeDocksHost, h as DevframeMessagesHost, i as hubDocksActivate, l as hubTerminalsRemove, m as DevframeTerminalsHost, n as builtinHubRpcDeclarations, o as hubMessagesClear, p as hubTerminalsWrite, r as hubCommandsExecute, s as hubMessagesRemove, t as createHubContext, u as hubTerminalsResize } from "../context-C7AFekjP.mjs";
|
|
2
2
|
import "ufo";
|
|
3
3
|
import "node:fs";
|
|
4
4
|
import "node:process";
|
package/dist/node/initiate.d.mts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { a as InstallDevframeOptions, n as DevframeHubContext, t as CreateHubContextOptions } from "../context-BmHQp89a.mjs";
|
|
2
2
|
import { r as DEVFRAMES_HUB_BASE } from "../constants-Bz4yclHo.mjs";
|
|
3
3
|
import { DevframeInstanceRecord } from "devframe/internal";
|
|
4
|
+
import { AuthBannerFunction } from "devframe/recipes/interactive-auth";
|
|
4
5
|
import { ConnectionMeta, DevframeDefinition, DevframeServiceInput, DevframeSseOptions, DevframeStorageScope, DevframeWsOptions, McpSetting } from "devframe/types";
|
|
5
6
|
import { DevframeAuthHandler } from "devframe/node/auth";
|
|
6
7
|
import { WsOriginRegistry } from "devframe/rpc/transports/ws-server";
|
|
@@ -9,7 +10,7 @@ import { IncomingMessage, Server, ServerResponse } from "node:http";
|
|
|
9
10
|
import { Duplex } from "node:stream";
|
|
10
11
|
//#region src/node/initiate.d.ts
|
|
11
12
|
/** A `devframes` entry with per-mount dock customization. */
|
|
12
|
-
interface HubDevframeEntry {
|
|
13
|
+
export interface HubDevframeEntry {
|
|
13
14
|
devframe: DevframeDefinition;
|
|
14
15
|
/** Per-mount overrides for the auto-synthesized iframe dock entry. */
|
|
15
16
|
dock?: InstallDevframeOptions['dock'];
|
|
@@ -30,7 +31,7 @@ type Arrayable<T> = T | readonly T[];
|
|
|
30
31
|
* returning this shape, e.g. `jsonRenderUiRenderer()` from
|
|
31
32
|
* `@devframes/json-render-ui/hub`.
|
|
32
33
|
*/
|
|
33
|
-
interface DockRendererRegistration {
|
|
34
|
+
export interface DockRendererRegistration {
|
|
34
35
|
/** Dock `type` this renderer handles (e.g. `'json-render'`). */
|
|
35
36
|
type: string;
|
|
36
37
|
/** Absolute path of the prebuilt, self-contained browser ES module. */
|
|
@@ -49,7 +50,7 @@ interface DockRendererRegistration {
|
|
|
49
50
|
* Vite DevTools or any community viewer supplies its own object to the same
|
|
50
51
|
* slot and reuses all the infrastructure.
|
|
51
52
|
*/
|
|
52
|
-
interface DevframeHubUi {
|
|
53
|
+
export interface DevframeHubUi {
|
|
53
54
|
/**
|
|
54
55
|
* A standalone viewer SPA (built with relative asset paths) served at the
|
|
55
56
|
* hub base itself; open `<base>` in a tab and the devtools are there.
|
|
@@ -86,9 +87,20 @@ interface DevframeHubUi {
|
|
|
86
87
|
* The hub stays policy-free about what the UI writes.
|
|
87
88
|
*/
|
|
88
89
|
setup?: (ctx: DevframeHubContext) => void | Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* The interactive OTP banner (auth code + magic-link URL) to print when
|
|
92
|
+
* {@link InitHubOptions.auth} is left at its default. A node-side
|
|
93
|
+
* counterpart to `setup`'s browser-facing branding: the reference UI's
|
|
94
|
+
* `createUi()` derives one from its own `branding.productName` via
|
|
95
|
+
* `createAuthBanner` (see `devframe/recipes/interactive-auth`), so the
|
|
96
|
+
* printed code matches the rebranded viewer without the caller wiring
|
|
97
|
+
* `auth` themselves. Ignored once `auth` is set explicitly - a `false` or
|
|
98
|
+
* a full {@link DevframeAuthHandler} both mean the caller owns the banner.
|
|
99
|
+
*/
|
|
100
|
+
authBanner?: AuthBannerFunction;
|
|
89
101
|
}
|
|
90
|
-
type DevframesInput = Array<DevframeDefinition | HubDevframeEntry | Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>> | (() => Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>>)>;
|
|
91
|
-
interface InitHubOptions {
|
|
102
|
+
export type DevframesInput = Array<DevframeDefinition | HubDevframeEntry | Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>> | (() => Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>>)>;
|
|
103
|
+
export interface InitHubOptions {
|
|
92
104
|
/**
|
|
93
105
|
* Name for the hub instance, used in logs and diagnostics, and mcp server.
|
|
94
106
|
*/
|
|
@@ -244,7 +256,7 @@ interface InitHubOptions {
|
|
|
244
256
|
/** Destroy off-route upgrades on a shared `server` devframe's adapter owns outright. */
|
|
245
257
|
destroyUnmatchedUpgrades?: boolean;
|
|
246
258
|
}
|
|
247
|
-
interface HubInstance {
|
|
259
|
+
export interface HubInstance {
|
|
248
260
|
/**
|
|
249
261
|
* The normalized mount base this hub answers under (leading and trailing
|
|
250
262
|
* slash, e.g. `/__devframes/`). Reference it when wiring the mount (route
|
|
@@ -297,6 +309,6 @@ interface HubInstance {
|
|
|
297
309
|
* {@link InitHubOptions.ws}), or waits for the host to hand upgrades over
|
|
298
310
|
* through {@link HubInstance.attach}.
|
|
299
311
|
*/
|
|
300
|
-
declare function initHub(options: InitHubOptions): HubInstance;
|
|
312
|
+
export declare function initHub(options: InitHubOptions): HubInstance;
|
|
301
313
|
//#endregion
|
|
302
|
-
export { DEVFRAMES_HUB_BASE
|
|
314
|
+
export { DEVFRAMES_HUB_BASE };
|
package/dist/node/initiate.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { a as normalizeHubBase, i as DOCK_RENDERERS_STATE_KEY, r as DEVFRAMES_HUB_BASE } from "../constants-Da23JxCZ.mjs";
|
|
2
|
-
import { t as createHubContext, y as diagnostics } from "../context-
|
|
3
|
-
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-
|
|
2
|
+
import { t as createHubContext, y as diagnostics } from "../context-C7AFekjP.mjs";
|
|
3
|
+
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-B-ISfDe5.mjs";
|
|
4
4
|
import { joinURL, withoutLeadingSlash } from "ufo";
|
|
5
5
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE } from "devframe/constants";
|
|
6
6
|
import { readFile } from "node:fs/promises";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { createH3DevframeHost, createInstanceShell, importRuntimeModule, loadAutoMcpAdapter, resolveInstanceRegister, resolveMcpConfig } from "devframe/internal";
|
|
9
9
|
import { resolve } from "pathe";
|
|
10
|
+
import { createInteractiveAuth } from "devframe/recipes/interactive-auth";
|
|
10
11
|
import { mountStaticHandler } from "devframe/utils/serve-static";
|
|
11
12
|
import { H3 } from "h3";
|
|
12
13
|
//#region src/node/initiate.ts
|
|
@@ -81,7 +82,14 @@ function initHub(options) {
|
|
|
81
82
|
app,
|
|
82
83
|
host: options.host,
|
|
83
84
|
origin: options.origin,
|
|
84
|
-
|
|
85
|
+
/**
|
|
86
|
+
* `false`/an explicit handler are the caller's own call, passed through
|
|
87
|
+
* as-is; `true`/unset both mean "gate with the defaults", so the handler
|
|
88
|
+
* is built lazily from `ctx` either way, taking the UI slot's
|
|
89
|
+
* `authBanner` (e.g. `createUi()`'s branded box) without the caller
|
|
90
|
+
* wiring `auth` themselves.
|
|
91
|
+
*/
|
|
92
|
+
auth: options.auth === false || typeof options.auth === "object" ? options.auth : (ctx) => createInteractiveAuth(ctx, { banner: options.ui?.authBanner }),
|
|
85
93
|
server: options.server,
|
|
86
94
|
ws: options.ws,
|
|
87
95
|
sse: options.sse,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devframes/hub",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.15",
|
|
5
5
|
"description": "Hub layer that orchestrates devframe docks, terminals, messages, and commands on any host.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -35,24 +35,24 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"devframe": "0.9.
|
|
38
|
+
"devframe": "0.9.15"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@standard-schema/spec": "^1.1.0",
|
|
42
42
|
"destr": "^2.0.5",
|
|
43
|
-
"h3": "^2.0.1-rc.
|
|
43
|
+
"h3": "^2.0.1-rc.31",
|
|
44
44
|
"pathe": "^2.0.3",
|
|
45
45
|
"perfect-debounce": "^2.1.0",
|
|
46
|
-
"tinyexec": "^1.3.
|
|
46
|
+
"tinyexec": "^1.3.1",
|
|
47
47
|
"ufo": "^1.6.4",
|
|
48
48
|
"zigpty": "^0.2.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^26.
|
|
52
|
-
"devframe": "0.9.
|
|
51
|
+
"@types/node": "^26.5.0",
|
|
52
|
+
"devframe": "0.9.15",
|
|
53
53
|
"get-port-please": "^3.2.0",
|
|
54
54
|
"mlly": "^1.8.2",
|
|
55
|
-
"tsdown": "^0.
|
|
55
|
+
"tsdown": "^0.23.0",
|
|
56
56
|
"valibot": "^1.4.2"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|