devframe 0.9.0-beta.8 → 0.9.0-beta.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{_shared-QkI6ljJS.d.mts → _shared-BPmX9fqK.d.mts} +1 -1
  2. package/dist/adapters/build.d.mts +2 -2
  3. package/dist/adapters/build.mjs +6 -6
  4. package/dist/adapters/cac.d.mts +1 -1
  5. package/dist/adapters/cac.mjs +2 -2
  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/cli/main.mjs +3 -3
  14. package/dist/client/index.d.mts +1 -1
  15. package/dist/client/index.mjs +22 -3
  16. package/dist/constants.d.mts +10 -1
  17. package/dist/constants.mjs +10 -1
  18. package/dist/{context-CQkRTbAc.d.mts → context-B3YUu_95.d.mts} +1 -1
  19. package/dist/{context-D0HD0F7C.mjs → context-CEe4PBz1.mjs} +7 -300
  20. package/dist/{context-D0jErmlx.mjs → context-xdynGSLP.mjs} +1 -1
  21. package/dist/{dev-QEuT8SOF.mjs → dev-Chvlqs7I.mjs} +5 -5
  22. package/dist/{devframe-Cfx6doi4.d.mts → devframe-DJMg0WLe.d.mts} +7 -16
  23. package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
  24. package/dist/{diagnostics-DEuH3P5O.mjs → diagnostics-DOQPnQmX.mjs} +1 -3
  25. package/dist/{host-agent-C5HjzfBz.mjs → host-agent-xLCSe65D.mjs} +1 -1
  26. package/dist/{http-CVwj7b4g.mjs → http-8Kpkap4_.mjs} +4 -4
  27. package/dist/{index-MYi1SZVL.d.mts → index-CB-fSUyn.d.mts} +2 -2
  28. package/dist/index.d.mts +4 -3
  29. package/dist/{instance-registry-M2p-z6xE.mjs → instance-registry-WvQkt42E.mjs} +1 -1
  30. package/dist/{instance-shell-D_UA0Idz.d.mts → instance-shell-CljiKq1c.d.mts} +2 -2
  31. package/dist/{instance-shell-DJ8s-MFw.mjs → instance-shell-XvN5USg4.mjs} +4 -4
  32. package/dist/internal/index.d.mts +8 -13
  33. package/dist/internal/index.mjs +6 -6
  34. package/dist/node/auth.d.mts +2 -2
  35. package/dist/node/hub-internals.d.mts +2 -2
  36. package/dist/node/hub-internals.mjs +1 -1
  37. package/dist/node/index.d.mts +1 -1
  38. package/dist/node/index.mjs +2 -2
  39. package/dist/nostics-CzECRXpE.mjs +59 -0
  40. package/dist/nostics-SPGDgHEP.d.mts +33 -0
  41. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  42. package/dist/recipes/interactive-auth.d.mts +2 -2
  43. package/dist/recipes/interactive-auth.mjs +2 -2
  44. package/dist/{remote-assets-DclsYyoL.d.mts → remote-assets-Bg4gCUZ_.d.mts} +19 -2
  45. package/dist/remote-assets-nTTxY2MU.mjs +636 -0
  46. package/dist/rpc/dump.mjs +1 -1
  47. package/dist/rpc/index.mjs +3 -3
  48. package/dist/rpc/transports/sse-client.mjs +1 -1
  49. package/dist/rpc/transports/sse-server.mjs +2 -2
  50. package/dist/rpc/transports/ws-bun.d.mts +1 -1
  51. package/dist/rpc/transports/ws-bun.mjs +1 -1
  52. package/dist/rpc/transports/ws-client.mjs +1 -1
  53. package/dist/rpc/transports/ws-server.mjs +1 -1
  54. package/dist/{rpc-core-C8JQ3p7A.d.mts → rpc-core-Cc4lucI0.d.mts} +2 -2
  55. package/dist/{rpc-core-IhcWl_xn.mjs → rpc-core-DMTe-hLo.mjs} +1 -1
  56. package/dist/{serialization-BHY8M5NQ.mjs → serialization-BGzEwAdr.mjs} +1 -1
  57. package/dist/{static-CvjkO8QE.mjs → static-BPZ1_OPA.mjs} +2 -2
  58. package/dist/{storage-BVuipbGS.mjs → storage-CYye7P7L.mjs} +1 -1
  59. package/dist/types/index.d.mts +4 -3
  60. package/dist/utils/events.d.mts +1 -1
  61. package/dist/utils/nostics.d.mts +2 -0
  62. package/dist/utils/nostics.mjs +2 -0
  63. package/dist/utils/remote-assets.d.mts +1 -1
  64. package/dist/utils/remote-assets.mjs +1 -308
  65. package/dist/utils/serve-static.d.mts +1 -1
  66. package/dist/utils/serve-static.mjs +16 -0
  67. package/dist/utils/shared-state.d.mts +1 -1
  68. package/dist/utils/streaming-channel.d.mts +1 -1
  69. package/dist/{validation-BiuDXTKW.mjs → validation-CpXFB6Dz.mjs} +1 -1
  70. package/dist/{wire-codec-9VhIKnyp.mjs → wire-codec-GsoRxIsD.mjs} +1 -1
  71. package/dist/{ws-server-Bk1hOG3X.mjs → ws-server-BiUne4K7.mjs} +1 -1
  72. package/package.json +2 -1
  73. 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
