devframe 0.9.19 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_shared-B2PZsp-J.mjs +191 -0
- package/dist/{_shared-BIUet_Jh.d.mts → _shared-Dy1UBMUN.d.mts} +13 -14
- package/dist/adapters/build.d.mts +3 -4
- package/dist/adapters/build.mjs +4 -5
- package/dist/adapters/cac.d.mts +3 -4
- package/dist/adapters/cac.mjs +3 -3
- package/dist/adapters/dev.d.mts +8 -8
- package/dist/adapters/dev.mjs +2 -2
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/initiate.d.mts +8 -8
- package/dist/adapters/initiate.mjs +1 -1
- package/dist/adapters/mcp.d.mts +4 -123
- package/dist/adapters/mcp.mjs +1 -589
- package/dist/agentic-D4QQQUjE.d.mts +30 -0
- package/dist/cli/main.mjs +12 -260
- package/dist/client/index.d.mts +6 -6
- package/dist/client/index.mjs +3 -4
- package/dist/constants.d.mts +2 -1
- package/dist/constants.mjs +2 -1
- package/dist/{context-BA5FPz7K.d.mts → context-B4BKPuaa.d.mts} +1 -1
- package/dist/{context-BLXXjoBW.mjs → context-C141q8H4.mjs} +5 -5
- package/dist/{context-jXO5vzjH.mjs → context-CHpyLX8W.mjs} +1 -1
- package/dist/{context-BLHBDQcZ.d.mts → context-CTAxz9ec.d.mts} +108 -47
- package/dist/{dev-DbWecpjA.mjs → dev-DM1mIlgi.mjs} +16 -24
- package/dist/{diagnostics-DZA6KQ_Z.mjs → diagnostics-Cx4_VjlG.mjs} +11 -3
- package/dist/dist-Bw3EbMj4.mjs +305 -0
- package/dist/dist-CO98PBnQ.mjs +265 -0
- package/dist/{host-agent-C3MBpNCd.mjs → host-agent-ZSKgzMVu.mjs} +2 -7
- package/dist/import-runtime-module-BzlEQ9PI.mjs +24 -0
- package/dist/in-page-channel/index.d.mts +2 -7
- package/dist/in-page-channel/index.mjs +1 -4
- package/dist/index-Bia1vKjL.d.mts +218 -0
- package/dist/{index-r6NstVmM.d.mts → index-CcPSKbxb.d.mts} +2 -2
- package/dist/index-CeEtxDmK.d.mts +78 -0
- package/dist/{index-CiA6C705.d.mts → index-DuEm0sDH.d.mts} +1 -1
- package/dist/index.d.mts +4 -11
- package/dist/index.mjs +1 -10
- package/dist/{instance-registry-DCq762YJ.mjs → instance-registry-DtvYxc0Y.mjs} +1 -1
- package/dist/{instance-shell-C6Vg97lg.d.mts → instance-shell-DOZSxst6.d.mts} +31 -5
- package/dist/{instance-shell-370Oee9K.mjs → instance-shell-wC2sfEU_.mjs} +6 -6
- package/dist/interactive-auth-BCa_iamv.mjs +384 -0
- package/dist/internal/index.d.mts +66 -22
- package/dist/internal/index.mjs +143 -8
- package/dist/mrmime-40h5OOIp.mjs +448 -0
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +2 -2
- package/dist/node/index.d.mts +2 -4
- package/dist/node/index.mjs +2 -2
- package/dist/{nostics-0sKe5HIj.d.mts → nostics-DWvukRwa.d.mts} +11 -2
- package/dist/{origin-DGDH8BI9.d.mts → origin-CY6BBHOy.d.mts} +14 -1
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -231
- package/dist/{remote-assets-D0StJVLp.mjs → remote-assets-B9MeWmW6.mjs} +2 -2
- package/dist/rpc/client.d.mts +1 -1
- package/dist/rpc/client.mjs +1 -1
- package/dist/rpc/dump.d.mts +2 -1
- package/dist/rpc/index.d.mts +3 -2
- package/dist/rpc/server.d.mts +1 -1
- package/dist/rpc/server.mjs +1 -1
- package/dist/rpc/transports/sse-client.d.mts +1 -1
- package/dist/rpc/transports/sse-server.d.mts +3 -3
- package/dist/rpc/transports/ws-bun.d.mts +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-deno.d.mts +2 -2
- package/dist/rpc/transports/ws-server.d.mts +2 -2
- package/dist/{rpc-core-CvkU23bQ.mjs → rpc-core-BXyMjbKG.mjs} +1 -1
- package/dist/{rpc-core-BlL-Ip8n.d.mts → rpc-core-rLrwFEcw.d.mts} +4 -4
- package/dist/{services-install-Ben4yh52.mjs → services-install-D5YUwFXW.mjs} +17 -1
- package/dist/{sse-client-BcbYwXdD.d.mts → sse-client-DNdscfu_.d.mts} +2 -2
- package/dist/{storage-B70AXK64.mjs → storage-CHD1IkqU.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/{types-D2vGd7-2.d.mts → types-BmDbfHCx.d.mts} +2 -3
- package/dist/utils/debounce.d.mts +50 -0
- package/dist/utils/debounce.mjs +88 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/launch-editor.d.mts +8 -0
- package/dist/utils/launch-editor.mjs +36 -1
- package/dist/utils/nostics.d.mts +2 -2
- package/dist/utils/origin.d.mts +2 -2
- package/dist/utils/origin.mjs +21 -1
- package/dist/utils/remote-assets.mjs +1 -1
- package/dist/utils/serve-static.mjs +1 -1
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/simple-schema.d.mts +3 -2
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/url.d.mts +31 -0
- package/dist/utils/url.mjs +58 -0
- package/dist/{ws-client-CNpP6Ium.d.mts → ws-client-6Mrz6eC4.d.mts} +2 -2
- package/dist/{ws-server-BB8jhxeT.d.mts → ws-server-y2R76aSW.d.mts} +2 -2
- package/package.json +10 -11
- package/dist/_shared-U8D-xzrp.mjs +0 -115
- package/dist/agent-tool-name-DGzeuWcO.mjs +0 -31
- package/dist/client-assets-DNdhagGm.mjs +0 -16
- package/dist/nostics-DD6gsDZA.mjs +0 -108
- package/dist/recipes/common-rpc-functions.d.mts +0 -70
- package/dist/recipes/common-rpc-functions.mjs +0 -115
- package/dist/simple-schema-Bi40l-P6.mjs +0 -154
|
@@ -707,6 +707,41 @@ var import_launch_editor = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
|
|
|
707
707
|
}
|
|
708
708
|
module.exports = launchEditor;
|
|
709
709
|
})))(), 1);
|
|
710
|
+
/** Runtime list of every {@link KnownEditor}. */
|
|
711
|
+
const KNOWN_EDITORS = [
|
|
712
|
+
"atom",
|
|
713
|
+
"subl",
|
|
714
|
+
"sublime",
|
|
715
|
+
"sublime_text",
|
|
716
|
+
"wstorm",
|
|
717
|
+
"charm",
|
|
718
|
+
"zed",
|
|
719
|
+
"notepad++",
|
|
720
|
+
"vim",
|
|
721
|
+
"mvim",
|
|
722
|
+
"joe",
|
|
723
|
+
"gvim",
|
|
724
|
+
"emacs",
|
|
725
|
+
"emacsclient",
|
|
726
|
+
"rmate",
|
|
727
|
+
"mate",
|
|
728
|
+
"code",
|
|
729
|
+
"code-insiders",
|
|
730
|
+
"codium",
|
|
731
|
+
"vscodium",
|
|
732
|
+
"trae",
|
|
733
|
+
"antigravity",
|
|
734
|
+
"cursor",
|
|
735
|
+
"appcode",
|
|
736
|
+
"clion",
|
|
737
|
+
"idea",
|
|
738
|
+
"phpstorm",
|
|
739
|
+
"pycharm",
|
|
740
|
+
"rubymine",
|
|
741
|
+
"webstorm",
|
|
742
|
+
"goland",
|
|
743
|
+
"rider"
|
|
744
|
+
];
|
|
710
745
|
/**
|
|
711
746
|
* Open a file in the user's editor.
|
|
712
747
|
*
|
|
@@ -720,4 +755,4 @@ function launchEditor(target, editor) {
|
|
|
720
755
|
(0, import_launch_editor.default)(target, editor);
|
|
721
756
|
}
|
|
722
757
|
//#endregion
|
|
723
|
-
export { launchEditor };
|
|
758
|
+
export { KNOWN_EDITORS, launchEditor };
|
package/dist/utils/nostics.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type AnyDiagnosticReporter, type ConsoleMethod, type ConsoleReporterOptions, DevframeDefineDiagnosticsOptions, type Diagnostic, type DiagnosticCallParams, type DiagnosticDefinition, type DiagnosticHandle, type DiagnosticInit, type DiagnosticReporter, type Diagnostics, ansiFormatter, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic };
|
|
1
|
+
import { _ as formatDiagnostic, a as DevframeDiagnostics, c as DiagnosticDefinition, d as DiagnosticReporter, f as Diagnostics, g as defineProdDiagnostics, h as defineDiagnostics, i as DevframeDefineDiagnosticsOptions, l as DiagnosticHandle, m as createConsoleReporter, n as ConsoleMethod, o as Diagnostic, p as ansiFormatter, r as ConsoleReporterOptions, s as DiagnosticCallParams, t as AnyDiagnosticReporter, u as DiagnosticInit } from "../nostics-DWvukRwa.mjs";
|
|
2
|
+
export { type AnyDiagnosticReporter, type ConsoleMethod, type ConsoleReporterOptions, DevframeDefineDiagnosticsOptions, DevframeDiagnostics, type Diagnostic, type DiagnosticCallParams, type DiagnosticDefinition, type DiagnosticHandle, type DiagnosticInit, type DiagnosticReporter, type Diagnostics, ansiFormatter, createConsoleReporter, defineDiagnostics, defineProdDiagnostics, formatDiagnostic };
|
package/dist/utils/origin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
export { isAllowedOrigin, isLoopbackHostname, validateOriginCandidate };
|
|
1
|
+
import { i as validateOriginCandidate, n as isLoopbackAddress, r as isLoopbackHostname, t as isAllowedOrigin } from "../origin-CY6BBHOy.mjs";
|
|
2
|
+
export { isAllowedOrigin, isLoopbackAddress, isLoopbackHostname, validateOriginCandidate };
|
package/dist/utils/origin.mjs
CHANGED
|
@@ -26,6 +26,26 @@ function isLoopbackHostname(hostname) {
|
|
|
26
26
|
if (h === "localhost" || h.endsWith(".localhost") || h === "::1") return true;
|
|
27
27
|
return isLoopbackIPv4(h);
|
|
28
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Whether `address` is a loopback peer address as reported by a socket
|
|
31
|
+
* (`net.Socket.remoteAddress`): the IPv6 loopback `::1`, an IPv4 literal in
|
|
32
|
+
* `127.0.0.0/8`, or an IPv4-mapped IPv6 form of one (`::ffff:127.0.0.1`).
|
|
33
|
+
*
|
|
34
|
+
* Unlike {@link isLoopbackHostname} this takes a raw address, not a hostname:
|
|
35
|
+
* it never accepts a `localhost`-style name (a socket peer is always a literal
|
|
36
|
+
* address) and understands the IPv4-mapped IPv6 form the OS hands back on a
|
|
37
|
+
* dual-stack listener. Used to prove a same-machine caller from the connected
|
|
38
|
+
* peer, which a client cannot forge, rather than from the `Origin` header,
|
|
39
|
+
* which it can.
|
|
40
|
+
*/
|
|
41
|
+
function isLoopbackAddress(address) {
|
|
42
|
+
let h = address.trim().replace(/^\[|\]$/g, "");
|
|
43
|
+
const zone = h.indexOf("%");
|
|
44
|
+
if (zone !== -1) h = h.slice(0, zone);
|
|
45
|
+
if (h === "::1") return true;
|
|
46
|
+
const mapped = /^::ffff:(.+)$/i.exec(h);
|
|
47
|
+
return isLoopbackIPv4(mapped ? mapped[1] : h);
|
|
48
|
+
}
|
|
29
49
|
/** A canonical dotted-decimal IPv4 literal in `127.0.0.0/8`. */
|
|
30
50
|
function isLoopbackIPv4(hostname) {
|
|
31
51
|
const octets = hostname.split(".");
|
|
@@ -77,4 +97,4 @@ function validateOriginCandidate(candidate, allowedOrigins) {
|
|
|
77
97
|
if (isLoopbackHostname(url.hostname) || allowedOrigins?.includes(canonical)) return canonical;
|
|
78
98
|
}
|
|
79
99
|
//#endregion
|
|
80
|
-
export { isAllowedOrigin, isLoopbackHostname, validateOriginCandidate };
|
|
100
|
+
export { isAllowedOrigin, isLoopbackAddress, isLoopbackHostname, validateOriginCandidate };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as resolveStaticAssetsSource } from "../remote-assets-
|
|
1
|
+
import { t as resolveStaticAssetsSource } from "../remote-assets-B9MeWmW6.mjs";
|
|
2
2
|
export { resolveStaticAssetsSource };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as DEVFRAME_EVENTS } from "../events-BV4Dj59a.mjs";
|
|
2
|
+
import { t as lookup } from "../mrmime-40h5OOIp.mjs";
|
|
2
3
|
import { realpath, stat } from "node:fs/promises";
|
|
3
4
|
import { extname, join, normalize, resolve, sep } from "pathe";
|
|
4
5
|
import { createReadStream } from "node:fs";
|
|
5
6
|
import { Readable } from "node:stream";
|
|
6
|
-
import { lookup } from "mrmime";
|
|
7
7
|
import { H3, defineHandler } from "h3";
|
|
8
8
|
//#region src/utils/serve-static.ts
|
|
9
9
|
const HTML_EXTENSIONS = [".html", ".htm"];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-
|
|
1
|
+
import { A as SharedStateEvents, D as ImmutableObject, E as ImmutableMap, M as SharedStatePatch, N as createSharedState, O as ImmutableSet, T as ImmutableArray, j as SharedStateOptions, k as SharedState, w as Immutable } from "../context-CTAxz9ec.mjs";
|
|
2
2
|
export { Immutable, ImmutableArray, ImmutableMap, ImmutableObject, ImmutableSet, SharedState, SharedStateEvents, SharedStateOptions, SharedStatePatch, createSharedState };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StandardSchemaV1 } from "
|
|
1
|
+
import { t as StandardSchemaV1 } from "../index-CeEtxDmK.mjs";
|
|
2
2
|
//#region src/utils/simple-schema.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* A tiny, zero-dependency [Standard Schema](https://standardschema.dev/)
|
|
@@ -98,4 +98,5 @@ export declare const s: {
|
|
|
98
98
|
readonly nullable: typeof nullable;
|
|
99
99
|
readonly describe: typeof describe;
|
|
100
100
|
};
|
|
101
|
-
//#endregion
|
|
101
|
+
//#endregion
|
|
102
|
+
export type { StandardSchemaV1 };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-
|
|
1
|
+
import { C as createStreamSink, S as createStreamReader, _ as CreateStreamSinkOptions, b as StreamSink, g as CreateStreamReaderOptions, h as BufferedChunk, v as StreamErrorPayload, x as StreamSinkEvents, y as StreamReader } from "../context-CTAxz9ec.mjs";
|
|
2
2
|
export { BufferedChunk, CreateStreamReaderOptions, CreateStreamSinkOptions, StreamErrorPayload, StreamReader, StreamSink, StreamSinkEvents, createStreamReader, createStreamSink };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/utils/url.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* URL path-joining and slash-normalization helpers shared by the adapters,
|
|
4
|
+
* the RPC clients, and the hub's mount-path plumbing. In-house replacements
|
|
5
|
+
* for the handful of `ufo` functions devframe used, kept dependency-free and
|
|
6
|
+
* browser-safe (pure string operations, no `node:` imports).
|
|
7
|
+
*/
|
|
8
|
+
/** `input` with a leading `/` added when missing. */
|
|
9
|
+
export declare function withLeadingSlash(input: string): string;
|
|
10
|
+
/** `input` with a leading `/` removed; a bare `/` stays `/`. */
|
|
11
|
+
export declare function withoutLeadingSlash(input: string): string;
|
|
12
|
+
/** `input` with a trailing `/` added when missing. */
|
|
13
|
+
export declare function withTrailingSlash(input: string): string;
|
|
14
|
+
/** `input` with a trailing `/` removed; a bare `/` stays `/`. */
|
|
15
|
+
export declare function withoutTrailingSlash(input: string): string;
|
|
16
|
+
/** Collapses runs of `/` in every path portion, preserving `://`. */
|
|
17
|
+
export declare function cleanDoubleSlashes(input: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Joins path segments onto `base` with exactly one `/` at each seam.
|
|
20
|
+
* A segment's leading `/` or `./` is dropped; empty and bare-`/` segments
|
|
21
|
+
* are skipped; the last segment's trailing slash is preserved.
|
|
22
|
+
*/
|
|
23
|
+
export declare function joinURL(base: string, ...segments: string[]): string;
|
|
24
|
+
/**
|
|
25
|
+
* Prefixes `input` with `base` unless it already carries the prefix or is an
|
|
26
|
+
* absolute URL with a protocol. An empty or `/` base is a no-op.
|
|
27
|
+
*/
|
|
28
|
+
export declare function withBase(input: string, base: string): string;
|
|
29
|
+
/** Replaces (or adds) the protocol of `input`: `withProtocol(url, 'ws://')`. */
|
|
30
|
+
export declare function withProtocol(input: string, protocol: string): string;
|
|
31
|
+
//#endregion
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
//#region src/utils/url.ts
|
|
2
|
+
/**
|
|
3
|
+
* URL path-joining and slash-normalization helpers shared by the adapters,
|
|
4
|
+
* the RPC clients, and the hub's mount-path plumbing. In-house replacements
|
|
5
|
+
* for the handful of `ufo` functions devframe used, kept dependency-free and
|
|
6
|
+
* browser-safe (pure string operations, no `node:` imports).
|
|
7
|
+
*/
|
|
8
|
+
/** Matches an explicit protocol prefix: `http://`, `wss://`, `file://`, … */
|
|
9
|
+
const PROTOCOL_RE = /^[\w+.-]{2,}:\/\//;
|
|
10
|
+
/** `input` with a leading `/` added when missing. */
|
|
11
|
+
function withLeadingSlash(input) {
|
|
12
|
+
return input.startsWith("/") ? input : `/${input}`;
|
|
13
|
+
}
|
|
14
|
+
/** `input` with a leading `/` removed; a bare `/` stays `/`. */
|
|
15
|
+
function withoutLeadingSlash(input) {
|
|
16
|
+
return (input.startsWith("/") ? input.slice(1) : input) || "/";
|
|
17
|
+
}
|
|
18
|
+
/** `input` with a trailing `/` added when missing. */
|
|
19
|
+
function withTrailingSlash(input) {
|
|
20
|
+
return input.endsWith("/") ? input : `${input}/`;
|
|
21
|
+
}
|
|
22
|
+
/** `input` with a trailing `/` removed; a bare `/` stays `/`. */
|
|
23
|
+
function withoutTrailingSlash(input) {
|
|
24
|
+
return (input.endsWith("/") ? input.slice(0, -1) : input) || "/";
|
|
25
|
+
}
|
|
26
|
+
/** Collapses runs of `/` in every path portion, preserving `://`. */
|
|
27
|
+
function cleanDoubleSlashes(input) {
|
|
28
|
+
return input.split("://").map((part) => part.replace(/\/{2,}/g, "/")).join("://");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Joins path segments onto `base` with exactly one `/` at each seam.
|
|
32
|
+
* A segment's leading `/` or `./` is dropped; empty and bare-`/` segments
|
|
33
|
+
* are skipped; the last segment's trailing slash is preserved.
|
|
34
|
+
*/
|
|
35
|
+
function joinURL(base, ...segments) {
|
|
36
|
+
let url = base;
|
|
37
|
+
for (const segment of segments) {
|
|
38
|
+
if (!segment || segment === "/") continue;
|
|
39
|
+
url = url ? withTrailingSlash(url) + segment.replace(/^\.?\//, "") : segment;
|
|
40
|
+
}
|
|
41
|
+
return url;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Prefixes `input` with `base` unless it already carries the prefix or is an
|
|
45
|
+
* absolute URL with a protocol. An empty or `/` base is a no-op.
|
|
46
|
+
*/
|
|
47
|
+
function withBase(input, base) {
|
|
48
|
+
if (!base || base === "/" || PROTOCOL_RE.test(input)) return input;
|
|
49
|
+
const prefix = withoutTrailingSlash(base);
|
|
50
|
+
return input.startsWith(prefix) ? input : joinURL(prefix, input);
|
|
51
|
+
}
|
|
52
|
+
/** Replaces (or adds) the protocol of `input`: `withProtocol(url, 'ws://')`. */
|
|
53
|
+
function withProtocol(input, protocol) {
|
|
54
|
+
const match = input.match(PROTOCOL_RE);
|
|
55
|
+
return protocol + (match ? input.slice(match[0].length) : input);
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { cleanDoubleSlashes, joinURL, withBase, withLeadingSlash, withProtocol, withTrailingSlash, withoutLeadingSlash, withoutTrailingSlash };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as ChannelOptions } from "./index-Bia1vKjL.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "./types-BmDbfHCx.mjs";
|
|
3
3
|
//#region src/rpc/transports/ws-client.d.ts
|
|
4
4
|
interface WsRpcChannelOptions {
|
|
5
5
|
url: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as ChannelOptions, n as BirpcGroup } from "./index-Bia1vKjL.mjs";
|
|
2
|
+
import { g as RpcFunctionDefinitionAny } from "./types-BmDbfHCx.mjs";
|
|
2
3
|
import { n as DevframeRpcConnection, t as DevframeNodeRpcSessionMeta } from "./session-r6PDixP6.mjs";
|
|
3
|
-
import { BirpcGroup, ChannelOptions } from "birpc";
|
|
4
4
|
import { Hooks } from "crossws";
|
|
5
5
|
import { NodeAdapter } from "crossws/adapters/node";
|
|
6
6
|
import { Buffer } from "node:buffer";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.0",
|
|
5
5
|
"description": "Framework for building one portable devtool integration that runs in any viewer.",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"./node": "./dist/node/index.mjs",
|
|
34
34
|
"./node/auth": "./dist/node/auth.mjs",
|
|
35
35
|
"./node/hub-internals": "./dist/node/hub-internals.mjs",
|
|
36
|
-
"./recipes/common-rpc-functions": "./dist/recipes/common-rpc-functions.mjs",
|
|
37
36
|
"./recipes/interactive-auth": "./dist/recipes/interactive-auth.mjs",
|
|
38
37
|
"./rpc": "./dist/rpc/index.mjs",
|
|
39
38
|
"./rpc/client": "./dist/rpc/client.mjs",
|
|
@@ -49,6 +48,7 @@
|
|
|
49
48
|
"./utils/agent-tool-name": "./dist/utils/agent-tool-name.mjs",
|
|
50
49
|
"./utils/colors": "./dist/utils/colors.mjs",
|
|
51
50
|
"./utils/crypto-token": "./dist/utils/crypto-token.mjs",
|
|
51
|
+
"./utils/debounce": "./dist/utils/debounce.mjs",
|
|
52
52
|
"./utils/events": "./dist/utils/events.mjs",
|
|
53
53
|
"./utils/get-port": "./dist/utils/get-port.mjs",
|
|
54
54
|
"./utils/hash": "./dist/utils/hash.mjs",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"./utils/shared-state": "./dist/utils/shared-state.mjs",
|
|
64
64
|
"./utils/streaming-channel": "./dist/utils/streaming-channel.mjs",
|
|
65
65
|
"./utils/structured-clone": "./dist/utils/structured-clone.mjs",
|
|
66
|
+
"./utils/url": "./dist/utils/url.mjs",
|
|
66
67
|
"./utils/when": "./dist/utils/when.mjs",
|
|
67
68
|
"./package.json": "./package.json"
|
|
68
69
|
},
|
|
@@ -76,11 +77,11 @@
|
|
|
76
77
|
"skills"
|
|
77
78
|
],
|
|
78
79
|
"peerDependencies": {
|
|
79
|
-
"@
|
|
80
|
+
"@devframes/agentic": "0.10.0",
|
|
80
81
|
"cac": "^7.0.0"
|
|
81
82
|
},
|
|
82
83
|
"peerDependenciesMeta": {
|
|
83
|
-
"@
|
|
84
|
+
"@devframes/agentic": {
|
|
84
85
|
"optional": true
|
|
85
86
|
},
|
|
86
87
|
"cac": {
|
|
@@ -88,23 +89,21 @@
|
|
|
88
89
|
}
|
|
89
90
|
},
|
|
90
91
|
"dependencies": {
|
|
91
|
-
"@modelcontextprotocol/server": "^2.0.0",
|
|
92
|
-
"@standard-schema/spec": "^1.1.0",
|
|
93
|
-
"birpc": "^4.2.0",
|
|
94
92
|
"crossws": "^0.4.12",
|
|
95
93
|
"h3": "^2.0.1-rc.31",
|
|
96
|
-
"mrmime": "^2.0.1",
|
|
97
94
|
"nostics": "^1.2.0",
|
|
98
|
-
"pathe": "^2.0.3"
|
|
99
|
-
"ufo": "^1.6.4"
|
|
95
|
+
"pathe": "^2.0.3"
|
|
100
96
|
},
|
|
101
97
|
"devDependencies": {
|
|
102
|
-
"@
|
|
98
|
+
"@devframes/agentic": "0.10.0",
|
|
99
|
+
"@standard-schema/spec": "^1.1.0",
|
|
100
|
+
"birpc": "^4.2.0",
|
|
103
101
|
"cac": "^7.0.0",
|
|
104
102
|
"get-port-please": "^3.2.0",
|
|
105
103
|
"immer": "^11.1.18",
|
|
106
104
|
"launch-editor": "^2.14.1",
|
|
107
105
|
"mlly": "^1.8.2",
|
|
106
|
+
"mrmime": "^2.0.1",
|
|
108
107
|
"obug": "^3.0.0",
|
|
109
108
|
"ohash": "^2.0.12",
|
|
110
109
|
"p-limit": "^7.3.2",
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import "./constants.mjs";
|
|
2
|
-
import { r as importServicePackage } from "./services-install-Ben4yh52.mjs";
|
|
3
|
-
import { n as getPort } from "./dist-CZXfGEkd.mjs";
|
|
4
|
-
import { cleanDoubleSlashes, withLeadingSlash, withTrailingSlash, withoutLeadingSlash } from "ufo";
|
|
5
|
-
//#region src/node/import-runtime-module.ts
|
|
6
|
-
/**
|
|
7
|
-
* Resolve and import a package at runtime without adding it to a consumer's
|
|
8
|
-
* bundle graph. First-party adapters use this for modules whose code is
|
|
9
|
-
* needed only when the matching feature is enabled (optional peers, and the
|
|
10
|
-
* MCP adapter with the SDK behind it).
|
|
11
|
-
*
|
|
12
|
-
* @internal
|
|
13
|
-
*/
|
|
14
|
-
async function importRuntimeModule(specifier) {
|
|
15
|
-
return await importServicePackage(specifier, [import.meta.url]);
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region src/adapters/_shared.ts
|
|
19
|
-
const DEFAULT_PORT = 9999;
|
|
20
|
-
/**
|
|
21
|
-
* Resolve the mount base path for a devframe's SPA. Hosted adapters
|
|
22
|
-
* (`vite`, `embedded`) default to `/__<id>/` so they don't collide
|
|
23
|
-
* with the host app; standalone adapters (`cli`, `build`)
|
|
24
|
-
* default to `/` because they own the origin.
|
|
25
|
-
*
|
|
26
|
-
* The devframe author can override with `basePath` on the definition.
|
|
27
|
-
*/
|
|
28
|
-
function resolveBasePath(def, kind) {
|
|
29
|
-
if (def.basePath) return normalizeBasePath(def.basePath);
|
|
30
|
-
return kind === "standalone" ? "/" : `/__${def.id}/`;
|
|
31
|
-
}
|
|
32
|
-
function normalizeBasePath(base) {
|
|
33
|
-
return cleanDoubleSlashes(withTrailingSlash(withLeadingSlash(base)));
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Resolve the listening port for `createDevServer` (and `createHandler`'s
|
|
37
|
-
* side-car tiers), honoring the definition's `cli.port` / `cli.portRange` /
|
|
38
|
-
* `cli.random` settings. Exposed separately so authors who run their own
|
|
39
|
-
* argv parsing can resolve a port up-front (to print it, log it, etc.)
|
|
40
|
-
* before starting the server.
|
|
41
|
-
*/
|
|
42
|
-
async function resolveDevServerPort(def, options = {}) {
|
|
43
|
-
const host = options.host ?? def.cli?.host ?? "localhost";
|
|
44
|
-
const portOptions = {
|
|
45
|
-
port: options.defaultPort ?? def.cli?.port ?? DEFAULT_PORT,
|
|
46
|
-
host
|
|
47
|
-
};
|
|
48
|
-
if (def.cli?.portRange) portOptions.portRange = def.cli.portRange;
|
|
49
|
-
if (def.cli?.random) portOptions.random = def.cli.random;
|
|
50
|
-
return getPort(portOptions);
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Normalize an *explicit* `mcp` setting into a fully-resolved config, or
|
|
54
|
-
* `undefined` when the MCP route is disabled. `'auto'` also resolves to
|
|
55
|
-
* `undefined` here: whether it mounts depends on the live agent surface,
|
|
56
|
-
* which only the mounting adapter can consult (through
|
|
57
|
-
* {@link loadAutoMcpAdapter}) - static resolvers like
|
|
58
|
-
* `resolveMcpConnectionMeta` treat it as unadvertisable.
|
|
59
|
-
*
|
|
60
|
-
* An enabled route trusts same-machine callers by default: the authorization
|
|
61
|
-
* resolves to origin-only (`false`) unless the object config opts into a
|
|
62
|
-
* bearer/callback identity check. An empty-string bearer is treated as no
|
|
63
|
-
* bearer (origin-only) rather than a usable credential.
|
|
64
|
-
*/
|
|
65
|
-
function resolveMcpConfig(mcp) {
|
|
66
|
-
if (!mcp || mcp === "auto") return void 0;
|
|
67
|
-
if (mcp === true) return { authorization: false };
|
|
68
|
-
const authorization = typeof mcp.authorization === "string" && mcp.authorization.length === 0 ? false : mcp.authorization ?? false;
|
|
69
|
-
return {
|
|
70
|
-
...mcp.path !== void 0 ? { path: mcp.path } : {},
|
|
71
|
-
...mcp.allowedOrigins !== void 0 ? { allowedOrigins: mcp.allowedOrigins } : {},
|
|
72
|
-
authorization
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Resolve the `mcp: 'auto'` default at mount time: import the MCP adapter
|
|
77
|
-
* when the devframe's agent surface is non-empty, or return `undefined`
|
|
78
|
-
* (mount nothing) when the surface is empty - the zero-cost path, loading
|
|
79
|
-
* no MCP code at all. The adapter (and the MCP SDK behind it) loads through
|
|
80
|
-
* `importRuntimeModule`, so it never enters a consumer's bundle graph.
|
|
81
|
-
*
|
|
82
|
-
* Generic like `importRuntimeModule`: the caller names the module type
|
|
83
|
-
* (`typeof import('devframe/adapters/mcp')`) so this shared helper carries
|
|
84
|
-
* no type-level dependency on the MCP adapter.
|
|
85
|
-
*/
|
|
86
|
-
async function loadAutoMcpAdapter(agent) {
|
|
87
|
-
if (!agent.hasSurface()) return void 0;
|
|
88
|
-
return await importRuntimeModule("devframe/adapters/mcp");
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Resolve the `mcp` entry a `__connection.json` should advertise for a dev
|
|
92
|
-
* server started with the given `mcp` option (falling back to `def.cli?.mcp`,
|
|
93
|
-
* exactly like `createDevServer`), or `undefined` when the route is
|
|
94
|
-
* disabled. `'auto'` (the omitted default) resolves at mount time against
|
|
95
|
-
* the live agent surface, so hand-rolled meta advertises it only for an
|
|
96
|
-
* explicit setting; the adapters advertise the actually-mounted route
|
|
97
|
-
* themselves.
|
|
98
|
-
*
|
|
99
|
-
* Hosted bridges that hand-roll their connection meta pass the side-car
|
|
100
|
-
* `port`: the advertised path becomes absolute (the side-car mounts at `/`)
|
|
101
|
-
* and the client dials `<page-host>:<port><path>`. Without `port` the path
|
|
102
|
-
* stays relative, resolved against `__connection.json`'s own location (the
|
|
103
|
-
* same-server default).
|
|
104
|
-
*/
|
|
105
|
-
function resolveMcpConnectionMeta(def, mcp, port) {
|
|
106
|
-
const config = resolveMcpConfig(mcp ?? def.cli?.mcp);
|
|
107
|
-
if (!config) return void 0;
|
|
108
|
-
const route = withoutLeadingSlash(config.path ?? "__mcp");
|
|
109
|
-
return port != null ? {
|
|
110
|
-
path: withLeadingSlash(route),
|
|
111
|
-
port
|
|
112
|
-
} : { path: route };
|
|
113
|
-
}
|
|
114
|
-
//#endregion
|
|
115
|
-
export { resolveMcpConfig as a, resolveDevServerPort as i, normalizeBasePath as n, resolveMcpConnectionMeta as o, resolveBasePath as r, importRuntimeModule as s, loadAutoMcpAdapter as t };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
//#region src/utils/agent-tool-name.ts
|
|
2
|
-
/**
|
|
3
|
-
* Maximum tool-name length several MCP clients enforce (the Anthropic API
|
|
4
|
-
* pattern is `^[a-zA-Z0-9_-]{1,128}$`).
|
|
5
|
-
*/
|
|
6
|
-
const MAX_TOOL_NAME_LENGTH = 128;
|
|
7
|
-
/**
|
|
8
|
-
* Derive the wire-safe agent tool name for an internal tool id.
|
|
9
|
-
*
|
|
10
|
-
* Devframe tool ids are colon-namespaced: `devframe:<area>:<fn>` for
|
|
11
|
-
* built-ins, `devframes:plugin:<slug>:<fn>` for plugin RPCs, and hub
|
|
12
|
-
* command ids for command-derived tools. MCP clients constrain tool names
|
|
13
|
-
* to `^[a-zA-Z0-9_-]{1,128}$`, so the agent/MCP boundary derives the wire
|
|
14
|
-
* name automatically: every run of characters outside `[a-zA-Z0-9_-]`
|
|
15
|
-
* becomes a single `_`, truncated to 128 characters. Internal ids never
|
|
16
|
-
* change; resolution back to the id happens at the boundary.
|
|
17
|
-
*
|
|
18
|
-
* ```
|
|
19
|
-
* devframe:state:read → devframe_state_read
|
|
20
|
-
* devframes:plugin:git:status → devframes_plugin_git_status
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* A plain string transform with no node dependency, so browser-side UIs
|
|
24
|
-
* that display a tool's id (e.g. the inspect plugin's agent view) can
|
|
25
|
-
* import it too and show the name a client actually calls.
|
|
26
|
-
*/
|
|
27
|
-
function toAgentToolName(id) {
|
|
28
|
-
return id.replace(/[^\w-]+/g, "_").slice(0, MAX_TOOL_NAME_LENGTH);
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
export { toAgentToolName as t };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/client-assets.ts
|
|
2
|
-
/**
|
|
3
|
-
* Resolve a definition's client assets source: the built SPA served as its
|
|
4
|
-
* UI. Prefers the top-level {@link DevframeDefinition.clientAssets} and falls
|
|
5
|
-
* back to the deprecated `cli.distDir`, so both the new and legacy shapes
|
|
6
|
-
* resolve. Returns `undefined` when neither is set (bridge mode, where the SPA is
|
|
7
|
-
* hosted elsewhere).
|
|
8
|
-
*
|
|
9
|
-
* Internal: exposed to first-party integrations via `devframe/internal`, not
|
|
10
|
-
* part of the stable public API.
|
|
11
|
-
*/
|
|
12
|
-
function resolveClientAssets(d) {
|
|
13
|
-
return d.clientAssets ?? d.cli?.distDir;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { resolveClientAssets as t };
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { colors } from "./utils/colors.mjs";
|
|
2
|
-
import { defineDiagnostics } from "nostics";
|
|
3
|
-
import { ansiFormatter } from "nostics/formatters/ansi";
|
|
4
|
-
//#region src/events.ts
|
|
5
|
-
/**
|
|
6
|
-
* Centralized registry of the core devframe event names: the node-side host
|
|
7
|
-
* bus events, the client RPC connection events, and the server→client
|
|
8
|
-
* broadcast notifications, so these names live in one place instead of
|
|
9
|
-
* scattered string literals.
|
|
10
|
-
*
|
|
11
|
-
* **Keep this in sync with [`docs/content/8.references/3.events.md`](../../../docs/content/8.references/3.events.md)**
|
|
12
|
-
* (the "Core devframe events" section): every name here appears in that page's
|
|
13
|
-
* tables, and every name there resolves to an entry here. Add, rename, or
|
|
14
|
-
* remove a name in both places in the same change, and reference
|
|
15
|
-
* `DEVFRAME_EVENTS.*` from call sites instead of re-typing a literal.
|
|
16
|
-
*
|
|
17
|
-
* This map covers **notifications** (events, broadcasts). The request/response
|
|
18
|
-
* RPC endpoints of the shared-state, streaming, and auth-handshake protocols
|
|
19
|
-
* (`devframe:rpc:server-state:*`, `devframe:streaming:subscribe`,
|
|
20
|
-
* `anonymous:devframe:auth`, …) are defined at their handlers and typed in
|
|
21
|
-
* `types/rpc-augments.ts`; they aren't events and stay out of this map.
|
|
22
|
-
*
|
|
23
|
-
* The `EventEmitter` maps (`RpcClientEvents`, `DevframeAgentHostEvents`) and the
|
|
24
|
-
* `DevframeRpcClientFunctions` augmentation declare these names as type-level
|
|
25
|
-
* keys (a literal is unavoidable in a type position); those declarations mirror
|
|
26
|
-
* this map and move with it.
|
|
27
|
-
*/
|
|
28
|
-
const DEVFRAME_EVENTS = {
|
|
29
|
-
/**
|
|
30
|
-
* Node-side host `EventEmitter` events. The agent host (`ctx.agent.events`)
|
|
31
|
-
* emits these as its tool/resource surface changes; protocol adapters (e.g.
|
|
32
|
-
* MCP) subscribe to re-publish their manifest.
|
|
33
|
-
*/
|
|
34
|
-
bus: {
|
|
35
|
-
agentManifestChanged: "agent:manifest:changed",
|
|
36
|
-
agentToolRegistered: "agent:tool:registered",
|
|
37
|
-
agentToolUnregistered: "agent:tool:unregistered",
|
|
38
|
-
agentResourceRegistered: "agent:resource:registered",
|
|
39
|
-
agentResourceUnregistered: "agent:resource:unregistered"
|
|
40
|
-
},
|
|
41
|
-
/**
|
|
42
|
-
* Client-side RPC connection `EventEmitter` events (`rpc.events`) a UI
|
|
43
|
-
* subscribes to for connection lifecycle and error surfacing.
|
|
44
|
-
*/
|
|
45
|
-
client: {
|
|
46
|
-
isTrustedUpdated: "rpc:is-trusted:updated",
|
|
47
|
-
error: "rpc:error",
|
|
48
|
-
connectionStatus: "connection:status",
|
|
49
|
-
connectionError: "connection:error"
|
|
50
|
-
},
|
|
51
|
-
/**
|
|
52
|
-
* Broadcast notifications the server pushes to clients (server → client),
|
|
53
|
-
* `devframe:` prefix. The paired request methods (subscribe/get/set/…) are
|
|
54
|
-
* RPC endpoints, not events, and are omitted deliberately.
|
|
55
|
-
*/
|
|
56
|
-
broadcast: {
|
|
57
|
-
authRevoked: "devframe:auth:revoked",
|
|
58
|
-
clientStateUpdated: "devframe:rpc:client-state:updated",
|
|
59
|
-
clientStatePatch: "devframe:rpc:client-state:patch",
|
|
60
|
-
streamingChunk: "devframe:streaming:chunk",
|
|
61
|
-
streamingEnd: "devframe:streaming:end",
|
|
62
|
-
streamingUploadCancel: "devframe:streaming:upload-cancel"
|
|
63
|
-
},
|
|
64
|
-
/**
|
|
65
|
-
* In-page channel notifications the page script pushes to its panels
|
|
66
|
-
* (page script → panel), `devframe:` prefix. The paired request methods
|
|
67
|
-
* (`devframe:in-page:page-state:subscribe`/`set`/`patch`) are call
|
|
68
|
-
* endpoints, not events, and are defined at their handlers
|
|
69
|
-
* (`in-page-channel/state.ts`).
|
|
70
|
-
*/
|
|
71
|
-
inPageChannel: {
|
|
72
|
-
panelStateUpdated: "devframe:in-page:panel-state:updated",
|
|
73
|
-
panelStatePatch: "devframe:in-page:panel-state:patch"
|
|
74
|
-
},
|
|
75
|
-
/** `postMessage` channels the runtime posts across window boundaries. */
|
|
76
|
-
postMessage: {
|
|
77
|
-
remoteAssetsError: "devframe:remote-assets-error",
|
|
78
|
-
inPageChannel: "devframe:in-page-channel"
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/utils/nostics.ts
|
|
83
|
-
const formatAnsi = ansiFormatter(colors);
|
|
84
|
-
/**
|
|
85
|
-
* The reporter every {@link defineDiagnostics} call below wires in ahead of
|
|
86
|
-
* any caller-supplied ones: prints the diagnostic through devframe's own
|
|
87
|
-
* ANSI colors via `console[method]` (default `'warn'`).
|
|
88
|
-
*/
|
|
89
|
-
function devframeReporter(d, { method = "warn" } = {}) {
|
|
90
|
-
console[method](formatAnsi(d));
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Drop-in replacement for `nostics`'s `defineDiagnostics()` with devframe's
|
|
94
|
-
* ANSI console reporter pre-wired ahead of any `reporters` passed in. Every
|
|
95
|
-
* `diagnostics.ts` in devframe core, `@devframes/hub`, `@devframes/json-render`,
|
|
96
|
-
* and the built-in plugins defines its codes through this instead of
|
|
97
|
-
* `nostics`'s own `defineDiagnostics`; the reporter registration lives
|
|
98
|
-
* here, once, so none of them need to build their own reporter (`colors`,
|
|
99
|
-
* `ansiFormatter`) or take a direct dependency on `nostics` themselves.
|
|
100
|
-
*/
|
|
101
|
-
function defineDiagnostics$1(options) {
|
|
102
|
-
return defineDiagnostics({
|
|
103
|
-
...options,
|
|
104
|
-
reporters: [devframeReporter, ...options.reporters ?? []]
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
//#endregion
|
|
108
|
-
export { DEVFRAME_EVENTS as n, defineDiagnostics$1 as t };
|