devframe 0.5.4 → 0.6.0-beta.2

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 (84) hide show
  1. package/dist/{_shared-CUFqO4kJ.mjs → _shared-bWRzeSa0.mjs} +2 -3
  2. package/dist/adapters/build.d.mts +1 -1
  3. package/dist/adapters/build.mjs +7 -7
  4. package/dist/adapters/cli.d.mts +1 -1
  5. package/dist/adapters/cli.mjs +2 -2
  6. package/dist/adapters/dev.d.mts +8 -2
  7. package/dist/adapters/dev.mjs +1 -1
  8. package/dist/adapters/embedded.d.mts +1 -1
  9. package/dist/adapters/mcp.d.mts +1 -1
  10. package/dist/adapters/mcp.mjs +4 -4
  11. package/dist/client/index.d.mts +148 -6
  12. package/dist/client/index.mjs +257 -44
  13. package/dist/constants.d.mts +17 -1
  14. package/dist/constants.mjs +17 -1
  15. package/dist/context-3x_bgBgZ.mjs +48 -0
  16. package/dist/{context-DTRcO_UH.d.mts → context-BEVByy_Z.d.mts} +1 -1
  17. package/dist/{dev-Cv43GfqM.mjs → dev-BaX8fLH2.mjs} +39 -13
  18. package/dist/{devframe-BuR6n9ZD.d.mts → devframe-D-gr9sBx.d.mts} +365 -15
  19. package/dist/{diagnostics-GitRGKbr.mjs → diagnostics-BXwBQmoN.mjs} +1 -1
  20. package/dist/{dump-9lKIJTLh.mjs → dump-DoXkj4ku.mjs} +1 -1
  21. package/dist/helpers/vite.d.mts +1 -1
  22. package/dist/helpers/vite.mjs +11 -11
  23. package/dist/{host-h3-Dgpgr1Ul.mjs → host-h3-C5SZlk03.mjs} +134 -6
  24. package/dist/{index-C7M1hnvL.d.mts → index-CxaPKDXX.d.mts} +2 -2
  25. package/dist/{index-DH2sBIwd.d.mts → index-DXHWuwJk.d.mts} +1 -1
  26. package/dist/index.d.mts +4 -4
  27. package/dist/index.mjs +1 -1
  28. package/dist/{launch-editor-BbNhtg7b.mjs → launch-editor-DPfltGA4.mjs} +88 -13
  29. package/dist/node/auth.d.mts +43 -23
  30. package/dist/node/auth.mjs +84 -37
  31. package/dist/node/hub-internals.d.mts +2 -2
  32. package/dist/node/hub-internals.mjs +2 -2
  33. package/dist/node/index.d.mts +22 -6
  34. package/dist/node/index.mjs +4 -4
  35. package/dist/recipes/open-helpers.d.mts +1 -1
  36. package/dist/recipes/open-helpers.mjs +3 -3
  37. package/dist/revoke-ENfxWkFK.mjs +79 -0
  38. package/dist/rpc/dump.d.mts +1 -1
  39. package/dist/rpc/dump.mjs +1 -1
  40. package/dist/rpc/index.d.mts +3 -3
  41. package/dist/rpc/index.mjs +4 -4
  42. package/dist/rpc/transports/ws-client.d.mts +1 -1
  43. package/dist/rpc/transports/ws-client.mjs +2 -2
  44. package/dist/rpc/transports/ws-server.d.mts +2 -2
  45. package/dist/rpc/transports/ws-server.mjs +154 -61
  46. package/dist/{serialization-BD_qXGjd.mjs → serialization-DpLXCy13.mjs} +1 -1
  47. package/dist/{server-BBaBJaUL.mjs → server-Dl6TU5LE.mjs} +19 -14
  48. package/dist/server-rX781kz-.d.mts +90 -0
  49. package/dist/{shared-state-u0y123fi.mjs → shared-state-D4PPieA0.mjs} +4 -4
  50. package/dist/{shared-state-BlBNYziY.mjs → storage-l2ezeend.mjs} +128 -6
  51. package/dist/types/index.d.mts +4 -4
  52. package/dist/{types-BkkQ0Txg.d.mts → types-DZEx4ffs.d.mts} +9 -1
  53. package/dist/utils/crypto-token.d.mts +24 -0
  54. package/dist/utils/crypto-token.mjs +45 -0
  55. package/dist/utils/events.d.mts +1 -1
  56. package/dist/utils/hash.mjs +1 -1
  57. package/dist/utils/launch-editor.mjs +1 -1
  58. package/dist/utils/open.mjs +1 -1
  59. package/dist/utils/scope.d.mts +11 -0
  60. package/dist/utils/scope.mjs +15 -0
  61. package/dist/utils/shared-state.d.mts +1 -1
  62. package/dist/utils/shared-state.mjs +1 -1
  63. package/dist/utils/streaming-channel.d.mts +1 -1
  64. package/dist/utils/structured-clone.mjs +1 -1
  65. package/dist/{ws-client-CVYX9niP.d.mts → ws-client-D0z0pOhn.d.mts} +1 -1
  66. package/dist/ws-server-Bc2wBHl-.d.mts +119 -0
  67. package/package.json +12 -7
  68. package/skills/devframe/SKILL.md +123 -23
  69. package/skills/devframe/templates/counter-devframe.ts +14 -4
  70. package/skills/devframe/templates/spa-devframe.ts +13 -3
  71. package/skills/devframe/templates/vite-client.ts +3 -2
  72. package/dist/context-DaKmhhHY.mjs +0 -164
  73. package/dist/revoke-CL0LSAN9.mjs +0 -803
  74. package/dist/server-wHlpcdZ9.d.mts +0 -55
  75. package/dist/utils/human-id.d.mts +0 -8
  76. package/dist/utils/human-id.mjs +0 -769
  77. package/dist/ws-server-C1LjmRnp.d.mts +0 -61
  78. /package/dist/{define-CW9gLnyG.mjs → define-BLWPsH6y.mjs} +0 -0
  79. /package/dist/{diagnostics-reporter-CBBZwoMv.mjs → diagnostics-reporter-CsIG85Q5.mjs} +0 -0
  80. /package/dist/{hash-bwOD8RgU.mjs → hash-DFc5WwhO.mjs} +0 -0
  81. /package/dist/{open-DiQn6zCH.mjs → open-Dusa2Zzd.mjs} +0 -0
  82. /package/dist/{structured-clone-PdCZwt7F.mjs → structured-clone-CeZOHvkd.mjs} +0 -0
  83. /package/dist/{structured-clone-jegjz0hM.mjs → structured-clone-XpHLZ8nr.mjs} +0 -0
  84. /package/dist/{transports-DTFoMUbE.mjs → transports-BmDVn4SF.mjs} +0 -0
