devframe 0.9.7 → 0.9.8

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 (49) hide show
  1. package/dist/{_shared-BJ6AmwTu.d.mts → _shared-mtXpcJIv.d.mts} +1 -1
  2. package/dist/adapters/build.d.mts +1 -1
  3. package/dist/adapters/build.mjs +1 -1
  4. package/dist/adapters/cac.d.mts +1 -1
  5. package/dist/adapters/cac.mjs +1 -1
  6. package/dist/adapters/dev.d.mts +4 -4
  7. package/dist/adapters/dev.mjs +1 -1
  8. package/dist/adapters/embedded.d.mts +1 -1
  9. package/dist/adapters/initiate.d.mts +3 -3
  10. package/dist/adapters/initiate.mjs +1 -1
  11. package/dist/adapters/mcp.d.mts +1 -1
  12. package/dist/adapters/mcp.mjs +1 -1
  13. package/dist/client/index.d.mts +1 -1
  14. package/dist/client/index.mjs +1 -1
  15. package/dist/client-assets-C7SXgTWY.mjs +16 -0
  16. package/dist/{context-BhBzOXVa.d.mts → context-CLF4-8Pp.d.mts} +16 -1
  17. package/dist/{context-HOnG-WvG.d.mts → context-DftYyXaR.d.mts} +1 -1
  18. package/dist/{dev-Czit5IP4.mjs → dev-CzkPCJwi.mjs} +1 -1
  19. package/dist/in-page-channel/index.d.mts +46 -9
  20. package/dist/in-page-channel/index.mjs +9 -3
  21. package/dist/{index-DcKxIMoI.d.mts → index-D3k0BIhe.d.mts} +2 -2
  22. package/dist/index.d.mts +5 -7
  23. package/dist/index.mjs +5 -6
  24. package/dist/{instance-shell-Bh4l9Vz_.d.mts → instance-shell-Tcp5hGoq.d.mts} +3 -3
  25. package/dist/internal/index.d.mts +19 -6
  26. package/dist/internal/index.mjs +2 -1
  27. package/dist/node/auth.d.mts +2 -2
  28. package/dist/node/hub-internals.d.mts +2 -2
  29. package/dist/node/index.d.mts +1 -1
  30. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  31. package/dist/recipes/interactive-auth.d.mts +2 -2
  32. package/dist/rpc/transports/sse-server.d.mts +1 -1
  33. package/dist/rpc/transports/sse-server.mjs +1 -1
  34. package/dist/rpc/transports/ws-bun.d.mts +2 -2
  35. package/dist/rpc/transports/ws-bun.mjs +1 -1
  36. package/dist/rpc/transports/ws-deno.d.mts +2 -2
  37. package/dist/rpc/transports/ws-deno.mjs +1 -1
  38. package/dist/rpc/transports/ws-server.d.mts +1 -1
  39. package/dist/rpc/transports/ws-server.mjs +1 -1
  40. package/dist/{rpc-core-BHUsDl7s.d.mts → rpc-core-B3W3z9ff.d.mts} +3 -3
  41. package/dist/{shared-state-DoXutg_U.mjs → shared-state--sduc6Xi.mjs} +2 -1
  42. package/dist/types/index.d.mts +2 -2
  43. package/dist/utils/events.d.mts +1 -1
  44. package/dist/utils/shared-state.d.mts +1 -1
  45. package/dist/utils/shared-state.mjs +1 -1
  46. package/dist/utils/streaming-channel.d.mts +1 -1
  47. package/dist/{ws-server-Di2oqr4q.d.mts → ws-server-VyHlanzy.d.mts} +15 -0
  48. package/dist/{ws-server-BdSLrhxE.mjs → ws-server-Y_AumUQH.mjs} +28 -1
  49. package/package.json +5 -5
@@ -1,4 +1,4 @@
1
- import { F as DevframeDefinition, G as McpRouteOptions, I as DevframeDeploymentKind, t as ConnectionMeta } from "./context-BhBzOXVa.mjs";
1
+ import { F as DevframeDefinition, G as McpRouteOptions, I as DevframeDeploymentKind, t as ConnectionMeta } from "./context-CLF4-8Pp.mjs";
2
2
  //#region src/adapters/_shared.d.ts
3
3
  /**
4
4
  * Resolve the mount base path for a devframe's SPA. Hosted adapters
@@ -1,4 +1,4 @@
1
- import { F as DevframeDefinition, V as DevframeSnapshotRpcEntry, o as DevframeNodeContext } from "../context-BhBzOXVa.mjs";
1
+ import { F as DevframeDefinition, V as DevframeSnapshotRpcEntry, o as DevframeNodeContext } from "../context-CLF4-8Pp.mjs";
2
2
  import { o as StaticAssetsSource } from "../remote-assets-B13_vRkJ.mjs";
3
3
  //#region src/adapters/build.d.ts
4
4
  interface CreateBuildOptions {
@@ -1,6 +1,6 @@
1
1
  import { s as colors } from "../nostics-CzECRXpE.mjs";
2
2
  import { n as strictJsonStringify } from "../serialization-BGzEwAdr.mjs";
3
- import { resolveClientAssets } from "../index.mjs";
3
+ import { t as resolveClientAssets } from "../client-assets-C7SXgTWY.mjs";
4
4
  import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
5
5
  import { t as collectStaticRpcDump } from "../static-DV_qUSRS.mjs";
6
6
  import { n as structuredCloneStringify } from "../structured-clone-CbAV5rFI.mjs";
@@ -1,4 +1,4 @@
1
- import { Dt as parseCliFlags, Et as defineCliFlags, F as DevframeDefinition, Tt as InferCliFlags, wt as CliFlagsSchema } from "../context-BhBzOXVa.mjs";
1
+ import { Dt as parseCliFlags, Et as defineCliFlags, F as DevframeDefinition, Tt as InferCliFlags, wt as CliFlagsSchema } from "../context-CLF4-8Pp.mjs";
2
2
  import { CAC } from "cac";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/cac.d.ts
@@ -2,7 +2,7 @@ import { s as colors } from "../nostics-CzECRXpE.mjs";
2
2
  import { r as resolveDevServerPort } from "../_shared-BM3PdYli.mjs";
3
3
  import { a as importRuntimeModule } from "../instance-shell-CpVW4zG0.mjs";
4
4
  import { createBuild } from "./build.mjs";
5
- import { t as createDevServer } from "../dev-Czit5IP4.mjs";
5
+ import { t as createDevServer } from "../dev-CzkPCJwi.mjs";
6
6
  import process from "node:process";
7
7
  import cac$1 from "cac";
8
8
  //#region src/adapters/flags.ts
@@ -1,8 +1,8 @@
1
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-Di2oqr4q.mjs";
2
- import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, s as DevframeNodeRpcSession } from "../context-BhBzOXVa.mjs";
1
+ import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-VyHlanzy.mjs";
2
+ import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, s as DevframeNodeRpcSession } from "../context-CLF4-8Pp.mjs";
3
3
  import { o as StaticAssetsSource } from "../remote-assets-B13_vRkJ.mjs";
4
- import { c as StartedServer } from "../instance-shell-Bh4l9Vz_.mjs";
5
- import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-BJ6AmwTu.mjs";
4
+ import { c as StartedServer } from "../instance-shell-Tcp5hGoq.mjs";
5
+ import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-mtXpcJIv.mjs";
6
6
  import { H3 } from "h3";
7
7
  //#region src/adapters/dev.d.ts
8
8
  interface CreateDevServerOptions {
@@ -1,3 +1,3 @@
1
1
  import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-BM3PdYli.mjs";
2
- import { t as createDevServer } from "../dev-Czit5IP4.mjs";
2
+ import { t as createDevServer } from "../dev-CzkPCJwi.mjs";
3
3
  export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,4 +1,4 @@
1
- import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-BhBzOXVa.mjs";
1
+ import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-CLF4-8Pp.mjs";
2
2
  //#region src/adapters/embedded.d.ts
3
3
  interface CreateEmbeddedOptions {
4
4
  /** Target context the devframe is registered into. Required. */
