Skip to content

feat(hub): add @devframes/hub/initiate — initHub, the headless hub behind one handler - #169

Open
antfubot wants to merge 1 commit into
mainfrom
feat/hub-handler
Open

feat(hub): add @devframes/hub/initiate — initHub, the headless hub behind one handler#169
antfubot wants to merge 1 commit into
mainfrom
feat/hub-handler

Conversation

@antfubot

@antfubot antfubot commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Layer 3 of the /__devframes/ standard-middleware stack (on #168). See plans/devframes-standard-middleware.md.

Intent

One catch-all route hosts the whole multi-devframe devtools installation: initHub() from @devframes/hub/initiate returns a HubInstance whose .handler serves — 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.

  • Shared everything: each frame's setup() runs against the shared hub context — one merged RPC registry (cross-frame calls by design), one WS socket (per-frame __connection.json advertises 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.
  • Reserved layout: __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).
  • DevframeHubUi slot: ui.viewer.distDir owns the namespace root; ui.embedded.entry serves the floating bootstrap at embedded.js. Omit ui and the hub is fully headless — @devframes/hub-ui (next PR) is just one implementation of the slot.
  • Assembly modes: declarative devframes: [...] + configure(ctx), or a pre-built context for hosts that mount frames themselves (DF8002 when both); key memoization against dev-reload leaks (DF8001).
  • devframe primitives promoted: the Bun WS tier becomes the public devframe/rpc/transports/ws-bun, createContextRpcServer exports from devframe/node, mountMcpHttp from devframe/adapters/mcp — the pieces initHub composes, shared with initDevframe.
  • mountDevframe now 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

  1. feat!: add devframe/initiate — initDevframe framework-agnostic middleware #167 feat/handler-core
  2. refactor(adapters): rebuild createDevServer, viteDevBridge, and @devframes/next on initDevframe #168 feat/handler-adapters
  3. feat/hub-handler (this PR)
  4. feat/hub-ui — @devframes/hub-ui webcomponents port + createUi()
  5. feat/handler-examples-docs — examples + framework guides + Bun smoke test

Created with the help of an agent.

…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
@netlify

netlify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 4fc3f2f
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a7422c920771000080c279f
😎 Deploy Preview https://deploy-preview-169--devfra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant