devframe 0.7.3 → 0.7.5

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 (45) hide show
  1. package/dist/adapters/build.d.mts +1 -1
  2. package/dist/adapters/build.mjs +1 -1
  3. package/dist/adapters/cac.d.mts +1 -1
  4. package/dist/adapters/cac.mjs +1 -1
  5. package/dist/adapters/cli.d.mts +1 -1
  6. package/dist/adapters/cli.mjs +1 -1
  7. package/dist/adapters/dev.d.mts +2 -2
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/mcp.d.mts +1 -1
  11. package/dist/adapters/mcp.mjs +1 -1
  12. package/dist/{build-server-Bo0G5XcS.mjs → build-server-D5-9okV6.mjs} +7 -3
  13. package/dist/{cac-BFCgKymz.mjs → cac-Dr-qCdgQ.mjs} +2 -2
  14. package/dist/client/index.d.mts +18 -2
  15. package/dist/client/index.mjs +27 -4
  16. package/dist/{context-CKJheEtf.mjs → context-ClRdkpJ7.mjs} +1 -1
  17. package/dist/{context-B1sekkgB.d.mts → context-DxFsOWkc.d.mts} +1 -1
  18. package/dist/{dev-Bs4oRVnI.mjs → dev-D6Hcv4v8.mjs} +20 -7
  19. package/dist/{devframe-CnTVuGw9.d.mts → devframe-WHtcqYlZ.d.mts} +705 -554
  20. package/dist/helpers/vite.d.mts +1 -1
  21. package/dist/helpers/vite.mjs +2 -2
  22. package/dist/{host-h3-Dsf-Tgwx.mjs → host-h3-A8CXZoS5.mjs} +62 -6
  23. package/dist/{http-BirzlyE9.mjs → http-Fxm-0_V7.mjs} +1 -1
  24. package/dist/{index-Dpsr-8dD.d.mts → index-Cj0M3G3F.d.mts} +3 -47
  25. package/dist/index.d.mts +3 -3
  26. package/dist/node/auth.d.mts +2 -1
  27. package/dist/node/hub-internals.d.mts +2 -2
  28. package/dist/node/hub-internals.mjs +1 -1
  29. package/dist/node/index.d.mts +25 -33
  30. package/dist/node/index.mjs +4 -4
  31. package/dist/recipes/interactive-auth.d.mts +2 -2
  32. package/dist/recipes/interactive-auth.mjs +1 -1
  33. package/dist/recipes/open-helpers.d.mts +1 -1
  34. package/dist/rpc/transports/ws-server.d.mts +1 -1
  35. package/dist/{server-4QH37sb-.d.mts → server-BRxA2OAh.d.mts} +3 -3
  36. package/dist/{server-CRFYfRqK.mjs → server-DvrOR1LG.mjs} +2 -2
  37. package/dist/{storage-yrUZaiib.mjs → storage-E9KrCsLr.mjs} +4 -0
  38. package/dist/types/index.d.mts +3 -3
  39. package/dist/utils/events.d.mts +1 -1
  40. package/dist/utils/serve-static.d.mts +4 -6
  41. package/dist/utils/serve-static.mjs +8 -14
  42. package/dist/utils/shared-state.d.mts +1 -1
  43. package/dist/utils/streaming-channel.d.mts +1 -1
  44. package/dist/{ws-server-CceOy6He.d.mts → ws-server-9-wn7MNQ.d.mts} +1 -1
  45. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-CnTVuGw9.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
2
2
  //#region src/helpers/vite.d.ts
3
3
  interface ViteDevBridgeOptions {
4
4
  /**
@@ -1,8 +1,8 @@
1
1
  import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constants.mjs";
2
- import { a as diagnostics } from "../storage-yrUZaiib.mjs";
2
+ import { a as diagnostics } from "../storage-E9KrCsLr.mjs";
3
3
  import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
4
4
  import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
5
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-Bs4oRVnI.mjs";
5
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-D6Hcv4v8.mjs";
6
6
  import { resolve } from "pathe";
7
7
  //#region src/helpers/vite.ts
8
8
  /**
@@ -2,7 +2,7 @@ import { t as devframeReporter } from "./diagnostics-reporter-CsIG85Q5.mjs";
2
2
  import { t as diagnostics } from "./diagnostics-BXwBQmoN.mjs";
3
3
  import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
4
4
  import { defineRpcFunction } from "./index.mjs";
5
- import { a as diagnostics$1, i as createEventEmitter, n as createSharedState, r as nanoid, t as createStorage } from "./storage-yrUZaiib.mjs";
5
+ import { a as diagnostics$1, i as createEventEmitter, n as createSharedState, r as nanoid, t as createStorage } from "./storage-E9KrCsLr.mjs";
6
6
  import { defineDiagnostics } from "nostics";
7
7
  import { isatty } from "node:tty";
8
8
  import { formatWithOptions, inspect } from "node:util";
@@ -1144,7 +1144,16 @@ function createRpcStreamingServerHost(rpc) {
1144
1144
  //#endregion
1145
1145
  //#region src/node/host-functions.ts
1146
1146
  const debugBroadcast = createDebug("devframe:rpc:broadcast");
1147
- var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
1147
+ /**
1148
+ * Concrete implementation backing `ctx.rpc`. Internal: consumers should
1149
+ * depend on the structural {@link RpcFunctionsHost} type, never this class.
1150
+ * Its `@internal` members (`_rpcGroup`, `_asyncStorage`,
1151
+ * `_emitSessionDisconnected`) are wired by `startHttpAndWs` and must not
1152
+ * widen the public surface.
1153
+ *
1154
+ * @internal
1155
+ */
1156
+ var RpcFunctionsHostImpl = class extends RpcFunctionsCollectorBase {
1148
1157
  /**
1149
1158
  * @internal
1150
1159
  */
@@ -1190,6 +1199,49 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
1190
1199
  }
1191
1200
  };
