devframe 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/adapters/build.d.mts +1 -1
  2. package/dist/adapters/build.mjs +5 -5
  3. package/dist/adapters/cli.d.mts +1 -1
  4. package/dist/adapters/cli.mjs +2 -2
  5. package/dist/adapters/dev.d.mts +2 -2
  6. package/dist/adapters/dev.mjs +1 -1
  7. package/dist/adapters/embedded.d.mts +1 -1
  8. package/dist/adapters/mcp.d.mts +1 -1
  9. package/dist/adapters/mcp.mjs +8 -7
  10. package/dist/client/index.d.mts +18 -4
  11. package/dist/client/index.mjs +321 -8
  12. package/dist/{context-BDpuScNZ.d.mts → context-CwjX6sCG.d.mts} +1 -1
  13. package/dist/{dev-CZ9ZQkuO.mjs → dev-BbmanqL7.mjs} +1 -1
  14. package/dist/{devframe-DAfZWnpI.d.mts → devframe-sc4cb5xr.d.mts} +48 -90
  15. package/dist/diagnostics-GitRGKbr.mjs +33 -0
  16. package/dist/diagnostics-reporter-CBBZwoMv.mjs +38 -0
  17. package/dist/{rpc-BlVCyk9W.mjs → dump-zMleojnD.mjs} +147 -134
  18. package/dist/helpers/vite.d.mts +1 -1
  19. package/dist/helpers/vite.mjs +6 -5
  20. package/dist/{host-h3-DEfOpa0j.mjs → host-h3-TTunNr_n.mjs} +284 -44
  21. package/dist/human-id-Dq-qgtES.mjs +803 -0
  22. package/dist/index-C5PmWqBf.d.mts +79 -0
  23. package/dist/{index-BNAsgVNz.d.mts → index-CTK6fuXs.d.mts} +31 -78
  24. package/dist/index-DTeZXHSi.d.mts +639 -0
  25. package/dist/index.d.mts +4 -4
  26. package/dist/node/auth.d.mts +2 -2
  27. package/dist/node/auth.mjs +1 -2
  28. package/dist/node/index.d.mts +10 -14
  29. package/dist/node/index.mjs +2 -2
  30. package/dist/node/internal.d.mts +2 -2
  31. package/dist/node/internal.mjs +2 -3
  32. package/dist/recipes/open-helpers.d.mts +1 -1
  33. package/dist/rpc/dump.d.mts +2 -0
  34. package/dist/rpc/dump.mjs +2 -0
  35. package/dist/rpc/index.d.mts +2 -2
  36. package/dist/rpc/index.mjs +128 -2
  37. package/dist/rpc/transports/ws-client.d.mts +25 -1
  38. package/dist/rpc/transports/ws-client.mjs +2 -2
  39. package/dist/rpc/transports/ws-server.d.mts +1 -1
  40. package/dist/rpc/transports/ws-server.mjs +2 -2
  41. package/dist/{serialization-CwO31axa.mjs → serialization-BlqLh4_J.mjs} +4 -38
  42. package/dist/{server-BGSrxsQb.d.mts → server-ouL4gZbu.d.mts} +1 -1
  43. package/dist/shared-state-CasqoUba.mjs +1019 -0
  44. package/dist/{shared-state-BJXkPxtf.mjs → shared-state-u0y123fi.mjs} +6 -6
  45. package/dist/{storage-D-jLaxDA.mjs → storage-K-OxR1xf.mjs} +5 -3
  46. package/dist/structured-clone-jegjz0hM.mjs +208 -0
  47. package/dist/types/index.d.mts +4 -4
  48. package/dist/utils/events.d.mts +1 -1
  49. package/dist/utils/hash.mjs +1 -1
  50. package/dist/utils/shared-state.d.mts +1 -1
  51. package/dist/utils/shared-state.mjs +1 -1
  52. package/dist/utils/streaming-channel.d.mts +1 -1
  53. package/dist/utils/structured-clone.mjs +1 -1
  54. package/dist/{ws-server-DKlqI8XP.d.mts → ws-server-DOwLJL23.d.mts} +1 -1
  55. package/package.json +3 -2
  56. package/skills/devframe/SKILL.md +1 -1
  57. package/dist/diagnostics-DNxVjo6X.mjs +0 -56
  58. package/dist/revoke-DDa7VSJa.mjs +0 -35
  59. package/dist/ws-client-CrLsflnY.d.mts +0 -26
  60. /package/dist/{hash-CIBte1yS.mjs → hash-bwOD8RgU.mjs} +0 -0
  61. /package/dist/{structured-clone-CD2l4fI3.mjs → structured-clone-PdCZwt7F.mjs} +0 -0
  62. /package/dist/{types-DmcujDa5.d.mts → types-BXL7EIDM.d.mts} +0 -0
