devframe 0.9.9 → 0.9.10

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 (69) hide show
  1. package/dist/{_shared-CK3czkH4.d.mts → _shared-CCzf9Hub.d.mts} +26 -7
  2. package/dist/{_shared-C08SdQRl.mjs → _shared-U8D-xzrp.mjs} +41 -5
  3. package/dist/adapters/build.d.mts +1 -1
  4. package/dist/adapters/build.mjs +13 -26
  5. package/dist/adapters/cac.d.mts +6 -10
  6. package/dist/adapters/cac.mjs +3 -4
  7. package/dist/adapters/dev.d.mts +7 -7
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +5 -4
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +1 -1
  13. package/dist/adapters/mcp.mjs +3 -3
  14. package/dist/cli/main.mjs +2 -2
  15. package/dist/client/index.d.mts +1 -1
  16. package/dist/client/index.mjs +7 -1
  17. package/dist/{context-CwPUinjn.mjs → context-B29Oh0oA.mjs} +47 -12
  18. package/dist/{context-rgBSPFHS.d.mts → context-BJiKJqyW.d.mts} +1 -1
  19. package/dist/{context-4AIVRLYF.d.mts → context-CHW4BZOj.d.mts} +51 -18
  20. package/dist/{context-DIUvJW4D.mjs → context-jXO5vzjH.mjs} +1 -1
  21. package/dist/{dev-Eqq5PX0k.mjs → dev-CRYHx7iG.mjs} +49 -35
  22. package/dist/{diagnostics-BMfN8mb1.mjs → diagnostics-DZA6KQ_Z.mjs} +3 -3
  23. package/dist/{services-install-P_DV7VYL.mjs → host-agent-CKqSTEX9.mjs} +8 -155
  24. package/dist/in-page-channel/index.d.mts +1 -1
  25. package/dist/{index-pKl67H6w.d.mts → index-CNC390b_.d.mts} +2 -2
  26. package/dist/index.d.mts +2 -2
  27. package/dist/{instance-registry-C7-41RSp.mjs → instance-registry-DCq762YJ.mjs} +2 -2
  28. package/dist/{instance-shell-7Z52PE4_.d.mts → instance-shell-DZipaP9k.d.mts} +2 -2
  29. package/dist/{instance-shell-cdVETpfz.mjs → instance-shell-DvYCwrDy.mjs} +5 -18
  30. package/dist/internal/index.d.mts +11 -9
  31. package/dist/internal/index.mjs +9 -9
  32. package/dist/node/auth.d.mts +2 -2
  33. package/dist/node/auth.mjs +1 -1
  34. package/dist/node/hub-internals.d.mts +2 -2
  35. package/dist/node/hub-internals.mjs +2 -2
  36. package/dist/node/index.d.mts +1 -1
  37. package/dist/node/index.mjs +2 -2
  38. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  39. package/dist/recipes/interactive-auth.d.mts +2 -2
  40. package/dist/recipes/interactive-auth.mjs +2 -2
  41. package/dist/{remote-assets-BIFWOlBW.mjs → remote-assets-DMFzLSoH.mjs} +3 -3
  42. package/dist/rpc/dump.d.mts +17 -1
  43. package/dist/rpc/dump.mjs +2 -2
  44. package/dist/rpc/index.mjs +2 -3
  45. package/dist/rpc/transports/sse-client.mjs +1 -1
  46. package/dist/rpc/transports/sse-server.mjs +1 -1
  47. package/dist/rpc/transports/ws-bun.d.mts +1 -1
  48. package/dist/rpc/transports/ws-client.mjs +1 -1
  49. package/dist/rpc/transports/ws-deno.d.mts +1 -1
  50. package/dist/rpc/transports/ws-server.mjs +1 -1
  51. package/dist/{rpc-core-DVQ7xi89.mjs → rpc-core-CvkU23bQ.mjs} +1 -1
  52. package/dist/{rpc-core-Ceu6AUz8.d.mts → rpc-core-DsyDViQy.d.mts} +2 -2
  53. package/dist/{serialization-DTZnPQ1-.mjs → serialization-DFg5sUt6.mjs} +39 -2
  54. package/dist/services-install-Ben4yh52.mjs +154 -0
  55. package/dist/{state-CeQQWzM-.mjs → state-Mwt6--el.mjs} +13 -5
  56. package/dist/{storage-Dccf_IyD.mjs → storage-B70AXK64.mjs} +2 -2
  57. package/dist/types/index.d.mts +2 -2
  58. package/dist/utils/events.d.mts +1 -1
  59. package/dist/utils/remote-assets.mjs +1 -1
  60. package/dist/utils/serve-static.mjs +1 -1
  61. package/dist/utils/shared-state.d.mts +1 -1
  62. package/dist/utils/streaming-channel.d.mts +1 -1
  63. package/dist/{validation-BOy8IoFZ.mjs → validation-CfV1s0SF.mjs} +1 -1
  64. package/dist/{wire-codec-dcCeXcSo.mjs → wire-codec-BHGt0sSs.mjs} +1 -1
  65. package/dist/{static-DZ8P2Kn7.mjs → write-BuLCrn9h.mjs} +25 -4
  66. package/package.json +2 -6
  67. package/skills/devframe/SKILL.md +5 -3
  68. package/dist/diagnostics-D0EVm5M6.mjs +0 -39
  69. package/dist/{host-h3-BJ4siyz7.mjs → host-h3-BROI6SQ4.mjs} +1 -1