@@ -1,3 +1,4 @@
1
+ import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash } from "ufo";
1
2
  //#region src/adapters/_shared.ts
2
3
  /**
3
4
  * Resolve the mount base path for a devframe's SPA. Hosted adapters
@@ -12,9 +13,7 @@ function resolveBasePath(def, kind) {
12
13
  return kind === "standalone" ? "/" : `/__${def.id}/`;
13
14
  }
14
15
  function normalizeBasePath(base) {
15
- let out = base.startsWith("/") ? base : `/${base}`;
16
- if (!out.endsWith("/")) out = `${out}/`;
17
- return out.replace(/\/+/g, "/");
16
+ return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
18
17
  }
19
18
  //#endregion
20
19
  export { resolveBasePath as n, normalizeBasePath as t };
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-BuR6n9ZD.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
2
2
 
3
3
  //#region src/adapters/build.d.ts
4
4
  interface CreateBuildOptions {
@@ -1,13 +1,13 @@
1
- import { t as collectStaticRpcDump } from "../dump-9lKIJTLh.mjs";
2
- import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
1
+ import { t as collectStaticRpcDump } from "../dump-DoXkj4ku.mjs";
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
- import { n as strictJsonStringify } from "../serialization-BD_qXGjd.mjs";
5
- import { n as structuredCloneStringify } from "../structured-clone-jegjz0hM.mjs";
6
- import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-Dgpgr1Ul.mjs";
7
- import { n as resolveBasePath } from "../_shared-CUFqO4kJ.mjs";
4
+ import { n as strictJsonStringify } from "../serialization-DpLXCy13.mjs";
5
+ import { n as structuredCloneStringify } from "../structured-clone-XpHLZ8nr.mjs";
6
+ import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-C5SZlk03.mjs";
7
+ import { n as resolveBasePath } from "../_shared-bWRzeSa0.mjs";
8
8
  import { existsSync } from "node:fs";
9
- import process from "node:process";
10
9
  import { dirname, resolve } from "pathe";
10
+ import process from "node:process";
11
11
  import fs$1 from "node:fs/promises";
12
12
  //#region src/adapters/build.ts
13
13
  /**
@@ -1,4 +1,4 @@
1
- import { dt as defineCliFlags, ft as parseCliFlags, lt as CliFlagsSchema, r as DevframeDefinition, ut as InferCliFlags } from "../devframe-BuR6n9ZD.mjs";
1
+ import { Ct as CliFlagsSchema, Et as parseCliFlags, Tt as defineCliFlags, r as DevframeDefinition, wt as InferCliFlags } from "../devframe-D-gr9sBx.mjs";
2
2
  import { CAC } from "cac";
3
3
  import { H3 } from "h3";
4
4
 
@@ -1,6 +1,6 @@
1
- import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
1
+ import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
2
2
  import { createBuild } from "./build.mjs";
3
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-Cv43GfqM.mjs";
3
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BaX8fLH2.mjs";
4
4
  import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
@@ -1,5 +1,5 @@
1
- import { r as DevframeDefinition } from "../devframe-BuR6n9ZD.mjs";
2
- import { n as StartedServer } from "../server-wHlpcdZ9.mjs";
1
+ import { l as DevframeWsOptions, r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
2
+ import { n as StartedServer } from "../server-rX781kz-.mjs";
3
3
  import { H3 } from "h3";
4
4
 
5
5
  //#region src/adapters/dev.d.ts
@@ -31,6 +31,12 @@ interface CreateDevServerOptions {
31
31
  * `resolveBasePath(def, 'standalone')` (i.e. `def.basePath` or `/`).
32
32
  */
