devframe 0.7.15 → 0.7.16

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 (43) hide show
  1. package/dist/adapters/build.d.mts +8 -1
  2. package/dist/adapters/build.mjs +3 -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-cANnMwg0.mjs → build-server-C7vTKjiQ.mjs} +2 -2
  13. package/dist/{cac-CjF0haJ6.mjs → cac-CPaOy3LD.mjs} +2 -2
  14. package/dist/client/index.d.mts +42 -6
  15. package/dist/client/index.mjs +178 -93
  16. package/dist/constants.d.mts +7 -1
  17. package/dist/constants.mjs +7 -1
  18. package/dist/{context-C_bqRR0i.d.mts → context-CzqPrJSz.d.mts} +1 -1
  19. package/dist/{context-C1Gr2BGB.mjs → context-DY72brRI.mjs} +1 -1
  20. package/dist/{dev-OJFr4rx8.mjs → dev-BCeaQuGE.mjs} +4 -4
  21. package/dist/{devframe-BADsX91-.d.mts → devframe-Ckhf3kFw.d.mts} +10 -0
  22. package/dist/helpers/vite.d.mts +1 -1
  23. package/dist/helpers/vite.mjs +2 -2
  24. package/dist/{host-h3-SjwRTwkE.mjs → host-h3-CgOetlNE.mjs} +1 -1
  25. package/dist/{http-B2P55ZXg.mjs → http-_pPbryTQ.mjs} +1 -1
  26. package/dist/{index-Brcd2V4t.d.mts → index-8dndvIxR.d.mts} +2 -2
  27. package/dist/index.d.mts +1 -1
  28. package/dist/node/auth.d.mts +2 -2
  29. package/dist/node/hub-internals.d.mts +2 -2
  30. package/dist/node/hub-internals.mjs +1 -1
  31. package/dist/node/index.d.mts +2 -2
  32. package/dist/node/index.mjs +3 -3
  33. package/dist/recipes/common-rpc-functions.d.mts +1 -1
  34. package/dist/recipes/interactive-auth.d.mts +2 -2
  35. package/dist/recipes/interactive-auth.mjs +1 -1
  36. package/dist/{server-Bu5iB3aV.d.mts → server-B0wiP_Oi.d.mts} +2 -2
  37. package/dist/{server-BFsuZI9e.mjs → server-DykHCza_.mjs} +2 -2
  38. package/dist/{storage-D_Xy9v1l.mjs → storage-gEnj9ASQ.mjs} +4 -0
  39. package/dist/types/index.d.mts +1 -1
  40. package/dist/utils/events.d.mts +1 -1
  41. package/dist/utils/shared-state.d.mts +1 -1
  42. package/dist/utils/streaming-channel.d.mts +1 -1
  43. package/package.json +1 -28
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-Ckhf3kFw.mjs";
2
2
  //#region src/adapters/build.d.ts
3
3
  interface CreateBuildOptions {
4
4
  /** Output directory. Defaults to `dist-static`. */
@@ -17,6 +17,13 @@ interface CreateBuildOptions {
17
17
  * minified. Set `true` when you need to diff / read the dumps by hand.
18
18
  */
19
19
  pretty?: boolean;
20
+ /**
21
+ * Proceed even when the definition declares `capabilities.build: false`.
22
+ * `createCac` already skips registering the `build` subcommand for such
23
+ * a definition — this only matters for a caller invoking `createBuild`
24
+ * directly, bypassing the CLI.
25
+ */
26
+ force?: boolean;
20
27
  }
21
28
  /**
22
29
  * Produce a self-contained static deploy of a devframe:
@@ -3,7 +3,8 @@ import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
3
3
  import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
4
4
  import { n as strictJsonStringify } from "../serialization-DpLXCy13.mjs";
5
5
  import { n as structuredCloneStringify } from "../structured-clone-CbAV5rFI.mjs";
6
- import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-SjwRTwkE.mjs";
6
+ import { a as diagnostics } from "../storage-gEnj9ASQ.mjs";
7
+ import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-CgOetlNE.mjs";
7
8
  import { n as resolveBasePath } from "../_shared-bWRzeSa0.mjs";
8
9
  import { existsSync } from "node:fs";
9
10
  import { dirname, resolve } from "pathe";
@@ -24,6 +25,7 @@ import fs$1 from "node:fs/promises";
24
25
  * works at `/`, `/devframe/`, or any base, no rewriting required.
25
26
  */
26
27
  async function createBuild(d, options = {}) {
28
+ if (d.capabilities?.build === false && !options.force) throw diagnostics.DF0042({ id: d.id });
27
29
  const outDir = resolve(options.outDir ?? "dist-static");
28
30
  const distDir = options.distDir ?? d.cli?.distDir;
29
31
  if (!distDir) throw new Error(`[devframe] createBuild: no distDir for "${d.id}". Set \`cli.distDir\` on the definition or pass it as an option.`);
@@ -1,4 +1,4 @@
1
- import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
1
+ import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags, r as DevframeDefinition } from "../devframe-Ckhf3kFw.mjs";
2
2
  import { CAC } from "cac";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/cac.d.ts
@@ -1,2 +1,2 @@
1
- import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CjF0haJ6.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CPaOy3LD.mjs";
2
2
  export { createCac, defineCliFlags, parseCliFlags };
@@ -1,4 +1,4 @@
1
- import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags } from "../devframe-BADsX91-.mjs";
1
+ import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags } from "../devframe-Ckhf3kFw.mjs";
2
2
  import { CacHandle, CreateCacOptions, createCac } from "./cac.mjs";
3
3
  //#region src/adapters/cli.d.ts
4
4
  /** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
@@ -1,4 +1,4 @@
1
- import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CjF0haJ6.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CPaOy3LD.mjs";
2
2
  //#region src/adapters/cli.ts
3
3
  /** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
4
4
  const createCli = createCac;
@@ -1,5 +1,5 @@
1
- import { _ as ConnectionMeta, d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-BADsX91-.mjs";
2
- import { n as StartedServer } from "../server-Bu5iB3aV.mjs";
1
+ import { _ as ConnectionMeta, d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-Ckhf3kFw.mjs";
2
+ import { n as StartedServer } from "../server-B0wiP_Oi.mjs";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/dev.d.ts
5
5
  interface CreateDevServerOptions {
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-OJFr4rx8.mjs";
1
+ import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-BCeaQuGE.mjs";
2
2
  export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,4 +1,4 @@
1
- import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
1
+ import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-Ckhf3kFw.mjs";
2
2
  //#region src/adapters/embedded.d.ts
3
3
  interface CreateEmbeddedOptions {
4
4
  /** Target context the devframe is registered into. Required. */
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-Ckhf3kFw.mjs";
2
2
  import "@modelcontextprotocol/sdk/server/index.js";
