devframe 0.2.0 → 0.2.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/README.md +20 -76
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +4 -5
- 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 +2 -2
- package/dist/adapters/mcp.mjs +72 -17
- package/dist/client/index.d.mts +4 -4
- package/dist/client/index.mjs +4 -8
- package/dist/{context-DRa0wGsC.d.mts → context-BaX-SZti.d.mts} +1 -1
- package/dist/{dev-CewNNE2R.mjs → dev-CA0-8Amw.mjs} +4 -5
- package/dist/{devframe-R5Ex5K5L.d.mts → devframe-BXZUBuy6.d.mts} +2 -2
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +3 -3
- package/dist/{context-BBi2IQDm.mjs → host-h3-CpYkiCIU.mjs} +25 -2
- package/dist/{index-DB2Ie0Or.d.mts → index-BO4daMzR.d.mts} +51 -3
- package/dist/index.d.mts +3 -3
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +2 -2
- package/dist/node/index.d.mts +6 -37
- package/dist/node/index.mjs +4 -6
- package/dist/node/internal.d.mts +2 -2
- package/dist/node/internal.mjs +4 -4
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +2 -2
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{rpc-DAzoVCR0.mjs → rpc-BlVCyk9W.mjs} +135 -11
- package/dist/{server-DzKz023G.d.mts → server-CgqyJG9m.d.mts} +1 -1
- package/dist/{transports-BnCs4rj9.mjs → transports-BLwT342H.mjs} +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/{types-4rdUEi2R.d.mts → types-ip8THGH1.d.mts} +21 -5
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/human-id.mjs +1 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{ws-client-Bavoya6-.d.mts → ws-client-DFUf-xgm.d.mts} +1 -1
- package/dist/{ws-server-DjvlwLuM.d.mts → ws-server-kW8RZXTw.d.mts} +1 -1
- package/package.json +1 -1
- package/skills/devframe/SKILL.md +1 -1
- package/dist/host-h3-Dz8YnFgu.mjs +0 -24
- package/dist/static-dump-C67bCuse.mjs +0 -80
- /package/dist/{_shared-BrKv3CYt.mjs → _shared-C_yZKUmx.mjs} +0 -0
- /package/dist/{human-id-adtUWQLr.mjs → human-id-mPh1HcFO.mjs} +0 -0
- /package/dist/{launch-editor-CX_n_0SS.mjs → launch-editor-1dAC7Uk5.mjs} +0 -0
- /package/dist/{open-B2ah1IKK.mjs → open-CWL4Zasd.mjs} +0 -0
- /package/dist/{revoke-DIMz1r7-.mjs → revoke-CWSPBbJH.mjs} +0 -0
- /package/dist/{server-DOk4grlJ.mjs → server-G1ymmN3_.mjs} +0 -0
- /package/dist/{storage-CNvfBGQ5.mjs → storage-BaLJK6e_.mjs} +0 -0
package/dist/node/index.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import { t as
|
|
3
|
-
import { t as
|
|
4
|
-
import { t as collectStaticRpcDump } from "../static-dump-C67bCuse.mjs";
|
|
5
|
-
import { t as createStorage } from "../storage-CNvfBGQ5.mjs";
|
|
1
|
+
import { a as createRpcStreamingServerHost, c as DevToolsAgentHost, i as RpcFunctionsHost, n as createHostContext, o as createRpcSharedStateServerHost, r as DevToolsViewHost, s as DevToolsDiagnosticsHost, t as createH3DevToolsHost } from "../host-h3-CpYkiCIU.mjs";
|
|
2
|
+
import { t as startHttpAndWs } from "../server-G1ymmN3_.mjs";
|
|
3
|
+
import { t as createStorage } from "../storage-BaLJK6e_.mjs";
|
|
6
4
|
import { isIP } from "node:net";
|
|
7
5
|
//#region src/node/utils.ts
|
|
8
6
|
function isObject(value) {
|
|
@@ -12,4 +10,4 @@ function normalizeHttpServerUrl(host, port) {
|
|
|
12
10
|
return `http://${host === "127.0.0.1" ? "localhost" : isIP(host) === 6 ? `[${host}]` : host}:${port}`;
|
|
13
11
|
}
|
|
14
12
|
//#endregion
|
|
15
|
-
export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost,
|
|
13
|
+
export { DevToolsAgentHost, DevToolsDiagnosticsHost, DevToolsViewHost, RpcFunctionsHost, createH3DevToolsHost, createHostContext, createRpcSharedStateServerHost, createRpcStreamingServerHost, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
|
package/dist/node/internal.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-
|
|
1
|
+
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-BXZUBuy6.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevToolsInternalContext } from "../context-BaX-SZti.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_shared.d.ts
|
|
5
5
|
/**
|
package/dist/node/internal.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createStorage } from "../storage-
|
|
2
|
-
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-
|
|
3
|
-
import { t as humanId } from "../human-id-
|
|
4
|
-
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-
|
|
1
|
+
import { t as createStorage } from "../storage-BaLJK6e_.mjs";
|
|
2
|
+
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "../revoke-CWSPBbJH.mjs";
|
|
3
|
+
import { t as humanId } from "../human-id-mPh1HcFO.mjs";
|
|
4
|
+
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-C_yZKUmx.mjs";
|
|
5
5
|
import { join } from "pathe";
|
|
6
6
|
//#region src/node/internal/context.ts
|
|
7
7
|
const internalContextMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { T as Thenable, h as RpcFunctionAgentOptions, s as RpcDump, x as RpcFunctionSetupResult } from "../types-ip8THGH1.mjs";
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
|
|
4
4
|
//#region src/recipes/open-helpers.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as defineRpcFunction } from "../define-CW9gLnyG.mjs";
|
|
2
|
-
import { t as launchEditor } from "../launch-editor-
|
|
3
|
-
import { t as open } from "../open-
|
|
2
|
+
import { t as launchEditor } from "../launch-editor-1dAC7Uk5.mjs";
|
|
3
|
+
import { t as open } from "../open-CWL4Zasd.mjs";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/recipes/open-helpers.ts
|
|
6
6
|
/**
|
package/dist/rpc/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as getRpcHandler, c as
|
|
2
|
-
import { C as
|
|
3
|
-
export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, Thenable, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions };
|
|
1
|
+
import { C as RpcCacheManager, S as RpcFunctionsCollectorBase, _ as createClientFromDump, a as getRpcHandler, b as createDefineWrapperWithContext, c as StaticRpcDumpFile, d as StaticRpcDumpManifestStaticEntry, f as StaticRpcDumpManifestValue, g as serializeDumpError, h as reviveDumpError, i as strictJsonStringify, l as StaticRpcDumpManifest, m as collectStaticRpcDump, n as validateDefinitions, o as getRpcResolvedSetupResult, p as StaticRpcDumpSerialization, r as STRUCTURED_CLONE_PREFIX, s as StaticRpcDumpCollection, t as validateDefinition, u as StaticRpcDumpManifestQueryEntry, v as dumpFunctions, w as RpcCacheOptions, x as defineRpcFunction, y as getDefinitionsWithDumps } from "../index-BO4daMzR.mjs";
|
|
2
|
+
import { C as RpcFunctionsCollector, S as RpcFunctionType, T as Thenable, _ as RpcFunctionDefinitionAny, a as RpcDefinitionsFilter, b as RpcFunctionDefinitionToFunction, c as RpcDumpClientOptions, d as RpcDumpGetter, f as RpcDumpRecord, g as RpcFunctionDefinition, h as RpcFunctionAgentOptions, i as RpcArgsSchema, l as RpcDumpCollectionOptions, m as RpcDumpStore, n as BirpcReturn, o as RpcDefinitionsToFunctions, p as RpcDumpRecordError, r as EntriesToObject, s as RpcDump, t as BirpcFn, u as RpcDumpDefinition, v as RpcFunctionDefinitionAnyWithContext, w as RpcReturnSchema, x as RpcFunctionSetupResult, y as RpcFunctionDefinitionBase } from "../types-ip8THGH1.mjs";
|
|
3
|
+
export { BirpcFn, BirpcReturn, EntriesToObject, RpcArgsSchema, RpcCacheManager, RpcCacheOptions, RpcDefinitionsFilter, RpcDefinitionsToFunctions, RpcDump, RpcDumpClientOptions, RpcDumpCollectionOptions, RpcDumpDefinition, RpcDumpGetter, RpcDumpRecord, RpcDumpRecordError, RpcDumpStore, RpcFunctionAgentOptions, RpcFunctionDefinition, RpcFunctionDefinitionAny, RpcFunctionDefinitionAnyWithContext, RpcFunctionDefinitionBase, RpcFunctionDefinitionToFunction, RpcFunctionSetupResult, RpcFunctionType, RpcFunctionsCollector, RpcFunctionsCollectorBase, RpcReturnSchema, STRUCTURED_CLONE_PREFIX, StaticRpcDumpCollection, StaticRpcDumpFile, StaticRpcDumpManifest, StaticRpcDumpManifestQueryEntry, StaticRpcDumpManifestStaticEntry, StaticRpcDumpManifestValue, StaticRpcDumpSerialization, Thenable, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, validateDefinition, validateDefinitions };
|
package/dist/rpc/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as reviveDumpError, c as validateDefinitions, d as getRpcResolvedSetupResult, f as RpcCacheManager, i as getDefinitionsWithDumps, l as RpcFunctionsCollectorBase, n as createClientFromDump, o as serializeDumpError, r as dumpFunctions, s as validateDefinition, t as collectStaticRpcDump, u as getRpcHandler } from "../rpc-BlVCyk9W.mjs";
|
|
2
2
|
import { n as strictJsonStringify, t as STRUCTURED_CLONE_PREFIX } from "../serialization-CwO31axa.mjs";
|
|
3
3
|
import { n as defineRpcFunction, t as createDefineWrapperWithContext } from "../define-CW9gLnyG.mjs";
|
|
4
|
-
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, strictJsonStringify, validateDefinition, validateDefinitions };
|
|
4
|
+
export { RpcCacheManager, RpcFunctionsCollectorBase, STRUCTURED_CLONE_PREFIX, collectStaticRpcDump, createClientFromDump, createDefineWrapperWithContext, defineRpcFunction, dumpFunctions, getDefinitionsWithDumps, getRpcHandler, getRpcResolvedSetupResult, reviveDumpError, serializeDumpError, strictJsonStringify, validateDefinition, validateDefinitions };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-
|
|
1
|
+
import { n as createWsRpcChannel, t as WsRpcChannelOptions } from "../../ws-client-DFUf-xgm.mjs";
|
|
2
2
|
export { WsRpcChannelOptions, createWsRpcChannel };
|
|
@@ -45,7 +45,7 @@ function createWsRpcChannel(options) {
|
|
|
45
45
|
method = pendingRequestMethods.get(msg.i);
|
|
46
46
|
pendingRequestMethods.delete(msg.i);
|
|
47
47
|
}
|
|
48
|
-
if (!!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
48
|
+
if (!(msg.t === "s" && "e" in msg) && !!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
49
49
|
return `s:${structuredCloneStringify(msg)}`;
|
|
50
50
|
},
|
|
51
51
|
deserialize: (raw) => {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-
|
|
1
|
+
import { n as WsRpcTransportOptions, r as attachWsRpcTransport, t as DevToolsNodeRpcSessionMeta } from "../../ws-server-kW8RZXTw.mjs";
|
|
2
2
|
export { DevToolsNodeRpcSessionMeta, WsRpcTransportOptions, attachWsRpcTransport };
|
|
@@ -46,7 +46,7 @@ function attachWsRpcTransport(rpcGroup, options = {}) {
|
|
|
46
46
|
method = pendingRequestMethods.get(msg.i);
|
|
47
47
|
pendingRequestMethods.delete(msg.i);
|
|
48
48
|
}
|
|
49
|
-
if (!!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
49
|
+
if (!(msg.t === "s" && "e" in msg) && !!method && definitions.get(method)?.jsonSerializable === true) return strictJsonStringify(msg, method ?? "");
|
|
50
50
|
return `s:${structuredCloneStringify(msg)}`;
|
|
51
51
|
}),
|
|
52
52
|
deserialize: deserializeOverride ?? ((raw) => {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { t as hash } from "./hash-CIBte1yS.mjs";
|
|
2
2
|
import { i as logger } from "./serialization-CwO31axa.mjs";
|
|
3
|
+
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
4
|
//#region src/rpc/cache.ts
|
|
4
5
|
/**
|
|
5
6
|
* @experimental API is expected to change.
|
|
@@ -285,7 +286,60 @@ function validateDefinition(definition) {
|
|
|
285
286
|
validateDefinitions([definition]);
|
|
286
287
|
}
|
|
287
288
|
//#endregion
|
|
288
|
-
//#region src/rpc/
|
|
289
|
+
//#region src/rpc/dump/error.ts
|
|
290
|
+
/**
|
|
291
|
+
* Normalize a thrown value into a plain object suitable for storage in
|
|
292
|
+
* a dump record. Preserves `message`, `name`, `cause`, and any own
|
|
293
|
+
* enumerable properties of an `Error` so consumers reading the dump can
|
|
294
|
+
* reconstruct a richer Error than just `{ message, name }`.
|
|
295
|
+
*
|
|
296
|
+
* Non-`Error` throws are wrapped as `{ name: 'Error', message: String(thrown) }`.
|
|
297
|
+
*/
|
|
298
|
+
function serializeDumpError(error) {
|
|
299
|
+
return serializeWithSeen(error, /* @__PURE__ */ new WeakSet());
|
|
300
|
+
}
|
|
301
|
+
function serializeWithSeen(error, seen) {
|
|
302
|
+
if (!(error instanceof Error)) return {
|
|
303
|
+
name: "Error",
|
|
304
|
+
message: String(error)
|
|
305
|
+
};
|
|
306
|
+
if (seen.has(error)) return {
|
|
307
|
+
name: error.name,
|
|
308
|
+
message: error.message
|
|
309
|
+
};
|
|
310
|
+
seen.add(error);
|
|
311
|
+
const out = {
|
|
312
|
+
name: error.name,
|
|
313
|
+
message: error.message
|
|
314
|
+
};
|
|
315
|
+
const cause = error.cause;
|
|
316
|
+
if (cause !== void 0) out.cause = cause instanceof Error ? serializeWithSeen(cause, seen) : cause;
|
|
317
|
+
for (const key of Object.keys(error)) {
|
|
318
|
+
if (key === "name" || key === "message" || key === "cause") continue;
|
|
319
|
+
out[key] = error[key];
|
|
320
|
+
}
|
|
321
|
+
return out;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Inverse of {@link serializeDumpError}: rebuild a thrown `Error` from
|
|
325
|
+
* the plain object stored in a dump record. Preserves `cause`, restores
|
|
326
|
+
* the original `name`, and re-attaches any custom own properties.
|
|
327
|
+
*/
|
|
328
|
+
function reviveDumpError(stored) {
|
|
329
|
+
const cause = stored.cause instanceof Error ? stored.cause : isPlainErrorShape(stored.cause) ? reviveDumpError(stored.cause) : stored.cause;
|
|
330
|
+
const error = cause !== void 0 ? new Error(stored.message, { cause }) : new Error(stored.message);
|
|
331
|
+
error.name = stored.name;
|
|
332
|
+
for (const key of Object.keys(stored)) {
|
|
333
|
+
if (key === "name" || key === "message" || key === "cause") continue;
|
|
334
|
+
error[key] = stored[key];
|
|
335
|
+
}
|
|
336
|
+
return error;
|
|
337
|
+
}
|
|
338
|
+
function isPlainErrorShape(value) {
|
|
339
|
+
return typeof value === "object" && value !== null && typeof value.message === "string" && typeof value.name === "string";
|
|
340
|
+
}
|
|
341
|
+
//#endregion
|
|
342
|
+
//#region src/rpc/dump/index.ts
|
|
289
343
|
function getDumpRecordKey(functionName, args) {
|
|
290
344
|
return `${functionName}---${hash(args)}`;
|
|
291
345
|
}
|
|
@@ -374,10 +428,7 @@ async function dumpFunctions(definitions, context, options = {}) {
|
|
|
374
428
|
} catch (error) {
|
|
375
429
|
store.records[recordKey] = {
|
|
376
430
|
inputs: input,
|
|
377
|
-
error:
|
|
378
|
-
message: error.message,
|
|
379
|
-
name: error.name
|
|
380
|
-
}
|
|
431
|
+
error: serializeDumpError(error)
|
|
381
432
|
};
|
|
382
433
|
}
|
|
383
434
|
});
|
|
@@ -409,11 +460,7 @@ function createClientFromDump(store, options = {}) {
|
|
|
409
460
|
const recordOrGetter = store.records[recordKey];
|
|
410
461
|
if (recordOrGetter) {
|
|
411
462
|
const record = await resolveGetter(recordOrGetter);
|
|
412
|
-
if (record.error)
|
|
413
|
-
const error = new Error(record.error.message);
|
|
414
|
-
error.name = record.error.name;
|
|
415
|
-
throw error;
|
|
416
|
-
}
|
|
463
|
+
if (record.error) throw reviveDumpError(record.error);
|
|
417
464
|
if (typeof record.output === "function") return await record.output();
|
|
418
465
|
return record.output;
|
|
419
466
|
}
|
|
@@ -454,4 +501,81 @@ function getDefinitionsWithDumps(definitions) {
|
|
|
454
501
|
return definitions.filter((def) => def.dump !== void 0);
|
|
455
502
|
}
|
|
456
503
|
//#endregion
|
|
457
|
-
|
|
504
|
+
//#region src/rpc/dump/static.ts
|
|
505
|
+
function makeDumpKey(name) {
|
|
506
|
+
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
507
|
+
}
|
|
508
|
+
function makeStaticPath(name) {
|
|
509
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
510
|
+
}
|
|
511
|
+
function makeQueryRecordPath(name, hash) {
|
|
512
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
513
|
+
}
|
|
514
|
+
function makeQueryFallbackPath(name) {
|
|
515
|
+
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
516
|
+
}
|
|
517
|
+
async function resolveRecord(record) {
|
|
518
|
+
return typeof record === "function" ? await record() : record;
|
|
519
|
+
}
|
|
520
|
+
async function collectStaticRpcDump(definitions, context) {
|
|
521
|
+
const manifest = {};
|
|
522
|
+
const files = {};
|
|
523
|
+
for (const definition of definitions) {
|
|
524
|
+
const type = definition.type ?? "query";
|
|
525
|
+
const serialization = definition.jsonSerializable === true ? "json" : "structured-clone";
|
|
526
|
+
if (type === "static") {
|
|
527
|
+
const handler = await getRpcHandler(definition, context);
|
|
528
|
+
const path = makeStaticPath(definition.name);
|
|
529
|
+
files[path] = {
|
|
530
|
+
serialization,
|
|
531
|
+
fnName: definition.name,
|
|
532
|
+
data: { output: await Promise.resolve(handler()) }
|
|
533
|
+
};
|
|
534
|
+
manifest[definition.name] = {
|
|
535
|
+
type: "static",
|
|
536
|
+
path,
|
|
537
|
+
serialization
|
|
538
|
+
};
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
if (type !== "query") continue;
|
|
542
|
+
const store = await dumpFunctions([definition], context);
|
|
543
|
+
if (!(definition.name in store.definitions)) continue;
|
|
544
|
+
const queryEntry = {
|
|
545
|
+
type: "query",
|
|
546
|
+
records: {},
|
|
547
|
+
serialization
|
|
548
|
+
};
|
|
549
|
+
const prefix = `${definition.name}---`;
|
|
550
|
+
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
551
|
+
if (!recordKey.startsWith(prefix)) continue;
|
|
552
|
+
const key = recordKey.slice(prefix.length);
|
|
553
|
+
const record = await resolveRecord(recordOrGetter);
|
|
554
|
+
if (key === "fallback") {
|
|
555
|
+
const path = makeQueryFallbackPath(definition.name);
|
|
556
|
+
files[path] = {
|
|
557
|
+
serialization,
|
|
558
|
+
fnName: definition.name,
|
|
559
|
+
data: record
|
|
560
|
+
};
|
|
561
|
+
queryEntry.fallback = path;
|
|
562
|
+
} else {
|
|
563
|
+
const path = makeQueryRecordPath(definition.name, key);
|
|
564
|
+
files[path] = {
|
|
565
|
+
serialization,
|
|
566
|
+
fnName: definition.name,
|
|
567
|
+
data: record
|
|
568
|
+
};
|
|
569
|
+
queryEntry.records[key] = path;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
573
|
+
manifest[definition.name] = queryEntry;
|
|
574
|
+
}
|
|
575
|
+
return {
|
|
576
|
+
manifest,
|
|
577
|
+
files
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
//#endregion
|
|
581
|
+
export { reviveDumpError as a, validateDefinitions as c, getRpcResolvedSetupResult as d, RpcCacheManager as f, getDefinitionsWithDumps as i, RpcFunctionsCollectorBase as l, createClientFromDump as n, serializeDumpError as o, dumpFunctions as r, validateDefinition as s, collectStaticRpcDump as t, getRpcHandler as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-
|
|
1
|
+
import { U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, d as DevToolsNodeContext } from "./devframe-BXZUBuy6.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { WebSocketServer } from "ws";
|
|
4
4
|
import { H3 } from "h3";
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-
|
|
2
|
-
import {
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
1
|
+
import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-BXZUBuy6.mjs";
|
|
2
|
+
import { h as RpcFunctionAgentOptions } from "../types-ip8THGH1.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-kW8RZXTw.mjs";
|
|
4
4
|
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe };
|
|
@@ -94,6 +94,25 @@ interface RpcFunctionSetupResult<ARGS extends any[], RETURN = void> {
|
|
|
94
94
|
type RpcArgsSchema = readonly GenericSchema[];
|
|
95
95
|
/** Valibot schema for validating function return value */
|
|
96
96
|
type RpcReturnSchema = GenericSchema;
|
|
97
|
+
/**
|
|
98
|
+
* Serialized representation of a thrown value in a dump record.
|
|
99
|
+
*
|
|
100
|
+
* Errors are stored as plain objects so they round-trip through both the
|
|
101
|
+
* strict-JSON and structured-clone codecs. `message` and `name` are always
|
|
102
|
+
* present; `cause` and any own enumerable properties of the original
|
|
103
|
+
* `Error` are preserved on a best-effort basis. Non-`Error` throws are
|
|
104
|
+
* normalized to `{ name: 'Error', message: String(thrown) }`.
|
|
105
|
+
*/
|
|
106
|
+
interface RpcDumpRecordError {
|
|
107
|
+
/** Error message (mirrors `Error.message`). */
|
|
108
|
+
message: string;
|
|
109
|
+
/** Error type name (e.g., "Error", "TypeError"). */
|
|
110
|
+
name: string;
|
|
111
|
+
/** `Error.cause`, recursively serialized when it is itself an `Error`. */
|
|
112
|
+
cause?: unknown;
|
|
113
|
+
/** Own enumerable properties of the original error (excluding `message`/`name`/`cause`). */
|
|
114
|
+
[key: string]: unknown;
|
|
115
|
+
}
|
|
97
116
|
/**
|
|
98
117
|
* Single record in a dump store with pre-computed results.
|
|
99
118
|
*/
|
|
@@ -103,10 +122,7 @@ interface RpcDumpRecord<ARGS extends any[] = any[], RETURN = any> {
|
|
|
103
122
|
/** Result (value or lazy function) */
|
|
104
123
|
output?: RETURN;
|
|
105
124
|
/** Error if execution failed */
|
|
106
|
-
error?:
|
|
107
|
-
/** Error message */message: string; /** Error type name (e.g., "Error", "TypeError") */
|
|
108
|
-
name: string;
|
|
109
|
-
};
|
|
125
|
+
error?: RpcDumpRecordError;
|
|
110
126
|
}
|
|
111
127
|
/**
|
|
112
128
|
* Defines argument combinations to pre-compute for a function.
|
|
@@ -270,4 +286,4 @@ type RpcDefinitionsFilter<T extends readonly RpcFunctionDefinitionAny[], Type ex
|
|
|
270
286
|
type: Type;
|
|
271
287
|
} ? T[K] : never };
|
|
272
288
|
//#endregion
|
|
273
|
-
export {
|
|
289
|
+
export { RpcFunctionsCollector as C, RpcFunctionType as S, Thenable as T, RpcFunctionDefinitionAny as _, RpcDefinitionsFilter as a, RpcFunctionDefinitionToFunction as b, RpcDumpClientOptions as c, RpcDumpGetter as d, RpcDumpRecord as f, RpcFunctionDefinition as g, RpcFunctionAgentOptions as h, RpcArgsSchema as i, RpcDumpCollectionOptions as l, RpcDumpStore as m, BirpcReturn$1 as n, RpcDefinitionsToFunctions as o, RpcDumpRecordError as p, EntriesToObject as r, RpcDump as s, BirpcFn as t, RpcDumpDefinition as u, RpcFunctionDefinitionAnyWithContext as v, RpcReturnSchema as w, RpcFunctionSetupResult as x, RpcFunctionDefinitionBase as y };
|
package/dist/utils/events.d.mts
CHANGED
package/dist/utils/human-id.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as humanId } from "../human-id-
|
|
1
|
+
import { t as humanId } from "../human-id-mPh1HcFO.mjs";
|
|
2
2
|
export { humanId };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as launchEditor } from "../launch-editor-
|
|
1
|
+
import { t as launchEditor } from "../launch-editor-1dAC7Uk5.mjs";
|
|
2
2
|
export { launchEditor };
|
package/dist/utils/open.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as open } from "../open-
|
|
1
|
+
import { t as open } from "../open-CWL4Zasd.mjs";
|
|
2
2
|
export { open };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as ImmutableArray, F as SharedStateEvents, I as SharedStateOptions, L as SharedStatePatch, M as ImmutableObject, N as ImmutableSet, P as SharedState, R as createSharedState, j as ImmutableMap, k as Immutable } from "../devframe-
|
|
1
|
+
import { A as ImmutableArray, F as SharedStateEvents, I as SharedStateOptions, L as SharedStatePatch, M as ImmutableObject, N as ImmutableSet, P as SharedState, R as createSharedState, j as ImmutableMap, k as Immutable } from "../devframe-BXZUBuy6.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as StreamErrorPayload, D as createStreamReader, E as StreamSinkEvents, O as createStreamSink, S as CreateStreamSinkOptions, T as StreamSink, b as BufferedChunk, w as StreamReader, x as CreateStreamReaderOptions } from "../devframe-
|
|
1
|
+
import { C as StreamErrorPayload, D as createStreamReader, E as StreamSinkEvents, O as createStreamSink, S as CreateStreamSinkOptions, T as StreamSink, b as BufferedChunk, w as StreamReader, x as CreateStreamReaderOptions } from "../devframe-BXZUBuy6.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as RpcFunctionDefinitionAny } from "./types-ip8THGH1.mjs";
|
|
2
2
|
import { BirpcGroup, ChannelOptions } from "birpc";
|
|
3
3
|
import { ServerOptions } from "node:https";
|
|
4
4
|
import { WebSocket, WebSocketServer } from "ws";
|
package/package.json
CHANGED
package/skills/devframe/SKILL.md
CHANGED
|
@@ -239,7 +239,7 @@ Readable.fromWeb(reader.readable).pipe(targetNodeWritable)
|
|
|
239
239
|
| Per-call lifecycles with cancellation | Cross-cutting fire-and-forget signals | Diff-based sync between clients |
|
|
240
240
|
| Replay on reconnect | | |
|
|
241
241
|
|
|
242
|
-
For chat-style UIs that combine both: keep the **conversation log** in shared state (survives reconnects), and use a streaming channel for **active responses**. The action that starts a response appends a placeholder to shared state; on producer close, commit the joined content back to shared state. Working example: [`
|
|
242
|
+
For chat-style UIs that combine both: keep the **conversation log** in shared state (survives reconnects), and use a streaming channel for **active responses**. The action that starts a response appends a placeholder to shared state; on producer close, commit the joined content back to shared state. Working example: [`examples/streaming-chat`](https://github.com/devframes/devframe/tree/main/examples/streaming-chat).
|
|
243
243
|
|
|
244
244
|
## Mounting into a host (Vite DevTools example)
|
|
245
245
|
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import { join } from "pathe";
|
|
4
|
-
//#region src/node/host-h3.ts
|
|
5
|
-
/**
|
|
6
|
-
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
7
|
-
*/
|
|
8
|
-
function createH3DevToolsHost(options) {
|
|
9
|
-
const workspaceRoot = options.workspaceRoot ?? process.cwd();
|
|
10
|
-
return {
|
|
11
|
-
mountStatic(base, distDir) {
|
|
12
|
-
return options.mount?.(base, distDir);
|
|
13
|
-
},
|
|
14
|
-
resolveOrigin() {
|
|
15
|
-
return options.origin;
|
|
16
|
-
},
|
|
17
|
-
getStorageDir(scope) {
|
|
18
|
-
const namespace = `.${options.appName}/devtools`;
|
|
19
|
-
return scope === "workspace" ? join(workspaceRoot, "node_modules", namespace) : join(homedir(), namespace);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { createH3DevToolsHost as t };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-DAzoVCR0.mjs";
|
|
2
|
-
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
|
-
//#region src/node/static-dump.ts
|
|
4
|
-
function makeDumpKey(name) {
|
|
5
|
-
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
6
|
-
}
|
|
7
|
-
function makeStaticPath(name) {
|
|
8
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
9
|
-
}
|
|
10
|
-
function makeQueryRecordPath(name, hash) {
|
|
11
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
12
|
-
}
|
|
13
|
-
function makeQueryFallbackPath(name) {
|
|
14
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
15
|
-
}
|
|
16
|
-
async function resolveRecord(record) {
|
|
17
|
-
return typeof record === "function" ? await record() : record;
|
|
18
|
-
}
|
|
19
|
-
async function collectStaticRpcDump(definitions, context) {
|
|
20
|
-
const manifest = {};
|
|
21
|
-
const files = {};
|
|
22
|
-
for (const definition of definitions) {
|
|
23
|
-
const type = definition.type ?? "query";
|
|
24
|
-
const serialization = definition.jsonSerializable === true ? "json" : "structured-clone";
|
|
25
|
-
if (type === "static") {
|
|
26
|
-
const handler = await getRpcHandler(definition, context);
|
|
27
|
-
const path = makeStaticPath(definition.name);
|
|
28
|
-
files[path] = {
|
|
29
|
-
serialization,
|
|
30
|
-
fnName: definition.name,
|
|
31
|
-
data: { output: await Promise.resolve(handler()) }
|
|
32
|
-
};
|
|
33
|
-
manifest[definition.name] = {
|
|
34
|
-
type: "static",
|
|
35
|
-
path,
|
|
36
|
-
serialization
|
|
37
|
-
};
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (type !== "query") continue;
|
|
41
|
-
const store = await dumpFunctions([definition], context);
|
|
42
|
-
if (!(definition.name in store.definitions)) continue;
|
|
43
|
-
const queryEntry = {
|
|
44
|
-
type: "query",
|
|
45
|
-
records: {},
|
|
46
|
-
serialization
|
|
47
|
-
};
|
|
48
|
-
const prefix = `${definition.name}---`;
|
|
49
|
-
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
50
|
-
if (!recordKey.startsWith(prefix)) continue;
|
|
51
|
-
const key = recordKey.slice(prefix.length);
|
|
52
|
-
const record = await resolveRecord(recordOrGetter);
|
|
53
|
-
if (key === "fallback") {
|
|
54
|
-
const path = makeQueryFallbackPath(definition.name);
|
|
55
|
-
files[path] = {
|
|
56
|
-
serialization,
|
|
57
|
-
fnName: definition.name,
|
|
58
|
-
data: record
|
|
59
|
-
};
|
|
60
|
-
queryEntry.fallback = path;
|
|
61
|
-
} else {
|
|
62
|
-
const path = makeQueryRecordPath(definition.name, key);
|
|
63
|
-
files[path] = {
|
|
64
|
-
serialization,
|
|
65
|
-
fnName: definition.name,
|
|
66
|
-
data: record
|
|
67
|
-
};
|
|
68
|
-
queryEntry.records[key] = path;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
72
|
-
manifest[definition.name] = queryEntry;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
manifest,
|
|
76
|
-
files
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
export { collectStaticRpcDump as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|