devframe 0.0.0 → 0.1.17
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/LICENSE.md +21 -0
- package/README.md +62 -0
- package/dist/_shared-Bxa2_kq7.mjs +20 -0
- package/dist/adapters/build.d.mts +37 -0
- package/dist/adapters/build.mjs +68 -0
- package/dist/adapters/cli.d.mts +35 -0
- package/dist/adapters/cli.mjs +357 -0
- package/dist/adapters/embedded.d.mts +19 -0
- package/dist/adapters/embedded.mjs +15 -0
- package/dist/adapters/kit.d.mts +23 -0
- package/dist/adapters/kit.mjs +16 -0
- package/dist/adapters/mcp.d.mts +39 -0
- package/dist/adapters/mcp.mjs +278 -0
- package/dist/adapters/vite.d.mts +32 -0
- package/dist/adapters/vite.mjs +31 -0
- package/dist/client/index.d.mts +228 -0
- package/dist/client/index.mjs +2 -0
- package/dist/client-CsR1_h3o.mjs +1569 -0
- package/dist/constants.d.mts +20 -0
- package/dist/constants.mjs +34 -0
- package/dist/context-xQo1FcxX.mjs +6827 -0
- package/dist/define-CW9gLnyG.mjs +11 -0
- package/dist/devtool-CHT-4_OU.d.mts +1233 -0
- package/dist/helpers/nuxt/index.d.mts +46 -0
- package/dist/helpers/nuxt/index.mjs +58 -0
- package/dist/helpers/nuxt/runtime/plugin.client.d.mts +8 -0
- package/dist/helpers/nuxt/runtime/plugin.client.mjs +12 -0
- package/dist/human-id-CHS0s28X.mjs +844 -0
- package/dist/immer-DEqg5kOd.mjs +894 -0
- package/dist/index-Cei8vVcd.d.mts +140 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +2 -0
- package/dist/main-BJD9t8dk.mjs +601 -0
- package/dist/node/index.d.mts +393 -0
- package/dist/node/index.mjs +69 -0
- package/dist/open-BMO2_-wC.mjs +533 -0
- package/dist/recipes/open-helpers.d.mts +108 -0
- package/dist/recipes/open-helpers.mjs +69 -0
- package/dist/rpc/client.d.mts +9 -0
- package/dist/rpc/client.mjs +13 -0
- package/dist/rpc/index.d.mts +3 -0
- package/dist/rpc/index.mjs +4 -0
- package/dist/rpc/server.d.mts +8 -0
- package/dist/rpc/server.mjs +10 -0
- package/dist/rpc/transports/ws-client.d.mts +2 -0
- package/dist/rpc/transports/ws-client.mjs +58 -0
- package/dist/rpc/transports/ws-server.d.mts +2 -0
- package/dist/rpc/transports/ws-server.mjs +73 -0
- package/dist/rpc-hbRk8qtt.mjs +456 -0
- package/dist/serialization-CWcWE7x7.mjs +112 -0
- package/dist/server-DkJ2-s0Y.mjs +49 -0
- package/dist/src-DIKqQIjp.mjs +85 -0
- package/dist/static-dump-DwFfj4U_.mjs +97 -0
- package/dist/transports-4bqw6Fqg.mjs +15 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +6 -0
- package/dist/types-BkyzI9r4.d.mts +273 -0
- package/dist/utils/events.d.mts +9 -0
- package/dist/utils/events.mjs +40 -0
- package/dist/utils/human-id.d.mts +10 -0
- package/dist/utils/human-id.mjs +3 -0
- package/dist/utils/nanoid.d.mts +4 -0
- package/dist/utils/nanoid.mjs +10 -0
- package/dist/utils/promise.d.mts +8 -0
- package/dist/utils/promise.mjs +15 -0
- package/dist/utils/shared-state.d.mts +2 -0
- package/dist/utils/shared-state.mjs +36 -0
- package/dist/utils/state.d.mts +49 -0
- package/dist/utils/state.mjs +26 -0
- package/dist/utils/when.d.mts +2 -0
- package/dist/utils/when.mjs +424 -0
- package/dist/when-aBBXAEh5.d.mts +401 -0
- package/dist/ws-client-CDGmViwt.d.mts +26 -0
- package/dist/ws-server-Cu8tmZcF.d.mts +49 -0
- package/package.json +116 -8
|
@@ -0,0 +1,140 @@
|
|
|
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-BkyzI9r4.mjs";
|
|
2
|
+
import { deserialize as structuredCloneDeserialize, parse as structuredCloneParse, serialize as structuredCloneSerialize, stringify as structuredCloneStringify } from "structured-clone-es";
|
|
3
|
+
|
|
4
|
+
//#region src/rpc/cache.d.ts
|
|
5
|
+
interface RpcCacheOptions {
|
|
6
|
+
functions: string[];
|
|
7
|
+
keySerializer?: (args: unknown[]) => string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* @experimental API is expected to change.
|
|
11
|
+
*/
|
|
12
|
+
declare class RpcCacheManager {
|
|
13
|
+
private cacheMap;
|
|
14
|
+
private options;
|
|
15
|
+
private keySerializer;
|
|
16
|
+
constructor(options: RpcCacheOptions);
|
|
17
|
+
updateOptions(options: Partial<RpcCacheOptions>): void;
|
|
18
|
+
cached<T>(m: string, a: unknown[]): T | undefined;
|
|
19
|
+
apply(req: {
|
|
20
|
+
m: string;
|
|
21
|
+
a: unknown[];
|
|
22
|
+
}, res: unknown): void;
|
|
23
|
+
validate(m: string): boolean;
|
|
24
|
+
clear(fn?: string): void;
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/rpc/collector.d.ts
|
|
28
|
+
declare class RpcFunctionsCollectorBase<LocalFunctions extends Record<string, any>, SetupContext> implements RpcFunctionsCollector<LocalFunctions, SetupContext> {
|
|
29
|
+
readonly context: SetupContext;
|
|
30
|
+
readonly definitions: Map<string, RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>>;
|
|
31
|
+
readonly functions: LocalFunctions;
|
|
32
|
+
private readonly _onChanged;
|
|
33
|
+
constructor(context: SetupContext);
|
|
34
|
+
register(fn: RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>, force?: boolean): void;
|
|
35
|
+
update(fn: RpcFunctionDefinition<string, any, any, any, any, any, SetupContext>, force?: boolean): void;
|
|
36
|
+
onChanged(fn: (id?: string) => void): () => void;
|
|
37
|
+
getHandler<T extends keyof LocalFunctions>(name: T): Promise<LocalFunctions[T]>;
|
|
38
|
+
getSchema<T extends keyof LocalFunctions>(name: T): {
|
|
39
|
+
args: RpcArgsSchema | undefined;
|
|
40
|
+
returns: RpcReturnSchema | undefined;
|
|
41
|
+
};
|
|
42
|
+
has(name: string): boolean;
|
|
43
|
+
get(name: string): RpcFunctionDefinition<string, any, any, any, any, any, SetupContext> | undefined;
|
|
44
|
+
list(): string[];
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/rpc/define.d.ts
|
|
48
|
+
declare function 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>): RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS>;
|
|
49
|
+
declare function createDefineWrapperWithContext<CONTEXT>(): <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, CONTEXT>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, CONTEXT>;
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/rpc/dumps.d.ts
|
|
52
|
+
/**
|
|
53
|
+
* Collects pre-computed dumps by executing functions with their defined input combinations.
|
|
54
|
+
* Static functions without dump config automatically get `{ inputs: [[]] }`.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const store = await dumpFunctions([greet], context, { concurrency: 10 })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a client that serves pre-computed results from a dump store.
|
|
64
|
+
* Uses argument hashing to match calls to stored records.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const client = createClientFromDump(store)
|
|
69
|
+
* await client.greet('Alice')
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
declare function createClientFromDump<T extends Record<string, any>>(store: RpcDumpStore<T>, options?: RpcDumpClientOptions): BirpcReturn<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Filters function definitions to only those with dump definitions.
|
|
75
|
+
* Note: Only checks the definition itself, not setup results.
|
|
76
|
+
*/
|
|
77
|
+
declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/rpc/handler.d.ts
|
|
80
|
+
declare function getRpcResolvedSetupResult<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, CONTEXT = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, any, any, CONTEXT>, context: CONTEXT): Promise<RpcFunctionSetupResult<ARGS, RETURN>>;
|
|
81
|
+
declare function getRpcHandler<NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, CONTEXT = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, any, any, CONTEXT>, context: CONTEXT): Promise<(...args: ARGS) => RETURN>;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/rpc/serialization.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* Wire format used by the WS RPC transport.
|
|
86
|
+
*
|
|
87
|
+
* - **JSON (default, unprefixed):** payload is plain JSON text. Used when
|
|
88
|
+
* the dispatched method is declared `jsonSerializable: true`. Encoded
|
|
89
|
+
* via {@link strictJsonStringify} (rejects non-JSON values), decoded
|
|
90
|
+
* via `JSON.parse`.
|
|
91
|
+
* - **Structured-clone (`s:` prefix):** payload is `s:` followed by
|
|
92
|
+
* `structured-clone-es` text. Used when the method is declared
|
|
93
|
+
* `jsonSerializable: false` (or omitted, the default). Round-trips
|
|
94
|
+
* `Map`, `Set`, `Date`, `BigInt`, cycles, and class instances.
|
|
95
|
+
*
|
|
96
|
+
* birpc envelopes always start with `{`, so a leading byte that is not
|
|
97
|
+
* `s` is unambiguously JSON. Each direction independently chooses its
|
|
98
|
+
* encoding from local definitions — request and response are not
|
|
99
|
+
* coupled by a mirror rule.
|
|
100
|
+
*/
|
|
101
|
+
declare const STRUCTURED_CLONE_PREFIX = "s:";
|
|
102
|
+
/**
|
|
103
|
+
* `JSON.stringify` with a single-pass strict replacer.
|
|
104
|
+
*
|
|
105
|
+
* Throws `DF0020` synchronously when the value contains a type JSON
|
|
106
|
+
* cannot round-trip losslessly: `Map`, `Set`, `Date`, `BigInt`, class
|
|
107
|
+
* instances, or `undefined` inside an array (silently becomes `null`).
|
|
108
|
+
*
|
|
109
|
+
* Native pass-throughs (no extra work needed):
|
|
110
|
+
* - circular references — `JSON.stringify` raises `TypeError`.
|
|
111
|
+
* - `BigInt` at top level — caught here for a friendlier error path.
|
|
112
|
+
*
|
|
113
|
+
* Lenient cases (allowed without throwing):
|
|
114
|
+
* - `undefined` as an object property — legitimate optional field;
|
|
115
|
+
* JSON.stringify just omits it.
|
|
116
|
+
* - `undefined` at the root — legitimate "action returned nothing".
|
|
117
|
+
* - `Symbol` / `Function` values — semantically "drop me" in JSON.
|
|
118
|
+
*
|
|
119
|
+
* `fnName` is used only for the diagnostic message — pass the RPC
|
|
120
|
+
* function name when calling from a wire serializer / dump writer so
|
|
121
|
+
* the error points at the offending function.
|
|
122
|
+
*/
|
|
123
|
+
declare function strictJsonStringify(value: unknown, fnName?: string): string;
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/rpc/validation.d.ts
|
|
126
|
+
/**
|
|
127
|
+
* Validates RPC function definitions.
|
|
128
|
+
* Action and event functions cannot have dumps (side effects should not be cached).
|
|
129
|
+
*
|
|
130
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
131
|
+
*/
|
|
132
|
+
declare function validateDefinitions(definitions: readonly RpcFunctionDefinitionAny[]): void;
|
|
133
|
+
/**
|
|
134
|
+
* Validates a single RPC function definition.
|
|
135
|
+
*
|
|
136
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
137
|
+
*/
|
|
138
|
+
declare function validateDefinition(definition: RpcFunctionDefinitionAny): void;
|
|
139
|
+
//#endregion
|
|
140
|
+
export { RpcCacheManager as _, structuredCloneDeserialize as a, structuredCloneStringify as c, createClientFromDump as d, dumpFunctions as f, RpcFunctionsCollectorBase as g, defineRpcFunction as h, strictJsonStringify as i, getRpcHandler as l, createDefineWrapperWithContext as m, validateDefinitions as n, structuredCloneParse as o, getDefinitionsWithDumps as p, STRUCTURED_CLONE_PREFIX as r, structuredCloneSerialize as s, validateDefinition as t, getRpcResolvedSetupResult as u, RpcCacheOptions as v };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { $ as DevToolsLogsHost, $t as EventsMap, A as DevToolsViewHost, At as DevToolsDiagnosticsHost, B as DevToolsTerminalStatus, Bt as DevToolsServerCommandEntry, Ct as DevToolsViewLauncher, Dt as JsonRenderer, Et as JsonRenderSpec, F as DevToolsChildProcessTerminalSession, Ft as DevToolsCommandHandle, G as DevToolsLogElementPosition, Gt as AgentResourceContent, H as DevToolsRpcClientFunctions, Ht as AgentHandle, I as DevToolsTerminalHost, It as DevToolsCommandKeybinding, J as DevToolsLogEntryInput, Jt as AgentToolInput, K as DevToolsLogEntry, Kt as AgentResourceInput, L as DevToolsTerminalSession, Lt as DevToolsCommandShortcutOverrides, M as PartialWithoutId, Mt as DevToolsClientCommand, N as Thenable, Nt as DevToolsCommandBase, Ot as RemoteDockOptions, P as DevToolsChildProcessExecuteOptions, Pt as DevToolsCommandEntry, Q as DevToolsLogsClient, Qt as EventUnsubscribe, R as DevToolsTerminalSessionBase, Rt as DevToolsCommandsHost, St as DevToolsViewJsonRender, Tt as JsonRenderElement, U as DevToolsRpcServerFunctions, Ut as AgentManifest, V as DevToolsDocksUserSettings, Vt as DevToolsServerCommandInput, W as DevToolsRpcSharedStates, Wt as AgentResource, X as DevToolsLogHandle, Xt as DevToolsAgentHostEvents, Y as DevToolsLogFilePosition, Yt as DevToolsAgentHost, Z as DevToolsLogLevel, Zt as EventEmitter, _ as RpcSharedStateGetOptions, _t as DevToolsDockUserEntry, a as DevtoolRuntime, at as DevToolsMessageHandle, bt as DevToolsViewCustomRender, c as defineDevtool, ct as DevToolsMessagesHost, d as DevToolsNodeContext, dt as DevToolsDockEntriesGrouped, en as CliFlagsSchema, et as DevToolsMessageElementPosition, f as DevToolsNodeUtils, ft as DevToolsDockEntry, g as RpcFunctionsHost, gt as DevToolsDockHost, h as RpcBroadcastOptions, ht as DevToolsDockEntryIcon, i as DevtoolDeploymentKind, it as DevToolsMessageFilePosition, j as EntriesToObject, jt as DevToolsDiagnosticsLogger, kt as DevToolsDiagnosticsDefinition, l as ConnectionMeta, lt as DevToolsHost, m as DevToolsNodeRpcSession, mt as DevToolsDockEntryCategory, n as DevtoolCliOptions, nn as defineCliFlags, nt as DevToolsMessageEntryFrom, o as DevtoolSetupInfo, ot as DevToolsMessageLevel, p as RemoteConnectionInfo, pt as DevToolsDockEntryBase, q as DevToolsLogEntryFrom, qt as AgentTool, r as DevtoolDefinition, rt as DevToolsMessageEntryInput, s as DevtoolSpaOptions, st as DevToolsMessagesClient, t as DevtoolBrowserContext, tn as InferCliFlags, tt as DevToolsMessageEntry, u as DevToolsCapabilities, ut as ClientScriptEntry, v as RpcSharedStateHost, vt as DevToolsViewAction, wt as DevToolsViewLauncherStatus, xt as DevToolsViewIframe, yt as DevToolsViewBuiltin, z as DevToolsTerminalSessionStreamChunkEvent, zt as DevToolsCommandsHostEvents } from "./devtool-CHT-4_OU.mjs";
|
|
2
|
+
import { C as RpcReturnSchema, h as RpcFunctionDefinition, i as RpcArgsSchema, m as RpcFunctionAgentOptions, x as RpcFunctionType } from "./types-BkyzI9r4.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-Cu8tmZcF.mjs";
|
|
4
|
+
|
|
5
|
+
//#region src/define.d.ts
|
|
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
|
+
declare function defineJsonRenderSpec(spec: JsonRenderSpec): JsonRenderSpec;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, type CliFlagsSchema, ClientScriptEntry, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsChildProcessExecuteOptions, DevToolsChildProcessTerminalSession, DevToolsClientCommand, DevToolsCommandBase, DevToolsCommandEntry, DevToolsCommandHandle, DevToolsCommandKeybinding, DevToolsCommandShortcutOverrides, DevToolsCommandsHost, DevToolsCommandsHostEvents, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsDockEntriesGrouped, DevToolsDockEntry, DevToolsDockEntryBase, DevToolsDockEntryCategory, DevToolsDockEntryIcon, DevToolsDockHost, DevToolsDockUserEntry, DevToolsDocksUserSettings, DevToolsHost, DevToolsLogElementPosition, DevToolsLogEntry, DevToolsLogEntryFrom, DevToolsLogEntryInput, DevToolsLogFilePosition, DevToolsLogHandle, DevToolsLogLevel, DevToolsLogsClient, DevToolsLogsHost, DevToolsMessageElementPosition, DevToolsMessageEntry, DevToolsMessageEntryFrom, DevToolsMessageEntryInput, DevToolsMessageFilePosition, DevToolsMessageHandle, DevToolsMessageLevel, DevToolsMessagesClient, DevToolsMessagesHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsNodeUtils, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsServerCommandEntry, DevToolsServerCommandInput, DevToolsTerminalHost, DevToolsTerminalSession, DevToolsTerminalSessionBase, DevToolsTerminalSessionStreamChunkEvent, DevToolsTerminalStatus, DevToolsViewAction, DevToolsViewBuiltin, DevToolsViewCustomRender, DevToolsViewHost, DevToolsViewIframe, DevToolsViewJsonRender, DevToolsViewLauncher, DevToolsViewLauncherStatus, DevtoolBrowserContext, DevtoolCliOptions, DevtoolDefinition, DevtoolDeploymentKind, DevtoolRuntime, DevtoolSetupInfo, DevtoolSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, type InferCliFlags, JsonRenderElement, JsonRenderSpec, JsonRenderer, PartialWithoutId, RemoteConnectionInfo, RemoteDockOptions, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, Thenable, defineCliFlags, defineCommand, defineDevtool, defineJsonRenderSpec, defineRpcFunction };
|
package/dist/index.mjs
ADDED