devframe 0.8.2 → 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-BPmX9fqK.d.mts +41 -0
- package/dist/_shared-CbZ_yhbz.mjs +68 -0
- package/dist/adapters/build.d.mts +10 -12
- package/dist/adapters/build.mjs +26 -29
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +156 -1
- package/dist/adapters/dev.d.mts +38 -46
- package/dist/adapters/dev.mjs +2 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +224 -0
- package/dist/adapters/initiate.mjs +2 -0
- package/dist/adapters/mcp.d.mts +24 -7
- package/dist/adapters/mcp.mjs +2 -2
- 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 +71 -7
- package/dist/client/index.mjs +720 -1540
- package/dist/constants.d.mts +28 -7
- package/dist/constants.mjs +28 -7
- package/dist/{context-DoSozfvx.d.mts → context-B3YUu_95.d.mts} +19 -1
- package/dist/{host-h3-D2hYZvDK.mjs → context-CEe4PBz1.mjs} +25 -557
- package/dist/{context-CBg8iRbQ.mjs → context-xdynGSLP.mjs} +10 -1
- package/dist/dev--rAPzbvO.mjs +239 -0
- package/dist/{devframe-mQ4qZAuo.d.mts → devframe-DJMg0WLe.d.mts} +181 -134
- package/dist/{diagnostics-hwjXp_UV.mjs → diagnostics-CD8nlgll.mjs} +1 -3
- package/dist/{diagnostics-D7wM2cwM.mjs → diagnostics-DOQPnQmX.mjs} +51 -5
- package/dist/dist-eNI9qM_I.mjs +228 -0
- package/dist/host-agent-xLCSe65D.mjs +264 -0
- package/dist/host-h3-Crkzm42q.mjs +26 -0
- package/dist/{fetch-BKaD0Vb3.mjs → http-DYpK0cUi.mjs} +42 -11
- package/dist/{index-b64Uuhy2.d.mts → index-CB-fSUyn.d.mts} +2 -2
- package/dist/{index-Dbw1p5ch.d.mts → index-tdrk1bzV.d.mts} +3 -32
- package/dist/index.d.mts +12 -5
- package/dist/index.mjs +8 -1
- package/dist/{instance-registry-BnnA2Eoh.mjs → instance-registry-WvQkt42E.mjs} +9 -8
- package/dist/instance-shell-CMFyszWJ.mjs +486 -0
- package/dist/instance-shell-CljiKq1c.d.mts +255 -0
- package/dist/internal/index.d.mts +397 -0
- package/dist/internal/index.mjs +9 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +1 -1
- package/dist/node/hub-internals.d.mts +2 -14
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +4 -268
- package/dist/node/index.mjs +3 -5
- package/dist/nostics-CzECRXpE.mjs +59 -0
- package/dist/nostics-SPGDgHEP.d.mts +33 -0
- package/dist/recipes/common-rpc-functions.d.mts +4 -4
- package/dist/recipes/interactive-auth.d.mts +3 -3
- package/dist/recipes/interactive-auth.mjs +8 -8
- package/dist/remote-assets-Bg4gCUZ_.d.mts +123 -0
- package/dist/remote-assets-nTTxY2MU.mjs +636 -0
- package/dist/rolldown-runtime-JspESFgx.mjs +35 -0
- package/dist/rpc/dump.d.mts +77 -1
- package/dist/rpc/dump.mjs +1 -1
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -18
- package/dist/rpc/transports/sse-client.d.mts +2 -0
- package/dist/rpc/transports/sse-client.mjs +142 -0
- package/dist/rpc/transports/sse-server.d.mts +61 -0
- package/dist/rpc/transports/sse-server.mjs +209 -0
- package/dist/rpc/transports/ws-bun.d.mts +35 -0
- package/dist/rpc/transports/ws-bun.mjs +31 -0
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +10 -18
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/rpc/transports/ws-server.mjs +2 -235
- package/dist/rpc-core-Cc4lucI0.d.mts +48 -0
- package/dist/rpc-core-DMTe-hLo.mjs +81 -0
- package/dist/{serialization-C8Mnw9hK.mjs → serialization-BGzEwAdr.mjs} +2 -2
- package/dist/{shared-state-6kHolYZy.mjs → shared-state-fRRbRUtD.mjs} +1 -1
- package/dist/sse-client-CFBOIaUi.d.mts +37 -0
- package/dist/state-Cc1IeSmQ.mjs +1291 -0
- package/dist/{dump-CgZShDRB.mjs → static-BPZ1_OPA.mjs} +3 -266
- package/dist/storage-CYye7P7L.mjs +137 -0
- package/dist/types/index.d.mts +6 -4
- package/dist/types/index.mjs +1 -6
- 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/launch-editor.mjs +1 -25
- 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/shared-state.mjs +1 -1
- package/dist/utils/simple-schema.d.mts +101 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/validation-CpXFB6Dz.mjs +266 -0
- package/dist/wire-codec-0K-o5MYW.mjs +56 -0
- package/dist/{ws-client-B6Tnr0ic.d.mts → ws-client-DhjNyQo3.d.mts} +7 -2
- package/dist/ws-server-BdSLrhxE.mjs +267 -0
- package/dist/{ws-server-uKQcClcJ.d.mts → ws-server-D1d3QM9f.d.mts} +90 -9
- package/package.json +13 -12
- package/skills/devframe/SKILL.md +91 -93
- package/dist/_shared-bWRzeSa0.mjs +0 -19
- package/dist/adapters/cli.d.mts +0 -11
- package/dist/adapters/cli.mjs +0 -6
- package/dist/cac-D4_9ok0z.mjs +0 -157
- package/dist/dev-Bc49u3qg.mjs +0 -439
- package/dist/diagnostics-reporter-CsIG85Q5.mjs +0 -38
- package/dist/helpers/vite.d.mts +0 -100
- package/dist/helpers/vite.mjs +0 -105
- package/dist/http-C4T68YV6.mjs +0 -38
- package/dist/index-vAX6bYuc.d.mts +0 -78
- package/dist/open-Deb5xmIT.mjs +0 -547
- package/dist/recipes/open-helpers.d.mts +0 -6
- package/dist/recipes/open-helpers.mjs +0 -6
- package/dist/server-CD8XmBXl.mjs +0 -167
- package/dist/server-UHWae43Q.d.mts +0 -149
- package/dist/simple-schema-BDzLeJDk.d.mts +0 -102
- package/dist/state-BeUHDDjk.mjs +0 -108
- package/dist/storage-CTNVbuFB.mjs +0 -1122
- package/dist/utils/promise.d.mts +0 -8
- package/dist/utils/promise.mjs +0 -15
- package/dist/utils/scope.d.mts +0 -11
- package/dist/utils/scope.mjs +0 -15
- package/skills/devframe/templates/spa-devframe.ts +0 -38
package/dist/constants.d.mts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
//#region src/constants.d.ts
|
|
2
|
-
declare const DEVFRAME_MOUNT_PATH = "/__devframe/";
|
|
3
|
-
declare const DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH = "/__devframe";
|
|
4
|
-
declare const DEVFRAME_DIRNAME = "__devframe";
|
|
5
2
|
declare const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
|
|
6
3
|
/**
|
|
7
4
|
* Global key holding the serializable connection prepared by
|
|
@@ -16,7 +13,23 @@ declare const DEVFRAME_CONNECTION_KEY = "__DEVFRAME_CONNECTION__";
|
|
|
16
13
|
* both HTTP and WS, and a host server (Vite, etc.) can mount the WS upgrade
|
|
17
14
|
* handler here without colliding with its own routes (HMR, asset serving).
|
|
18
15
|
*/
|
|
19
|
-
declare const DEVFRAME_WS_ROUTE = "
|
|
16
|
+
declare const DEVFRAME_WS_ROUTE = "__ws";
|
|
17
|
+
/**
|
|
18
|
+
* Route the SSE RPC endpoint is bound to, relative to a devframe's base
|
|
19
|
+
* path. A single method-dispatched route: `GET` opens the event stream
|
|
20
|
+
* (server→client), `POST` carries RPC frames (client→server). Sits next to
|
|
21
|
+
* `__connection.json` so the deployed SPA reaches it on the same origin it
|
|
22
|
+
* loaded from — the transport for hosts and proxies where the WebSocket
|
|
23
|
+
* upgrade isn't available.
|
|
24
|
+
*/
|
|
25
|
+
declare const DEVFRAME_SSE_ROUTE = "__sse";
|
|
26
|
+
/**
|
|
27
|
+
* Request header carrying the SSE session id on every RPC `POST`. The
|
|
28
|
+
* server mints the id as the stream's first event (`event: session`);
|
|
29
|
+
* the client echoes it here so the POST joins that stream's birpc
|
|
30
|
+
* channel. Mirrors birpc's own SSE helpers for wire compatibility.
|
|
31
|
+
*/
|
|
32
|
+
declare const DEVFRAME_SSE_SESSION_HEADER = "x-birpc-session";
|
|
20
33
|
/**
|
|
21
34
|
* Route the Streamable-HTTP MCP endpoint is bound to, relative to a
|
|
22
35
|
* devframe's base path. Sits next to `__connection.json` and the WS route
|
|
@@ -26,7 +39,6 @@ declare const DEVFRAME_WS_ROUTE = "__devframe_ws";
|
|
|
26
39
|
declare const DEVFRAME_MCP_ROUTE = "__mcp";
|
|
27
40
|
declare const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
|
|
28
41
|
declare const DEVFRAME_DOCK_IMPORTS_FILENAME = "__client-imports.js";
|
|
29
|
-
declare const DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID = "/__devframe-client-imports.js";
|
|
30
42
|
declare const DEVFRAME_RPC_DUMP_DIRNAME = "__rpc-dump";
|
|
31
43
|
/**
|
|
32
44
|
* URL fragment / query parameter name carrying the remote dock
|
|
@@ -57,6 +69,15 @@ declare const DEVFRAME_AUTH_TOKEN_QUERY_PARAM = "devframe_auth_token";
|
|
|
57
69
|
declare const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
|
|
58
70
|
/** Token that authorizes an external viewer origin registration. */
|
|
59
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";
|
|
60
81
|
/**
|
|
61
82
|
* Prefix that marks an RPC method as callable before a connection is
|
|
62
83
|
* trusted. This is the *only* rule the pre-trust gate applies — there is no
|
|
@@ -68,9 +89,9 @@ declare const ANONYMOUS_RPC_PREFIX = "anonymous:";
|
|
|
68
89
|
/**
|
|
69
90
|
* Whether `name` is callable before a connection is trusted, i.e. it starts
|
|
70
91
|
* with {@link ANONYMOUS_RPC_PREFIX}. Used by the resolver gate in
|
|
71
|
-
*
|
|
92
|
+
* the RPC server binding (via an `authorize` function) and by host adapters that
|
|
72
93
|
* implement their own transport.
|
|
73
94
|
*/
|
|
74
95
|
declare function isAnonymousRpcMethod(name: string): boolean;
|
|
75
96
|
//#endregion
|
|
76
|
-
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_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
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
//#region src/constants.ts
|
|
2
|
-
const DEVFRAME_MOUNT_PATH = "/__devframe/";
|
|
3
|
-
const DEVFRAME_MOUNT_PATH_NO_TRAILING_SLASH = "/__devframe";
|
|
4
|
-
const DEVFRAME_DIRNAME = "__devframe";
|
|
5
2
|
const DEVFRAME_CONNECTION_META_FILENAME = "__connection.json";
|
|
6
3
|
/**
|
|
7
4
|
* Global key holding the serializable connection prepared by
|
|
@@ -16,7 +13,23 @@ const DEVFRAME_CONNECTION_KEY = "__DEVFRAME_CONNECTION__";
|
|
|
16
13
|
* both HTTP and WS, and a host server (Vite, etc.) can mount the WS upgrade
|
|
17
14
|
* handler here without colliding with its own routes (HMR, asset serving).
|
|
18
15
|
*/
|
|
19
|
-
const DEVFRAME_WS_ROUTE = "
|
|
16
|
+
const DEVFRAME_WS_ROUTE = "__ws";
|
|
17
|
+
/**
|
|
18
|
+
* Route the SSE RPC endpoint is bound to, relative to a devframe's base
|
|
19
|
+
* path. A single method-dispatched route: `GET` opens the event stream
|
|
20
|
+
* (server→client), `POST` carries RPC frames (client→server). Sits next to
|
|
21
|
+
* `__connection.json` so the deployed SPA reaches it on the same origin it
|
|
22
|
+
* loaded from — the transport for hosts and proxies where the WebSocket
|
|
23
|
+
* upgrade isn't available.
|
|
24
|
+
*/
|
|
25
|
+
const DEVFRAME_SSE_ROUTE = "__sse";
|
|
26
|
+
/**
|
|
27
|
+
* Request header carrying the SSE session id on every RPC `POST`. The
|
|
28
|
+
* server mints the id as the stream's first event (`event: session`);
|
|
29
|
+
* the client echoes it here so the POST joins that stream's birpc
|
|
30
|
+
* channel. Mirrors birpc's own SSE helpers for wire compatibility.
|
|
31
|
+
*/
|
|
32
|
+
const DEVFRAME_SSE_SESSION_HEADER = "x-birpc-session";
|
|
20
33
|
/**
|
|
21
34
|
* Route the Streamable-HTTP MCP endpoint is bound to, relative to a
|
|
22
35
|
* devframe's base path. Sits next to `__connection.json` and the WS route
|
|
@@ -26,7 +39,6 @@ const DEVFRAME_WS_ROUTE = "__devframe_ws";
|
|
|
26
39
|
const DEVFRAME_MCP_ROUTE = "__mcp";
|
|
27
40
|
const DEVFRAME_RPC_DUMP_MANIFEST_FILENAME = "__rpc-dump/index.json";
|
|
28
41
|
const DEVFRAME_DOCK_IMPORTS_FILENAME = "__client-imports.js";
|
|
29
|
-
const DEVFRAME_DOCK_IMPORTS_VIRTUAL_ID = "/__devframe-client-imports.js";
|
|
30
42
|
const DEVFRAME_RPC_DUMP_DIRNAME = "__rpc-dump";
|
|
31
43
|
/**
|
|
32
44
|
* URL fragment / query parameter name carrying the remote dock
|
|
@@ -58,6 +70,15 @@ const DEVFRAME_VIEWER_ORIGIN_QUERY_PARAM = "devframe_viewer_origin";
|
|
|
58
70
|
/** Token that authorizes an external viewer origin registration. */
|
|
59
71
|
const DEVFRAME_VIEWER_ORIGIN_TOKEN_QUERY_PARAM = "devframe_viewer_origin_token";
|
|
60
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
|
+
/**
|
|
61
82
|
* Prefix that marks an RPC method as callable before a connection is
|
|
62
83
|
* trusted. This is the *only* rule the pre-trust gate applies — there is no
|
|
63
84
|
* per-method allowlist. Any handshake method a host adapter needs to reach
|
|
@@ -68,11 +89,11 @@ const ANONYMOUS_RPC_PREFIX = "anonymous:";
|
|
|
68
89
|
/**
|
|
69
90
|
* Whether `name` is callable before a connection is trusted, i.e. it starts
|
|
70
91
|
* with {@link ANONYMOUS_RPC_PREFIX}. Used by the resolver gate in
|
|
71
|
-
*
|
|
92
|
+
* the RPC server binding (via an `authorize` function) and by host adapters that
|
|
72
93
|
* implement their own transport.
|
|
73
94
|
*/
|
|
74
95
|
function isAnonymousRpcMethod(name) {
|
|
75
96
|
return name.startsWith(ANONYMOUS_RPC_PREFIX);
|
|
76
97
|
}
|
|
77
98
|
//#endregion
|
|
78
|
-
export { ANONYMOUS_RPC_PREFIX, DEVFRAME_AUTH_TOKEN_QUERY_PARAM, DEVFRAME_CONNECTION_KEY, DEVFRAME_CONNECTION_META_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;
|