@@ -261,6 +261,13 @@ interface DevframeAgentHost {
261
261
  * tools/resources registered on the host.
262
262
  */
263
263
  list: () => AgentManifest;
264
+ /**
265
+ * Whether the devframe exposes anything to agents: an `agent`-flagged RPC
266
+ * function, a registered tool or resource, or a provider currently
267
+ * yielding at least one tool. The `mcp: 'auto'` default consults this to
268
+ * decide whether a route is worth mounting.
269
+ */
270
+ hasSurface: () => boolean;
264
271
  /**
265
272
  * Invoke any tool by id. Routes to the underlying RPC handler for
266
273
  * `kind === 'rpc'`, or to the registered handler for `kind === 'tool'`.
@@ -1169,9 +1176,27 @@ interface DevframeSseOptions {
1169
1176
  * - `false`, the default: **origin-only**, trusting same-machine callers.
1170
1177
  */
1171
1178
  type McpAuthorization = string | ((request: Request) => boolean | Promise<boolean>) | false;
1179
+ /**
1180
+ * The route-based MCP setting accepted everywhere a host mounts a devframe
1181
+ * (`cli.mcp`, `initDevframe` / `initHub` / `createDevServer` options, the
1182
+ * framework kits):
1183
+ *
1184
+ * - `'auto'`, the default: mount the route when the devframe exposes an
1185
+ * agent surface (an `agent`-flagged RPC function, or a tool / resource /
1186
+ * provider registered on `ctx.agent`). An empty agent surface mounts
1187
+ * nothing and loads no MCP code.
1188
+ * - `true`: always mount at the default `__mcp` route.
1189
+ * - `false`: never mount.
1190
+ * - {@link McpRouteOptions}: always mount, with a custom route path, origin
1191
+ * allow-list, or {@link McpAuthorization} identity check.
1192
+ *
1193
+ * A mounted route trusts same-machine callers by default (the loopback
1194
+ * origin gate), exactly like `mcp: true`.
1195
+ */
1196
+ type McpSetting = boolean | 'auto' | McpRouteOptions;
1172
1197
  /**
1173
1198
  * Configuration for the route-based MCP server mounted alongside the dev
1174
- * server (opt-in via {@link DevframeCliOptions.mcp}). The endpoint speaks
1199
+ * server (via {@link DevframeCliOptions.mcp}). The endpoint speaks
1175
1200
  * the MCP Streamable-HTTP transport over the same origin as the SPA,
1176
1201
  * exposing the definition's `ctx.agent` tools + shared-state resources to
1177
1202
  * external MCP clients connected to the *running* server.
@@ -1253,11 +1278,11 @@ interface DevframeCliOptions {
1253
1278
  * base path). It surfaces the same `ctx.agent` tools + shared-state
1254
1279
  * resources as the stdio `mcp` command, but against the live server.
1255
1280
  *
1256
- * - `false` / omitted (default): no MCP route is mounted.
1257
- * - `true`: mount at the default `__mcp` route with the loopback origin
1258
- * gate (trusting same-machine callers).
1259
- * - {@link McpRouteOptions}: customise the route path, origin allow-list,
1260
- * and opt into an {@link McpAuthorization} identity check.
1281
+ * Defaults to `'auto'`: the route mounts once the devframe exposes an
1282
+ * agent surface (an `agent`-flagged RPC, a registered tool / resource).
1283
+ * See {@link McpSetting} for the full contract, and
1284
+ * {@link McpRouteOptions} for the route path, origin allow-list, and
1285
+ * {@link McpAuthorization} identity check.
1261
1286
  *
1262
1287
  * The `--mcp` / `--no-mcp` CLI flags override this per run. Whether to expose
1263
1288
  * MCP is a hosting decision, so programmatic hosts pass it to
@@ -1268,7 +1293,7 @@ interface DevframeCliOptions {
1268
1293
  * This field is still read as a fallback, and will be removed in a future
1269
1294
  * release.
1270
1295
  */
1271
- mcp?: boolean | McpRouteOptions;
1296
+ mcp?: McpSetting;
1272
1297
  /**
1273
1298
  * Author's SPA dist, served as the devframe's UI.
1274
1299
  *
@@ -1461,10 +1486,11 @@ interface DevframeDefinition {
1461
1486
  * act on a `false` before doing any work:
1462
1487
  *
1463
1488
  * - `build: false`: `createCac` skips registering the `build` subcommand,
1464
- * and `createBuild` refuses (throws `DF0042`) unless `{ force: true }`.
1465
- * Useful for a devframe whose value is inherently live (e.g. it manages
1466
- * real files on disk), so a static export would only ever produce a
1467
- * broken, write-less shell of the tool.
1489
+ * `createBuild` refuses (throws `DF0042`) unless `{ force: true }`, and
1490
+ * a hub static build (`buildHub`) silently skips the devframe - no dock,
1491
+ * no SPA copy, no RPCs in the dump. Useful for a devframe whose value is
1492
+ * inherently live (e.g. it manages real files on disk), so a static
1493
+ * export would only ever produce a broken, write-less shell of the tool.
1468
1494
  * - `dev: false`: `createDevServer` refuses (throws `DF0058`) unless
1469
1495
  * `{ force: true }`. Useful for a devframe that only makes sense as a
1470
1496
  * static export (e.g. a report generator with nothing to serve live).
@@ -2060,12 +2086,19 @@ interface ConnectionMeta {
2060
2086
  */
2061
2087
  jsonSerializableMethods?: string[];
2062
2088
  /**
2063
- * Absolute URL of the `__connection.json` this meta was loaded from.
2064
- * Annotated by the client (not served) when it publishes the meta on a
2065
- * shared window for same-origin inheritance: a relative `websocket.path`
2066
- * resolves against this, so a child SPA mounted at another base (e.g. a hub
2067
- * mounting several devframes at `/__foo/`, `/__bar/`, …) inherits a dialable
2068
- * endpoint rather than resolving the path against its own mount.
2089
+ * URL of the `__connection.json` that owns this meta's relative paths.
2090
+ * Two producers write it:
2091
+ *
2092
+ * - The client annotates it (absolute) when it publishes the meta on a
2093
+ * shared window for same-origin inheritance: a relative
2094
+ * `websocket.path` resolves against this, so a child SPA mounted at
2095
+ * another base (e.g. a hub mounting several devframes at `/__foo/`,
2096
+ * `/__bar/`, …) inherits a dialable endpoint rather than resolving the
2097
+ * path against its own mount.
2098
+ * - A static hub build serves it (base-absolute, e.g.
2099
+ * `/__devframes/__connection.json`) in each **per-frame** meta, so a
2100
+ * frame SPA that fetched its own copy still resolves the shared RPC
2101
+ * dump from the hub base. Resolved against the fetched URL.
2069
2102
  */
2070
2103
  baseUrl?: string;
2071
2104
  /**
@@ -2125,4 +2158,4 @@ interface ConnectionMeta {
2125
2158
  */
2126
2159
  interface DevframeConnectionConfigsRegistry {}
2127
2160
  //#endregion
2128
- export { DevframeServiceScopeOf as $, SharedStateEvents as A, AgentManifest as At, DevframeSetupInfo as B, EventEmitter as Bt, createStreamSink as C, DevframeDiagnosticsLogger as Ct, ImmutableObject as D, defineCliFlags as Dt, ImmutableMap as E, InferCliFlags as Et, DevframeDefinition as F, AgentToolInput as Ft, McpAuthorization as G, DevframeSnapshotRpcInputs as H, EventsMap as Ht, DevframeDeploymentKind as I, AgentToolProvider as It, DevframeServiceDescriptor as J, McpRouteOptions as K, DevframeDockDefaults as L, AgentToolProviderHandle as Lt, SharedStatePatch as M, AgentResourceContent as Mt, createSharedState as N, AgentResourceInput as Nt, ImmutableSet as O, parseCliFlags as Ot, DevframeCliOptions as P, AgentTool as Pt, DevframeServiceOf as Q, DevframeDuplicationStrategy as R, DevframeAgentHost as Rt, createStreamReader as S, DevframeDiagnosticsHost as St, ImmutableArray as T, CliFlagsSchema as Tt, DevframeSseOptions as U, DevframeSnapshotRpcEntry as V, EventUnsubscribe as Vt, DevframeWsOptions as W, DevframeServiceInput as X, DevframeServiceId as Y, DevframeServiceMeta as Z, CreateStreamSinkOptions as _, DevframeRpcClientFunctions as _t, DevframeConnectionConfigsRegistry as a, DevframeScopedNodeRpc as at, StreamSink as b, DevframeHost as bt, RpcBroadcastOptions as c, DevframeSettingsRegistry as ct, RpcSharedStateHost as d, ScopedClientFunctions as dt, DevframeServicesHost as et, RpcStreamingChannel as f, ScopedRpcFn as ft, CreateStreamReaderOptions as g, DevframeViewHost as gt, BufferedChunk as h, SettingsForNamespace as ht, DevframeCapabilities as i, DevframeScopedNodeContext as it, SharedStateOptions as j, AgentResource as jt, SharedState as k, AgentHandle as kt, RpcFunctionsHost as l, DevframeSettingsStore as lt, RpcStreamingHost as m, ScopedSharedStates as mt, ConnectionMetaSse as n, DevframeServicesScopeRegistry as nt, DevframeNodeContext as o, DevframeScopedStreamingHost as ot, RpcStreamingChannelOptions as p, ScopedServerFunctions as pt, DevframeServiceDefinition as q, ConnectionMetaWebsocket as r, DevframeServicesState as rt, DevframeNodeRpcSession as s, DevframeSettings as st, ConnectionMeta as t, DevframeServicesRegistry as tt, RpcSharedStateGetOptions as u, ScopedBroadcastOptions as ut, StreamErrorPayload as v, DevframeRpcServerFunctions as vt, Immutable as w, DevframeAuthHandler as wt, StreamSinkEvents as x, DevframeStorageScope as xt, StreamReader as y, DevframeRpcSharedStates as yt, DevframeRpcOptions as z, DevframeAgentHostEvents as zt };
2161
+ export { DevframeServiceOf as $, SharedStateEvents as A, AgentHandle as At, DevframeSetupInfo as B, DevframeAgentHostEvents as Bt, createStreamSink as C, DevframeDiagnosticsHost as Ct, ImmutableObject as D, InferCliFlags as Dt, ImmutableMap as E, CliFlagsSchema as Et, DevframeDefinition as F, AgentTool as Ft, McpAuthorization as G, DevframeSnapshotRpcInputs as H, EventUnsubscribe as Ht, DevframeDeploymentKind as I, AgentToolInput as It, DevframeServiceDefinition as J, McpRouteOptions as K, DevframeDockDefaults as L, AgentToolProvider as Lt, SharedStatePatch as M, AgentResource as Mt, createSharedState as N, AgentResourceContent as Nt, ImmutableSet as O, defineCliFlags as Ot, DevframeCliOptions as P, AgentResourceInput as Pt, DevframeServiceMeta as Q, DevframeDuplicationStrategy as R, AgentToolProviderHandle as Rt, createStreamReader as S, DevframeStorageScope as St, ImmutableArray as T, DevframeAuthHandler as Tt, DevframeSseOptions as U, EventsMap as Ut, DevframeSnapshotRpcEntry as V, EventEmitter as Vt, DevframeWsOptions as W, DevframeServiceId as X, DevframeServiceDescriptor as Y, DevframeServiceInput as Z, CreateStreamSinkOptions as _, DevframeViewHost as _t, DevframeConnectionConfigsRegistry as a, DevframeScopedNodeContext as at, StreamSink as b, DevframeRpcSharedStates as bt, RpcBroadcastOptions as c, DevframeSettings as ct, RpcSharedStateHost as d, ScopedBroadcastOptions as dt, DevframeServiceScopeOf as et, RpcStreamingChannel as f, ScopedClientFunctions as ft, CreateStreamReaderOptions as g, SettingsForNamespace as gt, BufferedChunk as h, ScopedSharedStates as ht, DevframeCapabilities as i, DevframeServicesState as it, SharedStateOptions as j, AgentManifest as jt, SharedState as k, parseCliFlags as kt, RpcFunctionsHost as l, DevframeSettingsRegistry as lt, RpcStreamingHost as m, ScopedServerFunctions as mt, ConnectionMetaSse as n, DevframeServicesRegistry as nt, DevframeNodeContext as o, DevframeScopedNodeRpc as ot, RpcStreamingChannelOptions as p, ScopedRpcFn as pt, McpSetting as q, ConnectionMetaWebsocket as r, DevframeServicesScopeRegistry as rt, DevframeNodeRpcSession as s, DevframeScopedStreamingHost as st, ConnectionMeta as t, DevframeServicesHost as tt, RpcSharedStateGetOptions as u, DevframeSettingsStore as ut, StreamErrorPayload as v, DevframeRpcClientFunctions as vt, Immutable as w, DevframeDiagnosticsLogger as wt, StreamSinkEvents as x, DevframeHost as xt, StreamReader as y, DevframeRpcServerFunctions as yt, DevframeRpcOptions as z, DevframeAgentHost as zt };
@@ -1,5 +1,5 @@
1
1
  import { n as randomToken } from "./crypto-token-TVbGGFuj.mjs";
2
- import { t as createStorage } from "./storage-Dccf_IyD.mjs";
2
+ import { t as createStorage } from "./storage-B70AXK64.mjs";
3
3
  import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-cqztiCX4.mjs";
4
4
  import { join } from "pathe";
5
5
  //#region src/node/hub-internals/context.ts
@@ -1,16 +1,16 @@
1
1
  import { t as resolveClientAssets } from "./client-assets-DNdhagGm.mjs";
2
2
  import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
3
- import { t as diagnostics } from "./diagnostics-BMfN8mb1.mjs";
4
- import { t as createHostContext } from "./context-CwPUinjn.mjs";
5
- import { t as resolveStaticAssetsSource } from "./remote-assets-BIFWOlBW.mjs";
6
- import { i as resolveMcpConfig, n as resolveBasePath, r as resolveDevServerPort, t as normalizeBasePath } from "./_shared-C08SdQRl.mjs";
7
- import { t as createH3DevframeHost } from "./host-h3-BJ4siyz7.mjs";
8
- import { a as importRuntimeModule, i as normalizeHttpServerUrl, n as resolveInstanceRegister, t as createInstanceShell } from "./instance-shell-cdVETpfz.mjs";
3
+ import { t as diagnostics } from "./diagnostics-DZA6KQ_Z.mjs";
4
+ import { t as createHostContext } from "./context-B29Oh0oA.mjs";
5
+ import { t as resolveStaticAssetsSource } from "./remote-assets-DMFzLSoH.mjs";
6
+ import { a as resolveMcpConfig, i as resolveDevServerPort, n as normalizeBasePath, r as resolveBasePath, s as importRuntimeModule, t as loadAutoMcpAdapter } from "./_shared-U8D-xzrp.mjs";
7
+ import { t as createH3DevframeHost } from "./host-h3-BROI6SQ4.mjs";
8
+ import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, t as createInstanceShell } from "./instance-shell-DvYCwrDy.mjs";
9
9
  import { open } from "./utils/open.mjs";