@@ -1,7 +1,7 @@
1
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-Di2oqr4q.mjs";
2
- import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, bt as DevframeStorageScope, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta } from "../context-BhBzOXVa.mjs";
1
+ import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-VyHlanzy.mjs";
2
+ import { Ct as DevframeAuthHandler, F as DevframeDefinition, G as McpRouteOptions, U as DevframeSseOptions, W as DevframeWsOptions, bt as DevframeStorageScope, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta } from "../context-CLF4-8Pp.mjs";
3
3
  import { o as StaticAssetsSource } from "../remote-assets-B13_vRkJ.mjs";
4
- import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-Bh4l9Vz_.mjs";
4
+ import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-Tcp5hGoq.mjs";
5
5
  import { Buffer } from "node:buffer";
6
6
  import { IncomingMessage, Server, ServerResponse } from "node:http";
7
7
  import { Duplex } from "node:stream";
@@ -1,2 +1,2 @@
1
- import { n as getInstanceInternals, r as initDevframe } from "../dev-Czit5IP4.mjs";
1
+ import { n as getInstanceInternals, r as initDevframe } from "../dev-CzkPCJwi.mjs";
2
2
  export { getInstanceInternals, initDevframe };
@@ -1,4 +1,4 @@
1
- import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-BhBzOXVa.mjs";
1
+ import { F as DevframeDefinition, o as DevframeNodeContext } from "../context-CLF4-8Pp.mjs";
2
2
  import { H3 } from "h3";
3
3
  import "@modelcontextprotocol/server";
4
4
  //#region src/adapters/mcp/build-server.d.ts
@@ -1,6 +1,6 @@
1
1
  import { t as Diagnostic } from "../nostics-CzECRXpE.mjs";
2
2
  import { t as DEVFRAME_EVENTS } from "../events-4daw0uK9.mjs";
3
- import { i as isAllowedOrigin } from "../ws-server-BdSLrhxE.mjs";
3
+ import { i as isAllowedOrigin } from "../ws-server-Y_AumUQH.mjs";
4
4
  import { t as diagnostics } from "../diagnostics-BXWW3VK-.mjs";
5
5
  import { t as createHostContext } from "../context-omlma_1n.mjs";
6
6
  import { t as toAgentToolName } from "../agent-tool-name-EgfoFO8C.mjs";
@@ -1,6 +1,6 @@
1
1
  import { f as RpcCacheManager, p as RpcCacheOptions } from "../index-BzyopqxV.mjs";
2
2
  import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-CMdPYhOx.mjs";
3
- import { Q as DevframeServiceScopeOf, X as DevframeServiceMeta, _t as DevframeRpcServerFunctions, b as StreamSink, d as RpcSharedStateHost, dt as ScopedRpcFn, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, k as SharedState, mt as SettingsForNamespace, nt as DevframeServicesState, ot as DevframeSettings, pt as ScopedSharedStates, t as ConnectionMeta, u as RpcSharedStateGetOptions, y as StreamReader, zt as EventEmitter } from "../context-BhBzOXVa.mjs";
3
+ import { Q as DevframeServiceScopeOf, X as DevframeServiceMeta, _t as DevframeRpcServerFunctions, b as StreamSink, d as RpcSharedStateHost, dt as ScopedRpcFn, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, k as SharedState, mt as SettingsForNamespace, nt as DevframeServicesState, ot as DevframeSettings, pt as ScopedSharedStates, t as ConnectionMeta, u as RpcSharedStateGetOptions, y as StreamReader, zt as EventEmitter } from "../context-CLF4-8Pp.mjs";
4
4
  import { t as SseRpcChannelOptions } from "../sse-client-DwX021ST.mjs";
5
5
  import { t as WsRpcChannelOptions } from "../ws-client-7_lZi-B9.mjs";
6
6
  import { BirpcOptions, BirpcReturn } from "birpc";
@@ -2,7 +2,7 @@ import { t as DEVFRAME_EVENTS } from "../events-4daw0uK9.mjs";
2
2
  import { t as hash } from "../hash-DdPnc4k3.mjs";
3
3
  import { colors } from "../utils/colors.mjs";
4
4
  import { createEventEmitter } from "../utils/events.mjs";
5
- import { t as createSharedState } from "../shared-state-DoXutg_U.mjs";
5
+ import { t as createSharedState } from "../shared-state--sduc6Xi.mjs";
6
6
  import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CgtQ61SA.mjs";
7
7
  import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
8
8
  import { defineDiagnostics } from "nostics";
@@ -0,0 +1,16 @@
1
+ //#region src/client-assets.ts
2
+ /**
3
+ * Resolve a definition's client assets source — the built SPA served as its
4
+ * UI. Prefers the top-level {@link DevframeDefinition.clientAssets} and falls
5
+ * back to the deprecated `cli.distDir`, so both the new and legacy shapes
6
+ * resolve. Returns `undefined` when neither is set (bridge mode — the SPA is
7
+ * hosted elsewhere).
8
+ *
9
+ * Internal: exposed to first-party integrations via `devframe/internal`, not
10
+ * part of the stable public API.
11
+ */
12
+ function resolveClientAssets(d) {
13
+ return d.clientAssets ?? d.cli?.distDir;
14
+ }
15
+ //#endregion
16
+ export { resolveClientAssets as t };
@@ -1,6 +1,6 @@
1
1
  import { d as RpcFunctionsCollectorBase } from "./index-BzyopqxV.mjs";
2
2
  import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-CMdPYhOx.mjs";
3
- import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-Di2oqr4q.mjs";
3
+ import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-VyHlanzy.mjs";
4
4
  import { a as RemoteAssetsStore, o as StaticAssetsSource } from "./remote-assets-B13_vRkJ.mjs";
5
5
  import { m as defineDiagnostics } from "./nostics-SPGDgHEP.mjs";
6
6
  import { BirpcReturn } from "birpc";
@@ -1333,6 +1333,21 @@ interface DevframeDockDefaults {
1333
1333
  badge?: string;
1334
1334
  /** Id of the dock group this entry collapses under, if any. */
1335
1335
  groupId?: string;
1336
+ /**
1337
+ * A client script the hub imports into the host page (this devframe's **page
1338
+ * script**). An absolute-path `importFrom` is served by the hub under the
1339
+ * mount base and rewritten to that URL, so mounting by package name needs no
1340
+ * host wiring; a URL or bare specifier passes through untouched.
1341
+ */
1342
+ clientScript?: {
1343
+ /** An absolute filesystem path, a served URL, or a bare npm specifier. */
1344
+ importFrom: string;
1345
+ /**
1346
+ * The name to import the module as.
1347
+ * @default 'default'
1348
+ */
1349
+ importName?: string;
1350
+ };
1336
1351
  }