@@ -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";
1
+ import { s as colors } from "../nostics-CzECRXpE.mjs";
2
2
  import { r as resolveDevServerPort } from "../_shared-CKZPvSrN.mjs";
3
3
  import { createBuild } from "./build.mjs";
4
- import { t as createDevServer } from "../dev-QEuT8SOF.mjs";
4
+ import { t as createDevServer } from "../dev-Chvlqs7I.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
1
  import { i as resolveMcpConnectionMeta, r as resolveDevServerPort } from "../_shared-CKZPvSrN.mjs";
2
- import { t as createDevServer } from "../dev-QEuT8SOF.mjs";
2
+ import { t as createDevServer } from "../dev-Chvlqs7I.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-Chvlqs7I.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-8Kpkap4_.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.`,
@@ -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
@@ -1,10 +1,10 @@
1
1
  import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
2
- import { t as diagnostics } from "./diagnostics-DEuH3P5O.mjs";
3
- import { t as createHostContext } from "./context-D0HD0F7C.mjs";
4
- import { resolveStaticAssetsSource } from "./utils/remote-assets.mjs";
2
+ import { t as diagnostics } from "./diagnostics-DOQPnQmX.mjs";
3
+ import { t as createHostContext } from "./context-CEe4PBz1.mjs";
4
+ import { t as resolveStaticAssetsSource } from "./remote-assets-nTTxY2MU.mjs";
5
5
  import { i as resolveMcpConnectionMeta, n as resolveBasePath, r as resolveDevServerPort, t as normalizeBasePath } from "./_shared-CKZPvSrN.mjs";
6
6
  import { t as createH3DevframeHost } from "./host-h3-Crkzm42q.mjs";
7
- import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, t as createInstanceShell } from "./instance-shell-DJ8s-MFw.mjs";
7
+ import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, t as createInstanceShell } from "./instance-shell-XvN5USg4.mjs";
8
8
  import { open } from "./utils/open.mjs";
9
9
  import { mountStaticHandler } from "./utils/serve-static.mjs";
10
10
  import { createServer } from "node:http";
