devframe 0.7.13 → 0.7.15

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 +18 -3
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/mcp.d.mts +5 -3
  11. package/dist/adapters/mcp.mjs +1 -1
  12. package/dist/{build-server-CBAxmnC8.mjs → build-server-cANnMwg0.mjs} +14 -3
  13. package/dist/{cac-Drj5sjnU.mjs → cac-CjF0haJ6.mjs} +1 -1
  14. package/dist/client/index.d.mts +1 -1
  15. package/dist/client/index.mjs +4 -2
  16. package/dist/{context-FonV8enL.d.mts → context-C_bqRR0i.d.mts} +1 -1
  17. package/dist/{dev-BdegDQKt.mjs → dev-OJFr4rx8.mjs} +25 -2
  18. package/dist/{devframe-DfzYvlKI.d.mts → devframe-BADsX91-.d.mts} +6 -1
  19. package/dist/helpers/vite.d.mts +14 -1
  20. package/dist/helpers/vite.mjs +6 -3
  21. package/dist/{http-BaCZYhIR.mjs → http-B2P55ZXg.mjs} +1 -1
  22. package/dist/{index-CxpC1ItQ.d.mts → index-Brcd2V4t.d.mts} +2 -2
  23. package/dist/index.d.mts +1 -1
  24. package/dist/node/auth.d.mts +2 -2
  25. package/dist/node/hub-internals.d.mts +2 -2
  26. package/dist/node/index.d.mts +2 -2
  27. package/dist/recipes/common-rpc-functions.d.mts +118 -0
  28. package/dist/recipes/common-rpc-functions.mjs +105 -0
  29. package/dist/recipes/interactive-auth.d.mts +2 -2
  30. package/dist/recipes/open-helpers.d.mts +3 -101
  31. package/dist/recipes/open-helpers.mjs +3 -63
  32. package/dist/rpc/transports/ws-client.mjs +1 -1
  33. package/dist/rpc/transports/ws-server.mjs +1 -1
  34. package/dist/{server-Bf27EWpv.d.mts → server-Bu5iB3aV.d.mts} +2 -2
  35. package/dist/{structured-clone-XpHLZ8nr.mjs → structured-clone-CbAV5rFI.mjs} +32 -3
  36. package/dist/{structured-clone-CeZOHvkd.mjs → structured-clone-CgtQ61SA.mjs} +32 -3
  37. package/dist/types/index.d.mts +1 -1
  38. package/dist/utils/events.d.mts +1 -1
  39. package/dist/utils/launch-editor.mjs +745 -1
  40. package/dist/utils/shared-state.d.mts +1 -1
  41. package/dist/utils/streaming-channel.d.mts +1 -1
  42. package/dist/utils/structured-clone.mjs +1 -1
  43. package/package.json +5 -4
  44. package/skills/devframe/SKILL.md +1 -1
  45. package/dist/launch-editor-C_xuzLnF.mjs +0 -746
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-DfzYvlKI.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
2
2
  //#region src/adapters/build.d.ts
