devframe 0.2.0 → 0.2.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.
- package/README.md +20 -76
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +5 -6
- 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 +1 -1
- package/dist/adapters/mcp.d.mts +2 -2
- package/dist/adapters/mcp.mjs +73 -18
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.mjs +5 -9
- package/dist/{context-DRa0wGsC.d.mts → context-BDpuScNZ.d.mts} +1 -1
- package/dist/{dev-CewNNE2R.mjs → dev-CZ9ZQkuO.mjs} +4 -5
- package/dist/{devframe-R5Ex5K5L.d.mts → devframe-DAfZWnpI.d.mts} +2 -2
- package/dist/{diagnostics-Cg9ycFIM.mjs → diagnostics-DNxVjo6X.mjs} +1 -1
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +3 -3
- package/dist/{context-BBi2IQDm.mjs → host-h3-DEfOpa0j.mjs} +28 -5
- package/dist/{index-DB2Ie0Or.d.mts → index-BNAsgVNz.d.mts} +51 -3
- package/dist/index.d.mts +3 -3
- package/dist/{launch-editor-CX_n_0SS.mjs → launch-editor-BbNhtg7b.mjs} +25 -1
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +2 -2
- package/dist/node/index.d.mts +6 -37
- package/dist/node/index.mjs +4 -6
- package/dist/node/internal.d.mts +2 -2
- package/dist/node/internal.mjs +4 -4
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +2 -2
- package/dist/rpc/index.d.mts +3 -3
- 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-DAzoVCR0.mjs → rpc-BlVCyk9W.mjs} +135 -11
- package/dist/{server-DzKz023G.d.mts → server-BGSrxsQb.d.mts} +1 -1
- package/dist/{storage-CNvfBGQ5.mjs → storage-D-jLaxDA.mjs} +2 -2
- package/dist/{transports-BnCs4rj9.mjs → transports-DTFoMUbE.mjs} +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/{types-4rdUEi2R.d.mts → types-DmcujDa5.d.mts} +21 -5
- package/dist/utils/colors.mjs +30 -1
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/human-id.d.mts +1 -1
- package/dist/utils/human-id.mjs +768 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- 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/{ws-client-Bavoya6-.d.mts → ws-client-CrLsflnY.d.mts} +1 -1
- package/dist/{ws-server-DjvlwLuM.d.mts → ws-server-DKlqI8XP.d.mts} +1 -1
- package/package.json +1 -5
- package/skills/devframe/SKILL.md +1 -1
- package/dist/chunk-e9Ob2GDo.mjs +0 -26
- package/dist/colors-DS7k8ljB.mjs +0 -123
- package/dist/host-h3-Dz8YnFgu.mjs +0 -24
- package/dist/human-id-adtUWQLr.mjs +0 -852
- package/dist/static-dump-C67bCuse.mjs +0 -80
- /package/dist/{_shared-BrKv3CYt.mjs → _shared-CUFqO4kJ.mjs} +0 -0
- /package/dist/{open-B2ah1IKK.mjs → open-DiQn6zCH.mjs} +0 -0
- /package/dist/{revoke-DIMz1r7-.mjs → revoke-DDa7VSJa.mjs} +0 -0
- /package/dist/{server-DOk4grlJ.mjs → server-BO8IDVsJ.mjs} +0 -0
- /package/dist/{shared-state-q9-1EOSX.mjs → shared-state-BJXkPxtf.mjs} +0 -0
package/dist/node/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $ as AgentResourceContent, J as DevToolsDiagnosticsHost$1, K as DevToolsHost, P as SharedState, Q as AgentResource, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, at as EventEmitter, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, it as DevToolsAgentHostEvents, m as RpcFunctionsHost$1, nt as AgentToolInput, p as RpcBroadcastOptions, rt as DevToolsAgentHost$1, tt as AgentTool, y as RpcStreamingHost, z as DevToolsViewHost$1 } from "../devframe-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
5
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-
|
|
1
|
+
import { $ as AgentResourceContent, J as DevToolsDiagnosticsHost$1, K as DevToolsHost, P as SharedState, Q as AgentResource, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, at as EventEmitter, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, it as DevToolsAgentHostEvents, m as RpcFunctionsHost$1, nt as AgentToolInput, p as RpcBroadcastOptions, rt as DevToolsAgentHost$1, tt as AgentTool, y as RpcStreamingHost, z as DevToolsViewHost$1 } from "../devframe-DAfZWnpI.mjs";
|
|
2
|
+
import { S as RpcFunctionsCollectorBase } from "../index-BNAsgVNz.mjs";
|
|
3
|
+
import { _ as RpcFunctionDefinitionAny } from "../types-DmcujDa5.mjs";
|
|
4
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DKlqI8XP.mjs";
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-BGSrxsQb.mjs";
|
|
6
6
|
import { createLogger, defineDiagnostics } from "logs-sdk";
|
|
7
7
|
import { BirpcGroup } from "birpc";
|
|
8
8
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -160,37 +160,6 @@ declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost$1): RpcSha
|
|
|
160
160
|
*/
|
|
161
161
|
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost$1): RpcStreamingHost;
|
|
162
162
|
//#endregion
|
|
163
|
-
//#region src/node/static-dump.d.ts
|
|
164
|
-
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
165
|
-
interface StaticRpcDumpManifestStaticEntry {
|
|
166
|
-
type: 'static';
|
|
167
|
-
path: string;
|
|
168
|
-
/** Encoder used when this entry's file was written. Default: `'json'`. */
|
|
169
|
-
serialization?: StaticRpcDumpSerialization;
|
|
170
|
-
}
|
|
171
|
-
interface StaticRpcDumpManifestQueryEntry {
|
|
172
|
-
type: 'query';
|
|
173
|
-
records: Record<string, string>;
|
|
174
|
-
fallback?: string;
|
|
175
|
-
/** Encoder used when each record/fallback file was written. Default: `'json'`. */
|
|
176
|
-
serialization?: StaticRpcDumpSerialization;
|
|
177
|
-
}
|
|
178
|
-
type StaticRpcDumpManifestValue = StaticRpcDumpManifestStaticEntry | StaticRpcDumpManifestQueryEntry | any;
|
|
179
|
-
type StaticRpcDumpManifest = Record<string, StaticRpcDumpManifestValue>;
|
|
180
|
-
interface StaticRpcDumpFile {
|
|
181
|
-
/** Whether this file was written via `JSON.stringify` or `structured-clone-es.stringify`. */
|
|
182
|
-
serialization: StaticRpcDumpSerialization;
|
|
183
|
-
/** Function name the file belongs to — used to scope `DF0019` errors during write. */
|
|
184
|
-
fnName: string;
|
|
185
|
-
/** Payload to encode. */
|
|
186
|
-
data: unknown;
|
|
187
|
-
}
|
|
188
|
-
interface StaticRpcDumpCollection {
|
|
189
|
-
manifest: StaticRpcDumpManifest;
|
|
190
|
-
files: Record<string, StaticRpcDumpFile>;
|
|
191
|
-
}
|
|
192
|
-
declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
|
|
193
|
-
//#endregion
|
|
194
163
|
//#region src/node/storage.d.ts
|
|
195
164
|
interface CreateStorageOptions<T extends object> {
|
|
196
165
|
filepath: string;
|
|
@@ -204,4 +173,4 @@ declare function createStorage<T extends object>(options: CreateStorageOptions<T
|
|
|
204
173
|
declare function isObject(value: unknown): value is Record<string, any>;
|
|
205
174
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
206
175
|
//#endregion
|
|
207
|
-
export { CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer,
|
|
176
|
+
export { CreateH3DevToolsHostOptions, CreateHostContextOptions, CreateStorageOptions, DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as collectStaticRpcDump } from "../static-dump-C67bCuse.mjs";
|
|
5
|
-
import { t as createStorage } from "../storage-CNvfBGQ5.mjs";
|
|
1
|
+
import { a as createRpcStreamingServerHost, c as DevToolsAgentHost, i as RpcFunctionsHost, n as createHostContext, o as createRpcSharedStateServerHost, r as DevToolsViewHost, s as DevToolsDiagnosticsHost, t as createH3DevToolsHost } from "../host-h3-DEfOpa0j.mjs";
|
|
2
|
+
import { t as startHttpAndWs } from "../server-BO8IDVsJ.mjs";
|
|
3
|
+
import { t as createStorage } from "../storage-D-jLaxDA.mjs";
|
|
6
4
|
import { isIP } from "node:net";
|
|
7
5
|
//#region src/node/utils.ts
|
|
8
6
|
function isObject(value) {
|
|
@@ -12,4 +10,4 @@ function normalizeHttpServerUrl(host, port) {
|
|
|
12
10
|
return `http://${host === "127.0.0.1" ? "localhost" : isIP(host) === 6 ? `[${host}]` : host}:${port}`;
|
|
13
11
|
}
|
|
14
12
|
//#endregion
|
|
15
|
-
export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost,
|
|
13
|
+
export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
|
package/dist/node/internal.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-
|
|
1
|
+
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-DAfZWnpI.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-BDpuScNZ.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_shared.d.ts
|
|
5
5
|
/**
|
package/dist/node/internal.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createStorage } from "../storage-
|
|
2
|
-
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-
|
|
3
|
-
import {
|
|
4
|
-
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-
|
|
1
|
+
import { t as createStorage } from "../storage-D-jLaxDA.mjs";
|
|
2
|
+
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-DDa7VSJa.mjs";
|
|
3
|
+
import { humanId } from "../utils/human-id.mjs";
|
|
4
|
+
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-CUFqO4kJ.mjs";
|
|
5
5
|
import { join } from "pathe";
|
|
6
6
|
//#region src/node/internal/context.ts
|
|
7
7
|
const internalContextMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as Thenable, h as RpcFunctionAgentOptions, s as RpcDump, x as RpcFunctionSetupResult } from "../types-DmcujDa5.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
|
|
4
4
|
//#region src/recipes/open-helpers.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { t as launchEditor } from "../launch-editor-BbNhtg7b.mjs";
|
|
1
2
|
import { n as defineRpcFunction } from "../define-CW9gLnyG.mjs";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as open } from "../open-B2ah1IKK.mjs";
|
|
3
|
+
import { t as open } from "../open-DiQn6zCH.mjs";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/recipes/open-helpers.ts
|
|
6
6
|
/**
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as getRpcHandler, c as
|
|
2
|
-
import { C as
|
|
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, validateDefinition, validateDefinitions };
|
|
1
|
+
import { C as RpcCacheManager, S as RpcFunctionsCollectorBase, _ as createClientFromDump, a as getRpcHandler, b as createDefineWrapperWithContext, c as StaticRpcDumpFile, d as StaticRpcDumpManifestStaticEntry, f as StaticRpcDumpManifestValue, g as serializeDumpError, h as reviveDumpError, i as strictJsonStringify, l as StaticRpcDumpManifest, m as collectStaticRpcDump, n as validateDefinitions, o as getRpcResolvedSetupResult, p as StaticRpcDumpSerialization, r as STRUCTURED_CLONE_PREFIX, s as StaticRpcDumpCollection, t as validateDefinition, u as StaticRpcDumpManifestQueryEntry, v as dumpFunctions, w as RpcCacheOptions, x as defineRpcFunction, y as getDefinitionsWithDumps } from "../index-BNAsgVNz.mjs";
|
|
2
|
+
import { C as RpcFunctionsCollector, S as RpcFunctionType, T as Thenable, _ as RpcFunctionDefinitionAny, a as RpcDefinitionsFilter, b as RpcFunctionDefinitionToFunction, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinition, h as RpcFunctionAgentOptions, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcDumpStore, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpRecordError, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionAnyWithContext, w as RpcReturnSchema, x as RpcFunctionSetupResult, y as RpcFunctionDefinitionBase } from "../types-DmcujDa5.mjs";
|
|
3
|
+
export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpRecordError, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, Thenable, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, validateDefinition, validateDefinitions };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as reviveDumpError, c as validateDefinitions, d as getRpcResolvedSetupResult, f as RpcCacheManager, i as getDefinitionsWithDumps, l as RpcFunctionsCollectorBase, n as createClientFromDump, o as serializeDumpError, r as dumpFunctions, s as validateDefinition, t as collectStaticRpcDump, u as getRpcHandler } from "../rpc-BlVCyk9W.mjs";
|
|
2
2
|
import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-CwO31axa.mjs";
|
|
3
3
|
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-CW9gLnyG.mjs";
|
|
4
|
-
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions };
|
|
4
|
+
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, 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-CrLsflnY.mjs";
|
|
2
2
|
export { WsRpcChannelOptions, createWsRpcChannel };
|
|
@@ -45,7 +45,7 @@ function createWsRpcChannel(options) {
|
|
|
45
45
|
method = pendingRequestMethods.get(msg.i);
|
|
46
46
|
pendingRequestMethods.delete(msg.i);
|
|
47
47
|
}
|
|
48
|
-
if (!!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
48
|
+
if (!(msg.t === "s" && "e" in msg) && !!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
49
49
|
return `s:${structuredCloneStringify(msg)}`;
|
|
50
50
|
},
|
|
51
51
|
deserialize: (raw) => {
|
|
@@ -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-DKlqI8XP.mjs";
|
|
2
2
|
export { DevToolsNodeRpcSessionMeta, WsRpcTransportOptions, attachWsRpcTransport };
|
|
@@ -46,7 +46,7 @@ function attachWsRpcTransport(rpcGroup, options = {}) {
|
|
|
46
46
|
method = pendingRequestMethods.get(msg.i);
|
|
47
47
|
pendingRequestMethods.delete(msg.i);
|
|
48
48
|
}
|
|
49
|
-
if (!!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
49
|
+
if (!(msg.t === "s" && "e" in msg) && !!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
50
50
|
return `s:${structuredCloneStringify(msg)}`;
|
|
51
51
|
}),
|
|
52
52
|
deserialize: deserializeOverride ?? ((raw) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as hash } from "./hash-CIBte1yS.mjs";
|
|
2
2
|
import { i as logger } from "./serialization-CwO31axa.mjs";
|
|
3
|
+
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
4
|
//#region src/rpc/cache.ts
|
|
4
5
|
/**
|
|
5
6
|
* @experimental API is expected to change.
|
|
@@ -285,7 +286,60 @@ function validateDefinition(definition) {
|
|
|
285
286
|
validateDefinitions([definition]);
|
|
286
287
|
}
|
|
287
288
|
//#endregion
|
|
288
|
-
//#region src/rpc/
|
|
289
|
+
//#region src/rpc/dump/error.ts
|
|
290
|
+
/**
|
|
291
|
+
* Normalize a thrown value into a plain object suitable for storage in
|
|
292
|
+
* a dump record. Preserves `message`, `name`, `cause`, and any own
|
|
293
|
+
* enumerable properties of an `Error` so consumers reading the dump can
|
|
294
|
+
* reconstruct a richer Error than just `{ message, name }`.
|
|
295
|
+
*
|
|
296
|
+
* Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
|
|
297
|
+
*/
|
|
298
|
+
function serializeDumpError(error) {
|
|
299
|
+
return serializeWithSeen(error, /* @__PURE__ */ new WeakSet());
|
|
300
|
+
}
|
|
301
|
+
function serializeWithSeen(error, seen) {
|
|
302
|
+
if (!(error instanceof Error)) return {
|
|
303
|
+
name: "Error",
|
|
304
|
+
message: String(error)
|
|
305
|
+
};
|
|
306
|
+
if (seen.has(error)) return {
|
|
307
|
+
name: error.name,
|
|
308
|
+
message: error.message
|
|
309
|
+
};
|
|
310
|
+
seen.add(error);
|
|
311
|
+
const out = {
|
|
312
|
+
name: error.name,
|
|
313
|
+
message: error.message
|
|
314
|
+
};
|
|
315
|
+
const cause = error.cause;
|
|
316
|
+
if (cause !== void 0) out.cause = cause instanceof Error ? serializeWithSeen(cause, seen) : cause;
|
|
317
|
+
for (const key of Object.keys(error)) {
|
|
318
|
+
if (key === "name" || key === "message" || key === "cause") continue;
|
|
319
|
+
out[key] = error[key];
|
|
320
|
+
}
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
|
|
325
|
+
* the plain object stored in a dump record. Preserves `cause`, restores
|
|
326
|
+
* the original `name`, and re-attaches any custom own properties.
|
|
327
|
+
*/
|
|
328
|
+
function reviveDumpError(stored) {
|
|
329
|
+
const cause = stored.cause instanceof Error ? stored.cause : isPlainErrorShape(stored.cause) ? reviveDumpError(stored.cause) : stored.cause;
|
|
330
|
+
const error = cause !== void 0 ? new Error(stored.message, { cause }) : new Error(stored.message);
|
|
331
|
+
error.name = stored.name;
|
|
332
|
+
for (const key of Object.keys(stored)) {
|
|
333
|
+
if (key === "name" || key === "message" || key === "cause") continue;
|
|
334
|
+
error[key] = stored[key];
|
|
335
|
+
}
|
|
336
|
+
return error;
|
|
337
|
+
}
|
|
338
|
+
function isPlainErrorShape(value) {
|
|
339
|
+
return typeof value === "object" && value !== null && typeof value.message === "string" && typeof value.name === "string";
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/rpc/dump/index.ts
|
|
289
343
|
function getDumpRecordKey(functionName, args) {
|
|
290
344
|
return `${functionName}---${hash(args)}`;
|
|
291
345
|
}
|
|
@@ -374,10 +428,7 @@ async function dumpFunctions(definitions, context, options = {}) {
|
|
|
374
428
|
} catch (error) {
|
|
375
429
|
store.records[recordKey] = {
|
|
376
430
|
inputs: input,
|
|
377
|
-
error:
|
|
378
|
-
message: error.message,
|
|
379
|
-
name: error.name
|
|
380
|
-
}
|
|
431
|
+
error: serializeDumpError(error)
|
|
381
432
|
};
|
|
382
433
|
}
|
|
383
434
|
});
|
|
@@ -409,11 +460,7 @@ function createClientFromDump(store, options = {}) {
|
|
|
409
460
|
const recordOrGetter = store.records[recordKey];
|
|
410
461
|
if (recordOrGetter) {
|
|
411
462
|
const record = await resolveGetter(recordOrGetter);
|
|
412
|
-
if (record.error)
|
|
413
|
-
const error = new Error(record.error.message);
|
|
414
|
-
error.name = record.error.name;
|
|
415
|
-
throw error;
|
|
416
|
-
}
|
|
463
|
+
if (record.error) throw reviveDumpError(record.error);
|
|
417
464
|
if (typeof record.output === "function") return await record.output();
|
|
418
465
|
return record.output;
|
|
419
466
|
}
|
|
@@ -454,4 +501,81 @@ function getDefinitionsWithDumps(definitions) {
|
|
|
454
501
|
return definitions.filter((def) => def.dump !== void 0);
|
|
455
502
|
}
|
|
456
503
|
//#endregion
|
|
457
|
-
|
|
504
|
+
//#region src/rpc/dump/static.ts
|
|
505
|
+
function makeDumpKey(name) {
|
|
506
|
+
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
507
|
+
}
|
|
508
|
+
function makeStaticPath(name) {
|
|
509
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
510
|
+
}
|
|
511
|
+
function makeQueryRecordPath(name, hash) {
|
|
512
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
513
|
+
}
|
|
514
|
+
function makeQueryFallbackPath(name) {
|
|
515
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
516
|
+
}
|
|
517
|
+
async function resolveRecord(record) {
|
|
518
|
+
return typeof record === "function" ? await record() : record;
|
|
519
|
+
}
|
|
520
|
+
async function collectStaticRpcDump(definitions, context) {
|
|
521
|
+
const manifest = {};
|
|
522
|
+
const files = {};
|
|
523
|
+
for (const definition of definitions) {
|
|
524
|
+
const type = definition.type ?? "query";
|
|
525
|
+
const serialization = definition.jsonSerializable === true ? "json" : "structured-clone";
|
|
526
|
+
if (type === "static") {
|
|
527
|
+
const handler = await getRpcHandler(definition, context);
|
|
528
|
+
const path = makeStaticPath(definition.name);
|
|
529
|
+
files[path] = {
|
|
530
|
+
serialization,
|
|
531
|
+
fnName: definition.name,
|
|
532
|
+
data: { output: await Promise.resolve(handler()) }
|
|
533
|
+
};
|
|
534
|
+
manifest[definition.name] = {
|
|
535
|
+
type: "static",
|
|
536
|
+
path,
|
|
537
|
+
serialization
|
|
538
|
+
};
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
if (type !== "query") continue;
|
|
542
|
+
const store = await dumpFunctions([definition], context);
|
|
543
|
+
if (!(definition.name in store.definitions)) continue;
|
|
544
|
+
const queryEntry = {
|
|
545
|
+
type: "query",
|
|
546
|
+
records: {},
|
|
547
|
+
serialization
|
|
548
|
+
};
|
|
549
|
+
const prefix = `${definition.name}---`;
|
|
550
|
+
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
551
|
+
if (!recordKey.startsWith(prefix)) continue;
|
|
552
|
+
const key = recordKey.slice(prefix.length);
|
|
553
|
+
const record = await resolveRecord(recordOrGetter);
|
|
554
|
+
if (key === "fallback") {
|
|
555
|
+
const path = makeQueryFallbackPath(definition.name);
|
|
556
|
+
files[path] = {
|
|
557
|
+
serialization,
|
|
558
|
+
fnName: definition.name,
|
|
559
|
+
data: record
|
|
560
|
+
};
|
|
561
|
+
queryEntry.fallback = path;
|
|
562
|
+
} else {
|
|
563
|
+
const path = makeQueryRecordPath(definition.name, key);
|
|
564
|
+
files[path] = {
|
|
565
|
+
serialization,
|
|
566
|
+
fnName: definition.name,
|
|
567
|
+
data: record
|
|
568
|
+
};
|
|
569
|
+
queryEntry.records[key] = path;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
573
|
+
manifest[definition.name] = queryEntry;
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
manifest,
|
|
577
|
+
files
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
581
|
+
export { reviveDumpError as a, validateDefinitions as c, getRpcResolvedSetupResult as d, RpcCacheManager as f, getDefinitionsWithDumps as i, RpcFunctionsCollectorBase as l, createClientFromDump as n, serializeDumpError as o, dumpFunctions as r, validateDefinition as s, collectStaticRpcDump as t, getRpcHandler as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-
|
|
1
|
+
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-DAfZWnpI.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import { H3 } from "h3";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as logger } from "./diagnostics-
|
|
2
|
-
import { t as createSharedState } from "./shared-state-
|
|
1
|
+
import { n as logger } from "./diagnostics-DNxVjo6X.mjs";
|
|
2
|
+
import { t as createSharedState } from "./shared-state-BJXkPxtf.mjs";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { dirname } from "pathe";
|
|
5
5
|
//#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-
|
|
2
|
-
import {
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
1
|
+
import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-DAfZWnpI.mjs";
|
|
2
|
+
import { h as RpcFunctionAgentOptions } from "../types-DmcujDa5.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DKlqI8XP.mjs";
|
|
4
4
|
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe };
|
|
@@ -94,6 +94,25 @@ interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> {
|
|
|
94
94
|
type RpcArgsSchema = readonly GenericSchema[];
|
|
95
95
|
/** Valibot schema for validating function return value */
|
|
96
96
|
type RpcReturnSchema = GenericSchema;
|
|
97
|
+
/**
|
|
98
|
+
* Serialized representation of a thrown value in a dump record.
|
|
99
|
+
*
|
|
100
|
+
* Errors are stored as plain objects so they round-trip through both the
|
|
101
|
+
* strict-JSON and structured-clone codecs. `message` and `name` are always
|
|
102
|
+
* present; `cause` and any own enumerable properties of the original
|
|
103
|
+
* `Error` are preserved on a best-effort basis. Non-`Error` throws are
|
|
104
|
+
* normalized to `{ name: 'Error', message: String(thrown) }`.
|
|
105
|
+
*/
|
|
106
|
+
interface RpcDumpRecordError {
|
|
107
|
+
/** Error message (mirrors `Error.message`). */
|
|
108
|
+
message: string;
|
|
109
|
+
/** Error type name (e.g., "Error", "TypeError"). */
|
|
110
|
+
name: string;
|
|
111
|
+
/** `Error.cause`, recursively serialized when it is itself an `Error`. */
|
|
112
|
+
cause?: unknown;
|
|
113
|
+
/** Own enumerable properties of the original error (excluding `message`/`name`/`cause`). */
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
}
|
|
97
116
|
/**
|
|
98
117
|
* Single record in a dump store with pre-computed results.
|
|
99
118
|
*/
|
|
@@ -103,10 +122,7 @@ interface RpcDumpRecord<ARGS extends any[] = any[], RETURN = any> {
|
|
|
103
122
|
/** Result (value or lazy function) */
|
|
104
123
|
output?: RETURN;
|
|
105
124
|
/** Error if execution failed */
|
|
106
|
-
error?:
|
|
107
|
-
/** Error message */message: string; /** Error type name (e.g., "Error", "TypeError") */
|
|
108
|
-
name: string;
|
|
109
|
-
};
|
|
125
|
+
error?: RpcDumpRecordError;
|
|
110
126
|
}
|
|
111
127
|
/**
|
|
112
128
|
* Defines argument combinations to pre-compute for a function.
|
|
@@ -270,4 +286,4 @@ type RpcDefinitionsFilter<T extends readonly RpcFunctionDefinitionAny[], Type ex
|
|
|
270
286
|
type: Type;
|
|
271
287
|
} ? T[K] : never };
|
|
272
288
|
//#endregion
|
|
273
|
-
export {
|
|
289
|
+
export { RpcFunctionsCollector as C, RpcFunctionType as S, Thenable as T, RpcFunctionDefinitionAny as _, RpcDefinitionsFilter as a, RpcFunctionDefinitionToFunction as b, RpcDumpClientOptions as c, RpcDumpGetter as d, RpcDumpRecord as f, RpcFunctionDefinition as g, RpcFunctionAgentOptions as h, RpcArgsSchema as i, RpcDumpCollectionOptions as l, RpcDumpStore as m, BirpcReturn$1 as n, RpcDefinitionsToFunctions as o, RpcDumpRecordError as p, EntriesToObject as r, RpcDump as s, BirpcFn as t, RpcDumpDefinition as u, RpcFunctionDefinitionAnyWithContext as v, RpcReturnSchema as w, RpcFunctionSetupResult as x, RpcFunctionDefinitionBase as y };
|
package/dist/utils/colors.mjs
CHANGED
|
@@ -1,2 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/utils/colors.ts
|
|
2
|
+
function makeColor(open, close) {
|
|
3
|
+
const o = `\x1B[${open}m`;
|
|
4
|
+
const c = `\x1B[${close}m`;
|
|
5
|
+
return ((arg, ...values) => {
|
|
6
|
+
if (Array.isArray(arg) && "raw" in arg) {
|
|
7
|
+
const strings = arg;
|
|
8
|
+
let out = "";
|
|
9
|
+
for (let i = 0; i < strings.length; i++) {
|
|
10
|
+
out += strings[i];
|
|
11
|
+
if (i < values.length) out += String(values[i]);
|
|
12
|
+
}
|
|
13
|
+
return `${o}${out}${c}`;
|
|
14
|
+
}
|
|
15
|
+
return `${o}${String(arg)}${c}`;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
const colors = {
|
|
19
|
+
blue: makeColor(34, 39),
|
|
20
|
+
cyan: makeColor(36, 39),
|
|
21
|
+
gray: makeColor(90, 39),
|
|
22
|
+
green: makeColor(32, 39),
|
|
23
|
+
red: makeColor(31, 39),
|
|
24
|
+
yellow: makeColor(33, 39),
|
|
25
|
+
bold: makeColor(1, 22),
|
|
26
|
+
dim: makeColor(2, 22),
|
|
27
|
+
reset: makeColor(0, 0),
|
|
28
|
+
underline: makeColor(4, 24)
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
2
31
|
export { colors };
|
package/dist/utils/events.d.mts
CHANGED