devframe 0.3.0 → 0.4.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.
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +3 -3
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- 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 +1 -1
- package/dist/adapters/mcp.mjs +3 -3
- package/dist/client/index.mjs +6 -6
- package/dist/{context-CwjX6sCG.d.mts → context-Ca70YtrW.d.mts} +1 -1
- package/dist/{dev-BbmanqL7.mjs → dev-C2wjXjGB.mjs} +1 -1
- package/dist/{devframe-sc4cb5xr.d.mts → devframe-xC8Q-xyt.d.mts} +10 -8
- package/dist/{dump-zMleojnD.mjs → dump-B1wd4u68.mjs} +6 -6
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +2 -2
- package/dist/{host-h3-TTunNr_n.mjs → host-h3-Div5Vp8R.mjs} +13 -13
- package/dist/index.d.mts +1 -1
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/index.d.mts +2 -2
- package/dist/node/index.mjs +2 -2
- package/dist/node/internal.d.mts +2 -2
- package/dist/node/internal.mjs +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.mjs +6 -6
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{serialization-BlqLh4_J.mjs → serialization-BD_qXGjd.mjs} +1 -1
- package/dist/{server-ouL4gZbu.d.mts → server-FNcskEBD.d.mts} +1 -1
- package/dist/{storage-K-OxR1xf.mjs → storage-CZVTPKsw.mjs} +1 -1
- package/dist/types/index.d.mts +1 -1
- package/package.json +3 -3
package/dist/adapters/build.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as collectStaticRpcDump } from "../dump-
|
|
1
|
+
import { t as collectStaticRpcDump } from "../dump-B1wd4u68.mjs";
|
|
2
2
|
import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
|
|
3
3
|
import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
4
|
-
import { n as strictJsonStringify } from "../serialization-
|
|
4
|
+
import { n as strictJsonStringify } from "../serialization-BD_qXGjd.mjs";
|
|
5
5
|
import { n as structuredCloneStringify } from "../structured-clone-jegjz0hM.mjs";
|
|
6
|
-
import { n as createHostContext, t as createH3DevToolsHost } from "../host-h3-
|
|
6
|
+
import { n as createHostContext, t as createH3DevToolsHost } from "../host-h3-Div5Vp8R.mjs";
|
|
7
7
|
import { n as resolveBasePath } from "../_shared-CUFqO4kJ.mjs";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import process from "node:process";
|
package/dist/adapters/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as CliFlagsSchema, J as parseCliFlags, K as InferCliFlags, q as defineCliFlags, r as DevframeDefinition } from "../devframe-
|
|
1
|
+
import { G as CliFlagsSchema, J as parseCliFlags, K as InferCliFlags, q as defineCliFlags, r as DevframeDefinition } from "../devframe-xC8Q-xyt.mjs";
|
|
2
2
|
import { H3 } from "h3";
|
|
3
3
|
import { CAC } from "cac";
|
|
4
4
|
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as colors } from "../diagnostics-reporter-CBBZwoMv.mjs";
|
|
2
2
|
import { createBuild } from "./build.mjs";
|
|
3
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-C2wjXjGB.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { n as StartedServer } from "../server-
|
|
1
|
+
import { r as DevframeDefinition } from "../devframe-xC8Q-xyt.mjs";
|
|
2
|
+
import { n as StartedServer } from "../server-FNcskEBD.mjs";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/dev.d.ts
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-C2wjXjGB.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
package/dist/adapters/mcp.d.mts
CHANGED
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as diagnostics } from "../shared-state-CasqoUba.mjs";
|
|
2
|
-
import { n as createHostContext } from "../host-h3-
|
|
2
|
+
import { n as createHostContext } from "../host-h3-Div5Vp8R.mjs";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { join } from "pathe";
|
|
@@ -185,7 +185,7 @@ function buildMcpServerFromContext(ctx, options) {
|
|
|
185
185
|
*/
|
|
186
186
|
async function createMcpServer(definition, options = {}) {
|
|
187
187
|
const transport = options.transport ?? "stdio";
|
|
188
|
-
if (transport !== "stdio") throw diagnostics.DF0017
|
|
188
|
+
if (transport !== "stdio") throw diagnostics.DF0017({
|
|
189
189
|
transport,
|
|
190
190
|
reason: "Only stdio transport is supported in this release."
|
|
191
191
|
});
|
|
@@ -210,7 +210,7 @@ async function createMcpServer(definition, options = {}) {
|
|
|
210
210
|
stop = await startStdioTransport(server);
|
|
211
211
|
} catch (error) {
|
|
212
212
|
const reason = error instanceof Error ? error.message : String(error);
|
|
213
|
-
throw diagnostics.DF0017
|
|
213
|
+
throw diagnostics.DF0017({
|
|
214
214
|
transport,
|
|
215
215
|
reason,
|
|
216
216
|
cause: error
|
package/dist/client/index.mjs
CHANGED
|
@@ -83,7 +83,7 @@ async function getRpcResolvedSetupResult(definition, context) {
|
|
|
83
83
|
async function getRpcHandler(definition, context) {
|
|
84
84
|
if (definition.handler) return definition.handler;
|
|
85
85
|
const result = await getRpcResolvedSetupResult(definition, context);
|
|
86
|
-
if (!result.handler) throw diagnostics.DF0024
|
|
86
|
+
if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
|
|
87
87
|
return result.handler;
|
|
88
88
|
}
|
|
89
89
|
//#endregion
|
|
@@ -155,13 +155,13 @@ var RpcFunctionsCollectorBase = class {
|
|
|
155
155
|
});
|
|
156
156
|
}
|
|
157
157
|
register(fn, force = false) {
|
|
158
|
-
if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021
|
|
158
|
+
if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021({ name: fn.name });
|
|
159
159
|
assertAgentJsonSerializable(fn);
|
|
160
160
|
this.definitions.set(fn.name, fn);
|
|
161
161
|
this._onChanged.forEach((cb) => cb(fn.name));
|
|
162
162
|
}
|
|
163
163
|
update(fn, force = false) {
|
|
164
|
-
if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022
|
|
164
|
+
if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022({ name: fn.name });
|
|
165
165
|
assertAgentJsonSerializable(fn);
|
|
166
166
|
this.definitions.set(fn.name, fn);
|
|
167
167
|
this._onChanged.forEach((cb) => cb(fn.name));
|
|
@@ -178,7 +178,7 @@ var RpcFunctionsCollectorBase = class {
|
|
|
178
178
|
}
|
|
179
179
|
getSchema(name) {
|
|
180
180
|
const definition = this.definitions.get(name);
|
|
181
|
-
if (!definition) throw diagnostics.DF0023
|
|
181
|
+
if (!definition) throw diagnostics.DF0023({ name: String(name) });
|
|
182
182
|
return {
|
|
183
183
|
args: definition.args,
|
|
184
184
|
returns: definition.returns
|
|
@@ -195,7 +195,7 @@ var RpcFunctionsCollectorBase = class {
|
|
|
195
195
|
}
|
|
196
196
|
};
|
|
197
197
|
function assertAgentJsonSerializable(fn) {
|
|
198
|
-
if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019
|
|
198
|
+
if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019({ name: fn.name });
|
|
199
199
|
}
|
|
200
200
|
//#endregion
|
|
201
201
|
//#region src/rpc/serialization.ts
|
|
@@ -243,7 +243,7 @@ function strictJsonStringify(value, fnName = "") {
|
|
|
243
243
|
}
|
|
244
244
|
function nonJsonAt(fnName, type, parent, key) {
|
|
245
245
|
const path = formatPath(parent, key);
|
|
246
|
-
return diagnostics.DF0020
|
|
246
|
+
return diagnostics.DF0020({
|
|
247
247
|
name: fnName || "<anonymous>",
|
|
248
248
|
type,
|
|
249
249
|
path
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEVTOOLS_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
|
-
import { n as createHostContext, t as createH3DevToolsHost } from "./host-h3-
|
|
2
|
+
import { n as createHostContext, t as createH3DevToolsHost } from "./host-h3-Div5Vp8R.mjs";
|
|
3
3
|
import { t as startHttpAndWs } from "./server-BO8IDVsJ.mjs";
|
|
4
4
|
import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-CUFqO4kJ.mjs";
|
|
5
5
|
import { t as open } from "./open-DiQn6zCH.mjs";
|
|
@@ -295,9 +295,10 @@ interface DevToolsAgentHost {
|
|
|
295
295
|
type DevToolsDiagnosticsDefinition = ReturnType<typeof defineDiagnostics<any, any>>;
|
|
296
296
|
/**
|
|
297
297
|
* The shared diagnostics lookup exposed by the host. A `Proxy` that resolves
|
|
298
|
-
* any registered code name to its `nostics` handle (
|
|
299
|
-
*
|
|
300
|
-
* definitions registered by different
|
|
298
|
+
* any registered code name to its `nostics` handle (a callable that builds
|
|
299
|
+
* a diagnostic and routes it through registered reporters). Typed loosely
|
|
300
|
+
* because it spans heterogeneous definitions registered by different
|
|
301
|
+
* integrations.
|
|
301
302
|
*/
|
|
302
303
|
type DevToolsDiagnosticsLogger = Record<string, any>;
|
|
303
304
|
/**
|
|
@@ -327,18 +328,19 @@ interface DevToolsDefineDiagnosticsOptions<Codes extends Record<string, Diagnost
|
|
|
327
328
|
* ctx.diagnostics.register(myDiagnostics)
|
|
328
329
|
*
|
|
329
330
|
* // Through the shared lookup (loose typing):
|
|
330
|
-
* ctx.diagnostics.logger.MYP0001
|
|
331
|
+
* throw ctx.diagnostics.logger.MYP0001()
|
|
331
332
|
*
|
|
332
333
|
* // Or directly on the typed handle returned from `defineDiagnostics`:
|
|
333
|
-
* myDiagnostics.MYP0001
|
|
334
|
+
* throw myDiagnostics.MYP0001()
|
|
334
335
|
* ```
|
|
335
336
|
*/
|
|
336
337
|
interface DevToolsDiagnosticsHost {
|
|
337
338
|
/**
|
|
338
339
|
* Proxy-backed lookup of every registered diagnostic handle by code name.
|
|
339
|
-
* Resolves to a `nostics` `DiagnosticHandle`
|
|
340
|
-
*
|
|
341
|
-
*
|
|
340
|
+
* Resolves to a `nostics` `DiagnosticHandle` — a callable that builds a
|
|
341
|
+
* diagnostic and routes it through registered reporters; prefix with
|
|
342
|
+
* `throw` to raise. Loosely typed — for autocompletion, keep a reference
|
|
343
|
+
* to the typed result of `defineDiagnostics()` instead.
|
|
342
344
|
*/
|
|
343
345
|
readonly logger: DevToolsDiagnosticsLogger;
|
|
344
346
|
/**
|
|
@@ -262,11 +262,11 @@ function validateConcurrency(concurrency) {
|
|
|
262
262
|
function validateDefinitions(definitions) {
|
|
263
263
|
for (const definition of definitions) {
|
|
264
264
|
const type = definition.type || "query";
|
|
265
|
-
if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027
|
|
265
|
+
if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027({
|
|
266
266
|
name: definition.name,
|
|
267
267
|
type
|
|
268
268
|
});
|
|
269
|
-
if (definition.snapshot && type !== "query") throw diagnostics.DF0028
|
|
269
|
+
if (definition.snapshot && type !== "query") throw diagnostics.DF0028({
|
|
270
270
|
name: definition.name,
|
|
271
271
|
type
|
|
272
272
|
});
|
|
@@ -364,7 +364,7 @@ async function dumpFunctions(definitions, context, options = {}) {
|
|
|
364
364
|
if (definition.type === "event" || definition.type === "action") return;
|
|
365
365
|
const setupResult = definition.setup ? await Promise.resolve(definition.setup(context)) : {};
|
|
366
366
|
const handler = setupResult.handler || definition.handler;
|
|
367
|
-
if (!handler) throw diagnostics.DF0024
|
|
367
|
+
if (!handler) throw diagnostics.DF0024({ name: definition.name });
|
|
368
368
|
let dump = setupResult.dump ?? definition.dump;
|
|
369
369
|
if (!dump && definition.type === "static") dump = { inputs: [[]] };
|
|
370
370
|
if (!dump && definition.snapshot) dump = async (_ctx, h) => {
|
|
@@ -449,7 +449,7 @@ function createClientFromDump(store, options = {}) {
|
|
|
449
449
|
const { onMiss } = options;
|
|
450
450
|
return new Proxy({}, {
|
|
451
451
|
get(_, functionName) {
|
|
452
|
-
if (!(functionName in store.definitions)) throw diagnostics.DF0025
|
|
452
|
+
if (!(functionName in store.definitions)) throw diagnostics.DF0025({ name: functionName });
|
|
453
453
|
return async (...args) => {
|
|
454
454
|
const recordKey = getDumpRecordKey(functionName, args);
|
|
455
455
|
const recordOrGetter = store.records[recordKey];
|
|
@@ -467,7 +467,7 @@ function createClientFromDump(store, options = {}) {
|
|
|
467
467
|
if (fallbackRecord && typeof fallbackRecord.output === "function") return await fallbackRecord.output();
|
|
468
468
|
if (fallbackRecord) return fallbackRecord.output;
|
|
469
469
|
}
|
|
470
|
-
throw diagnostics.DF0026
|
|
470
|
+
throw diagnostics.DF0026({
|
|
471
471
|
name: functionName,
|
|
472
472
|
args: JSON.stringify(args)
|
|
473
473
|
});
|
|
@@ -510,7 +510,7 @@ async function getRpcResolvedSetupResult(definition, context) {
|
|
|
510
510
|
async function getRpcHandler(definition, context) {
|
|
511
511
|
if (definition.handler) return definition.handler;
|
|
512
512
|
const result = await getRpcResolvedSetupResult(definition, context);
|
|
513
|
-
if (!result.handler) throw diagnostics.DF0024
|
|
513
|
+
if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
|
|
514
514
|
return result.handler;
|
|
515
515
|
}
|
|
516
516
|
//#endregion
|
package/dist/helpers/vite.d.mts
CHANGED
package/dist/helpers/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { DEVTOOLS_CONNECTION_META_FILENAME } from "../constants.mjs";
|
|
|
2
2
|
import { i as diagnostics } from "../shared-state-CasqoUba.mjs";
|
|
3
3
|
import { n as resolveBasePath } from "../_shared-CUFqO4kJ.mjs";
|
|
4
4
|
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
5
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-C2wjXjGB.mjs";
|
|
6
6
|
import { resolve } from "pathe";
|
|
7
7
|
//#region src/helpers/vite.ts
|
|
8
8
|
/**
|
|
@@ -54,7 +54,7 @@ function viteDevBridge(d, options = {}) {
|
|
|
54
54
|
openBrowser: false
|
|
55
55
|
});
|
|
56
56
|
} catch (e) {
|
|
57
|
-
diagnostics.DF0033
|
|
57
|
+
diagnostics.DF0033({
|
|
58
58
|
id: d.id,
|
|
59
59
|
reason: String(e),
|
|
60
60
|
cause: e
|
|
@@ -51,7 +51,7 @@ var DevToolsAgentHost = class {
|
|
|
51
51
|
return existed;
|
|
52
52
|
}
|
|
53
53
|
registerResource(input) {
|
|
54
|
-
if (this.resources.has(input.id)) throw diagnostics$1.DF0016
|
|
54
|
+
if (this.resources.has(input.id)) throw diagnostics$1.DF0016({ id: input.id });
|
|
55
55
|
const resource = {
|
|
56
56
|
id: input.id,
|
|
57
57
|
name: input.name,
|
|
@@ -113,11 +113,11 @@ var DevToolsAgentHost = class {
|
|
|
113
113
|
this._rpcUnsubscribe = void 0;
|
|
114
114
|
}
|
|
115
115
|
_validateToolId(id) {
|
|
116
|
-
if (this.tools.has(id)) throw diagnostics$1.DF0015
|
|
117
|
-
if (this.context.rpc.definitions.get(id)?.agent) throw diagnostics$1.DF0015
|
|
116
|
+
if (this.tools.has(id)) throw diagnostics$1.DF0015({ id });
|
|
117
|
+
if (this.context.rpc.definitions.get(id)?.agent) throw diagnostics$1.DF0015({ id });
|
|
118
118
|
}
|
|
119
119
|
_projectTool(input) {
|
|
120
|
-
if (!input.description || typeof input.description !== "string") throw diagnostics$1.DF0014
|
|
120
|
+
if (!input.description || typeof input.description !== "string") throw diagnostics$1.DF0014({ name: input.id });
|
|
121
121
|
return {
|
|
122
122
|
id: input.id,
|
|
123
123
|
kind: "tool",
|
|
@@ -135,7 +135,7 @@ var DevToolsAgentHost = class {
|
|
|
135
135
|
for (const [name, def] of this.context.rpc.definitions) {
|
|
136
136
|
const agent = def.agent;
|
|
137
137
|
if (!agent) continue;
|
|
138
|
-
if (!agent.description || typeof agent.description !== "string") throw diagnostics$1.DF0014
|
|
138
|
+
if (!agent.description || typeof agent.description !== "string") throw diagnostics$1.DF0014({ name });
|
|
139
139
|
const type = def.type ?? "query";
|
|
140
140
|
const safety = agent.safety ?? inferSafety(type);
|
|
141
141
|
out.push({
|
|
@@ -503,7 +503,7 @@ function createRpcSharedStateServerHost(rpc) {
|
|
|
503
503
|
const host = {
|
|
504
504
|
get: async (key, options) => {
|
|
505
505
|
if (sharedState.has(key)) return sharedState.get(key);
|
|
506
|
-
if (options?.initialValue === void 0 && options?.sharedState === void 0) throw diagnostics$1.DF0013
|
|
506
|
+
if (options?.initialValue === void 0 && options?.sharedState === void 0) throw diagnostics$1.DF0013({ key });
|
|
507
507
|
debug$1("new-state", key);
|
|
508
508
|
const state = options.sharedState ?? createSharedState({
|
|
509
509
|
initialValue: options.initialValue,
|
|
@@ -868,7 +868,7 @@ function createRpcStreamingServerHost(rpc) {
|
|
|
868
868
|
handler(channelName, id, opts) {
|
|
869
869
|
const state = channels.get(channelName);
|
|
870
870
|
if (!state) {
|
|
871
|
-
diagnostics$1.DF0030
|
|
871
|
+
diagnostics$1.DF0030({
|
|
872
872
|
channel: channelName,
|
|
873
873
|
id
|
|
874
874
|
}, { method: "error" });
|
|
@@ -876,7 +876,7 @@ function createRpcStreamingServerHost(rpc) {
|
|
|
876
876
|
}
|
|
877
877
|
const record = state.streams.get(id);
|
|
878
878
|
if (!record) {
|
|
879
|
-
diagnostics$1.DF0030
|
|
879
|
+
diagnostics$1.DF0030({
|
|
880
880
|
channel: channelName,
|
|
881
881
|
id
|
|
882
882
|
}, { method: "error" });
|
|
@@ -949,7 +949,7 @@ function createRpcStreamingServerHost(rpc) {
|
|
|
949
949
|
handler(channelName, id, seq, chunk) {
|
|
950
950
|
const record = channels.get(channelName)?.inbound.get(id);
|
|
951
951
|
if (!record) {
|
|
952
|
-
diagnostics$1.DF0030
|
|
952
|
+
diagnostics$1.DF0030({
|
|
953
953
|
channel: channelName,
|
|
954
954
|
id
|
|
955
955
|
}, { method: "error" });
|
|
@@ -979,7 +979,7 @@ function createRpcStreamingServerHost(rpc) {
|
|
|
979
979
|
}
|
|
980
980
|
});
|
|
981
981
|
function createChannel(name, opts = {}) {
|
|
982
|
-
if (channels.has(name)) throw diagnostics$1.DF0032
|
|
982
|
+
if (channels.has(name)) throw diagnostics$1.DF0032({ channel: name });
|
|
983
983
|
const replayWindow = opts.replayWindow ?? 0;
|
|
984
984
|
const state = {
|
|
985
985
|
name,
|
|
@@ -1142,7 +1142,7 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
|
|
|
1142
1142
|
this.streaming._onSessionDisconnected(meta);
|
|
1143
1143
|
}
|
|
1144
1144
|
async invokeLocal(method, ...args) {
|
|
1145
|
-
if (!this.definitions.has(method)) throw diagnostics$1.DF0006
|
|
1145
|
+
if (!this.definitions.has(method)) throw diagnostics$1.DF0006({ name: String(method) });
|
|
1146
1146
|
const handler = await this.getHandler(method);
|
|
1147
1147
|
return await Promise.resolve(handler(...args));
|
|
1148
1148
|
}
|
|
@@ -1159,7 +1159,7 @@ var RpcFunctionsHost = class extends RpcFunctionsCollectorBase {
|
|
|
1159
1159
|
}));
|
|
1160
1160
|
}
|
|
1161
1161
|
getCurrentRpcSession() {
|
|
1162
|
-
if (!this._asyncStorage) throw diagnostics$1.DF0007
|
|
1162
|
+
if (!this._asyncStorage) throw diagnostics$1.DF0007();
|
|
1163
1163
|
return this._asyncStorage.getStore();
|
|
1164
1164
|
}
|
|
1165
1165
|
};
|
|
@@ -1175,7 +1175,7 @@ var DevToolsViewHost = class {
|
|
|
1175
1175
|
this.context = context;
|
|
1176
1176
|
}
|
|
1177
1177
|
hostStatic(baseUrl, distDir) {
|
|
1178
|
-
if (!existsSync(distDir)) throw diagnostics$1.DF0008
|
|
1178
|
+
if (!existsSync(distDir)) throw diagnostics$1.DF0008({ distDir });
|
|
1179
1179
|
this.buildStaticDirs.push({
|
|
1180
1180
|
baseUrl,
|
|
1181
1181
|
distDir
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DevToolsDiagnosticsDefinition, B as DevToolsAgentHost, C as PartialWithoutId, D as DevToolsRpcSharedStates, 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, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventUnsubscribe, V as DevToolsAgentHostEvents, W as EventsMap, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsHost, k as DevToolsDefineDiagnosticsOptions, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as AgentToolInput } from "./devframe-
|
|
1
|
+
import { A as DevToolsDiagnosticsDefinition, B as DevToolsAgentHost, C as PartialWithoutId, D as DevToolsRpcSharedStates, 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, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventUnsubscribe, V as DevToolsAgentHostEvents, W as EventsMap, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsHost, k as DevToolsDefineDiagnosticsOptions, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as AgentToolInput } from "./devframe-xC8Q-xyt.mjs";
|
|
2
2
|
import { S as RpcFunctionType, g as RpcFunctionDefinition, h as RpcFunctionAgentOptions, i as RpcArgsSchema, w as RpcReturnSchema } from "./types-BXL7EIDM.mjs";
|
|
3
3
|
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-DOwLJL23.mjs";
|
|
4
4
|
|
package/dist/node/auth.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as SharedState, d as DevToolsNodeContext, f as DevToolsNodeRpcSession } from "../devframe-
|
|
2
|
-
import { n as InternalAnonymousAuthStorage } from "../context-
|
|
1
|
+
import { b as SharedState, d as DevToolsNodeContext, f as DevToolsNodeRpcSession } from "../devframe-xC8Q-xyt.mjs";
|
|
2
|
+
import { n as InternalAnonymousAuthStorage } from "../context-Ca70YtrW.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/node/auth/revoke.d.ts
|
|
5
5
|
/**
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
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-xC8Q-xyt.mjs";
|
|
2
2
|
import { _ as RpcFunctionDefinitionAny } from "../types-BXL7EIDM.mjs";
|
|
3
3
|
import { S as RpcFunctionsCollectorBase } from "../index-CTK6fuXs.mjs";
|
|
4
4
|
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DOwLJL23.mjs";
|
|
5
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-FNcskEBD.mjs";
|
|
6
6
|
import { BirpcGroup } from "birpc";
|
|
7
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
8
|
|
package/dist/node/index.mjs
CHANGED
|
@@ -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-
|
|
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-Div5Vp8R.mjs";
|
|
2
2
|
import { t as startHttpAndWs } from "../server-BO8IDVsJ.mjs";
|
|
3
|
-
import { t as createStorage } from "../storage-
|
|
3
|
+
import { t as createStorage } from "../storage-CZVTPKsw.mjs";
|
|
4
4
|
import { isIP } from "node:net";
|
|
5
5
|
//#region src/node/utils.ts
|
|
6
6
|
function isObject(value) {
|
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-xC8Q-xyt.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-Ca70YtrW.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_shared.d.ts
|
|
5
5
|
/**
|
package/dist/node/internal.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createStorage } from "../storage-
|
|
1
|
+
import { t as createStorage } from "../storage-CZVTPKsw.mjs";
|
|
2
2
|
import { n as revokeActiveConnectionsForToken, r as revokeAuthToken, t as humanId } from "../human-id-Dq-qgtES.mjs";
|
|
3
3
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-CUFqO4kJ.mjs";
|
|
4
4
|
import { join } from "pathe";
|
package/dist/rpc/dump.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as dumpFunctions, c as serializeDumpError, i as createClientFromDump, o as getDefinitionsWithDumps, s as reviveDumpError, t as collectStaticRpcDump } from "../dump-
|
|
1
|
+
import { a as dumpFunctions, c as serializeDumpError, i as createClientFromDump, o as getDefinitionsWithDumps, s as reviveDumpError, t as collectStaticRpcDump } from "../dump-B1wd4u68.mjs";
|
|
2
2
|
export { collectStaticRpcDump, createClientFromDump, dumpFunctions, getDefinitionsWithDumps, reviveDumpError, serializeDumpError };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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-
|
|
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-B1wd4u68.mjs";
|
|
2
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-
|
|
4
|
+
import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-BD_qXGjd.mjs";
|
|
5
5
|
//#region src/rpc/cache.ts
|
|
6
6
|
/**
|
|
7
7
|
* @experimental API is expected to change.
|
|
@@ -70,13 +70,13 @@ var RpcFunctionsCollectorBase = class {
|
|
|
70
70
|
});
|
|
71
71
|
}
|
|
72
72
|
register(fn, force = false) {
|
|
73
|
-
if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021
|
|
73
|
+
if (this.definitions.has(fn.name) && !force) throw diagnostics.DF0021({ name: fn.name });
|
|
74
74
|
assertAgentJsonSerializable(fn);
|
|
75
75
|
this.definitions.set(fn.name, fn);
|
|
76
76
|
this._onChanged.forEach((cb) => cb(fn.name));
|
|
77
77
|
}
|
|
78
78
|
update(fn, force = false) {
|
|
79
|
-
if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022
|
|
79
|
+
if (!this.definitions.has(fn.name) && !force) throw diagnostics.DF0022({ name: fn.name });
|
|
80
80
|
assertAgentJsonSerializable(fn);
|
|
81
81
|
this.definitions.set(fn.name, fn);
|
|
82
82
|
this._onChanged.forEach((cb) => cb(fn.name));
|
|
@@ -93,7 +93,7 @@ var RpcFunctionsCollectorBase = class {
|
|
|
93
93
|
}
|
|
94
94
|
getSchema(name) {
|
|
95
95
|
const definition = this.definitions.get(name);
|
|
96
|
-
if (!definition) throw diagnostics.DF0023
|
|
96
|
+
if (!definition) throw diagnostics.DF0023({ name: String(name) });
|
|
97
97
|
return {
|
|
98
98
|
args: definition.args,
|
|
99
99
|
returns: definition.returns
|
|
@@ -110,7 +110,7 @@ var RpcFunctionsCollectorBase = class {
|
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
function assertAgentJsonSerializable(fn) {
|
|
113
|
-
if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019
|
|
113
|
+
if (fn.agent && fn.jsonSerializable !== true) throw diagnostics.DF0019({ name: fn.name });
|
|
114
114
|
}
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/rpc/index.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as strictJsonStringify } from "../../serialization-
|
|
1
|
+
import { n as strictJsonStringify } from "../../serialization-BD_qXGjd.mjs";
|
|
2
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() {}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as strictJsonStringify } from "../../serialization-
|
|
1
|
+
import { n as strictJsonStringify } from "../../serialization-BD_qXGjd.mjs";
|
|
2
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";
|
|
@@ -62,7 +62,7 @@ function strictJsonStringify(value, fnName = "") {
|
|
|
62
62
|
}
|
|
63
63
|
function nonJsonAt(fnName, type, parent, key) {
|
|
64
64
|
const path = formatPath(parent, key);
|
|
65
|
-
return diagnostics.DF0020
|
|
65
|
+
return diagnostics.DF0020({
|
|
66
66
|
name: fnName || "<anonymous>",
|
|
67
67
|
type,
|
|
68
68
|
path
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as DevToolsRpcServerFunctions, T as DevToolsRpcClientFunctions, d as DevToolsNodeContext } from "./devframe-
|
|
1
|
+
import { E as DevToolsRpcServerFunctions, T as DevToolsRpcClientFunctions, d as DevToolsNodeContext } from "./devframe-xC8Q-xyt.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import { H3 } from "h3";
|
|
@@ -99,7 +99,7 @@ function createStorage(options) {
|
|
|
99
99
|
const savedValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
|
|
100
100
|
initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
|
|
101
101
|
} catch (error) {
|
|
102
|
-
diagnostics.DF0012
|
|
102
|
+
diagnostics.DF0012({
|
|
103
103
|
filepath: options.filepath,
|
|
104
104
|
cause: error
|
|
105
105
|
}, { method: "warn" });
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DevToolsDiagnosticsDefinition, B as DevToolsAgentHost, C as PartialWithoutId, D as DevToolsRpcSharedStates, 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, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventUnsubscribe, V as DevToolsAgentHostEvents, W as EventsMap, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsHost, k as DevToolsDefineDiagnosticsOptions, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as AgentToolInput } from "../devframe-
|
|
1
|
+
import { A as DevToolsDiagnosticsDefinition, B as DevToolsAgentHost, C as PartialWithoutId, D as DevToolsRpcSharedStates, 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, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventUnsubscribe, V as DevToolsAgentHostEvents, W as EventsMap, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsHost, k as DevToolsDefineDiagnosticsOptions, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as AgentToolInput } from "../devframe-xC8Q-xyt.mjs";
|
|
2
2
|
import { h as RpcFunctionAgentOptions } from "../types-BXL7EIDM.mjs";
|
|
3
3
|
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DOwLJL23.mjs";
|
|
4
4
|
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDefineDiagnosticsOptions, 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 };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"description": "Framework for building generic DevTools",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"./utils/when": "./dist/utils/when.mjs",
|
|
55
55
|
"./package.json": "./package.json"
|
|
56
56
|
},
|
|
57
|
-
"types": "./dist/index.d.
|
|
57
|
+
"types": "./dist/index.d.mts",
|
|
58
58
|
"files": [
|
|
59
59
|
"dist",
|
|
60
60
|
"skills"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"cac": "^7.0.0",
|
|
74
74
|
"h3": "2.0.1-rc.22",
|
|
75
75
|
"mrmime": "^2.0.1",
|
|
76
|
-
"nostics": "^0.
|
|
76
|
+
"nostics": "^0.2.0",
|
|
77
77
|
"pathe": "^2.0.3",
|
|
78
78
|
"valibot": "^1.4.0",
|
|
79
79
|
"ws": "^8.20.0"
|