Skip to content

Commit c425f80

Browse files
committed
refactor: rename the term-clashing APIs, deprecated aliases kept
createDevframeClientHost \u2192 createDevframeClientRuntime (with the DevframeClientRuntime/Options types) so the API says what every docs page now says; a11yAgentBundlePath \u2192 a11yPageScriptBundlePath; the data-inspector inject exports drop "agent" (DISCOVERY_FILE / InjectDiscovery / DataInspectorEndpoint, discovery file now discovery.json with attach falling back to the old agent.json). Old names stay as @deprecated aliases; kits re-export both; snapshots, docs anchors, examples, and the devframe skill follow.
1 parent 8600b67 commit c425f80

60 files changed

Lines changed: 305 additions & 247 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎AGENTS.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
**`devframe`** is the framework-neutral container for one devtool integration, portable across hub UI providers. Build a single tool (its RPC, its SPA, its diagnostics, its CLI/build/embedded outputs) without caring how it'll be displayed. A devframe runs standalone (CLI, static deploy, embedded SPA) just as well as it mounts inside a hub.
66

7-
**`@devframes/hub`** is the framework-neutral hub layer that sits on top of devframe and provides the multi-devframe orchestration (docks, terminals, messages, commands). It does not ship UI - hub UI providers (e.g. `@vitejs/devtools-kit`) provide their own UI on top of the hub's RPC + shared-state protocol. It does ship a **headless client runtime** (`createDevframeClientHost()` from `@devframes/hub/client`): booted in the host page, it assembles the shared `DevframeClientContext` (panel, docks, commands, when) and imports each dock entry's client script (`action` / `custom-render` / iframe `clientScript`) into that page - how a built-in devframe like the a11y inspector runs its page script inside the user app's page. See `examples/hub-vite/` for a working ~120-line Vite host demonstrating the protocol end to end.
7+
**`@devframes/hub`** is the framework-neutral hub layer that sits on top of devframe and provides the multi-devframe orchestration (docks, terminals, messages, commands). It does not ship UI - hub UI providers (e.g. `@vitejs/devtools-kit`) provide their own UI on top of the hub's RPC + shared-state protocol. It does ship a **headless client runtime** (`createDevframeClientRuntime()` from `@devframes/hub/client`): booted in the host page, it assembles the shared `DevframeClientContext` (panel, docks, commands, when) and imports each dock entry's client script (`action` / `custom-render` / iframe `clientScript`) into that page - how a built-in devframe like the a11y inspector runs its page script inside the user app's page. See `examples/hub-vite/` for a working ~120-line Vite host demonstrating the protocol end to end.
88

99
## Terminology
1010