33
33
  basePath?: string;
34
+ /**
35
+ * Override how the browser reaches the RPC WebSocket (`def.cli?.ws`).
36
+ * See {@link DevframeWsOptions}: same-server route (default), a dedicated
37
+ * port, or a remote origin.
38
+ */
39
+ ws?: DevframeWsOptions;
34
40
  /**
35
41
  * h3 app to mount the SPA + connection-meta routes on. When omitted
36
42
  * a fresh app is created. Pass a pre-configured app to attach custom
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-Cv43GfqM.mjs";
1
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BaX8fLH2.mjs";
2
2
  export { createDevServer, resolveDevServerPort };
@@ -1,4 +1,4 @@
1
- import { d as DevframeNodeContext, r as DevframeDefinition } from "../devframe-BuR6n9ZD.mjs";
1
+ import { m as DevframeNodeContext, r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
2
2
 
3
3
  //#region src/adapters/embedded.d.ts
4
4
  interface CreateEmbeddedOptions {
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-BuR6n9ZD.mjs";
1
+ import { r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
2
2
  //#region src/adapters/mcp/build-server.d.ts
3
3
  interface CreateMcpServerOptions {
4
4
  /**
@@ -1,8 +1,8 @@
1
- import { i as diagnostics } from "../shared-state-BlBNYziY.mjs";
2
- import { n as createHostContext } from "../host-h3-Dgpgr1Ul.mjs";
1
+ import { a as diagnostics } from "../storage-l2ezeend.mjs";
2
+ import { n as createHostContext } from "../host-h3-C5SZlk03.mjs";
3
+ import { join } from "pathe";
3
4
  import { homedir } from "node:os";
4
5
  import process from "node:process";
5
- import { join } from "pathe";
6
6
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
7
7
  import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema } from "@modelcontextprotocol/sdk/types.js";
8
8
  import { toJsonSchema } from "@valibot/to-json-schema";
@@ -204,7 +204,7 @@ async function createMcpServer(definition, options = {}) {
204
204
  serverVersion: options.serverVersion ?? definition.version ?? "0.0.0",
205
205
  exposeSharedState: options.exposeSharedState ?? true
206
206
  });
207
- const { startStdioTransport } = await import("../transports-DTFoMUbE.mjs");
207
+ const { startStdioTransport } = await import("../transports-BmDVn4SF.mjs");
208
208
  let stop;
209
209
  try {
210
210
  stop = await startStdioTransport(server);
@@ -1,7 +1,7 @@
1
- import { T as StreamSink, U as DevframeRpcClientFunctions, W as DevframeRpcServerFunctions, g as RpcSharedStateHost, l as ConnectionMeta, ot as EventEmitter, w as StreamReader } from "../devframe-BuR6n9ZD.mjs";
2
- import { C as RpcFunctionsCollector } from "../types-BkkQ0Txg.mjs";
3
- import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-C7M1hnvL.mjs";
4
- import { t as WsRpcChannelOptions } from "../ws-client-CVYX9niP.mjs";
1
+ import { $ as ScopedServerFunctions, D as StreamReader, J as DevframeSettings, L as SharedState, O as StreamSink, bt as EventEmitter, d as ConnectionMeta, et as ScopedSharedStates, it as DevframeRpcServerFunctions, rt as DevframeRpcClientFunctions, tt as SettingsForNamespace, v as RpcSharedStateGetOptions, y as RpcSharedStateHost } from "../devframe-D-gr9sBx.mjs";
2
+ import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-DZEx4ffs.mjs";
3
+ import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-CxaPKDXX.mjs";
4
+ import { t as WsRpcChannelOptions } from "../ws-client-D0z0pOhn.mjs";
5
5
  import { BirpcOptions, BirpcReturn } from "birpc";
6
6
 
7
7
  //#region src/client/rpc-streaming.d.ts
@@ -34,6 +34,81 @@ interface RpcStreamingClientHost {
34
34
  */
