devframe 0.9.0-beta.8 → 0.9.0

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 (77) hide show
  1. package/dist/{_shared-QkI6ljJS.d.mts → _shared-BPmX9fqK.d.mts} +1 -1
  2. package/dist/_shared-CbZ_yhbz.mjs +68 -0
  3. package/dist/adapters/build.d.mts +2 -2
  4. package/dist/adapters/build.mjs +6 -6
  5. package/dist/adapters/cac.d.mts +1 -1
  6. package/dist/adapters/cac.mjs +3 -3
  7. package/dist/adapters/dev.d.mts +4 -4
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +3 -3
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +1 -1
  13. package/dist/adapters/mcp.mjs +1 -1
  14. package/dist/cli/main.mjs +3 -3
  15. package/dist/client/index.d.mts +1 -1
  16. package/dist/client/index.mjs +22 -4
  17. package/dist/constants.d.mts +10 -1
  18. package/dist/constants.mjs +10 -1
  19. package/dist/{context-CQkRTbAc.d.mts → context-B3YUu_95.d.mts} +1 -1
  20. package/dist/{context-D0HD0F7C.mjs → context-CEe4PBz1.mjs} +7 -300
  21. package/dist/{context-D0jErmlx.mjs → context-xdynGSLP.mjs} +1 -1
  22. package/dist/{dev-QEuT8SOF.mjs → dev--rAPzbvO.mjs} +6 -6
  23. package/dist/{devframe-Cfx6doi4.d.mts → devframe-DJMg0WLe.d.mts} +7 -16
  24. package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
  25. package/dist/{diagnostics-DEuH3P5O.mjs → diagnostics-DOQPnQmX.mjs} +1 -3
  26. package/dist/{_shared-CKZPvSrN.mjs → dist-eNI9qM_I.mjs} +1 -67
  27. package/dist/{host-agent-C5HjzfBz.mjs → host-agent-xLCSe65D.mjs} +1 -1
  28. package/dist/{http-CVwj7b4g.mjs → http-DYpK0cUi.mjs} +4 -4
  29. package/dist/{index-MYi1SZVL.d.mts → index-CB-fSUyn.d.mts} +2 -2
  30. package/dist/index.d.mts +4 -3
  31. package/dist/{instance-registry-M2p-z6xE.mjs → instance-registry-WvQkt42E.mjs} +1 -1
  32. package/dist/{instance-shell-DJ8s-MFw.mjs → instance-shell-CMFyszWJ.mjs} +5 -5
  33. package/dist/{instance-shell-D_UA0Idz.d.mts → instance-shell-CljiKq1c.d.mts} +2 -2
  34. package/dist/internal/index.d.mts +8 -16
  35. package/dist/internal/index.mjs +7 -7
  36. package/dist/node/auth.d.mts +2 -2
  37. package/dist/node/hub-internals.d.mts +2 -2
  38. package/dist/node/hub-internals.mjs +2 -2
  39. package/dist/node/index.d.mts +1 -1
  40. package/dist/node/index.mjs +2 -2
  41. package/dist/nostics-CzECRXpE.mjs +59 -0
  42. package/dist/nostics-SPGDgHEP.d.mts +33 -0
  43. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  44. package/dist/recipes/interactive-auth.d.mts +2 -2
  45. package/dist/recipes/interactive-auth.mjs +2 -2
  46. package/dist/{remote-assets-DclsYyoL.d.mts → remote-assets-Bg4gCUZ_.d.mts} +19 -2
  47. package/dist/remote-assets-nTTxY2MU.mjs +636 -0
  48. package/dist/rpc/dump.mjs +1 -1
  49. package/dist/rpc/index.mjs +3 -3
  50. package/dist/rpc/transports/sse-client.mjs +1 -1
  51. package/dist/rpc/transports/sse-server.mjs +2 -2
  52. package/dist/rpc/transports/ws-bun.d.mts +1 -1
  53. package/dist/rpc/transports/ws-bun.mjs +1 -1
  54. package/dist/rpc/transports/ws-client.mjs +1 -1
  55. package/dist/rpc/transports/ws-server.mjs +1 -1
  56. package/dist/{rpc-core-C8JQ3p7A.d.mts → rpc-core-Cc4lucI0.d.mts} +2 -2
  57. package/dist/{rpc-core-IhcWl_xn.mjs → rpc-core-DMTe-hLo.mjs} +1 -1
  58. package/dist/{serialization-BHY8M5NQ.mjs → serialization-BGzEwAdr.mjs} +1 -1
  59. package/dist/{static-CvjkO8QE.mjs → static-BPZ1_OPA.mjs} +2 -2
  60. package/dist/{storage-BVuipbGS.mjs → storage-CYye7P7L.mjs} +1 -1
  61. package/dist/types/index.d.mts +4 -3
  62. package/dist/utils/events.d.mts +1 -1
  63. package/dist/utils/get-port.d.mts +17 -0
  64. package/dist/utils/get-port.mjs +2 -0
  65. package/dist/utils/nostics.d.mts +2 -0
  66. package/dist/utils/nostics.mjs +2 -0
  67. package/dist/utils/remote-assets.d.mts +1 -1
  68. package/dist/utils/remote-assets.mjs +1 -308
  69. package/dist/utils/serve-static.d.mts +1 -1
  70. package/dist/utils/serve-static.mjs +16 -0
  71. package/dist/utils/shared-state.d.mts +1 -1
  72. package/dist/utils/streaming-channel.d.mts +1 -1
  73. package/dist/{validation-BiuDXTKW.mjs → validation-CpXFB6Dz.mjs} +1 -1
  74. package/dist/{wire-codec-9VhIKnyp.mjs → wire-codec-0K-o5MYW.mjs} +1 -3
  75. package/dist/{ws-server-Bk1hOG3X.mjs → ws-server-BdSLrhxE.mjs} +1 -1
  76. package/package.json +3 -1
  77. package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