1192
1201
  //#endregion
1202
+ //#region src/node/host-services.ts
1203
+ /**
1204
+ * Cross-plugin service registry (see `types/services.ts` for the contract).
1205
+ * Values are held per context instance; `whenAvailable` subscriptions make
1206
+ * the mechanism robust against setup ordering between provider and consumer.
1207
+ */
1208
+ var DevframeServicesHostImpl = class {
1209
+ services = /* @__PURE__ */ new Map();
1210
+ listeners = /* @__PURE__ */ new Map();
1211
+ provide(id, service) {
1212
+ const key = id;
1213
+ if (this.services.has(key)) throw diagnostics$1.DF0037({ id: key });
1214
+ this.services.set(key, service);
1215
+ for (const listener of this.listeners.get(key) ?? []) listener(service);
1216
+ return () => {
1217
+ if (this.services.get(key) === service) this.services.delete(key);
1218
+ };
1219
+ }
1220
+ get(id) {
1221
+ return this.services.get(id);
1222
+ }
1223
+ has(id) {
1224
+ return this.services.has(id);
1225
+ }
1226
+ whenAvailable(id, callback) {
1227
+ const key = id;
1228
+ if (this.services.has(key)) callback(this.services.get(key));
1229
+ let set = this.listeners.get(key);
1230
+ if (!set) {
1231
+ set = /* @__PURE__ */ new Set();
1232
+ this.listeners.set(key, set);
1233
+ }
1234
+ const listener = callback;
1235
+ set.add(listener);
1236
+ return () => {
1237
+ set.delete(listener);
1238
+ };
1239
+ }
1240
+ keys() {
1241
+ return Array.from(this.services.keys());
1242
+ }
1243
+ };
1244
+ //#endregion
1193
1245
  //#region src/node/host-views.ts
