devframe 0.6.0-beta.1 → 0.6.0-beta.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/adapters/build.d.mts +1 -1
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/client/index.d.mts +1 -1
- package/dist/{context-o-TwncyP.d.mts → context-BEVByy_Z.d.mts} +1 -1
- package/dist/{dev-CSpLSEVh.mjs → dev-BaX8fLH2.mjs} +1 -1
- package/dist/{devframe-BwfavB78.d.mts → devframe-D-gr9sBx.d.mts} +1 -1
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/{launch-editor-CgXBgviI.mjs → launch-editor-DPfltGA4.mjs} +88 -13
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.mjs +1 -1
- package/dist/recipes/open-helpers.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +36 -7
- package/dist/{server-wyY3zh67.mjs → server-Dl6TU5LE.mjs} +1 -0
- package/dist/{server-oju7PTi2.d.mts → server-rX781kz-.d.mts} +9 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{ws-server-BVVMDo2n.d.mts → ws-server-Bc2wBHl-.d.mts} +17 -1
- package/package.json +1 -1
package/dist/adapters/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as CliFlagsSchema, Et as parseCliFlags, Tt as defineCliFlags, r as DevframeDefinition, wt as InferCliFlags } from "../devframe-
|
|
1
|
+
import { Ct as CliFlagsSchema, Et as parseCliFlags, Tt as defineCliFlags, r as DevframeDefinition, wt as InferCliFlags } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
2
|
import { createBuild } from "./build.mjs";
|
|
3
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-BaX8fLH2.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as DevframeWsOptions, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { n as StartedServer } from "../server-
|
|
1
|
+
import { l as DevframeWsOptions, r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
|
|
2
|
+
import { n as StartedServer } from "../server-rX781kz-.mjs";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/dev.d.ts
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-BaX8fLH2.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
package/dist/adapters/mcp.d.mts
CHANGED
package/dist/client/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ScopedServerFunctions, D as StreamReader, J as DevframeSettings, L as SharedState, O as StreamSink, bt as EventEmitter, d as ConnectionMeta, et as ScopedSharedStates, it as DevframeRpcServerFunctions, rt as DevframeRpcClientFunctions, tt as SettingsForNamespace, v as RpcSharedStateGetOptions, y as RpcSharedStateHost } from "../devframe-
|
|
1
|
+
import { $ as ScopedServerFunctions, D as StreamReader, J as DevframeSettings, L as SharedState, O as StreamSink, bt as EventEmitter, d as ConnectionMeta, et as ScopedSharedStates, it as DevframeRpcServerFunctions, rt as DevframeRpcClientFunctions, tt as SettingsForNamespace, v as RpcSharedStateGetOptions, y as RpcSharedStateHost } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-DZEx4ffs.mjs";
|
|
3
3
|
import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-CxaPKDXX.mjs";
|
|
4
4
|
import { t as WsRpcChannelOptions } from "../ws-client-D0z0pOhn.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
2
|
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-C5SZlk03.mjs";
|
|
3
|
-
import { t as startHttpAndWs } from "./server-
|
|
3
|
+
import { t as startHttpAndWs } from "./server-Dl6TU5LE.mjs";
|
|
4
4
|
import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-bWRzeSa0.mjs";
|
|
5
5
|
import { t as open } from "./open-Dusa2Zzd.mjs";
|
|
6
6
|
import { mountStaticHandler } from "./utils/serve-static.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as RpcFunctionDefinition } from "./types-DZEx4ffs.mjs";
|
|
2
2
|
import { S as RpcFunctionsCollectorBase } from "./index-CxaPKDXX.mjs";
|
|
3
|
-
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
3
|
+
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-Bc2wBHl-.mjs";
|
|
4
4
|
import { CAC } from "cac";
|
|
5
5
|
import { GenericSchema, InferOutput } from "valibot";
|
|
6
6
|
import { BirpcReturn } from "birpc";
|
package/dist/helpers/vite.d.mts
CHANGED
package/dist/helpers/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constan
|
|
|
2
2
|
import { a as diagnostics } from "../storage-l2ezeend.mjs";
|
|
3
3
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
4
4
|
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
5
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-BaX8fLH2.mjs";
|
|
6
6
|
import { resolve } from "pathe";
|
|
7
7
|
//#region src/helpers/vite.ts
|
|
8
8
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as ScopedServerFunctions, G as DevframeScopedNodeContext, H as EntriesToObject, J as DevframeSettings, K as DevframeScopedNodeRpc, Q as ScopedClientFunctions, S as RpcStreamingHost, St as EventsMap, U as PartialWithoutId, W as Thenable, X as DevframeSettingsStore, Y as DevframeSettingsRegistry, Z as ScopedBroadcastOptions, _ as RpcFunctionsHost, _t as AgentToolInput, a as DevframeDuplicationStrategy, at as DevframeRpcSharedStates, b as RpcStreamingChannel, bt as EventEmitter, c as DevframeSpaOptions, ct as DevframeDiagnosticsDefinition, d as ConnectionMeta, dt as AgentHandle, et as ScopedSharedStates, f as ConnectionMetaWebsocket, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, i as DevframeDeploymentKind, it as DevframeRpcServerFunctions, l as DevframeWsOptions, lt as DevframeDiagnosticsHost, m as DevframeNodeContext, mt as AgentResourceContent, n as DevframeCliOptions, nt as DevframeViewHost, o as DevframeRuntime, ot as DevframeHost, p as DevframeCapabilities, pt as AgentResource, q as DevframeScopedStreamingHost, r as DevframeDefinition, rt as DevframeRpcClientFunctions, s as DevframeSetupInfo, st as DevframeDefineDiagnosticsOptions, t as DevframeBrowserContext, tt as SettingsForNamespace, u as defineDevframe, ut as DevframeDiagnosticsLogger, v as RpcSharedStateGetOptions, vt as DevframeAgentHost, x as RpcStreamingChannelOptions, xt as EventUnsubscribe, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "./devframe-
|
|
1
|
+
import { $ as ScopedServerFunctions, G as DevframeScopedNodeContext, H as EntriesToObject, J as DevframeSettings, K as DevframeScopedNodeRpc, Q as ScopedClientFunctions, S as RpcStreamingHost, St as EventsMap, U as PartialWithoutId, W as Thenable, X as DevframeSettingsStore, Y as DevframeSettingsRegistry, Z as ScopedBroadcastOptions, _ as RpcFunctionsHost, _t as AgentToolInput, a as DevframeDuplicationStrategy, at as DevframeRpcSharedStates, b as RpcStreamingChannel, bt as EventEmitter, c as DevframeSpaOptions, ct as DevframeDiagnosticsDefinition, d as ConnectionMeta, dt as AgentHandle, et as ScopedSharedStates, f as ConnectionMetaWebsocket, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, i as DevframeDeploymentKind, it as DevframeRpcServerFunctions, l as DevframeWsOptions, lt as DevframeDiagnosticsHost, m as DevframeNodeContext, mt as AgentResourceContent, n as DevframeCliOptions, nt as DevframeViewHost, o as DevframeRuntime, ot as DevframeHost, p as DevframeCapabilities, pt as AgentResource, q as DevframeScopedStreamingHost, r as DevframeDefinition, rt as DevframeRpcClientFunctions, s as DevframeSetupInfo, st as DevframeDefineDiagnosticsOptions, t as DevframeBrowserContext, tt as SettingsForNamespace, u as defineDevframe, ut as DevframeDiagnosticsLogger, v as RpcSharedStateGetOptions, vt as DevframeAgentHost, x as RpcStreamingChannelOptions, xt as EventUnsubscribe, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "./devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { C as RpcFunctionType, T as RpcReturnSchema, _ as RpcFunctionDefinition, g as RpcFunctionAgentOptions, i as RpcArgsSchema } from "./types-DZEx4ffs.mjs";
|
|
3
|
-
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-
|
|
3
|
+
import { t as DevframeNodeRpcSessionMeta } from "./ws-server-Bc2wBHl-.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/define.d.ts
|
|
6
6
|
declare const defineRpcFunction: <NAME extends string, TYPE extends RpcFunctionType, ARGS extends any[], RETURN = void, const AS extends RpcArgsSchema | undefined = undefined, const RS extends RpcReturnSchema | undefined = undefined>(definition: RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>) => RpcFunctionDefinition<NAME, TYPE, ARGS, RETURN, AS, RS, DevframeNodeContext>;
|
|
@@ -91,21 +91,66 @@ var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
91
91
|
module.exports.createColors = createColors;
|
|
92
92
|
}));
|
|
93
93
|
//#endregion
|
|
94
|
-
//#region ../../node_modules/.pnpm/shell-quote@1.
|
|
94
|
+
//#region ../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/quote.js
|
|
95
95
|
var require_quote = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
96
|
+
/** @import { ControlOperator } from './parse' */
|
|
97
|
+
/** @type {ControlOperator['op'][]} */
|
|
98
|
+
var OPS = [
|
|
99
|
+
"||",
|
|
100
|
+
"&&",
|
|
101
|
+
";;",
|
|
102
|
+
"|&",
|
|
103
|
+
"<(",
|
|
104
|
+
"<<<",
|
|
105
|
+
">>",
|
|
106
|
+
">&",
|
|
107
|
+
"<&",
|
|
108
|
+
"&",
|
|
109
|
+
";",
|
|
110
|
+
"(",
|
|
111
|
+
")",
|
|
112
|
+
"|",
|
|
113
|
+
"<",
|
|
114
|
+
">"
|
|
115
|
+
];
|
|
116
|
+
var LINE_TERMINATORS = /[\n\r\u2028\u2029]/;
|
|
117
|
+
var GLOB_SHELL_SPECIAL = /[\s#!"$&'():;<=>@\\^`|]/g;
|
|
118
|
+
/** @type {import('./quote')} */
|
|
96
119
|
module.exports = function quote(xs) {
|
|
97
120
|
return xs.map(function(s) {
|
|
98
121
|
if (s === "") return "''";
|
|
99
|
-
if (s && typeof s === "object")
|
|
122
|
+
if (s && typeof s === "object") {
|
|
123
|
+
if ("op" in s && s.op === "glob") {
|
|
124
|
+
if (typeof s.pattern !== "string") throw new TypeError("glob token requires a string `pattern`");
|
|
125
|
+
if (LINE_TERMINATORS.test(s.pattern)) throw new TypeError("glob `pattern` must not contain line terminators");
|
|
126
|
+
return s.pattern.replace(GLOB_SHELL_SPECIAL, "\\$&");
|
|
127
|
+
}
|
|
128
|
+
if ("op" in s && typeof s.op === "string") {
|
|
129
|
+
if (OPS.indexOf(s.op) < 0) throw new TypeError("invalid `op` value: " + JSON.stringify(s.op));
|
|
130
|
+
return s.op.replace(/[\s\S]/g, "\\$&");
|
|
131
|
+
}
|
|
132
|
+
if ("comment" in s && typeof s.comment === "string") {
|
|
133
|
+
if (LINE_TERMINATORS.test(s.comment)) throw new TypeError("`comment` must not contain line terminators");
|
|
134
|
+
return "#" + s.comment;
|
|
135
|
+
}
|
|
136
|
+
throw new TypeError("unrecognized object token shape");
|
|
137
|
+
}
|
|
100
138
|
if (/["\s\\]/.test(s) && !/'/.test(s)) return "'" + s.replace(/(['])/g, "\\$1") + "'";
|
|
101
139
|
if (/["'\s]/.test(s)) return "\"" + s.replace(/(["\\$`!])/g, "\\$1") + "\"";
|
|
102
|
-
return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}])/g, "$1\\$2");
|
|
140
|
+
return String(s).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g, "$1\\$2");
|
|
103
141
|
}).join(" ");
|
|
104
142
|
};
|
|
105
143
|
}));
|
|
106
144
|
//#endregion
|
|
107
|
-
//#region ../../node_modules/.pnpm/shell-quote@1.
|
|
145
|
+
//#region ../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/parse.js
|
|
108
146
|
var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
147
|
+
/**
|
|
148
|
+
* @import {
|
|
149
|
+
* ControlOperator,
|
|
150
|
+
* Env,
|
|
151
|
+
* GlobPattern,
|
|
152
|
+
* ParseEntry,
|
|
153
|
+
* } from './parse' */
|
|
109
154
|
var CONTROL = "(?:" + [
|
|
110
155
|
"\\|\\|",
|
|
111
156
|
"\\&\\&",
|
|
@@ -130,17 +175,26 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
130
175
|
var mult = 4294967296;
|
|
131
176
|
for (var i = 0; i < 4; i++) TOKEN += (mult * Math.random()).toString(16);
|
|
132
177
|
var startsWithToken = new RegExp("^" + TOKEN);
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} s
|
|
180
|
+
* @param {RegExp} r
|
|
181
|
+
*/
|
|
133
182
|
function matchAll(s, r) {
|
|
134
183
|
var origIndex = r.lastIndex;
|
|
135
184
|
var matches = [];
|
|
136
185
|
var matchObj;
|
|
137
186
|
while (matchObj = r.exec(s)) {
|
|
138
|
-
matches.
|
|
187
|
+
matches[matches.length] = matchObj;
|
|
139
188
|
if (r.lastIndex === matchObj.index) r.lastIndex += 1;
|
|
140
189
|
}
|
|
141
190
|
r.lastIndex = origIndex;
|
|
142
191
|
return matches;
|
|
143
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* @param {Env} env
|
|
195
|
+
* @param {string} pre
|
|
196
|
+
* @param {string} key
|
|
197
|
+
*/
|
|
144
198
|
function getVar(env, pre, key) {
|
|
145
199
|
var r = typeof env === "function" ? env(key) : env[key];
|
|
146
200
|
if (typeof r === "undefined" && key != "") r = "";
|
|
@@ -148,6 +202,12 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
148
202
|
if (typeof r === "object") return pre + TOKEN + JSON.stringify(r) + TOKEN;
|
|
149
203
|
return pre + r;
|
|
150
204
|
}
|
|
205
|
+
/**
|
|
206
|
+
* @param {string} string
|
|
207
|
+
* @param {Env} [env]
|
|
208
|
+
* @param {{ escape?: string }} [opts]
|
|
209
|
+
* @returns {ParseEntry[]}
|
|
210
|
+
*/
|
|
151
211
|
function parseInternal(string, env, opts) {
|
|
152
212
|
if (!opts) opts = {};
|
|
153
213
|
var BS = opts.escape || "\\";
|
|
@@ -160,14 +220,18 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
160
220
|
var s = match[0];
|
|
161
221
|
if (!s || commented) return;
|
|
162
222
|
if (controlRE.test(s)) return { op: s };
|
|
223
|
+
/** @type {string | boolean} */
|
|
163
224
|
var quote = false;
|
|
164
225
|
var esc = false;
|
|
165
226
|
var out = "";
|
|
166
227
|
var isGlob = false;
|
|
228
|
+
/** @type {number} */
|
|
167
229
|
var i;
|
|
168
230
|
function parseEnvVar() {
|
|
169
231
|
i += 1;
|
|
232
|
+
/** @type {number | RegExpMatchArray | null} */
|
|
170
233
|
var varend;
|
|
234
|
+
/** @type {string} */
|
|
171
235
|
var varname;
|
|
172
236
|
var char = s.charAt(i);
|
|
173
237
|
if (char === "{") {
|
|
@@ -225,25 +289,36 @@ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
225
289
|
};
|
|
226
290
|
return out;
|
|
227
291
|
}).reduce(function(prev, arg) {
|
|
228
|
-
|
|
292
|
+
if (typeof arg === "undefined") return prev;
|
|
293
|
+
/** @type {ParseEntry[]} */ [].concat(arg).forEach(function(entry) {
|
|
294
|
+
prev[prev.length] = entry;
|
|
295
|
+
});
|
|
296
|
+
return prev;
|
|
229
297
|
}, []);
|
|
230
298
|
}
|
|
299
|
+
/** @type {import('./parse')} */
|
|
231
300
|
module.exports = function parse(s, env, opts) {
|
|
232
301
|
var mapped = parseInternal(s, env, opts);
|
|
233
302
|
if (typeof env !== "function") return mapped;
|
|
234
303
|
return mapped.reduce(function(acc, s) {
|
|
235
|
-
if (typeof s === "object")
|
|
304
|
+
if (typeof s === "object") {
|
|
305
|
+
acc[acc.length] = s;
|
|
306
|
+
return acc;
|
|
307
|
+
}
|
|
236
308
|
var xs = s.split(RegExp("(" + TOKEN + ".*?" + TOKEN + ")", "g"));
|
|
237
|
-
if (xs.length === 1)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
309
|
+
if (xs.length === 1) {
|
|
310
|
+
acc[acc.length] = xs[0];
|
|
311
|
+
return acc;
|
|
312
|
+
}
|
|
313
|
+
xs.filter(Boolean).forEach(function(x) {
|
|
314
|
+
acc[acc.length] = startsWithToken.test(x) ? JSON.parse(x.split(TOKEN)[1]) : x;
|
|
315
|
+
});
|
|
316
|
+
return acc;
|
|
242
317
|
}, []);
|
|
243
318
|
};
|
|
244
319
|
}));
|
|
245
320
|
//#endregion
|
|
246
|
-
//#region ../../node_modules/.pnpm/shell-quote@1.
|
|
321
|
+
//#region ../../node_modules/.pnpm/shell-quote@1.9.0/node_modules/shell-quote/index.js
|
|
247
322
|
var require_shell_quote = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
248
323
|
exports.quote = require_quote();
|
|
249
324
|
exports.parse = require_parse();
|
package/dist/node/auth.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as SharedState, h as DevframeNodeRpcSession, m as DevframeNodeContext } from "../devframe-
|
|
2
|
-
import { n as InternalAnonymousAuthStorage } from "../context-
|
|
1
|
+
import { L as SharedState, h as DevframeNodeRpcSession, m as DevframeNodeContext } from "../devframe-D-gr9sBx.mjs";
|
|
2
|
+
import { n as InternalAnonymousAuthStorage } from "../context-BEVByy_Z.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/node/auth/revoke.d.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-
|
|
2
|
-
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-
|
|
1
|
+
import { i as DevframeDeploymentKind, r as DevframeDefinition } from "../devframe-D-gr9sBx.mjs";
|
|
2
|
+
import { a as internalContextMap, i as getInternalContext, n as InternalAnonymousAuthStorage, r as RemoteTokenRecord, t as DevframeInternalContext } from "../context-BEVByy_Z.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapters/_shared.d.ts
|
|
5
5
|
/**
|
package/dist/node/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { G as DevframeScopedNodeContext, J as DevframeSettings, L as SharedState, S as RpcStreamingHost, _ as RpcFunctionsHost$1, _t as AgentToolInput, bt as EventEmitter, dt as AgentHandle, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, it as DevframeRpcServerFunctions, lt as DevframeDiagnosticsHost$1, m as DevframeNodeContext, mt as AgentResourceContent, nt as DevframeViewHost$1, ot as DevframeHost, pt as AgentResource, rt as DevframeRpcClientFunctions, ut as DevframeDiagnosticsLogger, vt as DevframeAgentHost$1, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "../devframe-
|
|
1
|
+
import { G as DevframeScopedNodeContext, J as DevframeSettings, L as SharedState, S as RpcStreamingHost, _ as RpcFunctionsHost$1, _t as AgentToolInput, bt as EventEmitter, dt as AgentHandle, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, it as DevframeRpcServerFunctions, lt as DevframeDiagnosticsHost$1, m as DevframeNodeContext, mt as AgentResourceContent, nt as DevframeViewHost$1, ot as DevframeHost, pt as AgentResource, rt as DevframeRpcClientFunctions, ut as DevframeDiagnosticsLogger, vt as DevframeAgentHost$1, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { v as RpcFunctionDefinitionAny } from "../types-DZEx4ffs.mjs";
|
|
3
3
|
import { S as RpcFunctionsCollectorBase } from "../index-CxaPKDXX.mjs";
|
|
4
|
-
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-
|
|
5
|
-
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-
|
|
4
|
+
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-Bc2wBHl-.mjs";
|
|
5
|
+
import { n as StartedServer, r as startHttpAndWs, t as StartHttpAndWsOptions } from "../server-rX781kz-.mjs";
|
|
6
6
|
import { BirpcGroup } from "birpc";
|
|
7
7
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
8
8
|
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as createStorage } from "../storage-l2ezeend.mjs";
|
|
2
2
|
import { a as DevframeViewHost, c as createRpcSharedStateServerHost, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as RpcFunctionsHost, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-C5SZlk03.mjs";
|
|
3
|
-
import { t as startHttpAndWs } from "../server-
|
|
3
|
+
import { t as startHttpAndWs } from "../server-Dl6TU5LE.mjs";
|
|
4
4
|
import { isIP } from "node:net";
|
|
5
5
|
//#region src/node/utils.ts
|
|
6
6
|
function isObject(value) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as launchEditor } from "../launch-editor-
|
|
1
|
+
import { t as launchEditor } from "../launch-editor-DPfltGA4.mjs";
|
|
2
2
|
import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
|
|
3
3
|
import { t as open } from "../open-Dusa2Zzd.mjs";
|
|
4
4
|
import * as v from "valibot";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as attachWsRpcTransport, n as WsRpcTransport, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-
|
|
2
|
-
export { DevframeNodeRpcSessionMeta, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport };
|
|
1
|
+
import { a as isAllowedOrigin, i as attachWsRpcTransport, n as WsRpcTransport, o as isLoopbackHostname, r as WsRpcTransportOptions, t as DevframeNodeRpcSessionMeta } from "../../ws-server-Bc2wBHl-.mjs";
|
|
2
|
+
export { DevframeNodeRpcSessionMeta, WsRpcTransport, WsRpcTransportOptions, attachWsRpcTransport, isAllowedOrigin, isLoopbackHostname };
|
|
@@ -12,6 +12,26 @@ function pathMatches(a, b) {
|
|
|
12
12
|
const strip = (p) => p.length > 1 && p.endsWith("/") ? p.slice(0, -1) : p;
|
|
13
13
|
return strip(a) === strip(b);
|
|
14
14
|
}
|
|
15
|
+
function isLoopbackHostname(hostname) {
|
|
16
|
+
const h = hostname.replace(/^\[|\]$/g, "");
|
|
17
|
+
return h === "localhost" || h === "127.0.0.1" || h === "::1" || h.endsWith(".localhost") || h.startsWith("127.");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Default origin policy for a localhost dev tool: allow requests with no
|
|
21
|
+
* `Origin` header (native, non-browser clients), allow any loopback origin
|
|
22
|
+
* (so cross-port localhost dev setups keep working), and allow explicitly
|
|
23
|
+
* configured origins. Everything else — a real remote page in the dev's
|
|
24
|
+
* browser — is rejected.
|
|
25
|
+
*/
|
|
26
|
+
function isAllowedOrigin(origin, allowedOrigins) {
|
|
27
|
+
if (!origin) return true;
|
|
28
|
+
if (allowedOrigins.includes(origin)) return true;
|
|
29
|
+
try {
|
|
30
|
+
return isLoopbackHostname(new URL(origin).hostname);
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
15
35
|
/**
|
|
16
36
|
* Route `upgrade` events on a server to the crossws adapter, optionally
|
|
17
37
|
* filtered to a single `path`. Non-matching requests are left untouched so
|
|
@@ -19,18 +39,27 @@ function pathMatches(a, b) {
|
|
|
19
39
|
* them, unless `destroyUnmatched` is set. Returns a detach function that
|
|
20
40
|
* removes the listener.
|
|
21
41
|
*/
|
|
22
|
-
function routeUpgrades(server, ws, path, destroyUnmatched) {
|
|
42
|
+
function routeUpgrades(server, ws, path, destroyUnmatched, allowedOrigins) {
|
|
23
43
|
const listener = (req, socket, head) => {
|
|
44
|
+
socket.on("error", () => {});
|
|
24
45
|
if (path) {
|
|
25
46
|
let pathname = req.url ?? "/";
|
|
26
47
|
try {
|
|
27
48
|
pathname = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
28
49
|
} catch {}
|
|
29
50
|
if (!pathMatches(pathname, path)) {
|
|
30
|
-
if (destroyUnmatched)
|
|
51
|
+
if (destroyUnmatched) {
|
|
52
|
+
socket.write("HTTP/1.1 400 Bad Request\r\nConnection: close\r\n\r\n");
|
|
53
|
+
socket.destroy();
|
|
54
|
+
}
|
|
31
55
|
return;
|
|
32
56
|
}
|
|
33
57
|
}
|
|
58
|
+
if (allowedOrigins !== false && !isAllowedOrigin(req.headers.origin, allowedOrigins ?? [])) {
|
|
59
|
+
socket.write("HTTP/1.1 403 Forbidden\r\nConnection: close\r\n\r\n");
|
|
60
|
+
socket.destroy();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
34
63
|
ws.handleUpgrade(req, socket, head);
|
|
35
64
|
};
|
|
36
65
|
server.on("upgrade", listener);
|
|
@@ -47,7 +76,7 @@ function routeUpgrades(server, ws, path, destroyUnmatched) {
|
|
|
47
76
|
* teardown).
|
|
48
77
|
*/
|
|
49
78
|
function attachWsRpcTransport(rpcGroup, options = {}) {
|
|
50
|
-
const { server, port, host = "localhost", path, destroyUnmatched = false, https, onConnected = NOOP, onDisconnected = NOOP, definitions = EMPTY_DEFS, serialize: serializeOverride, deserialize: deserializeOverride } = options;
|
|
79
|
+
const { server, port, host = "localhost", path, destroyUnmatched = false, https, allowedOrigins, onConnected = NOOP, onDisconnected = NOOP, definitions = EMPTY_DEFS, serialize: serializeOverride, deserialize: deserializeOverride } = options;
|
|
51
80
|
const states = /* @__PURE__ */ new WeakMap();
|
|
52
81
|
const ws = crossws({ hooks: {
|
|
53
82
|
open: (peer) => {
|
|
@@ -108,17 +137,17 @@ function attachWsRpcTransport(rpcGroup, options = {}) {
|
|
|
108
137
|
} });
|
|
109
138
|
let detach = NOOP;
|
|
110
139
|
let ownedServer;
|
|
111
|
-
if (server) detach = routeUpgrades(server, ws, path, destroyUnmatched);
|
|
140
|
+
if (server) detach = routeUpgrades(server, ws, path, destroyUnmatched, allowedOrigins);
|
|
112
141
|
else if (https) {
|
|
113
142
|
ownedServer = createServer$1(https);
|
|
114
|
-
detach = routeUpgrades(ownedServer, ws, path, true);
|
|
143
|
+
detach = routeUpgrades(ownedServer, ws, path, true, allowedOrigins);
|
|
115
144
|
ownedServer.listen(port, host);
|
|
116
145
|
} else {
|
|
117
146
|
ownedServer = createServer((_req, res) => {
|
|
118
147
|
res.writeHead(426, { "content-type": "text/plain" });
|
|
119
148
|
res.end("Upgrade Required");
|
|
120
149
|
});
|
|
121
|
-
detach = routeUpgrades(ownedServer, ws, path, true);
|
|
150
|
+
detach = routeUpgrades(ownedServer, ws, path, true, allowedOrigins);
|
|
122
151
|
ownedServer.listen(port, host);
|
|
123
152
|
}
|
|
124
153
|
return {
|
|
@@ -135,4 +164,4 @@ function attachWsRpcTransport(rpcGroup, options = {}) {
|
|
|
135
164
|
};
|
|
136
165
|
}
|
|
137
166
|
//#endregion
|
|
138
|
-
export { attachWsRpcTransport };
|
|
167
|
+
export { attachWsRpcTransport, isAllowedOrigin, isLoopbackHostname };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { it as DevframeRpcServerFunctions, m as DevframeNodeContext, rt as DevframeRpcClientFunctions } from "./devframe-
|
|
1
|
+
import { it as DevframeRpcServerFunctions, m as DevframeNodeContext, rt as DevframeRpcClientFunctions } from "./devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { BirpcGroup } from "birpc";
|
|
3
3
|
import { NodeAdapter } from "crossws/adapters/node";
|
|
4
4
|
import { Server } from "node:http";
|
|
@@ -51,6 +51,14 @@ interface StartHttpAndWsOptions {
|
|
|
51
51
|
* Default: `true`.
|
|
52
52
|
*/
|
|
53
53
|
auth?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Extra origins to accept on the WS upgrade beyond the loopback default
|
|
56
|
+
* (`localhost`/`127.0.0.1`/`::1` and any `Origin`-less request from a
|
|
57
|
+
* native client). Add your LAN/tunnel origin here when reaching the tool
|
|
58
|
+
* from another host. Pass `false` to disable origin checking entirely
|
|
59
|
+
* (not recommended). Default: loopback-only.
|
|
60
|
+
*/
|
|
61
|
+
allowedOrigins?: readonly string[] | false;
|
|
54
62
|
/**
|
|
55
63
|
* Called once the WS server is bound so callers can mount static
|
|
56
64
|
* handlers whose origin depends on the resolved port, or print their
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as ScopedServerFunctions, G as DevframeScopedNodeContext, H as EntriesToObject, J as DevframeSettings, K as DevframeScopedNodeRpc, Q as ScopedClientFunctions, S as RpcStreamingHost, St as EventsMap, U as PartialWithoutId, W as Thenable, X as DevframeSettingsStore, Y as DevframeSettingsRegistry, Z as ScopedBroadcastOptions, _ as RpcFunctionsHost, _t as AgentToolInput, a as DevframeDuplicationStrategy, at as DevframeRpcSharedStates, b as RpcStreamingChannel, bt as EventEmitter, c as DevframeSpaOptions, ct as DevframeDiagnosticsDefinition, d as ConnectionMeta, dt as AgentHandle, et as ScopedSharedStates, f as ConnectionMetaWebsocket, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, i as DevframeDeploymentKind, it as DevframeRpcServerFunctions, l as DevframeWsOptions, lt as DevframeDiagnosticsHost, m as DevframeNodeContext, mt as AgentResourceContent, n as DevframeCliOptions, nt as DevframeViewHost, o as DevframeRuntime, ot as DevframeHost, p as DevframeCapabilities, pt as AgentResource, q as DevframeScopedStreamingHost, r as DevframeDefinition, rt as DevframeRpcClientFunctions, s as DevframeSetupInfo, st as DevframeDefineDiagnosticsOptions, t as DevframeBrowserContext, tt as SettingsForNamespace, u as defineDevframe, ut as DevframeDiagnosticsLogger, v as RpcSharedStateGetOptions, vt as DevframeAgentHost, x as RpcStreamingChannelOptions, xt as EventUnsubscribe, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "../devframe-
|
|
1
|
+
import { $ as ScopedServerFunctions, G as DevframeScopedNodeContext, H as EntriesToObject, J as DevframeSettings, K as DevframeScopedNodeRpc, Q as ScopedClientFunctions, S as RpcStreamingHost, St as EventsMap, U as PartialWithoutId, W as Thenable, X as DevframeSettingsStore, Y as DevframeSettingsRegistry, Z as ScopedBroadcastOptions, _ as RpcFunctionsHost, _t as AgentToolInput, a as DevframeDuplicationStrategy, at as DevframeRpcSharedStates, b as RpcStreamingChannel, bt as EventEmitter, c as DevframeSpaOptions, ct as DevframeDiagnosticsDefinition, d as ConnectionMeta, dt as AgentHandle, et as ScopedSharedStates, f as ConnectionMetaWebsocket, ft as AgentManifest, g as RpcBroadcastOptions, gt as AgentTool, h as DevframeNodeRpcSession, ht as AgentResourceInput, i as DevframeDeploymentKind, it as DevframeRpcServerFunctions, l as DevframeWsOptions, lt as DevframeDiagnosticsHost, m as DevframeNodeContext, mt as AgentResourceContent, n as DevframeCliOptions, nt as DevframeViewHost, o as DevframeRuntime, ot as DevframeHost, p as DevframeCapabilities, pt as AgentResource, q as DevframeScopedStreamingHost, r as DevframeDefinition, rt as DevframeRpcClientFunctions, s as DevframeSetupInfo, st as DevframeDefineDiagnosticsOptions, t as DevframeBrowserContext, tt as SettingsForNamespace, u as defineDevframe, ut as DevframeDiagnosticsLogger, v as RpcSharedStateGetOptions, vt as DevframeAgentHost, x as RpcStreamingChannelOptions, xt as EventUnsubscribe, y as RpcSharedStateHost, yt as DevframeAgentHostEvents } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
import { g as RpcFunctionAgentOptions } from "../types-DZEx4ffs.mjs";
|
|
3
|
-
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-
|
|
3
|
+
import { t as DevframeNodeRpcSessionMeta } from "../ws-server-Bc2wBHl-.mjs";
|
|
4
4
|
export { AgentHandle, AgentManifest, AgentResource, AgentResourceContent, AgentResourceInput, AgentTool, AgentToolInput, ConnectionMeta, ConnectionMetaWebsocket, DevframeAgentHost, DevframeAgentHostEvents, DevframeBrowserContext, DevframeCapabilities, DevframeCliOptions, DevframeDefineDiagnosticsOptions, DevframeDefinition, DevframeDeploymentKind, DevframeDiagnosticsDefinition, DevframeDiagnosticsHost, DevframeDiagnosticsLogger, DevframeDuplicationStrategy, DevframeHost, DevframeNodeContext, DevframeNodeRpcSession, DevframeNodeRpcSessionMeta, DevframeRpcClientFunctions, DevframeRpcServerFunctions, DevframeRpcSharedStates, DevframeRuntime, DevframeScopedNodeContext, DevframeScopedNodeRpc, DevframeScopedStreamingHost, DevframeSettings, DevframeSettingsRegistry, DevframeSettingsStore, DevframeSetupInfo, DevframeSpaOptions, DevframeViewHost, DevframeWsOptions, EntriesToObject, EventEmitter, EventUnsubscribe, EventsMap, PartialWithoutId, RpcBroadcastOptions, RpcFunctionAgentOptions, RpcFunctionsHost, RpcSharedStateGetOptions, RpcSharedStateHost, RpcStreamingChannel, RpcStreamingChannelOptions, RpcStreamingHost, ScopedBroadcastOptions, ScopedClientFunctions, ScopedServerFunctions, ScopedSharedStates, SettingsForNamespace, Thenable, defineDevframe };
|
package/dist/utils/events.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as launchEditor } from "../launch-editor-
|
|
1
|
+
import { t as launchEditor } from "../launch-editor-DPfltGA4.mjs";
|
|
2
2
|
export { launchEditor };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { B as SharedStatePatch, F as ImmutableObject, I as ImmutableSet, L as SharedState, M as Immutable, N as ImmutableArray, P as ImmutableMap, R as SharedStateEvents, V as createSharedState, z as SharedStateOptions } from "../devframe-
|
|
1
|
+
import { B as SharedStatePatch, F as ImmutableObject, I as ImmutableSet, L as SharedState, M as Immutable, N as ImmutableArray, P as ImmutableMap, R as SharedStateEvents, V as createSharedState, z as SharedStateOptions } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as createStreamReader, C as BufferedChunk, D as StreamReader, E as StreamErrorPayload, O as StreamSink, T as CreateStreamSinkOptions, j as createStreamSink, k as StreamSinkEvents, w as CreateStreamReaderOptions } from "../devframe-
|
|
1
|
+
import { A as createStreamReader, C as BufferedChunk, D as StreamReader, E as StreamErrorPayload, O as StreamSink, T as CreateStreamSinkOptions, j as createStreamSink, k as StreamSinkEvents, w as CreateStreamReaderOptions } from "../devframe-D-gr9sBx.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|
|
@@ -57,6 +57,13 @@ interface WsRpcTransportOptions {
|
|
|
57
57
|
destroyUnmatched?: boolean;
|
|
58
58
|
/** When set, a new https.Server is created and the WS endpoint is attached to it. */
|
|
59
59
|
https?: ServerOptions;
|
|
60
|
+
/**
|
|
61
|
+
* Extra origins to accept on the WS upgrade beyond the loopback default.
|
|
62
|
+
* Add your LAN/tunnel origin here when reaching the tool from another host.
|
|
63
|
+
* Pass `false` to disable origin checking entirely (not recommended).
|
|
64
|
+
* Default: loopback-only.
|
|
65
|
+
*/
|
|
66
|
+
allowedOrigins?: readonly string[] | false;
|
|
60
67
|
/**
|
|
61
68
|
* RPC function definitions, used by the per-call wire serializer to
|
|
62
69
|
* dispatch between strict-JSON and structured-clone encoding based
|
|
@@ -88,6 +95,15 @@ interface WsRpcTransport {
|
|
|
88
95
|
*/
|
|
89
96
|
close: () => Promise<void>;
|
|
90
97
|
}
|
|
98
|
+
declare function isLoopbackHostname(hostname: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Default origin policy for a localhost dev tool: allow requests with no
|
|
101
|
+
* `Origin` header (native, non-browser clients), allow any loopback origin
|
|
102
|
+
* (so cross-port localhost dev setups keep working), and allow explicitly
|
|
103
|
+
* configured origins. Everything else — a real remote page in the dev's
|
|
104
|
+
* browser — is rejected.
|
|
105
|
+
*/
|
|
106
|
+
declare function isAllowedOrigin(origin: string | undefined, allowedOrigins: readonly string[]): boolean;
|
|
91
107
|
/**
|
|
92
108
|
* Attach a WebSocket transport to an existing RPC group, powered by
|
|
93
109
|
* [crossws](https://crossws.h3.dev). Either attach to an existing HTTP(S)
|
|
@@ -100,4 +116,4 @@ interface WsRpcTransport {
|
|
|
100
116
|
*/
|
|
101
117
|
declare function attachWsRpcTransport<ClientFunctions extends object, ServerFunctions extends object>(rpcGroup: BirpcGroup<ClientFunctions, ServerFunctions, false>, options?: WsRpcTransportOptions): WsRpcTransport;
|
|
102
118
|
//#endregion
|
|
103
|
-
export { attachWsRpcTransport as i, WsRpcTransport as n, WsRpcTransportOptions as r, DevframeNodeRpcSessionMeta as t };
|
|
119
|
+
export { isAllowedOrigin as a, attachWsRpcTransport as i, WsRpcTransport as n, isLoopbackHostname as o, WsRpcTransportOptions as r, DevframeNodeRpcSessionMeta as t };
|