devframe 0.9.8 → 0.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/dist/{_shared-BM3PdYli.mjs → _shared-C08SdQRl.mjs} +15 -4
  2. package/dist/{_shared-mtXpcJIv.d.mts → _shared-CK3czkH4.d.mts} +25 -2
  3. package/dist/adapters/build.d.mts +6 -6
  4. package/dist/adapters/build.mjs +32 -22
  5. package/dist/adapters/cac.d.mts +16 -1
  6. package/dist/adapters/cac.mjs +8 -7
  7. package/dist/adapters/dev.d.mts +13 -13
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +28 -26
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +28 -14
  13. package/dist/adapters/mcp.mjs +75 -39
  14. package/dist/{agent-tool-name-EgfoFO8C.mjs → agent-tool-name-DGzeuWcO.mjs} +2 -2
  15. package/dist/cli/main.d.mts +1 -1
  16. package/dist/cli/main.mjs +41 -17
  17. package/dist/client/index.d.mts +36 -36
  18. package/dist/client/index.mjs +83 -51
  19. package/dist/{client-assets-C7SXgTWY.mjs → client-assets-DNdhagGm.mjs} +2 -2
  20. package/dist/constants.d.mts +8 -7
  21. package/dist/constants.mjs +7 -6
  22. package/dist/{context-CLF4-8Pp.d.mts → context-4AIVRLYF.d.mts} +158 -122
  23. package/dist/{context-omlma_1n.mjs → context-CwPUinjn.mjs} +126 -88
  24. package/dist/{context-KUqAfawQ.mjs → context-DIUvJW4D.mjs} +3 -3
  25. package/dist/{context-DftYyXaR.d.mts → context-rgBSPFHS.d.mts} +5 -5
  26. package/dist/{crypto-token-XCqTSMg9.mjs → crypto-token-TVbGGFuj.mjs} +1 -1
  27. package/dist/{dev-CzkPCJwi.mjs → dev-Eqq5PX0k.mjs} +37 -18
  28. package/dist/{diagnostics-BXWW3VK-.mjs → diagnostics-BMfN8mb1.mjs} +30 -17
  29. package/dist/{diagnostics-CD8nlgll.mjs → diagnostics-D0EVm5M6.mjs} +2 -2
  30. package/dist/{events-4daw0uK9.mjs → events-BV4Dj59a.mjs} +2 -2
  31. package/dist/{host-h3-fRbF9yor.mjs → host-h3-BJ4siyz7.mjs} +1 -1
  32. package/dist/in-page-channel/index.d.mts +14 -14
  33. package/dist/in-page-channel/index.mjs +63 -54
  34. package/dist/{index-BzyopqxV.d.mts → index-pIVt92jP.d.mts} +9 -9
  35. package/dist/{index-D3k0BIhe.d.mts → index-pKl67H6w.d.mts} +4 -4
  36. package/dist/index.d.mts +8 -8
  37. package/dist/index.mjs +2 -2
  38. package/dist/{instance-registry-BjlMQbFB.mjs → instance-registry-C7-41RSp.mjs} +8 -8
  39. package/dist/{instance-shell-Tcp5hGoq.d.mts → instance-shell-7Z52PE4_.d.mts} +18 -18
  40. package/dist/{instance-shell-CpVW4zG0.mjs → instance-shell-cdVETpfz.mjs} +227 -58
  41. package/dist/internal/index.d.mts +40 -23
  42. package/dist/internal/index.mjs +10 -10
  43. package/dist/node/auth.d.mts +2 -2
  44. package/dist/node/auth.mjs +2 -2
  45. package/dist/node/hub-internals.d.mts +2 -2
  46. package/dist/node/hub-internals.mjs +2 -2
  47. package/dist/node/index.d.mts +5 -5
  48. package/dist/node/index.mjs +2 -2
  49. package/dist/{nostics-SPGDgHEP.d.mts → nostics-0sKe5HIj.d.mts} +2 -2
  50. package/dist/{nostics-CzECRXpE.mjs → nostics-D0PvLZsn.mjs} +1 -1
  51. package/dist/origin-DGDH8BI9.d.mts +45 -0
  52. package/dist/origin-DZit9g29.mjs +80 -0
  53. package/dist/recipes/common-rpc-functions.d.mts +5 -5
  54. package/dist/recipes/common-rpc-functions.mjs +3 -3
  55. package/dist/recipes/interactive-auth.d.mts +6 -6
  56. package/dist/recipes/interactive-auth.mjs +6 -6
  57. package/dist/{remote-assets-DezQmPQU.mjs → remote-assets-BIFWOlBW.mjs} +26 -6
  58. package/dist/{remote-assets-B13_vRkJ.d.mts → remote-assets-eBvSKZMS.d.mts} +7 -7
  59. package/dist/{revoke-COLW0cOi.mjs → revoke-cqztiCX4.mjs} +1 -1
  60. package/dist/rpc/dump.d.mts +2 -11
  61. package/dist/rpc/dump.mjs +1 -1
  62. package/dist/rpc/index.d.mts +2 -2
  63. package/dist/rpc/index.mjs +3 -3
  64. package/dist/rpc/transports/sse-client.d.mts +1 -1
  65. package/dist/rpc/transports/sse-client.mjs +30 -14
  66. package/dist/rpc/transports/sse-server.d.mts +4 -4
  67. package/dist/rpc/transports/sse-server.mjs +7 -7
  68. package/dist/rpc/transports/ws-bun.d.mts +5 -5
  69. package/dist/rpc/transports/ws-bun.mjs +8 -2
  70. package/dist/rpc/transports/ws-client.d.mts +1 -1
  71. package/dist/rpc/transports/ws-client.mjs +2 -2
  72. package/dist/rpc/transports/ws-deno.d.mts +4 -4
  73. package/dist/rpc/transports/ws-deno.mjs +8 -2
  74. package/dist/rpc/transports/ws-server.d.mts +2 -1
  75. package/dist/rpc/transports/ws-server.mjs +232 -1
  76. package/dist/{rpc-core-B3W3z9ff.d.mts → rpc-core-Ceu6AUz8.d.mts} +4 -4
  77. package/dist/{rpc-core-DlHd276T.mjs → rpc-core-DVQ7xi89.mjs} +14 -2
  78. package/dist/{serialization-BGzEwAdr.mjs → serialization-DTZnPQ1-.mjs} +20 -18
  79. package/dist/{services-install-CqqQVls5.mjs → services-install-P_DV7VYL.mjs} +32 -21
  80. package/dist/session-DPfj6zQG.mjs +16 -0
  81. package/dist/{shared-state--sduc6Xi.mjs → shared-state-CaxB1q0h.mjs} +2 -2
  82. package/dist/{simple-schema-DQPZrAaZ.mjs → simple-schema-Bi40l-P6.mjs} +2 -2
  83. package/dist/{sse-client-DwX021ST.d.mts → sse-client-BQ4jS3eO.d.mts} +4 -4
  84. package/dist/{state-CK9LjrnT.mjs → state-CeQQWzM-.mjs} +4 -4
  85. package/dist/{static-DV_qUSRS.mjs → static-DZ8P2Kn7.mjs} +130 -135
  86. package/dist/{storage-BXNVhKyR.mjs → storage-Dccf_IyD.mjs} +1 -1
  87. package/dist/types/index.d.mts +6 -6
  88. package/dist/{types-CMdPYhOx.d.mts → types-Dq4i156u.d.mts} +17 -17
  89. package/dist/utils/agent-tool-name.d.mts +2 -2
  90. package/dist/utils/agent-tool-name.mjs +2 -2
  91. package/dist/utils/colors.d.mts +1 -1
  92. package/dist/utils/crypto-token.d.mts +1 -1
  93. package/dist/utils/crypto-token.mjs +1 -1
  94. package/dist/utils/events.d.mts +1 -1
  95. package/dist/utils/nostics.d.mts +1 -1
  96. package/dist/utils/nostics.mjs +1 -1
  97. package/dist/utils/open.mjs +1 -1
  98. package/dist/utils/origin.d.mts +2 -0
  99. package/dist/utils/origin.mjs +80 -0
  100. package/dist/utils/remote-assets.d.mts +2 -2
  101. package/dist/utils/remote-assets.mjs +1 -1
  102. package/dist/utils/serve-static.d.mts +4 -4
  103. package/dist/utils/serve-static.mjs +56 -19
  104. package/dist/utils/shared-state.d.mts +1 -1
  105. package/dist/utils/shared-state.mjs +1 -1
  106. package/dist/utils/simple-schema.d.mts +5 -5
  107. package/dist/utils/simple-schema.mjs +2 -2
  108. package/dist/utils/streaming-channel.d.mts +1 -1
  109. package/dist/utils/streaming-channel.mjs +2 -2
  110. package/dist/utils/when.d.mts +5 -5
  111. package/dist/{validation-YrZH6atx.mjs → validation-BOy8IoFZ.mjs} +2 -2
  112. package/dist/{wire-codec-0K-o5MYW.mjs → wire-codec-dcCeXcSo.mjs} +3 -3
  113. package/dist/{ws-client-7_lZi-B9.d.mts → ws-client-Xpxt0oPA.d.mts} +3 -3
  114. package/dist/{ws-server-VyHlanzy.d.mts → ws-server-D2nv68Hg.d.mts} +13 -37
  115. package/package.json +2 -1
  116. package/dist/ws-server-Y_AumUQH.mjs +0 -294