35
35
  declare function createRpcStreamingClientHost(rpc: DevframeRpcClient): RpcStreamingClientHost;
36
36
  //#endregion
37
+ //#region src/client/scope.d.ts
38
+ type AnyRpcFn = (...args: any[]) => any;
39
+ /**
40
+ * Client-side streaming host scoped to a namespace. Channel names are
41
+ * auto-prefixed with `<namespace>:`.
42
+ */
43
+ interface DevframeScopedClientStreamingHost {
44
+ subscribe: <T = unknown>(channel: string, id: string, options?: StreamingSubscribeOptions) => StreamReader<T>;
45
+ upload: <T = unknown>(channel: string, id: string) => StreamSink<T>;
46
+ }
47
+ /**
48
+ * The scoped client RPC surface exposed on
49
+ * `client.scope('my-plugin').rpc`. IDs and keys you pass are
50
+ * auto-namespaced with `my-plugin:`.
51
+ */
52
+ interface DevframeScopedClientRpc<NS extends string = string> {
53
+ /** The namespace this surface is scoped to. */
54
+ readonly namespace: NS;
55
+ /**
56
+ * Register a client (server→client) RPC function. The definition's
57
+ * `name` must be bare (no `:`); it is stored as `<namespace>:<name>`.
58
+ */
59
+ register: (fn: RpcFunctionDefinition<string, any, any, any, any, any, DevframeRpcContext>) => void;
60
+ /** Call a server RPC function. Bare names resolve within this namespace. */
61
+ call: {
62
+ <T extends keyof ScopedServerFunctions<NS> & string>(method: T, ...args: Parameters<Extract<ScopedServerFunctions<NS>[T], AnyRpcFn>>): Promise<Awaited<ReturnType<Extract<ScopedServerFunctions<NS>[T], AnyRpcFn>>>>;
63
+ <T extends keyof DevframeRpcServerFunctions & string>(method: T, ...args: Parameters<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>): Promise<Awaited<ReturnType<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>>>;
64
+ (method: string, ...args: any[]): Promise<any>;
65
+ };
66
+ /** Call a server RPC event (fire-and-forget). */
67
+ callEvent: {
68
+ <T extends keyof ScopedServerFunctions<NS> & string>(method: T, ...args: Parameters<Extract<ScopedServerFunctions<NS>[T], AnyRpcFn>>): void;
69
+ <T extends keyof DevframeRpcServerFunctions & string>(method: T, ...args: Parameters<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>): void;
70
+ (method: string, ...args: any[]): void;
71
+ };
72
+ /** Call an optional server RPC function (no error if unregistered). */
73
+ callOptional: {
74
+ <T extends keyof ScopedServerFunctions<NS> & string>(method: T, ...args: Parameters<Extract<ScopedServerFunctions<NS>[T], AnyRpcFn>>): Promise<Awaited<ReturnType<Extract<ScopedServerFunctions<NS>[T], AnyRpcFn>>> | undefined>;
75
+ <T extends keyof DevframeRpcServerFunctions & string>(method: T, ...args: Parameters<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>): Promise<Awaited<ReturnType<Extract<DevframeRpcServerFunctions[T], AnyRpcFn>>> | undefined>;
76
+ (method: string, ...args: any[]): Promise<any>;
77
+ };
78
+ /** Resolve a namespaced shared state. Bare keys resolve within this namespace. */
79
+ sharedState: {
80
+ <T extends keyof ScopedSharedStates<NS> & string>(key: T, options?: RpcSharedStateGetOptions<ScopedSharedStates<NS>[T]>): Promise<SharedState<ScopedSharedStates<NS>[T]>>;
81
+ <T extends Record<string, any> = Record<string, any>>(key: string, options?: RpcSharedStateGetOptions<T>): Promise<SharedState<T>>;
82
+ };
83
+ /** Streaming host scoped to this namespace. */
84
+ streaming: DevframeScopedClientStreamingHost;
85
+ }
86
+ /**
87
+ * A namespace-scoped view of the {@link DevframeRpcClient}. Returned by
88
+ * `client.scope('my-plugin')`. Replaces `rpc` with the auto-namespaced
89
+ * surface and adds a top-level `settings` store.
90
+ */
91
+ interface DevframeScopedClientContext<NS extends string = string, Settings extends Record<string, any> = Record<string, any>> {
92
+ /** The namespace this context is scoped to. */
93
+ readonly namespace: NS;
94
+ /** The underlying unscoped client. */
95
+ readonly base: DevframeRpcClient;
96
+ rpc: DevframeScopedClientRpc<NS>;
97
+ /** Persisted settings for this namespace (`global` + `project`). */
98
+ settings: DevframeSettings<Settings>;
99
+ /**
100
+ * Return a new scoped client, replacing the current scope. Pass `null`
101
+ * or `''` to un-scope and get the base client.
102
+ */
103
+ scope: DevframeRpcClient['scope'];
104
+ }
105
+ /**
106
+ * Build a namespace-scoped view of a {@link DevframeRpcClient}. Every RPC
107
+ * id, shared-state key, and streaming channel passed through the returned
108
+ * `rpc` surface is auto-namespaced with `<namespace>:`.
109
+ */
110
+ declare function createScopedClientContext<NS extends string = string>(rpc: DevframeRpcClient, namespace: NS): DevframeScopedClientContext<NS>;
111
+ //#endregion
37
112
  //#region src/client/rpc.d.ts