1194
1246
  var DevframeViewHost = class {
1195
1247
  context;
@@ -1283,7 +1335,7 @@ function qualifyName(namespace, name) {
1283
1335
  //#region src/node/settings.ts
1284
1336
  const STORAGE_SCOPE = {
1285
1337
  global: "global",
1286
- project: "workspace"
1338
+ project: "project"
1287
1339
  };
1288
1340
  function createNodeSettingsStore(context, namespace, scope) {
1289
1341
  const stateKey = `devframe:settings:${scope}:${namespace}`;
@@ -1403,14 +1455,16 @@ async function createHostContext(options) {
1403
1455
  views: void 0,
1404
1456
  diagnostics: void 0,
1405
1457
  agent: void 0,
1458
+ services: void 0,
1406
1459
  scope: void 0
1407
1460
  };
1408
- const rpcHost = new RpcFunctionsHost(context);
1461
+ const rpcHost = new RpcFunctionsHostImpl(context);
1409
1462
  const viewsHost = new DevframeViewHost(context);
1410
1463
  const diagnosticsHost = new DevframeDiagnosticsHost(context, [diagnostics$1, diagnostics]);
1411
1464
  context.rpc = rpcHost;
1412
1465
  context.views = viewsHost;
1413
1466
  context.diagnostics = diagnosticsHost;
1467
+ context.services = new DevframeServicesHostImpl();
1414
1468
  context.agent = new DevframeAgentHost(context);
1415
1469
  const scopedCache = /* @__PURE__ */ new Map();
1416
1470
  context.scope = ((namespace) => {
@@ -1442,9 +1496,11 @@ function createH3DevframeHost(options) {
1442
1496
  },
1443
1497
  getStorageDir(scope) {
1444
1498
  const namespace = `.${options.appName}/devframe`;
1445
- return scope === "workspace" ? join(workspaceRoot, "node_modules", namespace) : join(homedir(), namespace);
1499
+ if (scope === "workspace") return join(workspaceRoot, ".devframe");
1500
+ if (scope === "project") return join(workspaceRoot, "node_modules", namespace);
1501
+ return join(homedir(), namespace);
1446
1502
  }
1447
1503
  };
1448
1504
  }
1449
1505
  //#endregion
1450
- export { DevframeViewHost as a, createRpcSharedStateServerHost as c, createNodeSettings as i, DevframeDiagnosticsHost as l, createHostContext as n, RpcFunctionsHost as o, createScopedNodeContext as r, createRpcStreamingServerHost as s, createH3DevframeHost as t, DevframeAgentHost as u };
1506
+ export { DevframeViewHost as a, createRpcSharedStateServerHost as c, createNodeSettings as i, DevframeDiagnosticsHost as l, createHostContext as n, DevframeServicesHostImpl as o, createScopedNodeContext as r, createRpcStreamingServerHost as s, createH3DevframeHost as t, DevframeAgentHost as u };
@@ -1,5 +1,5 @@
1
1
  import { isAllowedOrigin } from "./rpc/transports/ws-server.mjs";
2
- import { t as buildMcpServerFromContext } from "./build-server-Bo0G5XcS.mjs";
2
+ import { t as buildMcpServerFromContext } from "./build-server-D5-9okV6.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { defineHandler } from "h3";
5
5
  import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
@@ -1,49 +1,5 @@
1
- import { _ as DevframeNodeRpcSession, g as DevframeNodeContext, z as SharedState } from "./devframe-CnTVuGw9.mjs";
2
- import { v as RpcFunctionDefinitionAny } from "./types-CrzNxXKq.mjs";
3
- import "./index-DgsLFhZg.mjs";
4
- import { n as InternalAnonymousAuthStorage } from "./context-B1sekkgB.mjs";
5
- import { Peer } from "crossws";
6
- //#region src/node/auth/handler.d.ts
7
- /**
8
- * A ready-made pre-auth RPC handler, as produced by
9
- * `devframe/recipes/interactive-auth`'s `createInteractiveAuth`. Bundles
10
- * everything a host adapter needs to wire an authenticated server:
11
- * the handshake RPC functions, the resolver gate, the connect-time trust
12
- * hook, and the startup banner.
13
- *
14
- * `startHttpAndWs` accepts one of these directly via its `auth` option —
15
- * see {@link https://devfra.me | devframe}'s server docs — or a host can
16
- * wire the four pieces itself against a lower-level transport.
17
- */
18
- interface DevframeAuthHandler {
19
- /**
20
- * `anonymous:devframe:auth` + `anonymous:devframe:auth:exchange` (the
21
- * handshake) and `devframe:auth:revoke` (self-revoke) — register these on
22
- * the RPC host (e.g. `rpcHost.register(fn)` for each).
23
- */
24
- rpcFunctions: RpcFunctionDefinitionAny[];
25
- /**
26
- * Resolver gate: whether `methodName` is callable given `session`'s
27
- * current trust state. Defaults to allowing any `anonymous:`-prefixed
28
- * method (see `isAnonymousRpcMethod`) plus anything once the session is
29
- * trusted.
30
- */
31
- authorize: (methodName: string, session: DevframeNodeRpcSession) => boolean;
32
- /**
33
- * Connect-time trust: reads a bearer token off the peer's upgrade request
34
- * (an `Authorization: Bearer <token>` header, or a static/pre-shared
35
- * token from `clientAuthTokens`) and, when valid, marks the session
36
- * trusted immediately — before the client's own handshake call.
37
- */
38
- onConnect: (peer: Peer, session: DevframeNodeRpcSession) => void;
39
- /**
40
- * Print the current one-time code and its magic-link URL. Devframe stays
41
- * headless — call this yourself once the server is listening. Safe to
42
- * call repeatedly; it only prints once per code.
43
- */
44
- printBanner: () => void;
45
- }
46
- //#endregion
1
+ import { U as DevframeNodeRpcSession, b as DevframeNodeContext, mt as SharedState } from "./devframe-WHtcqYlZ.mjs";
2
+ import { n as InternalAnonymousAuthStorage } from "./context-DxFsOWkc.mjs";
47
3
  //#region src/node/auth/revoke.d.ts
48
4
  /**
49
5
  * Flip `isTrusted` to false on any live WS clients connected with `token`
@@ -104,4 +60,4 @@ declare function exchangeTempAuthCode(code: string, session: DevframeNodeRpcSess
104
60
  origin: string;
105
61
  }, storage: SharedState<InternalAnonymousAuthStorage>): string | null;
106
62
  //#endregion
107
- export { verifyAuthToken as a, DevframeAuthHandler as c, refreshTempAuthCode as i, exchangeTempAuthCode as n, revokeActiveConnectionsForToken as o, getTempAuthCode as r, revokeAuthToken as s, buildOtpAuthUrl as t };
63
+ export { verifyAuthToken as a, refreshTempAuthCode as i, exchangeTempAuthCode as n, revokeActiveConnectionsForToken as o, getTempAuthCode as r, revokeAuthToken as s, buildOtpAuthUrl as t };
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- import { $ as ScopedBroadcastOptions, C as RpcStreamingChannelOptions, Ct as EventUnsubscribe, G as PartialWithoutId, J as DevframeScopedNodeRpc, K as Thenable, Q as DevframeSettingsStore, S as RpcStreamingChannel, St as EventEmitter, W as EntriesToObject, X as DevframeSettings, Y as DevframeScopedStreamingHost, Z as DevframeSettingsRegistry, _ as DevframeNodeRpcSession, _t as AgentResourceInput, a as DevframeDockDefaults, at as DevframeRpcClientFunctions, b as RpcSharedStateGetOptions, bt as DevframeAgentHost, c as DevframeSetupInfo, ct as DevframeHost, d as McpRouteOptions, dt as DevframeDiagnosticsHost, et as ScopedClientFunctions, f as defineDevframe, ft as DevframeDiagnosticsLogger, g as DevframeNodeContext, gt as AgentResourceContent, h as DevframeCapabilities, ht as AgentResource, i as DevframeDeploymentKind, it as DevframeViewHost, l as DevframeSpaOptions, lt as DevframeDefineDiagnosticsOptions, m as ConnectionMetaWebsocket, mt as AgentManifest, n as DevframeCliOptions, nt as ScopedSharedStates, o as DevframeDuplicationStrategy, ot as DevframeRpcServerFunctions, p as ConnectionMeta, pt as AgentHandle, q as DevframeScopedNodeContext, r as DevframeDefinition, rt as SettingsForNamespace, s as DevframeRuntime, st as DevframeRpcSharedStates, t as DevframeBrowserContext, tt as ScopedServerFunctions, u as DevframeWsOptions, ut as DevframeDiagnosticsDefinition, v as RpcBroadcastOptions, vt as AgentTool, w as RpcStreamingHost, wt as EventsMap, x as RpcSharedStateHost, xt as DevframeAgentHostEvents, y as RpcFunctionsHost, yt as AgentToolInput } from "./devframe-CnTVuGw9.mjs";
1
+ import { $ as DevframeRpcSharedStates, A as DevframeSettingsStore, At as EventsMap, B as DevframeDiagnosticsDefinition, C as DevframeServicesHost, Ct as AgentResourceInput, D as DevframeScopedStreamingHost, Dt as DevframeAgentHostEvents, E as DevframeScopedNodeRpc, Et as DevframeAgentHost, F as SettingsForNamespace, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost, J as RpcStreamingChannel, K as RpcSharedStateGetOptions, L as DevframeHost, M as ScopedClientFunctions, N as ScopedServerFunctions, O as DevframeSettings, Ot as EventEmitter, P as ScopedSharedStates, Q as DevframeRpcServerFunctions, R as DevframeStorageScope, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, U as DevframeNodeRpcSession, V as DevframeDiagnosticsHost, W as RpcBroadcastOptions, X as RpcStreamingHost, Y as RpcStreamingChannelOptions, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentManifest, c as DevframeSetupInfo, d as McpRouteOptions, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, k as DevframeSettingsRegistry, kt as EventUnsubscribe, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateHost, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, y as DevframeCapabilities, yt as AgentHandle, z as DevframeDefineDiagnosticsOptions } from "./devframe-WHtcqYlZ.mjs";
2
2
  import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-CrzNxXKq.mjs";
3
3
  import "./index-DgsLFhZg.mjs";
4
- import { t as DevframeNodeRpcSessionMeta } from "./ws-server-CceOy6He.mjs";
4
+ import { t as DevframeNodeRpcSessionMeta } from "./ws-server-9-wn7MNQ.mjs";
5
5
  //#region src/define.d.ts
6
6
  declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>;
7
7
  //#endregion
8
- export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type ConnectionMeta, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
8
+ export { type AgentHandle, type AgentManifest, type AgentResource, type AgentResourceContent, type AgentResourceInput, type AgentTool, type AgentToolInput, type ConnectionMeta, type ConnectionMetaWebsocket, type DevframeAgentHost, type DevframeAgentHostEvents, type DevframeBrowserContext, type DevframeCapabilities, type DevframeCliOptions, type DevframeDefineDiagnosticsOptions, type DevframeDefinition, type DevframeDeploymentKind, type DevframeDiagnosticsDefinition, type DevframeDiagnosticsHost, type DevframeDiagnosticsLogger, type DevframeDockDefaults, type DevframeDuplicationStrategy, type DevframeHost, type DevframeNodeContext, type DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, type DevframeRpcClientFunctions, type DevframeRpcServerFunctions, type DevframeRpcSharedStates, type DevframeRuntime, type DevframeScopedNodeContext, type DevframeScopedNodeRpc, type DevframeScopedStreamingHost, type DevframeServiceId, type DevframeServiceOf, type DevframeServicesHost, type DevframeServicesRegistry, type DevframeSettings, type DevframeSettingsRegistry, type DevframeSettingsStore, type DevframeSetupInfo, type DevframeSpaOptions, type DevframeStorageScope, type DevframeViewHost, type DevframeWsOptions, type EntriesToObject, type EventEmitter, type EventUnsubscribe, type EventsMap, type McpRouteOptions, type PartialWithoutId, type RpcBroadcastOptions, type RpcFunctionAgentOptions, type RpcFunctionsHost, type RpcSharedStateGetOptions, type RpcSharedStateHost, type RpcStreamingChannel, type RpcStreamingChannelOptions, type RpcStreamingHost, type ScopedBroadcastOptions, type ScopedClientFunctions, type ScopedServerFunctions, type ScopedSharedStates, type SettingsForNamespace, type Thenable, type defineDevframe, defineRpcFunction };
@@ -1,2 +1,3 @@
1
- import { a as verifyAuthToken, c as DevframeAuthHandler, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-Dpsr-8dD.mjs";
1
+ import { p as DevframeAuthHandler } from "../devframe-WHtcqYlZ.mjs";
2
+ import { a as verifyAuthToken, i as refreshTempAuthCode, n as exchangeTempAuthCode, o as revokeActiveConnectionsForToken, r as getTempAuthCode, s as revokeAuthToken, t as buildOtpAuthUrl } from "../index-Cj0M3G3F.mjs";
2
3
  export { DevframeAuthHandler, buildOtpAuthUrl, exchangeTempAuthCode, getTempAuthCode, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
@@ -1,5 +1,5 @@
1
- import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-CnTVuGw9.mjs";
2
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-B1sekkgB.mjs";
1
+ import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
2
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-DxFsOWkc.mjs";
3
3
  //#region src/adapters/_shared.d.ts
4
4
  /**
5
5
  * Resolve the mount base path for a devframe's SPA. Hosted adapters
@@ -1,3 +1,3 @@
1
- import { n as internalContextMap, t as getInternalContext } from "../context-CKJheEtf.mjs";
1
+ import { n as internalContextMap, t as getInternalContext } from "../context-ClRdkpJ7.mjs";
2
2
  import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
3
3
  export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,10 +1,8 @@
1
- import { St as EventEmitter, X as DevframeSettings, _ as DevframeNodeRpcSession, _t as AgentResourceInput, at as DevframeRpcClientFunctions, bt as DevframeAgentHost$1, ct as DevframeHost, dt as DevframeDiagnosticsHost$1, ft as DevframeDiagnosticsLogger, g as DevframeNodeContext, gt as AgentResourceContent, ht as AgentResource, it as DevframeViewHost$1, mt as AgentManifest, ot as DevframeRpcServerFunctions, pt as AgentHandle, q as DevframeScopedNodeContext, v as RpcBroadcastOptions, vt as AgentTool, w as RpcStreamingHost, x as RpcSharedStateHost, xt as DevframeAgentHostEvents, y as RpcFunctionsHost$1, yt as AgentToolInput, z as SharedState } from "../devframe-CnTVuGw9.mjs";
1
+ import { C as DevframeServicesHost, Ct as AgentResourceInput, Dt as DevframeAgentHostEvents, Et as DevframeAgentHost$1, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost$1, L as DevframeHost, O as DevframeSettings, Ot as EventEmitter, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, V as DevframeDiagnosticsHost$1, X as RpcStreamingHost, b as DevframeNodeContext, bt as AgentManifest, mt as SharedState, q as RpcSharedStateHost, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, yt as AgentHandle } from "../devframe-WHtcqYlZ.mjs";
2
2
  import { v as RpcFunctionDefinitionAny } from "../types-CrzNxXKq.mjs";
3
- import { S as RpcFunctionsCollectorBase } from "../index-DgsLFhZg.mjs";
4
- import { t as DevframeNodeRpcSessionMeta } from "../ws-server-CceOy6He.mjs";
5
- import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-4QH37sb-.mjs";
3
+ import "../index-DgsLFhZg.mjs";
4
+ import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BRxA2OAh.mjs";
6
5
  import { BirpcGroup } from "birpc";
7
- import { AsyncLocalStorage } from "node:async_hooks";
8
6
  //#region src/node/context.d.ts
9
7
  interface CreateHostContextOptions {
10
8
  cwd: string;
@@ -72,29 +70,6 @@ declare class DevframeDiagnosticsHost implements DevframeDiagnosticsHost$1 {
72
70
  register(diagnostics: Record<string, unknown>): void;
73
71
  }
74
72
  //#endregion
75
- //#region src/node/host-functions.d.ts
76
- declare class RpcFunctionsHost extends RpcFunctionsCollectorBase<DevframeRpcServerFunctions, DevframeNodeContext> implements RpcFunctionsHost$1 {
77
- /**
78
- * @internal
79
- */
80
- _rpcGroup: BirpcGroup<DevframeRpcClientFunctions, DevframeRpcServerFunctions, false>;
81
- _asyncStorage: AsyncLocalStorage<DevframeNodeRpcSession>;
82
- constructor(context: DevframeNodeContext);
83
- sharedState: RpcSharedStateHost;
84
- streaming: RpcStreamingHost;
85
- /**
86
- * Adapters call this from their WS `onDisconnected` hook so downstream
87
- * hosts (streaming, …) can free per-session state. Public-ish because
88
- * tests / custom adapters may want to mirror it.
89
- *
90
- * @internal
91
- */
92
- _emitSessionDisconnected(meta: DevframeNodeRpcSessionMeta): void;
93
- invokeLocal<T extends keyof DevframeRpcServerFunctions, Args extends Parameters<DevframeRpcServerFunctions[T]>>(method: T, ...args: Args): Promise<Awaited<ReturnType<DevframeRpcServerFunctions[T]>>>;
94
- broadcast<T extends keyof DevframeRpcClientFunctions, Args extends Parameters<DevframeRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>): Promise<void>;
95
- getCurrentRpcSession(): DevframeNodeRpcSession | undefined;
96
- }
97
- //#endregion
98
73
  //#region src/node/host-h3.d.ts
99
74
  interface CreateH3DevframeHostOptions {
100
75
  /** The h3 app instance — registered once the CLI adapter lands. */
@@ -112,8 +87,9 @@ interface CreateH3DevframeHostOptions {
112
87
  mount?: (base: string, distDir: string) => void | Promise<void>;
113
88
  /**
114
89
  * Namespace for storage paths returned by `getStorageDir`. Workspace
115
- * state lives under `${workspaceRoot}/node_modules/.<appName>/devframe/`
116
- * and global state under `${homedir()}/.<appName>/devframe/`. Pick the
90
+ * state (committable) lives under `${workspaceRoot}/.devframe/`, project
91
+ * state under `${workspaceRoot}/node_modules/.<appName>/devframe/`, and
92
+ * global state under `${homedir()}/.<appName>/devframe/`. Pick the
117
93
  * devtool's id (or another stable, filesystem-safe identifier) so the
118
94
  * standalone host doesn't collide with other tools' storage.
119
95
  */
@@ -129,6 +105,22 @@ interface CreateH3DevframeHostOptions {
129
105
  */
130
106
  declare function createH3DevframeHost(options: CreateH3DevframeHostOptions): DevframeHost;
131
107
  //#endregion
108
+ //#region src/node/host-services.d.ts
109
+ /**
110
+ * Cross-plugin service registry (see `types/services.ts` for the contract).
111
+ * Values are held per context instance; `whenAvailable` subscriptions make
112
+ * the mechanism robust against setup ordering between provider and consumer.
113
+ */
114
+ declare class DevframeServicesHostImpl implements DevframeServicesHost {
115
+ private services;
116
+ private listeners;
117
+ provide<ID extends DevframeServiceId>(id: ID, service: DevframeServiceOf<ID>): () => void;
118
+ get<ID extends DevframeServiceId>(id: ID): DevframeServiceOf<ID> | undefined;
119
+ has(id: DevframeServiceId): boolean;
120
+ whenAvailable<ID extends DevframeServiceId>(id: ID, callback: (service: DevframeServiceOf<ID>) => void): () => void;
121
+ keys(): string[];
122
+ }
123
+ //#endregion
132
124
  //#region src/node/host-views.d.ts
133
125
  declare class DevframeViewHost implements DevframeViewHost$1 {
134
126
  readonly context: DevframeNodeContext;
@@ -144,7 +136,7 @@ declare class DevframeViewHost implements DevframeViewHost$1 {
144
136
  }
145
137
  //#endregion
146
138
  //#region src/node/rpc-shared-state.d.ts
147
- declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSharedStateHost;
139
+ declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost): RpcSharedStateHost;
148
140
  //#endregion
149
141
  //#region src/node/rpc-streaming.d.ts
150
142
  /**
@@ -153,7 +145,7 @@ declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSha
153
145
  * RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
154
146
  * state lives in a `Map<channelName, ChannelState>`.
155
147
  */
156
- declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost$1): RpcStreamingHost;
148
+ declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost): RpcStreamingHost;
157
149
  //#endregion
158
150
  //#region src/node/scope.d.ts
159
151
  /**
@@ -188,4 +180,4 @@ declare function toDialableHost(host: string): string;
188
180
  declare function formatHostForUrl(host: string): string;
189
181
  declare function normalizeHttpServerUrl(host: string, port: number | string): string;
190
182
  //#endregion
191
- export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
183
+ export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
@@ -1,4 +1,4 @@
1
- import { t as createStorage } from "../storage-yrUZaiib.mjs";
2
- import { a as DevframeViewHost, c as createRpcSharedStateServerHost, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as RpcFunctionsHost, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-Dsf-Tgwx.mjs";
3
- import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-CRFYfRqK.mjs";
4
- export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
1
+ import { t as createStorage } from "../storage-E9KrCsLr.mjs";
2
+ import { a as DevframeViewHost, c as createRpcSharedStateServerHost, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as DevframeServicesHostImpl, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-A8CXZoS5.mjs";
3
+ import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-DvrOR1LG.mjs";
4
+ export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
@@ -1,5 +1,5 @@
1
- import { g as DevframeNodeContext } from "../devframe-CnTVuGw9.mjs";
2
- import { c as DevframeAuthHandler } from "../index-Dpsr-8dD.mjs";
1
+ import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-WHtcqYlZ.mjs";
2
+ import "../index-Cj0M3G3F.mjs";
3
3
  //#region src/recipes/interactive-auth.d.ts
4
4
  interface CreateInteractiveAuthOptions {
5
5
  /**
@@ -1,7 +1,7 @@
1
1
  import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
2
2
  import { isAnonymousRpcMethod } from "../constants.mjs";
3
3
  import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
4
- import { t as getInternalContext } from "../context-CKJheEtf.mjs";
4
+ import { t as getInternalContext } from "../context-ClRdkpJ7.mjs";
5
5
  import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-WX3HT5a3.mjs";
6
6
  import * as v from "valibot";
7
7
  //#region src/recipes/interactive-auth.ts
@@ -1,4 +1,4 @@
1
- import "../devframe-CnTVuGw9.mjs";
1
+ import "../devframe-WHtcqYlZ.mjs";
2
2
  import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CrzNxXKq.mjs";
3
3
  import "../index-DgsLFhZg.mjs";
4
4
  import * as v from "valibot";
@@ -1,2 +1,2 @@
1
- import { a as isAllowedOrigin, i as attachWsRpcTransport, n as WsRpcTransport, o as isLoopbackHostname, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-CceOy6He.mjs";
1
+ import { a as isAllowedOrigin, i as attachWsRpcTransport, n as WsRpcTransport, o as isLoopbackHostname, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-9-wn7MNQ.mjs";
2
2
  export { DevframeNodeRpcSessionMeta, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport, isAllowedOrigin, isLoopbackHostname };
@@ -1,7 +1,7 @@
1
- import { _ as DevframeNodeRpcSession, at as DevframeRpcClientFunctions, g as DevframeNodeContext, ot as DevframeRpcServerFunctions, p as ConnectionMeta } from "./devframe-CnTVuGw9.mjs";
2
- import { c as DevframeAuthHandler } from "./index-Dpsr-8dD.mjs";
3
- import { BirpcGroup, EventOptions } from "birpc";
1
+ import { Q as DevframeRpcServerFunctions, U as DevframeNodeRpcSession, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, b as DevframeNodeContext, p as DevframeAuthHandler } from "./devframe-WHtcqYlZ.mjs";
2
+ import "./index-Cj0M3G3F.mjs";
4
3
  import { Peer } from "crossws";
4
+ import { BirpcGroup, EventOptions } from "birpc";
5
5
  import { NodeAdapter } from "crossws/adapters/node";
6
6
  import { Server } from "node:http";
7
7
  import { H3 } from "h3";
@@ -1,7 +1,7 @@
1
1
  import { createRpcServer } from "./rpc/server.mjs";
2
2
  import { attachWsRpcTransport } from "./rpc/transports/ws-server.mjs";
3
- import { a as diagnostics } from "./storage-yrUZaiib.mjs";
4
- import { t as getInternalContext } from "./context-CKJheEtf.mjs";
3
+ import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
4
+ import { t as getInternalContext } from "./context-ClRdkpJ7.mjs";
5
5
  import { createServer } from "node:http";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { H3, toNodeHandler } from "h3";
@@ -55,6 +55,10 @@ const diagnostics = defineDiagnostics({
55
55
  DF0036: {
56
56
  why: (p) => `RPC call to "${p.name}" was rejected: the caller is not authorized.`,
57
57
  fix: "Complete the auth handshake (or connect with a static/pre-shared token) before calling a trusted method. Untrusted callers may only call `anonymous:`-prefixed methods — see `isAnonymousRpcMethod`."
58
+ },
59
+ DF0037: {
60
+ why: (p) => `A service is already provided under "${p.id}".`,
61
+ fix: "Service ids are unique per context. Revoke the existing provider first (the `provide()` call returns a revoke function), or namespace the id with your plugin id to avoid collisions."
58
62
  }
59
63
  }
60
64
  });
@@ -1,4 +1,4 @@
1
- import { $ as ScopedBroadcastOptions, C as RpcStreamingChannelOptions, Ct as EventUnsubscribe, G as PartialWithoutId, J as DevframeScopedNodeRpc, K as Thenable, Q as DevframeSettingsStore, S as RpcStreamingChannel, St as EventEmitter, W as EntriesToObject, X as DevframeSettings, Y as DevframeScopedStreamingHost, Z as DevframeSettingsRegistry, _ as DevframeNodeRpcSession, _t as AgentResourceInput, a as DevframeDockDefaults, at as DevframeRpcClientFunctions, b as RpcSharedStateGetOptions, bt as DevframeAgentHost, c as DevframeSetupInfo, ct as DevframeHost, d as McpRouteOptions, dt as DevframeDiagnosticsHost, et as ScopedClientFunctions, f as defineDevframe, ft as DevframeDiagnosticsLogger, g as DevframeNodeContext, gt as AgentResourceContent, h as DevframeCapabilities, ht as AgentResource, i as DevframeDeploymentKind, it as DevframeViewHost, l as DevframeSpaOptions, lt as DevframeDefineDiagnosticsOptions, m as ConnectionMetaWebsocket, mt as AgentManifest, n as DevframeCliOptions, nt as ScopedSharedStates, o as DevframeDuplicationStrategy, ot as DevframeRpcServerFunctions, p as ConnectionMeta, pt as AgentHandle, q as DevframeScopedNodeContext, r as DevframeDefinition, rt as SettingsForNamespace, s as DevframeRuntime, st as DevframeRpcSharedStates, t as DevframeBrowserContext, tt as ScopedServerFunctions, u as DevframeWsOptions, ut as DevframeDiagnosticsDefinition, v as RpcBroadcastOptions, vt as AgentTool, w as RpcStreamingHost, wt as EventsMap, x as RpcSharedStateHost, xt as DevframeAgentHostEvents, y as RpcFunctionsHost, yt as AgentToolInput } from "../devframe-CnTVuGw9.mjs";
1
+ import { $ as DevframeRpcSharedStates, A as DevframeSettingsStore, At as EventsMap, B as DevframeDiagnosticsDefinition, C as DevframeServicesHost, Ct as AgentResourceInput, D as DevframeScopedStreamingHost, Dt as DevframeAgentHostEvents, E as DevframeScopedNodeRpc, Et as DevframeAgentHost, F as SettingsForNamespace, G as RpcFunctionsHost, H as DevframeDiagnosticsLogger, I as DevframeViewHost, J as RpcStreamingChannel, K as RpcSharedStateGetOptions, L as DevframeHost, M as ScopedClientFunctions, N as ScopedServerFunctions, O as DevframeSettings, Ot as EventEmitter, P as ScopedSharedStates, Q as DevframeRpcServerFunctions, R as DevframeStorageScope, S as DevframeServiceOf, St as AgentResourceContent, T as DevframeScopedNodeContext, Tt as AgentToolInput, U as DevframeNodeRpcSession, V as DevframeDiagnosticsHost, W as RpcBroadcastOptions, X as RpcStreamingHost, Y as RpcStreamingChannelOptions, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentManifest, c as DevframeSetupInfo, d as McpRouteOptions, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, k as DevframeSettingsRegistry, kt as EventUnsubscribe, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateHost, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentTool, x as DevframeServiceId, xt as AgentResource, y as DevframeCapabilities, yt as AgentHandle, z as DevframeDefineDiagnosticsOptions } from "../devframe-WHtcqYlZ.mjs";
2
2
  import { g as RpcFunctionAgentOptions } from "../types-CrzNxXKq.mjs";
3
- import { t as DevframeNodeRpcSessionMeta } from "../ws-server-CceOy6He.mjs";
4
- export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
3
+ import { t as DevframeNodeRpcSessionMeta } from "../ws-server-9-wn7MNQ.mjs";
4
+ export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
@@ -1,4 +1,4 @@
1
- import { St as EventEmitter, wt as EventsMap } from "../devframe-CnTVuGw9.mjs";
1
+ import { At as EventsMap, Ot as EventEmitter } from "../devframe-WHtcqYlZ.mjs";
2
2
  //#region src/utils/events.d.ts
3
3
  /**
4
4
  * Create event emitter.
@@ -18,13 +18,11 @@ interface ServeStaticOptions {
18
18
  */
19
19
  declare function serveStaticHandler(dir: string, options?: ServeStaticOptions): EventHandler;
20
20
  /**
21
- * Mount {@link serveStaticHandler} on an h3 app at `base`, handling the
22
- * route pattern and prefix-stripping required by h3 v2.
21
+ * Mount {@link serveStaticHandler} on an h3 app at `base`.
23
22
  *
24
- * h3 v2's `app.use(base, handler)` only matches the exact `base` path and
25
- * does not strip the prefix from `event.url.pathname`. Static serving
26
- * needs both subpath matching (`/base/**`) and the URL stripped so the
27
- * file resolver sees paths relative to `dir` — this helper bundles both.
23
+ * h3's sub-app mount provides segment-boundary matching and strips `base`
24
+ * from `event.url.pathname`, so the file resolver sees paths relative to
25
+ * `dir`.
28
26
  */
29
27
  declare function mountStaticHandler(app: H3, base: string, dir: string, options?: ServeStaticOptions): void;
30
28
  /**
@@ -1,6 +1,6 @@
1
1
  import { createReadStream } from "node:fs";
2
2
  import { extname, join, normalize, resolve, sep } from "pathe";
3
- import { defineHandler, withBase } from "h3";
3
+ import { H3, defineHandler } from "h3";
4
4
  import { stat } from "node:fs/promises";
5
5
  import { Readable } from "node:stream";
6
6
  import { lookup } from "mrmime";
@@ -103,22 +103,16 @@ function serveStaticHandler(dir, options) {
103
103
  });
104
104
  }
105
105
  /**
106
- * Mount {@link serveStaticHandler} on an h3 app at `base`, handling the
107
- * route pattern and prefix-stripping required by h3 v2.
106
+ * Mount {@link serveStaticHandler} on an h3 app at `base`.
108
107
  *
109
- * h3 v2's `app.use(base, handler)` only matches the exact `base` path and
110
- * does not strip the prefix from `event.url.pathname`. Static serving
111
- * needs both subpath matching (`/base/**`) and the URL stripped so the
112
- * file resolver sees paths relative to `dir` — this helper bundles both.
108
+ * h3's sub-app mount provides segment-boundary matching and strips `base`
109
+ * from `event.url.pathname`, so the file resolver sees paths relative to
110
+ * `dir`.
113
111
  */
114
112
  function mountStaticHandler(app, base, dir, options) {
115
- const trimmed = base.replace(/\/$/, "");
116
- const handler = serveStaticHandler(dir, options);
117
- if (trimmed === "") {
118
- app.use("/**", handler);
119
- return;
120
- }
121
- app.use(`${trimmed}/**`, withBase(trimmed, handler));
113
+ const staticApp = new H3();
114
+ staticApp.use(serveStaticHandler(dir, options));
115
+ app.mount(base.replace(/\/$/, ""), staticApp);
122
116
  }
123
117
  /**
124
118
  * Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
@@ -1,2 +1,2 @@
1
- import { B as SharedStateEvents, F as ImmutableArray, H as SharedStatePatch, I as ImmutableMap, L as ImmutableObject, P as Immutable, R as ImmutableSet, U as createSharedState, V as SharedStateOptions, z as SharedState } from "../devframe-CnTVuGw9.mjs";
1
+ import { _t as SharedStatePatch, dt as ImmutableMap, ft as ImmutableObject, gt as SharedStateOptions, ht as SharedStateEvents, lt as Immutable, mt as SharedState, pt as ImmutableSet, ut as ImmutableArray, vt as createSharedState } from "../devframe-WHtcqYlZ.mjs";
2
2
  export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
@@ -1,2 +1,2 @@
1
- import { A as StreamSink, D as CreateStreamSinkOptions, E as CreateStreamReaderOptions, M as createStreamReader, N as createStreamSink, O as StreamErrorPayload, T as BufferedChunk, j as StreamSinkEvents, k as StreamReader } from "../devframe-CnTVuGw9.mjs";
1
+ import { at as StreamSink, ct as createStreamSink, et as BufferedChunk, it as StreamReader, nt as CreateStreamSinkOptions, ot as StreamSinkEvents, rt as StreamErrorPayload, st as createStreamReader, tt as CreateStreamReaderOptions } from "../devframe-WHtcqYlZ.mjs";
2
2
  export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
@@ -1,6 +1,6 @@
1
1
  import { v as RpcFunctionDefinitionAny } from "./types-CrzNxXKq.mjs";
2
- import { BirpcGroup, ChannelOptions } from "birpc";
3
2
  import { Peer } from "crossws";
3
+ import { BirpcGroup, ChannelOptions } from "birpc";
4
4
  import { NodeAdapter } from "crossws/adapters/node";
5
5
  import { Server } from "node:http";
6
6
  import { Server as Server$1, ServerOptions } from "node:https";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "0.7.3",
4
+ "version": "0.7.5",
5
5
  "description": "Framework for building generic devframes",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -100,7 +100,7 @@
100
100
  "perfect-debounce": "^2.1.0",
101
101
  "structured-clone-es": "^2.0.0",
102
102
  "tinyglobby": "^0.2.17",
103
- "tsdown": "^0.22.7",
103
+ "tsdown": "^0.22.8",
104
104
  "ua-parser-modern": "^0.1.1",
105
105
  "whenexpr": "^0.1.2",
106
106
  "ws": "^8.21.1"