devframe 0.8.2 → 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 +20 -42
- 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-CBg8iRbQ.mjs → context-C33rR7n0.mjs} +1 -1
- package/dist/{context-DoSozfvx.d.mts → context-CSCwoABx.d.mts} +1 -1
- package/dist/{host-h3-D2hYZvDK.mjs → context-Du11TLcO.mjs} +5 -255
- package/dist/dev-BEveeA5H.mjs +233 -0
- package/dist/{devframe-mQ4qZAuo.d.mts → devframe-Bdd9YXTy.d.mts} +88 -25
- package/dist/{diagnostics-D7wM2cwM.mjs → diagnostics-DLYH5oD3.mjs} +16 -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-BKaD0Vb3.mjs → http-DLr_cJZ7.mjs} +42 -4
- package/dist/{index-b64Uuhy2.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-BnnA2Eoh.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 -235
- 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-CTNVbuFB.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-uKQcClcJ.d.mts → ws-server-Ces08fjP.d.mts} +89 -8
- 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-D4_9ok0z.mjs +0 -157
- package/dist/dev-Bc49u3qg.mjs +0 -439
- package/dist/http-C4T68YV6.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-CD8XmBXl.mjs +0 -167
- package/dist/server-UHWae43Q.d.mts +0 -149
- 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
|
@@ -1,132 +1,6 @@
|
|
|
1
|
+
import { n as validateDefinitions, r as getRpcHandler, s as hash } from "./validation-BiuDXTKW.mjs";
|
|
1
2
|
import { t as diagnostics } from "./diagnostics-hwjXp_UV.mjs";
|
|
2
3
|
import { DEVFRAME_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
|
-
import { createHash } from "node:crypto";
|
|
4
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
|
|
5
|
-
function serialize(o) {
|
|
6
|
-
return typeof o == "string" ? `'${o}'` : new c().serialize(o);
|
|
7
|
-
}
|
|
8
|
-
const c = /*@__PURE__*/ function() {
|
|
9
|
-
class o {
|
|
10
|
-
#t = /* @__PURE__ */ new Map();
|
|
11
|
-
compare(t, r) {
|
|
12
|
-
const e = typeof t, n = typeof r;
|
|
13
|
-
return e === "string" && n === "string" ? t.localeCompare(r) : e === "number" && n === "number" ? t - r : String.prototype.localeCompare.call(this.serialize(t, true), this.serialize(r, true));
|
|
14
|
-
}
|
|
15
|
-
serialize(t, r) {
|
|
16
|
-
if (t === null) return "null";
|
|
17
|
-
switch (typeof t) {
|
|
18
|
-
case "string": return r ? t : `'${t}'`;
|
|
19
|
-
case "bigint": return `${t}n`;
|
|
20
|
-
case "object": return this.$object(t);
|
|
21
|
-
case "function": return this.$function(t);
|
|
22
|
-
}
|
|
23
|
-
return String(t);
|
|
24
|
-
}
|
|
25
|
-
serializeObject(t) {
|
|
26
|
-
const r = Object.prototype.toString.call(t);
|
|
27
|
-
if (r !== "[object Object]") return this.serializeBuiltInType(r.length < 10 ? `unknown:${r}` : r.slice(8, -1), t);
|
|
28
|
-
const e = t.constructor, n = e === Object || e === void 0 ? "" : e.name;
|
|
29
|
-
if (n !== "" && globalThis[n] === e) return this.serializeBuiltInType(n, t);
|
|
30
|
-
if (typeof t.toJSON == "function") {
|
|
31
|
-
const i = t.toJSON();
|
|
32
|
-
return n + (i !== null && typeof i == "object" ? this.$object(i) : `(${this.serialize(i)})`);
|
|
33
|
-
}
|
|
34
|
-
return this.serializeObjectEntries(n, Object.entries(t));
|
|
35
|
-
}
|
|
36
|
-
serializeBuiltInType(t, r) {
|
|
37
|
-
const e = this["$" + t];
|
|
38
|
-
if (e) return e.call(this, r);
|
|
39
|
-
if (typeof r?.entries == "function") return this.serializeObjectEntries(t, r.entries());
|
|
40
|
-
throw new Error(`Cannot serialize ${t}`);
|
|
41
|
-
}
|
|
42
|
-
serializeObjectEntries(t, r) {
|
|
43
|
-
const e = Array.from(r).sort((i, a) => this.compare(i[0], a[0]));
|
|
44
|
-
let n = `${t}{`;
|
|
45
|
-
for (let i = 0; i < e.length; i++) {
|
|
46
|
-
const [a, l] = e[i];
|
|
47
|
-
n += `${this.serialize(a, true)}:${this.serialize(l)}`, i < e.length - 1 && (n += ",");
|
|
48
|
-
}
|
|
49
|
-
return n + "}";
|
|
50
|
-
}
|
|
51
|
-
$object(t) {
|
|
52
|
-
let r = this.#t.get(t);
|
|
53
|
-
return r === void 0 && (this.#t.set(t, `#${this.#t.size}`), r = this.serializeObject(t), this.#t.set(t, r)), r;
|
|
54
|
-
}
|
|
55
|
-
$function(t) {
|
|
56
|
-
const r = Function.prototype.toString.call(t);
|
|
57
|
-
return r.slice(-15) === "[native code] }" ? `${t.name || ""}()[native]` : `${t.name}(${t.length})${r.replace(/\s*\n\s*/g, "")}`;
|
|
58
|
-
}
|
|
59
|
-
$Array(t) {
|
|
60
|
-
let r = "[";
|
|
61
|
-
for (let e = 0; e < t.length; e++) r += this.serialize(t[e]), e < t.length - 1 && (r += ",");
|
|
62
|
-
return r + "]";
|
|
63
|
-
}
|
|
64
|
-
$Date(t) {
|
|
65
|
-
try {
|
|
66
|
-
return `Date(${t.toISOString()})`;
|
|
67
|
-
} catch {
|
|
68
|
-
return "Date(null)";
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
$ArrayBuffer(t) {
|
|
72
|
-
return `ArrayBuffer[${new Uint8Array(t).join(",")}]`;
|
|
73
|
-
}
|
|
74
|
-
$Set(t) {
|
|
75
|
-
return `Set${this.$Array(Array.from(t).sort((r, e) => this.compare(r, e)))}`;
|
|
76
|
-
}
|
|
77
|
-
$Map(t) {
|
|
78
|
-
return this.serializeObjectEntries("Map", t.entries());
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
for (const s of [
|
|
82
|
-
"Error",
|
|
83
|
-
"RegExp",
|
|
84
|
-
"URL"
|
|
85
|
-
]) o.prototype["$" + s] = function(t) {
|
|
86
|
-
return `${s}(${t})`;
|
|
87
|
-
};
|
|
88
|
-
for (const s of [
|
|
89
|
-
"Int8Array",
|
|
90
|
-
"Uint8Array",
|
|
91
|
-
"Uint8ClampedArray",
|
|
92
|
-
"Int16Array",
|
|
93
|
-
"Uint16Array",
|
|
94
|
-
"Int32Array",
|
|
95
|
-
"Uint32Array",
|
|
96
|
-
"Float32Array",
|
|
97
|
-
"Float64Array"
|
|
98
|
-
]) o.prototype["$" + s] = function(t) {
|
|
99
|
-
return `${s}[${t.join(",")}]`;
|
|
100
|
-
};
|
|
101
|
-
for (const s of ["BigInt64Array", "BigUint64Array"]) o.prototype["$" + s] = function(t) {
|
|
102
|
-
return `${s}[${t.join("n,")}${t.length > 0 ? "n" : ""}]`;
|
|
103
|
-
};
|
|
104
|
-
return o;
|
|
105
|
-
}();
|
|
106
|
-
//#endregion
|
|
107
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs
|
|
108
|
-
const e = globalThis.process?.getBuiltinModule?.("crypto")?.hash;
|
|
109
|
-
const r = "sha256";
|
|
110
|
-
const s = "base64url";
|
|
111
|
-
function digest(t) {
|
|
112
|
-
if (e) return e(r, t, s);
|
|
113
|
-
const o = createHash(r).update(t);
|
|
114
|
-
return globalThis.process?.versions?.webcontainer ? o.digest().toString(s) : o.digest(s);
|
|
115
|
-
}
|
|
116
|
-
//#endregion
|
|
117
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs
|
|
118
|
-
function hash$1(input) {
|
|
119
|
-
return digest(serialize(input));
|
|
120
|
-
}
|
|
121
|
-
//#endregion
|
|
122
|
-
//#region src/utils/hash.ts
|
|
123
|
-
/**
|
|
124
|
-
* Stable, deterministic hash of any structured-cloneable value.
|
|
125
|
-
*/
|
|
126
|
-
function hash(value) {
|
|
127
|
-
return hash$1(value);
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
4
|
//#region ../../node_modules/.pnpm/yocto-queue@1.2.2/node_modules/yocto-queue/index.js
|
|
131
5
|
var Node = class {
|
|
132
6
|
value;
|
|
@@ -254,35 +128,6 @@ function validateConcurrency(concurrency) {
|
|
|
254
128
|
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
255
129
|
}
|
|
256
130
|
//#endregion
|
|
257
|
-
//#region src/rpc/validation.ts
|
|
258
|
-
/**
|
|
259
|
-
* Validates RPC function definitions.
|
|
260
|
-
* Action and event functions cannot have dumps (side effects should not be cached).
|
|
261
|
-
*
|
|
262
|
-
* @throws {Error} If an action or event function has a dump configuration
|
|
263
|
-
*/
|
|
264
|
-
function validateDefinitions(definitions) {
|
|
265
|
-
for (const definition of definitions) {
|
|
266
|
-
const type = definition.type || "query";
|
|
267
|
-
if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027({
|
|
268
|
-
name: definition.name,
|
|
269
|
-
type
|
|
270
|
-
});
|
|
271
|
-
if (definition.snapshot && type !== "query") throw diagnostics.DF0028({
|
|
272
|
-
name: definition.name,
|
|
273
|
-
type
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Validates a single RPC function definition.
|
|
279
|
-
*
|
|
280
|
-
* @throws {Error} If an action or event function has a dump configuration
|
|
281
|
-
*/
|
|
282
|
-
function validateDefinition(definition) {
|
|
283
|
-
validateDefinitions([definition]);
|
|
284
|
-
}
|
|
285
|
-
//#endregion
|
|
286
131
|
//#region src/rpc/dump/error.ts
|
|
287
132
|
/**
|
|
288
133
|
* Normalize a thrown value into a plain object suitable for storage in
|
|
@@ -498,114 +343,6 @@ function getDefinitionsWithDumps(definitions) {
|
|
|
498
343
|
return definitions.filter((def) => def.dump !== void 0);
|
|
499
344
|
}
|
|
500
345
|
//#endregion
|
|
501
|
-
//#region src/rpc/validate-io.ts
|
|
502
|
-
/**
|
|
503
|
-
* Run a single [Standard Schema](https://standardschema.dev) validator,
|
|
504
|
-
* awaiting the result when the validator is asynchronous.
|
|
505
|
-
*/
|
|
506
|
-
async function runStandardSchema(schema, value) {
|
|
507
|
-
const result = schema["~standard"].validate(value);
|
|
508
|
-
return result instanceof Promise ? await result : result;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Render Standard Schema issues into a single human-readable line for a
|
|
512
|
-
* diagnostic message, prefixing each with its dotted path when present.
|
|
513
|
-
*/
|
|
514
|
-
function formatIssues(issues) {
|
|
515
|
-
return issues.map((issue) => {
|
|
516
|
-
const path = issue.path?.map((segment) => typeof segment === "object" ? segment.key : segment).join(".");
|
|
517
|
-
return path ? `${path}: ${issue.message}` : issue.message;
|
|
518
|
-
}).join("; ");
|
|
519
|
-
}
|
|
520
|
-
/**
|
|
521
|
-
* Validate positional arguments against their declared schemas. Only
|
|
522
|
-
* indices with a schema are checked; extra arguments pass through
|
|
523
|
-
* untouched. Throws `DF0038` on the first failing argument.
|
|
524
|
-
*
|
|
525
|
-
* Validation guards the payload without rewriting it: the original values
|
|
526
|
-
* are handed to the handler unchanged, so a schema that describes a subset
|
|
527
|
-
* of an object never silently strips the sender's extra fields (and any
|
|
528
|
-
* declared transforms stay a purely type-level concern).
|
|
529
|
-
*
|
|
530
|
-
* @internal
|
|
531
|
-
*/
|
|
532
|
-
async function validateRpcArgs(name, argsSchema, args) {
|
|
533
|
-
const original = args.slice();
|
|
534
|
-
if (!argsSchema || argsSchema.length === 0) return original;
|
|
535
|
-
for (let index = 0; index < argsSchema.length; index++) {
|
|
536
|
-
const schema = argsSchema[index];
|
|
537
|
-
if (!schema) continue;
|
|
538
|
-
const result = await runStandardSchema(schema, args[index]);
|
|
539
|
-
if (result.issues) throw diagnostics.DF0043({
|
|
540
|
-
name,
|
|
541
|
-
index,
|
|
542
|
-
issues: formatIssues(result.issues)
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
return original;
|
|
546
|
-
}
|
|
547
|
-
/**
|
|
548
|
-
* Validate a handler's resolved return value against its declared schema.
|
|
549
|
-
* Throws `DF0039` when the value fails the schema, otherwise returns the
|
|
550
|
-
* original value unchanged (guard-only, never rewriting the payload — see
|
|
551
|
-
* {@link validateRpcArgs}). Passes through when no return schema is set.
|
|
552
|
-
*
|
|
553
|
-
* @internal
|
|
554
|
-
*/
|
|
555
|
-
async function validateRpcReturn(name, returnSchema, value) {
|
|
556
|
-
if (!returnSchema) return value;
|
|
557
|
-
const result = await runStandardSchema(returnSchema, value);
|
|
558
|
-
if (result.issues) throw diagnostics.DF0044({
|
|
559
|
-
name,
|
|
560
|
-
issues: formatIssues(result.issues)
|
|
561
|
-
});
|
|
562
|
-
return value;
|
|
563
|
-
}
|
|
564
|
-
//#endregion
|
|
565
|
-
//#region src/rpc/handler.ts
|
|
566
|
-
async function getRpcResolvedSetupResult(definition, context) {
|
|
567
|
-
if (!definition.setup) return {};
|
|
568
|
-
if (typeof context === "object" && context !== null) {
|
|
569
|
-
definition.__cache ??= /* @__PURE__ */ new WeakMap();
|
|
570
|
-
const cache = definition.__cache;
|
|
571
|
-
let promise = cache.get(context);
|
|
572
|
-
if (!promise) {
|
|
573
|
-
promise = Promise.resolve(definition.setup(context));
|
|
574
|
-
promise.catch(() => {
|
|
575
|
-
if (cache.get(context) === promise) cache.delete(context);
|
|
576
|
-
});
|
|
577
|
-
cache.set(context, promise);
|
|
578
|
-
}
|
|
579
|
-
return await promise;
|
|
580
|
-
}
|
|
581
|
-
if (!definition.__promise) {
|
|
582
|
-
const promise = Promise.resolve(definition.setup(context));
|
|
583
|
-
promise.catch(() => {
|
|
584
|
-
if (definition.__promise === promise) definition.__promise = void 0;
|
|
585
|
-
});
|
|
586
|
-
definition.__promise = promise;
|
|
587
|
-
}
|
|
588
|
-
return await definition.__promise;
|
|
589
|
-
}
|
|
590
|
-
async function getRpcHandler(definition, context) {
|
|
591
|
-
let handler = definition.handler;
|
|
592
|
-
if (!handler) {
|
|
593
|
-
const result = await getRpcResolvedSetupResult(definition, context);
|
|
594
|
-
if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
|
|
595
|
-
handler = result.handler;
|
|
596
|
-
}
|
|
597
|
-
const argsSchema = definition.args;
|
|
598
|
-
const returnSchema = definition.returns;
|
|
599
|
-
if (!argsSchema && !returnSchema) return handler;
|
|
600
|
-
const inner = handler;
|
|
601
|
-
const validating = async (...args) => {
|
|
602
|
-
const validatedArgs = await validateRpcArgs(definition.name, argsSchema, args);
|
|
603
|
-
const output = await inner(...validatedArgs);
|
|
604
|
-
return await validateRpcReturn(definition.name, returnSchema, output);
|
|
605
|
-
};
|
|
606
|
-
return validating;
|
|
607
|
-
}
|
|
608
|
-
//#endregion
|
|
609
346
|
//#region src/rpc/dump/static.ts
|
|
610
347
|
function makeDumpKey(name) {
|
|
611
348
|
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
@@ -683,4 +420,4 @@ async function collectStaticRpcDump(definitions, context) {
|
|
|
683
420
|
};
|
|
684
421
|
}
|
|
685
422
|
//#endregion
|
|
686
|
-
export {
|
|
423
|
+
export { reviveDumpError as a, getDefinitionsWithDumps as i, createClientFromDump as n, serializeDumpError as o, dumpFunctions as r, collectStaticRpcDump as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as diagnostics } from "./diagnostics-
|
|
1
|
+
import { t as diagnostics } from "./diagnostics-DLYH5oD3.mjs";
|
|
2
2
|
import fs from "node:fs";
|
|
3
3
|
import { dirname } from "pathe";
|
|
4
4
|
import process$1 from "node:process";
|
|
@@ -42,7 +42,7 @@ function createEventEmitter() {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
|
-
//#region ../../node_modules/.pnpm/immer@11.1.
|
|
45
|
+
//#region ../../node_modules/.pnpm/immer@11.1.16/node_modules/immer/dist/immer.mjs
|
|
46
46
|
var NOTHING = Symbol.for("immer-nothing");
|
|
47
47
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
48
48
|
var DRAFT_STATE = Symbol.for("immer-state");
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as DevframeRpcClientFunctions, A as DevframeSettingsRegistry, At as DevframeAgentHost, B as DevframeStorageScope, C as DevframeServiceOf, Ct as AgentResource, D as DevframeScopedNodeRpc, Dt as AgentToolInput, E as DevframeScopedNodeContext, Et as AgentTool, F as ScopedServerFunctions, G as DevframeNodeRpcSession, H as DevframeDiagnosticsDefinition, I as ScopedSharedStates, J as RpcSharedStateGetOptions, K as RpcBroadcastOptions, L as SettingsForNamespace, M as ScopedBroadcastOptions, Mt as EventEmitter, N as ScopedClientFunctions, Nt as EventUnsubscribe, O as DevframeScopedStreamingHost, Ot as AgentToolProvider, P as ScopedRpcFn, Pt as EventsMap, Q as RpcStreamingHost, R as DevframeViewHost, S as DevframeServiceId, St as AgentManifest, T as DevframeServicesRegistry, Tt as AgentResourceInput, U as DevframeDiagnosticsHost, V as DevframeDefineDiagnosticsOptions, W as DevframeDiagnosticsLogger, X as RpcStreamingChannel, Y as RpcSharedStateHost, Z as RpcStreamingChannelOptions, _ as ConnectionMeta, a as DevframeDockDefaults, b as DevframeCapabilities, c as DevframeSetupInfo, d as DevframeWsOptions, et as DevframeRpcServerFunctions, f as McpRouteOptions, g as Thenable, h as PartialWithoutId, i as DevframeDeploymentKind, j as DevframeSettingsStore, jt as DevframeAgentHostEvents, k as DevframeSettings, kt as AgentToolProviderHandle, l as DevframeSpaOptions, m as EntriesToObject, n as DevframeCliOptions, o as DevframeDuplicationStrategy, q as RpcFunctionsHost, r as DevframeDefinition, s as DevframeRuntime, t as DevframeBrowserContext, tt as DevframeRpcSharedStates, u as DevframeSseOptions, v as ConnectionMetaSse, w as DevframeServicesHost, wt as AgentResourceContent, x as DevframeNodeContext, xt as AgentHandle, y as ConnectionMetaWebsocket, z as DevframeHost } from "../devframe-Bdd9YXTy.mjs";
|
|
2
2
|
import { g as RpcFunctionAgentOptions } from "../types-CnJSgRVa.mjs";
|
|
3
|
-
import {
|
|
4
|
-
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, AgentToolProvider, AgentToolProviderHandle, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable
|
|
3
|
+
import { d as DevframeRpcConnection, f as DevframeRpcConnectionRequest, p as DevframeRpcTransportKind, u as DevframeNodeRpcSessionMeta } from "../ws-server-Ces08fjP.mjs";
|
|
4
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, AgentToolProvider, AgentToolProviderHandle, ConnectionMeta, ConnectionMetaSse, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDockDefaults, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, type DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, type DevframeRpcConnection, type DevframeRpcConnectionRequest, DevframeRpcServerFunctions, DevframeRpcSharedStates, type DevframeRpcTransportKind, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeServiceId, DevframeServiceOf, DevframeServicesHost, DevframeServicesRegistry, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeSseOptions, DevframeStorageScope, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, McpRouteOptions, PartialWithoutId, RpcBroadcastOptions, type RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedRpcFn, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable };
|
package/dist/types/index.mjs
CHANGED
package/dist/utils/events.d.mts
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
-
key = keys[i];
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
-
value: mod,
|
|
22
|
-
enumerable: true
|
|
23
|
-
}) : target, mod));
|
|
24
|
-
var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
|
|
25
|
-
//#endregion
|
|
1
|
+
import { i as __toESM, r as __require, t as __commonJSMin } from "../rolldown-runtime-JspESFgx.mjs";
|
|
26
2
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
27
3
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
28
4
|
let p = process || {};
|
package/dist/utils/open.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as open } from "../open-
|
|
1
|
+
import { t as open } from "../open-Dz4V4irZ.mjs";
|
|
2
2
|
export { open };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createReadStream } from "node:fs";
|
|
2
2
|
import { extname, join, normalize, resolve, sep } from "pathe";
|
|
3
|
-
import { H3, defineHandler } from "h3";
|
|
4
3
|
import { stat } from "node:fs/promises";
|
|
4
|
+
import { H3, defineHandler } from "h3";
|
|
5
5
|
import { Readable } from "node:stream";
|
|
6
6
|
import { lookup } from "mrmime";
|
|
7
7
|
//#region src/utils/serve-static.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _t as
|
|
1
|
+
import { _t as SharedStateEvents, bt as createSharedState, dt as Immutable, ft as ImmutableArray, gt as SharedState, ht as ImmutableSet, mt as ImmutableObject, pt as ImmutableMap, vt as SharedStateOptions, yt as SharedStatePatch } from "../devframe-Bdd9YXTy.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createSharedState } from "../shared-state-
|
|
1
|
+
import { t as createSharedState } from "../shared-state-fRRbRUtD.mjs";
|
|
2
2
|
export { createSharedState };
|
|
@@ -1,2 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
+
//#region src/utils/simple-schema.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* A tiny, zero-dependency [Standard Schema](https://standardschema.dev/)
|
|
5
|
+
* builder.
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ **Discouraged for app code.** This is a deliberately minimal,
|
|
8
|
+
* best-effort validator that exists only so devframe's own first-party
|
|
9
|
+
* packages (recipes, built-in plugins) can declare `args`/`returns`/flag
|
|
10
|
+
* schemas without taking on a validator dependency. It implements a small
|
|
11
|
+
* subset of primitives and approximates refinements — it is not a
|
|
12
|
+
* general-purpose validator.
|
|
13
|
+
*
|
|
14
|
+
* For your own code, prefer a real Standard Schema validator — **valibot**,
|
|
15
|
+
* **zod**, or **arktype**. Devframe's RPC and CLI-flag layers accept any of
|
|
16
|
+
* them; install the one you like and use it directly:
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import * as v from 'valibot' // npm i valibot
|
|
20
|
+
*
|
|
21
|
+
* defineRpcFunction({
|
|
22
|
+
* name: 'greet',
|
|
23
|
+
* args: [v.object({ name: v.string() })],
|
|
24
|
+
* returns: v.string(),
|
|
25
|
+
* handler: ({ name }) => `hi ${name}`,
|
|
26
|
+
* })
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
/**
|
|
30
|
+
* A Standard Schema produced by the {@link s} builder. It carries a
|
|
31
|
+
* duck-typed `type` marker (and `wrapped` for wrappers) alongside the
|
|
32
|
+
* standard `~standard` prop so the CLI-flags adapter can introspect the
|
|
33
|
+
* schema kind without importing any validator.
|
|
34
|
+
*/
|
|
35
|
+
interface SimpleSchema<Input, Output = Input> extends StandardSchemaV1<Input, Output> {
|
|
36
|
+
/** Schema kind marker, e.g. `'string'`, `'boolean'`, `'optional'`. */
|
|
37
|
+
readonly type: string;
|
|
38
|
+
/** Inner schema for wrapper kinds (`optional` / `nullable`). */
|
|
39
|
+
readonly wrapped?: StandardSchemaV1;
|
|
40
|
+
/** Optional human description (surfaced as CLI option help). */
|
|
41
|
+
readonly description?: string;
|
|
42
|
+
}
|
|
43
|
+
/** Any string. */
|
|
44
|
+
declare function string(): SimpleSchema<string>;
|
|
45
|
+
/** A finite number (rejects `NaN`). */
|
|
46
|
+
declare function number(): SimpleSchema<number>;
|
|
47
|
+
/** A boolean. */
|
|
48
|
+
declare function boolean(): SimpleSchema<boolean>;
|
|
49
|
+
/** `undefined` — mirrors valibot's `void`. */
|
|
50
|
+
declare function voidType(): SimpleSchema<void>;
|
|
51
|
+
/** `null`. */
|
|
52
|
+
declare function nullType(): SimpleSchema<null>;
|
|
53
|
+
/** One of a fixed set of literal values. */
|
|
54
|
+
declare function picklist<const T extends readonly (string | number | boolean)[]>(values: T): SimpleSchema<T[number]>;
|
|
55
|
+
/** A single literal value (string / number / boolean). */
|
|
56
|
+
declare function literal<const T extends string | number | boolean>(value: T): SimpleSchema<T>;
|
|
57
|
+
/** A value matching any one of the given schemas. */
|
|
58
|
+
declare function union<const T extends readonly StandardSchemaV1[]>(options: T): SimpleSchema<StandardSchemaV1.InferInput<T[number]>, StandardSchemaV1.InferOutput<T[number]>>;
|
|
59
|
+
/** A record with string keys whose values each satisfy the value schema. */
|
|
60
|
+
declare function record<V extends StandardSchemaV1>(_key: StandardSchemaV1, value: V): SimpleSchema<Record<string, StandardSchemaV1.InferInput<V>>, Record<string, StandardSchemaV1.InferOutput<V>>>;
|
|
61
|
+
/** An array whose every element satisfies the item schema. */
|
|
62
|
+
declare function array<T extends StandardSchemaV1>(item: T): SimpleSchema<StandardSchemaV1.InferInput<T>[], StandardSchemaV1.InferOutput<T>[]>;
|
|
63
|
+
/** Flatten an intersection into a single object literal for readable types. */
|
|
64
|
+
type Prettify<T> = { [K in keyof T]: T[K]; } & {};
|
|
65
|
+
/**
|
|
66
|
+
* Map a shape to its object type, turning fields whose type includes
|
|
67
|
+
* `undefined` (i.e. `optional()`) into optional keys — mirroring how
|
|
68
|
+
* valibot/zod render `optional` object entries.
|
|
69
|
+
*/
|
|
70
|
+
type InferField<T extends StandardSchemaV1, Mode extends 'input' | 'output'> = Mode extends 'input' ? StandardSchemaV1.InferInput<T> : StandardSchemaV1.InferOutput<T>;
|
|
71
|
+
type InferObject<T extends Record<string, StandardSchemaV1>, Mode extends 'input' | 'output'> = Prettify<{ [K in keyof T as undefined extends InferField<T[K], Mode> ? never : K]: InferField<T[K], Mode>; } & { [K in keyof T as undefined extends InferField<T[K], Mode> ? K : never]?: InferField<T[K], Mode>; }>;
|
|
72
|
+
/** An object whose known keys each satisfy their schema (extra keys are kept). */
|
|
73
|
+
declare function object<T extends Record<string, StandardSchemaV1>>(shape: T): SimpleSchema<InferObject<T, 'input'>, InferObject<T, 'output'>>;
|
|
74
|
+
/** Allow `undefined` in addition to the inner schema. */
|
|
75
|
+
declare function optional<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | undefined, StandardSchemaV1.InferOutput<T> | undefined>;
|
|
76
|
+
/** Allow `null` in addition to the inner schema. */
|
|
77
|
+
declare function nullable<T extends StandardSchemaV1>(inner: T): SimpleSchema<StandardSchemaV1.InferInput<T> | null, StandardSchemaV1.InferOutput<T> | null>;
|
|
78
|
+
/** Attach a human-readable description (used for CLI option help). */
|
|
79
|
+
declare function describe<T extends SimpleSchema<any, any>>(schema: T, description: string): T;
|
|
80
|
+
/**
|
|
81
|
+
* Grouped access to every builder — `s.string()`, `s.object({ ... })`,
|
|
82
|
+
* `s.void()`, etc. Handy for a valibot-like `import { s } from
|
|
83
|
+
* 'devframe/utils/simple-schema'` call site.
|
|
84
|
+
*/
|
|
85
|
+
declare const s: {
|
|
86
|
+
readonly string: typeof string;
|
|
87
|
+
readonly number: typeof number;
|
|
88
|
+
readonly boolean: typeof boolean;
|
|
89
|
+
readonly void: typeof voidType;
|
|
90
|
+
readonly null: typeof nullType;
|
|
91
|
+
readonly literal: typeof literal;
|
|
92
|
+
readonly picklist: typeof picklist;
|
|
93
|
+
readonly union: typeof union;
|
|
94
|
+
readonly record: typeof record;
|
|
95
|
+
readonly array: typeof array;
|
|
96
|
+
readonly object: typeof object;
|
|
97
|
+
readonly optional: typeof optional;
|
|
98
|
+
readonly nullable: typeof nullable;
|
|
99
|
+
readonly describe: typeof describe;
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
2
102
|
export { SimpleSchema, array, boolean, describe, literal, nullType, nullable, number, object, optional, picklist, record, s, string, union, voidType };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { at as
|
|
1
|
+
import { at as StreamErrorPayload, ct as StreamSinkEvents, it as CreateStreamSinkOptions, lt as createStreamReader, nt as BufferedChunk, ot as StreamReader, rt as CreateStreamReaderOptions, st as StreamSink, ut as createStreamSink } from "../devframe-Bdd9YXTy.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|