@@ -14,7 +14,7 @@ The docs' canonical vocabulary lives in [`docs/content/1.guide/1.terms.md`](docs
1414
- **The tool is "a devframe"** - never "integration", "frame", or "app". The ready-to-run `@devframes/plugin-*` packages are **built-in devframes**: Devframe has no plugin concept; the `plugin-` npm prefix only sets those packages apart from core packages. "Vite plugin" stays for the bundler mechanism, and RPC ids keep the literal `devframes:plugin:<slug>:` namespace because it mirrors the package names on the wire.
1515
- **host framework** is the environment a devframe or hub mounts into (a Vite dev server, a Next.js app, a Hono server); named forms like "the Vite host" are fine. **host page** is the browser document where the client runtime boots; **user app** is the application being developed and inspected.
1616
- A devframe's two halves are the **node side** and the **browser side**.
17-
- Browser-side terms: **client runtime** (`createDevframeClientHost()`), **client context**, **client script**, **page script** (a devframe's script in the user app's page - never "agent"; **coding agent** is the only agent), **RPC client** (`connectDevframe()`), **SPA**, **panel** (a devframe's SPA as a rendered surface), **surface** (any rendered browser view - say "API", not "API surface").
17+
- Browser-side terms: **client runtime** (`createDevframeClientRuntime()`), **client context**, **client script**, **page script** (a devframe's script in the user app's page - never "agent"; **coding agent** is the only agent), **RPC client** (`connectDevframe()`), **SPA**, **panel** (a devframe's SPA as a rendered surface), **surface** (any rendered browser view - say "API", not "API surface").
1818
- Hub terms: **hub UI provider** (a hub UI implementation - never "shell" or bare "viewer"; "external viewer" stays for cross-origin surfaces in the security docs), **dock entry** / **dock rail** / **dock panel**, **mounted devframe** (never "frame").
1919
- The three communication paths: **RPC** (browser side ↔ node side), the **client context** (client scripts ↔ client runtime), and the **in-page channel** (page script ↔ panel, same-origin in-browser).
2020
- Storage scopes: **workspace scope** (committable, per-repo), **project scope** (per-checkout), **global scope** (per-user) - never describe the project scope as "per-workspace".
@@ -70,7 +70,7 @@ Ahead-of-time build artifacts that live under `src/` - the shadow-root styleshee
7070
The framework kits - `@devframes/vite`, `@devframes/nuxt`, `@devframes/next` - each split their surface into **two clearly-scoped subpaths**, because a consumer is always doing one of two distinct jobs. Keep all three parallel:
7171

7272
- **`.../single`** - **build & dev-serve a single devframe's SPA** with that tool (the "I'm authoring one devframe" scope). Vite: the `devframeVitePlugin` / `devframeViteBridge` / `devframeVite` plugins. Next: `withDevframe` + `createDevframeNextHandler`, with its React client at `.../single/client`. Nuxt: the Nuxt module (registered as `modules: ['@devframes/nuxt/single']`).
73-
- **`.../hub`** - **mount a whole `@devframes/hub` (many devframes) inside that tool** (the "I'm standing up devtools" scope). Wraps `initHub`, defaults the UI slot to `@devframes/hub-ui`'s `createUi()` (overridable via `ui`, or `ui: false` for headless), and ships a browser client helper at `.../hub/client` (a thin, lifecycle-managing wrapper over `@devframes/hub/client`'s `createDevframeClientHost`). `@devframes/hub` and `@devframes/hub-ui` are **optional peers** of these packages; `hub-ui` is loaded lazily (a bundler-ignored dynamic `import()` in the Next hub) so it stays optional and its `import.meta.url` asset lookups resolve at request time.
73+
- **`.../hub`** - **mount a whole `@devframes/hub` (many devframes) inside that tool** (the "I'm standing up devtools" scope). Wraps `initHub`, defaults the UI slot to `@devframes/hub-ui`'s `createUi()` (overridable via `ui`, or `ui: false` for headless), and ships a browser client helper at `.../hub/client` (a thin, lifecycle-managing wrapper over `@devframes/hub/client`'s `createDevframeClientRuntime`). `@devframes/hub` and `@devframes/hub-ui` are **optional peers** of these packages; `hub-ui` is loaded lazily (a bundler-ignored dynamic `import()` in the Next hub) so it stays optional and its `import.meta.url` asset lookups resolve at request time.
7474
- **The bare root (`.`) throws** a helpful error pointing at the two subpaths - never put real code on it.
7575
- **Vite and Nuxt already have native hub UI providers** (`@vitejs/devtools-kit`, `@nuxt/devtools`), so `@devframes/vite/hub` and `@devframes/nuxt/hub` still work but emit a one-time `console.warn` recommending those (silence with `{ quiet: true }`). `@devframes/next/hub` has no native counterpart, so it warns nothing.
7676
- The **full hub examples** (`examples/hub-vite`, `examples/hub-next`) consume `.../hub` on the node side but keep hand-rolling their own hub UI provider against `@devframes/hub/client` with `ui: false` - that hand-rolled hub UI provider is the whole point of those reference hosts. The **minimal** ones (`examples/hub-*-minimal`) consume `.../hub` with the default `@devframes/hub-ui` and inject its `embedded.js`, needing no browser-side code.

