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
docs: rework structure and flow around the standard-handler narrative
Reorganize the documentation to follow the define-once/mount-anywhere story:
one definition, one standard handler, adapters as conveniences, visual and
agentic, then composing a hub and inheriting the ecosystem.
- Reframe the landing page and guide introduction around this narrative.
- Elevate initDevframe() as 'The Standard Handler' — the boundary every
serving path is built on — and position adapters as conveniences over it.
- Regroup the guide sidebar/nav into narrative sections (Define your tool,
Mount anywhere, Visual & agentic, Compose a hub, Customize the UI).
- Fix stale claims: RPC is validated against any Standard Schema validator
(not 'birpc + valibot'), and the hosted default base is /__<id>/.
Created with the help of an agent.
Copy file name to clipboardExpand all lines: docs/adapters/index.md
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,17 @@ outline: deep
4
4
5
5
# Adapters
6
6
7
-
An adapter takes a `DevframeDefinition` and deploys it into a specific runtime — a standalone CLI, a Vite plugin, a static snapshot, an embedded host, or an MCP server. Each adapter ships at its own entry point (`devframe/adapters/<name>`); the bundler pulls in only the ones you use.
7
+
The lowest-level way to serve a devframe is [the standard handler](./initiate): `initDevframe(def, { base })` returns a Web Standard `(request: Request) => Promise<Response>` that mounts on any catch-all route. Every serving path below is built on it.
8
+
9
+
Adapters package that same foundation into familiar entry points, so you rarely wire the handler by hand. Each adapter takes a `DevframeDefinition` and deploys it into a specific runtime — a standalone CLI, a dev server, a Vite plugin, a static snapshot, an embedded host, or an MCP server. Each ships at its own entry point (`devframe/adapters/<name>`), so the bundler pulls in only the ones you use.
8
10
9
11
Every adapter factory has the shape `createXxx(devframeDef, options?)`. Some adapters draw on an optional peer dependency, installed only when you opt into that adapter: `cac` pulls in [`cac`](https://github.com/cacjs/cac), and `mcp` pulls in [`@modelcontextprotocol/server`](https://github.com/modelcontextprotocol/typescript-sdk).
10
12
11
13
## Comparison
12
14
13
-
|Adapter | Entry| Factory | Best for |
15
+
|Entry point | Module| Factory | Best for |
14
16
|---------|-------|---------|----------|
17
+
|[Standard Handler](./initiate)|`devframe/initiate`|`initDevframe(def, { base })`| Mounting the raw `Request → Response` handler into any host |
15
18
|[`cac`](./cac)|`devframe/adapters/cac`|`createCac(def, options?)`| Standalone tools run via `node ./my-tool.js`|
16
19
|[`dev`](./dev)|`devframe/adapters/dev`|`createDevServer(def, options?)`| Run the dev server programmatically — drive it from any CLI framework |
17
20
|[`build`](./build)|`devframe/adapters/build`|`createBuild(def, options?)`| Offline reports, CI artifacts, deployable SPA snapshots |
Copy file name to clipboardExpand all lines: docs/adapters/initiate.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
# Initiate (standard middleware)
1
+
# The Standard Handler
2
2
3
-
Serve a devframe from inside any app that can mount a catch-all route: `initDevframe(def, { base })` returns a live instance whose `.handler` — a web-standard `(request: Request) => Promise<Response>` — carries the whole surface (the SPA, `__connection.json` discovery, the WebSocket RPC endpoint, the auth gate, and the optional MCP route) under one mount base.
3
+
`initDevframe()` is the boundary the whole project is built on: it turns a `DevframeDefinition` into a live instance whose `.handler` — a Web Standard `(request: Request) => Promise<Response>` — carries the entire surface (the SPA, `__connection.json` discovery, the WebSocket RPC endpoint, the auth gate, and the optional MCP route) under one mount base. Every other serving path — the [adapters](./), the [framework packages](/frameworks/), and the [hub](../guide/hub-initiate) — is assembled from it. Mount it from inside any app that can serve a catch-all route.
Copy file name to clipboardExpand all lines: docs/guide/hub-initiate.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,7 +18,7 @@ export const hub = initHub({
18
18
})
19
19
```
20
20
21
-
`base` is required so the mount path is explicit; pass the exported `DEVFRAMES_HUB_BASE` for the conventional `/__devframes/`. The instance echoes the normalized value back as `hub.base`, so route guards and middleware reference it instead of repeating the string. Every mounted devframe runs its `setup()` against the **shared hub context**: one merged RPC registry (frames can call each other's functions), one shared-state store, one WebSocket transport, one Auth. The instance mirrors `initDevframe`'s surface — `base`, `handler`, `nodeMiddleware`, `attach`, `handleUpgrade`, `ready`, `context`, `connectionMeta()`, `close()` — and the same mount snippets apply; see [the initiate adapter](../adapters/initiate#mount-the-handler).
21
+
`base` is required so the mount path is explicit; pass the exported `DEVFRAMES_HUB_BASE` for the conventional `/__devframes/`. The instance echoes the normalized value back as `hub.base`, so route guards and middleware reference it instead of repeating the string. Every mounted devframe runs its `setup()` against the **shared hub context**: one merged RPC registry (frames can call each other's functions), one shared-state store, one WebSocket transport, one Auth. The instance mirrors `initDevframe`'s surface — `base`, `handler`, `nodeMiddleware`, `attach`, `handleUpgrade`, `ready`, `context`, `connectionMeta()`, `close()` — and the same mount snippets apply; see [The Standard Handler](../adapters/initiate#mount-the-handler).
Copy file name to clipboardExpand all lines: docs/guide/hub.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,7 +51,7 @@ ctx.commands.register({
51
51
})
52
52
```
53
53
54
-
`args` takes positional valibot schemas (a single `v.object(...)` is unwrapped into the tool's input object); omit it for a zero-argument tool. `safety` defaults to `'action'`. `when` clauses evaluate client-side only and are not enforced for agent calls — opt in a `when`-gated command only if running it outside its UI context is safe.
54
+
`args` takes positional [Standard Schema](https://standardschema.dev/)schemas (valibot above; a single `v.object(...)` is unwrapped into the tool's input object); omit it for a zero-argument tool. `safety` defaults to `'action'`. `when` clauses evaluate client-side only and are not enforced for agent calls — opt in a `when`-gated command only if running it outside its UI context is safe.
0 commit comments