devframe 0.9.0-beta.1 → 0.9.0-beta.10
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-DmpWW-HH.d.mts → _shared-BPmX9fqK.d.mts} +2 -4
- package/dist/{_shared-CttmCMBi.mjs → _shared-CbZ_yhbz.mjs} +2 -4
- package/dist/adapters/build.d.mts +10 -12
- package/dist/adapters/build.mjs +26 -30
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +6 -7
- package/dist/adapters/dev.d.mts +22 -8
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +5 -4
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +1 -8
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/{agent-tool-name-C3b5vEwJ.mjs → agent-tool-name-EgfoFO8C.mjs} +0 -3
- package/dist/cli/main.d.mts +0 -2
- package/dist/cli/main.mjs +4 -8
- package/dist/client/index.d.mts +5 -5
- package/dist/client/index.mjs +24 -1179
- package/dist/constants.d.mts +10 -2
- package/dist/constants.mjs +10 -2
- package/dist/{context-CSCwoABx.d.mts → context-B3YUu_95.d.mts} +19 -1
- package/dist/{context-Du11TLcO.mjs → context-CEe4PBz1.mjs} +23 -305
- package/dist/{context-C33rR7n0.mjs → context-xdynGSLP.mjs} +10 -1
- package/dist/{dev-BEveeA5H.mjs → dev--rAPzbvO.mjs} +16 -10
- package/dist/{devframe-Bdd9YXTy.d.mts → devframe-DJMg0WLe.d.mts} +97 -113
- package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
- package/dist/{diagnostics-DLYH5oD3.mjs → diagnostics-DOQPnQmX.mjs} +35 -5
- package/dist/{dist-D8jAMwxU.mjs → dist-eNI9qM_I.mjs} +1 -0
- package/dist/{host-agent-CpbAoqBx.mjs → host-agent-xLCSe65D.mjs} +41 -7
- package/dist/{host-h3-CzCZwtuV.mjs → host-h3-Crkzm42q.mjs} +2 -2
- package/dist/{http-DLr_cJZ7.mjs → http-DYpK0cUi.mjs} +5 -12
- package/dist/{index-CZRd2K1C.d.mts → index-CB-fSUyn.d.mts} +2 -2
- package/dist/{index-DSCq4M4q.d.mts → index-tdrk1bzV.d.mts} +1 -1
- package/dist/index.d.mts +7 -5
- package/dist/{instance-registry-BQqGoDO9.mjs → instance-registry-WvQkt42E.mjs} +1 -7
- package/dist/{instance-shell-KRdee1QF.mjs → instance-shell-CMFyszWJ.mjs} +9 -8
- package/dist/{instance-shell-DBTXTSjN.d.mts → instance-shell-CljiKq1c.d.mts} +3 -12
- package/dist/internal/index.d.mts +265 -18
- package/dist/internal/index.mjs +9 -7
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +1 -1
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +3 -3
- package/dist/node/index.mjs +2 -2
- package/dist/nostics-CzECRXpE.mjs +59 -0
- package/dist/nostics-SPGDgHEP.d.mts +33 -0
- package/dist/recipes/common-rpc-functions.d.mts +3 -3
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +3 -3
- package/dist/remote-assets-Bg4gCUZ_.d.mts +123 -0
- package/dist/remote-assets-nTTxY2MU.mjs +636 -0
- package/dist/rpc/dump.d.mts +1 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +2 -2
- package/dist/rpc/index.mjs +3 -3
- package/dist/rpc/transports/sse-client.d.mts +1 -1
- package/dist/rpc/transports/sse-client.mjs +1 -1
- package/dist/rpc/transports/sse-server.d.mts +2 -2
- package/dist/rpc/transports/sse-server.mjs +2 -2
- package/dist/rpc/transports/ws-bun.d.mts +2 -2
- package/dist/rpc/transports/ws-bun.mjs +1 -1
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +1 -1
- package/dist/{rpc-core-CGctXToO.d.mts → rpc-core-Cc4lucI0.d.mts} +3 -3
- package/dist/{rpc-core-CqcJkAu9.mjs → rpc-core-DMTe-hLo.mjs} +1 -1
- package/dist/{serialization-BHY8M5NQ.mjs → serialization-BGzEwAdr.mjs} +1 -1
- package/dist/{sse-client-BsIK3hMD.d.mts → sse-client-CFBOIaUi.d.mts} +1 -1
- package/dist/state-Cc1IeSmQ.mjs +1291 -0
- package/dist/{static-CvjkO8QE.mjs → static-BPZ1_OPA.mjs} +2 -2
- package/dist/storage-CYye7P7L.mjs +137 -0
- package/dist/types/index.d.mts +6 -4
- package/dist/{types-CnJSgRVa.d.mts → types-Djq7CBXh.d.mts} +0 -7
- package/dist/utils/agent-tool-name.d.mts +0 -3
- package/dist/utils/agent-tool-name.mjs +0 -3
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/get-port.d.mts +17 -0
- package/dist/utils/get-port.mjs +2 -0
- package/dist/utils/nostics.d.mts +2 -0
- package/dist/utils/nostics.mjs +2 -0
- package/dist/utils/open.d.mts +2 -10
- package/dist/utils/open.mjs +56 -1
- package/dist/utils/remote-assets.d.mts +15 -0
- package/dist/utils/remote-assets.mjs +2 -0
- package/dist/utils/serve-static.d.mts +13 -5
- package/dist/utils/serve-static.mjs +119 -9
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{validation-BiuDXTKW.mjs → validation-CpXFB6Dz.mjs} +1 -1
- package/dist/{wire-codec-9VhIKnyp.mjs → wire-codec-0K-o5MYW.mjs} +1 -3
- package/dist/{ws-client-CdNuATYa.d.mts → ws-client-DhjNyQo3.d.mts} +1 -1
- package/dist/{ws-server-Bk1hOG3X.mjs → ws-server-BdSLrhxE.mjs} +1 -1
- package/dist/{ws-server-Ces08fjP.d.mts → ws-server-D1d3QM9f.d.mts} +1 -1
- package/package.json +4 -4
- package/skills/devframe/SKILL.md +10 -11
- package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
- package/dist/helpers/vite.d.mts +0 -104
- package/dist/helpers/vite.mjs +0 -93
- package/dist/open-Dz4V4irZ.mjs +0 -547
- package/dist/state-BeUHDDjk.mjs +0 -108
- package/dist/storage-BcmVEJRc.mjs +0 -1122
- package/skills/devframe/templates/spa-devframe.ts +0 -38
package/dist/constants.d.mts
CHANGED
|
@@ -39,7 +39,6 @@ declare const DEVFRAME_SSE_SESSION_HEADER = "x-birpc-session";
|
|
|
39
39
|
declare const DEVFRAME_MCP_ROUTE = "__mcp";
|
|
40
40
|
declare const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
|
|
41
41
|
declare const DEVFRAME_DOCK_IMPORTS_FILENAME = "__client-imports.js";
|
|
42
|
-
declare const DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID = "/__devframe-client-imports.js";
|
|
43
42
|
declare const DEVFRAME_RPC_DUMP_DIRNAME = "__rpc-dump";
|
|
44
43
|
/**
|
|
45
44
|
* URL fragment / query parameter name carrying the remote dock
|
|
@@ -70,6 +69,15 @@ declare const DEVFRAME_AUTH_TOKEN_QUERY_PARAM = "devframe_auth_token";
|
|
|
70
69
|
declare const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
|
|
71
70
|
/** Token that authorizes an external viewer origin registration. */
|
|
72
71
|
declare const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
|
|
72
|
+
/**
|
|
73
|
+
* `postMessage` type the remote-assets fallback page posts to `window.parent`
|
|
74
|
+
* on load. That page is what a devframe serves (with a 502) when its client
|
|
75
|
+
* assets can be reached neither locally nor through their CDN provider — the
|
|
76
|
+
* message lets an embedding viewer replace the bare page with its own UI
|
|
77
|
+
* (`@devframes/hub-ui` does, in its iframe view). Payload shape:
|
|
78
|
+
* `RemoteAssetsErrorMessage` (`devframe/types`).
|
|
79
|
+
*/
|
|
80
|
+
declare const DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE = "devframe:remote-assets-error";
|
|
73
81
|
/**
|
|
74
82
|
* Prefix that marks an RPC method as callable before a connection is
|
|
75
83
|
* trusted. This is the *only* rule the pre-trust gate applies — there is no
|
|
@@ -86,4 +94,4 @@ declare const ANONYMOUS_RPC_PREFIX = "anonymous:";
|
|
|
86
94
|
*/
|
|
87
95
|
declare function isAnonymousRpcMethod(name: string): boolean;
|
|
88
96
|
//#endregion
|
|
89
|
-
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME,
|
|
97
|
+
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
|
package/dist/constants.mjs
CHANGED
|
@@ -39,7 +39,6 @@ const DEVFRAME_SSE_SESSION_HEADER = "x-birpc-session";
|
|
|
39
39
|
const DEVFRAME_MCP_ROUTE = "__mcp";
|
|
40
40
|
const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
|
|
41
41
|
const DEVFRAME_DOCK_IMPORTS_FILENAME = "__client-imports.js";
|
|
42
|
-
const DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID = "/__devframe-client-imports.js";
|
|
43
42
|
const DEVFRAME_RPC_DUMP_DIRNAME = "__rpc-dump";
|
|
44
43
|
/**
|
|
45
44
|
* URL fragment / query parameter name carrying the remote dock
|
|
@@ -71,6 +70,15 @@ const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
|
|
|
71
70
|
/** Token that authorizes an external viewer origin registration. */
|
|
72
71
|
const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
|
|
73
72
|
/**
|
|
73
|
+
* `postMessage` type the remote-assets fallback page posts to `window.parent`
|
|
74
|
+
* on load. That page is what a devframe serves (with a 502) when its client
|
|
75
|
+
* assets can be reached neither locally nor through their CDN provider — the
|
|
76
|
+
* message lets an embedding viewer replace the bare page with its own UI
|
|
77
|
+
* (`@devframes/hub-ui` does, in its iframe view). Payload shape:
|
|
78
|
+
* `RemoteAssetsErrorMessage` (`devframe/types`).
|
|
79
|
+
*/
|
|
80
|
+
const DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE = "devframe:remote-assets-error";
|
|
81
|
+
/**
|
|
74
82
|
* Prefix that marks an RPC method as callable before a connection is
|
|
75
83
|
* trusted. This is the *only* rule the pre-trust gate applies — there is no
|
|
76
84
|
* per-method allowlist. Any handshake method a host adapter needs to reach
|
|
@@ -88,4 +96,4 @@ function isAnonymousRpcMethod(name) {
|
|
|
88
96
|
return name.startsWith(ANONYMOUS_RPC_PREFIX);
|
|
89
97
|
}
|
|
90
98
|
//#endregion
|
|
91
|
-
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME,
|
|
99
|
+
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_DOCK_IMPORTS_FILENAME, DEVFRAME_MCP_ROUTE, DEVFRAME_OTP_URL_PARAM, DEVFRAME_REMOTE_ASSETS_ERROR_MESSAGE_TYPE, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME, DEVFRAME_SSE_ROUTE, DEVFRAME_SSE_SESSION_HEADER, DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM, DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM, DEVFRAME_WS_ROUTE, REMOTE_CONNECTION_KEY, isAnonymousRpcMethod };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { g as DevframeNodeContext, lt as SharedState } from "./devframe-DJMg0WLe.mjs";
|
|
2
2
|
//#region src/node/hub-internals/context.d.ts
|
|
3
3
|
interface InternalAnonymousAuthStorage {
|
|
4
4
|
trusted: Record<string, {
|
|
@@ -44,6 +44,24 @@ interface DevframeInternalContext {
|
|
|
44
44
|
/** Full `ws://` or `wss://` URL with host and port. */
|
|
45
45
|
url: string;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Set {@link DevframeInternalContext.wsEndpoint} and notify subscribers —
|
|
49
|
+
* the WS-binding tiers (side-car, shared-server, and the `unbound` tier's
|
|
50
|
+
* `attach()`) call this once the socket is bound (or `undefined` once torn
|
|
51
|
+
* down) instead of assigning the field directly, so anything that already
|
|
52
|
+
* projected the endpoint (a hub's remote-dock URLs, registered before an
|
|
53
|
+
* async bind resolves) gets a chance to re-project it.
|
|
54
|
+
*/
|
|
55
|
+
setWsEndpoint: (endpoint: {
|
|
56
|
+
url: string;
|
|
57
|
+
} | undefined) => void;
|
|
58
|
+
/**
|
|
59
|
+
* Subscribe to every {@link DevframeInternalContext.setWsEndpoint} call.
|
|
60
|
+
* Returns an unsubscribe function. The hub context uses this to refresh
|
|
61
|
+
* the `devframe:docks` shared state so a remote dock registered before the
|
|
62
|
+
* WS port resolves still ends up with a live connection URL.
|
|
63
|
+
*/
|
|
64
|
+
onWsEndpointChange: (cb: () => void) => () => void;
|
|
47
65
|
}
|
|
48
66
|
declare const internalContextMap: WeakMap<DevframeNodeContext, DevframeInternalContext>;
|
|
49
67
|
declare function getInternalContext(context: DevframeNodeContext): DevframeInternalContext;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as diagnostics } from "./diagnostics-
|
|
1
|
+
import { i as defineDiagnostics } from "./nostics-CzECRXpE.mjs";
|
|
2
|
+
import { t as diagnostics } from "./diagnostics-CD8nlgll.mjs";
|
|
3
3
|
import { RpcFunctionsCollectorBase } from "./rpc/index.mjs";
|
|
4
4
|
import { defineRpcFunction } from "./index.mjs";
|
|
5
|
-
import { t as diagnostics$1 } from "./diagnostics-
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { formatWithOptions, inspect } from "node:util";
|
|
5
|
+
import { t as diagnostics$1 } from "./diagnostics-DOQPnQmX.mjs";
|
|
6
|
+
import { r as createEventEmitter, t as DevframeAgentHost } from "./host-agent-xLCSe65D.mjs";
|
|
7
|
+
import { n as createDebug, t as resolveStaticAssetsSource } from "./remote-assets-nTTxY2MU.mjs";
|
|
8
|
+
import { t as createStorage } from "./storage-CYye7P7L.mjs";
|
|
9
|
+
import { createSharedState } from "devframe/utils/shared-state";
|
|
11
10
|
import { existsSync } from "node:fs";
|
|
12
11
|
import { join } from "pathe";
|
|
13
12
|
//#region src/node/host-diagnostics.ts
|
|
@@ -15,12 +14,7 @@ var DevframeDiagnosticsHost = class {
|
|
|
15
14
|
context;
|
|
16
15
|
_registry = {};
|
|
17
16
|
logger = new Proxy({}, { get: (_, code) => this._registry[code] });
|
|
18
|
-
defineDiagnostics =
|
|
19
|
-
return defineDiagnostics({
|
|
20
|
-
...opts,
|
|
21
|
-
reporters: [devframeReporter, ...opts.reporters ?? []]
|
|
22
|
-
});
|
|
23
|
-
};
|
|
17
|
+
defineDiagnostics = defineDiagnostics;
|
|
24
18
|
constructor(context, initialDefinitions = []) {
|
|
25
19
|
this.context = context;
|
|
26
20
|
for (const d of initialDefinitions) this.register(d);
|
|
@@ -30,291 +24,6 @@ var DevframeDiagnosticsHost = class {
|
|
|
30
24
|
}
|
|
31
25
|
};
|
|
32
26
|
//#endregion
|
|
33
|
-
//#region ../../node_modules/.pnpm/obug@2.1.4/node_modules/obug/dist/core.js
|
|
34
|
-
/**
|
|
35
|
-
* Coerce `value`.
|
|
36
|
-
*/
|
|
37
|
-
function coerce(value) {
|
|
38
|
-
if (value instanceof Error) return value.stack || value.message;
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Selects a color for a debug namespace
|
|
43
|
-
* @return An ANSI color code for the given namespace
|
|
44
|
-
*/
|
|
45
|
-
function selectColor(colors, namespace) {
|
|
46
|
-
let hash = 0;
|
|
47
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
48
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
49
|
-
hash |= 0;
|
|
50
|
-
}
|
|
51
|
-
return colors[Math.abs(hash) % colors.length];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Checks if the given string matches a namespace template, honoring
|
|
55
|
-
* asterisks as wildcards.
|
|
56
|
-
*/
|
|
57
|
-
function matchesTemplate(search, template) {
|
|
58
|
-
let searchIndex = 0;
|
|
59
|
-
let templateIndex = 0;
|
|
60
|
-
let starIndex = -1;
|
|
61
|
-
let matchIndex = 0;
|
|
62
|
-
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
63
|
-
starIndex = templateIndex;
|
|
64
|
-
matchIndex = searchIndex;
|
|
65
|
-
templateIndex++;
|
|
66
|
-
} else {
|
|
67
|
-
searchIndex++;
|
|
68
|
-
templateIndex++;
|
|
69
|
-
}
|
|
70
|
-
else if (starIndex !== -1) {
|
|
71
|
-
templateIndex = starIndex + 1;
|
|
72
|
-
matchIndex++;
|
|
73
|
-
searchIndex = matchIndex;
|
|
74
|
-
} else return false;
|
|
75
|
-
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
76
|
-
return templateIndex === template.length;
|
|
77
|
-
}
|
|
78
|
-
function humanize(value) {
|
|
79
|
-
if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
|
|
80
|
-
return `${value}ms`;
|
|
81
|
-
}
|
|
82
|
-
let globalNamespaces = "";
|
|
83
|
-
function createDebug$1(namespace, options) {
|
|
84
|
-
let prevTime;
|
|
85
|
-
let enableOverride;
|
|
86
|
-
let namespacesCache;
|
|
87
|
-
let enabledCache;
|
|
88
|
-
const debug = (...args) => {
|
|
89
|
-
if (!debug.enabled) return;
|
|
90
|
-
const curr = Date.now();
|
|
91
|
-
const diff = curr - (prevTime || curr);
|
|
92
|
-
prevTime = curr;
|
|
93
|
-
args[0] = coerce(args[0]);
|
|
94
|
-
if (typeof args[0] !== "string") args.unshift("%O");
|
|
95
|
-
let index = 0;
|
|
96
|
-
args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => {
|
|
97
|
-
if (match === "%%") return "%";
|
|
98
|
-
index++;
|
|
99
|
-
const formatter = options.formatters[format];
|
|
100
|
-
if (typeof formatter === "function") {
|
|
101
|
-
const value = args[index];
|
|
102
|
-
match = formatter.call(debug, value);
|
|
103
|
-
args.splice(index, 1);
|
|
104
|
-
index--;
|
|
105
|
-
}
|
|
106
|
-
return match;
|
|
107
|
-
});
|
|
108
|
-
options.formatArgs.call(debug, diff, args);
|
|
109
|
-
debug.log(...args);
|
|
110
|
-
};
|
|
111
|
-
debug.extend = function(namespace, delimiter = ":") {
|
|
112
|
-
return createDebug$1(this.namespace + delimiter + namespace, {
|
|
113
|
-
useColors: this.useColors,
|
|
114
|
-
color: this.color,
|
|
115
|
-
formatArgs: this.formatArgs,
|
|
116
|
-
formatters: this.formatters,
|
|
117
|
-
inspectOpts: this.inspectOpts,
|
|
118
|
-
log: this.log,
|
|
119
|
-
humanize: this.humanize
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
Object.assign(debug, options);
|
|
123
|
-
debug.namespace = namespace;
|
|
124
|
-
Object.defineProperty(debug, "enabled", {
|
|
125
|
-
enumerable: true,
|
|
126
|
-
configurable: false,
|
|
127
|
-
get: () => {
|
|
128
|
-
if (enableOverride != null) return enableOverride;
|
|
129
|
-
if (namespacesCache !== globalNamespaces) {
|
|
130
|
-
namespacesCache = globalNamespaces;
|
|
131
|
-
enabledCache = enabled(namespace);
|
|
132
|
-
}
|
|
133
|
-
return enabledCache;
|
|
134
|
-
},
|
|
135
|
-
set: (v) => {
|
|
136
|
-
enableOverride = v;
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
return debug;
|
|
140
|
-
}
|
|
141
|
-
let names = [];
|
|
142
|
-
let skips = [];
|
|
143
|
-
function enable(namespaces) {
|
|
144
|
-
globalNamespaces = namespaces;
|
|
145
|
-
names = [];
|
|
146
|
-
skips = [];
|
|
147
|
-
const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
148
|
-
for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1));
|
|
149
|
-
else names.push(ns);
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
153
|
-
*/
|
|
154
|
-
function enabled(name) {
|
|
155
|
-
for (const skip of skips) if (matchesTemplate(name, skip)) return false;
|
|
156
|
-
for (const ns of names) if (matchesTemplate(name, ns)) return true;
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
//#endregion
|
|
160
|
-
//#region ../../node_modules/.pnpm/obug@2.1.4/node_modules/obug/dist/node.js
|
|
161
|
-
let env = {};
|
|
162
|
-
try {
|
|
163
|
-
process.env.DEBUG;
|
|
164
|
-
env = process.env;
|
|
165
|
-
} catch (_unused) {}
|
|
166
|
-
const colors = process.stderr.getColorDepth && process.stderr.getColorDepth(env) > 2 ? [
|
|
167
|
-
20,
|
|
168
|
-
21,
|
|
169
|
-
26,
|
|
170
|
-
27,
|
|
171
|
-
32,
|
|
172
|
-
33,
|
|
173
|
-
38,
|
|
174
|
-
39,
|
|
175
|
-
40,
|
|
176
|
-
41,
|
|
177
|
-
42,
|
|
178
|
-
43,
|
|
179
|
-
44,
|
|
180
|
-
45,
|
|
181
|
-
56,
|
|
182
|
-
57,
|
|
183
|
-
62,
|
|
184
|
-
63,
|
|
185
|
-
68,
|
|
186
|
-
69,
|
|
187
|
-
74,
|
|
188
|
-
75,
|
|
189
|
-
76,
|
|
190
|
-
77,
|
|
191
|
-
78,
|
|
192
|
-
79,
|
|
193
|
-
80,
|
|
194
|
-
81,
|
|
195
|
-
92,
|
|
196
|
-
93,
|
|
197
|
-
98,
|
|
198
|
-
99,
|
|
199
|
-
112,
|
|
200
|
-
113,
|
|
201
|
-
128,
|
|
202
|
-
129,
|
|
203
|
-
134,
|
|
204
|
-
135,
|
|
205
|
-
148,
|
|
206
|
-
149,
|
|
207
|
-
160,
|
|
208
|
-
161,
|
|
209
|
-
162,
|
|
210
|
-
163,
|
|
211
|
-
164,
|
|
212
|
-
165,
|
|
213
|
-
166,
|
|
214
|
-
167,
|
|
215
|
-
168,
|
|
216
|
-
169,
|
|
217
|
-
170,
|
|
218
|
-
171,
|
|
219
|
-
172,
|
|
220
|
-
173,
|
|
221
|
-
178,
|
|
222
|
-
179,
|
|
223
|
-
184,
|
|
224
|
-
185,
|
|
225
|
-
196,
|
|
226
|
-
197,
|
|
227
|
-
198,
|
|
228
|
-
199,
|
|
229
|
-
200,
|
|
230
|
-
201,
|
|
231
|
-
202,
|
|
232
|
-
203,
|
|
233
|
-
204,
|
|
234
|
-
205,
|
|
235
|
-
206,
|
|
236
|
-
207,
|
|
237
|
-
208,
|
|
238
|
-
209,
|
|
239
|
-
214,
|
|
240
|
-
215,
|
|
241
|
-
220,
|
|
242
|
-
221
|
|
243
|
-
] : [
|
|
244
|
-
6,
|
|
245
|
-
2,
|
|
246
|
-
3,
|
|
247
|
-
4,
|
|
248
|
-
5,
|
|
249
|
-
1
|
|
250
|
-
];
|
|
251
|
-
const inspectOpts = Object.keys(env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => {
|
|
252
|
-
const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase());
|
|
253
|
-
let value = env[key];
|
|
254
|
-
const lowerCase = typeof value === "string" && value.toLowerCase();
|
|
255
|
-
if (value === "null") value = null;
|
|
256
|
-
else if (lowerCase === "yes" || lowerCase === "on" || lowerCase === "true" || lowerCase === "enabled") value = true;
|
|
257
|
-
else if (lowerCase === "no" || lowerCase === "off" || lowerCase === "false" || lowerCase === "disabled") value = false;
|
|
258
|
-
else value = Number(value);
|
|
259
|
-
obj[prop] = value;
|
|
260
|
-
return obj;
|
|
261
|
-
}, Object.create(null));
|
|
262
|
-
/**
|
|
263
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
264
|
-
*/
|
|
265
|
-
function useColors() {
|
|
266
|
-
return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd);
|
|
267
|
-
}
|
|
268
|
-
function getDate() {
|
|
269
|
-
if (inspectOpts.hideDate) return "";
|
|
270
|
-
return `${(/* @__PURE__ */ new Date()).toISOString()} `;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Adds ANSI color escape codes if enabled.
|
|
274
|
-
*/
|
|
275
|
-
function formatArgs(diff, args) {
|
|
276
|
-
const { namespace: name, useColors } = this;
|
|
277
|
-
if (useColors) {
|
|
278
|
-
const c = this.color;
|
|
279
|
-
const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`;
|
|
280
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
281
|
-
args[0] = prefix + args[0].split("\n").join(`\n${prefix}`);
|
|
282
|
-
args.push(`${colorCode}m+${this.humanize(diff)}\u001B[0m`);
|
|
283
|
-
} else args[0] = `${getDate()}${name} ${args[0]}`;
|
|
284
|
-
}
|
|
285
|
-
function log(...args) {
|
|
286
|
-
process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}\n`);
|
|
287
|
-
}
|
|
288
|
-
const defaultOptions = {
|
|
289
|
-
useColors: useColors(),
|
|
290
|
-
formatArgs,
|
|
291
|
-
formatters: {
|
|
292
|
-
/**
|
|
293
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
294
|
-
*/
|
|
295
|
-
o(v) {
|
|
296
|
-
this.inspectOpts.colors = this.useColors;
|
|
297
|
-
return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" ");
|
|
298
|
-
},
|
|
299
|
-
/**
|
|
300
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
301
|
-
*/
|
|
302
|
-
O(v) {
|
|
303
|
-
this.inspectOpts.colors = this.useColors;
|
|
304
|
-
return inspect(v, this.inspectOpts);
|
|
305
|
-
}
|
|
306
|
-
},
|
|
307
|
-
inspectOpts,
|
|
308
|
-
log,
|
|
309
|
-
humanize
|
|
310
|
-
};
|
|
311
|
-
function createDebug(namespace, options) {
|
|
312
|
-
var _ref;
|
|
313
|
-
const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
|
|
314
|
-
return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options));
|
|
315
|
-
}
|
|
316
|
-
enable(env.DEBUG || "");
|
|
317
|
-
//#endregion
|
|
318
27
|
//#region src/node/rpc-shared-state.ts
|
|
319
28
|
const debug$1 = createDebug("devframe:rpc:state:changed");
|
|
320
29
|
const debugSubscribe = createDebug("devframe:rpc:state:subscribe");
|
|
@@ -431,6 +140,15 @@ function createRpcSharedStateServerHost(rpc) {
|
|
|
431
140
|
return host;
|
|
432
141
|
}
|
|
433
142
|
//#endregion
|
|
143
|
+
//#region src/utils/nanoid.ts
|
|
144
|
+
const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
|
|
145
|
+
function nanoid(size = 21) {
|
|
146
|
+
let id = "";
|
|
147
|
+
let i = size;
|
|
148
|
+
while (i--) id += urlAlphabet[Math.random() * 64 | 0];
|
|
149
|
+
return id;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
434
152
|
//#region src/utils/streaming-channel.ts
|
|
435
153
|
const DEFAULT_HIGH_WATER_MARK = 256;
|
|
436
154
|
var StreamClosedError = class extends Error {
|
|
@@ -1093,13 +811,14 @@ var DevframeViewHost = class {
|
|
|
1093
811
|
constructor(context) {
|
|
1094
812
|
this.context = context;
|
|
1095
813
|
}
|
|
1096
|
-
hostStatic(baseUrl,
|
|
1097
|
-
|
|
814
|
+
hostStatic(baseUrl, source) {
|
|
815
|
+
const resolved = resolveStaticAssetsSource(source, this.context.host.getStorageDir("project"));
|
|
816
|
+
if (typeof resolved === "string" && !existsSync(resolved)) throw diagnostics$1.DF0008({ distDir: resolved });
|
|
1098
817
|
this.buildStaticDirs.push({
|
|
1099
818
|
baseUrl,
|
|
1100
|
-
|
|
819
|
+
source
|
|
1101
820
|
});
|
|
1102
|
-
this.context.host.mountStatic(baseUrl,
|
|
821
|
+
this.context.host.mountStatic(baseUrl, resolved);
|
|
1103
822
|
}
|
|
1104
823
|
};
|
|
1105
824
|
//#endregion
|
|
@@ -1131,8 +850,6 @@ const agentListResources = defineRpcFunction({
|
|
|
1131
850
|
* Built-in agent introspection RPC functions. Registered automatically
|
|
1132
851
|
* by `createHostContext`. Not themselves agent-exposed (no `agent`
|
|
1133
852
|
* field) — they power the MCP adapter and any future agent CLI.
|
|
1134
|
-
*
|
|
1135
|
-
* @experimental
|
|
1136
853
|
*/
|
|
1137
854
|
const BUILTIN_AGENT_RPC = [
|
|
1138
855
|
defineRpcFunction({
|
|
@@ -1297,6 +1014,7 @@ async function createHostContext(options) {
|
|
|
1297
1014
|
diagnostics: void 0,
|
|
1298
1015
|
agent: void 0,
|
|
1299
1016
|
services: void 0,
|
|
1017
|
+
staticConfig: {},
|
|
1300
1018
|
scope: void 0
|
|
1301
1019
|
};
|
|
1302
1020
|
const rpcHost = new RpcFunctionsHostImpl(context);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as randomToken } from "./crypto-token-XCqTSMg9.mjs";
|
|
2
|
-
import { t as createStorage } from "./storage-
|
|
2
|
+
import { t as createStorage } from "./storage-CYye7P7L.mjs";
|
|
3
3
|
import { n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-DZbJ7Cl0.mjs";
|
|
4
4
|
import { join } from "pathe";
|
|
5
5
|
//#region src/node/hub-internals/context.ts
|
|
@@ -11,6 +11,7 @@ function getInternalContext(context) {
|
|
|
11
11
|
initialValue: { trusted: {} }
|
|
12
12
|
});
|
|
13
13
|
const remoteTokens = /* @__PURE__ */ new Map();
|
|
14
|
+
const wsEndpointListeners = /* @__PURE__ */ new Set();
|
|
14
15
|
function revokeRemoteToken(token) {
|
|
15
16
|
if (!remoteTokens.delete(token)) return;
|
|
16
17
|
revokeActiveConnectionsForToken(context, token);
|
|
@@ -18,6 +19,14 @@ function getInternalContext(context) {
|
|
|
18
19
|
const internalContext = {
|
|
19
20
|
storage: { auth: storage },
|
|
20
21
|
revokeAuthToken: (token) => revokeAuthToken(context, storage, token),
|
|
22
|
+
setWsEndpoint(endpoint) {
|
|
23
|
+
internalContext.wsEndpoint = endpoint;
|
|
24
|
+
for (const listener of wsEndpointListeners) listener();
|
|
25
|
+
},
|
|
26
|
+
onWsEndpointChange(cb) {
|
|
27
|
+
wsEndpointListeners.add(cb);
|
|
28
|
+
return () => wsEndpointListeners.delete(cb);
|
|
29
|
+
},
|
|
21
30
|
remoteTokens,
|
|
22
31
|
allocateRemoteToken(dockId, origin, originLock) {
|
|
23
32
|
const token = randomToken();
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
|
-
import { t as diagnostics } from "./diagnostics-
|
|
3
|
-
import { t as createHostContext } from "./context-
|
|
4
|
-
import {
|
|
5
|
-
import { t as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
2
|
+
import { t as diagnostics } from "./diagnostics-DOQPnQmX.mjs";
|
|
3
|
+
import { t as createHostContext } from "./context-CEe4PBz1.mjs";
|
|
4
|
+
import { t as resolveStaticAssetsSource } from "./remote-assets-nTTxY2MU.mjs";
|
|
5
|
+
import { i as resolveMcpConnectionMeta, n as resolveBasePath, r as resolveDevServerPort, t as normalizeBasePath } from "./_shared-CbZ_yhbz.mjs";
|
|
6
|
+
import { t as createH3DevframeHost } from "./host-h3-Crkzm42q.mjs";
|
|
7
|
+
import { i as normalizeHttpServerUrl, n as resolveInstanceRegister, t as createInstanceShell } from "./instance-shell-CMFyszWJ.mjs";
|
|
8
|
+
import { open } from "./utils/open.mjs";
|
|
8
9
|
import { mountStaticHandler } from "./utils/serve-static.mjs";
|
|
9
10
|
import { createServer } from "node:http";
|
|
10
11
|
import { resolve } from "pathe";
|
|
@@ -86,7 +87,7 @@ function initDevframe(def, options) {
|
|
|
86
87
|
const mcpPath = joinURL(base, mcpMeta.path);
|
|
87
88
|
let mountMcpHttp;
|
|
88
89
|
try {
|
|
89
|
-
({mountMcpHttp} = await import("./http-
|
|
90
|
+
({mountMcpHttp} = await import("./http-DYpK0cUi.mjs").then((n) => n.t));
|
|
90
91
|
} catch (error) {
|
|
91
92
|
const reason = error instanceof Error ? error.message : String(error);
|
|
92
93
|
throw diagnostics.DF0017({
|
|
@@ -108,9 +109,12 @@ function initDevframe(def, options) {
|
|
|
108
109
|
...mcpDispose ? { dispose: mcpDispose } : {}
|
|
109
110
|
};
|
|
110
111
|
},
|
|
111
|
-
mount(
|
|
112
|
+
mount(context, meta) {
|
|
112
113
|
app.use(joinURL(base, DEVFRAME_CONNECTION_META_FILENAME), () => meta);
|
|
113
|
-
if (distDir)
|
|
114
|
+
if (distDir) {
|
|
115
|
+
const source = resolveStaticAssetsSource(distDir, context.host.getStorageDir("project"));
|
|
116
|
+
mountStaticHandler(app, base, typeof source === "string" ? resolve(source) : source);
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
const instance = {
|
|
@@ -138,7 +142,7 @@ function initDevframe(def, options) {
|
|
|
138
142
|
* server runs in **bridge mode**: only `__connection.json` and the WS
|
|
139
143
|
* endpoint are mounted, with no SPA mount. The SPA is expected to be
|
|
140
144
|
* hosted elsewhere (e.g. by a parent Vite/Nuxt dev server) — see
|
|
141
|
-
* `
|
|
145
|
+
* `devframeViteBridge` from `@devframes/vite`.
|
|
142
146
|
*
|
|
143
147
|
* Returns the underlying {@link StartedServer} handle so callers can
|
|
144
148
|
* close it gracefully (SIGINT, hot-reload, test teardown).
|
|
@@ -148,6 +152,7 @@ function initDevframe(def, options) {
|
|
|
148
152
|
* `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
|
|
149
153
|
*/
|
|
150
154
|
async function createDevServer(def, options = {}) {
|
|
155
|
+
if (def.capabilities?.dev === false && !options.force) throw diagnostics.DF0058({ id: def.id });
|
|
151
156
|
const host = options.host ?? def.cli?.host ?? "localhost";
|
|
152
157
|
const requestedPort = options.port ?? await resolveDevServerPort(def, { host });
|
|
153
158
|
const flags = options.flags ?? {};
|
|
@@ -182,6 +187,7 @@ async function createDevServer(def, options = {}) {
|
|
|
182
187
|
host,
|
|
183
188
|
origin,
|
|
184
189
|
ws: options.ws,
|
|
190
|
+
allowedOrigins: options.allowedOrigins,
|
|
185
191
|
sse: options.sse,
|
|
186
192
|
auth: flags.auth === false ? false : options.auth,
|
|
187
193
|
mcp: options.mcp,
|