devframe 0.1.21 → 0.2.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/README.md +40 -18
- package/dist/{_shared-iZy45oG3.mjs → _shared-BrKv3CYt.mjs} +5 -5
- package/dist/adapters/build.d.mts +5 -5
- package/dist/adapters/build.mjs +13 -12
- package/dist/adapters/cli.d.mts +4 -4
- package/dist/adapters/cli.mjs +5 -5
- package/dist/adapters/dev.d.mts +21 -12
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +5 -5
- package/dist/adapters/embedded.mjs +2 -2
- package/dist/adapters/mcp.d.mts +3 -3
- package/dist/adapters/mcp.mjs +5 -5
- package/dist/chunk-e9Ob2GDo.mjs +26 -0
- package/dist/client/index.d.mts +8 -5
- package/dist/client/index.mjs +12 -12
- package/dist/colors-DS7k8ljB.mjs +123 -0
- package/dist/{context-BJ4r2SmR.mjs → context-BBi2IQDm.mjs} +19 -37
- package/dist/{context-internal-saIAfNVw.d.mts → context-DRa0wGsC.d.mts} +2 -2
- package/dist/{dev-CdAy400a.mjs → dev-CewNNE2R.mjs} +24 -28
- package/dist/{devtool-CNvLs2_Y.d.mts → devframe-R5Ex5K5L.d.mts} +41 -66
- package/dist/{diagnostics-DxPnRoXO.mjs → diagnostics-Cg9ycFIM.mjs} +7 -2
- package/dist/hash-CIBte1yS.mjs +263 -0
- package/dist/helpers/vite.d.mts +65 -0
- package/dist/helpers/vite.mjs +94 -0
- package/dist/{human-id-BLoGo_e5.mjs → human-id-adtUWQLr.mjs} +12 -3
- package/dist/{index-CuLRIMto.d.mts → index-DB2Ie0Or.d.mts} +2 -3
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -5
- package/dist/launch-editor-CX_n_0SS.mjs +581 -0
- package/dist/node/auth.d.mts +44 -0
- package/dist/node/auth.mjs +55 -0
- package/dist/node/index.d.mts +13 -55
- package/dist/node/index.mjs +6 -62
- package/dist/node/internal.d.mts +16 -0
- package/dist/node/internal.mjs +50 -0
- package/dist/{open-Dede_w9r.mjs → open-B2ah1IKK.mjs} +38 -24
- package/dist/recipes/open-helpers.d.mts +4 -9
- package/dist/recipes/open-helpers.mjs +7 -12
- package/dist/revoke-DIMz1r7-.mjs +35 -0
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -1
- package/dist/{rpc-INbWfHoX.mjs → rpc-DAzoVCR0.mjs} +5 -4
- package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
- package/dist/{server-CBsxXIH5.mjs → server-DOk4grlJ.mjs} +4 -4
- package/dist/{server-BAqOajx_.d.mts → server-DzKz023G.d.mts} +8 -7
- package/dist/shared-state-q9-1EOSX.mjs +928 -0
- package/dist/{static-dump-D5VH8Iqk.mjs → static-dump-C67bCuse.mjs} +1 -1
- package/dist/{context-internal-Dx_NoSv1.mjs → storage-CNvfBGQ5.mjs} +5 -87
- package/dist/structured-clone-CD2l4fI3.mjs +221 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +3 -3
- package/dist/utils/colors.d.mts +28 -0
- package/dist/utils/colors.mjs +2 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.d.mts +7 -0
- package/dist/utils/hash.mjs +2 -0
- package/dist/utils/human-id.d.mts +6 -8
- package/dist/utils/human-id.mjs +1 -2
- package/dist/utils/launch-editor.d.mts +13 -0
- package/dist/utils/launch-editor.mjs +2 -0
- package/dist/utils/open.d.mts +16 -0
- package/dist/utils/open.mjs +2 -0
- package/dist/utils/serve-static.d.mts +40 -0
- package/dist/utils/serve-static.mjs +173 -0
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -35
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.d.mts +21 -0
- package/dist/utils/structured-clone.mjs +2 -0
- package/dist/utils/when.d.mts +33 -50
- package/dist/utils/when.mjs +21 -3
- package/dist/{ws-client-CjPuPFbA.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
- package/dist/{ws-server-C7LnhOHi.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
- package/package.json +38 -18
- package/skills/devframe/SKILL.md +64 -39
- package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +4 -4
- package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +5 -5
- package/skills/devframe/templates/vite-client.ts +2 -2
- package/dist/adapters/vite.d.mts +0 -33
- package/dist/adapters/vite.mjs +0 -32
- package/dist/internal/index.d.mts +0 -16
- package/dist/internal/index.mjs +0 -3
- package/dist/utils/state.d.mts +0 -50
- package/dist/utils/state.mjs +0 -26
- package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
- package/dist/{host-h3-9jeHcltx.mjs → host-h3-Dz8YnFgu.mjs} +1 -1
- /package/dist/{transports-DSV5_5QM.mjs → transports-BnCs4rj9.mjs} +0 -0
- /package/dist/{types-C5OVe4AC.d.mts → types-4rdUEi2R.d.mts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-
|
|
1
|
+
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-DAzoVCR0.mjs";
|
|
2
2
|
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
3
|
//#region src/node/static-dump.ts
|
|
4
4
|
function makeDumpKey(name) {
|
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { createSharedState } from "./utils/shared-state.mjs";
|
|
1
|
+
import { n as logger } from "./diagnostics-Cg9ycFIM.mjs";
|
|
2
|
+
import { t as createSharedState } from "./shared-state-q9-1EOSX.mjs";
|
|
4
3
|
import fs from "node:fs";
|
|
5
|
-
import { dirname
|
|
6
|
-
//#region
|
|
7
|
-
/**
|
|
8
|
-
* Flip `isTrusted` to false on any live WS clients connected with `token`
|
|
9
|
-
* and broadcast the `auth:revoked` event so they can react.
|
|
10
|
-
*
|
|
11
|
-
* Shared between persisted-auth revocation and remote-dock token revocation.
|
|
12
|
-
*/
|
|
13
|
-
async function revokeActiveConnectionsForToken(context, token) {
|
|
14
|
-
const rpcHost = context.rpc;
|
|
15
|
-
if (!rpcHost?._rpcGroup) return;
|
|
16
|
-
const affectedSessionIds = /* @__PURE__ */ new Set();
|
|
17
|
-
for (const client of rpcHost._rpcGroup.clients) if (client.$meta.clientAuthToken === token) {
|
|
18
|
-
affectedSessionIds.add(client.$meta.id);
|
|
19
|
-
client.$meta.isTrusted = false;
|
|
20
|
-
client.$meta.clientAuthToken = void 0;
|
|
21
|
-
}
|
|
22
|
-
if (affectedSessionIds.size === 0) return;
|
|
23
|
-
await rpcHost.broadcast({
|
|
24
|
-
method: "devframe:auth:revoked",
|
|
25
|
-
args: [],
|
|
26
|
-
filter: (client) => affectedSessionIds.has(client.$meta.id)
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Revoke an auth token: remove from storage and notify all connected clients
|
|
31
|
-
* using this token that they are no longer trusted.
|
|
32
|
-
*/
|
|
33
|
-
async function revokeAuthToken(context, storage, token) {
|
|
34
|
-
storage.mutate((state) => {
|
|
35
|
-
delete state.trusted[token];
|
|
36
|
-
});
|
|
37
|
-
await revokeActiveConnectionsForToken(context, token);
|
|
38
|
-
}
|
|
39
|
-
//#endregion
|
|
40
|
-
//#region ../../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
|
|
4
|
+
import { dirname } from "pathe";
|
|
5
|
+
//#region ../../node_modules/.pnpm/perfect-debounce@2.1.0/node_modules/perfect-debounce/dist/index.mjs
|
|
41
6
|
const DEBOUNCE_DEFAULTS = { trailing: true };
|
|
42
7
|
/**
|
|
43
8
|
Debounce functions
|
|
@@ -149,51 +114,4 @@ function createStorage(options) {
|
|
|
149
114
|
return state;
|
|
150
115
|
}
|
|
151
116
|
//#endregion
|
|
152
|
-
|
|
153
|
-
const internalContextMap = /* @__PURE__ */ new WeakMap();
|
|
154
|
-
function getInternalContext(context) {
|
|
155
|
-
if (!internalContextMap.has(context)) {
|
|
156
|
-
const storage = createStorage({
|
|
157
|
-
filepath: join(context.host.getStorageDir("global"), "auth.json"),
|
|
158
|
-
initialValue: { trusted: {} }
|
|
159
|
-
});
|
|
160
|
-
const remoteTokens = /* @__PURE__ */ new Map();
|
|
161
|
-
function revokeRemoteToken(token) {
|
|
162
|
-
if (!remoteTokens.delete(token)) return;
|
|
163
|
-
revokeActiveConnectionsForToken(context, token);
|
|
164
|
-
}
|
|
165
|
-
const internalContext = {
|
|
166
|
-
storage: { auth: storage },
|
|
167
|
-
revokeAuthToken: (token) => revokeAuthToken(context, storage, token),
|
|
168
|
-
remoteTokens,
|
|
169
|
-
allocateRemoteToken(dockId, origin, originLock) {
|
|
170
|
-
const token = (0, import_dist.humanId)({
|
|
171
|
-
separator: "-",
|
|
172
|
-
capitalize: false
|
|
173
|
-
});
|
|
174
|
-
remoteTokens.set(token, {
|
|
175
|
-
dockId,
|
|
176
|
-
origin,
|
|
177
|
-
originLock
|
|
178
|
-
});
|
|
179
|
-
return token;
|
|
180
|
-
},
|
|
181
|
-
revokeRemoteToken,
|
|
182
|
-
revokeRemoteTokensForDock(dockId) {
|
|
183
|
-
const tokensToRevoke = [];
|
|
184
|
-
for (const [token, record] of remoteTokens) if (record.dockId === dockId) tokensToRevoke.push(token);
|
|
185
|
-
for (const token of tokensToRevoke) revokeRemoteToken(token);
|
|
186
|
-
},
|
|
187
|
-
isRemoteTokenTrusted(token, requestOrigin) {
|
|
188
|
-
const record = remoteTokens.get(token);
|
|
189
|
-
if (!record) return false;
|
|
190
|
-
if (!record.originLock) return true;
|
|
191
|
-
return !!requestOrigin && record.origin === requestOrigin;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
internalContextMap.set(context, internalContext);
|
|
195
|
-
}
|
|
196
|
-
return internalContextMap.get(context);
|
|
197
|
-
}
|
|
198
|
-
//#endregion
|
|
199
|
-
export { revokeAuthToken as a, revokeActiveConnectionsForToken as i, internalContextMap as n, createStorage as r, getInternalContext as t };
|
|
117
|
+
export { createStorage as t };
|
|
@@ -0,0 +1,221 @@
|
|
|
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 (`Map`, `Set`, `Date`, `BigInt`,
|
|
196
|
+
* cycles, class instances, …) into a JSON-safe records array.
|
|
197
|
+
*/
|
|
198
|
+
function structuredCloneSerialize(value) {
|
|
199
|
+
return serialize(value);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Inverse of {@link structuredCloneSerialize}.
|
|
203
|
+
*/
|
|
204
|
+
function structuredCloneDeserialize(value) {
|
|
205
|
+
return deserialize(value);
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Serialize a structured-cloneable value to a single string. Equivalent
|
|
209
|
+
* to `JSON.stringify(structuredCloneSerialize(value))`.
|
|
210
|
+
*/
|
|
211
|
+
function structuredCloneStringify(value) {
|
|
212
|
+
return stringify(value);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Inverse of {@link structuredCloneStringify}.
|
|
216
|
+
*/
|
|
217
|
+
function structuredCloneParse(value) {
|
|
218
|
+
return parse(value);
|
|
219
|
+
}
|
|
220
|
+
//#endregion
|
|
221
|
+
export { structuredCloneStringify as i, structuredCloneParse as n, structuredCloneSerialize as r, structuredCloneDeserialize as t };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { m 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,
|
|
1
|
+
import { $ as AgentResourceContent, B as EntriesToObject, G as DevToolsRpcSharedStates, H as Thenable, J as DevToolsDiagnosticsHost, K as DevToolsHost, Q as AgentResource, U as DevToolsRpcClientFunctions, V as PartialWithoutId, W as DevToolsRpcServerFunctions, X as AgentHandle, Y as DevToolsDiagnosticsLogger, Z as AgentManifest, _ as RpcStreamingChannel, a as DevframeRuntime, at as EventEmitter, c as defineDevframe, d as DevToolsNodeContext, et as AgentResourceInput, f as DevToolsNodeRpcSession, g as RpcSharedStateHost, h as RpcSharedStateGetOptions, i as DevframeDeploymentKind, it as DevToolsAgentHostEvents, l as ConnectionMeta, m as RpcFunctionsHost, n as DevframeCliOptions, nt as AgentToolInput, o as DevframeSetupInfo, ot as EventUnsubscribe, p as RpcBroadcastOptions, q as DevToolsDiagnosticsDefinition, r as DevframeDefinition, rt as DevToolsAgentHost, s as DevframeSpaOptions, st as EventsMap, t as DevframeBrowserContext, tt as AgentTool, u as DevToolsCapabilities, v as RpcStreamingChannelOptions, y as RpcStreamingHost, z as DevToolsViewHost } from "../devframe-R5Ex5K5L.mjs";
|
|
2
|
+
import { m as RpcFunctionAgentOptions } from "../types-4rdUEi2R.mjs";
|
|
3
|
+
import { t as DevToolsNodeRpcSessionMeta } from "../ws-server-DjvlwLuM.mjs";
|
|
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 };
|
package/dist/types/index.mjs
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/utils/colors.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A colorizer — callable as a function (`colors.red('foo')`) or as a
|
|
4
|
+
* tagged template (``colors.red`foo ${bar}` ``).
|
|
5
|
+
*/
|
|
6
|
+
interface ColorFn {
|
|
7
|
+
(text: unknown): string;
|
|
8
|
+
(template: TemplateStringsArray, ...values: unknown[]): string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Minimal terminal color palette. Each entry is callable as both a
|
|
12
|
+
* plain function and a tagged template.
|
|
13
|
+
*/
|
|
14
|
+
interface Colors {
|
|
15
|
+
blue: ColorFn;
|
|
16
|
+
cyan: ColorFn;
|
|
17
|
+
gray: ColorFn;
|
|
18
|
+
green: ColorFn;
|
|
19
|
+
red: ColorFn;
|
|
20
|
+
yellow: ColorFn;
|
|
21
|
+
bold: ColorFn;
|
|
22
|
+
dim: ColorFn;
|
|
23
|
+
reset: ColorFn;
|
|
24
|
+
underline: ColorFn;
|
|
25
|
+
}
|
|
26
|
+
declare const colors: Colors;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { ColorFn, Colors, colors };
|
package/dist/utils/events.d.mts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
//#region
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
declare function humanId(options?: Options | string | boolean): string;
|
|
1
|
+
//#region src/utils/human-id.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Generate a human-readable, lowercase, dash-separated random ID
|
|
4
|
+
* (e.g. `bright-orange-tiger`).
|
|
5
|
+
*/
|
|
6
|
+
declare function humanId(): string;
|
|
9
7
|
//#endregion
|
|
10
8
|
export { humanId };
|
package/dist/utils/human-id.mjs
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/utils/launch-editor.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Open a file in the user's editor.
|
|
4
|
+
*
|
|
5
|
+
* `target` may be a plain path, `file:line`, or `file:line:column`.
|
|
6
|
+
*
|
|
7
|
+
* If `editor` is provided, it is used as the editor command (e.g. `'code'`,
|
|
8
|
+
* `'subl'`) or absolute binary path. Otherwise the editor is auto-detected
|
|
9
|
+
* via the `LAUNCH_EDITOR` env var with a fallback to common defaults.
|
|
10
|
+
*/
|
|
11
|
+
declare function launchEditor(target: string, editor?: string): void;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { launchEditor };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/utils/open.d.ts
|
|
2
|
+
interface OpenOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Resolve only after the launched app exits.
|
|
5
|
+
*
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
wait?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Open a URL, file, or other target in its default OS handler
|
|
12
|
+
* (browser for URLs, Finder/Explorer for paths, etc.).
|
|
13
|
+
*/
|
|
14
|
+
declare function open(target: string, options?: OpenOptions): Promise<void>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { OpenOptions, open };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { EventHandler, H3 } from "h3";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/serve-static.d.ts
|
|
5
|
+
interface ServeStaticOptions {
|
|
6
|
+
/** Default: `['index.html']`. */
|
|
7
|
+
indexNames?: string[];
|
|
8
|
+
/** SPA fallback to `indexNames[0]` on miss. Default: `true`. */
|
|
9
|
+
single?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* h3 event handler that serves files from `dir` with SPA fallback.
|
|
13
|
+
*
|
|
14
|
+
* Drop-in replacement for `fromNodeMiddleware(sirv(dir, { dev: true, single: true }))`
|
|
15
|
+
* when the surrounding server is an h3 app — no `Cache-Control` beyond
|
|
16
|
+
* `no-store`, `Content-Type` resolved via `mrmime`, and a miss with no
|
|
17
|
+
* file extension falls back to `<dir>/index.html` so client-side routing
|
|
18
|
+
* works.
|
|
19
|
+
*/
|
|
20
|
+
declare function serveStaticHandler(dir: string, options?: ServeStaticOptions): EventHandler;
|
|
21
|
+
/**
|
|
22
|
+
* Mount {@link serveStaticHandler} on an h3 app at `base`, handling the
|
|
23
|
+
* route pattern and prefix-stripping required by h3 v2.
|
|
24
|
+
*
|
|
25
|
+
* h3 v2's `app.use(base, handler)` only matches the exact `base` path and
|
|
26
|
+
* does not strip the prefix from `event.url.pathname`. Static serving
|
|
27
|
+
* needs both subpath matching (`/base/**`) and the URL stripped so the
|
|
28
|
+
* file resolver sees paths relative to `dir` — this helper bundles both.
|
|
29
|
+
*/
|
|
30
|
+
declare function mountStaticHandler(app: H3, base: string, dir: string, options?: ServeStaticOptions): void;
|
|
31
|
+
/**
|
|
32
|
+
* Connect/Express-style Node middleware variant of {@link serveStaticHandler}.
|
|
33
|
+
*
|
|
34
|
+
* Use when mounting onto `viteServer.middlewares.use(base, …)` or any other
|
|
35
|
+
* Connect stack — avoids forcing the host package to depend on h3 just to
|
|
36
|
+
* adapt an event handler back into Node middleware.
|
|
37
|
+
*/
|
|
38
|
+
declare function serveStaticNodeMiddleware(dir: string, options?: ServeStaticOptions): (req: IncomingMessage, res: ServerResponse, next?: (err?: Error) => void) => void;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ServeStaticOptions, mountStaticHandler, serveStaticHandler, serveStaticNodeMiddleware };
|