@@ -1,4 +1,4 @@
1
- import { d as ConnectionMeta, l as McpRouteOptions, n as DevframeDefinition, r as DevframeDeploymentKind } from "./devframe-Cfx6doi4.mjs";
1
+ import { d as ConnectionMeta, l as McpRouteOptions, n as DevframeDefinition, r as DevframeDeploymentKind } from "./devframe-DJMg0WLe.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
@@ -0,0 +1,68 @@
1
+ import "./constants.mjs";
2
+ import { n as getPort } from "./dist-eNI9qM_I.mjs";
3
+ import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash, withoutLeadingSlash } from "ufo";
4
+ //#region src/adapters/_shared.ts
5
+ const DEFAULT_PORT = 9999;
6
+ /**
7
+ * Resolve the mount base path for a devframe's SPA. Hosted adapters
8
+ * (`vite`, `embedded`) default to `/__<id>/` so they don't collide
9
+ * with the host app; standalone adapters (`cli`, `build`)
10
+ * default to `/` because they own the origin.
11
+ *
12
+ * The devframe author can override with `basePath` on the definition.
13
+ */
14
+ function resolveBasePath(def, kind) {
15
+ if (def.basePath) return normalizeBasePath(def.basePath);
16
+ return kind === "standalone" ? "/" : `/__${def.id}/`;
17
+ }
18
+ function normalizeBasePath(base) {
19
+ return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
20
+ }
21
+ /**
22
+ * Resolve the listening port for `createDevServer` (and `createHandler`'s
23
+ * side-car tiers), honoring the definition's `cli.port` / `cli.portRange` /
24
+ * `cli.random` settings. Exposed separately so authors who run their own
25
+ * argv parsing can resolve a port up-front (to print it, log it, etc.)
26
+ * before starting the server.
27
+ */
28
+ async function resolveDevServerPort(def, options = {}) {
29
+ const host = options.host ?? def.cli?.host ?? "localhost";
30
+ const portOptions = {
31
+ port: options.defaultPort ?? def.cli?.port ?? DEFAULT_PORT,
32
+ host
33
+ };
34
+ if (def.cli?.portRange) portOptions.portRange = def.cli.portRange;
35
+ if (def.cli?.random) portOptions.random = def.cli.random;
36
+ return getPort(portOptions);
37
+ }
38
+ /**
39
+ * Normalize the `cli.mcp` / `mcp` option (`boolean | McpRouteOptions`) into
40
+ * concrete options, or `undefined` when the MCP route is disabled.
41
+ */
42
+ function resolveMcpConfig(mcp) {
43
+ if (!mcp) return void 0;
44
+ return mcp === true ? {} : mcp;
45
+ }
46
+ /**
47
+ * Resolve the `mcp` entry a `__connection.json` should advertise for a dev
48
+ * server started with the given `mcp` option (falling back to `def.cli?.mcp`,
49
+ * exactly like `createDevServer`), or `undefined` when the route is
50
+ * disabled.
51
+ *
52
+ * Hosted bridges that hand-roll their connection meta pass the side-car
53
+ * `port`: the advertised path becomes absolute (the side-car mounts at `/`)
54
+ * and the client dials `<page-host>:<port><path>`. Without `port` the path
55
+ * stays relative, resolved against `__connection.json`'s own location (the
56
+ * same-server default).
57
+ */
58
+ function resolveMcpConnectionMeta(def, mcp, port) {
59
+ const config = resolveMcpConfig(mcp ?? def.cli?.mcp);
60
+ if (!config) return void 0;
61
+ const route = withoutLeadingSlash(config.path ?? "__mcp");
62
+ return port != null ? {
63
+ path: withLeadingSlash(route),
64
+ port
65
+ } : { path: route };
66
+ }
67
+ //#endregion
68
+ export { resolveMcpConnectionMeta as i, resolveBasePath as n, resolveDevServerPort as r, normalizeBasePath as t };
@@ -1,5 +1,5 @@
1
- import { n as DevframeDefinition } from "../devframe-Cfx6doi4.mjs";
2
- import { a as StaticAssetsSource } from "../remote-assets-DclsYyoL.mjs";
1
+ import { n as DevframeDefinition } from "../devframe-DJMg0WLe.mjs";
2
+ import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
3
3
  //#region src/adapters/build.d.ts