10
10
  import { mountStaticHandler } from "./utils/serve-static.mjs";
11
+ import { resolve } from "pathe";
11
12
  import { createServer } from "node:http";
12
13
  import process from "node:process";
13
- import { resolve } from "pathe";
14
14
  import { joinURL, withBase, withoutLeadingSlash } from "ufo";
15
15
  import { H3, toNodeHandler } from "h3";
16
16
  //#region src/adapters/initiate.ts
@@ -88,36 +88,11 @@ function initDevframe(def, options) {
88
88
  for (const input of def.services ?? []) context.services.install(input, { resolveFrom: def.importMetaUrl });
89
89
  await context.services.ready();
90
90
  await def.setup(context, setupInfo);
91
- const mcpConfig = resolveMcpConfig(options.mcp ?? def.cli?.mcp);
92
- let mcpMeta;
93
- let mcpDispose;
94
- if (mcpConfig) {
95
- const mcpRoute = withoutLeadingSlash(mcpConfig.path ?? "__mcp");
96
- mcpMeta = { path: mcpRoute };
97
- const mcpPath = joinURL(base, mcpRoute);
98
- let mountMcpHttp;
99
- try {
100
- ({mountMcpHttp} = await importRuntimeModule("devframe/adapters/mcp"));
101
- } catch (error) {
102
- const reason = error instanceof Error ? error.message : String(error);
103
- throw diagnostics.DF0017({
104
- transport: "http",
105
- reason,
106
- cause: error
107
- });
108
- }
109
- mcpDispose = mountMcpHttp(app, context, mcpPath, {
110
- serverName: `${def.id} (devframe)`,
111
- serverVersion: def.version ?? "0.0.0",
112
- exposeSharedState: true,
113
- authorization: mcpConfig.authorization,
114
- allowedOrigins: mcpConfig.allowedOrigins
115
- }).dispose;
116
- }
91
+ const mcp = await mountMcpRoute(app, context, def, base, options.mcp ?? def.cli?.mcp ?? "auto");
117
92
  return {
118
93
  context,
119
- ...mcpMeta ? { mcp: mcpMeta } : {},
120
- ...mcpDispose ? { dispose: mcpDispose } : {}
94
+ ...mcp?.meta ? { mcp: mcp.meta } : {},
95
+ ...mcp?.dispose ? { dispose: mcp.dispose } : {}
121
96
  };
122
97
  },