‎docs/content/1.guide/1.terms.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ A devframe has two halves: the **node side** registers RPC functions and owns st
4141
| **browser side** | The half of a devframe running in a page. | `devframe/client` |
4242
| **user app** | The application being developed and inspected. | — |
4343
| **host page** | The browser document where the client runtime boots — in dev, usually the user app's own page. | — |
44-
| **client runtime** | The headless runtime booted once per host page: it connects RPC, assembles the client context, and imports client scripts. | `createDevframeClientHost()` |
44+
| **client runtime** | The headless runtime booted once per host page: it connects RPC, assembles the client context, and imports client scripts. | `createDevframeClientRuntime()` |
4545
| **client context** | The shared object client scripts receive: panel, docks, commands, when-clauses. | `DevframeClientContext` |
4646
| **client script** | A dock entry's script, imported into the host page by the client runtime. | `clientScript` |
4747
| **page script** | A devframe's script running in the user app's page — loaded as a client script or standalone. The a11y page script runs axe-core. | — |

‎docs/content/1.guide/17.hub.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ Broadcast notifications (`devframe:docks:activate`, `devframe:terminals:updated`
254254

255255
## Running a devframe's code in the host page
256256

257-
The hub ships a headless client runtime, `createDevframeClientHost()` (`@devframes/hub/client`): booted in the host page, it assembles the client context and imports each dock entry's client script ([Client Scripts & Client Context](/guide/client-context)).
257+
The hub ships a headless client runtime, `createDevframeClientRuntime()` (`@devframes/hub/client`): booted in the host page, it assembles the client context and imports each dock entry's client script ([Client Scripts & Client Context](/guide/client-context)).
258258

259259
## Example
260260

‎docs/content/1.guide/18.client-context.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ A dock **client script** runs a devframe's code inside the **host page**; the **
1010
1111
## The client runtime
1212

13-
`createDevframeClientHost()` (`@devframes/hub/client`) boots the host page: it connects (or adopts) an RPC client, publishes the `DevframeClientContext`, and imports each dock's client script:
13+
`createDevframeClientRuntime()` (`@devframes/hub/client`) boots the host page: it connects (or adopts) an RPC client, publishes the `DevframeClientContext`, and imports each dock's client script:
1414

1515
```ts
1616
// main.ts — the host page's browser entry
17-
import { connectDevframe, createDevframeClientHost } from '@devframes/hub/client'
17+
import { connectDevframe, createDevframeClientRuntime } from '@devframes/hub/client'
1818

1919
const rpc = await connectDevframe({ baseURL: '/__hub/' })
20-
const { context, dispose } = await createDevframeClientHost({ rpc })
20+
const { context, dispose } = await createDevframeClientRuntime({ rpc })
2121
```
2222

2323
### Options
@@ -83,7 +83,7 @@ For a URL, attach it via `ctx.install(myDevframe, { dock: { clientScript: { impo
8383

8484
### Bare npm specifiers
8585

86-
Resolving a bare specifier is the **host framework's capability**: a host framework advertises a resolution template at `ConnectionMeta.configs.dock.clientModuleResolution` (loaders replace `{specifier}` before import). A Vite host declares this by default (`@devframes/vite/hub`) as `initHub({ clientModuleResolution: '/@id/{specifier}' })`; then use the specifier alone as `importFrom`. A host framework with no template (Next.js) supports the URL shape only, warning [`DF8111`](/errors/DF8111) on a specifier. A hub UI provider can override with `createDevframeClientHost({ resolveClientModule })`.
86+
Resolving a bare specifier is the **host framework's capability**: a host framework advertises a resolution template at `ConnectionMeta.configs.dock.clientModuleResolution` (loaders replace `{specifier}` before import). A Vite host declares this by default (`@devframes/vite/hub`) as `initHub({ clientModuleResolution: '/@id/{specifier}' })`; then use the specifier alone as `importFrom`. A host framework with no template (Next.js) supports the URL shape only, warning [`DF8111`](/errors/DF8111) on a specifier. A hub UI provider can override with `createDevframeClientRuntime({ resolveClientModule })`.
8787

8888
Client scripts execute in the user app's page realm (`window`); anchor shared state on `globalThis`.
8989

‎docs/content/1.guide/19.hub-initiate.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ initHub({
8080
})
8181
```
8282

83-
A renderer registered at boot (`createDevframeClientHost({ renderers })`) overrides the manifest; an uncovered type shows the hub UI provider's missing-renderer fallback.
83+
A renderer registered at boot (`createDevframeClientRuntime({ renderers })`) overrides the manifest; an uncovered type shows the hub UI provider's missing-renderer fallback.
8484

8585
Registrations are validated fail-fast: one module per type (`DF8108`), an existing bundle (`DF8109`), a route-safe type name (`DF8110`).
8686

‎docs/content/1.guide/23.build-your-own-json-render-frontend.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ disabling action dispatch there.
4646
## Plugging it in
4747

4848
- **Local registration** — a hub UI provider bundling its own client runtime passes
49-
`createDevframeClientHost({ renderers: { 'json-render': myRenderer } })`;
49+
`createDevframeClientRuntime({ renderers: { 'json-render': myRenderer } })`;
5050
local registrations win over the manifest.
5151
- **A prebuilt renderer module** — bundle your renderer as one self-contained
5252
browser ES module (framework and styles included), default-exporting the

‎docs/content/1.guide/24.build-your-own-hub-ui.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ into `ConnectionMeta.configs` and read by the RPC client at handshake.
2828
## The browser-side contracts
2929

3030
A hub UI provider renders from the hub's shared state via
31-
[`createDevframeClientHost()`](/guide/client-context), which assembles the
31+
[`createDevframeClientRuntime()`](/guide/client-context), which assembles the
3232
`DevframeClientContext` (docks, commands, renderers, when-clauses, connection)
3333
and loads dock client scripts. Honor:
3434

‎docs/content/1.guide/9.json-render.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ missing-renderer fallback). A host page can register a
141141