4
4
  interface CreateBuildOptions {
5
5
  /** Output directory. Defaults to `dist-static`. */
@@ -1,11 +1,11 @@
1
- import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
2
- import { n as strictJsonStringify } from "../serialization-BHY8M5NQ.mjs";
1
+ import { s as colors } from "../nostics-CzECRXpE.mjs";
2
+ import { n as strictJsonStringify } from "../serialization-BGzEwAdr.mjs";
3
3
  import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
4
- import { t as collectStaticRpcDump } from "../static-CvjkO8QE.mjs";
4
+ import { t as collectStaticRpcDump } from "../static-BPZ1_OPA.mjs";
5
5
  import { n as structuredCloneStringify } from "../structured-clone-CbAV5rFI.mjs";
6
- import { t as diagnostics } from "../diagnostics-DEuH3P5O.mjs";
7
- import { t as createHostContext } from "../context-D0HD0F7C.mjs";
8
- import { resolveStaticAssetsSource } from "../utils/remote-assets.mjs";
6
+ import { t as diagnostics } from "../diagnostics-DOQPnQmX.mjs";
7
+ import { t as createHostContext } from "../context-CEe4PBz1.mjs";
8
+ import { t as resolveStaticAssetsSource } from "../remote-assets-nTTxY2MU.mjs";
9
9
  import { t as createH3DevframeHost } from "../host-h3-Crkzm42q.mjs";
10
10
  import { existsSync } from "node:fs";
11
11
  import fs$1 from "node:fs/promises";
@@ -1,4 +1,4 @@
1
- import { At as InferCliFlags, Mt as parseCliFlags, jt as defineCliFlags, kt as CliFlagsSchema, n as DevframeDefinition } from "../devframe-Cfx6doi4.mjs";
1
+ import { At as defineCliFlags, Ot as CliFlagsSchema, jt as parseCliFlags, kt as InferCliFlags, n as DevframeDefinition } from "../devframe-DJMg0WLe.mjs";
2
2
  import { CAC } from "cac";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/cac.d.ts
@@ -1,7 +1,7 @@
1
- import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
2
- import { r as resolveDevServerPort } from "../_shared-CKZPvSrN.mjs";
1
+ import { s as colors } from "../nostics-CzECRXpE.mjs";
2
+ import { r as resolveDevServerPort } from "../_shared-CbZ_yhbz.mjs";
3
3
  import { createBuild } from "./build.mjs";
4
- import { t as createDevServer } from "../dev-QEuT8SOF.mjs";
4
+ import { t as createDevServer } from "../dev--rAPzbvO.mjs";
5
5
  import process from "node:process";
6
6
  import cac$1 from "cac";
7
7
  //#region src/adapters/flags.ts
@@ -1,8 +1,8 @@
1
- import { c as DevframeWsOptions, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler, z as DevframeNodeRpcSession } from "../devframe-Cfx6doi4.mjs";
1
+ import { R as DevframeNodeRpcSession, c as DevframeWsOptions, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler } from "../devframe-DJMg0WLe.mjs";
2
2
  import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-D1d3QM9f.mjs";
3
- import { a as StaticAssetsSource } from "../remote-assets-DclsYyoL.mjs";
4
- import { c as StartedServer } from "../instance-shell-D_UA0Idz.mjs";
5
- import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-QkI6ljJS.mjs";
3
+ import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
4
+ import { c as StartedServer } from "../instance-shell-CljiKq1c.mjs";
5
+ import { a as resolveMcpConnectionMeta, i as resolveDevServerPort, t as ResolveDevServerPortOptions } from "../_shared-BPmX9fqK.mjs";
6
6
  import { H3 } from "h3";
7
7
  //#region src/adapters/dev.d.ts
8
8
  interface CreateDevServerOptions {
@@ -1,3 +1,3 @@
1
- import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-CKZPvSrN.mjs";
2
- import { t as createDevServer } from "../dev-QEuT8SOF.mjs";
1
+ import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-CbZ_yhbz.mjs";
2
+ import { t as createDevServer } from "../dev--rAPzbvO.mjs";
3
3
  export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,4 +1,4 @@
1
- import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-Cfx6doi4.mjs";
1
+ import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-DJMg0WLe.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 { F as DevframeStorageScope, c as DevframeWsOptions, d as ConnectionMeta, g as DevframeNodeContext, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler, z as DevframeNodeRpcSession } from "../devframe-Cfx6doi4.mjs";
1
+ import { F as DevframeStorageScope, R as DevframeNodeRpcSession, c as DevframeWsOptions, d as ConnectionMeta, g as DevframeNodeContext, l as McpRouteOptions, n as DevframeDefinition, s as DevframeSseOptions, u as DevframeAuthHandler } from "../devframe-DJMg0WLe.mjs";
2
2
  import { d as DevframeRpcConnection, n as WsOriginRegistry, u as DevframeNodeRpcSessionMeta } from "../ws-server-D1d3QM9f.mjs";
3
- import { a as StaticAssetsSource } from "../remote-assets-DclsYyoL.mjs";
4
- import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-D_UA0Idz.mjs";
3
+ import { o as StaticAssetsSource } from "../remote-assets-Bg4gCUZ_.mjs";
4
+ import { c as StartedServer, f as DevframeInstanceRecord } from "../instance-shell-CljiKq1c.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-QEuT8SOF.mjs";
1
+ import { n as getInstanceInternals, r as initDevframe } from "../dev--rAPzbvO.mjs";
2
2
  export { getInstanceInternals, initDevframe };
@@ -1,4 +1,4 @@
1
- import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-Cfx6doi4.mjs";
1
+ import { g as DevframeNodeContext, n as DevframeDefinition } from "../devframe-DJMg0WLe.mjs";
2
2
  import { H3 } from "h3";
3
3
  import "@modelcontextprotocol/server";
4
4
  //#region src/adapters/mcp/build-server.d.ts
@@ -1,2 +1,2 @@
1
- import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-CVwj7b4g.mjs";
1
+ import { i as createMcpServer, n as mountMcpHttp, r as createMcpFetchHandler } from "../http-DYpK0cUi.mjs";
2
2
  export { createMcpFetchHandler, createMcpServer, mountMcpHttp };
package/dist/cli/main.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import { t as diagnostics } from "../diagnostics-DEuH3P5O.mjs";
2
- import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-M2p-z6xE.mjs";
1
+ import { t as Diagnostic } from "../nostics-CzECRXpE.mjs";
2
+ import { t as diagnostics } from "../diagnostics-DOQPnQmX.mjs";
3
+ import { n as listLiveDevframeInstances, r as probeDevframeOrigin } from "../instance-registry-WvQkt42E.mjs";
3
4
  import { t as toAgentToolName } from "../agent-tool-name-EgfoFO8C.mjs";
4
- import { Diagnostic } from "nostics";
5
5
  import process from "node:process";
6
6
  import { joinURL } from "ufo";
7
7
  import { cac } from "cac";
@@ -1,4 +1,4 @@
1
- import { A as ScopedServerFunctions, Et as EventEmitter, H as RpcSharedStateGetOptions, J as DevframeRpcServerFunctions, M as SettingsForNamespace, U as RpcSharedStateHost, d as ConnectionMeta, et as StreamReader, j as ScopedSharedStates, k as ScopedRpcFn, q as DevframeRpcClientFunctions, tt as StreamSink, ut as SharedState, w as DevframeSettings } from "../devframe-Cfx6doi4.mjs";
1
+ import { $ as StreamReader, A as ScopedServerFunctions, H as RpcSharedStateHost, K as DevframeRpcClientFunctions, M as SettingsForNamespace, Tt as EventEmitter, V as RpcSharedStateGetOptions, d as ConnectionMeta, et as StreamSink, j as ScopedSharedStates, k as ScopedRpcFn, lt as SharedState, q as DevframeRpcServerFunctions, w as DevframeSettings } from "../devframe-DJMg0WLe.mjs";
2
2
  import { f as RpcCacheManager, p as RpcCacheOptions } from "../index-tdrk1bzV.mjs";
3
3
  import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-Djq7CBXh.mjs";
4
4
  import { t as SseRpcChannelOptions } from "../sse-client-CFBOIaUi.mjs";
@@ -87,16 +87,35 @@ var RpcCacheManager = class {
87
87
  }
88
88
  };
89
89
  //#endregion
90
- //#region src/utils/diagnostics-reporter.ts
90
+ //#region src/utils/nostics.ts
91
91
  const formatAnsi = ansiFormatter(colors);
92
+ /**
93
+ * The reporter every {@link defineDiagnostics} call below wires in ahead of
94
+ * any caller-supplied ones: prints the diagnostic through devframe's own
95
+ * ANSI colors via `console[method]` (default `'warn'`).
96
+ */
92
97
  function devframeReporter(d, { method = "warn" } = {}) {
93
98
  console[method](formatAnsi(d));
94
99
  }
100
+ /**
101
+ * Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
102
+ * ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
103
+ * `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
104
+ * and the built-in plugins defines its codes through this instead of
105
+ * `nostics`'s own `defineDiagnostics` — the reporter registration lives
106
+ * here, once, so none of them need to build their own reporter (`colors`,
107
+ * `ansiFormatter`) or take a direct dependency on `nostics` themselves.
108
+ */
109
+ function defineDiagnostics$1(options) {
110
+ return defineDiagnostics({
111
+ ...options,
112
+ reporters: [devframeReporter, ...options.reporters ?? []]
113
+ });
114
+ }
95
115
  //#endregion
96
116
  //#region src/rpc/diagnostics.ts
97
- const diagnostics = defineDiagnostics({
117
+ const diagnostics = defineDiagnostics$1({
98
118
  docsBase: "https://devfra.me/errors",
99
- reporters: [devframeReporter],
100
119
  codes: {
101
120
  DF0019: {
102
121
  why: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
@@ -703,7 +722,6 @@ const EMPTY_WIRE_DEFS = /* @__PURE__ */ new Map();
703
722
  * don't collide across connections.
704
723
  *
705
724
  * @internal
706
- * implementations; not part of the stable public API.
707
725
  */
708
726
  function createRpcWireCodec(definitions = EMPTY_WIRE_DEFS) {
709
727
  const pendingRequestMethods = /* @__PURE__ */ new Map();
@@ -69,6 +69,15 @@ declare const DEVFRAME_AUTH_TOKEN_QUERY_PARAM = "devframe_auth_token";
69
69
  declare const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
70
70
  /** Token that authorizes an external viewer origin registration. */
71
71
  declare const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
72
+ /**
73
+ * `postMessage` type the remote-assets fallback page posts to `window.parent`
74
+ * on load. That page is what a devframe serves (with a 502) when its client
75
+ * assets can be reached neither locally nor through their CDN provider — the
76
+ * message lets an embedding viewer replace the bare page with its own UI
77
+ * (`@devframes/hub-ui` does, in its iframe view). Payload shape:
78
+ * `RemoteAssetsErrorMessage` (`devframe/types`).
79
+ */
80
+ declare const DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE = "devframe:remote-assets-error";
72
81
  /**
73
82
  * Prefix that marks an RPC method as callable before a connection is
74
83
  * trusted. This is the *only* rule the pre-trust gate applies — there is no
@@ -85,4 +94,4 @@ declare const ANONYMOUS_RPC_PREFIX = "anonymous:";
85
94
  */
86
95
  declare function isAnonymousRpcMethod(name: string): boolean;
87
96
  //#endregion
88
- export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
97
+ export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
@@ -70,6 +70,15 @@ const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
70
70
  /** Token that authorizes an external viewer origin registration. */
71
71
  const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
72
72
  /**
73
+ * `postMessage` type the remote-assets fallback page posts to `window.parent`
74
+ * on load. That page is what a devframe serves (with a 502) when its client
75
+ * assets can be reached neither locally nor through their CDN provider — the
76
+ * message lets an embedding viewer replace the bare page with its own UI
77
+ * (`@devframes/hub-ui` does, in its iframe view). Payload shape:
78
+ * `RemoteAssetsErrorMessage` (`devframe/types`).
79
+ */
80
+ const DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE = "devframe:remote-assets-error";
81
+ /**
73
82
  * Prefix that marks an RPC method as callable before a connection is
74
83
  * trusted. This is the *only* rule the pre-trust gate applies — there is no
75
84
  * per-method allowlist. Any handshake method a host adapter needs to reach
@@ -87,4 +96,4 @@ function isAnonymousRpcMethod(name) {
87
96
  return name.startsWith(ANONYMOUS_RPC_PREFIX);
88
97
  }
89
98
  //#endregion
90
- export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
99
+ export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
@@ -1,4 +1,4 @@
1
- import { g as DevframeNodeContext, ut as SharedState } from "./devframe-Cfx6doi4.mjs";
1
+ import { g as DevframeNodeContext, lt as SharedState } from "./devframe-DJMg0WLe.mjs";
2
2
  //#region src/node/hub-internals/context.d.ts
3
3
  interface InternalAnonymousAuthStorage {
4
4
  trusted: Record<string, {
@@ -1,14 +1,11 @@
1
- import { t as devframeReporter } from "./diagnostics-reporter-CsIG85Q5.mjs";
2
- import { t as diagnostics } from "./diagnostics-hwjXp_UV.mjs";
1
+ import { i as defineDiagnostics } from "./nostics-CzECRXpE.mjs";
2
+ import { t as diagnostics } from "./diagnostics-CD8nlgll.mjs";
3
3
  import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
4
4
  import { defineRpcFunction } from "./index.mjs";
5
- import { t as diagnostics$1 } from "./diagnostics-DEuH3P5O.mjs";
6
- import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-C5HjzfBz.mjs";
7
- import { resolveStaticAssetsSource } from "./utils/remote-assets.mjs";
8
- import { t as createStorage } from "./storage-BVuipbGS.mjs";
9
- import { defineDiagnostics } from "nostics";
10
- import { isatty } from "node:tty";
11
- import { formatWithOptions, inspect } from "node:util";
5
+ import { t as diagnostics$1 } from "./diagnostics-DOQPnQmX.mjs";
6
+ import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-xLCSe65D.mjs";
7
+ import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-nTTxY2MU.mjs";
8
+ import { t as createStorage } from "./storage-CYye7P7L.mjs";
12
9
  import { createSharedState } from "devframe/utils/shared-state";
13
10
  import { existsSync } from "node:fs";
14
11
  import { join } from "pathe";
@@ -17,12 +14,7 @@ var DevframeDiagnosticsHost = class {
17
14
  context;
18
15
  _registry = {};
19
16
  logger = new Proxy({}, { get: (_, code) => this._registry[code] });
20
- defineDiagnostics = (opts) => {
21
- return defineDiagnostics({
22
- ...opts,
23
- reporters: [devframeReporter, ...opts.reporters ?? []]
24
- });
25
- };
17
+ defineDiagnostics = defineDiagnostics;
26
18
  constructor(context, initialDefinitions = []) {
27
19
  this.context = context;
28
20
  for (const d of initialDefinitions) this.register(d);
@@ -32,291 +24,6 @@ var DevframeDiagnosticsHost = class {
32
24
  }
33
25
  };
34
26
  //#endregion
35
- //#region ../../node_modules/.pnpm/obug@2.1.4/node_modules/obug/dist/core.js
36
- /**
37
- * Coerce `value`.
38
- */
39
- function coerce(value) {
40
- if (value instanceof Error) return value.stack || value.message;
41
- return value;
42
- }
43
- /**
44
- * Selects a color for a debug namespace
45
- * @return An ANSI color code for the given namespace
46
- */
47
- function selectColor(colors, namespace) {
48
- let hash = 0;
49
- for (let i = 0; i < namespace.length; i++) {
50
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
51
- hash |= 0;
52
- }
53
- return colors[Math.abs(hash) % colors.length];
54
- }
55
- /**
56
- * Checks if the given string matches a namespace template, honoring
57
- * asterisks as wildcards.
58
- */
59
- function matchesTemplate(search, template) {
60
- let searchIndex = 0;
61
- let templateIndex = 0;
62
- let starIndex = -1;
63
- let matchIndex = 0;
64
- while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
65
- starIndex = templateIndex;
66
- matchIndex = searchIndex;
67
- templateIndex++;
68
- } else {
69
- searchIndex++;
70
- templateIndex++;
71
- }
72
- else if (starIndex !== -1) {
73
- templateIndex = starIndex + 1;
74
- matchIndex++;
75
- searchIndex = matchIndex;
76
- } else return false;
77
- while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
78
- return templateIndex === template.length;
79
- }
80
- function humanize(value) {
81
- if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
82
- return `${value}ms`;
83
- }
84
- let globalNamespaces = "";
85
- function createDebug$1(namespace, options) {
86
- let prevTime;
87
- let enableOverride;
88
- let namespacesCache;
89
- let enabledCache;
90
- const debug = (...args) => {
91
- if (!debug.enabled) return;
92
- const curr = Date.now();
93
- const diff = curr - (prevTime || curr);
94
- prevTime = curr;
95
- args[0] = coerce(args[0]);
96
- if (typeof args[0] !== "string") args.unshift("%O");
97
- let index = 0;
98
- args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => {
99
- if (match === "%%") return "%";
100
- index++;
101
- const formatter = options.formatters[format];
102
- if (typeof formatter === "function") {
103
- const value = args[index];
104
- match = formatter.call(debug, value);
105
- args.splice(index, 1);
106
- index--;
107
- }
108
- return match;
109
- });
110
- options.formatArgs.call(debug, diff, args);
111
- debug.log(...args);
112
- };
113
- debug.extend = function(namespace, delimiter = ":") {
114
- return createDebug$1(this.namespace + delimiter + namespace, {
115
- useColors: this.useColors,
116
- color: this.color,
117
- formatArgs: this.formatArgs,
118
- formatters: this.formatters,
119
- inspectOpts: this.inspectOpts,
120
- log: this.log,
121
- humanize: this.humanize
122
- });
123
- };
124
- Object.assign(debug, options);
125
- debug.namespace = namespace;
126
- Object.defineProperty(debug, "enabled", {
127
- enumerable: true,
128
- configurable: false,
129
- get: () => {
130
- if (enableOverride != null) return enableOverride;
131
- if (namespacesCache !== globalNamespaces) {
132
- namespacesCache = globalNamespaces;
133
- enabledCache = enabled(namespace);
134
- }
135
- return enabledCache;
136
- },
137
- set: (v) => {
138
- enableOverride = v;
139
- }
140
- });
141
- return debug;
142
- }
143
- let names = [];
144
- let skips = [];
145
- function enable(namespaces) {
146
- globalNamespaces = namespaces;
147
- names = [];
148
- skips = [];
149
- const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
150
- for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1));
151
- else names.push(ns);
152
- }
153
- /**
154
- * Returns true if the given mode name is enabled, false otherwise.
155
- */
156
- function enabled(name) {
157
- for (const skip of skips) if (matchesTemplate(name, skip)) return false;
158
- for (const ns of names) if (matchesTemplate(name, ns)) return true;
159
- return false;
160
- }
161
- //#endregion
162
- //#region ../../node_modules/.pnpm/obug@2.1.4/node_modules/obug/dist/node.js
163
- let env = {};
164
- try {
165
- process.env.DEBUG;
166
- env = process.env;
167
- } catch (_unused) {}
168
- const colors = process.stderr.getColorDepth && process.stderr.getColorDepth(env) > 2 ? [
169
- 20,
170
- 21,
171
- 26,
172
- 27,
173
- 32,
174
- 33,
175
- 38,
176
- 39,
177
- 40,
178
- 41,
179
- 42,
180
- 43,
181
- 44,
182
- 45,
183
- 56,
184
- 57,
185
- 62,
186
- 63,
187
- 68,
188
- 69,
189
- 74,
190
- 75,
191
- 76,
192
- 77,
193
- 78,
194
- 79,
195
- 80,
196
- 81,
197
- 92,
198
- 93,
199
- 98,
200
- 99,
201
- 112,
202
- 113,
203
- 128,
204
- 129,
205
- 134,
206
- 135,
207
- 148,
208
- 149,
209
- 160,
210
- 161,
211
- 162,
212
- 163,
213
- 164,
214
- 165,
215
- 166,
216
- 167,
217
- 168,
218
- 169,
219
- 170,
220
- 171,
221
- 172,
222
- 173,
223
- 178,
224
- 179,
225
- 184,
226
- 185,
227
- 196,
228
- 197,
229
- 198,
230
- 199,
231
- 200,
232
- 201,
233
- 202,
234
- 203,
235
- 204,
236
- 205,
237
- 206,
238
- 207,
239
- 208,
240
- 209,
241
- 214,
242
- 215,
243
- 220,
244
- 221
245
- ] : [
246
- 6,
247
- 2,
248
- 3,
249
- 4,
250
- 5,
251
- 1
252
- ];
253
- const inspectOpts = Object.keys(env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => {
254
- const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase());
255
- let value = env[key];
256
- const lowerCase = typeof value === "string" && value.toLowerCase();
257
- if (value === "null") value = null;
258
- else if (lowerCase === "yes" || lowerCase === "on" || lowerCase === "true" || lowerCase === "enabled") value = true;
259
- else if (lowerCase === "no" || lowerCase === "off" || lowerCase === "false" || lowerCase === "disabled") value = false;
260
- else value = Number(value);
261
- obj[prop] = value;
262
- return obj;
263
- }, Object.create(null));
264
- /**
265
- * Is stdout a TTY? Colored output is enabled when `true`.
266
- */
267
- function useColors() {
268
- return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd);
269
- }
270
- function getDate() {
271
- if (inspectOpts.hideDate) return "";
272
- return `${(/* @__PURE__ */ new Date()).toISOString()} `;
273
- }
274
- /**
275
- * Adds ANSI color escape codes if enabled.
276
- */
277
- function formatArgs(diff, args) {
278
- const { namespace: name, useColors } = this;
279
- if (useColors) {
280
- const c = this.color;
281
- const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`;
282
- const prefix = ` ${colorCode};1m${name} \u001B[0m`;
283
- args[0] = prefix + args[0].split("\n").join(`\n${prefix}`);
284
- args.push(`${colorCode}m+${this.humanize(diff)}\u001B[0m`);
285
- } else args[0] = `${getDate()}${name} ${args[0]}`;
286
- }
287
- function log(...args) {
288
- process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}\n`);
289
- }
290
- const defaultOptions = {
291
- useColors: useColors(),
292
- formatArgs,
293
- formatters: {
294
- /**
295
- * Map %o to `util.inspect()`, all on a single line.
296
- */
297
- o(v) {
298
- this.inspectOpts.colors = this.useColors;
299
- return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
300
- },
301
- /**
302
- * Map %O to `util.inspect()`, allowing multiple lines if needed.
303
- */
304
- O(v) {
305
- this.inspectOpts.colors = this.useColors;
306
- return inspect(v, this.inspectOpts);
307
- }
308
- },
309
- inspectOpts,
310
- log,
311
- humanize
312
- };
313
- function createDebug(namespace, options) {
314
- var _ref;
315
- const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
316
- return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options));
317
- }
318
- enable(env.DEBUG || "");
319
- //#endregion
320
27
  //#region src/node/rpc-shared-state.ts
321
28
  const debug$1 = createDebug("devframe:rpc:state:changed");
322
29
  const debugSubscribe = createDebug("devframe:rpc:state:subscribe");
@@ -1,5 +1,5 @@
1
1
  import { n as randomToken } from "./crypto-token-XCqTSMg9.mjs";
2
- import { t as createStorage } from "./storage-BVuipbGS.mjs";
2
+ import { t as createStorage } from "./storage-CYye7P7L.mjs";
3
3
  import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-DZbJ7Cl0.mjs";
4
4
  import { join } from "pathe";
5
5
  //#region src/node/hub-internals/context.ts