1337
1352
  /**
1338
1353
  * Runtime information threaded into `setup(ctx, info)`. Adapters
@@ -1,4 +1,4 @@
1
- import { k as SharedState, o as DevframeNodeContext } from "./context-BhBzOXVa.mjs";
1
+ import { k as SharedState, o as DevframeNodeContext } from "./context-CLF4-8Pp.mjs";
2
2
  //#region src/node/hub-internals/context.d.ts
3
3
  interface InternalAnonymousAuthStorage {
4
4
  trusted: Record<string, {
@@ -1,4 +1,4 @@
1
- import { resolveClientAssets } from "./index.mjs";
1
+ import { t as resolveClientAssets } from "./client-assets-C7SXgTWY.mjs";
2
2
  import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
3
3
  import { t as diagnostics } from "./diagnostics-BXWW3VK-.mjs";
4
4
  import { t as createHostContext } from "./context-omlma_1n.mjs";
@@ -1,5 +1,5 @@
1
1
  import { D as InferArgsType, E as Thenable, O as InferReturnType, T as RpcReturnSchema, i as RpcArgsSchema } from "../types-CMdPYhOx.mjs";
2
- import { k as SharedState, zt as EventEmitter } from "../context-BhBzOXVa.mjs";
2
+ import { k as SharedState, zt as EventEmitter } from "../context-CLF4-8Pp.mjs";
3
3
  import { BirpcReturn } from "birpc";
4
4
  //#region src/in-page-channel/types.d.ts
5
5
  /**
@@ -26,6 +26,12 @@ type PanelFunctions<P extends InPageChannelProtocol> = SideFunctions<NonNullable
26
26
  type SharedStates<P extends InPageChannelProtocol> = P['sharedStates'] extends Record<string, object> ? P['sharedStates'] : Record<string, never>;
27
27
  type FnArgs<F> = F extends ((...args: infer A) => any) ? A : never;
28
28
  type FnReturn<F> = F extends ((...args: any[]) => infer R) ? Awaited<R> : never;
29
+ /**
30
+ * Converts a protocol function to its accepted endpoint handler.
31
+ *
32
+ * @internal
33
+ */
34
+ type ProtocolHandler<F> = F extends ((...args: any[]) => any) ? (...args: FnArgs<F>) => Thenable<FnReturn<F>> : never;
29
35
  /**
30
36
  * Types of an in-page channel function — `RpcFunctionType` minus the
31
37
  * server-only `static`: `event` is fire-and-forget (the only type valid for
@@ -58,22 +64,49 @@ type InPageFunctionDefinition<NAME extends string, TYPE extends InPageFunctionTy
58
64
  jsonSerializable?: boolean;
59
65
  handler: (...args: InferArgsType<AS>) => Thenable<InferReturnType<RS>>;
60
66
  };
61
- /** Loosely-typed definition — the registration unit both endpoints accept. */
62
- type InPageFunctionDefinitionAny = InPageFunctionDefinition<string, any, any, any, any, any>;
67
+ /**
68
+ * Function metadata with its handler constrained by a protocol function.
69
+ *
70
+ * @internal
71
+ */
72
+ interface InPageFunctionOption<F> {
73
+ type?: InPageFunctionType;
74
+ /** Optional Standard Schema array validating the arguments. */
75
+ args?: RpcArgsSchema;
76
+ /** Optional Standard Schema validating the resolved return value. */
77
+ returns?: RpcReturnSchema;
78
+ jsonSerializable?: boolean;
79
+ handler: ProtocolHandler<F>;
80
+ }
81
+ /**
82
+ * Functions implemented by {@link createPageScriptChannel}.
83
+ *
84
+ * @internal
85
+ */
86
+ type CreatePageScriptChannelOptionsFunctions<P extends InPageChannelProtocol> = { [NAME in keyof PageScriptFunctions<P> & string]: InPageFunctionOption<PageScriptFunctions<P>[NAME]>; };
87
+ /**
88
+ * Functions implemented by {@link connectPanelChannel}.
89
+ *
90
+ * @internal
91
+ */
92
+ type ConnectPanelChannelOptionsFunctions<P extends InPageChannelProtocol> = { [NAME in keyof PanelFunctions<P> & string]: InPageFunctionOption<PanelFunctions<P>[NAME]>; };
63
93
  /**
64
94
  * Connection lifecycle of a panel endpoint: `connecting` (handshake retry
65
95
  * loop running, outgoing traffic buffered) → `connected` → back to
66
96
  * `connecting` on port loss, or `closed` after `close()` (permanent).
67
97
  */
68
98
  type InPageChannelStatus = 'connecting' | 'connected' | 'closed';
