devframe 0.2.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +5 -5
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +2 -2
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +8 -7
- package/dist/client/index.d.mts +18 -4
- package/dist/client/index.mjs +321 -8
- package/dist/{context-BDpuScNZ.d.mts → context-CwjX6sCG.d.mts} +1 -1
- package/dist/{dev-CZ9ZQkuO.mjs → dev-BbmanqL7.mjs} +1 -1
- package/dist/{devframe-DAfZWnpI.d.mts → devframe-sc4cb5xr.d.mts} +48 -90
- package/dist/diagnostics-GitRGKbr.mjs +33 -0
- package/dist/diagnostics-reporter-CBBZwoMv.mjs +38 -0
- package/dist/{rpc-BlVCyk9W.mjs → dump-zMleojnD.mjs} +147 -134
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +6 -5
- package/dist/{host-h3-DEfOpa0j.mjs → host-h3-TTunNr_n.mjs} +284 -44
- package/dist/human-id-Dq-qgtES.mjs +803 -0
- package/dist/index-C5PmWqBf.d.mts +79 -0
- package/dist/{index-BNAsgVNz.d.mts → index-CTK6fuXs.d.mts} +31 -78
- package/dist/index-DTeZXHSi.d.mts +639 -0
- package/dist/index.d.mts +4 -4
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +1 -2
- package/dist/node/index.d.mts +10 -14
- package/dist/node/index.mjs +2 -2
- package/dist/node/internal.d.mts +2 -2
- package/dist/node/internal.mjs +2 -3
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/rpc/dump.d.mts +2 -0
- package/dist/rpc/dump.mjs +2 -0
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +128 -2
- package/dist/rpc/transports/ws-client.d.mts +25 -1
- package/dist/rpc/transports/ws-client.mjs +2 -2
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -2
- package/dist/{serialization-CwO31axa.mjs → serialization-BlqLh4_J.mjs} +4 -38
- package/dist/{server-BGSrxsQb.d.mts → server-ouL4gZbu.d.mts} +1 -1
- package/dist/shared-state-CasqoUba.mjs +1019 -0
- package/dist/{shared-state-BJXkPxtf.mjs → shared-state-u0y123fi.mjs} +6 -6
- package/dist/{storage-D-jLaxDA.mjs → storage-K-OxR1xf.mjs} +5 -3
- package/dist/structured-clone-jegjz0hM.mjs +208 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- 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/utils/structured-clone.mjs +1 -1
- package/dist/{ws-server-DKlqI8XP.d.mts → ws-server-DOwLJL23.d.mts} +1 -1
- package/package.json +3 -2
- package/skills/devframe/SKILL.md +1 -1
- package/dist/diagnostics-DNxVjo6X.mjs +0 -56
- package/dist/revoke-DDa7VSJa.mjs +0 -35
- package/dist/ws-client-CrLsflnY.d.mts +0 -26
- /package/dist/{hash-CIBte1yS.mjs → hash-bwOD8RgU.mjs} +0 -0
- /package/dist/{structured-clone-CD2l4fI3.mjs → structured-clone-PdCZwt7F.mjs} +0 -0
- /package/dist/{types-DmcujDa5.d.mts → types-BXL7EIDM.d.mts} +0 -0
|
@@ -4,7 +4,7 @@ import { nanoid } from "./utils/nanoid.mjs";
|
|
|
4
4
|
var NOTHING = Symbol.for("immer-nothing");
|
|
5
5
|
var DRAFTABLE = Symbol.for("immer-draftable");
|
|
6
6
|
var DRAFT_STATE = Symbol.for("immer-state");
|
|
7
|
-
var errors =
|
|
7
|
+
var errors = [
|
|
8
8
|
function(plugin) {
|
|
9
9
|
return `The plugin for '${plugin}' has not been loaded into Immer. To enable the plugin, import and call \`enable${plugin}()\` when initializing your application.`;
|
|
10
10
|
},
|
|
@@ -31,9 +31,9 @@ var errors = process.env.NODE_ENV !== "production" ? [
|
|
|
31
31
|
function(thing) {
|
|
32
32
|
return `'original' expects a draft, got: ${thing}`;
|
|
33
33
|
}
|
|
34
|
-
]
|
|
34
|
+
];
|
|
35
35
|
function die(error, ...args) {
|
|
36
|
-
|
|
36
|
+
{
|
|
37
37
|
const e = errors[error];
|
|
38
38
|
const msg = isFunction(e) ? e.apply(null, args) : e;
|
|
39
39
|
throw new Error(`[Immer] ${msg}`);
|
|
@@ -438,11 +438,11 @@ for (let key in objectTraps) {
|
|
|
438
438
|
};
|
|
439
439
|
}
|
|
440
440
|
arrayTraps.deleteProperty = function(state, prop) {
|
|
441
|
-
if (
|
|
441
|
+
if (isNaN(parseInt(prop))) die(13);
|
|
442
442
|
return arrayTraps.set.call(this, state, prop, void 0);
|
|
443
443
|
};
|
|
444
444
|
arrayTraps.set = function(state, prop, value) {
|
|
445
|
-
if (
|
|
445
|
+
if (prop !== "length" && isNaN(parseInt(prop))) die(14);
|
|
446
446
|
return objectTraps.set.call(this, state[0], prop, value, state[0]);
|
|
447
447
|
};
|
|
448
448
|
function peek(draft, prop) {
|
|
@@ -651,7 +651,7 @@ function currentImpl(value) {
|
|
|
651
651
|
}
|
|
652
652
|
function enablePatches() {
|
|
653
653
|
const errorOffset = 16;
|
|
654
|
-
|
|
654
|
+
errors.push("Sets cannot have \"replace\" patches.", function(op) {
|
|
655
655
|
return "Unsupported patch operation: " + op;
|
|
656
656
|
}, function(path) {
|
|
657
657
|
return "Cannot apply patch, path doesn't resolve: " + path;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as createSharedState } from "./shared-state-BJXkPxtf.mjs";
|
|
1
|
+
import { i as diagnostics, t as createSharedState } from "./shared-state-CasqoUba.mjs";
|
|
3
2
|
import fs from "node:fs";
|
|
4
3
|
import { dirname } from "pathe";
|
|
5
4
|
//#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
|
|
@@ -100,7 +99,10 @@ function createStorage(options) {
|
|
|
100
99
|
const savedValue = JSON.parse(fs.readFileSync(options.filepath, "utf-8"));
|
|
101
100
|
initialValue = mergeInitialValue ? mergeInitialValue(options.initialValue, savedValue) : savedValue;
|
|
102
101
|
} catch (error) {
|
|
103
|
-
|
|
102
|
+
diagnostics.DF0012.report({
|
|
103
|
+
filepath: options.filepath,
|
|
104
|
+
cause: error
|
|
105
|
+
}, { method: "warn" });
|
|
104
106
|
initialValue = options.initialValue;
|
|
105
107
|
}
|
|
106
108
|
const state = createSharedState({
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/structured-clone-es@2.0.0/node_modules/structured-clone-es/dist/index.mjs
|
|
2
|
+
const env = typeof self === "object" ? self : globalThis;
|
|
3
|
+
function deserializer($, _) {
|
|
4
|
+
const as = (out, index) => {
|
|
5
|
+
$.set(index, out);
|
|
6
|
+
return out;
|
|
7
|
+
};
|
|
8
|
+
const unpair = (index) => {
|
|
9
|
+
if ($.has(index)) return $.get(index);
|
|
10
|
+
const [type, value] = _[index];
|
|
11
|
+
switch (type) {
|
|
12
|
+
case 0:
|
|
13
|
+
case -1: return as(value, index);
|
|
14
|
+
case 1: {
|
|
15
|
+
const arr = as([], index);
|
|
16
|
+
for (const index of value) arr.push(unpair(index));
|
|
17
|
+
return arr;
|
|
18
|
+
}
|
|
19
|
+
case 2: {
|
|
20
|
+
const object = as({}, index);
|
|
21
|
+
for (const [key, index] of value) object[unpair(key)] = unpair(index);
|
|
22
|
+
return object;
|
|
23
|
+
}
|
|
24
|
+
case 3: return as(new Date(value), index);
|
|
25
|
+
case 4: {
|
|
26
|
+
const { source, flags } = value;
|
|
27
|
+
return as(new RegExp(source, flags), index);
|
|
28
|
+
}
|
|
29
|
+
case 5: {
|
|
30
|
+
const map = as(/* @__PURE__ */ new Map(), index);
|
|
31
|
+
for (const [key, index] of value) map.set(unpair(key), unpair(index));
|
|
32
|
+
return map;
|
|
33
|
+
}
|
|
34
|
+
case 6: {
|
|
35
|
+
const set = as(/* @__PURE__ */ new Set(), index);
|
|
36
|
+
for (const index of value) set.add(unpair(index));
|
|
37
|
+
return set;
|
|
38
|
+
}
|
|
39
|
+
case 7: {
|
|
40
|
+
const { name, message } = value;
|
|
41
|
+
return as(new env[name](message), index);
|
|
42
|
+
}
|
|
43
|
+
case 8: return as(BigInt(value), index);
|
|
44
|
+
case "BigInt": return as(Object(BigInt(value)), index);
|
|
45
|
+
case "ArrayBuffer": return as(new Uint8Array(value).buffer, value);
|
|
46
|
+
case "DataView": {
|
|
47
|
+
const { buffer } = new Uint8Array(value);
|
|
48
|
+
return as(new DataView(buffer), value);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return as(new env[type](value), index);
|
|
52
|
+
};
|
|
53
|
+
return unpair;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns a deserialized value from a serialized array of Records.
|
|
57
|
+
* @param serialized a previously serialized value.
|
|
58
|
+
*/
|
|
59
|
+
function deserialize(serialized) {
|
|
60
|
+
return deserializer(/* @__PURE__ */ new Map(), serialized)(0);
|
|
61
|
+
}
|
|
62
|
+
const EMPTY = "";
|
|
63
|
+
const { toString } = {};
|
|
64
|
+
const { keys } = Object;
|
|
65
|
+
function typeOf(value) {
|
|
66
|
+
const type = typeof value;
|
|
67
|
+
if (type !== "object" || !value) return [0, type];
|
|
68
|
+
const asString = toString.call(value).slice(8, -1);
|
|
69
|
+
switch (asString) {
|
|
70
|
+
case "Array": return [1, EMPTY];
|
|
71
|
+
case "Object": return [2, EMPTY];
|
|
72
|
+
case "Date": return [3, EMPTY];
|
|
73
|
+
case "RegExp": return [4, EMPTY];
|
|
74
|
+
case "Map": return [5, EMPTY];
|
|
75
|
+
case "Set": return [6, EMPTY];
|
|
76
|
+
case "DataView": return [1, asString];
|
|
77
|
+
}
|
|
78
|
+
if (asString.includes("Array")) return [1, asString];
|
|
79
|
+
if (asString.includes("Error")) return [7, asString];
|
|
80
|
+
return [2, asString];
|
|
81
|
+
}
|
|
82
|
+
function shouldSkip([TYPE, type]) {
|
|
83
|
+
return TYPE === 0 && (type === "function" || type === "symbol");
|
|
84
|
+
}
|
|
85
|
+
function serializer(strict, json, $, _) {
|
|
86
|
+
const as = (out, value) => {
|
|
87
|
+
const index = _.push(out) - 1;
|
|
88
|
+
$.set(value, index);
|
|
89
|
+
return index;
|
|
90
|
+
};
|
|
91
|
+
const pair = (value) => {
|
|
92
|
+
if ($.has(value)) return $.get(value);
|
|
93
|
+
let [TYPE, type] = typeOf(value);
|
|
94
|
+
switch (TYPE) {
|
|
95
|
+
case 0: {
|
|
96
|
+
let entry = value;
|
|
97
|
+
switch (type) {
|
|
98
|
+
case "bigint":
|
|
99
|
+
TYPE = 8;
|
|
100
|
+
entry = value.toString();
|
|
101
|
+
break;
|
|
102
|
+
case "function":
|
|
103
|
+
case "symbol":
|
|
104
|
+
if (strict) throw new TypeError(`unable to serialize ${type}`);
|
|
105
|
+
entry = null;
|
|
106
|
+
break;
|
|
107
|
+
case "undefined": return as([-1], value);
|
|
108
|
+
}
|
|
109
|
+
return as([TYPE, entry], value);
|
|
110
|
+
}
|
|
111
|
+
case 1: {
|
|
112
|
+
if (type) {
|
|
113
|
+
let spread = value;
|
|
114
|
+
if (type === "DataView") spread = new Uint8Array(value.buffer);
|
|
115
|
+
else if (type === "ArrayBuffer") spread = new Uint8Array(value);
|
|
116
|
+
return as([type, [...spread]], value);
|
|
117
|
+
}
|
|
118
|
+
const arr = [];
|
|
119
|
+
const index = as([TYPE, arr], value);
|
|
120
|
+
for (const entry of value) arr.push(pair(entry));
|
|
121
|
+
return index;
|
|
122
|
+
}
|
|
123
|
+
case 2: {
|
|
124
|
+
if (type) switch (type) {
|
|
125
|
+
case "BigInt": return as([type, value.toString()], value);
|
|
126
|
+
case "Boolean":
|
|
127
|
+
case "Number":
|
|
128
|
+
case "String": return as([type, value.valueOf()], value);
|
|
129
|
+
}
|
|
130
|
+
if (json && "toJSON" in value) return pair(value.toJSON());
|
|
131
|
+
const entries = [];
|
|
132
|
+
const index = as([TYPE, entries], value);
|
|
133
|
+
for (const key of keys(value)) if (strict || !shouldSkip(typeOf(value[key]))) entries.push([pair(key), pair(value[key])]);
|
|
134
|
+
return index;
|
|
135
|
+
}
|
|
136
|
+
case 3: return as([TYPE, value.toISOString()], value);
|
|
137
|
+
case 4: {
|
|
138
|
+
const { source, flags } = value;
|
|
139
|
+
return as([TYPE, {
|
|
140
|
+
source,
|
|
141
|
+
flags
|
|
142
|
+
}], value);
|
|
143
|
+
}
|
|
144
|
+
case 5: {
|
|
145
|
+
const entries = [];
|
|
146
|
+
const index = as([TYPE, entries], value);
|
|
147
|
+
for (const [key, entry] of value) if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry)))) entries.push([pair(key), pair(entry)]);
|
|
148
|
+
return index;
|
|
149
|
+
}
|
|
150
|
+
case 6: {
|
|
151
|
+
const entries = [];
|
|
152
|
+
const index = as([TYPE, entries], value);
|
|
153
|
+
for (const entry of value) if (strict || !shouldSkip(typeOf(entry))) entries.push(pair(entry));
|
|
154
|
+
return index;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const { message } = value;
|
|
158
|
+
return as([TYPE, {
|
|
159
|
+
name: type,
|
|
160
|
+
message
|
|
161
|
+
}], value);
|
|
162
|
+
};
|
|
163
|
+
return pair;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns an array of serialized Records.
|
|
167
|
+
*/
|
|
168
|
+
function serialize(value, options = {}) {
|
|
169
|
+
const _ = [];
|
|
170
|
+
serializer(!(options.json || options.lossy), !!options.json, /* @__PURE__ */ new Map(), _)(value);
|
|
171
|
+
return _;
|
|
172
|
+
}
|
|
173
|
+
const { parse: $parse, stringify: $stringify } = JSON;
|
|
174
|
+
const options = {
|
|
175
|
+
json: true,
|
|
176
|
+
lossy: true
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* Revive a previously stringified structured clone.
|
|
180
|
+
* @param str previously stringified data as string.
|
|
181
|
+
*/
|
|
182
|
+
function parse(str) {
|
|
183
|
+
return deserialize($parse(str));
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Represent a structured clone value as string.
|
|
187
|
+
* @param any some clone-able value to stringify.
|
|
188
|
+
*/
|
|
189
|
+
function stringify(any) {
|
|
190
|
+
return $stringify(serialize(any, options));
|
|
191
|
+
}
|
|
192
|
+
//#endregion
|
|
193
|
+
//#region src/utils/structured-clone.ts
|
|
194
|
+
/**
|
|
195
|
+
* Serialize a structured-cloneable value to a single string. Equivalent
|
|
196
|
+
* to `JSON.stringify(structuredCloneSerialize(value))`.
|
|
197
|
+
*/
|
|
198
|
+
function structuredCloneStringify(value) {
|
|
199
|
+
return stringify(value);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Inverse of {@link structuredCloneStringify}.
|
|
203
|
+
*/
|
|
204
|
+
function structuredCloneParse(value) {
|
|
205
|
+
return parse(value);
|
|
206
|
+
}
|
|
207
|
+
//#endregion
|
|
208
|
+
export { structuredCloneStringify as n, structuredCloneParse as t };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as RpcFunctionAgentOptions } from "../types-
|
|
3
|
-
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-
|
|
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 };
|
|
1
|
+
import { A as DevToolsDiagnosticsDefinition, B as DevToolsAgentHost, C as PartialWithoutId, D as DevToolsRpcSharedStates, E as DevToolsRpcServerFunctions, F as AgentResource, H as EventEmitter, I as AgentResourceContent, L as AgentResourceInput, M as DevToolsDiagnosticsLogger, N as AgentHandle, O as DevToolsHost, P as AgentManifest, R as AgentTool, S as EntriesToObject, T as DevToolsRpcClientFunctions, U as EventUnsubscribe, V as DevToolsAgentHostEvents, W as EventsMap, _ as RpcStreamingChannel, a as DevframeRuntime, c as defineDevframe, d as DevToolsNodeContext, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, j as DevToolsDiagnosticsHost, k as DevToolsDefineDiagnosticsOptions, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, o as DevframeSetupInfo, p as RpcBroadcastOptions, r as DevframeDefinition, s as DevframeSpaOptions, t as DevframeBrowserContext, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, w as Thenable, x as DevToolsViewHost, y as RpcStreamingHost, z as AgentToolInput } from "../devframe-sc4cb5xr.mjs";
|
|
2
|
+
import { h as RpcFunctionAgentOptions } from "../types-BXL7EIDM.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DOwLJL23.mjs";
|
|
4
|
+
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, DevToolsAgentHost, DevToolsAgentHostEvents, DevToolsCapabilities, DevToolsDefineDiagnosticsOptions, DevToolsDiagnosticsDefinition, DevToolsDiagnosticsHost, DevToolsDiagnosticsLogger, DevToolsHost, DevToolsNodeContext, DevToolsNodeRpcSession, DevToolsNodeRpcSessionMeta, DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, DevToolsRpcSharedStates, DevToolsViewHost, DevframeBrowserContext, DevframeCliOptions, DevframeDefinition, DevframeDeploymentKind, DevframeRuntime, DevframeSetupInfo, DevframeSpaOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, Thenable, defineDevframe };
|
package/dist/utils/events.d.mts
CHANGED
package/dist/utils/hash.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as hash } from "../hash-
|
|
1
|
+
import { t as hash } from "../hash-bwOD8RgU.mjs";
|
|
2
2
|
export { hash };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as createSharedState, S as SharedStatePatch, _ as ImmutableObject, b as SharedStateEvents, g as ImmutableMap, h as ImmutableArray, m as Immutable, v as ImmutableSet, x as SharedStateOptions, y as SharedState } from "../index-DTeZXHSi.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-u0y123fi.mjs";
|
|
2
2
|
export { createSharedState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as BufferedChunk, c as StreamErrorPayload, d as StreamSinkEvents, f as createStreamReader, l as StreamReader, o as CreateStreamReaderOptions, p as createStreamSink, s as CreateStreamSinkOptions, u as StreamSink } from "../index-DTeZXHSi.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as structuredCloneStringify, n as structuredCloneParse, r as structuredCloneSerialize, t as structuredCloneDeserialize } from "../structured-clone-
|
|
1
|
+
import { i as structuredCloneStringify, n as structuredCloneParse, r as structuredCloneSerialize, t as structuredCloneDeserialize } from "../structured-clone-PdCZwt7F.mjs";
|
|
2
2
|
export { structuredCloneDeserialize, structuredCloneParse, structuredCloneSerialize, structuredCloneStringify };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as RpcFunctionDefinitionAny } from "./types-
|
|
1
|
+
import { _ as RpcFunctionDefinitionAny } from "./types-BXL7EIDM.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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.3.0",
|
|
5
5
|
"description": "Framework for building generic DevTools",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"./recipes/open-helpers": "./dist/recipes/open-helpers.mjs",
|
|
35
35
|
"./rpc": "./dist/rpc/index.mjs",
|
|
36
36
|
"./rpc/client": "./dist/rpc/client.mjs",
|
|
37
|
+
"./rpc/dump": "./dist/rpc/dump.mjs",
|
|
37
38
|
"./rpc/server": "./dist/rpc/server.mjs",
|
|
38
39
|
"./rpc/transports/ws-client": "./dist/rpc/transports/ws-client.mjs",
|
|
39
40
|
"./rpc/transports/ws-server": "./dist/rpc/transports/ws-server.mjs",
|
|
@@ -71,8 +72,8 @@
|
|
|
71
72
|
"birpc": "^4.0.0",
|
|
72
73
|
"cac": "^7.0.0",
|
|
73
74
|
"h3": "2.0.1-rc.22",
|
|
74
|
-
"logs-sdk": "^0.0.6",
|
|
75
75
|
"mrmime": "^2.0.1",
|
|
76
|
+
"nostics": "^0.1.0",
|
|
76
77
|
"pathe": "^2.0.3",
|
|
77
78
|
"valibot": "^1.4.0",
|
|
78
79
|
"ws": "^8.20.0"
|
package/skills/devframe/SKILL.md
CHANGED
|
@@ -84,7 +84,7 @@ See `templates/counter-devframe.ts` for a runnable counter example, `templates/s
|
|
|
84
84
|
|------|---------|
|
|
85
85
|
| `ctx.rpc` | Register RPC functions, broadcast, shared state, streaming channels |
|
|
86
86
|
| `ctx.views` | Serve static files via `hostStatic(base, distDir)` |
|
|
87
|
-
| `ctx.diagnostics` | Structured diagnostics host (
|
|
87
|
+
| `ctx.diagnostics` | Structured diagnostics host (nostics) — register custom error codes |
|
|
88
88
|
| `ctx.agent` | Expose tools + resources to coding agents (experimental) |
|
|
89
89
|
| `ctx.host` | Runtime abstraction — `mountStatic`, `resolveOrigin`, `getStorageDir` |
|
|
90
90
|
| `ctx.mode` | `'dev'` or `'build'` — gate setup work per runtime |
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { colors } from "./utils/colors.mjs";
|
|
2
|
-
import { consoleReporter, createLogger, defineDiagnostics } from "logs-sdk";
|
|
3
|
-
import { ansiFormatter } from "logs-sdk/formatters/ansi";
|
|
4
|
-
//#region src/node/diagnostics.ts
|
|
5
|
-
const diagnostics = defineDiagnostics({
|
|
6
|
-
docsBase: "https://devfra.me/errors",
|
|
7
|
-
codes: {
|
|
8
|
-
DF0006: { message: (p) => `RPC function "${p.name}" is not registered` },
|
|
9
|
-
DF0007: { message: "AsyncLocalStorage is not set, it likely to be an internal bug of the DevTools foundation" },
|
|
10
|
-
DF0008: { message: (p) => `distDir ${p.distDir} does not exist` },
|
|
11
|
-
DF0012: {
|
|
12
|
-
message: (p) => `Failed to parse storage file: ${p.filepath}, falling back to defaults.`,
|
|
13
|
-
level: "warn"
|
|
14
|
-
},
|
|
15
|
-
DF0013: { message: (p) => `Shared state of "${p.key}" is not found, please provide an initial value for the first time` },
|
|
16
|
-
DF0014: {
|
|
17
|
-
message: (p) => `RPC function "${p.name}" has an invalid \`agent\` field — \`description\` must be a non-empty string.`,
|
|
18
|
-
hint: "Provide a short description (~1–3 sentences) explaining what the tool does and when agents should invoke it."
|
|
19
|
-
},
|
|
20
|
-
DF0015: {
|
|
21
|
-
message: (p) => `Agent tool "${p.id}" is already registered.`,
|
|
22
|
-
hint: "Tool ids must be unique across RPC functions with an `agent` field and tools registered via `ctx.agent.registerTool()`."
|
|
23
|
-
},
|
|
24
|
-
DF0016: { message: (p) => `Agent resource "${p.id}" is already registered.` },
|
|
25
|
-
DF0017: { message: (p) => `Failed to start MCP server (${p.transport}): ${p.reason}` },
|
|
26
|
-
DF0029: {
|
|
27
|
-
message: (p) => `Stream "${p.channel}#${p.id}" dropped ${p.dropped} chunk(s) after exceeding the client high-water mark.`,
|
|
28
|
-
hint: "The consumer is too slow for the producer. Raise `highWaterMark` on the subscription, slow the producer, or batch chunks.",
|
|
29
|
-
level: "warn"
|
|
30
|
-
},
|
|
31
|
-
DF0030: {
|
|
32
|
-
message: (p) => `Stream "${p.channel}#${p.id}" is unknown — no producer has called \`channel.start({ id: "${p.id}" })\`.`,
|
|
33
|
-
hint: "Ensure the server-side producer is running before clients subscribe, or check for typos in the stream id."
|
|
34
|
-
},
|
|
35
|
-
DF0031: {
|
|
36
|
-
message: (p) => `Cannot write to closed stream "${p.channel}#${p.id}".`,
|
|
37
|
-
hint: "Track the producer lifecycle — guard writes with the `stream.signal.aborted` flag."
|
|
38
|
-
},
|
|
39
|
-
DF0032: {
|
|
40
|
-
message: (p) => `Streaming channel "${p.channel}" is already registered.`,
|
|
41
|
-
hint: "Each channel name must be unique within a context. Pick a different name or reuse the existing channel handle."
|
|
42
|
-
},
|
|
43
|
-
DF0033: {
|
|
44
|
-
message: (p) => `Failed to start dev RPC bridge for "${p.id}": ${p.reason}`,
|
|
45
|
-
hint: "Verify the bridge port is free and the devframe setup function does not throw. Pin a port via `cli.port` / `cli.portRange` on the definition, or via `devMiddleware.port` on `viteDevBridge`.",
|
|
46
|
-
level: "warn"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
const logger = createLogger({
|
|
51
|
-
diagnostics: [diagnostics],
|
|
52
|
-
formatter: ansiFormatter(colors),
|
|
53
|
-
reporters: consoleReporter
|
|
54
|
-
});
|
|
55
|
-
//#endregion
|
|
56
|
-
export { logger as n, diagnostics as t };
|
package/dist/revoke-DDa7VSJa.mjs
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
//#region src/node/auth/revoke.ts
|
|
2
|
-
/**
|
|
3
|
-
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
4
|
-
* and broadcast the `auth:revoked` event so they can react.
|
|
5
|
-
*
|
|
6
|
-
* Shared between persisted-auth revocation and remote-dock token revocation.
|
|
7
|
-
*/
|
|
8
|
-
async function revokeActiveConnectionsForToken(context, token) {
|
|
9
|
-
const rpcHost = context.rpc;
|
|
10
|
-
if (!rpcHost?._rpcGroup) return;
|
|
11
|
-
const affectedSessionIds = /* @__PURE__ */ new Set();
|
|
12
|
-
for (const client of rpcHost._rpcGroup.clients) if (client.$meta.clientAuthToken === token) {
|
|
13
|
-
affectedSessionIds.add(client.$meta.id);
|
|
14
|
-
client.$meta.isTrusted = false;
|
|
15
|
-
client.$meta.clientAuthToken = void 0;
|
|
16
|
-
}
|
|
17
|
-
if (affectedSessionIds.size === 0) return;
|
|
18
|
-
await rpcHost.broadcast({
|
|
19
|
-
method: "devframe:auth:revoked",
|
|
20
|
-
args: [],
|
|
21
|
-
filter: (client) => affectedSessionIds.has(client.$meta.id)
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Revoke an auth token: remove from storage and notify all connected clients
|
|
26
|
-
* using this token that they are no longer trusted.
|
|
27
|
-
*/
|
|
28
|
-
async function revokeAuthToken(context, storage, token) {
|
|
29
|
-
storage.mutate((state) => {
|
|
30
|
-
delete state.trusted[token];
|
|
31
|
-
});
|
|
32
|
-
await revokeActiveConnectionsForToken(context, token);
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
export { revokeAuthToken as n, revokeActiveConnectionsForToken as t };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { _ as RpcFunctionDefinitionAny } from "./types-DmcujDa5.mjs";
|
|
2
|
-
import { ChannelOptions } from "birpc";
|
|
3
|
-
|
|
4
|
-
//#region src/rpc/transports/ws-client.d.ts
|
|
5
|
-
interface WsRpcChannelOptions {
|
|
6
|
-
url: string;
|
|
7
|
-
onConnected?: (e: Event) => void;
|
|
8
|
-
onError?: (e: Error) => void;
|
|
9
|
-
onDisconnected?: (e: CloseEvent) => void;
|
|
10
|
-
authToken?: string;
|
|
11
|
-
/**
|
|
12
|
-
* RPC function definitions (or just the `jsonSerializable` flag per
|
|
13
|
-
* method) used to dispatch the per-call wire serializer. Pass an
|
|
14
|
-
* empty / partial map on clients that don't have the full registry —
|
|
15
|
-
* encoding falls back to structured-clone (the safer superset) and
|
|
16
|
-
* decoding still routes correctly via the wire prefix.
|
|
17
|
-
*/
|
|
18
|
-
definitions?: ReadonlyMap<string, Pick<RpcFunctionDefinitionAny, 'jsonSerializable'>>;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Build a birpc `ChannelOptions` object backed by a browser `WebSocket`.
|
|
22
|
-
* Pass the result straight to `createRpcClient`'s `channel` option.
|
|
23
|
-
*/
|
|
24
|
-
declare function createWsRpcChannel(options: WsRpcChannelOptions): ChannelOptions;
|
|
25
|
-
//#endregion
|
|
26
|
-
export { createWsRpcChannel as n, WsRpcChannelOptions as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|