123
98
  mount(context, meta) {
@@ -142,6 +117,45 @@ function initDevframe(def, options) {
142
117
  INSTANCE_INTERNALS.set(instance, shell.internals);
143
118
  return instance;
144
119
  }
120
+ /**
121
+ * Mount the route-based MCP server at `<base>__mcp`, before the SPA static
122
+ * catch-all so the exact route wins. The MCP SDK is pulled in dynamically
123
+ * only when the route mounts, keeping it out of consumer bundles: `'auto'`
124
+ * mounts once `setup()` left a non-empty agent surface (an empty surface
125
+ * loads no MCP code); an explicit setting mounts unconditionally. The
126
+ * resolved config is origin-only unless it opts into a bearer/callback.
127
+ */
128
+ async function mountMcpRoute(app, context, def, base, setting) {
129
+ let module;
130
+ let config;
131
+ if (setting === "auto") {
132
+ module = await loadAutoMcpAdapter(context.agent);
133
+ if (module) config = { authorization: false };
134
+ } else config = resolveMcpConfig(setting);
135
+ if (!config) return void 0;
136
+ const route = withoutLeadingSlash(config.path ?? "__mcp");
137
+ if (!module) try {
138
+ module = await importRuntimeModule("devframe/adapters/mcp");
139
+ } catch (error) {
140
+ const reason = error instanceof Error ? error.message : String(error);
141
+ throw diagnostics.DF0017({
142
+ transport: "http",
143
+ reason,
144
+ cause: error
145
+ });
146
+ }
147
+ const mounted = module.mountMcpHttp(app, context, joinURL(base, route), {
148
+ serverName: `${def.id} (devframe)`,
149
+ serverVersion: def.version ?? "0.0.0",
150
+ exposeSharedState: true,
151
+ authorization: config.authorization,
152
+ allowedOrigins: config.allowedOrigins
153
+ });
154
+ return {
155
+ meta: { path: route },
156
+ dispose: mounted.dispose
157
+ };
158
+ }
145
159
  //#endregion
146
160
  //#region src/adapters/dev.ts
147
161
  /**
@@ -68,8 +68,8 @@ const diagnostics = defineDiagnostics({
68
68
  fix: "Discovery tooling (`devframe connect`) will not see this instance. Check that the registry directory is writable, point `DEVFRAME_INSTANCES_DIR` at a writable directory, or set `DEVFRAME_DISABLE_INSTANCE_REGISTRY=1` to opt out of registration."
69
69
  },
70
70
  DF0046: {
71
- why: (p) => `\`devframe connect\` requires the optional peer dependency @modelcontextprotocol/server: ${p.reason}`,
72
- fix: "Install it next to devframe (e.g. `npm install @modelcontextprotocol/server`) and run `devframe connect` again."
71
+ why: (p) => `\`devframe connect\` requires the optional peer dependency @modelcontextprotocol/client: ${p.reason}`,
72
+ fix: "Install it next to devframe (e.g. `npm install @modelcontextprotocol/client`) and run `devframe connect` again."
73
73
  },
74
74
  DF0047: {
75
75
  why: (p) => `Agent tool "${p.id}" is hidden from the MCP surface: its wire name "${p.name}" collides with the tool "${p.existing}".`,
@@ -173,7 +173,7 @@ const diagnostics = defineDiagnostics({
173
173
  },
174
174
  DF0076: {
175
175
  why: (p) => `\`attach\` / \`handleUpgrade\` drive a raw \`node:http\` upgrade into crossws's Node adapter, which refuses to run on ${p.runtime}.`,
176
- fix: "On Bun/Deno, serve the advertised `__ws` route from `Bun.serve` / `Deno.serve` with `attachBunWsTransport` / `attachDenoWsTransport` (see the hub-deno-minimal example), or connect over the SSE endpoint instead."
176
+ fix: "On Bun/Deno, serve the advertised `__ws` route from `Bun.serve` / `Deno.serve` with `attachBunWsTransport` / `attachDenoWsTransport` (see the hub-deno example), or connect over the SSE endpoint instead."
177
177
  }
178
178
  }
179
179
  });
@@ -1,8 +1,5 @@
1
1
  import { t as DEVFRAME_EVENTS } from "./events-BV4Dj59a.mjs";
2
- import { t as diagnostics } from "./diagnostics-BMfN8mb1.mjs";
3
- import { createRequire } from "node:module";
4
- import { pathToFileURL } from "node:url";
5
- import { isAbsolute, join } from "pathe";
2
+ import { t as diagnostics } from "./diagnostics-DZA6KQ_Z.mjs";
6
3
  //#region src/utils/events.ts
7
4
  /**
8
5
  * Create event emitter.
@@ -174,6 +171,12 @@ var DevframeAgentHost = class {
174
171
  resources
175
172
  };
176
173
  }
174
+ hasSurface() {
175
+ if (this.tools.size > 0 || this.resources.size > 0) return true;
176
+ for (const [, def] of this.context.rpc.definitions) if (def.agent) return true;
177
+ for (const provider of this.providers) if (provider().length > 0) return true;
178
+ return false;
179
+ }
177
180
  getTool(id) {
178
181
  const plain = this.tools.get(id);
179
182
  if (plain) return plain.tool;
@@ -271,154 +274,4 @@ function inferSafety(type) {
271
274
  return "action";
272
275
  }
273
276
  //#endregion
274
- //#region src/node/services-install.ts
275
- /**
276
- * Turn a `resolveFrom` value (a file path, a file URL like `import.meta.url`,
277
- * or a directory) into something `createRequire` accepts; a directory gets a
278
- * synthetic filename appended so resolution starts inside it.
279
- */
280
- function toRequireBase(resolveFrom) {
281
- if (resolveFrom.startsWith("file://")) return resolveFrom;
282
- if ((resolveFrom.split(/[/\\]/).pop() ?? "").includes(".")) return resolveFrom;
283
- return join(resolveFrom, "_devframe_resolve.js");
284
- }
285
- /**
286
- * Normalize an `install()` `resolveFrom` into a resolution base. Paths and
287
- * file URLs pass through (the common case: the declaring plugin's
288
- * `importMetaUrl`, so a service it declares resolves against the plugin's own
289
- * dependencies); a bare npm package name resolves to that package's location
290
- * from `cwd`. An unresolvable package name reads as no base (the caller's
291
- * workspace fallbacks apply).
292
- */
293
- function expandResolveFrom(resolveFrom, cwd) {
294
- if (resolveFrom.startsWith("file://") || resolveFrom.startsWith(".") || isAbsolute(resolveFrom)) return resolveFrom;
295
- const require = createRequire(join(cwd, "_devframe_resolve.js"));
296
- try {
297
- return require.resolve(`${resolveFrom}/package.json`);
298
- } catch {}
299
- try {
300
- return require.resolve(resolveFrom);
301
- } catch {}
302
- }
303
- /**
304
- * Import a service package's module, trying each `resolveFrom` candidate in
305
- * order (so a plugin-declared service resolves against the plugin's own
306
- * dependency tree first, then the workspace fallback). Throws the last
307
- * resolution error when no candidate succeeds.
308
- */
309
- async function importServicePackage(pkg, resolveFroms) {
310
- const candidates = [...new Set(resolveFroms.filter((x) => typeof x === "string" && x.length > 0))];
311
- let lastError = /* @__PURE__ */ new Error(`no resolution base available for "${pkg}"`);
312
- for (const from of candidates) {
313
- let resolved;
314
- try {
315
- resolved = createRequire(toRequireBase(from)).resolve(pkg);
316
- } catch (error) {
317
- lastError = error;
318
- continue;
319
- }
320
- return await import(
321
- /* webpackIgnore: true */
322
- /* @vite-ignore */
323
- /* turbopackIgnore: true */
324
- pathToFileURL(resolved).href
325
- );
326
- }
327
- throw lastError;
328
- }
329
- function parseVersion(input) {
330
- const [core, ...prerelease] = input.trim().replace(/^v/, "").split("-");
331
- if (!core) return void 0;
332
- const parts = core.split(".").map((part) => Number.parseInt(part, 10));
333
- if (parts.length === 0 || parts.some((part) => Number.isNaN(part) || part < 0)) return void 0;
334
- while (parts.length < 3) parts.push(0);
335
- return {
336
- parts,
337
- ...prerelease.length ? { prerelease: prerelease.join("-") } : {}
338
- };
339
- }
340
- function compareVersions(a, b) {
341
- for (let i = 0; i < 3; i++) {
342
- const diff = (a.parts[i] ?? 0) - (b.parts[i] ?? 0);
343
- if (diff !== 0) return diff;
344
- }
345
- if (a.prerelease && !b.prerelease) return -1;
346
- if (!a.prerelease && b.prerelease) return 1;
347
- if (a.prerelease && b.prerelease) return a.prerelease < b.prerelease ? -1 : a.prerelease > b.prerelease ? 1 : 0;
348
- return 0;
349
- }
350
- /** Whether `version` and `base` share their first `lockUpTo + 1` parts. */
351
- function partsMatchUpTo(version, base, lockUpTo) {
352
- for (let i = 0; i <= lockUpTo; i++) if ((version.parts[i] ?? 0) !== (base.parts[i] ?? 0)) return false;
353
- return true;
354
- }
355
- function satisfiesCaret(version, base) {
356
- if (compareVersions(version, base) < 0) return false;
357
- const fixedIndex = base.parts.findIndex((part) => part !== 0);
358
- return partsMatchUpTo(version, base, fixedIndex === -1 ? base.parts.length - 1 : fixedIndex);
359
- }
360
- function satisfiesTilde(version, base, segments) {
361
- if (compareVersions(version, base) < 0) return false;
362
- return partsMatchUpTo(version, base, segments.length >= 2 ? 1 : 0);
363
- }
364
- function satisfiesExactOrPrefix(version, base, segments) {
365
- for (let i = 0; i < Math.max(segments.length, 3); i++) if (i < segments.length && (version.parts[i] ?? 0) !== (base.parts[i] ?? 0)) return false;
366
- return segments.length >= 3 ? compareVersions(version, base) === 0 : true;
367
- }
368
- function satisfiesComparator(version, comparator) {
369
- const raw = comparator.trim();
370
- if (!raw || raw === "*" || raw === "x") return true;
371
- const operatorMatch = raw.match(/^([\^~]|>=|<=|[><=])?(.+)$/);
372
- if (!operatorMatch) return false;
373
- const operator = operatorMatch[1];
374
- const rest = operatorMatch[2].trim();
375
- const segments = rest.replace(/\.[x*]/gi, "").split(".").filter(Boolean);
376
- const base = parseVersion(rest.replace(/[x*]/gi, "0"));
377
- if (!base) return false;
378
- switch (operator) {
379
- case ">": return compareVersions(version, base) > 0;
380
- case ">=": return compareVersions(version, base) >= 0;
381
- case "<": return compareVersions(version, base) < 0;
382
- case "<=": return compareVersions(version, base) <= 0;
383
- case "^": return satisfiesCaret(version, base);
384
- case "~": return satisfiesTilde(version, base, segments);
385
- default: return satisfiesExactOrPrefix(version, base, segments);
386
- }
387
- }
388
- /**
389
- * Pragmatic semver range check for service version declarations; supports
390
- * the common forms (`1.2.3`, `^1.2.3`, `~1.2`, `>=1 <3`, `1.x`, `*`, and
391
- * `||`-joined alternatives) without pulling in a semver dependency. An
392
- * unparseable version or range reads as **not satisfied**.
393
- */
394
- function satisfiesVersionRange(version, range) {
395
- const parsed = parseVersion(version);
396
- if (!parsed) return false;
397
- const alternatives = range.split("||").map((alt) => alt.trim()).filter(Boolean);
398
- if (alternatives.length === 0) return true;
399
- return alternatives.some((alternative) => alternative.split(/\s+/).every((comparator) => satisfiesComparator(parsed, comparator)));
400
- }
401
- function isPlainObject(value) {
402
- return typeof value === "object" && value !== null && !Array.isArray(value);
403
- }
404
- /** Deep-merge two values with the service option-set rules (see below). */
405
- function deepMergeTwo(a, b) {
406
- if (Array.isArray(a) && Array.isArray(b)) return [.../* @__PURE__ */ new Set([...a, ...b])];
407
- if (isPlainObject(a) && isPlainObject(b)) {
408
- const out = { ...a };
409
- for (const key of Object.keys(b)) out[key] = key in a ? deepMergeTwo(a[key], b[key]) : b[key];
410
- return out;
411
- }
412
- return b;
413
- }
414
- /**
415
- * Default option-set merge when a service declares no `mergeOptions`:
416
- * deep-merge in declaration order: objects recurse, arrays union-dedupe,
417
- * scalars take the later value. Covers the built-in services (`roots` /
418
- * `langs` union, `themes` per-key last-wins) without a custom hook.
419
- */
420
- function deepMergeOptionSets(sets) {
421
- return sets.reduce((merged, set) => deepMergeTwo(merged, set));
422
- }
423
- //#endregion
424
- export { DevframeAgentHost as a, satisfiesVersionRange as i, expandResolveFrom as n, coerceAgentPositionalArgs as o, importServicePackage as r, createEventEmitter as s, deepMergeOptionSets as t };
277
+ export { coerceAgentPositionalArgs as n, createEventEmitter as r, DevframeAgentHost as t };
@@ -1,5 +1,5 @@
1
1
  import { D as InferArgsType, E as Thenable, O as InferReturnType, T as RpcReturnSchema, i as RpcArgsSchema } from "../types-Dq4i156u.mjs";
2
- import { Bt as EventEmitter, k as SharedState } from "../context-4AIVRLYF.mjs";
2
+ import { Vt as EventEmitter, k as SharedState } from "../context-CHW4BZOj.mjs";
3
3
  import { BirpcReturn } from "birpc";
4
4
  //#region src/in-page-channel/types.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-4AIVRLYF.mjs";
2
- import { n as InternalAnonymousAuthStorage } from "./context-rgBSPFHS.mjs";
1
+ import { k as SharedState, o as DevframeNodeContext, s as DevframeNodeRpcSession } from "./context-CHW4BZOj.mjs";
2
+ import { n as InternalAnonymousAuthStorage } from "./context-BJiKJqyW.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-pIVt92jP.mjs";
2
2
  import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-Dq4i156u.mjs";
3
3
  import { c as DevframeNodeRpcSessionMeta, d as DevframeRpcTransportKind, l as DevframeRpcConnection, u as DevframeRpcConnectionRequest } from "./ws-server-D2nv68Hg.mjs";
4
- import { $ as DevframeServiceScopeOf, At as AgentManifest, B as DevframeSetupInfo, Bt as EventEmitter, Ct as DevframeDiagnosticsLogger, F as DevframeDefinition, Ft as AgentToolInput, G as McpAuthorization, H as DevframeSnapshotRpcInputs, Ht as EventsMap, I as DevframeDeploymentKind, It as AgentToolProvider, J as DevframeServiceDescriptor, K as McpRouteOptions, L as DevframeDockDefaults, Lt as AgentToolProviderHandle, Mt as AgentResourceContent, Nt as AgentResourceInput, P as DevframeCliOptions, Pt as AgentTool, Q as DevframeServiceOf, R as DevframeDuplicationStrategy, Rt as DevframeAgentHost, St as DevframeDiagnosticsHost, U as DevframeSseOptions, V as DevframeSnapshotRpcEntry, Vt as EventUnsubscribe, W as DevframeWsOptions, X as DevframeServiceInput, Y as DevframeServiceId, Z as DevframeServiceMeta, _t as DevframeRpcClientFunctions, a as DevframeConnectionConfigsRegistry, at as DevframeScopedNodeRpc, bt as DevframeHost, c as RpcBroadcastOptions, ct as DevframeSettingsRegistry, d as RpcSharedStateHost, dt as ScopedClientFunctions, et as DevframeServicesHost, f as RpcStreamingChannel, ft as ScopedRpcFn, gt as DevframeViewHost, ht as SettingsForNamespace, i as DevframeCapabilities, it as DevframeScopedNodeContext, jt as AgentResource, kt as AgentHandle, l as RpcFunctionsHost, lt as DevframeSettingsStore, m as RpcStreamingHost, mt as ScopedSharedStates, n as ConnectionMetaSse, nt as DevframeServicesScopeRegistry, o as DevframeNodeContext, ot as DevframeScopedStreamingHost, p as RpcStreamingChannelOptions, pt as ScopedServerFunctions, q as DevframeServiceDefinition, r as ConnectionMetaWebsocket, rt as DevframeServicesState, s as DevframeNodeRpcSession, st as DevframeSettings, t as ConnectionMeta, tt as DevframeServicesRegistry, u as RpcSharedStateGetOptions, ut as ScopedBroadcastOptions, vt as DevframeRpcServerFunctions, xt as DevframeStorageScope, yt as DevframeRpcSharedStates, z as DevframeRpcOptions, zt as DevframeAgentHostEvents } from "./context-4AIVRLYF.mjs";
4
+ import { $ as DevframeServiceOf, At as AgentHandle, B as DevframeSetupInfo, Bt as DevframeAgentHostEvents, Ct as DevframeDiagnosticsHost, F as DevframeDefinition, Ft as AgentTool, G as McpAuthorization, H as DevframeSnapshotRpcInputs, Ht as EventUnsubscribe, I as DevframeDeploymentKind, It as AgentToolInput, J as DevframeServiceDefinition, K as McpRouteOptions, L as DevframeDockDefaults, Lt as AgentToolProvider, Mt as AgentResource, Nt as AgentResourceContent, P as DevframeCliOptions, Pt as AgentResourceInput, Q as DevframeServiceMeta, R as DevframeDuplicationStrategy, Rt as AgentToolProviderHandle, St as DevframeStorageScope, U as DevframeSseOptions, Ut as EventsMap, V as DevframeSnapshotRpcEntry, Vt as EventEmitter, W as DevframeWsOptions, X as DevframeServiceId, Y as DevframeServiceDescriptor, Z as DevframeServiceInput, _t as DevframeViewHost, a as DevframeConnectionConfigsRegistry, at as DevframeScopedNodeContext, bt as DevframeRpcSharedStates, c as RpcBroadcastOptions, ct as DevframeSettings, d as RpcSharedStateHost, dt as ScopedBroadcastOptions, et as DevframeServiceScopeOf, f as RpcStreamingChannel, ft as ScopedClientFunctions, gt as SettingsForNamespace, ht as ScopedSharedStates, i as DevframeCapabilities, it as DevframeServicesState, jt as AgentManifest, l as RpcFunctionsHost, lt as DevframeSettingsRegistry, m as RpcStreamingHost, mt as ScopedServerFunctions, n as ConnectionMetaSse, nt as DevframeServicesRegistry, o as DevframeNodeContext, ot as DevframeScopedNodeRpc, p as RpcStreamingChannelOptions, pt as ScopedRpcFn, q as McpSetting, r as ConnectionMetaWebsocket, rt as DevframeServicesScopeRegistry, s as DevframeNodeRpcSession, st as DevframeScopedStreamingHost, t as ConnectionMeta, tt as DevframeServicesHost, u as RpcSharedStateGetOptions, ut as DevframeSettingsStore, vt as DevframeRpcClientFunctions, wt as DevframeDiagnosticsLogger, xt as DevframeHost, yt as DevframeRpcServerFunctions, z as DevframeRpcOptions, zt as DevframeAgentHost } from "./context-CHW4BZOj.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-eBvSKZMS.mjs";
6
6
  import { i as DevframeDefineDiagnosticsOptions } from "./nostics-0sKe5HIj.mjs";
7
7
  //#region src/define.d.ts
@@ -18,4 +18,4 @@ declare function defineDevframe(d: DevframeDefinition): DevframeDefinition;
18
18
  */
19
19
  declare function resolveClientAssets(d: DevframeDefinition): StaticAssetsSource | undefined;
20
20
  //#endregion
21
- export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type AgentToolProvider, type AgentToolProviderHandle, type ConnectionMeta, type ConnectionMetaSse, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeCapabilities, type DevframeCliOptions, type DevframeConnectionConfigsRegistry, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcOptions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRpcTransportKind, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceDefinition, type DevframeServiceDescriptor, type DevframeServiceId, type DevframeServiceInput, type DevframeServiceMeta, type DevframeServiceOf, type DevframeServiceScopeOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeServicesScopeRegistry, type DevframeServicesState, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSnapshotRpcEntry, type DevframeSnapshotRpcInputs, type DevframeSseOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpAuthorization, type McpRouteOptions, type RemoteAssets, type RemoteAssetsErrorMessage, type RemoteAssetsProvider, type RemoteAssetsProviderCustom, type RemoteAssetsStore, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type StaticAssetsSource, defineDevframe, defineRpcFunction, resolveClientAssets };
21
+ export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type AgentToolProvider, type AgentToolProviderHandle, type ConnectionMeta, type ConnectionMetaSse, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeCapabilities, type DevframeCliOptions, type DevframeConnectionConfigsRegistry, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, type DevframeRpcOptions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRpcTransportKind, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceDefinition, type DevframeServiceDescriptor, type DevframeServiceId, type DevframeServiceInput, type DevframeServiceMeta, type DevframeServiceOf, type DevframeServiceScopeOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeServicesScopeRegistry, type DevframeServicesState, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSnapshotRpcEntry, type DevframeSnapshotRpcInputs, type DevframeSseOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpAuthorization, type McpRouteOptions, type McpSetting, type RemoteAssets, type RemoteAssetsErrorMessage, type RemoteAssetsProvider, type RemoteAssetsProviderCustom, type RemoteAssetsStore, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedRpcFn, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type StaticAssetsSource, defineDevframe, defineRpcFunction, resolveClientAssets };
@@ -1,7 +1,7 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-B4iAMlE-.mjs";
2
- import { t as diagnostics } from "./diagnostics-BMfN8mb1.mjs";
3
- import process from "node:process";
2
+ import { t as diagnostics } from "./diagnostics-DZA6KQ_Z.mjs";
4
3
  import { join } from "pathe";
