devframe 0.9.0 → 0.9.2
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-BPmX9fqK.d.mts → _shared-BAGBgTUO.d.mts} +1 -1
- package/dist/{_shared-CbZ_yhbz.mjs → _shared-BM3PdYli.mjs} +1 -1
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +12 -9
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +4 -3
- package/dist/adapters/dev.d.mts +3 -3
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/embedded.mjs +2 -0
- package/dist/adapters/initiate.d.mts +2 -2
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/cli/main.mjs +2 -2
- package/dist/client/index.d.mts +48 -2
- package/dist/client/index.mjs +133 -23
- package/dist/constants.d.mts +74 -2
- package/dist/constants.mjs +9 -2
- package/dist/{context-xdynGSLP.mjs → context-af2w_F0_.mjs} +2 -2
- package/dist/{context-B3YUu_95.d.mts → context-al99DDJ8.d.mts} +1 -1
- package/dist/{context-CEe4PBz1.mjs → context-riPPHGiu.mjs} +339 -26
- package/dist/{dev--rAPzbvO.mjs → dev-BKm_HisC.mjs} +15 -11
- package/dist/{devframe-DJMg0WLe.d.mts → devframe-mbfgpQQC.d.mts} +774 -587
- package/dist/{diagnostics-DOQPnQmX.mjs → diagnostics-DI1HGj2I.mjs} +20 -0
- package/dist/{dist-eNI9qM_I.mjs → dist-CZXfGEkd.mjs} +1 -1
- package/dist/events-DKfSmoTj.mjs +65 -0
- package/dist/hash-DdPnc4k3.mjs +360 -0
- package/dist/{host-agent-xLCSe65D.mjs → host-agent-DVDLqjvj.mjs} +14 -13
- package/dist/{http-DYpK0cUi.mjs → http-POepPnaQ.mjs} +10 -6
- package/dist/{index-CB-fSUyn.d.mts → index-Dipgo9ji.d.mts} +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/{instance-registry-WvQkt42E.mjs → instance-registry-Dy28drtm.mjs} +4 -4
- package/dist/{instance-shell-CMFyszWJ.mjs → instance-shell-GqTY93gC.mjs} +5 -5
- package/dist/{instance-shell-CljiKq1c.d.mts → instance-shell-mU5j5xWn.d.mts} +2 -2
- package/dist/internal/index.d.mts +40 -4
- package/dist/internal/index.mjs +7 -7
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +10 -1
- package/dist/node/index.mjs +2 -2
- package/dist/recipes/common-rpc-functions.d.mts +11 -1
- package/dist/recipes/common-rpc-functions.mjs +10 -0
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +2 -2
- package/dist/{remote-assets-nTTxY2MU.mjs → remote-assets-CqxiyltC.mjs} +18 -7
- package/dist/{revoke-DZbJ7Cl0.mjs → revoke-3Q6aDKWk.mjs} +2 -1
- package/dist/{rolldown-runtime-JspESFgx.mjs → rolldown-runtime-B4iAMlE-.mjs} +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.mjs +1 -1
- package/dist/rpc/transports/ws-bun.d.mts +1 -1
- package/dist/rpc/transports/ws-deno.d.mts +26 -0
- package/dist/rpc/transports/ws-deno.mjs +30 -0
- package/dist/{rpc-core-DMTe-hLo.mjs → rpc-core-DRYnbxdD.mjs} +2 -2
- package/dist/{rpc-core-Cc4lucI0.d.mts → rpc-core-dV69u4lY.d.mts} +2 -2
- package/dist/{shared-state-fRRbRUtD.mjs → shared-state-DoXutg_U.mjs} +1 -1
- package/dist/{state-Cc1IeSmQ.mjs → state-CK9LjrnT.mjs} +1 -1
- package/dist/{static-BPZ1_OPA.mjs → static-DV_qUSRS.mjs} +1 -1
- package/dist/{storage-CYye7P7L.mjs → storage-BNqSAOxA.mjs} +3 -3
- package/dist/types/index.d.mts +2 -2
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/get-port.mjs +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/launch-editor.mjs +12 -11
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/remote-assets.d.mts +7 -1
- package/dist/utils/remote-assets.mjs +1 -1
- package/dist/utils/serve-static.mjs +6 -5
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/validation-YrZH6atx.mjs +311 -0
- package/package.json +4 -3
- package/skills/devframe/SKILL.md +1 -1
- package/dist/hash-KtDZYXDN.mjs +0 -266
- package/dist/validation-CpXFB6Dz.mjs +0 -266
- package/dist/{host-h3-Crkzm42q.mjs → host-h3-fRbF9yor.mjs} +1 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { t as diagnostics } from "./diagnostics-CD8nlgll.mjs";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
//#region ../../node_modules/.pnpm/ohash@2.0.12/node_modules/ohash/dist/_chunks/is-equal.mjs
|
|
4
|
+
function serialize(input) {
|
|
5
|
+
if (typeof input === "string") return `'${input}'`;
|
|
6
|
+
return new Serializer().serialize(input);
|
|
7
|
+
}
|
|
8
|
+
const asciiOrder = " _-,;:!?.'\"()[]{}@*/\\&#%`^+<=>|~$0123456789abcdefghijklmnopqrstuvwxyz";
|
|
9
|
+
const asciiWeights = /*@__PURE__*/ (function() {
|
|
10
|
+
const weights = /* @__PURE__ */ new Uint8Array(128);
|
|
11
|
+
for (let i = 0; i < 69; i++) weights[asciiOrder.charCodeAt(i)] = i + 1;
|
|
12
|
+
for (let code = 65; code <= 90; code++) weights[code] = weights[code + 32];
|
|
13
|
+
return weights;
|
|
14
|
+
})();
|
|
15
|
+
function compareStrings(a, b) {
|
|
16
|
+
if (a === b) return 0;
|
|
17
|
+
const length = Math.min(a.length, b.length);
|
|
18
|
+
let tieBreaker = 0;
|
|
19
|
+
for (let i = 0; i < length; i++) {
|
|
20
|
+
const codeA = a.charCodeAt(i);
|
|
21
|
+
const codeB = b.charCodeAt(i);
|
|
22
|
+
if (codeA === codeB) continue;
|
|
23
|
+
const weightA = codeA < 128 && asciiWeights[codeA] ? asciiWeights[codeA] : codeA + 128;
|
|
24
|
+
const weightB = codeB < 128 && asciiWeights[codeB] ? asciiWeights[codeB] : codeB + 128;
|
|
25
|
+
if (weightA !== weightB) return weightA < weightB ? -1 : 1;
|
|
26
|
+
if (tieBreaker === 0) tieBreaker = codeA > codeB ? -1 : 1;
|
|
27
|
+
}
|
|
28
|
+
if (a.length !== b.length) return a.length < b.length ? -1 : 1;
|
|
29
|
+
return tieBreaker;
|
|
30
|
+
}
|
|
31
|
+
const Serializer = /*@__PURE__*/ (function() {
|
|
32
|
+
class Serializer {
|
|
33
|
+
#context = /* @__PURE__ */ new Map();
|
|
34
|
+
compare(a, b) {
|
|
35
|
+
const typeA = typeof a;
|
|
36
|
+
const typeB = typeof b;
|
|
37
|
+
if (typeA === "string" && typeB === "string") return compareStrings(a, b);
|
|
38
|
+
if (typeA === "number" && typeB === "number") return a - b;
|
|
39
|
+
return compareStrings(this.serialize(a, true), this.serialize(b, true));
|
|
40
|
+
}
|
|
41
|
+
serialize(value, noQuotes) {
|
|
42
|
+
if (value === null) return "null";
|
|
43
|
+
switch (typeof value) {
|
|
44
|
+
case "string": return noQuotes ? value : `'${value}'`;
|
|
45
|
+
case "bigint": return `${value}n`;
|
|
46
|
+
case "object": return this.$object(value);
|
|
47
|
+
case "function": return this.$function(value);
|
|
48
|
+
}
|
|
49
|
+
return String(value);
|
|
50
|
+
}
|
|
51
|
+
serializeObject(object) {
|
|
52
|
+
const objString = Object.prototype.toString.call(object);
|
|
53
|
+
if (objString !== "[object Object]") return this.serializeBuiltInType(objString.length < 10 ? `unknown:${objString}` : objString.slice(8, -1), object);
|
|
54
|
+
const constructor = object.constructor;
|
|
55
|
+
const objName = constructor === Object || constructor === void 0 ? "" : constructor.name;
|
|
56
|
+
if (objName !== "" && globalThis[objName] === constructor) return this.serializeBuiltInType(objName, object);
|
|
57
|
+
if ("toJSON" in object && typeof object.toJSON === "function") {
|
|
58
|
+
const json = object.toJSON();
|
|
59
|
+
return objName + (json !== null && typeof json === "object" ? this.$object(json) : `(${this.serialize(json)})`);
|
|
60
|
+
}
|
|
61
|
+
const keys = Object.keys(object).sort(compareStrings);
|
|
62
|
+
let content = `${objName}{`;
|
|
63
|
+
for (let i = 0; i < keys.length; i++) {
|
|
64
|
+
const key = keys[i];
|
|
65
|
+
content += `${key}:${this.serialize(object[key])}`;
|
|
66
|
+
if (i < keys.length - 1) content += ",";
|
|
67
|
+
}
|
|
68
|
+
return content + "}";
|
|
69
|
+
}
|
|
70
|
+
serializeBuiltInType(type, object) {
|
|
71
|
+
const handler = this["$" + type];
|
|
72
|
+
if (handler) return handler.call(this, object);
|
|
73
|
+
if (typeof object.entries === "function") return this.serializeObjectEntries(type, object.entries());
|
|
74
|
+
throw new Error(`Cannot serialize ${type}`);
|
|
75
|
+
}
|
|
76
|
+
serializeObjectEntries(type, entries) {
|
|
77
|
+
const sortedEntries = Array.from(entries).sort((a, b) => this.compare(a[0], b[0]));
|
|
78
|
+
let content = `${type}{`;
|
|
79
|
+
for (let i = 0; i < sortedEntries.length; i++) {
|
|
80
|
+
const [key, value] = sortedEntries[i];
|
|
81
|
+
content += `${this.serialize(key, true)}:${this.serialize(value)}`;
|
|
82
|
+
if (i < sortedEntries.length - 1) content += ",";
|
|
83
|
+
}
|
|
84
|
+
return content + "}";
|
|
85
|
+
}
|
|
86
|
+
$object(object) {
|
|
87
|
+
let content = this.#context.get(object);
|
|
88
|
+
if (content === void 0) {
|
|
89
|
+
this.#context.set(object, `#${this.#context.size}`);
|
|
90
|
+
content = this.serializeObject(object);
|
|
91
|
+
this.#context.set(object, content);
|
|
92
|
+
}
|
|
93
|
+
return content;
|
|
94
|
+
}
|
|
95
|
+
$function(fn) {
|
|
96
|
+
const fnStr = Function.prototype.toString.call(fn);
|
|
97
|
+
if (fnStr.slice(-15) === "[native code] }") return `${fn.name || ""}()[native]`;
|
|
98
|
+
return `${fn.name}(${fn.length})${fnStr.replace(/\s*\n\s*/g, "")}`;
|
|
99
|
+
}
|
|
100
|
+
$Array(arr) {
|
|
101
|
+
let content = "[";
|
|
102
|
+
for (let i = 0; i < arr.length; i++) {
|
|
103
|
+
content += this.serialize(arr[i]);
|
|
104
|
+
if (i < arr.length - 1) content += ",";
|
|
105
|
+
}
|
|
106
|
+
return content + "]";
|
|
107
|
+
}
|
|
108
|
+
$Date(date) {
|
|
109
|
+
try {
|
|
110
|
+
return `Date(${date.toISOString()})`;
|
|
111
|
+
} catch {
|
|
112
|
+
return `Date(null)`;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
$ArrayBuffer(arr) {
|
|
116
|
+
return `ArrayBuffer[${new Uint8Array(arr).join(",")}]`;
|
|
117
|
+
}
|
|
118
|
+
$Set(set) {
|
|
119
|
+
return `Set${this.$Array(Array.from(set).sort((a, b) => this.compare(a, b)))}`;
|
|
120
|
+
}
|
|
121
|
+
$Map(map) {
|
|
122
|
+
return this.serializeObjectEntries("Map", map.entries());
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
for (const type of [
|
|
126
|
+
"Error",
|
|
127
|
+
"RegExp",
|
|
128
|
+
"URL"
|
|
129
|
+
]) Serializer.prototype["$" + type] = function(val) {
|
|
130
|
+
return `${type}(${val})`;
|
|
131
|
+
};
|
|
132
|
+
for (const type of [
|
|
133
|
+
"Int8Array",
|
|
134
|
+
"Uint8Array",
|
|
135
|
+
"Uint8ClampedArray",
|
|
136
|
+
"Int16Array",
|
|
137
|
+
"Uint16Array",
|
|
138
|
+
"Int32Array",
|
|
139
|
+
"Uint32Array",
|
|
140
|
+
"Float32Array",
|
|
141
|
+
"Float64Array"
|
|
142
|
+
]) Serializer.prototype["$" + type] = function(arr) {
|
|
143
|
+
return `${type}[${arr.join(",")}]`;
|
|
144
|
+
};
|
|
145
|
+
for (const type of ["BigInt64Array", "BigUint64Array"]) Serializer.prototype["$" + type] = function(arr) {
|
|
146
|
+
return `${type}[${arr.join("n,")}${arr.length > 0 ? "n" : ""}]`;
|
|
147
|
+
};
|
|
148
|
+
return Serializer;
|
|
149
|
+
})();
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region ../../node_modules/.pnpm/ohash@2.0.12/node_modules/ohash/dist/crypto/node/index.mjs
|
|
152
|
+
const fastHash = /*@__PURE__*/ (() => globalThis.process?.getBuiltinModule?.("crypto")?.hash)();
|
|
153
|
+
const algorithm = "sha256";
|
|
154
|
+
const encoding = "base64url";
|
|
155
|
+
function digest(data) {
|
|
156
|
+
if (fastHash) return fastHash(algorithm, data, encoding);
|
|
157
|
+
const h = createHash(algorithm).update(data);
|
|
158
|
+
return globalThis.process?.versions?.webcontainer ? h.digest().toString(encoding) : h.digest(encoding);
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region ../../node_modules/.pnpm/ohash@2.0.12/node_modules/ohash/dist/index.mjs
|
|
162
|
+
function hash$1(input) {
|
|
163
|
+
return digest(serialize(input));
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/utils/hash.ts
|
|
167
|
+
/**
|
|
168
|
+
* Stable, deterministic hash of any structured-cloneable value.
|
|
169
|
+
*/
|
|
170
|
+
function hash(value) {
|
|
171
|
+
return hash$1(value);
|
|
172
|
+
}
|
|
173
|
+
//#endregion
|
|
174
|
+
//#region src/rpc/validate-io.ts
|
|
175
|
+
/**
|
|
176
|
+
* Run a single [Standard Schema](https://standardschema.dev) validator,
|
|
177
|
+
* awaiting the result when the validator is asynchronous.
|
|
178
|
+
*/
|
|
179
|
+
async function runStandardSchema(schema, value) {
|
|
180
|
+
const result = schema["~standard"].validate(value);
|
|
181
|
+
return result instanceof Promise ? await result : result;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Render Standard Schema issues into a single human-readable line for a
|
|
185
|
+
* diagnostic message, prefixing each with its dotted path when present.
|
|
186
|
+
*/
|
|
187
|
+
function formatIssues(issues) {
|
|
188
|
+
return issues.map((issue) => {
|
|
189
|
+
const path = issue.path?.map((segment) => typeof segment === "object" ? segment.key : segment).join(".");
|
|
190
|
+
return path ? `${path}: ${issue.message}` : issue.message;
|
|
191
|
+
}).join("; ");
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Validate positional arguments against their declared schemas. Only
|
|
195
|
+
* indices with a schema are checked; extra arguments pass through
|
|
196
|
+
* untouched. Throws `DF0038` on the first failing argument.
|
|
197
|
+
*
|
|
198
|
+
* Validation guards the payload without rewriting it: the original values
|
|
199
|
+
* are handed to the handler unchanged, so a schema that describes a subset
|
|
200
|
+
* of an object never silently strips the sender's extra fields (and any
|
|
201
|
+
* declared transforms stay a purely type-level concern).
|
|
202
|
+
*
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
async function validateRpcArgs(name, argsSchema, args) {
|
|
206
|
+
const original = args.slice();
|
|
207
|
+
if (!argsSchema || argsSchema.length === 0) return original;
|
|
208
|
+
for (let index = 0; index < argsSchema.length; index++) {
|
|
209
|
+
const schema = argsSchema[index];
|
|
210
|
+
if (!schema) continue;
|
|
211
|
+
const result = await runStandardSchema(schema, args[index]);
|
|
212
|
+
if (result.issues) throw diagnostics.DF0043({
|
|
213
|
+
name,
|
|
214
|
+
index,
|
|
215
|
+
issues: formatIssues(result.issues)
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return original;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Validate a handler's resolved return value against its declared schema.
|
|
222
|
+
* Throws `DF0039` when the value fails the schema, otherwise returns the
|
|
223
|
+
* original value unchanged (guard-only, never rewriting the payload — see
|
|
224
|
+
* {@link validateRpcArgs}). Passes through when no return schema is set.
|
|
225
|
+
*
|
|
226
|
+
* @internal
|
|
227
|
+
*/
|
|
228
|
+
async function validateRpcReturn(name, returnSchema, value) {
|
|
229
|
+
if (!returnSchema) return value;
|
|
230
|
+
const result = await runStandardSchema(returnSchema, value);
|
|
231
|
+
if (result.issues) throw diagnostics.DF0044({
|
|
232
|
+
name,
|
|
233
|
+
issues: formatIssues(result.issues)
|
|
234
|
+
});
|
|
235
|
+
return value;
|
|
236
|
+
}
|
|
237
|
+
//#endregion
|
|
238
|
+
//#region src/rpc/handler.ts
|
|
239
|
+
async function getRpcResolvedSetupResult(definition, context) {
|
|
240
|
+
if (!definition.setup) return {};
|
|
241
|
+
if (typeof context === "object" && context !== null) {
|
|
242
|
+
definition.__cache ??= /* @__PURE__ */ new WeakMap();
|
|
243
|
+
const cache = definition.__cache;
|
|
244
|
+
let promise = cache.get(context);
|
|
245
|
+
if (!promise) {
|
|
246
|
+
promise = Promise.resolve(definition.setup(context));
|
|
247
|
+
promise.catch(() => {
|
|
248
|
+
if (cache.get(context) === promise) cache.delete(context);
|
|
249
|
+
});
|
|
250
|
+
cache.set(context, promise);
|
|
251
|
+
}
|
|
252
|
+
return await promise;
|
|
253
|
+
}
|
|
254
|
+
if (!definition.__promise) {
|
|
255
|
+
const promise = Promise.resolve(definition.setup(context));
|
|
256
|
+
promise.catch(() => {
|
|
257
|
+
if (definition.__promise === promise) definition.__promise = void 0;
|
|
258
|
+
});
|
|
259
|
+
definition.__promise = promise;
|
|
260
|
+
}
|
|
261
|
+
return await definition.__promise;
|
|
262
|
+
}
|
|
263
|
+
async function getRpcHandler(definition, context) {
|
|
264
|
+
let handler = definition.handler;
|
|
265
|
+
if (!handler) {
|
|
266
|
+
const result = await getRpcResolvedSetupResult(definition, context);
|
|
267
|
+
if (!result.handler) throw diagnostics.DF0024({ name: definition.name });
|
|
268
|
+
handler = result.handler;
|
|
269
|
+
}
|
|
270
|
+
const argsSchema = definition.args;
|
|
271
|
+
const returnSchema = definition.returns;
|
|
272
|
+
if (!argsSchema && !returnSchema) return handler;
|
|
273
|
+
const inner = handler;
|
|
274
|
+
const validating = async (...args) => {
|
|
275
|
+
const validatedArgs = await validateRpcArgs(definition.name, argsSchema, args);
|
|
276
|
+
const output = await inner(...validatedArgs);
|
|
277
|
+
return await validateRpcReturn(definition.name, returnSchema, output);
|
|
278
|
+
};
|
|
279
|
+
return validating;
|
|
280
|
+
}
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/rpc/validation.ts
|
|
283
|
+
/**
|
|
284
|
+
* Validates RPC function definitions.
|
|
285
|
+
* Action and event functions cannot have dumps (side effects should not be cached).
|
|
286
|
+
*
|
|
287
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
288
|
+
*/
|
|
289
|
+
function validateDefinitions(definitions) {
|
|
290
|
+
for (const definition of definitions) {
|
|
291
|
+
const type = definition.type || "query";
|
|
292
|
+
if ((type === "action" || type === "event") && definition.dump) throw diagnostics.DF0027({
|
|
293
|
+
name: definition.name,
|
|
294
|
+
type
|
|
295
|
+
});
|
|
296
|
+
if (definition.snapshot && type !== "query") throw diagnostics.DF0028({
|
|
297
|
+
name: definition.name,
|
|
298
|
+
type
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Validates a single RPC function definition.
|
|
304
|
+
*
|
|
305
|
+
* @throws {Error} If an action or event function has a dump configuration
|
|
306
|
+
*/
|
|
307
|
+
function validateDefinition(definition) {
|
|
308
|
+
validateDefinitions([definition]);
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
export { validateRpcArgs as a, getRpcResolvedSetupResult as i, validateDefinitions as n, validateRpcReturn as o, getRpcHandler as r, hash as s, validateDefinition as t };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.9.
|
|
4
|
+
"version": "0.9.2",
|
|
5
5
|
"description": "Framework for building one portable devtool integration that runs in any viewer.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"./rpc/transports/sse-client": "./dist/rpc/transports/sse-client.mjs",
|
|
42
42
|
"./rpc/transports/sse-server": "./dist/rpc/transports/sse-server.mjs",
|
|
43
43
|
"./rpc/transports/ws-bun": "./dist/rpc/transports/ws-bun.mjs",
|
|
44
|
+
"./rpc/transports/ws-deno": "./dist/rpc/transports/ws-deno.mjs",
|
|
44
45
|
"./rpc/transports/ws-client": "./dist/rpc/transports/ws-client.mjs",
|
|
45
46
|
"./rpc/transports/ws-server": "./dist/rpc/transports/ws-server.mjs",
|
|
46
47
|
"./types": "./dist/types/index.mjs",
|
|
@@ -103,11 +104,11 @@
|
|
|
103
104
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
104
105
|
"cac": "^7.0.0",
|
|
105
106
|
"get-port-please": "^3.2.0",
|
|
106
|
-
"immer": "^11.1.
|
|
107
|
+
"immer": "^11.1.17",
|
|
107
108
|
"launch-editor": "^2.14.1",
|
|
108
109
|
"mlly": "^1.8.2",
|
|
109
110
|
"obug": "^2.1.4",
|
|
110
|
-
"ohash": "^2.0.
|
|
111
|
+
"ohash": "^2.0.12",
|
|
111
112
|
"p-limit": "^7.3.1",
|
|
112
113
|
"perfect-debounce": "^2.1.0",
|
|
113
114
|
"structured-clone-es": "^2.0.1",
|
package/skills/devframe/SKILL.md
CHANGED
|
@@ -558,7 +558,7 @@ Devframe re-exports a curated set of helpers under `devframe/utils/*`. They are
|
|
|
558
558
|
| `createStreamSink` / `createStreamReader` from `devframe/utils/streaming-channel` | - | Low-level streaming primitives |
|
|
559
559
|
| `evaluateWhen` / `WhenExpression` from `devframe/utils/when` | `whenexpr` | When-clause expressions |
|
|
560
560
|
|
|
561
|
-
For "open file in editor" + "reveal in finder", prefer the
|
|
561
|
+
For "open file in editor" + "reveal in finder", prefer the `@devframes/service-open` wire service (declare `services: [{ package: '@devframes/service-open' }]` on the definition, gate client UI on `rpc.services.has(...)`) - one host-level installation shared by every plugin, with workspace-root path containment. The older `commonRpcFunctions` recipe (`devframe/recipes/common-rpc-functions`) still works but is deprecated.
|
|
562
562
|
|
|
563
563
|
## Security (secure by default)
|
|
564
564
|
|
package/dist/hash-KtDZYXDN.mjs
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
|
|
2
|
-
function serialize(o) {
|
|
3
|
-
return typeof o == "string" ? `'${o}'` : new c().serialize(o);
|
|
4
|
-
}
|
|
5
|
-
const c = /*@__PURE__*/ function() {
|
|
6
|
-
class o {
|
|
7
|
-
#t = /* @__PURE__ */ new Map();
|
|
8
|
-
compare(t, r) {
|
|
9
|
-
const e = typeof t, n = typeof r;
|
|
10
|
-
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));
|
|
11
|
-
}
|
|
12
|
-
serialize(t, r) {
|
|
13
|
-
if (t === null) return "null";
|
|
14
|
-
switch (typeof t) {
|
|
15
|
-
case "string": return r ? t : `'${t}'`;
|
|
16
|
-
case "bigint": return `${t}n`;
|
|
17
|
-
case "object": return this.$object(t);
|
|
18
|
-
case "function": return this.$function(t);
|
|
19
|
-
}
|
|
20
|
-
return String(t);
|
|
21
|
-
}
|
|
22
|
-
serializeObject(t) {
|
|
23
|
-
const r = Object.prototype.toString.call(t);
|
|
24
|
-
if (r !== "[object Object]") return this.serializeBuiltInType(r.length < 10 ? `unknown:${r}` : r.slice(8, -1), t);
|
|
25
|
-
const e = t.constructor, n = e === Object || e === void 0 ? "" : e.name;
|
|
26
|
-
if (n !== "" && globalThis[n] === e) return this.serializeBuiltInType(n, t);
|
|
27
|
-
if (typeof t.toJSON == "function") {
|
|
28
|
-
const i = t.toJSON();
|
|
29
|
-
return n + (i !== null && typeof i == "object" ? this.$object(i) : `(${this.serialize(i)})`);
|
|
30
|
-
}
|
|
31
|
-
return this.serializeObjectEntries(n, Object.entries(t));
|
|
32
|
-
}
|
|
33
|
-
serializeBuiltInType(t, r) {
|
|
34
|
-
const e = this["$" + t];
|
|
35
|
-
if (e) return e.call(this, r);
|
|
36
|
-
if (typeof r?.entries == "function") return this.serializeObjectEntries(t, r.entries());
|
|
37
|
-
throw new Error(`Cannot serialize ${t}`);
|
|
38
|
-
}
|
|
39
|
-
serializeObjectEntries(t, r) {
|
|
40
|
-
const e = Array.from(r).sort((i, a) => this.compare(i[0], a[0]));
|
|
41
|
-
let n = `${t}{`;
|
|
42
|
-
for (let i = 0; i < e.length; i++) {
|
|
43
|
-
const [a, l] = e[i];
|
|
44
|
-
n += `${this.serialize(a, true)}:${this.serialize(l)}`, i < e.length - 1 && (n += ",");
|
|
45
|
-
}
|
|
46
|
-
return n + "}";
|
|
47
|
-
}
|
|
48
|
-
$object(t) {
|
|
49
|
-
let r = this.#t.get(t);
|
|
50
|
-
return r === void 0 && (this.#t.set(t, `#${this.#t.size}`), r = this.serializeObject(t), this.#t.set(t, r)), r;
|
|
51
|
-
}
|
|
52
|
-
$function(t) {
|
|
53
|
-
const r = Function.prototype.toString.call(t);
|
|
54
|
-
return r.slice(-15) === "[native code] }" ? `${t.name || ""}()[native]` : `${t.name}(${t.length})${r.replace(/\s*\n\s*/g, "")}`;
|
|
55
|
-
}
|
|
56
|
-
$Array(t) {
|
|
57
|
-
let r = "[";
|
|
58
|
-
for (let e = 0; e < t.length; e++) r += this.serialize(t[e]), e < t.length - 1 && (r += ",");
|
|
59
|
-
return r + "]";
|
|
60
|
-
}
|
|
61
|
-
$Date(t) {
|
|
62
|
-
try {
|
|
63
|
-
return `Date(${t.toISOString()})`;
|
|
64
|
-
} catch {
|
|
65
|
-
return "Date(null)";
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
$ArrayBuffer(t) {
|
|
69
|
-
return `ArrayBuffer[${new Uint8Array(t).join(",")}]`;
|
|
70
|
-
}
|
|
71
|
-
$Set(t) {
|
|
72
|
-
return `Set${this.$Array(Array.from(t).sort((r, e) => this.compare(r, e)))}`;
|
|
73
|
-
}
|
|
74
|
-
$Map(t) {
|
|
75
|
-
return this.serializeObjectEntries("Map", t.entries());
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
for (const s of [
|
|
79
|
-
"Error",
|
|
80
|
-
"RegExp",
|
|
81
|
-
"URL"
|
|
82
|
-
]) o.prototype["$" + s] = function(t) {
|
|
83
|
-
return `${s}(${t})`;
|
|
84
|
-
};
|
|
85
|
-
for (const s of [
|
|
86
|
-
"Int8Array",
|
|
87
|
-
"Uint8Array",
|
|
88
|
-
"Uint8ClampedArray",
|
|
89
|
-
"Int16Array",
|
|
90
|
-
"Uint16Array",
|
|
91
|
-
"Int32Array",
|
|
92
|
-
"Uint32Array",
|
|
93
|
-
"Float32Array",
|
|
94
|
-
"Float64Array"
|
|
95
|
-
]) o.prototype["$" + s] = function(t) {
|
|
96
|
-
return `${s}[${t.join(",")}]`;
|
|
97
|
-
};
|
|
98
|
-
for (const s of ["BigInt64Array", "BigUint64Array"]) o.prototype["$" + s] = function(t) {
|
|
99
|
-
return `${s}[${t.join("n,")}${t.length > 0 ? "n" : ""}]`;
|
|
100
|
-
};
|
|
101
|
-
return o;
|
|
102
|
-
}();
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/js/index.mjs
|
|
105
|
-
const z = [
|
|
106
|
-
1779033703,
|
|
107
|
-
-1150833019,
|
|
108
|
-
1013904242,
|
|
109
|
-
-1521486534,
|
|
110
|
-
1359893119,
|
|
111
|
-
-1694144372,
|
|
112
|
-
528734635,
|
|
113
|
-
1541459225
|
|
114
|
-
];
|
|
115
|
-
const R = [
|
|
116
|
-
1116352408,
|
|
117
|
-
1899447441,
|
|
118
|
-
-1245643825,
|
|
119
|
-
-373957723,
|
|
120
|
-
961987163,
|
|
121
|
-
1508970993,
|
|
122
|
-
-1841331548,
|
|
123
|
-
-1424204075,
|
|
124
|
-
-670586216,
|
|
125
|
-
310598401,
|
|
126
|
-
607225278,
|
|
127
|
-
1426881987,
|
|
128
|
-
1925078388,
|
|
129
|
-
-2132889090,
|
|
130
|
-
-1680079193,
|
|
131
|
-
-1046744716,
|
|
132
|
-
-459576895,
|
|
133
|
-
-272742522,
|
|
134
|
-
264347078,
|
|
135
|
-
604807628,
|
|
136
|
-
770255983,
|
|
137
|
-
1249150122,
|
|
138
|
-
1555081692,
|
|
139
|
-
1996064986,
|
|
140
|
-
-1740746414,
|
|
141
|
-
-1473132947,
|
|
142
|
-
-1341970488,
|
|
143
|
-
-1084653625,
|
|
144
|
-
-958395405,
|
|
145
|
-
-710438585,
|
|
146
|
-
113926993,
|
|
147
|
-
338241895,
|
|
148
|
-
666307205,
|
|
149
|
-
773529912,
|
|
150
|
-
1294757372,
|
|
151
|
-
1396182291,
|
|
152
|
-
1695183700,
|
|
153
|
-
1986661051,
|
|
154
|
-
-2117940946,
|
|
155
|
-
-1838011259,
|
|
156
|
-
-1564481375,
|
|
157
|
-
-1474664885,
|
|
158
|
-
-1035236496,
|
|
159
|
-
-949202525,
|
|
160
|
-
-778901479,
|
|
161
|
-
-694614492,
|
|
162
|
-
-200395387,
|
|
163
|
-
275423344,
|
|
164
|
-
430227734,
|
|
165
|
-
506948616,
|
|
166
|
-
659060556,
|
|
167
|
-
883997877,
|
|
168
|
-
958139571,
|
|
169
|
-
1322822218,
|
|
170
|
-
1537002063,
|
|
171
|
-
1747873779,
|
|
172
|
-
1955562222,
|
|
173
|
-
2024104815,
|
|
174
|
-
-2067236844,
|
|
175
|
-
-1933114872,
|
|
176
|
-
-1866530822,
|
|
177
|
-
-1538233109,
|
|
178
|
-
-1090935817,
|
|
179
|
-
-965641998
|
|
180
|
-
];
|
|
181
|
-
const S = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
|
|
182
|
-
const r = [];
|
|
183
|
-
var k = class {
|
|
184
|
-
_data = new l();
|
|
185
|
-
_hash = new l([...z]);
|
|
186
|
-
_nDataBytes = 0;
|
|
187
|
-
_minBufferSize = 0;
|
|
188
|
-
finalize(e) {
|
|
189
|
-
e && this._append(e);
|
|
190
|
-
const s = this._nDataBytes * 8, t = this._data.sigBytes * 8;
|
|
191
|
-
return this._data.words[t >>> 5] |= 128 << 24 - t % 32, this._data.words[(t + 64 >>> 9 << 4) + 14] = Math.floor(s / 4294967296), this._data.words[(t + 64 >>> 9 << 4) + 15] = s, this._data.sigBytes = this._data.words.length * 4, this._process(), this._hash;
|
|
192
|
-
}
|
|
193
|
-
_doProcessBlock(e, s) {
|
|
194
|
-
const t = this._hash.words;
|
|
195
|
-
let i = t[0], o = t[1], a = t[2], c = t[3], h = t[4], g = t[5], f = t[6], y = t[7];
|
|
196
|
-
for (let n = 0; n < 64; n++) {
|
|
197
|
-
if (n < 16) r[n] = e[s + n] | 0;
|
|
198
|
-
else {
|
|
199
|
-
const d = r[n - 15], j = (d << 25 | d >>> 7) ^ (d << 14 | d >>> 18) ^ d >>> 3, B = r[n - 2], x = (B << 15 | B >>> 17) ^ (B << 13 | B >>> 19) ^ B >>> 10;
|
|
200
|
-
r[n] = j + r[n - 7] + x + r[n - 16];
|
|
201
|
-
}
|
|
202
|
-
const m = h & g ^ ~h & f, p = i & o ^ i & a ^ o & a, u = (i << 30 | i >>> 2) ^ (i << 19 | i >>> 13) ^ (i << 10 | i >>> 22), b = (h << 26 | h >>> 6) ^ (h << 21 | h >>> 11) ^ (h << 7 | h >>> 25), w = y + b + m + R[n] + r[n], M = u + p;
|
|
203
|
-
y = f, f = g, g = h, h = c + w | 0, c = a, a = o, o = i, i = w + M | 0;
|
|
204
|
-
}
|
|
205
|
-
t[0] = t[0] + i | 0, t[1] = t[1] + o | 0, t[2] = t[2] + a | 0, t[3] = t[3] + c | 0, t[4] = t[4] + h | 0, t[5] = t[5] + g | 0, t[6] = t[6] + f | 0, t[7] = t[7] + y | 0;
|
|
206
|
-
}
|
|
207
|
-
_append(e) {
|
|
208
|
-
typeof e == "string" && (e = l.fromUtf8(e)), this._data.concat(e), this._nDataBytes += e.sigBytes;
|
|
209
|
-
}
|
|
210
|
-
_process(e) {
|
|
211
|
-
let s, t = this._data.sigBytes / 64;
|
|
212
|
-
e ? t = Math.ceil(t) : t = Math.max((t | 0) - this._minBufferSize, 0);
|
|
213
|
-
const i = t * 16, o = Math.min(i * 4, this._data.sigBytes);
|
|
214
|
-
if (i) {
|
|
215
|
-
for (let a = 0; a < i; a += 16) this._doProcessBlock(this._data.words, a);
|
|
216
|
-
s = this._data.words.splice(0, i), this._data.sigBytes -= o;
|
|
217
|
-
}
|
|
218
|
-
return new l(s, o);
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
var l = class l {
|
|
222
|
-
words;
|
|
223
|
-
sigBytes;
|
|
224
|
-
constructor(e, s) {
|
|
225
|
-
e = this.words = e || [], this.sigBytes = s === void 0 ? e.length * 4 : s;
|
|
226
|
-
}
|
|
227
|
-
static fromUtf8(e) {
|
|
228
|
-
const s = unescape(encodeURIComponent(e)), t = s.length, i = [];
|
|
229
|
-
for (let o = 0; o < t; o++) i[o >>> 2] |= (s.charCodeAt(o) & 255) << 24 - o % 4 * 8;
|
|
230
|
-
return new l(i, t);
|
|
231
|
-
}
|
|
232
|
-
toBase64() {
|
|
233
|
-
const e = [];
|
|
234
|
-
for (let s = 0; s < this.sigBytes; s += 3) {
|
|
235
|
-
const t = this.words[s >>> 2] >>> 24 - s % 4 * 8 & 255, i = this.words[s + 1 >>> 2] >>> 24 - (s + 1) % 4 * 8 & 255, o = this.words[s + 2 >>> 2] >>> 24 - (s + 2) % 4 * 8 & 255, a = t << 16 | i << 8 | o;
|
|
236
|
-
for (let c = 0; c < 4 && s * 8 + c * 6 < this.sigBytes * 8; c++) e.push(S.charAt(a >>> 6 * (3 - c) & 63));
|
|
237
|
-
}
|
|
238
|
-
return e.join("");
|
|
239
|
-
}
|
|
240
|
-
concat(e) {
|
|
241
|
-
if (this.words[this.sigBytes >>> 2] &= 4294967295 << 32 - this.sigBytes % 4 * 8, this.words.length = Math.ceil(this.sigBytes / 4), this.sigBytes % 4) for (let s = 0; s < e.sigBytes; s++) {
|
|
242
|
-
const t = e.words[s >>> 2] >>> 24 - s % 4 * 8 & 255;
|
|
243
|
-
this.words[this.sigBytes + s >>> 2] |= t << 24 - (this.sigBytes + s) % 4 * 8;
|
|
244
|
-
}
|
|
245
|
-
else for (let s = 0; s < e.sigBytes; s += 4) this.words[this.sigBytes + s >>> 2] = e.words[s >>> 2];
|
|
246
|
-
this.sigBytes += e.sigBytes;
|
|
247
|
-
}
|
|
248
|
-
};
|
|
249
|
-
function digest(_) {
|
|
250
|
-
return new k().finalize(_).toBase64();
|
|
251
|
-
}
|
|
252
|
-
//#endregion
|
|
253
|
-
//#region ../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs
|
|
254
|
-
function hash$1(input) {
|
|
255
|
-
return digest(serialize(input));
|
|
256
|
-
}
|
|
257
|
-
//#endregion
|
|
258
|
-
//#region src/utils/hash.ts
|
|
259
|
-
/**
|
|
260
|
-
* Stable, deterministic hash of any structured-cloneable value.
|
|
261
|
-
*/
|
|
262
|
-
function hash(value) {
|
|
263
|
-
return hash$1(value);
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
export { hash as t };
|