38
113
  interface DevframeRpcContext {
39
114
  /**
@@ -52,6 +127,14 @@ interface DevframeRpcClientOptions {
52
127
  * The auth token to use for the client
53
128
  */
54
129
  authToken?: string;
130
+ /**
131
+ * Query-param name on the page URL carrying a one-time authentication code
132
+ * (OTP) for "magic link" auth (e.g. a link the dev server prints). When
133
+ * present, the client exchanges the code for a token and removes the parameter
134
+ * from the URL. Set `false` to disable — e.g. integrations that drive their
135
+ * own authentication via `authenticateWithUrlOtp`. Default: `'devframe_otp'`.
136
+ */
137
+ otpParam?: string | false;
55
138
  wsOptions?: Partial<WsRpcChannelOptions>;
56
139
  rpcOptions?: Partial<BirpcOptions<DevframeRpcServerFunctions, DevframeRpcClientFunctions, boolean>>;
57
140
  cacheOptions?: boolean | Partial<RpcCacheOptions>;
@@ -85,10 +168,17 @@ interface DevframeRpcClient {
85
168
  */
86
169
  requestTrust: () => Promise<boolean>;
87
170
  /**
88
- * Request trust from the server using a specific auth token.
171
+ * Request trust from the server using a previously-issued auth token.
89
172
  * Updates the stored token and re-requests trust without reloading the page.
90
173
  */
91
174
  requestTrustWithToken: (token: string) => Promise<boolean>;
175
+ /**
176
+ * Authenticate this client by exchanging a one-time code (shown by the dev
177
+ * server) for a node-issued auth token. On success the token is persisted for
178
+ * future reconnections and shared with sibling tabs. Resolves `true` when
179
+ * authenticated.
180
+ */
181
+ requestTrustWithCode: (code: string) => Promise<boolean>;
92
182
  /**
93
183
  * Call a RPC function on the server
94
184
  */
@@ -119,19 +209,71 @@ interface DevframeRpcClient {
119
209
  * The RPC cache manager
120
210
  */
121
211
  cacheManager: RpcCacheManager;
212
+ /**
213
+ * Create a namespace-scoped view of this client. The returned
214
+ * `client.scope('my-plugin')` auto-namespaces every RPC id,
215
+ * shared-state key, and streaming channel with `my-plugin:`, and
216
+ * exposes a typed top-level `settings` store. This is the preferred way
217
+ * to consume the client from a single tool's UI code.
218
+ *
219
+ * Pass `null` or `''` to un-scope and get the base client.
220
+ */
221
+ scope: {
222
+ <NS extends string>(namespace: NS): DevframeScopedClientContext<NS, SettingsForNamespace<NS>>;
223
+ (namespace?: null | ''): DevframeRpcClient;
224
+ };
122
225
  }
123
226
  interface DevframeRpcClientMode {
124
227
  readonly isTrusted: boolean;
125
228
  ensureTrusted: DevframeRpcClient['ensureTrusted'];
126
229
  requestTrust: DevframeRpcClient['requestTrust'];
127
230
  requestTrustWithToken: DevframeRpcClient['requestTrustWithToken'];
231
+ /**
232
+ * Exchange a one-time code for a node-issued token. Resolves the minted
233
+ * token on success (for the caller to persist), or `null` on failure.
234
+ */
235
+ requestTrustWithCode: (code: string) => Promise<string | null>;
128
236
  call: DevframeRpcClient['call'];
129
237
  callEvent: DevframeRpcClient['callEvent'];
130
238
  callOptional: DevframeRpcClient['callOptional'];
131
239
  }
132
240
  declare function getDevframeRpcClient(options?: DevframeRpcClientOptions): Promise<DevframeRpcClient>;
133
241
  //#endregion
242
+ //#region src/client/otp.d.ts
243
+ /**
244
+ * Read a one-time authentication code (OTP) from the current page URL's query
245
+ * string, without side effects. Returns `undefined` when the parameter is absent.
246
+ */
247
+ declare function readOtpFromUrl(param?: string): string | undefined;
248
+ /**
249
+ * Read the one-time code from the page URL and remove it from the address bar
250
+ * (and the current history entry), so the single-use code isn't left in the
251
+ * URL, browser history, or a `Referer`. Returns the code, or `undefined` when
252
+ * absent.
253
+ */
254
+ declare function consumeOtpFromUrl(param?: string): string | undefined;
255
+ /**
256
+ * Consume a one-time code from the page URL (see {@link consumeOtpFromUrl}) and
257
+ * exchange it for a token via the client. Resolves `true` when the client is
258
+ * authenticated (already trusted, or the exchange succeeded), and `false` when
259
+ * no code is present or the exchange failed.
260
+ *
261
+ * Higher-level integrations (e.g. Vite DevTools) that want to drive their own
262
+ * authentication UI can disable `connectDevframe`'s built-in handling with
263
+ * `otpParam: false` and call this — or {@link consumeOtpFromUrl} — themselves.
264
+ */
265
+ declare function authenticateWithUrlOtp(rpc: Pick<DevframeRpcClient, 'isTrusted' | 'requestTrustWithCode'>, options?: {
266
+ param?: string;
267
+ }): Promise<boolean>;
268
+ //#endregion
269
+ //#region src/client/settings.d.ts
270
+ /**
271
+ * Build the client-side `settings` surface for a scope namespace. Mirrors
272
+ * the node-side stores over the shared-state sync protocol.
273
+ */
274
+ declare function createClientSettings<T extends Record<string, any> = Record<string, any>>(rpc: DevframeRpcClient, namespace: string): DevframeSettings<T>;
275
+ //#endregion
134
276
  //#region src/client/index.d.ts
135
277
  declare const connectDevframe: typeof getDevframeRpcClient;
136
278
  //#endregion
137
- export { DevframeClientRpcHost, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, RpcClientEvents, RpcStreamingClientHost, StreamingSubscribeOptions, connectDevframe, createRpcStreamingClientHost, getDevframeRpcClient };
279
+ export { DevframeClientRpcHost, DevframeRpcClient, DevframeRpcClientCall, DevframeRpcClientCallEvent, DevframeRpcClientCallOptional, DevframeRpcClientMode, DevframeRpcClientOptions, DevframeRpcContext, DevframeScopedClientContext, DevframeScopedClientRpc, DevframeScopedClientStreamingHost, RpcClientEvents, RpcStreamingClientHost, StreamingSubscribeOptions, authenticateWithUrlOtp, connectDevframe, consumeOtpFromUrl, createClientSettings, createRpcStreamingClientHost, createScopedClientContext, getDevframeRpcClient, readOtpFromUrl };