@devframes/hub 0.9.11 → 0.9.12
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-CbPTcI7d.mjs} +1 -1
- package/dist/{context-Cdrtg-Kk.mjs → context-nVwOE7i1.mjs} +2 -25
- package/dist/node/build.d.mts +4 -1
- package/dist/node/build.mjs +14 -5
- package/dist/node/index.mjs +1 -1
- package/dist/node/initiate.d.mts +12 -0
- package/dist/node/initiate.mjs +11 -3
- package/package.json +3 -3
|
@@ -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-nVwOE7i1.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";
|
|
@@ -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
|
*/
|
package/dist/node/build.d.mts
CHANGED
|
@@ -7,7 +7,10 @@ interface BuildHubOptions {
|
|
|
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
|
/**
|
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-nVwOE7i1.mjs";
|
|
3
|
+
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-CbPTcI7d.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.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-nVwOE7i1.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";
|
|
@@ -86,6 +87,17 @@ 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
102
|
type DevframesInput = Array<DevframeDefinition | HubDevframeEntry | Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>> | (() => Thenable<Arrayable<DevframeDefinition | HubDevframeEntry | null | undefined>>)>;
|
|
91
103
|
interface InitHubOptions {
|
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-nVwOE7i1.mjs";
|
|
3
|
+
import { i as resolveRendererRegistrations, n as renderClientImportsModule, r as resolveDevframesInput, t as mountDevframes } from "../assemble-CbPTcI7d.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.12",
|
|
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,7 +35,7 @@
|
|
|
35
35
|
"dist"
|
|
36
36
|
],
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"devframe": "0.9.
|
|
38
|
+
"devframe": "0.9.12"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@standard-schema/spec": "^1.1.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^26.4.0",
|
|
52
|
-
"devframe": "0.9.
|
|
52
|
+
"devframe": "0.9.12",
|
|
53
53
|
"get-port-please": "^3.2.0",
|
|
54
54
|
"mlly": "^1.8.2",
|
|
55
55
|
"tsdown": "^0.22.14",
|