3
3
  //#region src/adapters/mcp/build-server.d.ts
4
4
  interface CreateMcpServerOptions {
@@ -1,2 +1,2 @@
1
- import { n as createMcpServer } from "../build-server-cANnMwg0.mjs";
1
+ import { n as createMcpServer } from "../build-server-C7vTKjiQ.mjs";
2
2
  export { createMcpServer };
@@ -1,5 +1,5 @@
1
- import { a as diagnostics } from "./storage-D_Xy9v1l.mjs";
2
- import { n as createHostContext } from "./host-h3-SjwRTwkE.mjs";
1
+ import { a as diagnostics } from "./storage-gEnj9ASQ.mjs";
2
+ import { n as createHostContext } from "./host-h3-CgOetlNE.mjs";
3
3
  import { Diagnostic } from "nostics";
4
4
  import { join } from "pathe";
5
5
  import process from "node:process";
@@ -1,6 +1,6 @@
1
1
  import { n as colors } from "./diagnostics-reporter-CsIG85Q5.mjs";
2
2
  import { createBuild } from "./adapters/build.mjs";
3
- import { n as resolveDevServerPort, t as createDevServer } from "./dev-OJFr4rx8.mjs";
3
+ import { n as resolveDevServerPort, t as createDevServer } from "./dev-BCeaQuGE.mjs";
4
4
  import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
@@ -111,7 +111,7 @@ function createCac(d, options = {}) {
111
111
  onReady: options.onReady
112
112
  });
113
113
  });
