You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/hub-next/README.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ pnpm install
11
11
pnpm --filter hub-next dev
12
12
```
13
13
14
+
On first load the hub asks you to authorize. `initHub()` gates every connection by default (devframe's interactive OTP), so it prints a 6-digit code and a magic link in the terminal, and the page shows an authorization view that exchanges the code for a bearer token stored in the browser. The client shell opts out of devframe's native `prompt()` (`simpleAuth: false`) to render that view; open the magic link instead to authorize without typing. Each embedded SPA then inherits the token the host page stored.
15
+
14
16
Open the printed URL. The dock on the left lists every mounted tool with its icon:
15
17
16
18
-**Git**, **Terminals**, **Code Server**, **RPC & State Inspector**, **A11y Inspector** - the built-in plugins, each an entry in `initHub`'s `devframes` list
@@ -40,6 +42,7 @@ The instance is memoized on `globalThis`, so Next's dev-time module re-evaluatio
40
42
41
43
-`initHub()` boots a whole hub with no Vite-specific code path - devframes, shared RPC registry, WS transport, MCP, and discovery behind one framework-agnostic handler
42
44
- Every `devframes` entry is mounted as a dock and served at `/__devframes/<id>/` with its own `__connection.json`, so the embedded SPA connects straight back to the hub
45
+
- One authorization covers the whole hub: `initHub()` gates the shared transport by default, so a single OTP handshake trusts every mounted frame, the discovery endpoints, and the built-ins. The shell drives its own authorization view (`simpleAuth: false`) and each embedded SPA inherits the stored token
43
46
- The browser reads `devframe:docks` / `devframe:commands` shared state and dispatches commands over RPC - byte-for-byte the same protocol the Vite host speaks
44
47
-`createDevframeClientHost()` boots the hub's framework-level client runtime in the host page: it publishes the shared client context and imports each dock's `clientScript` (here, the a11y agent) so plugins run code in the page being inspected
45
48
- The **JSON Render** dock renders through a **local React renderer** (`src/client/json-render/react-renderer.tsx` - a compact React port of the base catalog) registered at `createDevframeClientHost({ renderers })`. The hub *also* publishes the reference Vue frontend through its renderer manifest (`renderers: [jsonRenderUiRenderer()]` on `initHub`), but local registration takes precedence - witnessing that any frontend implementing the `JsonRenderDockRenderer` contract can replace the reference one. Delete the local `renderers` option and the same dock renders via the manifest-served module instead. (The sibling `hub-vite` witness ships no local renderer and consumes the manifest directly - the other side of the swap seam.)
@@ -56,5 +59,5 @@ The plugins run node-side (child processes, the native `zigpty` PTY backend) and
56
59
|`src/client/devframe/next-devframe-hub.ts`| The Next host - one `initHub()` call: devframes (incl. the a11y agent's dock `clientScript`), hub RPCs, commands, the json-render dock + renderer manifest, instance-registry registration |
57
60
|`src/client/devframe/unrendered-dock.ts`| A dock type registered with no renderer on purpose - the missing-renderer fallback witness |
58
61
|`src/client/app/%5F_devframes/[[...path]]/route.ts`| The one catch-all - delegates every `/__devframes/*` request to the instance's `handler`|
59
-
|`src/client/app/page.tsx`| The browser UI that consumes the hub protocol |
62
+
|`src/client/app/page.tsx`| The browser UI that consumes the hub protocol, including the interactive-OTP authorization view|
60
63
|`src/client/app/icons.ts`| Offline Phosphor icons for the dock |
0 commit comments