4
+ import process from "node:process";
5
5
  import { mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
6
6
  import { homedir } from "node:os";
7
7
  //#region src/node/instance-registry.ts
@@ -1,6 +1,6 @@
1
1
  import { c as DevframeNodeRpcSessionMeta, l as DevframeRpcConnection, n as WsOriginRegistry } from "./ws-server-D2nv68Hg.mjs";
2
- import { U as DevframeSseOptions, W as DevframeWsOptions, _t as DevframeRpcClientFunctions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta, vt as DevframeRpcServerFunctions, wt as DevframeAuthHandler } from "./context-4AIVRLYF.mjs";
3
- import "./index-pKl67H6w.mjs";
2
+ import { Tt as DevframeAuthHandler, U as DevframeSseOptions, W as DevframeWsOptions, o as DevframeNodeContext, s as DevframeNodeRpcSession, t as ConnectionMeta, vt as DevframeRpcClientFunctions, yt as DevframeRpcServerFunctions } from "./context-CHW4BZOj.mjs";
3
+ import "./index-CNC390b_.mjs";
4
4
  import { BirpcGroup } from "birpc";
5
5
  import { NodeAdapter } from "crossws/adapters/node";
6
6
  import { Buffer } from "node:buffer";
@@ -1,26 +1,13 @@
1
1
  import "./constants.mjs";
2
2
  import { r as validateOriginCandidate } from "./origin-DZit9g29.mjs";
3
- import { t as diagnostics } from "./diagnostics-BMfN8mb1.mjs";
4
- import { r as importServicePackage } from "./services-install-P_DV7VYL.mjs";
5
- import { t as getInternalContext } from "./context-DIUvJW4D.mjs";
3
+ import { t as diagnostics } from "./diagnostics-DZA6KQ_Z.mjs";
4
+ import { t as getInternalContext } from "./context-jXO5vzjH.mjs";
6
5
  import { createInteractiveAuth } from "./recipes/interactive-auth.mjs";
7
6
  import { createServer } from "node:http";
8
7
  import process from "node:process";
9
8
  import { isIP } from "node:net";
10
9
  import { joinURL, withLeadingSlash, withoutLeadingSlash, withoutTrailingSlash } from "ufo";
11
10
  import { H3, defineHandler, toNodeHandler } from "h3";
12
- //#region src/node/import-runtime-module.ts
13
- /**
14
- * Resolve and import a package at runtime without adding it to a consumer's
15
- * bundle graph. First-party adapters use this for optional peers whose code
16
- * is needed only when the matching feature is enabled.
17
- *
18
- * @internal
19
- */
20
- async function importRuntimeModule(specifier) {
21
- return await importServicePackage(specifier, [import.meta.url]);
22
- }
23
- //#endregion
24
11
  //#region src/node/runtime.ts
25
12
  /**
26
13
  * Detect the current server runtime from its runtime-specific global. The
@@ -330,7 +317,7 @@ function createInstanceShell(options) {
330
317
  const origin = currentOrigin();
331
318
  if (!cfg || registerPromise || !origin || !meta) return;
332
319
  const resolvedMeta = meta;
333
- registerPromise = import("./instance-registry-C7-41RSp.mjs").then((n) => n.t).then(({ registerDevframeInstance }) => {
320
+ registerPromise = import("./instance-registry-DCq762YJ.mjs").then((n) => n.t).then(({ registerDevframeInstance }) => {
334
321
  let port = 0;
335
322
  try {
336
323
  const url = new URL(origin);
@@ -402,7 +389,7 @@ function createInstanceShell(options) {
402
389
  let resolvedAuth = false;
403
390
  let corePromise;
404
391
  function ensureCore() {
405
- corePromise ??= import("./rpc-core-DVQ7xi89.mjs").then((n) => n.n).then(({ createContextRpcServer }) => createContextRpcServer({
392
+ corePromise ??= import("./rpc-core-CvkU23bQ.mjs").then((n) => n.n).then(({ createContextRpcServer }) => createContextRpcServer({
406
393
  context: ctx,
407
394
  auth: resolvedAuth,
408
395
  onPeerConnect: options.onPeerConnect,
@@ -665,4 +652,4 @@ function createInstanceShell(options) {
665
652
  };
666
653
  }
667
654
  //#endregion
668
- export { importRuntimeModule as a, normalizeHttpServerUrl as i, resolveInstanceRegister as n, samePath as r, createInstanceShell as t };
655
+ export { normalizeHttpServerUrl as i, resolveInstanceRegister as n, samePath as r, createInstanceShell as t };
@@ -1,9 +1,9 @@
1
1
  import { v as RpcFunctionDefinitionAny } from "../types-Dq4i156u.mjs";
2
- import { At as AgentManifest, Bt as EventEmitter, F as DevframeDefinition, Ft as AgentToolInput, It as AgentToolProvider, Lt as AgentToolProviderHandle, Mt as AgentResourceContent, Nt as AgentResourceInput, Pt as AgentTool, Rt as DevframeAgentHost$1, bt as DevframeHost, jt as AgentResource, kt as AgentHandle, o as DevframeNodeContext, zt as DevframeAgentHostEvents } from "../context-4AIVRLYF.mjs";
2
+ import { At as AgentHandle, Bt as DevframeAgentHostEvents, F as DevframeDefinition, Ft as AgentTool, It as AgentToolInput, Lt as AgentToolProvider, Mt as AgentResource, Nt as AgentResourceContent, Pt as AgentResourceInput, Rt as AgentToolProviderHandle, Vt as EventEmitter, jt as AgentManifest, o as DevframeNodeContext, xt as DevframeHost, zt as DevframeAgentHost$1 } from "../context-CHW4BZOj.mjs";
3
3
  import { a as RemoteAssetsStore, o as StaticAssetsSource } from "../remote-assets-eBvSKZMS.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-7Z52PE4_.mjs";
5
- import { i as resolveBasePath, n as ResolvedMcpConfig, o as resolveMcpConfig, r as normalizeBasePath } from "../_shared-CK3czkH4.mjs";
6
- import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-Ceu6AUz8.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-DZipaP9k.mjs";
5
+ import { a as resolveBasePath, i as normalizeBasePath, n as ResolvedMcpConfig, r as loadAutoMcpAdapter, s as resolveMcpConfig } from "../_shared-CCzf9Hub.mjs";
6
+ import { n as CreateContextRpcServerOptions, r as createContextRpcServer, t as ContextRpcServer } from "../rpc-core-DsyDViQy.mjs";
7
7
  //#region src/client-assets.d.ts
8
8
  /**
9
9
  * Resolve a definition's client assets source: the built SPA served as its
@@ -175,7 +175,7 @@ declare const diagnostics: import("nostics").Diagnostics<{
175
175
  readonly why: (p: {
176
176
  reason: string;
177
177
  }) => string;
178
- readonly fix: "Install it next to devframe (e.g. `npm install @modelcontextprotocol/server`) and run `devframe connect` again.";
178
+ readonly fix: "Install it next to devframe (e.g. `npm install @modelcontextprotocol/client`) and run `devframe connect` again.";
179
179
  };
180
180
  readonly DF0047: {
181
181
  readonly why: (p: {
@@ -350,7 +350,7 @@ declare const diagnostics: import("nostics").Diagnostics<{
350
350
  readonly why: (p: {
351
351
  runtime: string;
352
352
  }) => string;
353
- readonly fix: "On Bun/Deno, serve the advertised `__ws` route from `Bun.serve` / `Deno.serve` with `attachBunWsTransport` / `attachDenoWsTransport` (see the hub-deno-minimal example), or connect over the SSE endpoint instead.";
353
+ readonly fix: "On Bun/Deno, serve the advertised `__ws` route from `Bun.serve` / `Deno.serve` with `attachBunWsTransport` / `attachDenoWsTransport` (see the hub-deno example), or connect over the SSE endpoint instead.";
354
354
  };
355
355
  }, readonly [(d: import("nostics").Diagnostic, { method }?: {
356
356
  method?: "log" | "warn" | "error";
@@ -377,6 +377,7 @@ declare class DevframeAgentHost implements DevframeAgentHost$1 {
377
377
  registerResource(input: AgentResourceInput): AgentHandle;
378
378
  unregisterResource(id: string): boolean;
379
379
  list(): AgentManifest;
380
+ hasSurface(): boolean;
380
381
  getTool(id: string): AgentTool | undefined;
381
382
  getResource(id: string): AgentResource | undefined;
382
383
  invoke(id: string, args: unknown): Promise<unknown>;
@@ -431,8 +432,9 @@ declare function createH3DevframeHost(options: CreateH3DevframeHostOptions): Dev
431
432
  //#region src/node/import-runtime-module.d.ts
432
433
  /**
433
434
  * Resolve and import a package at runtime without adding it to a consumer's
434
- * bundle graph. First-party adapters use this for optional peers whose code
435
- * is needed only when the matching feature is enabled.
435
+ * bundle graph. First-party adapters use this for modules whose code is
436
+ * needed only when the matching feature is enabled (optional peers, and the
437
+ * MCP adapter with the SDK behind it).
436
438
  *
437
439
  * @internal
438
440
  */
@@ -476,4 +478,4 @@ declare function peekRpcWireFrame(raw: string): {
476
478
  i?: string;
477
479
  };
478
480
  //#endregion
479
- 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 ResolvedMcpConfig, type RpcWireCodec, type StartedServer, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveClientAssets, resolveInstanceRegister, resolveMcpConfig, samePath };
481
+ 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 ResolvedMcpConfig, type RpcWireCodec, type StartedServer, coerceAgentPositionalArgs, createContextRpcServer, createH3DevframeHost, createInstanceShell, createRpcWireCodec, diagnostics, importRuntimeModule, listLiveDevframeInstances, loadAutoMcpAdapter, normalizeBasePath, normalizeHttpServerUrl, peekRpcWireFrame, registerDevframeInstance, resolveBasePath, resolveClientAssets, resolveInstanceRegister, resolveMcpConfig, samePath };