142142
```ts
143143
// host page — a locally-bundled frontend wins over the manifest module
144-
import { createDevframeClientHost } from '@devframes/hub/client'
144+
import { createDevframeClientRuntime } from '@devframes/hub/client'
145145
import { myJsonRenderDockRenderer } from './my-renderer'
146146

147-
const host = await createDevframeClientHost({
147+
const host = await createDevframeClientRuntime({
148148
renderers: { 'json-render': myJsonRenderDockRenderer },
149149
})
150150

‎docs/content/5.plugins/1.data-inspector.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ globalThis.cache = cache
124124

125125
It reads `globalThis` at query time, so later assignments appear next run (opt out: `DEVFRAME_DATA_INSPECTOR_GLOBAL=0`).
126126

127-
The inject endpoint binds `127.0.0.1`, requires the trust handshake with a per-run token, and advertises itself in `node_modules/.data-inspector/agent.json`, which `attach` reads (or pass `ws://…` + `--token`).
127+
The inject endpoint binds `127.0.0.1`, requires the trust handshake with a per-run token, and advertises itself in `node_modules/.data-inspector/discovery.json`, which `attach` reads (or pass `ws://…` + `--token`).
128128

129129
## RPC
130130

‎docs/content/5.plugins/4.a11y.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ The page script and the panel talk over the in-page channel (a same-origin `Broa
2929

3030
## In a hub
3131

32-
The page script is the a11y dock's [client script](/guide/client-context): attach `a11yAgentBundlePath` as the dock's `clientScript` and the hub imports it into the page. It also mirrors each scan into the hub's messages feed — a summary plus one per rule:
32+
The page script is the a11y dock's [client script](/guide/client-context): attach `a11yPageScriptBundlePath` as the dock's `clientScript` and the hub imports it into the page. It also mirrors each scan into the hub's messages feed — a summary plus one per rule:
3333

3434
```ts
35-
import createA11yDevframe, { a11yAgentBundlePath } from '@devframes/plugin-a11y'
35+
import createA11yDevframe, { a11yPageScriptBundlePath } from '@devframes/plugin-a11y'
3636

3737
await ctx.install(createA11yDevframe(), {
38-
dock: { clientScript: { importFrom: `/@fs/${a11yAgentBundlePath}` } },
38+
dock: { clientScript: { importFrom: `/@fs/${a11yPageScriptBundlePath}` } },
3939
})
4040
```
4141

0 commit comments

Comments
 (0)