devframe 0.1.19 → 0.1.21
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/README.md +2 -2
- package/dist/{_shared-BcPXmcjq.mjs → _shared-iZy45oG3.mjs} +2 -2
- package/dist/adapters/build.d.mts +3 -3
- package/dist/adapters/build.mjs +12 -9
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +2 -2
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +2 -2
- package/dist/adapters/embedded.mjs +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +6 -2
- package/dist/adapters/vite.d.mts +5 -4
- package/dist/adapters/vite.mjs +4 -3
- package/dist/client/index.d.mts +51 -145
- package/dist/client/index.mjs +1664 -2
- package/dist/constants.d.mts +12 -15
- package/dist/constants.mjs +12 -29
- package/dist/context-BJ4r2SmR.mjs +1051 -0
- package/dist/context-internal-Dx_NoSv1.mjs +199 -0
- package/dist/context-internal-saIAfNVw.d.mts +51 -0
- package/dist/{dev-Djy5hbgs.mjs → dev-CdAy400a.mjs} +7 -6
- package/dist/{devtool-CIqONpYU.d.mts → devtool-CNvLs2_Y.d.mts} +367 -530
- package/dist/diagnostics-DxPnRoXO.mjs +51 -0
- package/dist/host-h3-9jeHcltx.mjs +24 -0
- package/dist/{human-id-CHS0s28X.mjs → human-id-BLoGo_e5.mjs} +0 -1
- package/dist/{index-BwrLhNmz.d.mts → index-CuLRIMto.d.mts} +1 -1
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +1 -4
- package/dist/internal/index.d.mts +16 -0
- package/dist/internal/index.mjs +3 -0
- package/dist/node/index.d.mts +45 -140
- package/dist/node/index.mjs +7 -6
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +3 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{rpc-D7LxIh8t.mjs → rpc-INbWfHoX.mjs} +1 -1
- package/dist/{serialization-BN2ZQEE9.mjs → serialization-DwKi05Pn.mjs} +1 -1
- package/dist/{server-CaUeMcAh.d.mts → server-BAqOajx_.d.mts} +1 -1
- package/dist/{server-DrBxa6ZV.mjs → server-CBsxXIH5.mjs} +27 -2
- package/dist/{static-dump-cyGfMmRf.mjs → static-dump-D5VH8Iqk.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/human-id.mjs +1 -1
- package/dist/utils/shared-state.d.mts +2 -2
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/state.d.mts +2 -1
- package/dist/utils/state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +2 -0
- package/dist/utils/streaming-channel.mjs +255 -0
- package/dist/utils/when.d.mts +401 -2
- package/dist/{ws-client-DOYwYluO.d.mts → ws-client-CjPuPFbA.d.mts} +1 -1
- package/dist/{ws-server-DHMeNOY_.d.mts → ws-server-C7LnhOHi.d.mts} +13 -1
- package/package.json +10 -21
- package/skills/devframe/README.md +13 -0
- package/skills/devframe/SKILL.md +406 -0
- package/skills/devframe/templates/counter-devtool.ts +24 -0
- package/skills/devframe/templates/spa-devtool.ts +28 -0
- package/skills/devframe/templates/vite-client.ts +11 -0
- package/dist/adapters/kit.d.mts +0 -23
- package/dist/adapters/kit.mjs +0 -16
- package/dist/client-C6w_NshP.mjs +0 -1569
- package/dist/context-BsNZMCnr.mjs +0 -6827
- package/dist/helpers/nuxt/index.d.mts +0 -46
- package/dist/helpers/nuxt/index.mjs +0 -58
- package/dist/helpers/nuxt/runtime/plugin.client.d.mts +0 -8
- package/dist/helpers/nuxt/runtime/plugin.client.mjs +0 -12
- package/dist/host-h3-w3c0t8ZO.mjs +0 -18
- package/dist/immer-HjMAm3b6.mjs +0 -894
- package/dist/main-CuGOfqoX.mjs +0 -601
- package/dist/when-BAE663Hv.d.mts +0 -401
- package/dist/{open-JfacLHs0.mjs → open-Dede_w9r.mjs} +4 -4
- /package/dist/{types-gWbe-b2R.d.mts → types-C5OVe4AC.d.mts} +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { consoleReporter, createLogger, defineDiagnostics } from "logs-sdk";
|
|
2
|
+
import c from "ansis";
|
|
3
|
+
import { ansiFormatter } from "logs-sdk/formatters/ansi";
|
|
4
|
+
//#region src/node/diagnostics.ts
|
|
5
|
+
const diagnostics = defineDiagnostics({
|
|
6
|
+
docsBase: "https://devfra.me/errors",
|
|
7
|
+
codes: {
|
|
8
|
+
DF0006: { message: (p) => `RPC function "${p.name}" is not registered` },
|
|
9
|
+
DF0007: { message: "AsyncLocalStorage is not set, it likely to be an internal bug of the DevTools foundation" },
|
|
10
|
+
DF0008: { message: (p) => `distDir ${p.distDir} does not exist` },
|
|
11
|
+
DF0012: {
|
|
12
|
+
message: (p) => `Failed to parse storage file: ${p.filepath}, falling back to defaults.`,
|
|
13
|
+
level: "warn"
|
|
14
|
+
},
|
|
15
|
+
DF0013: { message: (p) => `Shared state of "${p.key}" is not found, please provide an initial value for the first time` },
|
|
16
|
+
DF0014: {
|
|
17
|
+
message: (p) => `RPC function "${p.name}" has an invalid \`agent\` field — \`description\` must be a non-empty string.`,
|
|
18
|
+
hint: "Provide a short description (~1–3 sentences) explaining what the tool does and when agents should invoke it."
|
|
19
|
+
},
|
|
20
|
+
DF0015: {
|
|
21
|
+
message: (p) => `Agent tool "${p.id}" is already registered.`,
|
|
22
|
+
hint: "Tool ids must be unique across RPC functions with an `agent` field and tools registered via `ctx.agent.registerTool()`."
|
|
23
|
+
},
|
|
24
|
+
DF0016: { message: (p) => `Agent resource "${p.id}" is already registered.` },
|
|
25
|
+
DF0017: { message: (p) => `Failed to start MCP server (${p.transport}): ${p.reason}` },
|
|
26
|
+
DF0029: {
|
|
27
|
+
message: (p) => `Stream "${p.channel}#${p.id}" dropped ${p.dropped} chunk(s) after exceeding the client high-water mark.`,
|
|
28
|
+
hint: "The consumer is too slow for the producer. Raise `highWaterMark` on the subscription, slow the producer, or batch chunks.",
|
|
29
|
+
level: "warn"
|
|
30
|
+
},
|
|
31
|
+
DF0030: {
|
|
32
|
+
message: (p) => `Stream "${p.channel}#${p.id}" is unknown — no producer has called \`channel.start({ id: "${p.id}" })\`.`,
|
|
33
|
+
hint: "Ensure the server-side producer is running before clients subscribe, or check for typos in the stream id."
|
|
34
|
+
},
|
|
35
|
+
DF0031: {
|
|
36
|
+
message: (p) => `Cannot write to closed stream "${p.channel}#${p.id}".`,
|
|
37
|
+
hint: "Track the producer lifecycle — guard writes with the `stream.signal.aborted` flag."
|
|
38
|
+
},
|
|
39
|
+
DF0032: {
|
|
40
|
+
message: (p) => `Streaming channel "${p.channel}" is already registered.`,
|
|
41
|
+
hint: "Each channel name must be unique within a context. Pick a different name or reuse the existing channel handle."
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
const logger = createLogger({
|
|
46
|
+
diagnostics: [diagnostics],
|
|
47
|
+
formatter: ansiFormatter(c),
|
|
48
|
+
reporters: consoleReporter
|
|
49
|
+
});
|
|
50
|
+
//#endregion
|
|
51
|
+
export { logger as n, diagnostics as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { join } from "pathe";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
//#region src/node/host-h3.ts
|
|
5
|
+
/**
|
|
6
|
+
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
7
|
+
*/
|
|
8
|
+
function createH3DevToolsHost(options) {
|
|
9
|
+
const workspaceRoot = options.workspaceRoot ?? process.cwd();
|
|
10
|
+
return {
|
|
11
|
+
mountStatic(base, distDir) {
|
|
12
|
+
return options.mount?.(base, distDir);
|
|
13
|
+
},
|
|
14
|
+
resolveOrigin() {
|
|
15
|
+
return options.origin;
|
|
16
|
+
},
|
|
17
|
+
getStorageDir(scope) {
|
|
18
|
+
const namespace = `.${options.appName}/devtools`;
|
|
19
|
+
return scope === "workspace" ? join(workspaceRoot, "node_modules", namespace) : join(homedir(), namespace);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { createH3DevToolsHost as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RpcReturnSchema, S as RpcFunctionsCollector, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, x as RpcFunctionType } from "./types-
|
|
1
|
+
import { C as RpcReturnSchema, S as RpcFunctionsCollector, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, x as RpcFunctionType } from "./types-C5OVe4AC.mjs";
|
|
2
2
|
import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
|
|
3
3
|
|
|
4
4
|
//#region src/rpc/cache.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { C as RpcReturnSchema, h as RpcFunctionDefinition, i as RpcArgsSchema, m as RpcFunctionAgentOptions, x as RpcFunctionType } from "./types-
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-
|
|
1
|
+
import { $ as AgentHandle, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as JsonRenderer, K as JsonRenderElement, Q as DevToolsDiagnosticsLogger, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as DevToolsDiagnosticsDefinition, Y as DevToolsHost, Z as DevToolsDiagnosticsHost, _ as RpcStreamingChannel, a as DevtoolRuntime, at as AgentToolInput, c as defineDevtool, ct as EventEmitter, d as DevToolsNodeContext, et as AgentManifest, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevtoolDeploymentKind, it as AgentTool, l as ConnectionMeta, lt as EventUnsubscribe, m as RpcFunctionsHost, n as DevtoolCliOptions, nt as AgentResourceContent, o as DevtoolSetupInfo, ot as DevToolsAgentHost, p as RpcBroadcastOptions, q as JsonRenderSpec, r as DevtoolDefinition, rt as AgentResourceInput, s as DevtoolSpaOptions, st as DevToolsAgentHostEvents, t as DevtoolBrowserContext, tt as AgentResource, u as DevToolsCapabilities, ut as EventsMap, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "./devtool-CNvLs2_Y.mjs";
|
|
2
|
+
import { C as RpcReturnSchema, h as RpcFunctionDefinition, i as RpcArgsSchema, m as RpcFunctionAgentOptions, x as RpcFunctionType } from "./types-C5OVe4AC.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-C7LnhOHi.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevToolsNodeContext>;
|
|
7
|
-
declare function defineCommand(command: DevToolsServerCommandInput): DevToolsServerCommandInput;
|
|
8
7
|
declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
|
|
9
8
|
//#endregion
|
|
10
|
-
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput,
|
|
9
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevtoolBrowserContext, DevtoolCliOptions, DevtoolDefinition, DevtoolDeploymentKind, DevtoolRuntime, DevtoolSetupInfo, DevtoolSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevtool, defineJsonRenderSpec, defineRpcFunction };
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { t as createDefineWrapperWithContext } from "./define-Bb4zh-Dc.mjs";
|
|
2
2
|
//#region src/define.ts
|
|
3
3
|
const defineRpcFunction = createDefineWrapperWithContext();
|
|
4
|
-
function defineCommand(command) {
|
|
5
|
-
return command;
|
|
6
|
-
}
|
|
7
4
|
function defineJsonRenderSpec(spec) {
|
|
8
5
|
return spec;
|
|
9
6
|
}
|
|
10
7
|
//#endregion
|
|
11
|
-
export {
|
|
8
|
+
export { defineJsonRenderSpec, defineRpcFunction };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { i as DevtoolDeploymentKind, r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-internal-saIAfNVw.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/_shared.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the mount base path for a devtool's SPA. Hosted adapters
|
|
7
|
+
* (`vite`, `kit`, `embedded`) default to `/__<id>/` so they don't
|
|
8
|
+
* collide with the host app; standalone adapters (`cli`, `spa`,
|
|
9
|
+
* `build`) default to `/` because they own the origin.
|
|
10
|
+
*
|
|
11
|
+
* The devtool author can override with `basePath` on the definition.
|
|
12
|
+
*/
|
|
13
|
+
declare function resolveBasePath(def: DevtoolDefinition, kind: DevtoolDeploymentKind): string;
|
|
14
|
+
declare function normalizeBasePath(base: string): string;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { type DevToolsInternalContext, type InternalAnonymousAuthStorage, type RemoteTokenRecord, getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { n as internalContextMap, t as getInternalContext } from "../context-internal-Dx_NoSv1.mjs";
|
|
2
|
+
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-iZy45oG3.mjs";
|
|
3
|
+
export { getInternalContext, internalContextMap, normalizeBasePath, resolveBasePath };
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,59 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as RpcFunctionsCollectorBase } from "../index-
|
|
3
|
-
import { g as RpcFunctionDefinitionAny } from "../types-
|
|
4
|
-
import {
|
|
1
|
+
import { $ as AgentHandle, P as SharedState, Q as DevToolsDiagnosticsLogger, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, Y as DevToolsHost, Z as DevToolsDiagnosticsHost$1, at as AgentToolInput, ct as EventEmitter, d as DevToolsNodeContext, et as AgentManifest, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, it as AgentTool, m as RpcFunctionsHost$1, nt as AgentResourceContent, ot as DevToolsAgentHost$1, p as RpcBroadcastOptions, rt as AgentResourceInput, st as DevToolsAgentHostEvents, tt as AgentResource, y as RpcStreamingHost, z as DevToolsViewHost$1 } from "../devtool-CNvLs2_Y.mjs";
|
|
2
|
+
import { g as RpcFunctionsCollectorBase } from "../index-CuLRIMto.mjs";
|
|
3
|
+
import { g as RpcFunctionDefinitionAny } from "../types-C5OVe4AC.mjs";
|
|
4
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-C7LnhOHi.mjs";
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BAqOajx_.mjs";
|
|
6
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-internal-saIAfNVw.mjs";
|
|
5
7
|
import { createLogger, defineDiagnostics } from "logs-sdk";
|
|
6
8
|
import { BirpcGroup } from "birpc";
|
|
7
9
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
10
|
|
|
9
|
-
//#region src/node/context-internal.d.ts
|
|
10
|
-
interface InternalAnonymousAuthStorage {
|
|
11
|
-
trusted: Record<string, {
|
|
12
|
-
authToken: string;
|
|
13
|
-
ua: string;
|
|
14
|
-
origin: string;
|
|
15
|
-
timestamp: number;
|
|
16
|
-
} | undefined>;
|
|
17
|
-
}
|
|
18
|
-
interface RemoteTokenRecord {
|
|
19
|
-
dockId: string;
|
|
20
|
-
/** Dock URL origin — matched against WS handshake `Origin` header when `originLock` is on. */
|
|
21
|
-
origin: string;
|
|
22
|
-
originLock: boolean;
|
|
23
|
-
}
|
|
24
|
-
interface DevToolsInternalContext {
|
|
25
|
-
storage: {
|
|
26
|
-
auth: SharedState<InternalAnonymousAuthStorage>;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Revoke an auth token: remove from storage and notify all connected clients
|
|
30
|
-
* using this token that they are no longer trusted.
|
|
31
|
-
*/
|
|
32
|
-
revokeAuthToken: (token: string) => Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Session-only tokens issued to remote-UI iframe docks. Not persisted —
|
|
35
|
-
* regenerated on every dev-server restart.
|
|
36
|
-
*/
|
|
37
|
-
remoteTokens: Map<string, RemoteTokenRecord>;
|
|
38
|
-
allocateRemoteToken: (dockId: string, origin: string, originLock: boolean) => string;
|
|
39
|
-
revokeRemoteToken: (token: string) => void;
|
|
40
|
-
revokeRemoteTokensForDock: (dockId: string) => void;
|
|
41
|
-
/**
|
|
42
|
-
* Returns true if `token` is a valid remote token and, when `originLock` is
|
|
43
|
-
* on, `requestOrigin` matches the recorded dock origin.
|
|
44
|
-
*/
|
|
45
|
-
isRemoteTokenTrusted: (token: string, requestOrigin?: string) => boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Populated by `createWsServer` once the WS port is bound. Consumed by the
|
|
48
|
-
* docks host when enriching remote iframe URLs with a connection descriptor.
|
|
49
|
-
*/
|
|
50
|
-
wsEndpoint?: {
|
|
51
|
-
/** Full `ws://` or `wss://` URL with host and port. */url: string;
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
declare const internalContextMap: WeakMap<DevToolsNodeContext, DevToolsInternalContext>;
|
|
55
|
-
declare function getInternalContext(context: DevToolsNodeContext): DevToolsInternalContext;
|
|
56
|
-
//#endregion
|
|
57
11
|
//#region src/node/auth-revoke.d.ts
|
|
58
12
|
/**
|
|
59
13
|
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
@@ -108,19 +62,16 @@ interface CreateHostContextOptions {
|
|
|
108
62
|
builtinRpcDeclarations?: readonly RpcFunctionDefinitionAny[];
|
|
109
63
|
}
|
|
110
64
|
/**
|
|
111
|
-
* Framework-neutral core of the DevTools node context. Wires the
|
|
112
|
-
* host
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
65
|
+
* Framework-neutral core of the DevTools node context. Wires the RPC
|
|
66
|
+
* host, view (HTTP file-serving) host, diagnostics, and agent
|
|
67
|
+
* subsystems plus the JSON-render factory. Hub-level subsystems
|
|
68
|
+
* (`docks`, `terminals`, `messages`, `commands`) are owned by
|
|
69
|
+
* `@vitejs/devtools-kit` — its `createKitContext` wraps this and
|
|
70
|
+
* attaches them when the devtool is mounted into a multi-integration
|
|
71
|
+
* hub.
|
|
116
72
|
*/
|
|
117
73
|
declare function createHostContext(options: CreateHostContextOptions): Promise<DevToolsNodeContext>;
|
|
118
74
|
//#endregion
|
|
119
|
-
//#region src/node/context-utils.d.ts
|
|
120
|
-
declare const ContextUtils: {
|
|
121
|
-
createSimpleClientScript(fn: string | ((ctx: any) => void)): ClientScriptEntry;
|
|
122
|
-
};
|
|
123
|
-
//#endregion
|
|
124
75
|
//#region src/node/host-agent.d.ts
|
|
125
76
|
/**
|
|
126
77
|
* Framework-neutral host aggregating the agent-exposed surface of a
|
|
@@ -155,20 +106,6 @@ declare class DevToolsAgentHost implements DevToolsAgentHost$1 {
|
|
|
155
106
|
private _coercePositionalArgs;
|
|
156
107
|
}
|
|
157
108
|
//#endregion
|
|
158
|
-
//#region src/node/host-commands.d.ts
|
|
159
|
-
declare class DevToolsCommandsHost implements DevToolsCommandsHost$1 {
|
|
160
|
-
readonly context: DevToolsNodeContext;
|
|
161
|
-
readonly commands: DevToolsCommandsHost$1['commands'];
|
|
162
|
-
readonly events: DevToolsCommandsHost$1['events'];
|
|
163
|
-
constructor(context: DevToolsNodeContext);
|
|
164
|
-
register(command: DevToolsServerCommandInput): DevToolsCommandHandle;
|
|
165
|
-
unregister(id: string): boolean;
|
|
166
|
-
execute(id: string, ...args: any[]): Promise<unknown>;
|
|
167
|
-
list(): DevToolsServerCommandEntry[];
|
|
168
|
-
private findCommand;
|
|
169
|
-
private toSerializable;
|
|
170
|
-
}
|
|
171
|
-
//#endregion
|
|
172
109
|
//#region src/node/host-diagnostics.d.ts
|
|
173
110
|
declare class DevToolsDiagnosticsHost implements DevToolsDiagnosticsHost$1 {
|
|
174
111
|
readonly context: DevToolsNodeContext;
|
|
@@ -182,30 +119,6 @@ declare class DevToolsDiagnosticsHost implements DevToolsDiagnosticsHost$1 {
|
|
|
182
119
|
private _rebuild;
|
|
183
120
|
}
|
|
184
121
|
//#endregion
|
|
185
|
-
//#region src/node/host-docks.d.ts
|
|
186
|
-
declare class DevToolsDockHost implements DevToolsDockHost$1 {
|
|
187
|
-
readonly context: DevToolsNodeContext;
|
|
188
|
-
readonly views: DevToolsDockHost$1['views'];
|
|
189
|
-
readonly events: DevToolsDockHost$1['events'];
|
|
190
|
-
userSettings: SharedState<DevToolsDocksUserSettings>;
|
|
191
|
-
/** Dock-id → allocated remote token + resolved options. */
|
|
192
|
-
private readonly remoteDocks;
|
|
193
|
-
constructor(context: DevToolsNodeContext);
|
|
194
|
-
init(): Promise<void>;
|
|
195
|
-
values({
|
|
196
|
-
includeBuiltin
|
|
197
|
-
}?: {
|
|
198
|
-
includeBuiltin?: boolean;
|
|
199
|
-
}): DevToolsDockEntry[];
|
|
200
|
-
private projectView;
|
|
201
|
-
private resolveDevServerOrigin;
|
|
202
|
-
register<T extends DevToolsDockUserEntry>(view: T, force?: boolean): {
|
|
203
|
-
update: (patch: Partial<T>) => void;
|
|
204
|
-
};
|
|
205
|
-
update(view: DevToolsDockUserEntry): void;
|
|
206
|
-
private prepareRemoteRegistration;
|
|
207
|
-
}
|
|
208
|
-
//#endregion
|
|
209
122
|
//#region src/node/host-functions.d.ts
|
|
210
123
|
declare class RpcFunctionsHost extends RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, DevToolsNodeContext> implements RpcFunctionsHost$1 {
|
|
211
124
|
/**
|
|
@@ -215,6 +128,15 @@ declare class RpcFunctionsHost extends RpcFunctionsCollectorBase<DevToolsRpcServ
|
|
|
215
128
|
_asyncStorage: AsyncLocalStorage<DevToolsNodeRpcSession>;
|
|
216
129
|
constructor(context: DevToolsNodeContext);
|
|
217
130
|
sharedState: RpcSharedStateHost;
|
|
131
|
+
streaming: RpcStreamingHost;
|
|
132
|
+
/**
|
|
133
|
+
* Adapters call this from their WS `onDisconnected` hook so downstream
|
|
134
|
+
* hosts (streaming, …) can free per-session state. Public-ish because
|
|
135
|
+
* tests / custom adapters may want to mirror it.
|
|
136
|
+
*
|
|
137
|
+
* @internal
|
|
138
|
+
*/
|
|
139
|
+
_emitSessionDisconnected(meta: DevToolsNodeRpcSessionMeta): void;
|
|
218
140
|
invokeLocal<T extends keyof DevToolsRpcServerFunctions, Args extends Parameters<DevToolsRpcServerFunctions[T]>>(method: T, ...args: Args): Promise<Awaited<ReturnType<DevToolsRpcServerFunctions[T]>>>;
|
|
219
141
|
broadcast<T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>): Promise<void>;
|
|
220
142
|
getCurrentRpcSession(): DevToolsNodeRpcSession | undefined;
|
|
@@ -235,51 +157,25 @@ interface CreateH3DevToolsHostOptions {
|
|
|
235
157
|
* the CLI isn't running, so the default is a no-op.
|
|
236
158
|
*/
|
|
237
159
|
mount?: (base: string, distDir: string) => void | Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Namespace for storage paths returned by `getStorageDir`. Workspace
|
|
162
|
+
* state lives under `${workspaceRoot}/node_modules/.<appName>/devtools/`
|
|
163
|
+
* and global state under `${homedir()}/.<appName>/devtools/`. Pick the
|
|
164
|
+
* devtool's id (or another stable, filesystem-safe identifier) so the
|
|
165
|
+
* standalone host doesn't collide with other tools' storage.
|
|
166
|
+
*/
|
|
167
|
+
appName: string;
|
|
168
|
+
/**
|
|
169
|
+
* Workspace root used as the parent of the per-project storage
|
|
170
|
+
* directory. Defaults to `process.cwd()`.
|
|
171
|
+
*/
|
|
172
|
+
workspaceRoot?: string;
|
|
238
173
|
}
|
|
239
174
|
/**
|
|
240
175
|
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
241
|
-
* This commit adds the shell; the CLI adapter in commit 5 wires it up
|
|
242
|
-
* with a real h3 app and sirv handler.
|
|
243
176
|
*/
|
|
244
177
|
declare function createH3DevToolsHost(options: CreateH3DevToolsHostOptions): DevToolsHost;
|
|
245
178
|
//#endregion
|
|
246
|
-
//#region src/node/host-messages.d.ts
|
|
247
|
-
declare class DevToolsMessagesHost implements DevToolsMessagesHost$1 {
|
|
248
|
-
readonly context: DevToolsNodeContext;
|
|
249
|
-
readonly entries: DevToolsMessagesHost$1['entries'];
|
|
250
|
-
readonly events: DevToolsMessagesHost$1['events'];
|
|
251
|
-
/** Tracks when each entry was last added or updated (monotonic) */
|
|
252
|
-
readonly lastModified: Map<string, number>;
|
|
253
|
-
/** Tracks recently removed entry IDs with their removal time */
|
|
254
|
-
readonly removals: Array<{
|
|
255
|
-
id: string;
|
|
256
|
-
time: number;
|
|
257
|
-
}>;
|
|
258
|
-
private _autoDeleteTimers;
|
|
259
|
-
private _clock;
|
|
260
|
-
private _tick;
|
|
261
|
-
constructor(context: DevToolsNodeContext);
|
|
262
|
-
add(input: DevToolsMessageEntryInput): Promise<DevToolsMessageHandle>;
|
|
263
|
-
update(id: string, patch: Partial<DevToolsMessageEntryInput>): Promise<DevToolsMessageEntry | undefined>;
|
|
264
|
-
remove(id: string): Promise<void>;
|
|
265
|
-
clear(): Promise<void>;
|
|
266
|
-
private _createHandle;
|
|
267
|
-
}
|
|
268
|
-
//#endregion
|
|
269
|
-
//#region src/node/host-terminals.d.ts
|
|
270
|
-
declare class DevToolsTerminalHost implements DevToolsTerminalHost$1 {
|
|
271
|
-
readonly context: DevToolsNodeContext;
|
|
272
|
-
readonly sessions: DevToolsTerminalHost$1['sessions'];
|
|
273
|
-
readonly events: DevToolsTerminalHost$1['events'];
|
|
274
|
-
private _boundStreams;
|
|
275
|
-
constructor(context: DevToolsNodeContext);
|
|
276
|
-
register(session: DevToolsTerminalSession): DevToolsTerminalSession;
|
|
277
|
-
update(patch: PartialWithoutId<DevToolsTerminalSession>): void;
|
|
278
|
-
remove(session: DevToolsTerminalSession): void;
|
|
279
|
-
private bindStream;
|
|
280
|
-
startChildProcess(executeOptions: DevToolsChildProcessExecuteOptions, terminal: Omit<DevToolsTerminalSessionBase, 'status'>): Promise<DevToolsChildProcessTerminalSession>;
|
|
281
|
-
}
|
|
282
|
-
//#endregion
|
|
283
179
|
//#region src/node/host-views.d.ts
|
|
284
180
|
declare class DevToolsViewHost implements DevToolsViewHost$1 {
|
|
285
181
|
readonly context: DevToolsNodeContext;
|
|
@@ -297,6 +193,15 @@ declare class DevToolsViewHost implements DevToolsViewHost$1 {
|
|
|
297
193
|
//#region src/node/rpc-shared-state.d.ts
|
|
298
194
|
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSharedStateHost;
|
|
299
195
|
//#endregion
|
|
196
|
+
//#region src/node/rpc-streaming.d.ts
|
|
197
|
+
/**
|
|
198
|
+
* Build the server-side streaming host. Mirrors the layout of
|
|
199
|
+
* `createRpcSharedStateServerHost` — registers a fixed set of internal
|
|
200
|
+
* RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
|
|
201
|
+
* state lives in a `Map<channelName, ChannelState>`.
|
|
202
|
+
*/
|
|
203
|
+
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost$1): RpcStreamingHost;
|
|
204
|
+
//#endregion
|
|
300
205
|
//#region src/node/static-dump.d.ts
|
|
301
206
|
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
302
207
|
interface StaticRpcDumpManifestStaticEntry {
|
|
@@ -341,4 +246,4 @@ declare function createStorage<T extends object>(options: CreateStorageOptions<T
|
|
|
341
246
|
declare function isObject(value: unknown): value is Record<string, any>;
|
|
342
247
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
343
248
|
//#endregion
|
|
344
|
-
export {
|
|
249
|
+
export { CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsInternalContext, DevToolsViewHost, InternalAnonymousAuthStorage, PendingAuthRequest, RemoteTokenRecord, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { t as import_dist } from "../human-id-
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as
|
|
1
|
+
import { t as import_dist } from "../human-id-BLoGo_e5.mjs";
|
|
2
|
+
import { a as revokeAuthToken, i as revokeActiveConnectionsForToken, n as internalContextMap, r as createStorage, t as getInternalContext } from "../context-internal-Dx_NoSv1.mjs";
|
|
3
|
+
import { a as createRpcSharedStateServerHost, i as createRpcStreamingServerHost, n as DevToolsViewHost, o as DevToolsDiagnosticsHost, r as RpcFunctionsHost, s as DevToolsAgentHost, t as createHostContext } from "../context-BJ4r2SmR.mjs";
|
|
4
|
+
import { t as createH3DevToolsHost } from "../host-h3-9jeHcltx.mjs";
|
|
5
|
+
import { t as startHttpAndWs } from "../server-CBsxXIH5.mjs";
|
|
6
|
+
import { t as collectStaticRpcDump } from "../static-dump-D5VH8Iqk.mjs";
|
|
6
7
|
import { isIP } from "node:net";
|
|
7
8
|
//#region src/node/auth-state.ts
|
|
8
9
|
let pendingAuth = null;
|
|
@@ -67,4 +68,4 @@ function normalizeHttpServerUrl(host, port) {
|
|
|
67
68
|
return `http://${host === "127.0.0.1" ? "localhost" : isIP(host) === 6 ? `[${host}]` : host}:${port}`;
|
|
68
69
|
}
|
|
69
70
|
//#endregion
|
|
70
|
-
export {
|
|
71
|
+
export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, abortPendingAuth, collectStaticRpcDump, consumeTempAuthToken, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, getInternalContext, getPendingAuth, getTempAuthToken, internalContextMap, isObject, normalizeHttpServerUrl, refreshTempAuthToken, revokeActiveConnectionsForToken, revokeAuthToken, setPendingAuth, startHttpAndWs };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as RpcFunctionSetupResult, m as RpcFunctionAgentOptions, s as RpcDump, w as Thenable } from "../types-
|
|
1
|
+
import { b as RpcFunctionSetupResult, m as RpcFunctionAgentOptions, s as RpcDump, w as Thenable } from "../types-C5OVe4AC.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
|
|
4
4
|
//#region src/recipes/open-helpers.d.ts
|
|
@@ -25,6 +25,7 @@ import * as v from "valibot";
|
|
|
25
25
|
const openInEditor = defineRpcFunction({
|
|
26
26
|
name: "devframe:open-in-editor",
|
|
27
27
|
type: "action",
|
|
28
|
+
jsonSerializable: true,
|
|
28
29
|
args: [v.string()],
|
|
29
30
|
returns: v.void(),
|
|
30
31
|
async handler(filename) {
|
|
@@ -47,10 +48,11 @@ const openInEditor = defineRpcFunction({
|
|
|
47
48
|
const openInFinder = defineRpcFunction({
|
|
48
49
|
name: "devframe:open-in-finder",
|
|
49
50
|
type: "action",
|
|
51
|
+
jsonSerializable: true,
|
|
50
52
|
args: [v.string()],
|
|
51
53
|
returns: v.void(),
|
|
52
54
|
async handler(path) {
|
|
53
|
-
const { default: open } = await import("../open-
|
|
55
|
+
const { default: open } = await import("../open-Dede_w9r.mjs");
|
|
54
56
|
await open(path);
|
|
55
57
|
}
|
|
56
58
|
});
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as RpcCacheManager, a as structuredCloneDeserialize, c as structuredCloneStringify, d as createClientFromDump, f as dumpFunctions, g as RpcFunctionsCollectorBase, h as defineRpcFunction, i as strictJsonStringify, l as getRpcHandler, m as createDefineWrapperWithContext, n as validateDefinitions, o as structuredCloneParse, p as getDefinitionsWithDumps, r as STRUCTURED_CLONE_PREFIX, s as structuredCloneSerialize, t as validateDefinition, u as getRpcResolvedSetupResult, v as RpcCacheOptions } from "../index-
|
|
2
|
-
import { C as RpcReturnSchema, S as RpcFunctionsCollector, _ as RpcFunctionDefinitionAnyWithContext, a as RpcDefinitionsFilter, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcFunctionAgentOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionBase, w as Thenable, x as RpcFunctionType, y as RpcFunctionDefinitionToFunction } from "../types-
|
|
1
|
+
import { _ as RpcCacheManager, a as structuredCloneDeserialize, c as structuredCloneStringify, d as createClientFromDump, f as dumpFunctions, g as RpcFunctionsCollectorBase, h as defineRpcFunction, i as strictJsonStringify, l as getRpcHandler, m as createDefineWrapperWithContext, n as validateDefinitions, o as structuredCloneParse, p as getDefinitionsWithDumps, r as STRUCTURED_CLONE_PREFIX, s as structuredCloneSerialize, t as validateDefinition, u as getRpcResolvedSetupResult, v as RpcCacheOptions } from "../index-CuLRIMto.mjs";
|
|
2
|
+
import { C as RpcReturnSchema, S as RpcFunctionsCollector, _ as RpcFunctionDefinitionAnyWithContext, a as RpcDefinitionsFilter, b as RpcFunctionSetupResult, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinitionAny, h as RpcFunctionDefinition, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcFunctionAgentOptions, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpStore, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionBase, w as Thenable, x as RpcFunctionType, y as RpcFunctionDefinitionToFunction } from "../types-C5OVe4AC.mjs";
|
|
3
3
|
export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify, validateDefinition, validateDefinitions };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as validateDefinitions, c as getRpcResolvedSetupResult, i as validateDefinition, l as RpcCacheManager, n as dumpFunctions, o as RpcFunctionsCollectorBase, r as getDefinitionsWithDumps, s as getRpcHandler, t as createClientFromDump } from "../rpc-
|
|
2
|
-
import { a as structuredCloneSerialize, i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify, r as structuredCloneDeserialize, t as STRUCTURED_CLONE_PREFIX } from "../serialization-
|
|
1
|
+
import { a as validateDefinitions, c as getRpcResolvedSetupResult, i as validateDefinition, l as RpcCacheManager, n as dumpFunctions, o as RpcFunctionsCollectorBase, r as getDefinitionsWithDumps, s as getRpcHandler, t as createClientFromDump } from "../rpc-INbWfHoX.mjs";
|
|
2
|
+
import { a as structuredCloneSerialize, i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify, r as structuredCloneDeserialize, t as STRUCTURED_CLONE_PREFIX } from "../serialization-DwKi05Pn.mjs";
|
|
3
3
|
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-Bb4zh-Dc.mjs";
|
|
4
4
|
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify, validateDefinition, validateDefinitions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-
|
|
1
|
+
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-CjPuPFbA.mjs";
|
|
2
2
|
export { WsRpcChannelOptions, createWsRpcChannel };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-
|
|
1
|
+
import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-DwKi05Pn.mjs";
|
|
2
2
|
//#region src/rpc/transports/ws-client.ts
|
|
3
3
|
function NOOP() {}
|
|
4
4
|
const EMPTY_DEFS = /* @__PURE__ */ new Map();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-
|
|
1
|
+
import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-C7LnhOHi.mjs";
|
|
2
2
|
export { DevToolsNodeRpcSessionMeta, WsRpcTransportOptions, attachWsRpcTransport };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-
|
|
1
|
+
import { i as structuredCloneParse, n as strictJsonStringify, o as structuredCloneStringify } from "../../serialization-DwKi05Pn.mjs";
|
|
2
2
|
import { createServer } from "node:https";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
//#region src/rpc/transports/ws-server.ts
|
|
@@ -2,7 +2,7 @@ import { consoleReporter, createLogger, defineDiagnostics, plainFormatter } from
|
|
|
2
2
|
import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
|
|
3
3
|
//#region src/rpc/diagnostics.ts
|
|
4
4
|
const diagnostics = defineDiagnostics({
|
|
5
|
-
docsBase: "https://
|
|
5
|
+
docsBase: "https://devfra.me/errors",
|
|
6
6
|
codes: {
|
|
7
7
|
DF0019: {
|
|
8
8
|
message: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devtool-CNvLs2_Y.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import { App } from "h3";
|
|
@@ -18,11 +18,36 @@ async function startHttpAndWs(options) {
|
|
|
18
18
|
const wss = new WebSocketServer({ server: httpServer });
|
|
19
19
|
const rpcHost = context.rpc;
|
|
20
20
|
const asyncStorage = new AsyncLocalStorage();
|
|
21
|
-
const rpcGroup = createRpcServer(rpcHost.functions)
|
|
22
|
-
|
|
21
|
+
const rpcGroup = createRpcServer(rpcHost.functions, { rpcOptions: { resolver(name, fn) {
|
|
22
|
+
const rpc = this;
|
|
23
|
+
if (!fn) return void 0;
|
|
24
|
+
return async function(...args) {
|
|
25
|
+
return await asyncStorage.run({
|
|
26
|
+
rpc,
|
|
27
|
+
meta: rpc.$meta
|
|
28
|
+
}, async () => {
|
|
29
|
+
return (await fn).apply(this, args);
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
} } });
|
|
33
|
+
attachWsRpcTransport(rpcGroup, {
|
|
34
|
+
wss,
|
|
35
|
+
onDisconnected: (_ws, meta) => {
|
|
36
|
+
rpcHost._emitSessionDisconnected(meta);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
23
39
|
rpcHost._rpcGroup = rpcGroup;
|
|
24
40
|
rpcHost._asyncStorage = asyncStorage;
|
|
25
41
|
rpcHost._authDisabled = options.auth === false;
|
|
42
|
+
if (options.auth === false && !rpcHost.definitions.has("vite:anonymous:auth")) rpcHost.register({
|
|
43
|
+
name: "vite:anonymous:auth",
|
|
44
|
+
type: "action",
|
|
45
|
+
handler: () => {
|
|
46
|
+
const session = rpcHost.getCurrentRpcSession();
|
|
47
|
+
if (session) session.meta.isTrusted = true;
|
|
48
|
+
return { isTrusted: true };
|
|
49
|
+
}
|
|
50
|
+
});
|
|
26
51
|
await new Promise((resolveListen) => {
|
|
27
52
|
httpServer.listen(port, bindHost, () => resolveListen());
|
|
28
53
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-
|
|
1
|
+
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-INbWfHoX.mjs";
|
|
2
2
|
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
3
|
//#region src/node/static-dump.ts
|
|
4
4
|
function makeDumpKey(name) {
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { m as RpcFunctionAgentOptions } from "../types-
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
4
|
-
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput,
|
|
1
|
+
import { $ as AgentHandle, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as JsonRenderer, K as JsonRenderElement, Q as DevToolsDiagnosticsLogger, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as DevToolsDiagnosticsDefinition, Y as DevToolsHost, Z as DevToolsDiagnosticsHost, _ as RpcStreamingChannel, a as DevtoolRuntime, at as AgentToolInput, c as defineDevtool, ct as EventEmitter, d as DevToolsNodeContext, et as AgentManifest, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevtoolDeploymentKind, it as AgentTool, l as ConnectionMeta, lt as EventUnsubscribe, m as RpcFunctionsHost, n as DevtoolCliOptions, nt as AgentResourceContent, o as DevtoolSetupInfo, ot as DevToolsAgentHost, p as RpcBroadcastOptions, q as JsonRenderSpec, r as DevtoolDefinition, rt as AgentResourceInput, s as DevtoolSpaOptions, st as DevToolsAgentHostEvents, t as DevtoolBrowserContext, tt as AgentResource, u as DevToolsCapabilities, ut as EventsMap, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devtool-CNvLs2_Y.mjs";
|
|
2
|
+
import { m as RpcFunctionAgentOptions } from "../types-C5OVe4AC.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-C7LnhOHi.mjs";
|
|
4
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevtoolBrowserContext, DevtoolCliOptions, DevtoolDefinition, DevtoolDeploymentKind, DevtoolRuntime, DevtoolSetupInfo, DevtoolSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevtool };
|
package/dist/utils/events.d.mts
CHANGED
package/dist/utils/human-id.mjs
CHANGED