devframe 0.8.1 → 0.9.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared-CttmCMBi.mjs +70 -0
- package/dist/_shared-DmpWW-HH.d.mts +43 -0
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +6 -5
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +157 -1
- package/dist/adapters/dev.d.mts +25 -34
- package/dist/adapters/dev.mjs +2 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +223 -0
- package/dist/adapters/initiate.mjs +2 -0
- package/dist/adapters/mcp.d.mts +26 -2
- package/dist/adapters/mcp.mjs +2 -2
- package/dist/cli/main.mjs +2 -2
- package/dist/client/index.d.mts +70 -6
- package/dist/client/index.mjs +743 -408
- package/dist/constants.d.mts +19 -6
- package/dist/constants.mjs +19 -6
- package/dist/{context-CQefP2jR.mjs → context-C33rR7n0.mjs} +1 -1
- package/dist/{context-DFzmxCLa.d.mts → context-CSCwoABx.d.mts} +1 -1
- package/dist/{host-h3-Kz7t5Xab.mjs → context-Du11TLcO.mjs} +5 -255
- package/dist/dev-BEveeA5H.mjs +233 -0
- package/dist/{devframe-qgCKL683.d.mts → devframe-Bdd9YXTy.d.mts} +88 -25
- package/dist/{diagnostics-B5-qHeqD.mjs → diagnostics-DLYH5oD3.mjs} +20 -0
- package/dist/dist-D8jAMwxU.mjs +227 -0
- package/dist/helpers/vite.d.mts +43 -39
- package/dist/helpers/vite.mjs +26 -38
- package/dist/host-agent-CpbAoqBx.mjs +230 -0
- package/dist/host-h3-CzCZwtuV.mjs +26 -0
- package/dist/{fetch-CK0S253E.mjs → http-DLr_cJZ7.mjs} +42 -4
- package/dist/{index-B7RgLw--.d.mts → index-CZRd2K1C.d.mts} +2 -2
- package/dist/{index-Dbw1p5ch.d.mts → index-DSCq4M4q.d.mts} +2 -31
- package/dist/index.d.mts +9 -4
- package/dist/index.mjs +8 -1
- package/dist/{instance-registry-D6fxYu36.mjs → instance-registry-BQqGoDO9.mjs} +9 -2
- package/dist/instance-shell-DBTXTSjN.d.mts +264 -0
- package/dist/instance-shell-KRdee1QF.mjs +485 -0
- package/dist/internal/index.d.mts +150 -0
- package/dist/internal/index.mjs +7 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -14
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +3 -267
- package/dist/node/index.mjs +3 -5
- package/dist/recipes/common-rpc-functions.d.mts +3 -3
- package/dist/recipes/interactive-auth.d.mts +3 -3
- package/dist/recipes/interactive-auth.mjs +6 -6
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/rpc/dump.d.mts +77 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +3 -17
- package/dist/rpc/transports/sse-client.d.mts +2 -0
- package/dist/rpc/transports/sse-client.mjs +142 -0
- package/dist/rpc/transports/sse-server.d.mts +61 -0
- package/dist/rpc/transports/sse-server.mjs +209 -0
- package/dist/rpc/transports/ws-bun.d.mts +35 -0
- package/dist/rpc/transports/ws-bun.mjs +31 -0
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +10 -18
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +2 -214
- package/dist/rpc-core-CGctXToO.d.mts +48 -0
- package/dist/rpc-core-CqcJkAu9.mjs +81 -0
- package/dist/{serialization-C8Mnw9hK.mjs → serialization-BHY8M5NQ.mjs} +1 -1
- package/dist/{shared-state-6kHolYZy.mjs → shared-state-fRRbRUtD.mjs} +1 -1
- package/dist/sse-client-BsIK3hMD.d.mts +37 -0
- package/dist/{dump-CgZShDRB.mjs → static-CvjkO8QE.mjs} +2 -265
- package/dist/{storage-Dzoc3NVC.mjs → storage-BcmVEJRc.mjs} +2 -2
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.mjs +1 -6
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/launch-editor.mjs +1 -25
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/serve-static.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/simple-schema.d.mts +101 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/validation-BiuDXTKW.mjs +266 -0
- package/dist/wire-codec-9VhIKnyp.mjs +58 -0
- package/dist/{ws-client-B6Tnr0ic.d.mts → ws-client-CdNuATYa.d.mts} +6 -1
- package/dist/ws-server-Bk1hOG3X.mjs +267 -0
- package/dist/{ws-server-J-zkiOyp.d.mts → ws-server-Ces08fjP.d.mts} +102 -13
- package/package.json +10 -9
- package/skills/devframe/SKILL.md +84 -85
- package/dist/_shared-bWRzeSa0.mjs +0 -19
- package/dist/adapters/cli.d.mts +0 -11
- package/dist/adapters/cli.mjs +0 -6
- package/dist/cac-B1LM3zit.mjs +0 -157
- package/dist/dev-BSHFZGZr.mjs +0 -437
- package/dist/http-Dvgxujcu.mjs +0 -38
- package/dist/index-vAX6bYuc.d.mts +0 -78
- package/dist/recipes/open-helpers.d.mts +0 -6
- package/dist/recipes/open-helpers.mjs +0 -6
- package/dist/server-CXaDDUl0.mjs +0 -148
- package/dist/server-E9z4ZWbd.d.mts +0 -132
- package/dist/simple-schema-BDzLeJDk.d.mts +0 -102
- package/dist/utils/promise.d.mts +0 -8
- package/dist/utils/promise.mjs +0 -15
- package/dist/utils/scope.d.mts +0 -11
- package/dist/utils/scope.mjs +0 -15
- package/dist/{open-Deb5xmIT.mjs → open-Dz4V4irZ.mjs} +1 -1
package/dist/node/index.d.mts
CHANGED
|
@@ -1,38 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { gt as SharedState, q as RpcFunctionsHost, x as DevframeNodeContext, z as DevframeHost } from "../devframe-Bdd9YXTy.mjs";
|
|
2
|
+
import "../index-DSCq4M4q.mjs";
|
|
2
3
|
import { v as RpcFunctionDefinitionAny } from "../types-CnJSgRVa.mjs";
|
|
3
|
-
import "../index-Dbw1p5ch.mjs";
|
|
4
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-E9z4ZWbd.mjs";
|
|
5
4
|
import { BirpcGroup } from "birpc";
|
|
6
|
-
//#region src/node/agent-args.d.ts
|
|
7
|
-
/**
|
|
8
|
-
* How {@link coerceAgentPositionalArgs} treats an args object that carries
|
|
9
|
-
* neither declared schemas nor `arg0`/`arg1`/… keys:
|
|
10
|
-
*
|
|
11
|
-
* - `'wrap'` — pass the object itself as the single positional argument.
|
|
12
|
-
* RPC-backed tools use this: an untyped RPC may take one raw object.
|
|
13
|
-
* - `'drop'` — call with zero arguments. Command-backed tools use this:
|
|
14
|
-
* a handler's positional parameters come solely from its declared
|
|
15
|
-
* `agent.args` schemas, so undeclared payload is ignored.
|
|
16
|
-
*/
|
|
17
|
-
type AgentArgsFallback = 'wrap' | 'drop';
|
|
18
|
-
/**
|
|
19
|
-
* Map the args payload an agent surface receives (MCP sends an object
|
|
20
|
-
* keyed `arg0`/`arg1`/…, matching the schema the adapter advertises) onto
|
|
21
|
-
* a handler's positional parameters. Shared by the agent host's RPC
|
|
22
|
-
* bridge and the hub's command-derived tools so the coercion cannot
|
|
23
|
-
* drift between them.
|
|
24
|
-
*
|
|
25
|
-
* - an array passes through as-is
|
|
26
|
-
* - `null`/`undefined` become a zero-argument call
|
|
27
|
-
* - with declared schemas, each schema reads its own `argN` key, in order
|
|
28
|
-
* - without schemas, `arg0`/`arg1`/… keys are collected when present
|
|
29
|
-
* - an empty object becomes a zero-argument call
|
|
30
|
-
* - anything else follows the {@link AgentArgsFallback}
|
|
31
|
-
*
|
|
32
|
-
* @experimental
|
|
33
|
-
*/
|
|
34
|
-
declare function coerceAgentPositionalArgs(args: unknown, schemas: readonly unknown[] | undefined, fallback?: AgentArgsFallback): unknown[];
|
|
35
|
-
//#endregion
|
|
36
5
|
//#region src/node/context.d.ts
|
|
37
6
|
interface CreateHostContextOptions {
|
|
38
7
|
cwd: string;
|
|
@@ -56,231 +25,6 @@ interface CreateHostContextOptions {
|
|
|
56
25
|
*/
|
|
57
26
|
declare function createHostContext(options: CreateHostContextOptions): Promise<DevframeNodeContext>;
|
|
58
27
|
//#endregion
|
|
59
|
-
//#region src/node/host-agent.d.ts
|
|
60
|
-
/**
|
|
61
|
-
* Framework-neutral host aggregating the agent-exposed surface of a
|
|
62
|
-
* devframe. Auto-discovers RPC functions with an `agent` field from
|
|
63
|
-
* `ctx.rpc.definitions`, and accepts plugin-registered tools /
|
|
64
|
-
* resources via `registerTool` / `registerResource`.
|
|
65
|
-
*
|
|
66
|
-
* @experimental
|
|
67
|
-
*/
|
|
68
|
-
declare class DevframeAgentHost implements DevframeAgentHost$1 {
|
|
69
|
-
readonly context: DevframeNodeContext;
|
|
70
|
-
readonly events: EventEmitter<DevframeAgentHostEvents>;
|
|
71
|
-
private readonly tools;
|
|
72
|
-
private readonly resources;
|
|
73
|
-
private readonly providers;
|
|
74
|
-
private _rpcUnsubscribe;
|
|
75
|
-
constructor(context: DevframeNodeContext);
|
|
76
|
-
registerTool(input: AgentToolInput): AgentHandle;
|
|
77
|
-
unregisterTool(id: string): boolean;
|
|
78
|
-
registerToolProvider(provider: AgentToolProvider): AgentToolProviderHandle;
|
|
79
|
-
registerResource(input: AgentResourceInput): AgentHandle;
|
|
80
|
-
unregisterResource(id: string): boolean;
|
|
81
|
-
list(): AgentManifest;
|
|
82
|
-
getTool(id: string): AgentTool | undefined;
|
|
83
|
-
getResource(id: string): AgentResource | undefined;
|
|
84
|
-
invoke(id: string, args: unknown): Promise<unknown>;
|
|
85
|
-
read(id: string): Promise<AgentResourceContent>;
|
|
86
|
-
/** @internal */
|
|
87
|
-
_dispose(): void;
|
|
88
|
-
private _validateToolId;
|
|
89
|
-
private _projectTool;
|
|
90
|
-
/** Query every registered provider, projecting inputs to serializable tools. */
|
|
91
|
-
private _collectProviderTools;
|
|
92
|
-
private _collectRpcTools;
|
|
93
|
-
private _findRpcDefinition;
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region src/node/host-diagnostics.d.ts
|
|
97
|
-
declare class DevframeDiagnosticsHost implements DevframeDiagnosticsHost$1 {
|
|
98
|
-
readonly context: DevframeNodeContext;
|
|
99
|
-
private _registry;
|
|
100
|
-
readonly logger: DevframeDiagnosticsLogger;
|
|
101
|
-
readonly defineDiagnostics: DevframeDiagnosticsHost$1['defineDiagnostics'];
|
|
102
|
-
constructor(context: DevframeNodeContext, initialDefinitions?: Array<Record<string, unknown>>);
|
|
103
|
-
register(diagnostics: Record<string, unknown>): void;
|
|
104
|
-
}
|
|
105
|
-
//#endregion
|
|
106
|
-
//#region src/node/host-h3.d.ts
|
|
107
|
-
interface CreateH3DevframeHostOptions {
|
|
108
|
-
/** The h3 app instance — registered once the CLI adapter lands. */
|
|
109
|
-
app?: unknown;
|
|
110
|
-
/**
|
|
111
|
-
* Host the standalone server listens on, e.g. `http://localhost:9999`.
|
|
112
|
-
* Consumed by `resolveOrigin` for dock entries that need an absolute URL.
|
|
113
|
-
*/
|
|
114
|
-
origin: string;
|
|
115
|
-
/**
|
|
116
|
-
* Register a static-file handler at `base` serving files from `distDir`.
|
|
117
|
-
* Wired into the h3 app once the CLI adapter lands (commit 5). For now
|
|
118
|
-
* the CLI isn't running, so the default is a no-op.
|
|
119
|
-
*/
|
|
120
|
-
mount?: (base: string, distDir: string) => void | Promise<void>;
|
|
121
|
-
/**
|
|
122
|
-
* Namespace for storage paths returned by `getStorageDir`. Workspace
|
|
123
|
-
* state (committable) lives under `${workspaceRoot}/.devframe/`, project
|
|
124
|
-
* state under `${workspaceRoot}/node_modules/.<appName>/devframe/`, and
|
|
125
|
-
* global state under `${homedir()}/.<appName>/devframe/`. Pick the
|
|
126
|
-
* devtool's id (or another stable, filesystem-safe identifier) so the
|
|
127
|
-
* standalone host doesn't collide with other tools' storage.
|
|
128
|
-
*/
|
|
129
|
-
appName: string;
|
|
130
|
-
/**
|
|
131
|
-
* Workspace root used as the parent of the per-project storage
|
|
132
|
-
* directory. Defaults to `process.cwd()`.
|
|
133
|
-
*/
|
|
134
|
-
workspaceRoot?: string;
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* h3-backed {@link DevframeHost} — used by the standalone CLI adapter.
|
|
138
|
-
*/
|
|
139
|
-
declare function createH3DevframeHost(options: CreateH3DevframeHostOptions): DevframeHost;
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/node/host-services.d.ts
|
|
142
|
-
/**
|
|
143
|
-
* Cross-plugin service registry (see `types/services.ts` for the contract).
|
|
144
|
-
* Values are held per context instance; `whenAvailable` subscriptions make
|
|
145
|
-
* the mechanism robust against setup ordering between provider and consumer.
|
|
146
|
-
*/
|
|
147
|
-
declare class DevframeServicesHostImpl implements DevframeServicesHost {
|
|
148
|
-
private services;
|
|
149
|
-
private listeners;
|
|
150
|
-
provide<ID extends DevframeServiceId>(id: ID, service: DevframeServiceOf<ID>): () => void;
|
|
151
|
-
get<ID extends DevframeServiceId>(id: ID): DevframeServiceOf<ID> | undefined;
|
|
152
|
-
has(id: DevframeServiceId): boolean;
|
|
153
|
-
whenAvailable<ID extends DevframeServiceId>(id: ID, callback: (service: DevframeServiceOf<ID>) => void): () => void;
|
|
154
|
-
keys(): string[];
|
|
155
|
-
}
|
|
156
|
-
//#endregion
|
|
157
|
-
//#region src/node/host-views.d.ts
|
|
158
|
-
declare class DevframeViewHost implements DevframeViewHost$1 {
|
|
159
|
-
readonly context: DevframeNodeContext;
|
|
160
|
-
/**
|
|
161
|
-
* @internal
|
|
162
|
-
*/
|
|
163
|
-
buildStaticDirs: {
|
|
164
|
-
baseUrl: string;
|
|
165
|
-
distDir: string;
|
|
166
|
-
}[];
|
|
167
|
-
constructor(context: DevframeNodeContext);
|
|
168
|
-
hostStatic(baseUrl: string, distDir: string): void;
|
|
169
|
-
}
|
|
170
|
-
//#endregion
|
|
171
|
-
//#region src/node/instance-registry.d.ts
|
|
172
|
-
/**
|
|
173
|
-
* One running devframe instance, as recorded in the instance registry.
|
|
174
|
-
* Records are self-describing JSON — additive fields are safe.
|
|
175
|
-
*
|
|
176
|
-
* @experimental The agent-native surface is experimental and may change
|
|
177
|
-
* without a major version bump until it stabilizes.
|
|
178
|
-
*/
|
|
179
|
-
interface DevframeInstanceRecord {
|
|
180
|
-
/** Process id of the dev server. */
|
|
181
|
-
pid: number;
|
|
182
|
-
/** Listening port. */
|
|
183
|
-
port: number;
|
|
184
|
-
/** Dialable HTTP origin, e.g. `http://127.0.0.1:9876`. */
|
|
185
|
-
origin: string;
|
|
186
|
-
/** Base path the devframe is mounted at (trailing slash). */
|
|
187
|
-
basePath: string;
|
|
188
|
-
/** Definition id. */
|
|
189
|
-
id: string;
|
|
190
|
-
/** Definition display name. */
|
|
191
|
-
name?: string;
|
|
192
|
-
/** Working directory the instance was started from. */
|
|
193
|
-
rootDir: string;
|
|
194
|
-
/**
|
|
195
|
-
* Absolute URL path of the MCP Streamable-HTTP endpoint on `origin`, or
|
|
196
|
-
* `null` when the instance runs without an MCP route.
|
|
197
|
-
*/
|
|
198
|
-
mcp: {
|
|
199
|
-
path: string;
|
|
200
|
-
} | null;
|
|
201
|
-
/** Epoch-ms timestamp of registration. */
|
|
202
|
-
startedAt: number;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Handle returned by {@link registerDevframeInstance}.
|
|
206
|
-
*
|
|
207
|
-
* @experimental
|
|
208
|
-
*/
|
|
209
|
-
interface DevframeInstanceRegistration {
|
|
210
|
-
/** The registry file backing this registration. */
|
|
211
|
-
readonly file: string;
|
|
212
|
-
/** Remove the record (idempotent). Call on server close. */
|
|
213
|
-
unregister: () => void;
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Record a running devframe instance in the global instance registry so
|
|
217
|
-
* discovery tooling (`devframe connect`, editor integrations) can find it
|
|
218
|
-
* without port guessing.
|
|
219
|
-
*
|
|
220
|
-
* `createDevServer` registers automatically; custom hosts that serve a
|
|
221
|
-
* devframe in-process (e.g. `@devframes/next`'s host inside a Next dev
|
|
222
|
-
* server) call this explicitly with the origin they are reachable at.
|
|
223
|
-
*
|
|
224
|
-
* The record is written atomically to `<dir>/<pid>-<port>.json` and removed
|
|
225
|
-
* by {@link DevframeInstanceRegistration.unregister}. Records surviving a
|
|
226
|
-
* crash are pruned by readers whose liveness probe fails. Registration never
|
|
227
|
-
* throws — a write failure degrades to a coded warning (`DF0045`), since a
|
|
228
|
-
* dev server must not die over discovery metadata.
|
|
229
|
-
*
|
|
230
|
-
* @experimental
|
|
231
|
-
*/
|
|
232
|
-
declare function registerDevframeInstance(record: DevframeInstanceRecord, options?: {
|
|
233
|
-
instancesDir?: string;
|
|
234
|
-
}): DevframeInstanceRegistration;
|
|
235
|
-
/**
|
|
236
|
-
* Read the registry and split records into live and dead by probing each
|
|
237
|
-
* one's `__connection.json`, deleting dead records (prune-on-read). Live
|
|
238
|
-
* records carry the dialable origin the probe confirmed (a `localhost`
|
|
239
|
-
* record may come back as `127.0.0.1` / `[::1]`).
|
|
240
|
-
*
|
|
241
|
-
* A liveness probe only proves *something* answers on the record's port, so
|
|
242
|
-
* records left behind by killed processes shadow the server currently bound
|
|
243
|
-
* there: per `(port, basePath)` only the newest record survives, older
|
|
244
|
-
* ghosts are pruned with the dead.
|
|
245
|
-
*
|
|
246
|
-
* @experimental
|
|
247
|
-
*/
|
|
248
|
-
declare function listLiveDevframeInstances(options?: {
|
|
249
|
-
instancesDir?: string;
|
|
250
|
-
timeoutMs?: number;
|
|
251
|
-
}): Promise<{
|
|
252
|
-
live: DevframeInstanceRecord[];
|
|
253
|
-
pruned: DevframeInstanceRecord[];
|
|
254
|
-
}>;
|
|
255
|
-
//#endregion
|
|
256
|
-
//#region src/node/rpc-shared-state.d.ts
|
|
257
|
-
declare function createRpcSharedStateServerHost(rpc: RpcFunctionsHost): RpcSharedStateHost;
|
|
258
|
-
//#endregion
|
|
259
|
-
//#region src/node/rpc-streaming.d.ts
|
|
260
|
-
/**
|
|
261
|
-
* Build the server-side streaming host. Mirrors the layout of
|
|
262
|
-
* `createRpcSharedStateServerHost` — registers a fixed set of internal
|
|
263
|
-
* RPC methods (`subscribe` / `unsubscribe` / `cancel`) once, then per-channel
|
|
264
|
-
* state lives in a `Map<channelName, ChannelState>`.
|
|
265
|
-
*/
|
|
266
|
-
declare function createRpcStreamingServerHost(rpc: RpcFunctionsHost): RpcStreamingHost;
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/node/scope.d.ts
|
|
269
|
-
/**
|
|
270
|
-
* Build a namespace-scoped view of a {@link DevframeNodeContext}. Every
|
|
271
|
-
* RPC id, shared-state key, and streaming channel passed through the
|
|
272
|
-
* returned `rpc` surface is auto-namespaced with `<namespace>:`.
|
|
273
|
-
*/
|
|
274
|
-
declare function createScopedNodeContext<NS extends string = string>(context: DevframeNodeContext, namespace: NS): DevframeScopedNodeContext<NS>;
|
|
275
|
-
//#endregion
|
|
276
|
-
//#region src/node/settings.d.ts
|
|
277
|
-
/**
|
|
278
|
-
* Build the node-side `settings` surface for a scope namespace. `project`
|
|
279
|
-
* persists under the host's `workspace` storage dir, `global` under its
|
|
280
|
-
* `global` dir. Each is a file-backed, client-synced key-value store.
|
|
281
|
-
*/
|
|
282
|
-
declare function createNodeSettings<T extends Record<string, any> = Record<string, any>>(context: DevframeNodeContext, namespace: string): DevframeSettings<T>;
|
|
283
|
-
//#endregion
|
|
284
28
|
//#region src/node/storage.d.ts
|
|
285
29
|
interface CreateStorageOptions<T extends object> {
|
|
286
30
|
filepath: string;
|
|
@@ -290,12 +34,4 @@ interface CreateStorageOptions<T extends object> {
|
|
|
290
34
|
}
|
|
291
35
|
declare function createStorage<T extends object>(options: CreateStorageOptions<T>): SharedState<T>;
|
|
292
36
|
//#endregion
|
|
293
|
-
|
|
294
|
-
declare function isObject(value: unknown): value is Record<string, any>;
|
|
295
|
-
/** Map a bind host to a host a client can actually connect to. */
|
|
296
|
-
declare function toDialableHost(host: string): string;
|
|
297
|
-
/** Format a bind host for use in a URL authority (dialable, IPv6-bracketed). */
|
|
298
|
-
declare function formatHostForUrl(host: string): string;
|
|
299
|
-
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
300
|
-
//#endregion
|
|
301
|
-
export { AgentArgsFallback, CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, type DevframeInstanceRecord, type DevframeInstanceRegistration, DevframeServicesHostImpl, DevframeViewHost, type RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, listLiveDevframeInstances, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
|
|
37
|
+
export { CreateHostContextOptions, CreateStorageOptions, type RpcFunctionsHost, createHostContext, createStorage };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
4
|
-
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-CXaDDUl0.mjs";
|
|
5
|
-
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeServicesHostImpl, DevframeViewHost, coerceAgentPositionalArgs, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, listLiveDevframeInstances, normalizeHttpServerUrl, registerDevframeInstance, startHttpAndWs, toDialableHost };
|
|
1
|
+
import { t as createStorage } from "../storage-BcmVEJRc.mjs";
|
|
2
|
+
import { t as createHostContext } from "../context-Du11TLcO.mjs";
|
|
3
|
+
export { createHostContext, createStorage };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../devframe-
|
|
1
|
+
import "../devframe-Bdd9YXTy.mjs";
|
|
2
|
+
import "../index-DSCq4M4q.mjs";
|
|
2
3
|
import { E as Thenable, S as RpcFunctionSetupResult, c as RpcDump, g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
|
|
3
|
-
import "../
|
|
4
|
-
import { t as SimpleSchema } from "../simple-schema-BDzLeJDk.mjs";
|
|
4
|
+
import { SimpleSchema } from "../utils/simple-schema.mjs";
|
|
5
5
|
//#region src/recipes/common-rpc-functions.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Editor commands that `launch-editor` (the library behind
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../index-
|
|
1
|
+
import { p as DevframeAuthHandler, x as DevframeNodeContext } from "../devframe-Bdd9YXTy.mjs";
|
|
2
|
+
import "../index-CZRd2K1C.mjs";
|
|
3
3
|
//#region src/recipes/interactive-auth.d.ts
|
|
4
4
|
interface CreateInteractiveAuthOptions {
|
|
5
5
|
/**
|
|
@@ -44,7 +44,7 @@ interface CreateInteractiveAuthOptions {
|
|
|
44
44
|
* auth.printBanner()
|
|
45
45
|
*
|
|
46
46
|
* // wire `auth.authorize` / `auth.onConnect` into your transport, or pass
|
|
47
|
-
* // the whole handler to `
|
|
47
|
+
* // the whole handler to `initDevframe` / `initHub` via their `auth` option.
|
|
48
48
|
* ```
|
|
49
49
|
*/
|
|
50
50
|
declare function createInteractiveAuth(context: DevframeNodeContext, options?: CreateInteractiveAuthOptions): DevframeAuthHandler;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
|
-
import { isAnonymousRpcMethod } from "../constants.mjs";
|
|
3
2
|
import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
|
|
4
|
-
import {
|
|
3
|
+
import { isAnonymousRpcMethod } from "../constants.mjs";
|
|
5
4
|
import { a as verifyAuthToken, n as exchangeTempAuthCode, r as getTempAuthCode, t as buildOtpAuthUrl } from "../state-BeUHDDjk.mjs";
|
|
5
|
+
import { t as getInternalContext } from "../context-C33rR7n0.mjs";
|
|
6
6
|
import { t as s } from "../simple-schema-DQPZrAaZ.mjs";
|
|
7
7
|
//#region src/recipes/interactive-auth.ts
|
|
8
8
|
function defaultBanner(info) {
|
|
@@ -26,7 +26,7 @@ function defaultBanner(info) {
|
|
|
26
26
|
* auth.printBanner()
|
|
27
27
|
*
|
|
28
28
|
* // wire `auth.authorize` / `auth.onConnect` into your transport, or pass
|
|
29
|
-
* // the whole handler to `
|
|
29
|
+
* // the whole handler to `initDevframe` / `initHub` via their `auth` option.
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
32
|
function createInteractiveAuth(context, options = {}) {
|
|
@@ -105,14 +105,14 @@ function createInteractiveAuth(context, options = {}) {
|
|
|
105
105
|
if (isAnonymousRpcMethod(methodName)) return true;
|
|
106
106
|
return !!session.meta.isTrusted;
|
|
107
107
|
}
|
|
108
|
-
function onConnect(
|
|
108
|
+
function onConnect(connection, session) {
|
|
109
109
|
let token;
|
|
110
110
|
let requestOrigin;
|
|
111
111
|
try {
|
|
112
|
-
token = new URL(
|
|
112
|
+
token = new URL(connection.request?.url ?? "", "http://localhost").searchParams.get("devframe_auth_token") ?? void 0;
|
|
113
113
|
} catch {}
|
|
114
114
|
try {
|
|
115
|
-
requestOrigin =
|
|
115
|
+
requestOrigin = connection.request?.headers?.get?.("origin") ?? void 0;
|
|
116
116
|
} catch {}
|
|
117
117
|
if (!token) return;
|
|
118
118
|
if (isStaticToken(token)) {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __exportAll = (all, no_symbols) => {
|
|
11
|
+
let target = {};
|
|
12
|
+
for (var name in all) __defProp(target, name, {
|
|
13
|
+
get: all[name],
|
|
14
|
+
enumerable: true
|
|
15
|
+
});
|
|
16
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
17
|
+
return target;
|
|
18
|
+
};
|
|
19
|
+
var __copyProps = (to, from, except, desc) => {
|
|
20
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
21
|
+
key = keys[i];
|
|
22
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
23
|
+
get: ((k) => from[k]).bind(null, key),
|
|
24
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return to;
|
|
28
|
+
};
|
|
29
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
34
|
+
//#endregion
|
|
35
|
+
export { __toESM as i, __exportAll as n, __require as r, __commonJSMin as t };
|
package/dist/rpc/dump.d.mts
CHANGED
|
@@ -1,2 +1,78 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as RpcDumpStore, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny } from "../types-CnJSgRVa.mjs";
|
|
2
|
+
//#region src/rpc/dump/collect.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Collects pre-computed dumps by executing functions with their defined input combinations.
|
|
5
|
+
* Static functions without dump config automatically get `{ inputs: [[]] }`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const store = await dumpFunctions([greet], context, { concurrency: 10 })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
declare function dumpFunctions<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T, context?: any, options?: RpcDumpCollectionOptions): Promise<RpcDumpStore<RpcDefinitionsToFunctions<T>>>;
|
|
13
|
+
/**
|
|
14
|
+
* Creates a client that serves pre-computed results from a dump store.
|
|
15
|
+
* Uses argument hashing to match calls to stored records.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* const client = createClientFromDump(store)
|
|
20
|
+
* await client.greet('Alice')
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
declare function createClientFromDump<T extends Record<string, any>>(store: RpcDumpStore<T>, options?: RpcDumpClientOptions): BirpcReturn<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Filters function definitions to only those with dump definitions.
|
|
26
|
+
* Note: Only checks the definition itself, not setup results.
|
|
27
|
+
*/
|
|
28
|
+
declare function getDefinitionsWithDumps<T extends readonly RpcFunctionDefinitionAny[]>(definitions: T): RpcFunctionDefinitionAny[];
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/rpc/dump/error.d.ts
|
|
31
|
+
/**
|
|
32
|
+
* Normalize a thrown value into a plain object suitable for storage in
|
|
33
|
+
* a dump record. Preserves `message`, `name`, `cause`, and any own
|
|
34
|
+
* enumerable properties of an `Error` so consumers reading the dump can
|
|
35
|
+
* reconstruct a richer Error than just `{ message, name }`.
|
|
36
|
+
*
|
|
37
|
+
* Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
|
|
38
|
+
*/
|
|
39
|
+
declare function serializeDumpError(error: unknown): RpcDumpRecordError;
|
|
40
|
+
/**
|
|
41
|
+
* Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
|
|
42
|
+
* the plain object stored in a dump record. Preserves `cause`, restores
|
|
43
|
+
* the original `name`, and re-attaches any custom own properties.
|
|
44
|
+
*/
|
|
45
|
+
declare function reviveDumpError(stored: RpcDumpRecordError): Error;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/rpc/dump/static.d.ts
|
|
48
|
+
type StaticRpcDumpSerialization = 'json' | 'structured-clone';
|
|
49
|
+
interface StaticRpcDumpManifestStaticEntry {
|
|
50
|
+
type: 'static';
|
|
51
|
+
path: string;
|
|
52
|
+
/** Encoder used when this entry's file was written. Default: `'json'`. */
|
|
53
|
+
serialization?: StaticRpcDumpSerialization;
|
|
54
|
+
}
|
|
55
|
+
interface StaticRpcDumpManifestQueryEntry {
|
|
56
|
+
type: 'query';
|
|
57
|
+
records: Record<string, string>;
|
|
58
|
+
fallback?: string;
|
|
59
|
+
/** Encoder used when each record/fallback file was written. Default: `'json'`. */
|
|
60
|
+
serialization?: StaticRpcDumpSerialization;
|
|
61
|
+
}
|
|
62
|
+
type StaticRpcDumpManifestValue = StaticRpcDumpManifestStaticEntry | StaticRpcDumpManifestQueryEntry | any;
|
|
63
|
+
type StaticRpcDumpManifest = Record<string, StaticRpcDumpManifestValue>;
|
|
64
|
+
interface StaticRpcDumpFile {
|
|
65
|
+
/** Whether this file was written via `JSON.stringify` or `structured-clone-es.stringify`. */
|
|
66
|
+
serialization: StaticRpcDumpSerialization;
|
|
67
|
+
/** Function name the file belongs to — used to scope `DF0019` errors during write. */
|
|
68
|
+
fnName: string;
|
|
69
|
+
/** Payload to encode. */
|
|
70
|
+
data: unknown;
|
|
71
|
+
}
|
|
72
|
+
interface StaticRpcDumpCollection {
|
|
73
|
+
manifest: StaticRpcDumpManifest;
|
|
74
|
+
files: Record<string, StaticRpcDumpFile>;
|
|
75
|
+
}
|
|
76
|
+
declare function collectStaticRpcDump(definitions: Iterable<RpcFunctionDefinitionAny>, context: any): Promise<StaticRpcDumpCollection>;
|
|
77
|
+
//#endregion
|
|
2
78
|
export { StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError };
|
package/dist/rpc/dump.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as reviveDumpError, i as getDefinitionsWithDumps, n as createClientFromDump, o as serializeDumpError, r as dumpFunctions, t as collectStaticRpcDump } from "../static-CvjkO8QE.mjs";
|
|
2
2
|
export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError };
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
+
import { a as STRUCTURED_CLONE_PREFIX, c as getRpcResolvedSetupResult, d as RpcFunctionsCollectorBase, f as RpcCacheManager, i as validateRpcReturn, l as createDefineWrapperWithContext, n as validateDefinitions, o as strictJsonStringify, p as RpcCacheOptions, r as validateRpcArgs, s as getRpcHandler, t as validateDefinition, u as defineRpcFunction } from "../index-DSCq4M4q.mjs";
|
|
1
2
|
import { C as RpcFunctionType, E as Thenable, S as RpcFunctionSetupResult, T as RpcReturnSchema, _ as RpcFunctionDefinition, a as RpcDefinitionsFilter, b as RpcFunctionDefinitionBase, c as RpcDump, d as RpcDumpDefinition, f as RpcDumpGetter, g as RpcFunctionAgentOptions, h as RpcDumpStore, i as RpcArgsSchema, l as RpcDumpClientOptions, m as RpcDumpRecordError, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpRecord, r as EntriesToObject, s as RpcDefinitionsToFunctionsWithNamespace, t as BirpcFn, u as RpcDumpCollectionOptions, v as RpcFunctionDefinitionAny, w as RpcFunctionsCollector, x as RpcFunctionDefinitionToFunction, y as RpcFunctionDefinitionAnyWithContext } from "../types-CnJSgRVa.mjs";
|
|
2
|
-
|
|
3
|
-
export { type BirpcFn, type BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDefinitionsToFunctionsWithNamespace, 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, validateRpcArgs, validateRpcReturn };
|
|
3
|
+
export { type BirpcFn, type BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDefinitionsToFunctionsWithNamespace, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpRecordError, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createDefineWrapperWithContext, defineRpcFunction, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions, validateRpcArgs, validateRpcReturn };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as validateRpcArgs, i as getRpcResolvedSetupResult, n as validateDefinitions, o as validateRpcReturn, r as getRpcHandler, s as hash, t as validateDefinition } from "../validation-BiuDXTKW.mjs";
|
|
2
2
|
import { t as diagnostics } from "../diagnostics-hwjXp_UV.mjs";
|
|
3
3
|
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-BLWPsH6y.mjs";
|
|
4
|
-
import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-
|
|
4
|
+
import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-BHY8M5NQ.mjs";
|
|
5
5
|
//#region src/rpc/cache.ts
|
|
6
6
|
/**
|
|
7
7
|
* @experimental API is expected to change.
|
|
@@ -116,18 +116,4 @@ function assertAgentJsonSerializable(fn) {
|
|
|
116
116
|
if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019({ name: fn.name });
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
|
-
|
|
120
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
121
|
-
const collectStaticRpcDump = collectStaticRpcDump$1;
|
|
122
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
123
|
-
const createClientFromDump = createClientFromDump$1;
|
|
124
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
125
|
-
const dumpFunctions = dumpFunctions$1;
|
|
126
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
127
|
-
const getDefinitionsWithDumps = getDefinitionsWithDumps$1;
|
|
128
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
129
|
-
const reviveDumpError = reviveDumpError$1;
|
|
130
|
-
/** @deprecated Import from `devframe/rpc/dump` instead. */
|
|
131
|
-
const serializeDumpError = serializeDumpError$1;
|
|
132
|
-
//#endregion
|
|
133
|
-
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, validateDefinition, validateDefinitions, validateRpcArgs, validateRpcReturn };
|
|
119
|
+
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createDefineWrapperWithContext, defineRpcFunction, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions, validateRpcArgs, validateRpcReturn };
|