feat(hub): add @devframes/hub/initiate — initHub, the headless hub behind one handler - #169
Open
antfubot wants to merge 1 commit into
Open
feat(hub): add @devframes/hub/initiate — initHub, the headless hub behind one handler#169antfubot wants to merge 1 commit into
antfubot wants to merge 1 commit into
Conversation
…hind one handler initHub() serves the whole multi-devframe devtools surface through one web-standard handler under a single namespace (default /__devframes/): every mounted devframe shares one hub context (merged RPC registry, shared state, docks/terminals/messages/commands), one WebSocket transport, and one hub Auth; frames serve at <base><id>/ with per-frame discovery pointing at the shared socket. - reserved layout: __connection.json, __ws, __index.json, __client-imports.js, __mcp (aggregate over the shared registry), embedded.js; frame ids validated against it (DF8000) - DevframeHubUi slot (pure data): ui.viewer owns the namespace root, ui.embedded serves the floating bootstrap at embedded.js — omitted, the hub stays fully headless and the root serves the index document - assembly modes: declarative devframes list (+ configure(ctx)) or a pre-built context (DF8002 when both); key memoization against dev-reload leaks (DF8001) - devframe: the Bun WS tier is promoted to the public devframe/rpc/transports/ws-bun subpath, createContextRpcServer is exported from devframe/node, and adapters/mcp exports mountMcpHttp — the primitives initHub composes - mountDevframe now mounts a frame's connection meta before its SPA statics so route-ordered hosts (h3) resolve the exact meta route ahead of the static catch-all
antfubot
force-pushed
the
feat/hub-handler
branch
from
August 6, 2026 05:59
151ec15 to
4fc3f2f
Compare
✅ Deploy Preview for devfra ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layer 3 of the
/__devframes/standard-middleware stack (on #168). Seeplans/devframes-standard-middleware.md.Intent
One catch-all route hosts the whole multi-devframe devtools installation:
initHub()from@devframes/hub/initiatereturns aHubInstancewhose.handlerserves — under a single namespace (default/__devframes/) — every mounted devframe's SPA at<base><id>/, the discovery endpoints, the one shared WebSocket transport, the single hub Auth, and the aggregate MCP route. The hub stays headless: UI is a data-only slot.setup()runs against the shared hub context — one merged RPC registry (cross-frame calls by design), one WS socket (per-frame__connection.jsonadvertises a hub-base-absolute path so it resolves to the shared socket from any depth), one Auth gate covering frames, hub built-ins, and MCP.__connection.json,__ws,__index.json(also the headless root document),__client-imports.js(dock client-script import map),__mcp(aggregate over the already-namespaced tool registry),embedded.js; frame ids are validated against it (DF8000).DevframeHubUislot:ui.viewer.distDirowns the namespace root;ui.embedded.entryserves the floating bootstrap atembedded.js. Omituiand the hub is fully headless —@devframes/hub-ui(next PR) is just one implementation of the slot.devframes: [...]+configure(ctx), or a pre-builtcontextfor hosts that mount frames themselves (DF8002when both);keymemoization against dev-reload leaks (DF8001).devframe/rpc/transports/ws-bun,createContextRpcServerexports fromdevframe/node,mountMcpHttpfromdevframe/adapters/mcp— the piecesinitHubcomposes, shared withinitDevframe.mountDevframenow mounts a frame's connection meta before its SPA statics (route-ordered hosts resolve the exact meta route ahead of the static catch-all).Stack
Created with the help of an agent.