@@ -87,7 +87,7 @@ function initDevframe(def, options) {
87
87
  const mcpPath = joinURL(base, mcpMeta.path);
88
88
  let mountMcpHttp;
89
89
  try {
90
- ({mountMcpHttp} = await import("./http-CVwj7b4g.mjs").then((n) => n.t));
90
+ ({mountMcpHttp} = await import("./http-8Kpkap4_.mjs").then((n) => n.t));
91
91
  } catch (error) {
92
92
  const reason = error instanceof Error ? error.message : String(error);
93
93
  throw diagnostics.DF0017({
@@ -1,11 +1,11 @@
1
1
  import { d as RpcFunctionsCollectorBase } from "./index-tdrk1bzV.mjs";
2
2
  import { _ as RpcFunctionDefinition, v as RpcFunctionDefinitionAny } from "./types-Djq7CBXh.mjs";
3
3
  import { d as DevframeRpcConnection, u as DevframeNodeRpcSessionMeta } from "./ws-server-D1d3QM9f.mjs";
4
- import { a as StaticAssetsSource, i as RemoteAssetsStore } from "./remote-assets-DclsYyoL.mjs";
4
+ import { m as defineDiagnostics } from "./nostics-SPGDgHEP.mjs";
5
+ import { a as RemoteAssetsStore, o as StaticAssetsSource } from "./remote-assets-Bg4gCUZ_.mjs";
5
6
  import { CAC } from "cac";
6
7
  import { StandardSchemaV1 } from "@standard-schema/spec";
7
8
  import { BirpcReturn } from "birpc";
8
- import { Diagnostic, DiagnosticDefinition, defineDiagnostics } from "nostics";
9
9
  //#region src/adapters/flags.d.ts
10
10
  /**
11
11
  * Schema map for typed CLI flags. Keys are flag names in camelCase —
@@ -844,16 +844,6 @@ interface RpcStreamingHost {
844
844
  * integrations.
845
845
  */
846
846
  type DevframeDiagnosticsLogger = Record<string, any>;
847
- /**
848
- * Options accepted by the host's `defineDiagnostics()` factory — mirrors
849
- * `nostics`'s shape but the host pre-wires its ANSI console reporter, so
850
- * plugins typically omit `reporters`.
851
- */
852
- interface DevframeDefineDiagnosticsOptions<Codes extends Record<string, DiagnosticDefinition>> {
853
- docsBase?: string | ((code: keyof Codes) => string | undefined);
854
- codes: Codes;
855
- reporters?: ReadonlyArray<(d: Diagnostic, o?: any) => void>;
856
- }
857
847
  /**
858
848
  * Host for structured diagnostics — a thin layer over `nostics` that lets
859
849
  * integrations register their own coded errors/warnings into a shared
@@ -896,10 +886,11 @@ interface DevframeDiagnosticsHost {
896
886
  register: (definitions: Record<string, unknown>) => void;
897
887
  /**
898
888
  * Build a typed diagnostics object with the host's ANSI console reporter
899
- * pre-wired. Mirrors `nostics`'s `defineDiagnostics` so integrations don't
900
- * need to take a direct dependency on `nostics`.
889
+ * pre-wired. The same `devframe/utils/nostics` `defineDiagnostics` every
890
+ * built-in plugin's module-level `diagnostics.ts` uses, so integrations
891
+ * don't need to take a direct dependency on `nostics`.
901
892
  */
902
- defineDiagnostics: <const Codes extends Record<string, DiagnosticDefinition>>(options: DevframeDefineDiagnosticsOptions<Codes>) => ReturnType<typeof defineDiagnostics<Codes, any>>;
893
+ defineDiagnostics: typeof defineDiagnostics;
903
894
  }
904
895
  //#endregion
905
896
  //#region src/types/host.d.ts
@@ -1855,4 +1846,4 @@ interface DevframeDefinition {
1855
1846
  cli?: DevframeCliOptions;
1856
1847
  }
1857
1848
  //#endregion
1858
- export { StreamErrorPayload as $, ScopedServerFunctions as A, InferCliFlags as At, RpcBroadcastOptions as B, DevframeScopedStreamingHost as C, AgentToolProviderHandle as Ct, ScopedBroadcastOptions as D, EventUnsubscribe as Dt, DevframeSettingsStore as E, EventEmitter as Et, DevframeStorageScope as F, RpcStreamingChannelOptions as G, RpcSharedStateGetOptions as H, DevframeDefineDiagnosticsOptions as I, DevframeRpcServerFunctions as J, RpcStreamingHost as K, DevframeDiagnosticsHost as L, SettingsForNamespace as M, parseCliFlags as Mt, DevframeViewHost as N, ScopedClientFunctions as O, EventsMap as Ot, DevframeHost as P, CreateStreamSinkOptions as Q, DevframeDiagnosticsLogger as R, DevframeScopedNodeRpc as S, AgentToolProvider as St, DevframeSettingsRegistry as T, DevframeAgentHostEvents as Tt, RpcSharedStateHost as U, RpcFunctionsHost as V, RpcStreamingChannel as W, BufferedChunk as X, DevframeRpcSharedStates as Y, CreateStreamReaderOptions as Z, DevframeServiceId as _, AgentResource as _t, DevframeDuplicationStrategy as a, Immutable as at, DevframeServicesRegistry as b, AgentTool as bt, DevframeWsOptions as c, ImmutableObject as ct, ConnectionMeta as d, SharedStateEvents as dt, StreamReader as et, ConnectionMetaSse as f, SharedStateOptions as ft, DevframeNodeContext as g, AgentManifest as gt, DevframeConnectionConfigsRegistry as h, AgentHandle as ht, DevframeDockDefaults as i, createStreamSink as it, ScopedSharedStates as j, defineCliFlags as jt, ScopedRpcFn as k, CliFlagsSchema as kt, McpRouteOptions as l, ImmutableSet as lt, DevframeCapabilities as m, createSharedState as mt, DevframeDefinition as n, StreamSinkEvents as nt, DevframeSetupInfo as o, ImmutableArray as ot, ConnectionMetaWebsocket as p, SharedStatePatch as pt, DevframeRpcClientFunctions as q, DevframeDeploymentKind as r, createStreamReader as rt, DevframeSseOptions as s, ImmutableMap as st, DevframeCliOptions as t, StreamSink as tt, DevframeAuthHandler as u, SharedState as ut, DevframeServiceOf as v, AgentResourceContent as vt, DevframeSettings as w, DevframeAgentHost as wt, DevframeScopedNodeContext as x, AgentToolInput as xt, DevframeServicesHost as y, AgentResourceInput as yt, DevframeNodeRpcSession as z };
1849
+ export { StreamReader as $, ScopedServerFunctions as A, defineCliFlags as At, RpcFunctionsHost as B, DevframeScopedStreamingHost as C, DevframeAgentHost as Ct, ScopedBroadcastOptions as D, EventsMap as Dt, DevframeSettingsStore as E, EventUnsubscribe as Et, DevframeStorageScope as F, RpcStreamingHost as G, RpcSharedStateHost as H, DevframeDiagnosticsHost as I, DevframeRpcSharedStates as J, DevframeRpcClientFunctions as K, DevframeDiagnosticsLogger as L, SettingsForNamespace as M, DevframeViewHost as N, ScopedClientFunctions as O, CliFlagsSchema as Ot, DevframeHost as P, StreamErrorPayload as Q, DevframeNodeRpcSession as R, DevframeScopedNodeRpc as S, AgentToolProviderHandle as St, DevframeSettingsRegistry as T, EventEmitter as Tt, RpcStreamingChannel as U, RpcSharedStateGetOptions as V, RpcStreamingChannelOptions as W, CreateStreamReaderOptions as X, BufferedChunk as Y, CreateStreamSinkOptions as Z, DevframeServiceId as _, AgentResourceContent as _t, DevframeDuplicationStrategy as a, ImmutableArray as at, DevframeServicesRegistry as b, AgentToolInput as bt, DevframeWsOptions as c, ImmutableSet as ct, ConnectionMeta as d, SharedStateOptions as dt, StreamSink as et, ConnectionMetaSse as f, SharedStatePatch as ft, DevframeNodeContext as g, AgentResource as gt, DevframeConnectionConfigsRegistry as h, AgentManifest as ht, DevframeDockDefaults as i, Immutable as it, ScopedSharedStates as j, parseCliFlags as jt, ScopedRpcFn as k, InferCliFlags as kt, McpRouteOptions as l, SharedState as lt, DevframeCapabilities as m, AgentHandle as mt, DevframeDefinition as n, createStreamReader as nt, DevframeSetupInfo as o, ImmutableMap as ot, ConnectionMetaWebsocket as p, createSharedState as pt, DevframeRpcServerFunctions as q, DevframeDeploymentKind as r, createStreamSink as rt, DevframeSseOptions as s, ImmutableObject as st, DevframeCliOptions as t, StreamSinkEvents as tt, DevframeAuthHandler as u, SharedStateEvents as ut, DevframeServiceOf as v, AgentResourceInput as vt, DevframeSettings as w, DevframeAgentHostEvents as wt, DevframeScopedNodeContext as x, AgentToolProvider as xt, DevframeServicesHost as y, AgentTool as yt, RpcBroadcastOptions as z };