devframe 0.5.3 → 0.6.0-beta.1
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.
- package/dist/{_shared-CUFqO4kJ.mjs → _shared-bWRzeSa0.mjs} +2 -3
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +7 -7
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +2 -2
- package/dist/adapters/dev.d.mts +8 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +4 -4
- package/dist/client/index.d.mts +148 -6
- package/dist/client/index.mjs +272 -49
- package/dist/constants.d.mts +17 -1
- package/dist/constants.mjs +17 -1
- package/dist/context-3x_bgBgZ.mjs +48 -0
- package/dist/{context-DTRcO_UH.d.mts → context-o-TwncyP.d.mts} +1 -1
- package/dist/{dev-Cv43GfqM.mjs → dev-CSpLSEVh.mjs} +39 -13
- package/dist/{devframe-BuR6n9ZD.d.mts → devframe-BwfavB78.d.mts} +365 -15
- package/dist/{diagnostics-GitRGKbr.mjs → diagnostics-BXwBQmoN.mjs} +1 -1
- package/dist/{dump-9lKIJTLh.mjs → dump-DoXkj4ku.mjs} +1 -1
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +11 -11
- package/dist/{host-h3-Dgpgr1Ul.mjs → host-h3-C5SZlk03.mjs} +134 -6
- package/dist/{index-C7M1hnvL.d.mts → index-CxaPKDXX.d.mts} +2 -2
- package/dist/{index-DH2sBIwd.d.mts → index-DXHWuwJk.d.mts} +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/node/auth.d.mts +43 -23
- package/dist/node/auth.mjs +84 -37
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +22 -6
- package/dist/node/index.mjs +4 -4
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +3 -3
- package/dist/revoke-ENfxWkFK.mjs +79 -0
- package/dist/rpc/dump.d.mts +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -2
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +124 -60
- package/dist/{serialization-BD_qXGjd.mjs → serialization-DpLXCy13.mjs} +1 -1
- package/dist/{server-wHlpcdZ9.d.mts → server-oju7PTi2.d.mts} +30 -3
- package/dist/{server-BBaBJaUL.mjs → server-wyY3zh67.mjs} +18 -14
- package/dist/{shared-state-u0y123fi.mjs → shared-state-D4PPieA0.mjs} +4 -4
- package/dist/{shared-state-BlBNYziY.mjs → storage-l2ezeend.mjs} +128 -6
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-BkkQ0Txg.d.mts → types-DZEx4ffs.d.mts} +9 -1
- package/dist/utils/crypto-token.d.mts +24 -0
- package/dist/utils/crypto-token.mjs +45 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/scope.d.mts +11 -0
- package/dist/utils/scope.mjs +15 -0
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.mjs +1 -1
- package/dist/{ws-client-CVYX9niP.d.mts → ws-client-D0z0pOhn.d.mts} +1 -1
- package/dist/ws-server-BVVMDo2n.d.mts +103 -0
- package/package.json +12 -7
- package/skills/devframe/SKILL.md +123 -23
- package/skills/devframe/templates/counter-devframe.ts +14 -4
- package/skills/devframe/templates/spa-devframe.ts +13 -3
- package/skills/devframe/templates/vite-client.ts +3 -2
- package/dist/context-DaKmhhHY.mjs +0 -164
- package/dist/revoke-CL0LSAN9.mjs +0 -803
- package/dist/utils/human-id.d.mts +0 -8
- package/dist/utils/human-id.mjs +0 -769
- package/dist/ws-server-C1LjmRnp.d.mts +0 -61
- /package/dist/{define-CW9gLnyG.mjs → define-BLWPsH6y.mjs} +0 -0
- /package/dist/{diagnostics-reporter-CBBZwoMv.mjs → diagnostics-reporter-CsIG85Q5.mjs} +0 -0
- /package/dist/{hash-bwOD8RgU.mjs → hash-DFc5WwhO.mjs} +0 -0
- /package/dist/{launch-editor-BbNhtg7b.mjs → launch-editor-CgXBgviI.mjs} +0 -0
- /package/dist/{open-DiQn6zCH.mjs → open-Dusa2Zzd.mjs} +0 -0
- /package/dist/{structured-clone-PdCZwt7F.mjs → structured-clone-CeZOHvkd.mjs} +0 -0
- /package/dist/{structured-clone-jegjz0hM.mjs → structured-clone-XpHLZ8nr.mjs} +0 -0
- /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
|
-
|
|
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 };
|
package/dist/adapters/build.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { t as collectStaticRpcDump } from "../dump-
|
|
2
|
-
import { n as colors } from "../diagnostics-reporter-
|
|
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-
|
|
5
|
-
import { n as structuredCloneStringify } from "../structured-clone-
|
|
6
|
-
import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-
|
|
7
|
-
import { n as resolveBasePath } from "../_shared-
|
|
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
|
/**
|
package/dist/adapters/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ct as CliFlagsSchema, Et as parseCliFlags, Tt as defineCliFlags, r as DevframeDefinition, wt as InferCliFlags } from "../devframe-BwfavB78.mjs";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as colors } from "../diagnostics-reporter-
|
|
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-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-CSpLSEVh.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { n as StartedServer } from "../server-
|
|
1
|
+
import { l as DevframeWsOptions, r as DevframeDefinition } from "../devframe-BwfavB78.mjs";
|
|
2
|
+
import { n as StartedServer } from "../server-oju7PTi2.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
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-CSpLSEVh.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
package/dist/adapters/mcp.d.mts
CHANGED
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createHostContext } from "../host-h3-
|
|
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-
|
|
207
|
+
const { startStdioTransport } = await import("../transports-BmDVn4SF.mjs");
|
|
208
208
|
let stop;
|
|
209
209
|
try {
|
|
210
210
|
stop = await startStdioTransport(server);
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-
|
|
4
|
-
import { t as WsRpcChannelOptions } from "../ws-client-
|
|
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-BwfavB78.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
|
|
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 };
|