@@ -1,8 +1,8 @@
1
- import { d as RpcFunctionsCollectorBase } from "./index-BzyopqxV.mjs";
2
- import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-CMdPYhOx.mjs";
3
- import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-VyHlanzy.mjs";
4
- import { a as RemoteAssetsStore, o as StaticAssetsSource } from "./remote-assets-B13_vRkJ.mjs";
5
- import { m as defineDiagnostics } from "./nostics-SPGDgHEP.mjs";
1
+ import { d as RpcFunctionsCollectorBase } from "./index-pIVt92jP.mjs";
2
+ import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-Dq4i156u.mjs";
3
+ import { c as DevframeNodeRpcSessionMeta, l as DevframeRpcConnection } from "./ws-server-D2nv68Hg.mjs";
4
+ import { a as RemoteAssetsStore, o as StaticAssetsSource } from "./remote-assets-eBvSKZMS.mjs";
5
+ import { m as defineDiagnostics } from "./nostics-0sKe5HIj.mjs";
6
6
  import { BirpcReturn } from "birpc";
7
7
  import { StandardSchemaV1 } from "@standard-schema/spec";
8
8
  import { CAC } from "cac";
@@ -91,15 +91,15 @@ interface AgentTool {
91
91
  title: string;
92
92
  /** Human-readable description shown to the agent. */
93
93
  description: string;
94
- /** Safety classification — drives MCP hint annotations downstream. */
94
+ /** Safety classification; drives MCP hint annotations downstream. */
95
95
  safety: 'read' | 'action' | 'destructive';
96
96
  /** Free-form tags for grouping/filtering. */
97
97
  tags?: readonly string[];
98
- /** Present for `kind === 'rpc'` — points to the RPC function name. */
98
+ /** Present for `kind === 'rpc'`; points to the RPC function name. */
99
99
  rpcName?: string;
100
100
  /**
101
101
  * Positional Standard Schemas describing a `kind: 'tool'` entry's
102
- * arguments — carried on the tool itself (mirroring how `rpcName` defers
102
+ * arguments, carried on the tool itself (mirroring how `rpcName` defers
103
103
  * an RPC-backed tool's schemas to `ctx.rpc.definitions`) so consumers
104
104
  * (e.g. the MCP adapter) convert Standard Schema → JSON Schema on demand,
105
105
  * same as RPC `args`.
@@ -126,7 +126,7 @@ interface AgentToolInput {
126
126
  safety?: 'read' | 'action' | 'destructive';
127
127
  tags?: readonly string[];
128
128
  /**
129
- * Positional Standard Schemas describing the tool's arguments — the same
129
+ * Positional Standard Schemas describing the tool's arguments, the same
130
130
  * shape RPC definitions carry (any [Standard Schema](https://standardschema.dev/)
131
131
  * validator: valibot, zod, arktype, devframe's built-in `s` builder, …).
132
132
  * Each is advertised under `arg0` / `arg1` / … on the tool's JSON-Schema
@@ -166,7 +166,7 @@ interface AgentResourceInput {
166
166
  name: string;
167
167
  description?: string;
168
168
  mimeType?: string;
169
- /** Optional URI override — if omitted, a `devframe://resource/<id>` URI is generated. */
169
+ /** Optional URI override; if omitted, a `devframe://resource/<id>` URI is generated. */
170
170
  uri?: string;
171
171
  /** Snapshot reader. Called on each read. */
172
172
  read: () => Promise<AgentResourceContent> | AgentResourceContent;
@@ -195,7 +195,7 @@ interface AgentHandle {
195
195
  }
196
196
  /**
197
197
  * A lazy source of agent tools, queried at `list()` / `getTool()` /
198
- * `invoke()` time — the same on-demand projection the host applies to
198
+ * `invoke()` time, the same on-demand projection the host applies to
199
199
  * `agent`-flagged RPC definitions. Use a provider when tools *derive from*
200
200
  * other state (a command registry, a plugin catalog): the underlying state
201
201
  * stays the single source of truth and nothing needs to be kept in sync.
@@ -225,7 +225,7 @@ interface DevframeAgentHostEvents {
225
225
  'agent:resource:registered': (resource: AgentResource) => void;
226
226
  'agent:resource:unregistered': (id: string) => void;
227
227
  /**
228
- * Fires when the unified manifest changes — including when a new
228
+ * Fires when the unified manifest changes, including when a new
229
229
  * RPC function with an `agent` field is registered on `ctx.rpc`.
230
230
  */
231
231
  'agent:manifest:changed': () => void;
@@ -247,7 +247,7 @@ interface DevframeAgentHost {
247
247
  /** Unregister a previously registered tool by id. */
248
248
  unregisterTool: (id: string) => boolean;
249
249
  /**
250
- * Register a lazy tool source, queried on demand — see
250
+ * Register a lazy tool source, queried on demand; see
251
251
  * {@link AgentToolProvider}.
252
252
  */
253
253
  registerToolProvider: (provider: AgentToolProvider) => AgentToolProviderHandle;
@@ -276,7 +276,7 @@ interface DevframeAgentHost {
276
276
  //#endregion
277
277
  //#region src/adapters/flags.d.ts
278
278
  /**
279
- * Schema map for typed CLI flags. Keys are flag names in camelCase —
279
+ * Schema map for typed CLI flags. Keys are flag names in camelCase, so
280
280
  * this matches CAC's parsed-flag output ( `--no-open` → `noOpen` ). Each
281
281
  * value is any [Standard Schema](https://standardschema.dev/) validator
282
282
  * (valibot, zod, arktype, devframe's built-in `s`, …) used to both (a)
@@ -285,7 +285,7 @@ interface DevframeAgentHost {
285
285
  */
286
286
  type CliFlagsSchema = Record<string, StandardSchemaV1>;
287
287
  /**
288
- * Identity helper that preserves the literal schema-map type — use this
288
+ * Identity helper that preserves the literal schema-map type; use this
289
289
  * so `InferCliFlags<typeof myFlags>` resolves to the right object shape.
290
290
  *
291
291
  * ```ts
@@ -321,14 +321,14 @@ declare function parseCliFlags(schema: CliFlagsSchema, raw: Record<string, unkno
321
321
  * the handshake RPC functions, the resolver gate, the connect-time trust
322
322
  * hook, and the startup banner.
323
323
  *
324
- * `initDevframe` / `initHub` accept one of these directly via their `auth` option —
325
- * see {@link https://devfra.me | devframe}'s server docs — or a host can
324
+ * `initDevframe` / `initHub` accept one of these directly via their `auth` option
325
+ * (see {@link https://devfra.me | devframe}'s server docs), or a host can
326
326
  * wire the four pieces itself against a lower-level transport.
327
327
  */
328
328
  interface DevframeAuthHandler {
329
329
  /**
330
330
  * `anonymous:devframe:auth` + `anonymous:devframe:auth:exchange` (the
331
- * handshake) and `devframe:auth:revoke` (self-revoke) — register these on
331
+ * handshake) and `devframe:auth:revoke` (self-revoke); register these on
332
332
  * the RPC host (e.g. `rpcHost.register(fn)` for each).
333
333
  */
334
334
  rpcFunctions: RpcFunctionDefinitionAny[];
@@ -343,18 +343,18 @@ interface DevframeAuthHandler {
343
343
  * Connect-time trust: reads a bearer token off the connection's initial
344
344
  * request (a static/pre-shared token from `clientAuthTokens`, or a token
345
345
  * minted by the code exchange) and, when valid, marks the session
346
- * trusted immediately — before the client's own handshake call.
346
+ * trusted immediately, before the client's own handshake call.
347
347
  */
348
348
  onConnect: (connection: DevframeRpcConnection, session: DevframeNodeRpcSession) => void;
349
349
  /**
350
350
  * Print the current one-time code and its magic-link URL. Devframe stays
351
- * headless — call this yourself once the server is listening. Safe to
351
+ * headless, so call this yourself once the server is listening. Safe to
352
352
  * call repeatedly; it only prints once per code.
353
353
  */
354
354
  printBanner: () => void;
355
355
  /**
356
356
  * Rewrite a URL the CLI is about to open in the browser (`--open`) so the
357
- * tab lands already authenticated — e.g. appending the current OTP as a
357
+ * tab lands already authenticated, e.g. appending the current OTP as a
358
358
  * query param. Called with the fully-resolved target URL; return it
359
359
  * unchanged to opt out. Optional: a handler that doesn't need this (e.g.
360
360
  * one gated by a pre-shared bearer token instead of an interactive code)
@@ -373,7 +373,7 @@ interface DevframeAuthHandler {
373
373
  */
374
374
  type DevframeDiagnosticsLogger = Record<string, any>;
375
375
  /**
376
- * Host for structured diagnostics — a thin layer over `nostics` that lets
376
+ * Host for structured diagnostics: a thin layer over `nostics` that lets
377
377
  * integrations register their own coded errors/warnings into a shared
378
378
  * registry without taking a direct dependency on `nostics`.
379
379
  *
@@ -398,9 +398,9 @@ type DevframeDiagnosticsLogger = Record<string, any>;
398
398
  interface DevframeDiagnosticsHost {
399
399
  /**
400
400
  * Proxy-backed lookup of every registered diagnostic handle by code name.
401
- * Resolves to a `nostics` `DiagnosticHandle` — a callable that builds a
401
+ * Resolves to a `nostics` `DiagnosticHandle`: a callable that builds a
402
402
  * diagnostic and routes it through registered reporters; prefix with
403
- * `throw` to raise. Loosely typed — for autocompletion, keep a reference
403
+ * `throw` to raise. Loosely typed; for autocompletion, keep a reference
404
404
  * to the typed result of `defineDiagnostics()` instead.
405
405
  */
406
406
  readonly logger: DevframeDiagnosticsLogger;
@@ -408,7 +408,7 @@ interface DevframeDiagnosticsHost {
408
408
  * Register additional diagnostic definitions with this host. After
409
409
  * registration, codes from the new definition are reachable via
410
410
  * `host.logger.CODE`. Plugins that want shared output formatting should
411
- * build their diagnostics via `host.defineDiagnostics()` first — that
411
+ * build their diagnostics via `host.defineDiagnostics()` first; that
412
412
  * factory pre-wires the host's ANSI console reporter.
413
413
  */
414
414
  register: (definitions: Record<string, unknown>) => void;
@@ -424,12 +424,12 @@ interface DevframeDiagnosticsHost {
424
424
  //#region src/types/host.d.ts
425
425
  interface DevframeHost {
426
426
  /**
427
- * Serve static assets at the given URL base — a local directory, or a
427
+ * Serve static assets at the given URL base: a local directory, or a
428
428
  * resolved {@link RemoteAssetsStore} back-proxy. Called by
429
429
  * `DevframeViewHost.hostStatic` (which normalizes `RemoteAssets`
430
430
  * declarations into stores first). Implementations map this to whatever
431
431
  * the underlying runtime expects (Vite middleware, h3 handler, no-op
432
- * for build snapshots) — the shared engine in
432
+ * for build snapshots); the shared engine in
433
433
  * `devframe/utils/serve-static` accepts either shape.
434
434
  */
435
435
  mountStatic: (base: string, source: string | RemoteAssetsStore) => void | Promise<void>;
@@ -440,7 +440,7 @@ interface DevframeHost {
440
440
  *
441
441
  * Called by `ctx.install` for each mounted devframe (alongside
442
442
  * `mountStatic`). Without it, an embedded SPA can only discover the
443
- * endpoint by inheriting it from a same-origin parent window — which fails
443
+ * endpoint by inheriting it from a same-origin parent window, which fails
444
444
  * for cross-origin or sandboxed iframes. Implementations serve the same
445
445
  * meta they expose at the hub's own base.
446
446
  *
@@ -465,15 +465,15 @@ interface DevframeHost {
465
465
  * collide between, say, the Vite host (`.vite/devframe`) and a
466
466
  * standalone CLI host (`.<appName>/devframe`).
467
467
  *
468
- * - `workspace` — state shared with the whole team through version
468
+ * - `workspace`: state shared with the whole team through version
469
469
  * control (saved queries, shared presets). Conventionally
470
470
  * `${workspaceRoot}/.devframe/`; hosts must place it somewhere
471
471
  * committable.
472
- * - `project` — per-checkout private state (caches, personal
472
+ * - `project`: per-checkout private state (caches, personal
473
473
  * settings). Typically under
474
474
  * `${cwd}/node_modules/.<appName>/devframe/`, which version
475
475
  * control ignores.
476
- * - `global` — per-user state (auth tokens, machine-wide
476
+ * - `global`: per-user state (auth tokens, machine-wide
477
477
  * preferences). Typically under
478
478
  * `${homedir()}/.<appName>/devframe/`.
479
479
  *
@@ -553,7 +553,7 @@ interface DevframeRpcServerFunctions {
553
553
  * an auto-trust noop when `auth: false`.
554
554
  *
555
555
  * Named with the `anonymous:` prefix (see `isAnonymousRpcMethod`) so it is
556
- * reachable before the connection is trusted — this is the *only* rule the
556
+ * reachable before the connection is trusted; this is the *only* rule the
557
557
  * pre-trust gate applies, no per-method allowlist.
558
558
  *
559
559
  * @internal
@@ -665,7 +665,7 @@ interface DevframeRpcServerFunctions {
665
665
  */
666
666
  interface DevframeRpcSharedStates {
667
667
  /**
668
- * Wire-service advertisements — package name → `{ package, version,
668
+ * Wire-service advertisements: package name → `{ package, version,
669
669
  * scope, meta }` for every installed {@link import('./services').DevframeServiceDefinition}.
670
670
  * Written by the node services host at the `ready()` barrier; clients read
671
671
  * it through `client.services` (or subscribe to it directly for
@@ -758,9 +758,9 @@ interface DevframeSettingsStore<T extends Record<string, any> = Record<string, a
758
758
  /**
759
759
  * The two settings scopes available on a scoped context.
760
760
  *
761
- * - `project` — per-workspace state, persisted under the host's
761
+ * - `project`: per-workspace state, persisted under the host's
762
762
  * `workspace` storage dir. Project-local settings.
763
- * - `global` — per-user state, persisted under the host's `global`
763
+ * - `global`: per-user state, persisted under the host's `global`
764
764
  * storage dir. Machine-wide preferences.
765
765
  */
766
766
  interface DevframeSettings<T extends Record<string, any> = Record<string, any>> {
@@ -914,7 +914,7 @@ interface DevframeServicesScopeRegistry {}
914
914
  /** Resolved RPC scope namespace for a service package name, or `string`. */
915
915
  type DevframeServiceScopeOf<PKG> = PKG extends keyof DevframeServicesScopeRegistry ? DevframeServicesScopeRegistry[PKG] & string : string;
916
916
  /**
917
- * A **wire service** — a shared server-side capability (e.g. open-in-editor,
917
+ * A **wire service**: a shared server-side capability (e.g. open-in-editor,
918
918
  * syntax highlighting) packaged so any devframe host can install it once and
919
919
  * every plugin/client can consume it without re-implementing or re-bundling
920
920
  * it. Contrast with plain {@link DevframeServicesHost.provide}, which shares
@@ -925,16 +925,16 @@ type DevframeServiceScopeOf<PKG> = PKG extends keyof DevframeServicesScopeRegist
925
925
  * feature-detect it (`ctx.services.has(pkg)`) and degrade gracefully.
926
926
  *
927
927
  * Ship one per npm package (`@devframes/service-<slug>` for first-party),
928
- * with the package's default export being the `create<X>Service` factory —
928
+ * with the package's default export being the `create<X>Service` factory,
929
929
  * never a pre-built instance.
930
930
  */
931
931
  interface DevframeServiceDefinition<API = unknown, Options = any> {
932
932
  /**
933
- * The npm package name this service ships in — also its registry key
933
+ * The npm package name this service ships in, also its registry key
934
934
  * (`ctx.services.has('@devframes/service-x')` on both node and client).
935
935
  */
936
936
  package: string;
937
- /** Semver of the service — advertised to clients, checked against descriptor ranges. */
937
+ /** Semver of the service, advertised to clients and checked against descriptor ranges. */
938
938
  version: string;
939
939
  /**
940
940
  * RPC namespace the service's functions register under, following the
@@ -944,7 +944,7 @@ interface DevframeServiceDefinition<API = unknown, Options = any> {
944
944
  scope: string;
945
945
  /**
946
946
  * Extra advertised metadata (feature flags, defaults, …). Must be
947
- * JSON-serializable — it is mirrored to every client.
947
+ * JSON-serializable, since it is mirrored to every client.
948
948
  */
949
949
  meta?: Record<string, unknown>;
950
950
  /**
@@ -961,18 +961,18 @@ interface DevframeServiceDefinition<API = unknown, Options = any> {
961
961
  mergeOptions?: (sets: Options[]) => Options;
962
962
  /**
963
963
  * Construct the service: register its RPC functions on the pre-scoped
964
- * context and return its **node API** — the in-process surface other
964
+ * context and return its **node API**: the in-process surface other
965
965
  * plugins get from `ctx.services.get(package)` (no RPC hop server-side).
966
966
  * `info.options` carries every installer's option sets merged at the
967
967
  * `ready()` barrier (via {@link mergeOptions} when present, otherwise a
968
- * shallow merge in declaration order — later sets win).
968
+ * shallow merge in declaration order, later sets win).
969
969
  */
970
970
  setup: (ctx: DevframeScopedNodeContext, info: {
971
971
  options?: Options;
972
972
  }) => API | Promise<API>;
973
973
  }
974
974
  /**
975
- * Declarative reference to a service package — the form a
975
+ * Declarative reference to a service package: the form a
976
976
  * {@link DevframeServiceInput} takes when the installer doesn't hold the
977
977
  * factory itself (e.g. `DevframeDefinition.services`). The host imports the
978
978
  * package's default-export factory and installs the resulting definition at
@@ -983,13 +983,13 @@ interface DevframeServiceDescriptor<Options = any> {
983
983
  package: string;
984
984
  /**
985
985
  * Accepted semver range for the installed service. An unsatisfied range
986
- * warns (`DF0069`) — or throws (`DF0068`) when {@link required} — while the
986
+ * warns (`DF0069`), or throws (`DF0068`) when {@link required}, while the
987
987
  * service still installs; the advertised meta carries the real version.
988
988
  */
989
989
  version?: string;
990
990
  /**
991
991
  * Fail hard when the service can't be imported or its version range isn't
992
- * satisfied. By default a missing service is skipped silently — clients see
992
+ * satisfied. By default a missing service is skipped silently; clients see
993
993
  * `has() === false` and degrade.
994
994
  *
995
995
  * @default false
@@ -1002,7 +1002,7 @@ interface DevframeServiceDescriptor<Options = any> {
1002
1002
  * What can be passed to `ctx.services.install()` (and listed in
1003
1003
  * `DevframeDefinition.services`): a declarative {@link DevframeServiceDescriptor}
1004
1004
  * (the host imports the factory) or a ready {@link DevframeServiceDefinition}
1005
- * (the installer already called the factory — its `options` join the merge).
1005
+ * (the installer already called the factory, so its `options` join the merge).
1006
1006
  */
1007
1007
  type DevframeServiceInput<API = unknown, Options = any> = DevframeServiceDescriptor<Options> | DevframeServiceDefinition<API, Options>;
1008
1008
  /**
@@ -1010,7 +1010,7 @@ type DevframeServiceInput<API = unknown, Options = any> = DevframeServiceDescrip
1010
1010
  * `devframe:services` shared state.
1011
1011
  */
1012
1012
  interface DevframeServiceMeta {
1013
- /** npm package name — the registry key. */
1013
+ /** npm package name, the registry key. */
1014
1014
  package: string;
1015
1015
  /** Installed version of the service. */
1016
1016
  version: string;
@@ -1033,7 +1033,7 @@ interface DevframeServicesHost {
1033
1033
  get: <ID extends DevframeServiceId>(id: ID) => DevframeServiceOf<ID> | undefined;
1034
1034
  has: (id: DevframeServiceId) => boolean;
1035
1035
  /**
1036
- * Run `callback` with the service as soon as it is available — immediately
1036
+ * Run `callback` with the service as soon as it is available: immediately
1037
1037
  * when already provided, otherwise on `provide`. Survives provider/consumer
1038
1038
  * setup-order differences. The callback also re-fires if the service is
1039
1039
  * revoked and provided again. Returns an unsubscribe function.
@@ -1043,7 +1043,7 @@ interface DevframeServicesHost {
1043
1043
  keys: () => string[];
1044
1044
  /**
1045
1045
  * Install a **wire service** (see {@link DevframeServiceDefinition}). The
1046
- * common path is declarative — list services on `DevframeDefinition.services`
1046
+ * common path is declarative: list services on `DevframeDefinition.services`
1047
1047
  * (or `initHub({ services })`) and the adapter installs them for you before
1048
1048
  * `setup` runs. Call `install()` directly only for the dynamic escape hatch:
1049
1049
  * a service configured at runtime from data unknown until then.
@@ -1051,7 +1051,7 @@ interface DevframeServicesHost {
1051
1051
  * Before the pre-setup ready fires, installs are queued and their option
1052
1052
  * sets deep-merged, constructing each service **once**. After it, an install
1053
1053
  * constructs immediately; installing an already-installed package returns
1054
- * the existing API (a warning — `DF0066` — when the late install carried
1054
+ * the existing API (a warning, `DF0066`, when the late install carried
1055
1055
  * options, since they're ignored). The returned promise resolves with the
1056
1056
  * node API (or `undefined` when an optional descriptor's package can't be
1057
1057
  * imported).
@@ -1065,7 +1065,7 @@ interface DevframeServicesHost {
1065
1065
  resolveFrom?: string | null;
1066
1066
  }) => Promise<API | undefined>;
1067
1067
  /**
1068
- * Construct every queued service — importing descriptor packages, merging
1068
+ * Construct every queued service, importing descriptor packages, merging
1069
1069
  * option sets, `provide()`-ing each node API under its package name, and
1070
1070
  * advertising it to clients via the `devframe:services` shared state.
1071
1071
  * Idempotent. **Internal**: the adapters call it once, before running any
@@ -1089,28 +1089,28 @@ type DevframeDeploymentKind = 'standalone' | 'hosted';
1089
1089
  * How a hub deduplicates devframes that share an `id` when more than one
1090
1090
  * is mounted onto the same hub. See {@link DevframeDefinition.duplicationStrategy}.
1091
1091
  *
1092
- * - `'warn'` (default) — keep the first registration, drop later
1092
+ * - `'warn'` (default): keep the first registration, drop later
1093
1093
  * duplicates, and emit a warning diagnostic (`DF8105`).
1094
- * - `'silent'` — drop later duplicates without warning.
1095
- * - `'throw'` — throw when a duplicate is mounted.
1096
- * - `'duplicate'` — let every instance coexist under a disambiguated
1094
+ * - `'silent'`: drop later duplicates without warning.
1095
+ * - `'throw'`: throw when a duplicate is mounted.
1096
+ * - `'duplicate'`: let every instance coexist under a disambiguated
1097
1097
  * dock id.
1098
1098
  */
1099
1099
  type DevframeDuplicationStrategy = 'warn' | 'silent' | 'throw' | 'duplicate';
1100
1100
  /**
1101
- * Controls where the browser opens the RPC WebSocket — advertised in
1101
+ * Controls where the browser opens the RPC WebSocket, advertised in
1102
1102
  * `__connection.json` and used to bind the dev server. The three shapes map
1103
1103
  * to the three connection scenarios; precedence is `url` > `port` > `route`:
1104
1104
  *
1105
- * 1. **Same server, different route** (default) — leave `port`/`url` unset.
1105
+ * 1. **Same server, different route** (default): leave `port`/`url` unset.
1106
1106
  * The socket shares the HTTP server's port and binds to `route`
1107
1107
  * (`__ws`). The client connects to its own origin, so the link
1108
1108
  * survives a reverse proxy that rewrites the host/port/subpath.
1109
1109
  *
1110
- * 2. **Different port** — set `port`. The socket binds on its own port on the
1110
+ * 2. **Different port**: set `port`. The socket binds on its own port on the
1111
1111
  * same host; the client targets `ws(s)://<page-host>:<port>/<route>`.
1112
1112
  *
1113
- * 3. **Remote, different origin** — set `url` to a full `ws://`/`wss://`
1113
+ * 3. **Remote, different origin**: set `url` to a full `ws://`/`wss://`
1114
1114
  * endpoint (e.g. a public tunnel or relay). The client uses it verbatim.
1115
1115
  */
1116
1116
  interface DevframeWsOptions {
@@ -1139,7 +1139,7 @@ interface DevframeWsOptions {
1139
1139
  url?: string;
1140
1140
  }
1141
1141
  /**
1142
- * Controls the SSE RPC endpoint — the WebSocket-free transport for hosts
1142
+ * Controls the SSE RPC endpoint, the WebSocket-free transport for hosts
1143
1143
  * and proxies where the upgrade isn't available. It rides whatever HTTP
1144
1144
  * surface serves the instance (the same one serving `__connection.json`),
1145
1145
  * so a relative `route` always resolves; there is no port plumbing of its
@@ -1153,6 +1153,22 @@ interface DevframeSseOptions {
1153
1153
  */
1154
1154
  route?: string;
1155
1155
  }
1156
+ /**
1157
+ * An **optional** identity check layered on top of the origin gate. The
1158
+ * route-based MCP endpoint trusts same-machine callers by default (the
1159
+ * loopback origin gate is enough), so this is opt-in hardening for the cases
1160
+ * where a same-machine process is not a trust boundary, like a LAN/tunnel
1161
+ * origin, a shared/CI box, or a destructive tool surface:
1162
+ *
1163
+ * - a non-empty **bearer token string**: the request must carry
1164
+ * `Authorization: Bearer <token>`, compared in constant time. Back it with
1165
+ * an environment variable rather than a literal;
1166
+ * - a **callback** `(request) => boolean | Promise<boolean>`: a custom
1167
+ * identity check (validate a signed header, an mTLS-derived claim, …). It
1168
+ * only governs identity and cannot relax the origin gate;
1169
+ * - `false`, the default: **origin-only**, trusting same-machine callers.
1170
+ */
1171
+ type McpAuthorization = string | ((request: Request) => boolean | Promise<boolean>) | false;
1156
1172
  /**
1157
1173
  * Configuration for the route-based MCP server mounted alongside the dev
1158
1174
  * server (opt-in via {@link DevframeCliOptions.mcp}). The endpoint speaks
@@ -1166,6 +1182,16 @@ interface McpRouteOptions {
1166
1182
  * Default: `__mcp` (i.e. `/__mcp` standalone, `/__<id>/__mcp` hosted).
1167
1183
  */
1168
1184
  path?: string;
1185
+ /**
1186
+ * Optional identity check, layered on top of the origin gate and checked
1187
+ * **after** it. Defaults to origin-only (`false`): the route trusts
1188
+ * same-machine callers, since the loopback origin gate already keeps
1189
+ * arbitrary remote/browser callers out. Set a bearer token or a callback to
1190
+ * harden the route when a same-machine process is not your trust boundary
1191
+ * (LAN/tunnel origin, shared/CI host, destructive tools). See
1192
+ * {@link McpAuthorization}.
1193
+ */
1194
+ authorization?: McpAuthorization;
1169
1195
  /**
1170
1196
  * Extra `Origin` header values to accept beyond the loopback default
1171
1197
  * (`localhost`/`127.0.0.1`/`::1` and any `Origin`-less native client).
@@ -1173,10 +1199,12 @@ interface McpRouteOptions {
1173
1199
  * host, mirroring the WS transport's origin gate. Pass `false` to disable
1174
1200
  * origin checking entirely (not recommended). Default: loopback-only.
1175
1201
  *
1176
- * This is the endpoint's DNS-rebinding protection — the shared
1202
+ * This is the endpoint's DNS-rebinding protection: the shared
1177
1203
  * `isAllowedOrigin` gate the WS upgrade already uses, applied as external
1178
1204
  * middleware (the approach the MCP SDK now recommends over its own
1179
- * deprecated `allowedHosts`/`allowedOrigins` transport flags).
1205
+ * deprecated `allowedHosts`/`allowedOrigins` transport flags). When you
1206
+ * widen it past loopback, layer on {@link McpRouteOptions.authorization} to
1207
+ * prove identity too.
1180
1208
  */
1181
1209
  allowedOrigins?: readonly string[] | false;
1182
1210
  }
@@ -1200,16 +1228,16 @@ interface DevframeCliOptions {
1200
1228
  /**
1201
1229
  * Authentication for the standalone dev server.
1202
1230
  *
1203
- * - `undefined` / `true` — the standalone adapters (`cli` /
1231
+ * - `undefined` / `true`: the standalone adapters (`cli` /
1204
1232
  * served `build`) auto-wire devframe's interactive OTP auth
1205
1233
  * (`createInteractiveAuth`): an untrusted client can only reach
1206
1234
  * `anonymous:` methods until it exchanges the printed one-time code.
1207
1235
  * The adapter prints the code + magic-link banner once the server is
1208
1236
  * listening.
1209
- * - `false` — no gate, for trusted single-user localhost tools where an
1237
+ * - `false`: no gate, for trusted single-user localhost tools where an
1210
1238
  * auth round-trip only gets in the way (the built-in plugins set this).
1211
1239
  * The `--no-auth` CLI flag maps here for one-off runs.
1212
- * - A {@link DevframeAuthHandler} — a custom handler (e.g. a tuned
1240
+ * - A {@link DevframeAuthHandler}: a custom handler (e.g. a tuned
1213
1241
  * `createInteractiveAuth`, or an entirely different scheme) passed
1214
1242
  * straight through to the RPC transport binding.
1215
1243
  *
@@ -1220,21 +1248,29 @@ interface DevframeCliOptions {
1220
1248
  */
1221
1249
  auth?: boolean | DevframeAuthHandler;
1222
1250
  /**
1223
- * Expose a route-based MCP server alongside the dev server, speaking the
1224
- * MCP Streamable-HTTP transport at `/__mcp` (relative to the base path).
1225
- * It surfaces the same `ctx.agent` tools + shared-state resources as the
1226
- * stdio `mcp` command, but against the live, running server.
1251
+ * Expose a route-based MCP server alongside the standalone dev server,
1252
+ * speaking the MCP Streamable-HTTP transport at `/__mcp` (relative to the
1253
+ * base path). It surfaces the same `ctx.agent` tools + shared-state
1254
+ * resources as the stdio `mcp` command, but against the live server.
1255
+ *
1256
+ * - `false` / omitted (default): no MCP route is mounted.
1257
+ * - `true`: mount at the default `__mcp` route with the loopback origin
1258
+ * gate (trusting same-machine callers).
1259
+ * - {@link McpRouteOptions}: customise the route path, origin allow-list,
1260
+ * and opt into an {@link McpAuthorization} identity check.
1227
1261
  *
1228
- * - `false` / omitted (default) — no MCP route is mounted.
1229
- * - `true` — mount at the default `__mcp` route with the loopback-only
1230
- * origin gate.
1231
- * - {@link McpRouteOptions} — customise the route path / allowed origins.
1262
+ * The `--mcp` / `--no-mcp` CLI flags override this per run. Whether to expose
1263
+ * MCP is a hosting decision, so programmatic hosts pass it to
1264
+ * `initDevframe` / `initHub` / `createDevServer` instead.
1232
1265
  *
1233
- * The `--mcp` / `--no-mcp` CLI flags override this per run.
1266
+ * @deprecated Whether to expose MCP is a hosting decision, not a capability
1267
+ * of the tool. Pass `mcp` to `createCac` (or the programmatic host) instead.
1268
+ * This field is still read as a fallback, and will be removed in a future
1269
+ * release.
1234
1270
  */
1235
1271
  mcp?: boolean | McpRouteOptions;
1236
1272
  /**
1237
- * Author's SPA dist — served as the devframe's UI.
1273
+ * Author's SPA dist, served as the devframe's UI.
1238
1274
  *
1239
1275
  * @deprecated Moved to the top-level {@link DevframeDefinition.clientAssets}.
1240
1276
  * Set `clientAssets` on the definition instead. This field is still read as a
@@ -1245,11 +1281,11 @@ interface DevframeCliOptions {
1245
1281
  * How the browser reaches the RPC WebSocket. Defaults to sharing the HTTP
1246
1282
  * port on the `__ws` route. See {@link DevframeWsOptions} for the
1247
1283
  * different-port and remote-origin variants. Pass `false` to serve no
1248
- * WebSocket at all — clients connect over SSE instead (`backend: 'sse'`).
1284
+ * WebSocket at all; clients connect over SSE instead (`backend: 'sse'`).
1249
1285
  */
1250
1286
  ws?: DevframeWsOptions | false;
1251
1287
  /**
1252
- * How the browser reaches the SSE RPC endpoint — enabled by default
1288
+ * How the browser reaches the SSE RPC endpoint, enabled by default
1253
1289
  * alongside the WebSocket as the more portable transport. Pass `false`
1254
1290
  * to disable, or a {@link DevframeSseOptions} to change its route.
1255
1291
  */
@@ -1291,7 +1327,7 @@ interface DevframeCliOptions {
1291
1327
  }
1292
1328
  /**
1293
1329
  * Default dock attributes for the iframe entry a hub synthesizes when it
1294
- * mounts this devframe. Framework-neutral metadata only — the hub layer
1330
+ * mounts this devframe. Framework-neutral metadata only; the hub layer
1295
1331
  * (`ctx.install`) merges these beneath its per-mount `dock` overrides,
1296
1332
  * which in turn sit beneath the locked, derived `id` / `type` / `url`.
1297
1333
  *
@@ -1325,7 +1361,7 @@ interface DevframeDockDefaults {
1325
1361
  /**
1326
1362
  * Render-only visibility expression, same syntax as {@link when}. Hides the
1327
1363
  * entry's own dock-bar button when it evaluates to `false` while leaving it
1328
- * registered and reachable (activation, RPC lookups, etc.) — unlike `when`,
1364
+ * registered and reachable (activation, RPC lookups, etc.), unlike `when`,
1329
1365
  * which is the general relevance switch for the entry as a whole.
1330
1366
  */
1331
1367
  visibility?: string;
@@ -1372,13 +1408,13 @@ interface DevframeDefinition {
1372
1408
  * everything against the plugin's own installed packages rather than the
1373
1409
  * consuming app's.
1374
1410
  *
1375
- * - **Remote assets** — becomes the default `resolveFrom` for any remote
1411
+ * - **Remote assets**: becomes the default `resolveFrom` for any remote
1376
1412
  * {@link StaticAssetsSource} the devframe hosts (its `clientAssets`, and
1377
1413
  * every `ctx.views.hostStatic` call) that doesn't set one explicitly, so a
1378
1414
  * locally installed copy of the assets package is served with zero
1379
1415
  * network. A per-asset `resolveFrom` still wins, and an explicit
1380
1416
  * `resolveFrom: null` still opts out.
1381
- * - **Service dependencies** — becomes the base the host resolves declared
1417
+ * - **Service dependencies**: becomes the base the host resolves declared
1382
1418
  * {@link DevframeServiceInput | services} from, so a plugin can ship a
1383
1419
  * service package as its own dependency instead of asking users to install
1384
1420
  * it.
@@ -1424,12 +1460,12 @@ interface DevframeDefinition {
1424
1460
  * Declares which runtimes meaningfully support this devframe. Adapters
1425
1461
  * act on a `false` before doing any work:
1426
1462
  *
1427
- * - `build: false` — `createCac` skips registering the `build` subcommand,
1463
+ * - `build: false`: `createCac` skips registering the `build` subcommand,
1428
1464
  * and `createBuild` refuses (throws `DF0042`) unless `{ force: true }`.
1429
1465
  * Useful for a devframe whose value is inherently live (e.g. it manages
1430
1466
  * real files on disk), so a static export would only ever produce a
1431
1467
  * broken, write-less shell of the tool.
1432
- * - `dev: false` — `createDevServer` refuses (throws `DF0058`) unless
1468
+ * - `dev: false`: `createDevServer` refuses (throws `DF0058`) unless
1433
1469
  * `{ force: true }`. Useful for a devframe that only makes sense as a
1434
1470
  * static export (e.g. a report generator with nothing to serve live).
1435
1471
  */
@@ -1440,18 +1476,18 @@ interface DevframeDefinition {
1440
1476
  /**
1441
1477
  * Wire services this devframe consumes (see `DevframeServiceDefinition`).
1442
1478
  * Each entry is either a declarative descriptor
1443
- * (`{ package, version?, required?, options? }` — the host imports the
1479
+ * (`{ package, version?, required?, options? }`, where the host imports the
1444
1480
  * package's default-export factory, resolving it against **this plugin's
1445
1481
  * own dependencies**) or a ready `DevframeServiceDefinition` (the factory
1446
1482
  * was already called). The adapter queues these before `setup(ctx)` runs
1447
1483
  * and constructs each service once at the `ctx.services.ready()` barrier,
1448
1484
  * merging option sets across every declarer. Missing services are skipped
1449
- * unless marked `required` — clients feature-detect via
1485
+ * unless marked `required`; clients feature-detect via
1450
1486
  * `client.services.has(pkg)` and degrade.
1451
1487
  */
1452
1488
  services?: DevframeServiceInput[];
1453
1489
  /**
1454
- * Author's SPA dist — served as the devframe's UI. A local directory, or
1490
+ * Author's SPA dist, served as the devframe's UI. A local directory, or
1455
1491
  * a {@link StaticAssetsSource} remote declaration (`{ package, version }`)
1456
1492
  * served through devframe's caching CDN back-proxy so the assets need not
1457
1493
  * ship inside the node package.
@@ -1463,20 +1499,20 @@ interface DevframeDefinition {
1463
1499
  clientAssets?: StaticAssetsSource;
1464
1500
  /** RPC-level configuration for this devframe (see {@link DevframeRpcOptions}). */
1465
1501
  rpc?: DevframeRpcOptions;
1466
- /** Server-side setup — the primary entrypoint. Runs in every runtime. */
1502
+ /** Server-side setup: the primary entrypoint. Runs in every runtime. */
1467
1503
  setup: (ctx: DevframeNodeContext, info?: DevframeSetupInfo) => void | Promise<void>;
1468
1504
  cli?: DevframeCliOptions;
1469
1505
  }
1470
1506
  interface DevframeRpcOptions {
1471
1507
  /**
1472
1508
  * Opt an RPC function into the static-build snapshot **without owning its
1473
- * definition** — the mechanism a devframe uses to bake a wire service's
1509
+ * definition**, the mechanism a devframe uses to bake a wire service's
1474
1510
  * RPC (e.g. `@devframes/service-git`'s `status`/`log`/`show`) into its
1475
1511
  * `build` export, since the service itself defines no `dump`/`snapshot`.
1476
1512
  *
1477
1513
  * Each entry is either a bare method id (bakes the no-argument call, like
1478
1514
  * `snapshot: true`) or `{ method, inputs }` where `inputs` is the list of
1479
- * argument-tuples to bake — or an async provider given the node context
1515
+ * argument-tuples to bake, or an async provider given the node context
1480
1516
  * (so it can enumerate at build time, e.g. read commit hashes via the
1481
1517
  * service's node API). `createBuild` resolves these after setup and
1482
1518
  * executes the target's own handler per tuple; the first tuple's result
@@ -1576,7 +1612,7 @@ interface BufferedChunk<T> {
1576
1612
  interface StreamSinkEvents<T> {
1577
1613
  /** Fired for each `write()`. The RPC layer subscribes and broadcasts. */
1578
1614
  chunk: (seq: number, chunk: T) => void;
1579
- /** Terminal — fired exactly once per sink lifetime. */
1615
+ /** Terminal; fired exactly once per sink lifetime. */
1580
1616
  end: (error?: StreamErrorPayload) => void;
1581
1617
  }
1582
1618
  interface CreateStreamSinkOptions {
@@ -1610,17 +1646,17 @@ interface StreamSink<T> {
1610
1646
  close: () => void;
1611
1647
  /** External-cancel path. Aborts the signal so handlers can short-circuit. */
1612
1648
  abort: (reason?: unknown) => void;
1613
- /** `WritableStream<T>` adapter — same in-memory state as the imperative API. */
1649
+ /** `WritableStream<T>` adapter; same in-memory state as the imperative API. */
1614
1650
  readonly writable: WritableStream<T>;
1615
1651
  /**
1616
- * Internal — RPC layer subscribes to receive chunk/end notifications.
1652
+ * Internal: RPC layer subscribes to receive chunk/end notifications.
1617
1653
  * Not part of the public contract; do not call directly.
1618
1654
  *
1619
1655
  * @internal
1620
1656
  */
1621
1657
  readonly events: EventEmitter<StreamSinkEvents<T>>;
1622
1658
  /**
1623
- * Internal — replay buffer. RPC layer reads on (re)subscribe to feed
1659
+ * Internal replay buffer. RPC layer reads on (re)subscribe to feed
1624
1660
  * missed chunks before going live.
1625
1661
  *
1626
1662
  * @internal
@@ -1640,12 +1676,12 @@ interface CreateStreamReaderOptions {
1640
1676
  * RPC-agnostic.
1641
1677
  */
1642
1678
  onOverflow?: (dropped: number) => void;
1643
- /** Called when the consumer cancels — the RPC layer sends `:cancel` upstream. */
1679
+ /** Called when the consumer cancels; the RPC layer sends `:cancel` upstream. */
1644
1680
  onCancel?: () => void;
1645
1681
  }
1646
1682
  /**
1647
1683
  * Client-side consumer handle. Both an `AsyncIterable<T>` (for `for await`)
1648
- * and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one — they
1684
+ * and exposes `readable: ReadableStream<T>` (for `pipeTo`). Pick one; they
1649
1685
  * share a single internal queue, so concurrent draining will race.
1650
1686
  */
1651
1687
  interface StreamReader<T> extends AsyncIterable<T> {
@@ -1663,13 +1699,13 @@ interface StreamReader<T> extends AsyncIterable<T> {
1663
1699
  _end: (error?: StreamErrorPayload) => void;
1664
1700
  }
1665
1701
  /**
1666
- * Build a server-side stream sink. RPC-agnostic — the RPC host wires
1702
+ * Build a server-side stream sink. RPC-agnostic; the RPC host wires
1667
1703
  * `events.on('chunk' | 'end')` to broadcast, and reads `buffer` to replay
1668
1704
  * for late or reconnecting subscribers.
1669
1705
  */
1670
1706
  declare function createStreamSink<T>(options?: CreateStreamSinkOptions): StreamSink<T>;
1671
1707
  /**
1672
- * Build a client-side stream reader. RPC-agnostic — the RPC host calls
1708
+ * Build a client-side stream reader. RPC-agnostic; the RPC host calls
1673
1709
  * `_push(seq, chunk)` on each incoming chunk and `_end(error?)` on the
1674
1710
  * terminal frame. Consumers iterate with `for await` or pipe `readable`.
1675
1711
  */
@@ -1747,7 +1783,7 @@ interface RpcStreamingChannelOptions {
1747
1783
  * replay-on-resubscribe. `0` (default) disables replay; on reconnect
1748
1784
  * the consumer only sees chunks that arrive after subscribing.
1749
1785
  *
1750
- * The buffer is per stream id, not per channel — each `channel.start()`
1786
+ * The buffer is per stream id, not per channel; each `channel.start()`
1751
1787
  * gets its own.
1752
1788
  */
1753
1789
  replayWindow?: number;
@@ -1797,7 +1833,7 @@ interface RpcStreamingChannel<T = unknown> {
1797
1833
  /** All active outbound stream ids on this channel. */
1798
1834
  ids: () => string[];
1799
1835
  /**
1800
- * Open an inbound stream — the server side of a client-to-server
1836
+ * Open an inbound stream: the server side of a client-to-server
1801
1837
  * upload. Allocates an id, returns a `StreamReader<T>` that fills as
1802
1838
  * the client writes chunks. Typical pattern is to call this from an
1803
1839
  * action handler, kick off background processing, and return the id
@@ -1848,7 +1884,7 @@ interface DevframeCapabilities {
1848
1884
  views?: boolean;
1849
1885
  }
1850
1886
  /**
1851
- * Framework- and build-tool-agnostic node context — RPC + diagnostics +
1887
+ * Framework- and build-tool-agnostic node context: RPC + diagnostics +
1852
1888
  * agent + the view-host (HTTP file-serving). Host adapters can wrap this
1853
1889
  * to add their own surfaces; for example, `@vitejs/devtools-kit`'s
1854
1890
  * `createKitContext` adds `docks`, `terminals`, `messages`, and
@@ -1862,10 +1898,10 @@ interface DevframeNodeContext {
1862
1898
  /**
1863
1899
  * Lifecycle distinction surfaced to plugin authors:
1864
1900
  *
1865
- * - `'dev'` — long-running, interactive session. Connections come and
1901
+ * - `'dev'`: long-running, interactive session. Connections come and
1866
1902
  * go; broadcasts and shared-state mutations are debounced
1867
1903
  * to keep the UI responsive.
1868
- * - `'build'` — one-shot batch run. The context is set up, the devtool
1904
+ * - `'build'`: one-shot batch run. The context is set up, the devtool
1869
1905
  * collects what it needs, and a snapshot is written. No
1870
1906
  * live UI, no WS server.
1871
1907
  *
@@ -1875,23 +1911,23 @@ interface DevframeNodeContext {
1875
1911
  */
1876
1912
  readonly mode: 'dev' | 'build';
1877
1913
  /**
1878
- * Host runtime abstraction — exposes `mountStatic` / `resolveOrigin` /
1914
+ * Host runtime abstraction, exposing `mountStatic` / `resolveOrigin` /
1879
1915
  * `getStorageDir`.
1880
1916
  */
1881
1917
  host: DevframeHost;
1882
1918
  rpc: RpcFunctionsHost;
1883
1919
  views: DevframeViewHost;
1884
1920
  /**
1885
- * Structured diagnostics host — wraps `nostics` and lets integrations
1921
+ * Structured diagnostics host; wraps `nostics` and lets integrations
1886
1922
  * register their own coded errors/warnings into the shared lookup.
1887
1923
  */
1888
1924
  diagnostics: DevframeDiagnosticsHost;
1889
1925
  /**
1890
- * Agent host — aggregates the agent-exposed surface of this devtool.
1926
+ * Agent host; aggregates the agent-exposed surface of this devtool.
1891
1927
  */
1892
1928
  agent: DevframeAgentHost;
1893
1929
  /**
1894
- * Cross-plugin services — a typed, namespaced registry through which one
1930
+ * Cross-plugin services: a typed, namespaced registry through which one
1895
1931
  * integration exposes a capability (e.g. a data-source registry) and
1896
1932
  * others consume it without a hard package dependency. Ids follow the RPC
1897
1933
  * namespacing rule (`<plugin-id>:<service>`); types come from augmenting
@@ -1900,11 +1936,11 @@ interface DevframeNodeContext {
1900
1936
  */
1901
1937
  services: DevframeServicesHost;
1902
1938
  /**
1903
- * This context's own {@link ConnectionMeta.configs} — static, boot-time
1939
+ * This context's own {@link ConnectionMeta.configs}: static, boot-time
1904
1940
  * config a host publishes once through the connection handshake and every
1905
1941
  * client reads read-only. A plain, **non-reactive** object: mutate it
1906
1942
  * during `setup(ctx)` (a plugin sets its keys, a hub aggregates across
1907
- * every installed devframe), never during the session — it's serialized
1943
+ * every installed devframe), never during the session, since it's serialized
1908
1944
  * once, after setup, and changing it afterwards reaches no client.
1909
1945
  *
1910
1946
  * ```ts
@@ -1935,7 +1971,7 @@ interface DevframeNodeContext {
1935
1971
  * where `__connection.json` was loaded, and the connection is made to the
1936
1972
  * page's own origin (only the `http`→`ws` / `https`→`wss` protocol swap is
1937
1973
  * applied). This survives reverse proxies that change the host/port, because
1938
- * the client never trusts a server-baked hostname — it reuses its own.
1974
+ * the client never trusts a server-baked hostname; it reuses its own.
1939
1975
  *
1940
1976
  * Set `port` (and/or `host`) only when the WS endpoint genuinely lives on a
1941
1977
  * different origin than the page, e.g. a side-car server on its own port.
@@ -1953,7 +1989,7 @@ interface ConnectionMetaWebsocket {
1953
1989
  host?: string;
1954
1990
  }
1955
1991
  /**
1956
- * Object form of {@link ConnectionMeta.sse} — the same proxy-safe shape and
1992
+ * Object form of {@link ConnectionMeta.sse}: the same proxy-safe shape and
1957
1993
  * resolution rules as {@link ConnectionMetaWebsocket}, producing an
1958
1994
  * `http(s)://` endpoint instead of a `ws(s)://` one. Set `port` (and/or
1959
1995
  * `host`) only when the SSE endpoint genuinely lives on a different origin
@@ -1981,10 +2017,10 @@ interface ConnectionMeta {
1981
2017
  /**
1982
2018
  * WebSocket endpoint, resolved by the client into a `ws(s)://` URL:
1983
2019
  *
1984
- * - {@link ConnectionMetaWebsocket} — the proxy-flexible default; a
2020
+ * - {@link ConnectionMetaWebsocket}: the proxy-flexible default; a
1985
2021
  * same-origin path relative to `__connection.json`.
1986
- * - `number` — a port on the page's hostname (`ws(s)://<host>:<port>`).
1987
- * - `string` — a full `ws://`/`wss://` URL used verbatim, an `http(s)://`
2022
+ * - `number`: a port on the page's hostname (`ws(s)://<host>:<port>`).
2023
+ * - `string`: a full `ws://`/`wss://` URL used verbatim, an `http(s)://`
1988
2024
  * URL with its protocol swapped, or a path resolved same-origin.
1989
2025
  */
1990
2026
  websocket?: number | string | ConnectionMetaWebsocket;
@@ -1993,9 +2029,9 @@ interface ConnectionMeta {
1993
2029
  * resolved by the client into an `http(s)://` URL with the same
1994
2030
  * proxy-safe rules as {@link ConnectionMeta.websocket}:
1995
2031
  *
1996
- * - {@link ConnectionMetaSse} — the proxy-flexible default; a
2032
+ * - {@link ConnectionMetaSse}: the proxy-flexible default; a
1997
2033
  * same-origin path relative to `__connection.json`.
1998
- * - `string` — a full `http(s)://` URL used verbatim, or a path
2034
+ * - `string`: a full `http(s)://` URL used verbatim, or a path
1999
2035
  * resolved same-origin.
2000
2036
  */
2001
2037
  sse?: string | ConnectionMetaSse;
@@ -2005,7 +2041,7 @@ interface ConnectionMeta {
2005
2041
  * tooling (e.g. an MCP inspector) can discover it without guessing the
2006
2042
  * path. `path` is relative to `__connection.json`'s location, like the
2007
2043
  * WebSocket `path`. `port` is set when the endpoint lives on a side-car
2008
- * server on its own port (bridge mode — `devframeViteBridge`,
2044
+ * server on its own port (bridge mode: `devframeViteBridge`,
2009
2045
  * `@devframes/next`): the client combines the page hostname with `port`
2010
2046
  * and resolves `path` against that origin, mirroring
2011
2047
  * {@link ConnectionMetaWebsocket.port}.
@@ -2035,7 +2071,7 @@ interface ConnectionMeta {
2035
2071
  /**
2036
2072
  * A pre-issued bearer token embedded in the meta so a client trusts the
2037
2073
  * server on connect without any prompt or `localStorage` lookup. Only a
2038
- * **hub** serving a **per-frame** connection meta populates this — it
2074
+ * **hub** serving a **per-frame** connection meta populates this; it
2039
2075
  * authenticates once at the top level and bakes the resulting token into
2040
2076
  * the meta each plugin iframe fetches, so a cross-origin frame (which
2041
2077
  * cannot read the hub's `localStorage`) is still pre-authorized. The
@@ -2043,7 +2079,7 @@ interface ConnectionMeta {
2043
2079
  *
2044
2080
  * > [!WARNING]
2045
2081
  * > A token in a fetchable JSON is only as protected as the URL serving
2046
- * > it. Emit it exclusively from hub-controlled, per-frame meta — never
2082
+ * > it. Emit it exclusively from hub-controlled, per-frame meta, never
2047
2083
  * > from a publicly reachable static `__connection.json`.
2048
2084
  */
2049
2085
  authToken?: string;
@@ -2057,13 +2093,13 @@ interface ConnectionMeta {
2057
2093
  */
2058
2094
  viewerOriginToken?: string;
2059
2095
  /**
2060
- * Static, host-declared configuration — baked in once at connect time and
2096
+ * Static, host-declared configuration, baked in once at connect time and
2061
2097
  * fixed for the life of the server (e.g. a hub's UI rebrand, or its
2062
2098
  * aggregated dock-bar layout preferences). Read-only from the browser: a
2063
2099
  * client only ever reads `rpc.connectionMeta.configs`, never writes to it.
2064
2100
  *
2065
2101
  * Contrast this with {@link DevframeSettingsRegistry} (`ctx.scope(ns).settings`)
2066
- * and a hub's `devframe:user-settings` shared-state key — both are
2102
+ * and a hub's `devframe:user-settings` shared-state key; both are
2067
2103
  * mutable, user-editable, and synced bidirectionally over RPC for the
2068
2104
  * life of the session. `configs` is the opposite: one-way, immutable,
2069
2105
  * decided by whoever assembled the server.
@@ -2081,7 +2117,7 @@ interface ConnectionMeta {
2081
2117
  configs?: Partial<DevframeConnectionConfigsRegistry>;
2082
2118
  }
2083
2119
  /**
2084
- * Augmentation point for {@link ConnectionMeta.configs}. Empty by default —
2120
+ * Augmentation point for {@link ConnectionMeta.configs}. Empty by default;
2085
2121
  * a package that wants to publish static, boot-time config through the
2086
2122
  * connection handshake augments this interface with its own key (see
2087
2123
  * {@link ConnectionMeta.configs} for the pattern). `@devframes/hub`
@@ -2089,4 +2125,4 @@ interface ConnectionMeta {
2089
2125
  */
2090
2126
  interface DevframeConnectionConfigsRegistry {}
2091
2127
  //#endregion
2092
- export { DevframeServicesHost as $, SharedStateEvents as A, AgentResource as At, DevframeSetupInfo as B, EventUnsubscribe as Bt, createStreamSink as C, DevframeAuthHandler as Ct, ImmutableObject as D, parseCliFlags as Dt, ImmutableMap as E, defineCliFlags as Et, DevframeDefinition as F, AgentToolProvider as Ft, McpRouteOptions as G, DevframeSnapshotRpcInputs as H, DevframeDeploymentKind as I, AgentToolProviderHandle as It, DevframeServiceId as J, DevframeServiceDefinition as K, DevframeDockDefaults as L, DevframeAgentHost as Lt, SharedStatePatch as M, AgentResourceInput as Mt, createSharedState as N, AgentTool as Nt, ImmutableSet as O, AgentHandle as Ot, DevframeCliOptions as P, AgentToolInput as Pt, DevframeServiceScopeOf as Q, DevframeDuplicationStrategy as R, DevframeAgentHostEvents as Rt, createStreamReader as S, DevframeDiagnosticsLogger as St, ImmutableArray as T, InferCliFlags as Tt, DevframeSseOptions as U, DevframeSnapshotRpcEntry as V, EventsMap as Vt, DevframeWsOptions as W, DevframeServiceMeta as X, DevframeServiceInput as Y, DevframeServiceOf as Z, CreateStreamSinkOptions as _, DevframeRpcServerFunctions as _t, DevframeConnectionConfigsRegistry as a, DevframeScopedStreamingHost as at, StreamSink as b, DevframeStorageScope as bt, RpcBroadcastOptions as c, DevframeSettingsStore as ct, RpcSharedStateHost as d, ScopedRpcFn as dt, DevframeServicesRegistry as et, RpcStreamingChannel as f, ScopedServerFunctions as ft, CreateStreamReaderOptions as g, DevframeRpcClientFunctions as gt, BufferedChunk as h, DevframeViewHost as ht, DevframeCapabilities as i, DevframeScopedNodeRpc as it, SharedStateOptions as j, AgentResourceContent as jt, SharedState as k, AgentManifest as kt, RpcFunctionsHost as l, ScopedBroadcastOptions as lt, RpcStreamingHost as m, SettingsForNamespace as mt, ConnectionMetaSse as n, DevframeServicesState as nt, DevframeNodeContext as o, DevframeSettings as ot, RpcStreamingChannelOptions as p, ScopedSharedStates as pt, DevframeServiceDescriptor as q, ConnectionMetaWebsocket as r, DevframeScopedNodeContext as rt, DevframeNodeRpcSession as s, DevframeSettingsRegistry as st, ConnectionMeta as t, DevframeServicesScopeRegistry as tt, RpcSharedStateGetOptions as u, ScopedClientFunctions as ut, StreamErrorPayload as v, DevframeRpcSharedStates as vt, Immutable as w, CliFlagsSchema as wt, StreamSinkEvents as x, DevframeDiagnosticsHost as xt, StreamReader as y, DevframeHost as yt, DevframeRpcOptions as z, EventEmitter as zt };
2128
+ export { DevframeServiceScopeOf as $, SharedStateEvents as A, AgentManifest as At, DevframeSetupInfo as B, EventEmitter as Bt, createStreamSink as C, DevframeDiagnosticsLogger as Ct, ImmutableObject as D, defineCliFlags as Dt, ImmutableMap as E, InferCliFlags as Et, DevframeDefinition as F, AgentToolInput as Ft, McpAuthorization as G, DevframeSnapshotRpcInputs as H, EventsMap as Ht, DevframeDeploymentKind as I, AgentToolProvider as It, DevframeServiceDescriptor as J, McpRouteOptions as K, DevframeDockDefaults as L, AgentToolProviderHandle as Lt, SharedStatePatch as M, AgentResourceContent as Mt, createSharedState as N, AgentResourceInput as Nt, ImmutableSet as O, parseCliFlags as Ot, DevframeCliOptions as P, AgentTool as Pt, DevframeServiceOf as Q, DevframeDuplicationStrategy as R, DevframeAgentHost as Rt, createStreamReader as S, DevframeDiagnosticsHost as St, ImmutableArray as T, CliFlagsSchema as Tt, DevframeSseOptions as U, DevframeSnapshotRpcEntry as V, EventUnsubscribe as Vt, DevframeWsOptions as W, DevframeServiceInput as X, DevframeServiceId as Y, DevframeServiceMeta as Z, CreateStreamSinkOptions as _, DevframeRpcClientFunctions as _t, DevframeConnectionConfigsRegistry as a, DevframeScopedNodeRpc as at, StreamSink as b, DevframeHost as bt, RpcBroadcastOptions as c, DevframeSettingsRegistry as ct, RpcSharedStateHost as d, ScopedClientFunctions as dt, DevframeServicesHost as et, RpcStreamingChannel as f, ScopedRpcFn as ft, CreateStreamReaderOptions as g, DevframeViewHost as gt, BufferedChunk as h, SettingsForNamespace as ht, DevframeCapabilities as i, DevframeScopedNodeContext as it, SharedStateOptions as j, AgentResource as jt, SharedState as k, AgentHandle as kt, RpcFunctionsHost as l, DevframeSettingsStore as lt, RpcStreamingHost as m, ScopedSharedStates as mt, ConnectionMetaSse as n, DevframeServicesScopeRegistry as nt, DevframeNodeContext as o, DevframeScopedStreamingHost as ot, RpcStreamingChannelOptions as p, ScopedServerFunctions as pt, DevframeServiceDefinition as q, ConnectionMetaWebsocket as r, DevframeServicesState as rt, DevframeNodeRpcSession as s, DevframeSettings as st, ConnectionMeta as t, DevframeServicesRegistry as tt, RpcSharedStateGetOptions as u, ScopedBroadcastOptions as ut, StreamErrorPayload as v, DevframeRpcServerFunctions as vt, Immutable as w, DevframeAuthHandler as wt, StreamSinkEvents as x, DevframeStorageScope as xt, StreamReader as y, DevframeRpcSharedStates as yt, DevframeRpcOptions as z, DevframeAgentHostEvents as zt };