@@ -1,9 +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-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
- import { createLogger, defineDiagnostics } from "logs-sdk";
1
+ import { B as DevToolsAgentHost$1, E as DevToolsRpcServerFunctions, F as AgentResource, H as EventEmitter, I as AgentResourceContent, L as AgentResourceInput, M as DevToolsDiagnosticsLogger, N as AgentHandle, O as DevToolsHost, P as AgentManifest, R as AgentTool, T as DevToolsRpcClientFunctions, V as DevToolsAgentHostEvents, b as SharedState, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, j as DevToolsDiagnosticsHost$1, m as RpcFunctionsHost$1, p as RpcBroadcastOptions, x as DevToolsViewHost$1, y as RpcStreamingHost, z as AgentToolInput } from "../devframe-sc4cb5xr.mjs";
2
+ import { _ as RpcFunctionDefinitionAny } from "../types-BXL7EIDM.mjs";
3
+ import { S as RpcFunctionsCollectorBase } from "../index-CTK6fuXs.mjs";
4
+ import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DOwLJL23.mjs";
5
+ import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-ouL4gZbu.mjs";
7
6
  import { BirpcGroup } from "birpc";
8
7
  import { AsyncLocalStorage } from "node:async_hooks";
9
8
 
@@ -67,14 +66,11 @@ declare class DevToolsAgentHost implements DevToolsAgentHost$1 {
67
66
  //#region src/node/host-diagnostics.d.ts
68
67
  declare class DevToolsDiagnosticsHost implements DevToolsDiagnosticsHost$1 {
69
68
  readonly context: DevToolsNodeContext;
70
- private _definitions;
71
- private _logger;
72
- readonly defineDiagnostics: typeof defineDiagnostics;
73
- readonly createLogger: typeof createLogger;
74
- constructor(context: DevToolsNodeContext, initialDefinitions?: unknown[]);
75
- get logger(): DevToolsDiagnosticsLogger;
76
- register(definitions: unknown): void;
77
- private _rebuild;
69
+ private _registry;
70
+ readonly logger: DevToolsDiagnosticsLogger;
71
+ readonly defineDiagnostics: DevToolsDiagnosticsHost$1['defineDiagnostics'];
72
+ constructor(context: DevToolsNodeContext, initialDefinitions?: Array<Record<string, unknown>>);
73
+ register(diagnostics: Record<string, unknown>): void;
78
74
  }
79
75
  //#endregion
80
76
  //#region src/node/host-functions.d.ts
@@ -1,6 +1,6 @@
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";
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-TTunNr_n.mjs";
2
2
  import { t as startHttpAndWs } from "../server-BO8IDVsJ.mjs";
3
- import { t as createStorage } from "../storage-D-jLaxDA.mjs";
3
+ import { t as createStorage } from "../storage-K-OxR1xf.mjs";
4
4
  import { isIP } from "node:net";
5
5
  //#region src/node/utils.ts
6
6
  function isObject(value) {
@@ -1,5 +1,5 @@
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";
1
+ import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-sc4cb5xr.mjs";
2
+ import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-CwjX6sCG.mjs";
3
3
 
4
4
  //#region src/adapters/_shared.d.ts
5
5
  /**
@@ -1,6 +1,5 @@
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";
1
+ import { t as createStorage } from "../storage-K-OxR1xf.mjs";
2
+ import { n as revokeActiveConnectionsForToken, r as revokeAuthToken, t as humanId } from "../human-id-Dq-qgtES.mjs";
4
3
  import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-CUFqO4kJ.mjs";
5
4
  import { join } from "pathe";
6
5
  //#region src/node/internal/context.ts
@@ -1,4 +1,4 @@
1
- import { T as Thenable, h as RpcFunctionAgentOptions, s as RpcDump, x as RpcFunctionSetupResult } from "../types-DmcujDa5.mjs";
1
+ import { T as Thenable, h as RpcFunctionAgentOptions, s as RpcDump, x as RpcFunctionSetupResult } from "../types-BXL7EIDM.mjs";
2
2
  import * as v from "valibot";
3
3
 
4
4
  //#region src/recipes/open-helpers.d.ts
@@ -0,0 +1,2 @@
1
+ import { a as getDefinitionsWithDumps, c as StaticRpcDumpManifest, d as StaticRpcDumpManifestValue, f as StaticRpcDumpSerialization, i as dumpFunctions, l as StaticRpcDumpManifestQueryEntry, n as serializeDumpError, o as StaticRpcDumpCollection, p as collectStaticRpcDump, r as createClientFromDump, s as StaticRpcDumpFile, t as reviveDumpError, u as StaticRpcDumpManifestStaticEntry } from "../index-C5PmWqBf.mjs";
2
+ export { StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError };
@@ -0,0 +1,2 @@
1
+ import { a as dumpFunctions, c as serializeDumpError, i as createClientFromDump, o as getDefinitionsWithDumps, s as reviveDumpError, t as collectStaticRpcDump } from "../dump-zMleojnD.mjs";
2
+ export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError };
@@ -1,3 +1,3 @@
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";
1
+ 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-BXL7EIDM.mjs";
2
+ import { C as RpcCacheManager, S as RpcFunctionsCollectorBase, _ as strictJsonStringify, a as StaticRpcDumpManifestStaticEntry, b as createDefineWrapperWithContext, c as collectStaticRpcDump, d as getDefinitionsWithDumps, f as reviveDumpError, g as STRUCTURED_CLONE_PREFIX, h as validateDefinitions, i as StaticRpcDumpManifestQueryEntry, l as createClientFromDump, m as validateDefinition, n as StaticRpcDumpFile, o as StaticRpcDumpManifestValue, p as serializeDumpError, r as StaticRpcDumpManifest, s as StaticRpcDumpSerialization, t as StaticRpcDumpCollection, u as dumpFunctions, v as getRpcHandler, w as RpcCacheOptions, x as defineRpcFunction, y as getRpcResolvedSetupResult } from "../index-CTK6fuXs.mjs";
3
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 };
@@ -1,4 +1,130 @@
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
- import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-CwO31axa.mjs";
1
+ import { a as dumpFunctions$1, c as serializeDumpError$1, d as hash, i as createClientFromDump$1, l as validateDefinition, n as getRpcHandler, o as getDefinitionsWithDumps$1, r as getRpcResolvedSetupResult, s as reviveDumpError$1, t as collectStaticRpcDump$1, u as validateDefinitions } from "../dump-zMleojnD.mjs";
2
+ import { t as diagnostics } from "../diagnostics-GitRGKbr.mjs";
3
3
  import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-CW9gLnyG.mjs";
4
+ import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-BlqLh4_J.mjs";
5
+ //#region src/rpc/cache.ts
6
+ /**
7
+ * @experimental API is expected to change.
8
+ */
9
+ var RpcCacheManager = class {
10
+ cacheMap = /* @__PURE__ */ new Map();
11
+ options;
12
+ keySerializer;
13
+ constructor(options) {
14
+ this.options = options;
15
+ this.keySerializer = options.keySerializer || ((args) => hash(args));
16
+ }
17
+ updateOptions(options) {
18
+ this.options = {
19
+ ...this.options,
20
+ ...options
21
+ };
22
+ }
23
+ cached(m, a) {
24
+ const methodCache = this.cacheMap.get(m);
25
+ if (methodCache) return methodCache.get(this.keySerializer(a));
26
+ }
27
+ apply(req, res) {
28
+ const methodCache = this.cacheMap.get(req.m) || /* @__PURE__ */ new Map();
29
+ methodCache.set(this.keySerializer(req.a), res);
30
+ this.cacheMap.set(req.m, methodCache);
31
+ }
32
+ validate(m) {
33
+ return this.options.functions.includes(m);
34
+ }
35
+ clear(fn) {
36
+ if (fn) this.cacheMap.delete(fn);
37
+ else this.cacheMap.clear();
38
+ }
39
+ };
40
+ //#endregion
41
+ //#region src/rpc/collector.ts
42
+ var RpcFunctionsCollectorBase = class {
43
+ context;
44
+ definitions = /* @__PURE__ */ new Map();
45
+ functions;
46
+ _onChanged = [];
47
+ constructor(context) {
48
+ this.context = context;
49
+ const definitions = this.definitions;
50
+ const self = this;
51
+ this.functions = new Proxy({}, {
52
+ get(_, prop) {
53
+ const definition = definitions.get(prop);
54
+ if (!definition) return void 0;
55
+ return getRpcHandler(definition, self.context);
56
+ },
57
+ has(_, prop) {
58
+ return definitions.has(prop);
59
+ },
60
+ getOwnPropertyDescriptor(_, prop) {
61
+ return {
62
+ value: definitions.get(prop)?.handler,
63
+ configurable: true,
64
+ enumerable: true
65
+ };
66
+ },
67
+ ownKeys() {
68
+ return Array.from(definitions.keys());
69
+ }
70
+ });
71
+ }
72
+ register(fn, force = false) {
73
+ if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021.throw({ name: fn.name });
74
+ assertAgentJsonSerializable(fn);
75
+ this.definitions.set(fn.name, fn);
76
+ this._onChanged.forEach((cb) => cb(fn.name));
77
+ }
78
+ update(fn, force = false) {
79
+ if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022.throw({ name: fn.name });
80
+ assertAgentJsonSerializable(fn);
81
+ this.definitions.set(fn.name, fn);
82
+ this._onChanged.forEach((cb) => cb(fn.name));
83
+ }
84
+ onChanged(fn) {
85
+ this._onChanged.push(fn);
86
+ return () => {
87
+ const index = this._onChanged.indexOf(fn);
88
+ if (index !== -1) this._onChanged.splice(index, 1);
89
+ };
90
+ }
91
+ async getHandler(name) {
92
+ return await getRpcHandler(this.definitions.get(name), this.context);
93
+ }
94
+ getSchema(name) {
95
+ const definition = this.definitions.get(name);
96
+ if (!definition) throw diagnostics.DF0023.throw({ name: String(name) });
97
+ return {
98
+ args: definition.args,
99
+ returns: definition.returns
100
+ };
101
+ }
102
+ has(name) {
103
+ return this.definitions.has(name);
104
+ }
105
+ get(name) {
106
+ return this.definitions.get(name);
107
+ }
108
+ list() {
109
+ return Array.from(this.definitions.keys());
110
+ }
111
+ };
112
+ function assertAgentJsonSerializable(fn) {
113
+ if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019.throw({ name: fn.name });
114
+ }
115
+ //#endregion
116
+ //#region src/rpc/index.ts
117
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
118
+ const collectStaticRpcDump = collectStaticRpcDump$1;
119
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
120
+ const createClientFromDump = createClientFromDump$1;
121
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
122
+ const dumpFunctions = dumpFunctions$1;
123
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
124
+ const getDefinitionsWithDumps = getDefinitionsWithDumps$1;
125
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
126
+ const reviveDumpError = reviveDumpError$1;
127
+ /** @deprecated Import from `devframe/rpc/dump` instead. */
128
+ const serializeDumpError = serializeDumpError$1;
129
+ //#endregion
4
130
  export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, validateDefinition, validateDefinitions };
@@ -1,2 +1,26 @@
1
- import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-CrLsflnY.mjs";
1
+ import { _ as RpcFunctionDefinitionAny } from "../../types-BXL7EIDM.mjs";
2
+ import { ChannelOptions } from "birpc";
3
+
4
+ //#region src/rpc/transports/ws-client.d.ts
5
+ interface WsRpcChannelOptions {
6
+ url: string;
7
+ onConnected?: (e: Event) => void;
8
+ onError?: (e: Error) => void;
9
+ onDisconnected?: (e: CloseEvent) => void;
10
+ authToken?: string;
11
+ /**
12
+ * RPC function definitions (or just the `jsonSerializable` flag per
13
+ * method) used to dispatch the per-call wire serializer. Pass an
14
+ * empty / partial map on clients that don't have the full registry —
15
+ * encoding falls back to structured-clone (the safer superset) and
16
+ * decoding still routes correctly via the wire prefix.
17
+ */
18
+ definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, 'jsonSerializable'>>;
19
+ }
20
+ /**
21
+ * Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
22
+ * Pass the result straight to `createRpcClient`'s `channel` option.
23
+ */
24
+ declare function createWsRpcChannel(options: WsRpcChannelOptions): ChannelOptions;
25
+ //#endregion
2
26
  export { WsRpcChannelOptions, createWsRpcChannel };
@@ -1,5 +1,5 @@
1
- import { n as strictJsonStringify } from "../../serialization-CwO31axa.mjs";
2
- import { i as structuredCloneStringify, n as structuredCloneParse } from "../../structured-clone-CD2l4fI3.mjs";
1
+ import { n as strictJsonStringify } from "../../serialization-BlqLh4_J.mjs";
2
+ import { n as structuredCloneStringify, t as structuredCloneParse } from "../../structured-clone-jegjz0hM.mjs";
3
3
  //#region src/rpc/transports/ws-client.ts
4
4
  function NOOP() {}
5
5
  const EMPTY_DEFS = /* @__PURE__ */ new Map();
@@ -1,2 +1,2 @@
1
- import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-DKlqI8XP.mjs";
1
+ import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-DOwLJL23.mjs";
2
2
  export { DevToolsNodeRpcSessionMeta, WsRpcTransportOptions, attachWsRpcTransport };
@@ -1,5 +1,5 @@
1
- import { n as strictJsonStringify } from "../../serialization-CwO31axa.mjs";
2
- import { i as structuredCloneStringify, n as structuredCloneParse } from "../../structured-clone-CD2l4fI3.mjs";
1
+ import { n as strictJsonStringify } from "../../serialization-BlqLh4_J.mjs";
2
+ import { n as structuredCloneStringify, t as structuredCloneParse } from "../../structured-clone-jegjz0hM.mjs";
3
3
  import { createServer } from "node:https";
4
4
  import { WebSocketServer } from "ws";
5
5
  //#region src/rpc/transports/ws-server.ts
@@ -1,38 +1,4 @@
1
- import { consoleReporter, createLogger, defineDiagnostics, plainFormatter } from "logs-sdk";
2
- //#region src/rpc/diagnostics.ts
3
- const diagnostics = defineDiagnostics({
4
- docsBase: "https://devfra.me/errors",
5
- codes: {
6
- DF0019: {
7
- message: (p) => `RPC function "${p.name}" has \`agent\` set but \`jsonSerializable\` is not \`true\` — MCP requires JSON-serializable data.`,
8
- hint: "Set `jsonSerializable: true` if the payload is JSON-safe, or remove `agent` to keep it RPC-only."
9
- },
10
- DF0020: {
11
- message: (p) => `RPC function "${p.name}" declares \`jsonSerializable: true\` but the value at "${p.path}" is a ${p.type}.`,
12
- hint: "Either drop `jsonSerializable: true` (falls back to structured-clone) or change the value to a JSON-safe shape."
13
- },
14
- DF0021: {
15
- message: (p) => `RPC function "${p.name}" is already registered`,
16
- hint: "Use the `force` parameter to overwrite an existing registration."
17
- },
18
- DF0022: { message: (p) => `RPC function "${p.name}" is not registered. Use register() to add new functions.` },
19
- DF0023: { message: (p) => `RPC function "${p.name}" is not registered` },
20
- DF0024: { message: (p) => `Either handler or setup function must be provided for RPC function "${p.name}"` },
21
- DF0025: { message: (p) => `Function "${p.name}" not found in dump store` },
22
- DF0026: { message: (p) => `No dump match for "${p.name}" with args: ${p.args}` },
23
- DF0027: { message: (p) => `Function "${p.name}" with type "${p.type}" cannot have dump configuration. Only "static" and "query" types support dumps.` },
24
- DF0028: {
25
- message: (p) => `Function "${p.name}" with type "${p.type}" cannot use \`snapshot: true\`. Only "query" functions support this sugar; "static" functions have equivalent default behavior already.`,
26
- hint: "Remove `snapshot: true`, or change the function type to `query`."
27
- }
28
- }
29
- });
30
- const logger = createLogger({
31
- diagnostics: [diagnostics],
32
- formatter: plainFormatter,
33
- reporters: consoleReporter
34
- });
35
- //#endregion
1
+ import { t as diagnostics } from "./diagnostics-GitRGKbr.mjs";
36
2
  //#region src/rpc/serialization.ts
37
3
  /**
38
4
  * Wire format used by the WS RPC transport.
@@ -96,11 +62,11 @@ function strictJsonStringify(value, fnName = "") {
96
62
  }
97
63
  function nonJsonAt(fnName, type, parent, key) {
98
64
  const path = formatPath(parent, key);
99
- return logger.DF0020({
65
+ return diagnostics.DF0020.throw({
100
66
  name: fnName || "<anonymous>",
101
67
  type,
102
68
  path
103
- }).throw();
69
+ });
104
70
  }
105
71
  function formatPath(parent, key) {
106
72
  if (Array.isArray(parent)) return `[${key}]`;
@@ -108,4 +74,4 @@ function formatPath(parent, key) {
108
74
  return key;
109
75
  }
110
76
  //#endregion
111
- export { logger as i, strictJsonStringify as n, diagnostics as r, STRUCTURED_CLONE_PREFIX as t };
77
+ export { strictJsonStringify as n, STRUCTURED_CLONE_PREFIX as t };
@@ -1,4 +1,4 @@
1
- import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-DAfZWnpI.mjs";
1
+ import { E as DevToolsRpcServerFunctions, T as DevToolsRpcClientFunctions, d as DevToolsNodeContext } from "./devframe-sc4cb5xr.mjs";
2
2
  import { BirpcGroup } from "birpc";
3
3
  import { WebSocketServer } from "ws";
4
4
  import { H3 } from "h3";