3
3
  interface CreateBuildOptions {
4
4
  /** Output directory. Defaults to `dist-static`. */
@@ -2,7 +2,7 @@ import { t as collectStaticRpcDump } from "../dump-Cz7yVvsB.mjs";
2
2
  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
- import { n as structuredCloneStringify } from "../structured-clone-XpHLZ8nr.mjs";
5
+ import { n as structuredCloneStringify } from "../structured-clone-CbAV5rFI.mjs";
6
6
  import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-SjwRTwkE.mjs";
7
7
  import { n as resolveBasePath } from "../_shared-bWRzeSa0.mjs";
8
8
  import { existsSync } from "node:fs";
@@ -1,4 +1,4 @@
1
- import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags, r as DevframeDefinition } from "../devframe-DfzYvlKI.mjs";
1
+ import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags, r as DevframeDefinition } from "../devframe-BADsX91-.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-Drj5sjnU.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CjF0haJ6.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-DfzYvlKI.mjs";
1
+ import { Ft as parseCliFlags, Mt as CliFlagsSchema, Nt as InferCliFlags, Pt as defineCliFlags } from "../devframe-BADsX91-.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-Drj5sjnU.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-CjF0haJ6.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 { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-DfzYvlKI.mjs";
2
- import { n as StartedServer } from "../server-Bf27EWpv.mjs";
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";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/dev.d.ts
5
5
  interface CreateDevServerOptions {
@@ -111,5 +111,20 @@ declare function resolveDevServerPort(def: DevframeDefinition, options?: Resolve
111
111
  * `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
112
112
  */
113
113
  declare function createDevServer(def: DevframeDefinition, options?: CreateDevServerOptions): Promise<StartedServer>;
114
+ /**
115
+ * Resolve the `mcp` entry a `__connection.json` should advertise for a dev
116
+ * server started with the given `mcp` option (falling back to `def.cli?.mcp`,
117
+ * exactly like {@link createDevServer}), or `undefined` when the route is
118
+ * disabled.
119
+ *
120
+ * Hosted bridges that hand-roll their connection meta (`viteDevBridge`,
121
+ * `@devframes/next`'s handler) pass the side-car `port`: the advertised path
122
+ * becomes absolute (the side-car mounts at `/`) and the client dials
123
+ * `<page-host>:<port><path>`. Without `port` the path stays relative, resolved
124
+ * against `__connection.json`'s own location (the same-server default).
125
+ *
126
+ * @experimental
127
+ */
128
+ declare function resolveMcpConnectionMeta(def: DevframeDefinition, mcp: boolean | McpRouteOptions | undefined, port?: number): ConnectionMeta['mcp'];
114
129
  //#endregion
115
- export { CreateDevServerOptions, ResolveDevServerPortOptions, createDevServer, resolveDevServerPort };
130
+ export { CreateDevServerOptions, ResolveDevServerPortOptions, createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-BdegDQKt.mjs";
2
- export { createDevServer, resolveDevServerPort };
1
+ import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-OJFr4rx8.mjs";
2
+ export { createDevServer, resolveDevServerPort, resolveMcpConnectionMeta };
@@ -1,4 +1,4 @@
1
- import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-DfzYvlKI.mjs";
1
+ import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
2
2
  //#region src/adapters/embedded.d.ts
3
3
  interface CreateEmbeddedOptions {
4
4
  /** Target context the devframe is registered into. Required. */
@@ -1,10 +1,12 @@
1
- import { r as DevframeDefinition } from "../devframe-DfzYvlKI.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
2
2
  import "@modelcontextprotocol/sdk/server/index.js";
3
3
  //#region src/adapters/mcp/build-server.d.ts
4
4
  interface CreateMcpServerOptions {
5
5
  /**
6
- * Transport to use. Only `'stdio'` is implemented today; HTTP support
7
- * is planned in a follow-up PR.
6
+ * Transport to use. `createMcpServer` itself runs `'stdio'` (a standalone
7
+ * process with its own host context); the Streamable-HTTP transport is
8
+ * served route-based by the dev server instead — see `mountMcpHttp` and
9
+ * the `mcp` option on `createDevServer` / `createCac`'s `--mcp` flag.
8
10
  */
9
11
  transport?: 'stdio';
10
12
  /**
@@ -1,2 +1,2 @@
1
- import { n as createMcpServer } from "../build-server-CBAxmnC8.mjs";
1
+ import { n as createMcpServer } from "../build-server-cANnMwg0.mjs";
2
2
  export { createMcpServer };
@@ -1,5 +1,6 @@
1
1
  import { a as diagnostics } from "./storage-D_Xy9v1l.mjs";
2
2
  import { n as createHostContext } from "./host-h3-SjwRTwkE.mjs";
3
+ import { Diagnostic } from "nostics";
3
4
  import { join } from "pathe";
4
5
  import process from "node:process";
5
6
  import { homedir } from "node:os";
@@ -59,11 +60,21 @@ function stringifyForMcp(value) {
59
60
  }, 2);
60
61
  }
61
62
  /**
62
- * Format a thrown value for an MCP `isError` text payload. Surfaces the
63
- * `Error.name`/`message`, and one level of `cause.message` so context
64
- * isn't dropped silently.
63
+ * Format a thrown value for an MCP `isError` text payload.
64
+ *
65
+ * A nostics `Diagnostic` (every coded devframe error) becomes structured
66
+ * JSON — `{ error: { code, message, fix?, docs? } }` — so an agent receives
67
+ * the actionable next step (`fix`) and the docs URL instead of a bare
68
+ * message string. Other errors surface `Error.name`/`message`, plus one
69
+ * level of `cause.message` so context isn't dropped silently.
65
70
  */
66
71
  function formatMcpError(error) {
72
+ if (error instanceof Diagnostic) return JSON.stringify({ error: {
73
+ code: error.code,
74
+ message: error.message,
75
+ ...error.fix ? { fix: error.fix } : {},
76
+ ...error.docs ? { docs: error.docs } : {}
77
+ } }, null, 2);
67
78
  if (!(error instanceof Error)) return String(error);
68
79
  const cause = error.cause;
69
80
  const causeText = cause instanceof Error ? ` (cause: ${cause.message})` : cause !== void 0 ? ` (cause: ${String(cause)})` : "";
@@ -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-BdegDQKt.mjs";
3
+ import { n as resolveDevServerPort, t as createDevServer } from "./dev-OJFr4rx8.mjs";
4
4
  import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
@@ -1,4 +1,4 @@
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-DfzYvlKI.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-BADsX91-.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";
@@ -2,7 +2,7 @@ import { t as hash } from "../hash-KtDZYXDN.mjs";
2
2
  import { colors } from "../utils/colors.mjs";
3
3
  import { createEventEmitter } from "../utils/events.mjs";
4
4
  import { t as createSharedState } from "../shared-state-6kHolYZy.mjs";
5
- import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CeZOHvkd.mjs";
5
+ import { i as structuredCloneStringify, n as structuredCloneParse, t as structuredCloneDeserialize } from "../structured-clone-CgtQ61SA.mjs";
6
6
  import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
7
7
  import { promiseWithResolver } from "../utils/promise.mjs";
8
8
  import { isQualifiedName, qualifyName } from "../utils/scope.mjs";
@@ -2261,7 +2261,9 @@ async function getDevframeRpcClient(options = {}) {
2261
2261
  if (!connectionMeta) {
2262
2262
  const errors = [];
2263
2263
  for (const base of bases) try {
2264
- connectionMeta = await fetch(withBase(DEVFRAME_CONNECTION_META_FILENAME, base)).then((r) => r.json());
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();
2265
2267
  resolvedBaseURL = base;
2266
2268
  globalThis[CONNECTION_META_KEY] = {
2267
2269
  ...connectionMeta,
@@ -1,4 +1,4 @@
1
- import { b as DevframeNodeContext, ht as SharedState } from "./devframe-DfzYvlKI.mjs";
1
+ import { b as DevframeNodeContext, ht as SharedState } from "./devframe-BADsX91-.mjs";
2
2
  //#region src/node/hub-internals/context.d.ts
3
3
  interface InternalAnonymousAuthStorage {
4
4
  trusted: Record<string, {
@@ -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-BaCZYhIR.mjs"));
297
+ ({mountMcpHttp} = await import("./http-B2P55ZXg.mjs"));
298
298
  } catch (error) {
299
299
  const reason = error instanceof Error ? error.message : String(error);
300
300
  throw diagnostics.DF0017({
@@ -362,6 +362,29 @@ function resolveMcpConfig(mcp) {
362
362
  return mcp === true ? {} : mcp;
363
363
  }
364
364
  /**
365
+ * Resolve the `mcp` entry a `__connection.json` should advertise for a dev
366
+ * server started with the given `mcp` option (falling back to `def.cli?.mcp`,
367
+ * exactly like {@link createDevServer}), or `undefined` when the route is
368
+ * disabled.
369
+ *
370
+ * Hosted bridges that hand-roll their connection meta (`viteDevBridge`,
371
+ * `@devframes/next`'s handler) pass the side-car `port`: the advertised path
372
+ * becomes absolute (the side-car mounts at `/`) and the client dials
373
+ * `<page-host>:<port><path>`. Without `port` the path stays relative, resolved
374
+ * against `__connection.json`'s own location (the same-server default).
375
+ *
376
+ * @experimental
377
+ */
378
+ function resolveMcpConnectionMeta(def, mcp, port) {
379
+ const config = resolveMcpConfig(mcp ?? def.cli?.mcp);
380
+ if (!config) return void 0;
381
+ const route = withoutLeadingSlash(config.path ?? "__mcp");
382
+ return port != null ? {
383
+ path: withLeadingSlash(route),
384
+ port
385
+ } : { path: route };
386
+ }
387
+ /**
365
388
  * Resolve the three WS connection scenarios from the definition / call-site
366
389
  * config into a concrete server bind path, optional dedicated port, and the
367
390
  * `__connection.json` descriptor the browser resolves.
@@ -400,4 +423,4 @@ async function maybeOpenBrowser(def, flags, origin, override, authHandler) {
400
423
  } catch {}
401
424
  }
402
425
  //#endregion
403
- export { resolveDevServerPort as n, createDevServer as t };
426
+ export { resolveDevServerPort as n, resolveMcpConnectionMeta as r, createDevServer as t };
@@ -1319,10 +1319,15 @@ interface ConnectionMeta {
1319
1319
  * (`cli.mcp`). Advertises the MCP Streamable-HTTP route so in-browser
1320
1320
  * tooling (e.g. an MCP inspector) can discover it without guessing the
1321
1321
  * path. `path` is relative to `__connection.json`'s location, like the
1322
- * WebSocket `path`.
1322
+ * WebSocket `path`. `port` is set when the endpoint lives on a side-car
1323
+ * server on its own port (bridge mode — `viteDevBridge`,
1324
+ * `@devframes/next`): the client combines the page hostname with `port`
1325
+ * and resolves `path` against that origin, mirroring
1326
+ * {@link ConnectionMetaWebsocket.port}.
1323
1327
  */
1324
1328
  mcp?: {
1325
1329
  path: string;
1330
+ port?: number;
1326
1331
  };
1327
1332
  /**
1328
1333
  * Names of RPC functions that have declared `jsonSerializable: true`.
@@ -1,4 +1,4 @@
1
- import { p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-DfzYvlKI.mjs";
1
+ import { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-BADsX91-.mjs";
2
2
  //#region src/helpers/vite.d.ts
3
3
  interface ViteDevBridgeOptions {
4
4
  /**
@@ -43,6 +43,19 @@ interface ViteDevBridgeOptions {
43
43
  * @default false
44
44
  */
45
45
  auth?: boolean | DevframeAuthHandler;
46
+ /**
47
+ * Expose the side-car's route-based MCP server (Streamable-HTTP) and
48
+ * advertise it in the bridge's `__connection.json`. Forwarded to
49
+ * {@link createDevServer}: overrides `def.cli?.mcp`, `undefined` falls
50
+ * through to it, `false` disables the route regardless. Only applies in
51
+ * bridge mode (`devMiddleware`); the static-mount mode starts no server.
52
+ *
53
+ * The endpoint lives on the side-car's own port, so the advertised meta
54
+ * carries `{ port, path }` — see `ConnectionMeta['mcp']`.
55
+ *
56
+ * @experimental
57
+ */
58
+ mcp?: boolean | McpRouteOptions;
46
59
  }
47
60
  interface DevframeVitePlugin {
48
61
  name: string;
@@ -2,7 +2,7 @@ import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constan
2
2
  import { a as diagnostics } from "../storage-D_Xy9v1l.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-BdegDQKt.mjs";
5
+ import { n as resolveDevServerPort, r as resolveMcpConnectionMeta, t as createDevServer } from "../dev-OJFr4rx8.mjs";
6
6
  import { resolve } from "pathe";
7
7
  //#region src/helpers/vite.ts
8
8
  /**
@@ -58,7 +58,8 @@ function viteDevBridge(d, options = {}) {
58
58
  port,
59
59
  flags: mw.flags,
60
60
  openBrowser: false,
61
- auth: options.auth ?? false
61
+ auth: options.auth ?? false,
62
+ mcp: options.mcp
62
63
  });
63
64
  } catch (e) {
64
65
  diagnostics.DF0033({
@@ -68,6 +69,7 @@ function viteDevBridge(d, options = {}) {
68
69
  }, { method: "warn" });
69
70
  return;
70
71
  }
72
+ const mcpMeta = resolveMcpConnectionMeta(d, options.mcp, port);
71
73
  const metaPath = `${base}${DEVFRAME_CONNECTION_META_FILENAME}`;
72
74
  server.middlewares.use(metaPath, (_req, res) => {
73
75
  res.setHeader("Content-Type", "application/json");
@@ -76,7 +78,8 @@ function viteDevBridge(d, options = {}) {
76
78
  websocket: {
77
79
  port,
78
80
  path: `/${DEVFRAME_WS_ROUTE}`
79
- }
81
+ },
82
+ ...mcpMeta ? { mcp: mcpMeta } : {}
80
83
  }));
81
84
  });
82
85
  server.httpServer?.once("close", () => {
@@ -1,5 +1,5 @@
1
1
  import { isAllowedOrigin } from "./rpc/transports/ws-server.mjs";
2
- import { t as buildMcpServerFromContext } from "./build-server-CBAxmnC8.mjs";
2
+ import { t as buildMcpServerFromContext } from "./build-server-cANnMwg0.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-DfzYvlKI.mjs";
2
- import { n as InternalAnonymousAuthStorage } from "./context-FonV8enL.mjs";
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";
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-DfzYvlKI.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-BADsX91-.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-DfzYvlKI.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-CxpC1ItQ.mjs";
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";
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-DfzYvlKI.mjs";
2
- import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-FonV8enL.mjs";
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";
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,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-DfzYvlKI.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-BADsX91-.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-Bf27EWpv.mjs";
4
+ import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-Bu5iB3aV.mjs";
5
5
  import { BirpcGroup } from "birpc";
6
6
  //#region src/node/context.d.ts
7
7
  interface CreateHostContextOptions {
@@ -0,0 +1,118 @@
1
+ import "../devframe-BADsX91-.mjs";
2
+ import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CrzNxXKq.mjs";
3
+ import "../index-DgsLFhZg.mjs";
4
+ import * as v from "valibot";
5
+ //#region src/recipes/common-rpc-functions.d.ts
6
+ /**
7
+ * Editor commands that `launch-editor` (the library behind
8
+ * `devframe/utils/launch-editor`) recognizes with a tailored
9
+ * `file:line:column` invocation. `openInEditor`'s optional second argument
10
+ * is restricted to this union, so the RPC surface can't be used to spawn an
11
+ * arbitrary command.
12
+ */
13
+ type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm' | 'charm' | 'zed' | 'notepad++' | 'vim' | 'mvim' | 'joe' | 'gvim' | 'emacs' | 'emacsclient' | 'rmate' | 'mate' | 'code' | 'code-insiders' | 'codium' | 'vscodium' | 'trae' | 'antigravity' | 'cursor' | 'appcode' | 'clion' | 'idea' | 'phpstorm' | 'pycharm' | 'rubymine' | 'webstorm' | 'goland' | 'rider';
14
+ /** Runtime list of every {@link KnownEditor}, in the order `v.picklist` reports them. */
15
+ declare const KNOWN_EDITORS: KnownEditor[];
16
+ /**
17
+ * Prebuilt RPC action that opens a file in the user's configured editor.
18
+ *
19
+ * Registered name: `devframe:open-in-editor`.
20
+ *
21
+ * The optional second argument picks the editor command explicitly (must be
22
+ * one of {@link KNOWN_EDITORS}); otherwise it's auto-detected per
23
+ * `devframe/utils/launch-editor`.
24
+ *
25
+ * ```ts
26
+ * import { openInEditor } from 'devframe/recipes/common-rpc-functions'
27
+ *
28
+ * defineDevframe({
29
+ * id: 'my-tool',
30
+ * name: 'My Tool',
31
+ * setup(ctx) {
32
+ * ctx.rpc.register(openInEditor)
33
+ * },
34
+ * })
35
+ * ```
36
+ */
37
+ declare const openInEditor: {
38
+ name: "devframe:open-in-editor";
39
+ type?: "action" | undefined;
40
+ cacheable?: boolean;
41
+ args: readonly [v.StringSchema<undefined>, v.OptionalSchema<v.PicklistSchema<KnownEditor[], undefined>, undefined>];
42
+ returns: v.VoidSchema<undefined>;
43
+ jsonSerializable?: boolean;
44
+ agent?: RpcFunctionAgentOptions;
45
+ setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>>) | undefined;
46
+ handler?: ((args_0: string, args_1: KnownEditor | undefined) => void) | undefined;
47
+ dump?: RpcDump<[string, KnownEditor | undefined], void, undefined> | undefined;
48
+ snapshot?: boolean;
49
+ __cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>>> | undefined;
50
+ __promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>> | undefined;
51
+ };
52
+ /**
53
+ * Prebuilt RPC action that reveals a path in the OS file explorer.
54
+ *
55
+ * Registered name: `devframe:open-in-finder`.
56
+ *
57
+ * ```ts
58
+ * import { openInFinder } from 'devframe/recipes/common-rpc-functions'
59
+ *
60
+ * ctx.rpc.register(openInFinder)
61
+ * ```
62
+ */
63
+ declare const openInFinder: {
64
+ name: "devframe:open-in-finder";
65
+ type?: "action" | undefined;
66
+ cacheable?: boolean;
67
+ args: readonly [v.StringSchema<undefined>];
68
+ returns: v.VoidSchema<undefined>;
69
+ jsonSerializable?: boolean;
70
+ agent?: RpcFunctionAgentOptions;
71
+ setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], void>>) | undefined;
72
+ handler?: ((args_0: string) => void) | undefined;
73
+ dump?: RpcDump<[string], void, undefined> | undefined;
74
+ snapshot?: boolean;
75
+ __cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], void>>> | undefined;
76
+ __promise?: Thenable<RpcFunctionSetupResult<[string], void>> | undefined;
77
+ };
78
+ /**
79
+ * Convenience array bundling both helpers so callers can register them
80
+ * in a single `forEach`.
81
+ *
82
+ * ```ts
83
+ * import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
84
+ *
85
+ * commonRpcFunctions.forEach(fn => ctx.rpc.register(fn))
86
+ * ```
87
+ */
88
+ declare const commonRpcFunctions: readonly [{
89
+ name: "devframe:open-in-editor";
90
+ type?: "action" | undefined;
91
+ cacheable?: boolean;
92
+ args: readonly [v.StringSchema<undefined>, v.OptionalSchema<v.PicklistSchema<KnownEditor[], undefined>, undefined>];
93
+ returns: v.VoidSchema<undefined>;
94
+ jsonSerializable?: boolean;
95
+ agent?: RpcFunctionAgentOptions;
96
+ setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>>) | undefined;
97
+ handler?: ((args_0: string, args_1: KnownEditor | undefined) => void) | undefined;
98
+ dump?: RpcDump<[string, KnownEditor | undefined], void, undefined> | undefined;
99
+ snapshot?: boolean;
100
+ __cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>>> | undefined;
101
+ __promise?: Thenable<RpcFunctionSetupResult<[string, KnownEditor | undefined], void>> | undefined;
102
+ }, {
103
+ name: "devframe:open-in-finder";
104
+ type?: "action" | undefined;
105
+ cacheable?: boolean;
106
+ args: readonly [v.StringSchema<undefined>];
107
+ returns: v.VoidSchema<undefined>;
108
+ jsonSerializable?: boolean;
109
+ agent?: RpcFunctionAgentOptions;
110
+ setup?: ((context: undefined) => Thenable<RpcFunctionSetupResult<[string], void>>) | undefined;
111
+ handler?: ((args_0: string) => void) | undefined;
112
+ dump?: RpcDump<[string], void, undefined> | undefined;
113
+ snapshot?: boolean;
114
+ __cache?: WeakMap<object, Thenable<RpcFunctionSetupResult<[string], void>>> | undefined;
115
+ __promise?: Thenable<RpcFunctionSetupResult<[string], void>> | undefined;
116
+ }];
117
+ //#endregion
118
+ export { KNOWN_EDITORS, KnownEditor, commonRpcFunctions, openInEditor, openInFinder };
@@ -0,0 +1,105 @@
1
+ import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
2
+ import * as v from "valibot";
3
+ //#region src/recipes/common-rpc-functions.ts
4
+ /** Runtime list of every {@link KnownEditor}, in the order `v.picklist` reports them. */
5
+ const KNOWN_EDITORS = [
6
+ "atom",
7
+ "subl",
8
+ "sublime",
9
+ "sublime_text",
10
+ "wstorm",
11
+ "charm",
12
+ "zed",
13
+ "notepad++",
14
+ "vim",
15
+ "mvim",
16
+ "joe",
17
+ "gvim",
18
+ "emacs",
19
+ "emacsclient",
20
+ "rmate",
21
+ "mate",
22
+ "code",
23
+ "code-insiders",
24
+ "codium",
25
+ "vscodium",
26
+ "trae",
27
+ "antigravity",
28
+ "cursor",
29
+ "appcode",
30
+ "clion",
31
+ "idea",
32
+ "phpstorm",
33
+ "pycharm",
34
+ "rubymine",
35
+ "webstorm",
36
+ "goland",
37
+ "rider"
38
+ ];
39
+ /**
40
+ * Prebuilt RPC action that opens a file in the user's configured editor.
41
+ *
42
+ * Registered name: `devframe:open-in-editor`.
43
+ *
44
+ * The optional second argument picks the editor command explicitly (must be
45
+ * one of {@link KNOWN_EDITORS}); otherwise it's auto-detected per
46
+ * `devframe/utils/launch-editor`.
47
+ *
48
+ * ```ts
49
+ * import { openInEditor } from 'devframe/recipes/common-rpc-functions'
50
+ *
51
+ * defineDevframe({
52
+ * id: 'my-tool',
53
+ * name: 'My Tool',
54
+ * setup(ctx) {
55
+ * ctx.rpc.register(openInEditor)
56
+ * },
57
+ * })
58
+ * ```
59
+ */
60
+ const openInEditor = defineRpcFunction({
61
+ name: "devframe:open-in-editor",
62
+ type: "action",
63
+ jsonSerializable: true,
64
+ args: [v.string(), v.optional(v.picklist(KNOWN_EDITORS))],
65
+ returns: v.void(),
66
+ async handler(filename, editor) {
67
+ const { launchEditor } = await import("../utils/launch-editor.mjs");
68
+ launchEditor(filename, editor);
69
+ }
70
+ });
71
+ /**
72
+ * Prebuilt RPC action that reveals a path in the OS file explorer.
73
+ *
74
+ * Registered name: `devframe:open-in-finder`.
75
+ *
76
+ * ```ts
77
+ * import { openInFinder } from 'devframe/recipes/common-rpc-functions'
78
+ *
79
+ * ctx.rpc.register(openInFinder)
80
+ * ```
81
+ */
82
+ const openInFinder = defineRpcFunction({
83
+ name: "devframe:open-in-finder",
84
+ type: "action",
85
+ jsonSerializable: true,
86
+ args: [v.string()],
87
+ returns: v.void(),
88
+ async handler(path) {
89
+ const { open } = await import("../utils/open.mjs");
90
+ await open(path);
91
+ }
92
+ });
93
+ /**
94
+ * Convenience array bundling both helpers so callers can register them
95
+ * in a single `forEach`.
96
+ *
97
+ * ```ts
98
+ * import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
99
+ *
100
+ * commonRpcFunctions.forEach(fn => ctx.rpc.register(fn))
101
+ * ```
102
+ */
103
+ const commonRpcFunctions = [openInEditor, openInFinder];
104
+ //#endregion
105
+ export { KNOWN_EDITORS, commonRpcFunctions, openInEditor, openInFinder };
@@ -1,5 +1,5 @@
1
- import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-DfzYvlKI.mjs";
2
- import "../index-CxpC1ItQ.mjs";
1
+ import { b as DevframeNodeContext, p as DevframeAuthHandler } from "../devframe-BADsX91-.mjs";
2
+ import "../index-Brcd2V4t.mjs";
3
3
  //#region src/recipes/interactive-auth.d.ts
4
4
  interface CreateInteractiveAuthOptions {
5
5
  /**