99
+ /**
100
+ * Options shared by both in-page channel endpoints.
101
+ *
102
+ * @internal
103
+ */
69
104
  interface InPageChannelCommonOptions {
70
105
  /**
71
106
  * Channel name, namespaced with the devframe id by convention
72
107
  * (e.g. `devframes:plugin:a11y`). Both endpoints must use the same name.
73
108
  */
74
109
  name: string;
75
- /** Implementations of this endpoint's side of the protocol. */
76
- functions?: readonly InPageFunctionDefinitionAny[];
77
110
  /**
78
111
  * Origins accepted during the handshake (and used as `targetOrigin` when
79
112
  * posting handshake messages). The in-page channel is same-origin by
@@ -106,7 +139,9 @@ interface InPageChannelCommonOptions {
106
139
  deserialize?: (value: unknown) => unknown;
107
140
  }
108
141
  /** Options for {@link createPageScriptChannel}. */
109
- interface CreatePageScriptChannelOptions extends InPageChannelCommonOptions {
142
+ interface CreatePageScriptChannelOptions<Protocol extends InPageChannelProtocol = InPageChannelProtocol> extends InPageChannelCommonOptions {
143
+ /** Implementations of the protocol's page-script functions. */
144
+ functions: CreatePageScriptChannelOptionsFunctions<Protocol>;
110
145
  /**
111
146
  * Window whose `message` events carry panel hellos. Defaults to the
112
147
  * global `window`; pass `false` to skip the handshake listener entirely
@@ -115,7 +150,9 @@ interface CreatePageScriptChannelOptions extends InPageChannelCommonOptions {
115
150
  window?: Window | false;
116
151
  }
117
152
  /** Options for {@link connectPanelChannel}. */
118
- interface ConnectPanelChannelOptions extends InPageChannelCommonOptions {
153
+ interface ConnectPanelChannelOptions<Protocol extends InPageChannelProtocol = InPageChannelProtocol> extends InPageChannelCommonOptions {
154
+ /** Implementations of the protocol's panel functions. */
155
+ functions: ConnectPanelChannelOptionsFunctions<Protocol>;
119
156
  /**
120
157
  * The panel's own window (listens for the handshake grant). Defaults to
121
158
  * the global `window`; pass `false` with `transport` to skip the handshake.
@@ -275,7 +312,7 @@ declare class InPageChannelError extends Error {
275
312
  * panels all handshake the same way, and a panel reload is simply a new
276
313
  * handshake. No server is involved at any point.
277
314
  */
278
- declare function createPageScriptChannel<P extends InPageChannelProtocol>(options: CreatePageScriptChannelOptions): PageScriptChannel<P>;
315
+ declare function createPageScriptChannel<P extends InPageChannelProtocol>(options: CreatePageScriptChannelOptions<P>): PageScriptChannel<P>;
279
316
  //#endregion
280
317
  //#region src/in-page-channel/panel.d.ts
281
318
  /**
@@ -290,7 +327,7 @@ declare function createPageScriptChannel<P extends InPageChannelProtocol>(option
290
327
  * (e.g. the panel opened standalone), the endpoint stays `connecting` and
291
328
  * the UI can key a fallback state off `status` / `whenConnected()`.
292
329
  */
293
- declare function connectPanelChannel<P extends InPageChannelProtocol>(options: ConnectPanelChannelOptions): PanelChannel<P>;
330
+ declare function connectPanelChannel<P extends InPageChannelProtocol>(options: ConnectPanelChannelOptions<P>): PanelChannel<P>;
294
331
  //#endregion
295
332
  //#region src/in-page-channel/index.d.ts
296
333
  /**
@@ -1,6 +1,6 @@
1
1
  import { t as DEVFRAME_EVENTS } from "../events-4daw0uK9.mjs";
2
2
  import { createEventEmitter } from "../utils/events.mjs";
3
- import { t as createSharedState } from "../shared-state-DoXutg_U.mjs";
3
+ import { t as createSharedState } from "../shared-state--sduc6Xi.mjs";
4
4
  import { nanoid } from "../utils/nanoid.mjs";
5
5
  import { createBirpc } from "birpc";
6
6
  //#region src/in-page-channel/protocol.ts
@@ -440,7 +440,10 @@ function createPageScriptChannel(options) {
440
440
  let closed = false;
441
441
  let heartbeatTimer;
442
442
  const registry = createLocalFunctionRegistry(codec);
443
- for (const definition of options.functions ?? []) registry.register(definition);
443
+ for (const [fnName, definition] of Object.entries(options.functions ?? {})) registry.register({
444
+ ...definition,
445
+ name: fnName
446
+ });
444
447
  const stateHost = createPageScriptStateHost(function* () {
445
448
  for (const peer of peers.values()) yield {
446
449
  subscribedStates: peer.subscribedStates,
@@ -603,7 +606,10 @@ function connectPanelChannel(options) {
603
606
  const canHandshake = !!win && targets.length > 0;
604
607
  const events = createEventEmitter();
605
608
  const registry = createLocalFunctionRegistry(codec);
606
- for (const definition of options.functions ?? []) registry.register(definition);
609
+ for (const [fnName, definition] of Object.entries(options.functions ?? {})) registry.register({
610
+ ...definition,
611
+ name: fnName
612
+ });
607
613
  let status = "connecting";
608
614
  let attached;
609
615
  let pageScriptInfo;
@@ -1,5 +1,5 @@
1
- import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-BhBzOXVa.mjs";
2
- import { n as InternalAnonymousAuthStorage } from "./context-HOnG-WvG.mjs";
1
+ import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-CLF4-8Pp.mjs";
2
+ import { n as InternalAnonymousAuthStorage } from "./context-DftYyXaR.mjs";
3
3
  //#region src/node/auth/revoke.d.ts
4
4
  /**
5
5
  * Flip `isTrusted` to false on any live WS clients connected with `token`
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./index-BzyopqxV.mjs";
2
2
  import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-CMdPYhOx.mjs";
3
- import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "./ws-server-Di2oqr4q.mjs";
4
- import { $ as DevframeServicesHost, At as AgentResource, B as DevframeSetupInfo, Bt as EventUnsubscribe, F as DevframeDefinition, Ft as AgentToolProvider, G as McpRouteOptions, H as DevframeSnapshotRpcInputs, I as DevframeDeploymentKind, It as AgentToolProviderHandle, J as DevframeServiceId, K as DevframeServiceDefinition, L as DevframeDockDefaults, Lt as DevframeAgentHost, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, P as DevframeCliOptions, Pt as AgentToolInput, Q as DevframeServiceScopeOf, R as DevframeDuplicationStrategy, Rt as DevframeAgentHostEvents, St as DevframeDiagnosticsLogger, U as DevframeSseOptions, V as DevframeSnapshotRpcEntry, Vt as EventsMap, W as DevframeWsOptions, X as DevframeServiceMeta, Y as DevframeServiceInput, Z as DevframeServiceOf, _t as DevframeRpcServerFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeScopedStreamingHost, bt as DevframeStorageScope, c as RpcBroadcastOptions, ct as DevframeSettingsStore, d as RpcSharedStateHost, dt as ScopedRpcFn, et as DevframeServicesRegistry, f as RpcStreamingChannel, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, ht as DevframeViewHost, i as DevframeCapabilities, it as DevframeScopedNodeRpc, jt as AgentResourceContent, kt as AgentManifest, l as RpcFunctionsHost, lt as ScopedBroadcastOptions, m as RpcStreamingHost, mt as SettingsForNamespace, n as ConnectionMetaSse, nt as DevframeServicesState, o as DevframeNodeContext, ot as DevframeSettings, p as RpcStreamingChannelOptions, pt as ScopedSharedStates, q as DevframeServiceDescriptor, r as ConnectionMetaWebsocket, rt as DevframeScopedNodeContext, s as DevframeNodeRpcSession, st as DevframeSettingsRegistry, t as ConnectionMeta, tt as DevframeServicesScopeRegistry, u as RpcSharedStateGetOptions, ut as ScopedClientFunctions, vt as DevframeRpcSharedStates, xt as DevframeDiagnosticsHost, yt as DevframeHost, z as DevframeRpcOptions, zt as EventEmitter } from "./context-BhBzOXVa.mjs";
3
+ import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "./ws-server-VyHlanzy.mjs";
4
+ import { $ as DevframeServicesHost, At as AgentResource, B as DevframeSetupInfo, Bt as EventUnsubscribe, F as DevframeDefinition, Ft as AgentToolProvider, G as McpRouteOptions, H as DevframeSnapshotRpcInputs, I as DevframeDeploymentKind, It as AgentToolProviderHandle, J as DevframeServiceId, K as DevframeServiceDefinition, L as DevframeDockDefaults, Lt as DevframeAgentHost, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, P as DevframeCliOptions, Pt as AgentToolInput, Q as DevframeServiceScopeOf, R as DevframeDuplicationStrategy, Rt as DevframeAgentHostEvents, St as DevframeDiagnosticsLogger, U as DevframeSseOptions, V as DevframeSnapshotRpcEntry, Vt as EventsMap, W as DevframeWsOptions, X as DevframeServiceMeta, Y as DevframeServiceInput, Z as DevframeServiceOf, _t as DevframeRpcServerFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeScopedStreamingHost, bt as DevframeStorageScope, c as RpcBroadcastOptions, ct as DevframeSettingsStore, d as RpcSharedStateHost, dt as ScopedRpcFn, et as DevframeServicesRegistry, f as RpcStreamingChannel, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, ht as DevframeViewHost, i as DevframeCapabilities, it as DevframeScopedNodeRpc, jt as AgentResourceContent, kt as AgentManifest, l as RpcFunctionsHost, lt as ScopedBroadcastOptions, m as RpcStreamingHost, mt as SettingsForNamespace, n as ConnectionMetaSse, nt as DevframeServicesState, o as DevframeNodeContext, ot as DevframeSettings, p as RpcStreamingChannelOptions, pt as ScopedSharedStates, q as DevframeServiceDescriptor, r as ConnectionMetaWebsocket, rt as DevframeScopedNodeContext, s as DevframeNodeRpcSession, st as DevframeSettingsRegistry, t as ConnectionMeta, tt as DevframeServicesScopeRegistry, u as RpcSharedStateGetOptions, ut as ScopedClientFunctions, vt as DevframeRpcSharedStates, xt as DevframeDiagnosticsHost, yt as DevframeHost, z as DevframeRpcOptions, zt as EventEmitter } from "./context-CLF4-8Pp.mjs";
5
5
  import { a as RemoteAssetsStore, i as RemoteAssetsProviderCustom, n as RemoteAssetsErrorMessage, o as StaticAssetsSource, r as RemoteAssetsProvider, t as RemoteAssets } from "./remote-assets-B13_vRkJ.mjs";
6
6
  import { i as DevframeDefineDiagnosticsOptions } from "./nostics-SPGDgHEP.mjs";
7
7
  //#region src/define.d.ts
@@ -12,11 +12,9 @@ declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionT
12
12
  */
13
13
  declare function defineDevframe(d: DevframeDefinition): DevframeDefinition;
14
14
  /**
15
- * Resolve a definition's client assets source — the built SPA served as its
16
- * UI. Prefers the top-level {@link DevframeDefinition.clientAssets} and falls
17
- * back to the deprecated {@link DevframeCliOptions.distDir}, so both the new
18
- * and legacy shapes resolve. Returns `undefined` when neither is set (bridge
19
- * mode — the SPA is hosted elsewhere).
15
+ * @deprecated Read {@link DevframeDefinition.clientAssets} from the definition
16
+ * directly. This helper is internal machinery that was never meant to be part
17
+ * of the public API and is scheduled for removal.
20
18
  */
21
19
  declare function resolveClientAssets(d: DevframeDefinition): StaticAssetsSource | undefined;
22
20
  //#endregion
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  import { t as createDefineWrapperWithContext } from "./define-BLWPsH6y.mjs";
2
+ import { t as resolveClientAssets$1 } from "./client-assets-C7SXgTWY.mjs";
2
3
  //#region src/define.ts
3
4
  const defineRpcFunction = createDefineWrapperWithContext();
4
5
  /**
@@ -9,14 +10,12 @@ function defineDevframe(d) {
9
10
  return d;
10
11
  }
11
12
  /**
12
- * Resolve a definition's client assets source — the built SPA served as its
13
- * UI. Prefers the top-level {@link DevframeDefinition.clientAssets} and falls
14
- * back to the deprecated {@link DevframeCliOptions.distDir}, so both the new
15
- * and legacy shapes resolve. Returns `undefined` when neither is set (bridge
16
- * mode — the SPA is hosted elsewhere).
13
+ * @deprecated Read {@link DevframeDefinition.clientAssets} from the definition
14
+ * directly. This helper is internal machinery that was never meant to be part
15
+ * of the public API and is scheduled for removal.
17
16
  */
18
17
  function resolveClientAssets(d) {
19
- return d.clientAssets ?? d.cli?.distDir;
18
+ return resolveClientAssets$1(d);
20
19
  }
21
20
  //#endregion
22
21
  export { defineDevframe, defineRpcFunction, resolveClientAssets };
@@ -1,6 +1,6 @@
1
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "./ws-server-Di2oqr4q.mjs";
2
- import { Ct as DevframeAuthHandler, U as DevframeSseOptions, W as DevframeWsOptions, _t as DevframeRpcServerFunctions, gt as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta } from "./context-BhBzOXVa.mjs";
3
- import "./index-DcKxIMoI.mjs";
1
+ import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "./ws-server-VyHlanzy.mjs";
2
+ import { Ct as DevframeAuthHandler, U as DevframeSseOptions, W as DevframeWsOptions, _t as DevframeRpcServerFunctions, gt as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta } from "./context-CLF4-8Pp.mjs";
3
+ import "./index-D3k0BIhe.mjs";
4
4
  import { BirpcGroup } from "birpc";
5
5
  import { NodeAdapter } from "crossws/adapters/node";
6
6
  import { Buffer } from "node:buffer";
@@ -1,9 +1,22 @@
1
1
  import { v as RpcFunctionDefinitionAny } from "../types-CMdPYhOx.mjs";
2
- import { At as AgentResource, Ft as AgentToolProvider, It as AgentToolProviderHandle, Lt as DevframeAgentHost$1, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, Pt as AgentToolInput, Rt as DevframeAgentHostEvents, jt as AgentResourceContent, kt as AgentManifest, o as DevframeNodeContext, yt as DevframeHost, zt as EventEmitter } from "../context-BhBzOXVa.mjs";
3
- import { a as RemoteAssetsStore } from "../remote-assets-B13_vRkJ.mjs";
4
- import { a as InstanceShellInit, c as StartedServer, d as samePath, f as DevframeInstanceRecord, h as registerDevframeInstance, i as InstanceShellApi, l as createInstanceShell, m as listLiveDevframeInstances, n as InstanceRegisterConfig, o as InstanceShellInternals, p as DevframeInstanceRegistration, r as InstanceShell, s as InstanceWsTier, t as CreateInstanceShellOptions, u as resolveInstanceRegister } from "../instance-shell-Bh4l9Vz_.mjs";
5
- import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-BJ6AmwTu.mjs";
6
- import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-BHUsDl7s.mjs";
2
+ import { At as AgentResource, F as DevframeDefinition, Ft as AgentToolProvider, It as AgentToolProviderHandle, Lt as DevframeAgentHost$1, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, Pt as AgentToolInput, Rt as DevframeAgentHostEvents, jt as AgentResourceContent, kt as AgentManifest, o as DevframeNodeContext, yt as DevframeHost, zt as EventEmitter } from "../context-CLF4-8Pp.mjs";
3
+ import { a as RemoteAssetsStore, o as StaticAssetsSource } from "../remote-assets-B13_vRkJ.mjs";
4
+ import { a as InstanceShellInit, c as StartedServer, d as samePath, f as DevframeInstanceRecord, h as registerDevframeInstance, i as InstanceShellApi, l as createInstanceShell, m as listLiveDevframeInstances, n as InstanceRegisterConfig, o as InstanceShellInternals, p as DevframeInstanceRegistration, r as InstanceShell, s as InstanceWsTier, t as CreateInstanceShellOptions, u as resolveInstanceRegister } from "../instance-shell-Tcp5hGoq.mjs";
5
+ import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-mtXpcJIv.mjs";
6
+ import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-B3W3z9ff.mjs";
7
+ //#region src/client-assets.d.ts
8
+ /**
9
+ * Resolve a definition's client assets source — the built SPA served as its
10
+ * UI. Prefers the top-level {@link DevframeDefinition.clientAssets} and falls
11
+ * back to the deprecated `cli.distDir`, so both the new and legacy shapes
12
+ * resolve. Returns `undefined` when neither is set (bridge mode — the SPA is
13
+ * hosted elsewhere).
14
+ *
15
+ * Internal: exposed to first-party integrations via `devframe/internal`, not
16
+ * part of the stable public API.
17
+ */
18
+ declare function resolveClientAssets(d: DevframeDefinition): StaticAssetsSource | undefined;
19
+ //#endregion
7
20
  //#region src/node/agent-args.d.ts
8
21
  /**
9
22
  * How {@link coerceAgentPositionalArgs} treats an args object that carries
@@ -446,4 +459,4 @@ declare function peekRpcWireFrame(raw: string): {
446
459
  i?: string;
447
460
  };
448
461
  //#endregion
449
- export { type AgentArgsFallback, type ContextRpcServer, type CreateContextRpcServerOptions, CreateH3DevframeHostOptions, type CreateInstanceShellOptions, DevframeAgentHost, type DevframeInstanceRecord, type DevframeInstanceRegistration, type InstanceRegisterConfig, type InstanceShell, type InstanceShellApi, type InstanceShellInit, type InstanceShellInternals, type InstanceWsTier, type RpcWireCodec, type StartedServer, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveInstanceRegister, samePath };
462
+ export { type AgentArgsFallback, type ContextRpcServer, type CreateContextRpcServerOptions, CreateH3DevframeHostOptions, type CreateInstanceShellOptions, DevframeAgentHost, type DevframeInstanceRecord, type DevframeInstanceRegistration, type InstanceRegisterConfig, type InstanceShell, type InstanceShellApi, type InstanceShellInit, type InstanceShellInternals, type InstanceWsTier, type RpcWireCodec, type StartedServer, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveClientAssets, resolveInstanceRegister, samePath };
@@ -1,3 +1,4 @@
1
+ import { t as resolveClientAssets } from "../client-assets-C7SXgTWY.mjs";
1
2
  import { n as peekRpcWireFrame, t as createRpcWireCodec } from "../wire-codec-0K-o5MYW.mjs";
2
3
  import { t as diagnostics } from "../diagnostics-BXWW3VK-.mjs";
3
4
  import { a as DevframeAgentHost, o as coerceAgentPositionalArgs } from "../services-install-CqqQVls5.mjs";
@@ -6,4 +7,4 @@ import { t as createH3DevframeHost } from "../host-h3-fRbF9yor.mjs";
6
7
  import { a as importRuntimeModule, i as normalizeHttpServerUrl, n as resolveInstanceRegister, r as samePath, t as createInstanceShell } from "../instance-shell-CpVW4zG0.mjs";
7
8
  import { i as registerDevframeInstance, n as listLiveDevframeInstances } from "../instance-registry-BjlMQbFB.mjs";
8
9
  import { t as createContextRpcServer } from "../rpc-core-DlHd276T.mjs";
9
- export { DevframeAgentHost, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveInstanceRegister, samePath };
10
+ export { DevframeAgentHost, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveClientAssets, resolveInstanceRegister, samePath };
@@ -1,3 +1,3 @@
1
- import { Ct as DevframeAuthHandler } from "../context-BhBzOXVa.mjs";
2
- import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-DcKxIMoI.mjs";
1
+ import { Ct as DevframeAuthHandler } from "../context-CLF4-8Pp.mjs";
2
+ import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-D3k0BIhe.mjs";
3
3
  export { DevframeAuthHandler, buildOtpAuthUrl, exchangeTempAuthCode, getTempAuthCode, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
@@ -1,3 +1,3 @@
1
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-HOnG-WvG.mjs";
2
- import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-BJ6AmwTu.mjs";
1
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-DftYyXaR.mjs";
2
+ import { n as normalizeBasePath, r as resolveBasePath } from "../_shared-mtXpcJIv.mjs";
3
3
  export { type DevframeInternalContext, type InternalAnonymousAuthStorage, type RemoteTokenRecord, getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,6 +1,6 @@
1
1
  import "../index-BzyopqxV.mjs";
2
2
  import { v as RpcFunctionDefinitionAny } from "../types-CMdPYhOx.mjs";
3
- import { k as SharedState, l as RpcFunctionsHost, o as DevframeNodeContext, yt as DevframeHost } from "../context-BhBzOXVa.mjs";
3
+ import { k as SharedState, l as RpcFunctionsHost, o as DevframeNodeContext, yt as DevframeHost } from "../context-CLF4-8Pp.mjs";
4
4
  import { BirpcGroup } from "birpc";
5
5
  //#region src/node/context.d.ts
6
6
  interface CreateHostContextOptions {
@@ -1,6 +1,6 @@
1
1
  import "../index-BzyopqxV.mjs";
2
2
  import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CMdPYhOx.mjs";
3
- import "../context-BhBzOXVa.mjs";
3
+ import "../context-CLF4-8Pp.mjs";
4
4
  import { SimpleSchema } from "../utils/simple-schema.mjs";
5
5
  //#region src/recipes/common-rpc-functions.d.ts
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { Ct as DevframeAuthHandler, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "../context-BhBzOXVa.mjs";
2
- import "../index-DcKxIMoI.mjs";
1
+ import { Ct as DevframeAuthHandler, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "../context-CLF4-8Pp.mjs";
2
+ import "../index-D3k0BIhe.mjs";
3
3
  //#region src/recipes/interactive-auth.d.ts
4
4
  interface CreateInteractiveAuthOptions {
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { v as RpcFunctionDefinitionAny } from "../../types-CMdPYhOx.mjs";
2
- import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../../ws-server-Di2oqr4q.mjs";
2
+ import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../../ws-server-VyHlanzy.mjs";
3
3
  import { BirpcGroup } from "birpc";
4
4
  //#region src/rpc/transports/sse-server.d.ts
5
5
  interface SseRpcTransportOptions {
@@ -1,6 +1,6 @@
1
1
  import { DEVFRAME_SSE_SESSION_HEADER } from "../../constants.mjs";
2
2
  import { n as peekRpcWireFrame, t as createRpcWireCodec } from "../../wire-codec-0K-o5MYW.mjs";
3
- import { i as isAllowedOrigin, o as createRpcSessionMeta } from "../../ws-server-BdSLrhxE.mjs";
3
+ import { i as isAllowedOrigin, o as createRpcSessionMeta } from "../../ws-server-Y_AumUQH.mjs";
4
4
  //#region src/rpc/transports/sse-server.ts
5
5
  const SSE_STREAM_HEADERS = {
6
6
  "content-type": "text/event-stream",
@@ -1,5 +1,5 @@
1
- import { n as WsOriginRegistry } from "../../ws-server-Di2oqr4q.mjs";
2
- import { t as ContextRpcServer } from "../../rpc-core-BHUsDl7s.mjs";
1
+ import { n as WsOriginRegistry } from "../../ws-server-VyHlanzy.mjs";
2
+ import { t as ContextRpcServer } from "../../rpc-core-B3W3z9ff.mjs";
3
3
  //#region src/rpc/transports/ws-bun.d.ts
4
4
  interface AttachBunWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
@@ -1,4 +1,4 @@
1
- import { i as isAllowedOrigin, r as createWsRpcPeerHooks } from "../../ws-server-BdSLrhxE.mjs";
1
+ import { i as isAllowedOrigin, r as createWsRpcPeerHooks } from "../../ws-server-Y_AumUQH.mjs";
2
2
  //#region src/rpc/transports/ws-bun.ts
3
3
  /**
4
4
  * The Bun fetch-upgrade WebSocket tier for `initDevframe` / `initHub` — the
@@ -1,5 +1,5 @@
1
- import { n as WsOriginRegistry } from "../../ws-server-Di2oqr4q.mjs";
2
- import { t as ContextRpcServer } from "../../rpc-core-BHUsDl7s.mjs";
1
+ import { n as WsOriginRegistry } from "../../ws-server-VyHlanzy.mjs";
2
+ import { t as ContextRpcServer } from "../../rpc-core-B3W3z9ff.mjs";
3
3
  //#region src/rpc/transports/ws-deno.d.ts
4
4
  interface AttachDenoWsTransportOptions {
5
5
  /** Same contract as `WsRpcTransportOptions.allowedOrigins`. */
@@ -1,4 +1,4 @@
1
- import { i as isAllowedOrigin, r as createWsRpcPeerHooks } from "../../ws-server-BdSLrhxE.mjs";
1
+ import { i as isAllowedOrigin, r as createWsRpcPeerHooks } from "../../ws-server-Y_AumUQH.mjs";
2
2
  //#region src/rpc/transports/ws-deno.ts
3
3
  /**
4
4
  * The Deno fetch-upgrade WebSocket tier for `initDevframe` / `initHub` — the
@@ -1,2 +1,2 @@
1
- import { a as attachWsRpcTransport, c as isAllowedOrigin, d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, i as WsRpcTransportOptions, l as isLoopbackHostname, n as WsOriginRegistry, o as createWsOriginRegistry, p as DevframeRpcTransportKind, r as WsRpcTransport, s as createWsRpcPeerHooks, t as CreateWsOriginRegistryOptions, u as DevframeNodeRpcSessionMeta } from "../../ws-server-Di2oqr4q.mjs";
1
+ import { a as attachWsRpcTransport, c as isAllowedOrigin, d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, i as WsRpcTransportOptions, l as isLoopbackHostname, n as WsOriginRegistry, o as createWsOriginRegistry, p as DevframeRpcTransportKind, r as WsRpcTransport, s as createWsRpcPeerHooks, t as CreateWsOriginRegistryOptions, u as DevframeNodeRpcSessionMeta } from "../../ws-server-VyHlanzy.mjs";
2
2
  export { CreateWsOriginRegistryOptions, type DevframeNodeRpcSessionMeta, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcTransportKind, WsOriginRegistry, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport, createWsOriginRegistry, createWsRpcPeerHooks, isAllowedOrigin, isLoopbackHostname };
@@ -1,2 +1,2 @@
1
- import { a as isLoopbackHostname, i as isAllowedOrigin, n as createWsOriginRegistry, r as createWsRpcPeerHooks, t as attachWsRpcTransport } from "../../ws-server-BdSLrhxE.mjs";
1
+ import { a as isLoopbackHostname, i as isAllowedOrigin, n as createWsOriginRegistry, r as createWsRpcPeerHooks, t as attachWsRpcTransport } from "../../ws-server-Y_AumUQH.mjs";
2
2
  export { attachWsRpcTransport, createWsOriginRegistry, createWsRpcPeerHooks, isAllowedOrigin, isLoopbackHostname };
@@ -1,6 +1,6 @@
1
- import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-Di2oqr4q.mjs";
2
- import { Ct as DevframeAuthHandler, _t as DevframeRpcServerFunctions, gt as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-BhBzOXVa.mjs";
3
- import "./index-DcKxIMoI.mjs";
1
+ import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-VyHlanzy.mjs";
2
+ import { Ct as DevframeAuthHandler, _t as DevframeRpcServerFunctions, gt as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-CLF4-8Pp.mjs";
3
+ import "./index-D3k0BIhe.mjs";
4
4
  import { BirpcGroup, EventOptions } from "birpc";
5
5
  //#region src/node/rpc-core.d.ts
6
6
  interface CreateContextRpcServerOptions {
@@ -1,6 +1,6 @@
1
1
  import { createEventEmitter } from "./utils/events.mjs";
2
2
  import { nanoid } from "./utils/nanoid.mjs";
3
- //#region ../../node_modules/.pnpm/immer@11.1.17/node_modules/immer/dist/immer.mjs
3
+ //#region ../../node_modules/.pnpm/immer@11.1.18/node_modules/immer/dist/immer.mjs
4
4
  var NOTHING = Symbol.for("immer-nothing");
5
5
  var DRAFTABLE = Symbol.for("immer-draftable");
6
6
  var DRAFT_STATE = Symbol.for("immer-state");
@@ -891,6 +891,7 @@ function enablePatches() {
891
891
  getPath
892
892
  });
893
893
  }
894
+ globalThis.Iterator?.from;
894
895
  var immer = new Immer2();
895
896
  var produce = immer.produce;
896
897
  var produceWithPatches = /* @__PURE__ */ immer.produceWithPatches.bind(immer);
@@ -1,6 +1,6 @@
1
1
  import { g as RpcFunctionAgentOptions } from "../types-CMdPYhOx.mjs";
2
- import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "../ws-server-Di2oqr4q.mjs";
3
- import { $ as DevframeServicesHost, At as AgentResource, B as DevframeSetupInfo, Bt as EventUnsubscribe, F as DevframeDefinition, Ft as AgentToolProvider, G as McpRouteOptions, H as DevframeSnapshotRpcInputs, I as DevframeDeploymentKind, It as AgentToolProviderHandle, J as DevframeServiceId, K as DevframeServiceDefinition, L as DevframeDockDefaults, Lt as DevframeAgentHost, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, P as DevframeCliOptions, Pt as AgentToolInput, Q as DevframeServiceScopeOf, R as DevframeDuplicationStrategy, Rt as DevframeAgentHostEvents, St as DevframeDiagnosticsLogger, U as DevframeSseOptions, V as DevframeSnapshotRpcEntry, Vt as EventsMap, W as DevframeWsOptions, X as DevframeServiceMeta, Y as DevframeServiceInput, Z as DevframeServiceOf, _t as DevframeRpcServerFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeScopedStreamingHost, bt as DevframeStorageScope, c as RpcBroadcastOptions, ct as DevframeSettingsStore, d as RpcSharedStateHost, dt as ScopedRpcFn, et as DevframeServicesRegistry, f as RpcStreamingChannel, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, ht as DevframeViewHost, i as DevframeCapabilities, it as DevframeScopedNodeRpc, jt as AgentResourceContent, kt as AgentManifest, l as RpcFunctionsHost, lt as ScopedBroadcastOptions, m as RpcStreamingHost, mt as SettingsForNamespace, n as ConnectionMetaSse, nt as DevframeServicesState, o as DevframeNodeContext, ot as DevframeSettings, p as RpcStreamingChannelOptions, pt as ScopedSharedStates, q as DevframeServiceDescriptor, r as ConnectionMetaWebsocket, rt as DevframeScopedNodeContext, s as DevframeNodeRpcSession, st as DevframeSettingsRegistry, t as ConnectionMeta, tt as DevframeServicesScopeRegistry, u as RpcSharedStateGetOptions, ut as ScopedClientFunctions, vt as DevframeRpcSharedStates, xt as DevframeDiagnosticsHost, yt as DevframeHost, z as DevframeRpcOptions, zt as EventEmitter } from "../context-BhBzOXVa.mjs";
2
+ import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "../ws-server-VyHlanzy.mjs";
3
+ import { $ as DevframeServicesHost, At as AgentResource, B as DevframeSetupInfo, Bt as EventUnsubscribe, F as DevframeDefinition, Ft as AgentToolProvider, G as McpRouteOptions, H as DevframeSnapshotRpcInputs, I as DevframeDeploymentKind, It as AgentToolProviderHandle, J as DevframeServiceId, K as DevframeServiceDefinition, L as DevframeDockDefaults, Lt as DevframeAgentHost, Mt as AgentResourceInput, Nt as AgentTool, Ot as AgentHandle, P as DevframeCliOptions, Pt as AgentToolInput, Q as DevframeServiceScopeOf, R as DevframeDuplicationStrategy, Rt as DevframeAgentHostEvents, St as DevframeDiagnosticsLogger, U as DevframeSseOptions, V as DevframeSnapshotRpcEntry, Vt as EventsMap, W as DevframeWsOptions, X as DevframeServiceMeta, Y as DevframeServiceInput, Z as DevframeServiceOf, _t as DevframeRpcServerFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeScopedStreamingHost, bt as DevframeStorageScope, c as RpcBroadcastOptions, ct as DevframeSettingsStore, d as RpcSharedStateHost, dt as ScopedRpcFn, et as DevframeServicesRegistry, f as RpcStreamingChannel, ft as ScopedServerFunctions, gt as DevframeRpcClientFunctions, ht as DevframeViewHost, i as DevframeCapabilities, it as DevframeScopedNodeRpc, jt as AgentResourceContent, kt as AgentManifest, l as RpcFunctionsHost, lt as ScopedBroadcastOptions, m as RpcStreamingHost, mt as SettingsForNamespace, n as ConnectionMetaSse, nt as DevframeServicesState, o as DevframeNodeContext, ot as DevframeSettings, p as RpcStreamingChannelOptions, pt as ScopedSharedStates, q as DevframeServiceDescriptor, r as ConnectionMetaWebsocket, rt as DevframeScopedNodeContext, s as DevframeNodeRpcSession, st as DevframeSettingsRegistry, t as ConnectionMeta, tt as DevframeServicesScopeRegistry, u as RpcSharedStateGetOptions, ut as ScopedClientFunctions, vt as DevframeRpcSharedStates, xt as DevframeDiagnosticsHost, yt as DevframeHost, z as DevframeRpcOptions, zt as EventEmitter } from "../context-CLF4-8Pp.mjs";
4
4
  import { a as RemoteAssetsStore, i as RemoteAssetsProviderCustom, n as RemoteAssetsErrorMessage, o as StaticAssetsSource, r as RemoteAssetsProvider, t as RemoteAssets } from "../remote-assets-B13_vRkJ.mjs";
5
5
  import { i as DevframeDefineDiagnosticsOptions } from "../nostics-SPGDgHEP.mjs";
6
6
  export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, AgentToolProvider, AgentToolProviderHandle, ConnectionMeta, ConnectionMetaSse, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeCapabilities, DevframeCliOptions, DevframeConnectionConfigsRegistry, type DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, DevframeRpcOptions, DevframeRpcServerFunctions, DevframeRpcSharedStates, type DevframeRpcTransportKind, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceDefinition, DevframeServiceDescriptor, DevframeServiceId, DevframeServiceInput, DevframeServiceMeta, DevframeServiceOf, DevframeServiceScopeOf, DevframeServicesHost, DevframeServicesRegistry, DevframeServicesScopeRegistry, DevframeServicesState, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSnapshotRpcEntry, DevframeSnapshotRpcInputs, DevframeSseOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, RemoteAssets, RemoteAssetsErrorMessage, RemoteAssetsProvider, RemoteAssetsProviderCustom, RemoteAssetsStore, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, StaticAssetsSource };
@@ -1,4 +1,4 @@
1
- import { Vt as EventsMap, zt as EventEmitter } from "../context-BhBzOXVa.mjs";
1
+ import { Vt as EventsMap, zt as EventEmitter } from "../context-CLF4-8Pp.mjs";
2
2
  //#region src/utils/events.d.ts
3
3
  /**
4
4
  * Create event emitter.
@@ -1,2 +1,2 @@
1
- import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-BhBzOXVa.mjs";
1
+ import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-CLF4-8Pp.mjs";
2
2
  export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
@@ -1,2 +1,2 @@
1
- import { t as createSharedState } from "../shared-state-DoXutg_U.mjs";
1
+ import { t as createSharedState } from "../shared-state--sduc6Xi.mjs";
2
2
  export { createSharedState };
@@ -1,2 +1,2 @@
1
- import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-BhBzOXVa.mjs";
1
+ import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-CLF4-8Pp.mjs";
2
2
  export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
@@ -195,6 +195,21 @@ interface WsRpcTransport {
195
195
  */
196
196
  close: () => Promise<void>;
197
197
  }
198
+ /**
199
+ * Whether `hostname` names a loopback host: `localhost` (or any `*.localhost`
200
+ * subdomain), the IPv6 loopback `::1`, or an IPv4 literal inside the
201
+ * `127.0.0.0/8` loopback block.
202
+ *
203
+ * The IPv4 case is matched **structurally** — the whole hostname must be a
204
+ * canonical dotted-decimal IPv4 literal whose first octet is `127`. A bare
205
+ * `startsWith('127.')` prefix check would also accept an attacker-controlled
206
+ * DNS name that merely *begins* with `127.` (`127.attacker.example`,
207
+ * `127.0.0.1.attacker.example`), letting a cross-origin browser page defeat
208
+ * the loopback origin gate that guards the RPC/MCP surface (a DNS-rebinding /
209
+ * cross-site WebSocket-hijacking bypass). Requiring a real IPv4 literal keeps
210
+ * genuine loopback addresses (`127.0.0.1`, `127.5.5.5`) allowed while rejecting
211
+ * those DNS names.
212
+ */
198
213
  declare function isLoopbackHostname(hostname: string): boolean;
199
214
  /**
200
215
  * Default origin policy for a localhost dev tool: allow requests with no
@@ -83,9 +83,36 @@ function pathMatches(a, b) {
83
83
  const strip = (p) => p.length > 1 && p.endsWith("/") ? p.slice(0, -1) : p;
84
84
  return strip(a) === strip(b);
85
85
  }
86
+ /**
87
+ * Whether `hostname` names a loopback host: `localhost` (or any `*.localhost`
88
+ * subdomain), the IPv6 loopback `::1`, or an IPv4 literal inside the
89
+ * `127.0.0.0/8` loopback block.
90
+ *
91
+ * The IPv4 case is matched **structurally** — the whole hostname must be a
92
+ * canonical dotted-decimal IPv4 literal whose first octet is `127`. A bare
93
+ * `startsWith('127.')` prefix check would also accept an attacker-controlled
94
+ * DNS name that merely *begins* with `127.` (`127.attacker.example`,
95
+ * `127.0.0.1.attacker.example`), letting a cross-origin browser page defeat
96
+ * the loopback origin gate that guards the RPC/MCP surface (a DNS-rebinding /
97
+ * cross-site WebSocket-hijacking bypass). Requiring a real IPv4 literal keeps
98
+ * genuine loopback addresses (`127.0.0.1`, `127.5.5.5`) allowed while rejecting
99
+ * those DNS names.
100
+ */
86
101
  function isLoopbackHostname(hostname) {
87
102
  const h = hostname.replace(/^\[|\]$/g, "");
88
- return h === "localhost" || h === "127.0.0.1" || h === "::1" || h.endsWith(".localhost") || h.startsWith("127.");
103
+ if (h === "localhost" || h.endsWith(".localhost") || h === "::1") return true;
104
+ return isLoopbackIPv4(h);
105
+ }
106
+ /** A canonical dotted-decimal IPv4 literal in `127.0.0.0/8`. */
107
+ function isLoopbackIPv4(hostname) {
108
+ const octets = hostname.split(".");
109
+ if (octets.length !== 4 || !octets.every(isDecimalOctet)) return false;
110
+ return Number(octets[0]) === 127;
111
+ }
112
+ /** A single canonical IPv4 octet: 1–3 digits, no leading zero, value 0–255. */
113
+ function isDecimalOctet(part) {
114
+ if (!/^\d{1,3}$/.test(part) || part.length > 1 && part[0] === "0") return false;
115
+ return Number(part) <= 255;
89
116
  }
90
117
  /**
91
118
  * Default origin policy for a localhost dev tool: allow requests with no
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "0.9.7",
4
+ "version": "0.9.8",
5
5
  "description": "Framework for building one portable devtool integration that runs in any viewer.",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -92,9 +92,9 @@
92
92
  },
93
93
  "dependencies": {
94
94
  "@standard-schema/spec": "^1.1.0",
95
- "birpc": "^4.1.0",
96
- "crossws": "^0.4.10",
97
- "h3": "^2.0.1-rc.26",
95
+ "birpc": "^4.2.0",
96
+ "crossws": "^0.4.12",
97
+ "h3": "^2.0.1-rc.29",
98
98
  "mrmime": "^2.0.1",
99
99
  "nostics": "^1.2.0",
100
100
  "pathe": "^2.0.3",
@@ -105,7 +105,7 @@
105
105
  "@modelcontextprotocol/server": "^2.0.0",
106
106
  "cac": "^7.0.0",
107
107
  "get-port-please": "^3.2.0",
108
- "immer": "^11.1.17",
108
+ "immer": "^11.1.18",
109
109
  "launch-editor": "^2.14.1",
110
110
  "mlly": "^1.8.2",
111
111
  "obug": "^2.1.4",