114
- cli.command("build", "Build a self-contained static deploy of the devframe").option("--out-dir <outDir>", "Output directory", { default: "dist-static" }).option("--base <base>", "URL base", { default: "/" }).option("--pretty", "Pretty-print dump JSON (larger on disk)").action(async (flags) => {
114
+ if (d.capabilities?.build !== false) cli.command("build", "Build a self-contained static deploy of the devframe").option("--out-dir <outDir>", "Output directory", { default: "dist-static" }).option("--base <base>", "URL base", { default: "/" }).option("--pretty", "Pretty-print dump JSON (larger on disk)").action(async (flags) => {
115
115
  await createBuild(d, {
116
116
  outDir: flags.outDir,
117
117
  base: flags.base,
@@ -1,9 +1,42 @@
1
- import { $ as DevframeRpcServerFunctions, F as ScopedSharedStates, I as SettingsForNamespace, J as RpcSharedStateHost, N as ScopedRpcFn, O as DevframeSettings, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, _ as ConnectionMeta, at as StreamReader, ht as SharedState, kt as EventEmitter, ot as StreamSink, q as RpcSharedStateGetOptions } from "../devframe-BADsX91-.mjs";
1
+ import { $ as DevframeRpcServerFunctions, F as ScopedSharedStates, I as SettingsForNamespace, J as RpcSharedStateHost, N as ScopedRpcFn, O as DevframeSettings, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, _ as ConnectionMeta, at as StreamReader, ht as SharedState, kt as EventEmitter, ot as StreamSink, q as RpcSharedStateGetOptions } from "../devframe-Ckhf3kFw.mjs";
2
2
  import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-CrzNxXKq.mjs";
3
3
  import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-DgsLFhZg.mjs";
4
4
  import { t as WsRpcChannelOptions } from "../ws-client-DSXiI2h7.mjs";
5
5
  import { BirpcOptions, BirpcReturn } from "birpc";
6
6
  //#region src/client/connection.d.ts
7
+ interface DevframeConnection {
8
+ /** Server-advertised transport and serialization metadata. */
9
+ connectionMeta: ConnectionMeta;
10
+ /**
11
+ * Absolute URL of the `__connection.json` that produced
12
+ * {@link connectionMeta}. Relative transport paths and side-car ports are
13
+ * resolved from this URL, rather than from an external viewer's location.
14
+ */
15
+ metaBaseUrl: string;
16
+ /** Previously issued bearer token, when the connection is already trusted. */
17
+ authToken?: string;
18
+ }
19
+ interface SetupDevframeConnectionOptions {
20
+ /** Reuse a complete connection prepared in another viewer or JavaScript realm. */
21
+ connection?: DevframeConnection;
22
+ /** Use a pre-known descriptor while deriving its source URL from `baseURL`. */
23
+ connectionMeta?: ConnectionMeta;
24
+ /** Base URL, or fallback list, used to locate `__connection.json`. */
25
+ baseURL?: string | string[];
26
+ /** Override the locally stored auth token. */
27
+ authToken?: string;
28
+ }
29
+ /**
30
+ * Return connection information previously prepared in this window or an
31
+ * accessible parent window.
32
+ */
33
+ declare function getDevframeConnection(): DevframeConnection | undefined;
34
+ /**
35
+ * Prepare the connection information shared by a devframe client and external
36
+ * viewers. Reuses an explicit or previously prepared connection before
37
+ * fetching `__connection.json` from the configured base URLs.
38
+ */
39
+ declare function setupDevframeConnection(options?: SetupDevframeConnectionOptions): Promise<DevframeConnection>;
7
40
  /**
8
41
  * The connection lifecycle of a devframe client, as a single value a UI can
9
42
  * render from. Derived from the transport (WebSocket open/close/error) and the
@@ -183,9 +216,7 @@ interface RpcClientEvents {
183
216
  */
184
217
  'rpc:error': (error: Error, method: string) => void;
185
218
  }
186
- interface DevframeRpcClientOptions {
187
- connectionMeta?: ConnectionMeta;
188
- baseURL?: string | string[];
219
+ interface DevframeRpcClientOptions extends SetupDevframeConnectionOptions {
189
220
  /**
190
221
  * The auth token to use for the client
191
222
  */
@@ -250,7 +281,12 @@ interface DevframeRpcClient {
250
281
  */
251
282
  readonly connectionError: Error | null;
252
283
  /**
253
- * The connection meta
284
+ * The complete connection used by this client, including the metadata source
285
+ * URL external viewers use to resolve relative resources.
286
+ */
287
+ readonly connection: DevframeConnection;
288
+ /**
289
+ * The server-advertised connection metadata.
254
290
  */
255
291
  readonly connectionMeta: ConnectionMeta;
256
292
  /**
@@ -376,4 +412,4 @@ declare function createClientSettings<T extends Record<string, any> = Record<str
376
412
  //#region src/client/index.d.ts
377
413
  declare const connectDevframe: typeof getDevframeRpcClient;
378
414
  //#endregion
379
- export { DevframeClientRpcHost, DevframeConnectionError, DevframeConnectionErrorKind, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, DevframeScopedClientContext, DevframeScopedClientRpc, DevframeScopedClientStreamingHost, RpcClientEvents, RpcStreamingClientHost, StreamingSubscribeOptions, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeRpcClient, isCallableStatus, readOtpFromUrl };
415
+ export { DevframeClientRpcHost, DevframeConnection, DevframeConnectionError, DevframeConnectionErrorKind, DevframeConnectionStatus, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, DevframeScopedClientContext, DevframeScopedClientRpc, DevframeScopedClientStreamingHost, RpcClientEvents, RpcStreamingClientHost, SetupDevframeConnectionOptions, StreamingSubscribeOptions, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeConnection, getDevframeRpcClient, isCallableStatus, readOtpFromUrl, setupDevframeConnection };
@@ -12,6 +12,12 @@ import { withBase, withProtocol } from "ufo";
12
12
  import { createBirpc } from "birpc";
13
13
  //#region src/constants.ts
14
14
  const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
15
+ /**
16
+ * Global key holding the serializable connection prepared by
17
+ * `setupDevframeConnection()`. External viewers can use this key to read the
18
+ * connection from another JavaScript realm.
19
+ */
20
+ const DEVFRAME_CONNECTION_KEY = "__DEVFRAME_CONNECTION__";
15
21
  const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
16
22
  /**
17
23
  * Page-URL query parameter carrying a one-time authentication code (OTP) for
@@ -289,6 +295,155 @@ function formatPath(parent, key) {
289
295
  return key;
290
296
  }
291
297
  //#endregion
298
+ //#region src/client/connection-storage.ts
299
+ const CONNECTION_META_KEY = "__DEVFRAME_CONNECTION_META__";
300
+ const CONNECTION_AUTH_TOKEN_KEY = "__DEVFRAME_CONNECTION_AUTH_TOKEN__";
301
+ function readFromWindows(key) {
302
+ const getters = [
303
+ () => window?.[key],
304
+ () => globalThis?.[key],
305
+ () => parent.window?.[key]
306
+ ];
307
+ for (const getter of getters) try {
308
+ const value = getter();
309
+ if (value) return value;
310
+ } catch {}
311
+ }
312
+ function readStoredConnection() {
313
+ return readFromWindows(DEVFRAME_CONNECTION_KEY);
314
+ }
315
+ function readStoredConnectionMeta() {
316
+ return readFromWindows(CONNECTION_META_KEY);
317
+ }
318
+ function readStoredAuthToken(userAuthToken) {
319
+ if (userAuthToken) return userAuthToken;
320
+ try {
321
+ const token = localStorage.getItem(CONNECTION_AUTH_TOKEN_KEY);
322
+ if (token) return token;
323
+ } catch {}
324
+ return readFromWindows(CONNECTION_AUTH_TOKEN_KEY);
325
+ }
326
+ function storeConnection(connection) {
327
+ globalThis[DEVFRAME_CONNECTION_KEY] = connection;
328
+ globalThis[CONNECTION_META_KEY] = {
329
+ ...connection.connectionMeta,
330
+ baseUrl: connection.metaBaseUrl
331
+ };
332
+ if (connection.authToken) storeAuthToken(connection.authToken);
333
+ }
334
+ function storeAuthToken(token) {
335
+ try {
336
+ localStorage.setItem(CONNECTION_AUTH_TOKEN_KEY, token);
337
+ } catch {}
338
+ globalThis[CONNECTION_AUTH_TOKEN_KEY] = token;
339
+ const connection = readStoredConnection();
340
+ if (connection) globalThis[DEVFRAME_CONNECTION_KEY] = {
341
+ ...connection,
342
+ authToken: token
343
+ };
344
+ }
345
+ //#endregion
346
+ //#region src/client/connection.ts
347
+ function resolveMetaBaseUrl(baseURL) {
348
+ const metaPath = withBase(DEVFRAME_CONNECTION_META_FILENAME, baseURL);
349
+ try {
350
+ return new URL(metaPath, globalThis.location?.href).href;
351
+ } catch {
352
+ return metaPath;
353
+ }
354
+ }
355
+ function withAuthToken(connection, authToken) {
356
+ return authToken && authToken !== connection.authToken ? {
357
+ ...connection,
358
+ authToken
359
+ } : connection;
360
+ }
361
+ /**
362
+ * Return connection information previously prepared in this window or an
363
+ * accessible parent window.
364
+ */
365
+ function getDevframeConnection() {
366
+ const connection = readStoredConnection();
367
+ if (connection) return withAuthToken(connection, readStoredAuthToken() ?? connection.authToken ?? connection.connectionMeta.authToken);
368
+ const connectionMeta = readStoredConnectionMeta();
369
+ if (!connectionMeta) return void 0;
370
+ return {
371
+ connectionMeta,
372
+ metaBaseUrl: connectionMeta.baseUrl ?? resolveMetaBaseUrl("./"),
373
+ authToken: readStoredAuthToken(connectionMeta.authToken)
374
+ };
375
+ }
376
+ /**
377
+ * Prepare the connection information shared by a devframe client and external
378
+ * viewers. Reuses an explicit or previously prepared connection before
379
+ * fetching `__connection.json` from the configured base URLs.
380
+ */
381
+ async function setupDevframeConnection(options = {}) {
382
+ if (options.connection) {
383
+ const connection = withAuthToken(options.connection, readStoredAuthToken(options.authToken ?? options.connection.authToken ?? options.connection.connectionMeta.authToken));
384
+ storeConnection(connection);
385
+ return connection;
386
+ }
387
+ const bases = Array.isArray(options.baseURL) ? options.baseURL : [options.baseURL ?? "./"];
388
+ if (options.connectionMeta) {
389
+ const connection = {
390
+ connectionMeta: options.connectionMeta,
391
+ metaBaseUrl: resolveMetaBaseUrl(bases[0] ?? "./"),
392
+ authToken: readStoredAuthToken(options.authToken ?? options.connectionMeta.authToken)
393
+ };
394
+ storeConnection(connection);
395
+ return connection;
396
+ }
397
+ const existing = getDevframeConnection();
398
+ if (existing) {
399
+ const connection = withAuthToken(existing, readStoredAuthToken(options.authToken ?? existing.authToken ?? existing.connectionMeta.authToken));
400
+ storeConnection(connection);
401
+ return connection;
402
+ }
403
+ const errors = [];
404
+ for (const base of bases) {
405
+ const metaPath = withBase(DEVFRAME_CONNECTION_META_FILENAME, base);
406
+ const metaUrl = resolveMetaBaseUrl(base);
407
+ try {
408
+ const response = await fetch(metaPath);
409
+ if (!response.ok) throw new Error(`Failed to fetch connection meta from ${metaUrl}: ${response.status}`);
410
+ const connectionMeta = await response.json();
411
+ const connection = {
412
+ connectionMeta,
413
+ metaBaseUrl: response.url || metaUrl,
414
+ authToken: readStoredAuthToken(options.authToken ?? connectionMeta.authToken)
415
+ };
416
+ storeConnection(connection);
417
+ return connection;
418
+ } catch (error) {
419
+ errors.push(error);
420
+ }
421
+ }
422
+ throw new Error(`Failed to get connection meta from ${bases.join(", ")}`, { cause: errors });
423
+ }
424
+ /**
425
+ * The error rejected from `rpc.call(...)` (and carried on
426
+ * `rpc.connectionError`) when a call cannot be served because the connection is
427
+ * down, the client is unauthorized, or a call timed out. Its `kind` lets a UI
428
+ * tailor its message and recovery affordance without string-matching.
429
+ */
430
+ var DevframeConnectionError = class extends Error {
431
+ name = "DevframeConnectionError";
432
+ kind;
433
+ constructor(kind, message, options) {
434
+ super(message, options);
435
+ this.kind = kind;
436
+ }
437
+ };
438
+ /**
439
+ * Whether a status means calls can be attempted. `connecting` counts because
440
+ * the transport queues outgoing calls until the socket opens; the terminal
441
+ * failure states short-circuit calls so a stuck socket never hangs the UI.
442
+ */
443
+ function isCallableStatus(status) {
444
+ return status === "connected" || status === "connecting";
445
+ }
446
+ //#endregion
292
447
  //#region src/client/otp.ts
293
448
  /**
294
449
  * Read a one-time authentication code (OTP) from the current page URL's query
@@ -1868,30 +2023,6 @@ function parseUA(uastringOrExtensions, extensions) {
1868
2023
  };
1869
2024
  }
1870
2025
  //#endregion
1871
- //#region src/client/connection.ts
1872
- /**
1873
- * The error rejected from `rpc.call(...)` (and carried on
1874
- * `rpc.connectionError`) when a call cannot be served because the connection is
1875
- * down, the client is unauthorized, or a call timed out. Its `kind` lets a UI
1876
- * tailor its message and recovery affordance without string-matching.
1877
- */
1878
- var DevframeConnectionError = class extends Error {
1879
- name = "DevframeConnectionError";
1880
- kind;
1881
- constructor(kind, message, options) {
1882
- super(message, options);
1883
- this.kind = kind;
1884
- }
1885
- };
1886
- /**
1887
- * Whether a status means calls can be attempted. `connecting` counts because
1888
- * the transport queues outgoing calls until the socket opens; the terminal
1889
- * failure states short-circuit calls so a stuck socket never hangs the UI.
1890
- */
1891
- function isCallableStatus(status) {
1892
- return status === "connected" || status === "connecting";
1893
- }
1894
- //#endregion
1895
2026
  //#region src/client/rpc-ws.ts
1896
2027
  /**
1897
2028
  * Resolve a {@link ConnectionMeta.websocket} descriptor into a concrete
@@ -1906,7 +2037,6 @@ function isCallableStatus(status) {
1906
2037
  * endpoint, e.g. a side-car server on its own port.
1907
2038
  */
1908
2039
  function resolveWsUrl(websocket, metaBaseUrl, loc) {
1909
- const wsProtocol = loc.protocol === "https:" ? "wss:" : "ws:";
1910
2040
  const base = (() => {
1911
2041
  try {
1912
2042
  return new URL(metaBaseUrl, loc.href);
@@ -1914,9 +2044,10 @@ function resolveWsUrl(websocket, metaBaseUrl, loc) {
1914
2044
  return new URL(loc.href);
1915
2045
  }
1916
2046
  })();
2047
+ const wsProtocol = base.protocol === "https:" ? "wss:" : "ws:";
1917
2048
  if (websocket && typeof websocket === "object") {
1918
2049
  if (websocket.host != null || websocket.port != null) {
1919
- const host = websocket.host ?? `${loc.hostname}:${websocket.port}`;
2050
+ const host = websocket.host ?? `${base.hostname}:${websocket.port}`;
1920
2051
  const target = new URL(websocket.path ?? "/", `${wsProtocol}//${host}`);
1921
2052
  target.protocol = wsProtocol;
1922
2053
  return target.href;
@@ -1925,7 +2056,7 @@ function resolveWsUrl(websocket, metaBaseUrl, loc) {
1925
2056
  target.protocol = wsProtocol;
1926
2057
  return target.href;
1927
2058
  }
1928
- if (typeof websocket === "number") return `${wsProtocol}//${loc.hostname}:${websocket}`;
2059
+ if (typeof websocket === "number") return `${wsProtocol}//${base.hostname}:${websocket}`;
1929
2060
  const str = websocket ?? "";
1930
2061
  if (/^wss?:\/\//i.test(str)) return str;
1931
2062
  if (/^https?:\/\//i.test(str)) return withProtocol(str, /^https/i.test(str) ? "wss://" : "ws://");
@@ -2210,78 +2341,21 @@ function createScopedClientContext(rpc, namespace) {
2210
2341
  }
2211
2342
  //#endregion
2212
2343
  //#region src/client/rpc.ts
2213
- const CONNECTION_META_KEY = "__DEVFRAME_CONNECTION_META__";
2214
- const CONNECTION_AUTH_TOKEN_KEY = "__DEVFRAME_CONNECTION_AUTH_TOKEN__";
2215
- function getStoredAuthToken(userAuthToken) {
2216
- const getters = [
2217
- () => userAuthToken,
2218
- () => localStorage.getItem(CONNECTION_AUTH_TOKEN_KEY) ?? void 0,
2219
- () => window?.[CONNECTION_AUTH_TOKEN_KEY],
2220
- () => globalThis?.[CONNECTION_AUTH_TOKEN_KEY],
2221
- () => parent.window?.[CONNECTION_AUTH_TOKEN_KEY]
2222
- ];
2223
- for (const getter of getters) try {
2224
- const value = getter();
2225
- if (value) return value;
2226
- } catch {}
2227
- }
2228
- function persistAuthToken(token) {
2229
- try {
2230
- localStorage.setItem(CONNECTION_AUTH_TOKEN_KEY, token);
2231
- } catch {}
2232
- globalThis[CONNECTION_AUTH_TOKEN_KEY] = token;
2233
- }
2234
- function findConnectionMetaFromWindows() {
2235
- const getters = [
2236
- () => window?.[CONNECTION_META_KEY],
2237
- () => globalThis?.[CONNECTION_META_KEY],
2238
- () => parent.window?.[CONNECTION_META_KEY]
2239
- ];
2240
- for (const getter of getters) try {
2241
- const value = getter();
2242
- if (value) return value;
2243
- } catch {}
2244
- }
2245
2344
  async function getDevframeRpcClient(options = {}) {
2246
2345
  const { baseURL = "./", rpcOptions = {}, cacheOptions = false } = options;
2247
2346
  const events = createEventEmitter();
2248
2347
  const bases = Array.isArray(baseURL) ? baseURL : [baseURL];
2249
- let connectionMeta = options.connectionMeta || findConnectionMetaFromWindows();
2348
+ let connection = await setupDevframeConnection(options);
2349
+ const { connectionMeta, metaBaseUrl, authToken } = connection;
2250
2350
  let resolvedBaseURL = bases[0] ?? "./";
2251
- const inheritedMetaBaseUrl = options.connectionMeta ? void 0 : connectionMeta?.baseUrl;
2252
- function resolveMetaBaseUrl() {
2253
- if (inheritedMetaBaseUrl) return inheritedMetaBaseUrl;
2254
- const metaPath = withBase(DEVFRAME_CONNECTION_META_FILENAME, resolvedBaseURL);
2255
- try {
2256
- return new URL(metaPath, globalThis.location?.href).href;
2257
- } catch {
2258
- return metaPath;
2259
- }
2260
- }
2261
- if (!connectionMeta) {
2262
- const errors = [];
2263
- for (const base of bases) try {
2264
- const response = await fetch(withBase(DEVFRAME_CONNECTION_META_FILENAME, base));
2265
- if (!response.ok) throw new Error(`Failed to fetch connection meta: ${response.status}`);
2266
- connectionMeta = await response.json();
2267
- resolvedBaseURL = base;
2268
- globalThis[CONNECTION_META_KEY] = {
2269
- ...connectionMeta,
2270
- baseUrl: resolveMetaBaseUrl()
2271
- };
2272
- break;
2273
- } catch (e) {
2274
- errors.push(e);
2275
- }
2276
- if (!connectionMeta) throw new Error(`Failed to get connection meta from ${bases.join(", ")}`, { cause: errors });
2277
- }
2351
+ try {
2352
+ resolvedBaseURL = new URL(".", metaBaseUrl).href;
2353
+ } catch {}
2278
2354
  const cacheManager = new RpcCacheManager({
2279
2355
  functions: [],
2280
2356
  ...typeof options.cacheOptions === "object" ? options.cacheOptions : {}
2281
2357
  });
2282
2358
  const context = { rpc: void 0 };
2283
- const authToken = getStoredAuthToken(options.authToken || connectionMeta.authToken);
2284
- if (authToken) persistAuthToken(authToken);
2285
2359
  const clientRpc = new RpcFunctionsCollectorBase(context);
2286
2360
  async function fetchJsonFromBases(path) {
2287
2361
  const candidates = [resolvedBaseURL, ...bases.filter((base) => base !== resolvedBaseURL)].filter((x) => x != null);
@@ -2299,7 +2373,7 @@ async function getDevframeRpcClient(options = {}) {
2299
2373
  const mode = connectionMeta.backend === "static" ? await createStaticRpcClientMode({ fetchJsonFromBases }) : createWsRpcClientMode({
2300
2374
  authToken,
2301
2375
  connectionMeta,
2302
- metaBaseUrl: resolveMetaBaseUrl(),
2376
+ metaBaseUrl,
2303
2377
  events,
2304
2378
  clientRpc,
2305
2379
  callTimeout: options.callTimeout,
@@ -2339,17 +2413,28 @@ async function getDevframeRpcClient(options = {}) {
2339
2413
  get connectionError() {
2340
2414
  return mode.connectionError;
2341
2415
  },
2416
+ get connection() {
2417
+ return connection;
2418
+ },
2342
2419
  connectionMeta,
2343
2420
  ensureTrusted: mode.ensureTrusted,
2344
2421
  requestTrust: mode.requestTrust,
2345
2422
  requestTrustWithToken: async (token) => {
2346
- persistAuthToken(token);
2423
+ storeAuthToken(token);
2424
+ connection = {
2425
+ ...connection,
2426
+ authToken: token
2427
+ };
2347
2428
  return mode.requestTrustWithToken(token);
2348
2429
  },
2349
2430
  requestTrustWithCode: async (code) => {
2350
2431
  const token = await mode.requestTrustWithCode(code);
2351
2432
  if (!token) return false;
2352
- persistAuthToken(token);
2433
+ storeAuthToken(token);
2434
+ connection = {
2435
+ ...connection,
2436
+ authToken: token
2437
+ };
2353
2438
  try {
2354
2439
  authChannel?.postMessage({
2355
2440
  type: "auth-update",
@@ -2419,4 +2504,4 @@ async function getDevframeRpcClient(options = {}) {
2419
2504
  //#region src/client/index.ts
2420
2505
  const connectDevframe = getDevframeRpcClient;
2421
2506
  //#endregion
2422
- export { DevframeConnectionError, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeRpcClient, isCallableStatus, readOtpFromUrl };
2507
+ export { DevframeConnectionError, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeConnection, getDevframeRpcClient, isCallableStatus, readOtpFromUrl, setupDevframeConnection };
@@ -3,6 +3,12 @@ declare const DEVFRAME_MOUNT_PATH = "/__devframe/";
3
3
  declare const DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH = "/__devframe";
4
4
  declare const DEVFRAME_DIRNAME = "__devframe";
5
5
  declare const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
6
+ /**
7
+ * Global key holding the serializable connection prepared by
8
+ * `setupDevframeConnection()`. External viewers can use this key to read the
9
+ * connection from another JavaScript realm.
10
+ */
11
+ declare const DEVFRAME_CONNECTION_KEY = "__DEVFRAME_CONNECTION__";
6
12
  /**
7
13
  * Route the WebSocket RPC endpoint is bound to, relative to a devframe's
8
14
  * base path. Sits next to `__connection.json` so the deployed SPA can reach
@@ -60,4 +66,4 @@ declare const ANONYMOUS_RPC_PREFIX = "anonymous:";
60
66
  */
61
67
  declare function isAnonymousRpcMethod(name: string): boolean;
62
68
  //#endregion
63
- export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DIRNAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID, DEVFRAME_MCP_ROUTE, DEVFRAME_MOUNT_PATH, DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
69
+ export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DIRNAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID, DEVFRAME_MCP_ROUTE, DEVFRAME_MOUNT_PATH, DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
@@ -4,6 +4,12 @@ const DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH = "/__devframe";
4
4
  const DEVFRAME_DIRNAME = "__devframe";
5
5
  const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
6
6
  /**
7
+ * Global key holding the serializable connection prepared by
8
+ * `setupDevframeConnection()`. External viewers can use this key to read the
9
+ * connection from another JavaScript realm.
10
+ */
11
+ const DEVFRAME_CONNECTION_KEY = "__DEVFRAME_CONNECTION__";
12
+ /**
7
13
  * Route the WebSocket RPC endpoint is bound to, relative to a devframe's
8
14
  * base path. Sits next to `__connection.json` so the deployed SPA can reach
9
15
  * it on the same origin it loaded from — the dev server shares one port for
@@ -62,4 +68,4 @@ function isAnonymousRpcMethod(name) {
62
68
  return name.startsWith(ANONYMOUS_RPC_PREFIX);
63
69
  }
64
70
  //#endregion
65
- export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DIRNAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID, DEVFRAME_MCP_ROUTE, DEVFRAME_MOUNT_PATH, DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
71
+ export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DIRNAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID, DEVFRAME_MCP_ROUTE, DEVFRAME_MOUNT_PATH, DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH, DEVFRAME_OTP_URL_PARAM, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
@@ -1,4 +1,4 @@
1
- import { b as DevframeNodeContext, ht as SharedState } from "./devframe-BADsX91-.mjs";
1
+ import { b as DevframeNodeContext, ht as SharedState } from "./devframe-Ckhf3kFw.mjs";
2
2
  //#region src/node/hub-internals/context.d.ts
3
3
  interface InternalAnonymousAuthStorage {
4
4
  trusted: Record<string, {
@@ -1,4 +1,4 @@
1
- import { t as createStorage } from "./storage-D_Xy9v1l.mjs";
1
+ import { t as createStorage } from "./storage-gEnj9ASQ.mjs";
2
2
  import { i as randomToken, n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-BtQDKTp7.mjs";
3
3
  import { join } from "pathe";
4
4
  //#region src/node/hub-internals/context.ts
@@ -1,7 +1,7 @@
1
1
  import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
2
- import { a as diagnostics } from "./storage-D_Xy9v1l.mjs";
3
- import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-SjwRTwkE.mjs";
4
- import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-BFsuZI9e.mjs";
2
+ import { a as diagnostics } from "./storage-gEnj9ASQ.mjs";
3
+ import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-CgOetlNE.mjs";
4
+ import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-DykHCza_.mjs";
5
5
  import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-bWRzeSa0.mjs";
6
6
  import { t as open } from "./open-Deb5xmIT.mjs";
7
7
  import { mountStaticHandler } from "./utils/serve-static.mjs";
@@ -294,7 +294,7 @@ async function createDevServer(def, options = {}) {
294
294
  const mcpPath = joinURL(basePath, mcpRoute);
295
295
  let mountMcpHttp;
296
296
  try {
297
- ({mountMcpHttp} = await import("./http-B2P55ZXg.mjs"));
297
+ ({mountMcpHttp} = await import("./http-_pPbryTQ.mjs"));
298
298
  } catch (error) {
299
299
  const reason = error instanceof Error ? error.message : String(error);
300
300
  throw diagnostics.DF0017({
@@ -1713,6 +1713,16 @@ interface DevframeDefinition {
1713
1713
  * @default 'warn'
1714
1714
  */
1715
1715
  duplicationStrategy?: DevframeDuplicationStrategy;
1716
+ /**
1717
+ * Declares which runtimes meaningfully support this devframe. Consulted
1718
+ * by adapters that can act on a plain `false` before doing any work:
1719
+ * `createCac` skips registering the `build` subcommand entirely when
1720
+ * `capabilities.build` is `false` — useful for a devframe whose value is
1721
+ * inherently live (e.g. it manages real files on disk), so a static
1722
+ * export would only ever produce a broken, write-less shell of the tool.
1723
+ * The `Record<string, boolean>` shape is reserved for finer-grained
1724
+ * sub-capabilities and currently unconsumed by any adapter.
1725
+ */
1716
1726
  capabilities?: {
1717
1727
  dev?: boolean | Record<string, boolean>;
1718
1728
  build?: boolean | Record<string, boolean>;
@@ -1,4 +1,4 @@
1
- import { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
1
+ import { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-Ckhf3kFw.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-D_Xy9v1l.mjs";
2
+ import { a as diagnostics } from "../storage-gEnj9ASQ.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, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-OJFr4rx8.mjs";
5
+ import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-BCeaQuGE.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-D_Xy9v1l.mjs";
5
+ import { a as diagnostics$1, i as createEventEmitter, n as createSharedState, r as nanoid, t as createStorage } from "./storage-gEnj9ASQ.mjs";
6
6
  import { defineDiagnostics } from "nostics";
7
7
  import { isatty } from "node:tty";
8
8
  import { formatWithOptions, inspect } from "node:util";
@@ -1,5 +1,5 @@
1
1
  import { isAllowedOrigin } from "./rpc/transports/ws-server.mjs";
2
- import { t as buildMcpServerFromContext } from "./build-server-cANnMwg0.mjs";
2
+ import { t as buildMcpServerFromContext } from "./build-server-C7vTKjiQ.mjs";
3
3
  import { randomUUID } from "node:crypto";
4
4
  import { defineHandler } from "h3";
5
5
  import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
@@ -1,5 +1,5 @@
1
- import { W as DevframeNodeRpcSession, b as DevframeNodeContext, ht as SharedState } from "./devframe-BADsX91-.mjs";
2
- import { n as InternalAnonymousAuthStorage } from "./context-C_bqRR0i.mjs";
1
+ import { W as DevframeNodeRpcSession, b as DevframeNodeContext, ht as SharedState } from "./devframe-Ckhf3kFw.mjs";
2
+ import { n as InternalAnonymousAuthStorage } from "./context-CzqPrJSz.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,4 +1,4 @@
1
- import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as EventUnsubscribe, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as DevframeAgentHost, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, N as ScopedRpcFn, O as DevframeSettings, Ot as DevframeAgentHostEvents, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventsMap, k as DevframeSettingsRegistry, kt as EventEmitter, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "./devframe-BADsX91-.mjs";
1
+ import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as EventUnsubscribe, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as DevframeAgentHost, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, N as ScopedRpcFn, O as DevframeSettings, Ot as DevframeAgentHostEvents, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventsMap, k as DevframeSettingsRegistry, kt as EventEmitter, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "./devframe-Ckhf3kFw.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
4
  import { t as DevframeNodeRpcSessionMeta } from "./ws-server-9-wn7MNQ.mjs";
@@ -1,3 +1,3 @@
1
- import { p as DevframeAuthHandler } from "../devframe-BADsX91-.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-Brcd2V4t.mjs";
1
+ import { p as DevframeAuthHandler } from "../devframe-Ckhf3kFw.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-8dndvIxR.mjs";
3
3
  export { DevframeAuthHandler, buildOtpAuthUrl, exchangeTempAuthCode, getTempAuthCode, refreshTempAuthCode, revokeActiveConnectionsForToken, revokeAuthToken, verifyAuthToken };
@@ -1,5 +1,5 @@
1
- import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
2
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-C_bqRR0i.mjs";
1
+ import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-Ckhf3kFw.mjs";
2
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-CzqPrJSz.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-C1Gr2BGB.mjs";
1
+ import { n as internalContextMap, t as getInternalContext } from "../context-DY72brRI.mjs";
2
2
  import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
3
3
  export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
@@ -1,7 +1,7 @@
1
- import { C as DevframeServicesHost, Ct as AgentResourceContent, Dt as DevframeAgentHost$1, Et as AgentToolInput, H as DevframeDiagnosticsHost$1, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost$1, O as DevframeSettings, Ot as DevframeAgentHostEvents, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, Z as RpcStreamingHost, b as DevframeNodeContext, bt as AgentHandle, ht as SharedState, kt as EventEmitter, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest } from "../devframe-BADsX91-.mjs";
1
+ import { C as DevframeServicesHost, Ct as AgentResourceContent, Dt as DevframeAgentHost$1, Et as AgentToolInput, H as DevframeDiagnosticsHost$1, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost$1, O as DevframeSettings, Ot as DevframeAgentHostEvents, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, Z as RpcStreamingHost, b as DevframeNodeContext, bt as AgentHandle, ht as SharedState, kt as EventEmitter, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest } from "../devframe-Ckhf3kFw.mjs";
2
2
  import { v as RpcFunctionDefinitionAny } from "../types-CrzNxXKq.mjs";
3
3
  import "../index-DgsLFhZg.mjs";
4
- import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-Bu5iB3aV.mjs";
4
+ import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-B0wiP_Oi.mjs";
5
5
  import { BirpcGroup } from "birpc";
6
6
  //#region src/node/context.d.ts
7
7
  interface CreateHostContextOptions {
@@ -1,4 +1,4 @@
1
- import { t as createStorage } from "../storage-D_Xy9v1l.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-SjwRTwkE.mjs";
3
- import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-BFsuZI9e.mjs";
1
+ import { t as createStorage } from "../storage-gEnj9ASQ.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-CgOetlNE.mjs";
3
+ import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-DykHCza_.mjs";
4
4
  export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
@@ -1,4 +1,4 @@
1
- import "../devframe-BADsX91-.mjs";
1
+ import "../devframe-Ckhf3kFw.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,5 +1,5 @@
1
- import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-BADsX91-.mjs";
2
- import "../index-Brcd2V4t.mjs";
1
+ import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-Ckhf3kFw.mjs";
2
+ import "../index-8dndvIxR.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-C1Gr2BGB.mjs";
4
+ import { t as getInternalContext } from "../context-DY72brRI.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,5 +1,5 @@
1
- import { $ as DevframeRpcServerFunctions, Q as DevframeRpcClientFunctions, W as DevframeNodeRpcSession, _ as ConnectionMeta, b as DevframeNodeContext, p as DevframeAuthHandler } from "./devframe-BADsX91-.mjs";
2
- import "./index-Brcd2V4t.mjs";
1
+ import { $ as DevframeRpcServerFunctions, Q as DevframeRpcClientFunctions, W as DevframeNodeRpcSession, _ as ConnectionMeta, b as DevframeNodeContext, p as DevframeAuthHandler } from "./devframe-Ckhf3kFw.mjs";
2
+ import "./index-8dndvIxR.mjs";
3
3
  import { Peer } from "crossws";
4
4
  import { BirpcGroup, EventOptions } from "birpc";
5
5
  import { NodeAdapter } from "crossws/adapters/node";
@@ -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-D_Xy9v1l.mjs";
4
- import { t as getInternalContext } from "./context-C1Gr2BGB.mjs";
3
+ import { a as diagnostics } from "./storage-gEnj9ASQ.mjs";
4
+ import { t as getInternalContext } from "./context-DY72brRI.mjs";
5
5
  import { createServer } from "node:http";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { H3, toNodeHandler } from "h3";
@@ -59,6 +59,10 @@ const diagnostics = defineDiagnostics({
59
59
  DF0037: {
60
60
  why: (p) => `A service is already provided under "${p.id}".`,
61
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."
62
+ },
63
+ DF0042: {
64
+ why: (p) => `"${p.id}" declares \`capabilities.build: false\` — its static export is not meaningful (writes are excluded and any live-served data won't be there).`,
65
+ fix: "Pass `{ force: true }` to `createBuild()` if the degraded export is still useful to you, or drop `capabilities.build: false` on the definition."
62
66
  }
63
67
  }
64
68
  });
@@ -1,4 +1,4 @@
1
- import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as EventUnsubscribe, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as DevframeAgentHost, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, N as ScopedRpcFn, O as DevframeSettings, Ot as DevframeAgentHostEvents, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventsMap, k as DevframeSettingsRegistry, kt as EventEmitter, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "../devframe-BADsX91-.mjs";
1
+ import { $ as DevframeRpcServerFunctions, A as DevframeSettingsStore, At as EventUnsubscribe, B as DevframeDefineDiagnosticsOptions, C as DevframeServicesHost, Ct as AgentResourceContent, D as DevframeScopedStreamingHost, Dt as DevframeAgentHost, E as DevframeScopedNodeRpc, Et as AgentToolInput, F as ScopedSharedStates, G as RpcBroadcastOptions, H as DevframeDiagnosticsHost, I as SettingsForNamespace, J as RpcSharedStateHost, K as RpcFunctionsHost, L as DevframeViewHost, M as ScopedClientFunctions, N as ScopedRpcFn, O as DevframeSettings, Ot as DevframeAgentHostEvents, P as ScopedServerFunctions, Q as DevframeRpcClientFunctions, R as DevframeHost, S as DevframeServiceOf, St as AgentResource, T as DevframeScopedNodeContext, Tt as AgentTool, U as DevframeDiagnosticsLogger, V as DevframeDiagnosticsDefinition, W as DevframeNodeRpcSession, X as RpcStreamingChannelOptions, Y as RpcStreamingChannel, Z as RpcStreamingHost, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeNodeContext, bt as AgentHandle, c as DevframeSetupInfo, d as McpRouteOptions, et as DevframeRpcSharedStates, f as defineDevframe, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as ScopedBroadcastOptions, jt as EventsMap, k as DevframeSettingsRegistry, kt as EventEmitter, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcSharedStateGetOptions, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, u as DevframeWsOptions, v as ConnectionMetaWebsocket, w as DevframeServicesRegistry, wt as AgentResourceInput, x as DevframeServiceId, xt as AgentManifest, y as DevframeCapabilities, z as DevframeStorageScope } from "../devframe-Ckhf3kFw.mjs";
2
2
  import { g as RpcFunctionAgentOptions } from "../types-CrzNxXKq.mjs";
3
3
  import { t as DevframeNodeRpcSessionMeta } from "../ws-server-9-wn7MNQ.mjs";
4
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, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
@@ -1,4 +1,4 @@
1
- import { jt as EventsMap, kt as EventEmitter } from "../devframe-BADsX91-.mjs";
1
+ import { jt as EventsMap, kt as EventEmitter } from "../devframe-Ckhf3kFw.mjs";
2
2
  //#region src/utils/events.d.ts
3
3
  /**
4
4
  * Create event emitter.
@@ -1,2 +1,2 @@
1
- import { _t as SharedStateOptions, dt as ImmutableArray, ft as ImmutableMap, gt as SharedStateEvents, ht as SharedState, mt as ImmutableSet, pt as ImmutableObject, ut as Immutable, vt as SharedStatePatch, yt as createSharedState } from "../devframe-BADsX91-.mjs";
1
+ import { _t as SharedStateOptions, dt as ImmutableArray, ft as ImmutableMap, gt as SharedStateEvents, ht as SharedState, mt as ImmutableSet, pt as ImmutableObject, ut as Immutable, vt as SharedStatePatch, yt as createSharedState } from "../devframe-Ckhf3kFw.mjs";
2
2
  export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
@@ -1,2 +1,2 @@
1
- import { at as StreamReader, ct as createStreamReader, it as StreamErrorPayload, lt as createStreamSink, nt as CreateStreamReaderOptions, ot as StreamSink, rt as CreateStreamSinkOptions, st as StreamSinkEvents, tt as BufferedChunk } from "../devframe-BADsX91-.mjs";
1
+ import { at as StreamReader, ct as createStreamReader, it as StreamErrorPayload, lt as createStreamSink, nt as CreateStreamReaderOptions, ot as StreamSink, rt as CreateStreamSinkOptions, st as StreamSinkEvents, tt as BufferedChunk } from "../devframe-Ckhf3kFw.mjs";
2
2
  export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "0.7.15",
4
+ "version": "0.7.16",
5
5
  "description": "Framework for building generic devframes",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -106,33 +106,6 @@
106
106
  "whenexpr": "^0.1.2",
107
107
  "ws": "^8.21.1"
108
108
  },
109
- "inlinedDependencies": {
110
- "bundle-name": "4.1.0",
111
- "default-browser": "5.5.0",
112
- "default-browser-id": "5.0.1",
113
- "define-lazy-prop": "3.0.0",
114
- "get-port-please": "3.2.0",
115
- "immer": "11.1.8",
116
- "is-docker": "3.0.0",
117
- "is-in-ssh": "1.0.0",
118
- "is-inside-container": "1.0.0",
119
- "is-wsl": "3.1.1",
120
- "launch-editor": "2.13.2",
121
- "obug": "2.1.1",
122
- "ohash": "2.0.11",
123
- "open": "11.0.0",
124
- "p-limit": "7.3.0",
125
- "perfect-debounce": "2.1.0",
126
- "picocolors": "1.1.1",
127
- "powershell-utils": "0.1.0",
128
- "run-applescript": "7.1.0",
129
- "shell-quote": "1.8.3",
130
- "structured-clone-es": "2.0.0",
131
- "ua-parser-modern": "0.1.1",
132
- "whenexpr": "0.1.2",
133
- "wsl-utils": "0.3.1",
134
- "yocto-queue": "1.2.2"
135
- },
136
109
  "scripts": {
137
110
  "build": "tsdown",
138
111
  "watch": "tsdown --watch",