devframe 0.9.20 → 0.10.1

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.
Files changed (102) hide show
  1. package/dist/_shared-B2PZsp-J.mjs +191 -0
  2. package/dist/{_shared-BIUet_Jh.d.mts → _shared-D1ebaX_J.d.mts} +13 -14
  3. package/dist/adapters/build.d.mts +3 -4
  4. package/dist/adapters/build.mjs +4 -5
  5. package/dist/adapters/cac.d.mts +3 -4
  6. package/dist/adapters/cac.mjs +3 -3
  7. package/dist/adapters/dev.d.mts +8 -8
  8. package/dist/adapters/dev.mjs +2 -2
  9. package/dist/adapters/embedded.d.mts +1 -1
  10. package/dist/adapters/initiate.d.mts +8 -8
  11. package/dist/adapters/initiate.mjs +1 -1
  12. package/dist/adapters/mcp.d.mts +4 -142
  13. package/dist/adapters/mcp.mjs +1 -597
  14. package/dist/agentic-DLqHMOyN.d.mts +30 -0
  15. package/dist/browser-agent-Pu-FLk6I.mjs +26 -0
  16. package/dist/browser-agent-rpc-BXhoSh1z.mjs +70 -0
  17. package/dist/cli/main.mjs +12 -260
  18. package/dist/client/index.d.mts +6 -6
  19. package/dist/client/index.mjs +12 -87
  20. package/dist/constants.d.mts +2 -1
  21. package/dist/constants.mjs +2 -1
  22. package/dist/{context-BLHBDQcZ.d.mts → context--tVkJw3W.d.mts} +127 -47
  23. package/dist/{context-BLXXjoBW.mjs → context-BqpgC5tq.mjs} +55 -5
  24. package/dist/{context-jXO5vzjH.mjs → context-CHpyLX8W.mjs} +1 -1
  25. package/dist/{context-BA5FPz7K.d.mts → context-D3qBv0IX.d.mts} +1 -1
  26. package/dist/{dev-BdKKOH8S.mjs → dev-BTbLJekh.mjs} +16 -24
  27. package/dist/{diagnostics-DZA6KQ_Z.mjs → diagnostics-Cx4_VjlG.mjs} +11 -3
  28. package/dist/dist-CO98PBnQ.mjs +265 -0
  29. package/dist/{host-agent-C3MBpNCd.mjs → host-agent-mIbQ6Qi5.mjs} +14 -13
  30. package/dist/import-runtime-module-BzlEQ9PI.mjs +24 -0
  31. package/dist/in-page-channel/index.d.mts +16 -12
  32. package/dist/in-page-channel/index.mjs +42 -14
  33. package/dist/index-Bia1vKjL.d.mts +218 -0
  34. package/dist/index-CeEtxDmK.d.mts +78 -0
  35. package/dist/{index-r6NstVmM.d.mts → index-D-2IdY1I.d.mts} +2 -2
  36. package/dist/{index-CiA6C705.d.mts → index-DuEm0sDH.d.mts} +1 -1
  37. package/dist/index.d.mts +4 -11
  38. package/dist/index.mjs +1 -10
  39. package/dist/{instance-registry-DCq762YJ.mjs → instance-registry-DtvYxc0Y.mjs} +1 -1
  40. package/dist/{instance-shell-C6Vg97lg.d.mts → instance-shell-CXnpSuK7.d.mts} +31 -5
  41. package/dist/{instance-shell-yfrM3_vK.mjs → instance-shell-wC2sfEU_.mjs} +7 -7
  42. package/dist/interactive-auth-BCa_iamv.mjs +384 -0
  43. package/dist/internal/index.d.mts +66 -22
  44. package/dist/internal/index.mjs +143 -8
  45. package/dist/mrmime-40h5OOIp.mjs +448 -0
  46. package/dist/node/auth.d.mts +2 -2
  47. package/dist/node/hub-internals.d.mts +2 -2
  48. package/dist/node/hub-internals.mjs +2 -2
  49. package/dist/node/index.d.mts +2 -4
  50. package/dist/node/index.mjs +2 -2
  51. package/dist/{nostics-0sKe5HIj.d.mts → nostics-DWvukRwa.d.mts} +11 -2
  52. package/dist/{origin-D_eBKEzr.mjs → origin-DZit9g29.mjs} +1 -21
  53. package/dist/recipes/interactive-auth.d.mts +2 -2
  54. package/dist/recipes/interactive-auth.mjs +1 -231
  55. package/dist/{remote-assets-D0StJVLp.mjs → remote-assets-B9MeWmW6.mjs} +2 -2
  56. package/dist/rpc/client.d.mts +1 -1
  57. package/dist/rpc/client.mjs +1 -1
  58. package/dist/rpc/dump.d.mts +2 -1
  59. package/dist/rpc/index.d.mts +3 -2
  60. package/dist/rpc/server.d.mts +1 -1
  61. package/dist/rpc/server.mjs +1 -1
  62. package/dist/rpc/transports/sse-client.d.mts +1 -1
  63. package/dist/rpc/transports/sse-server.d.mts +3 -3
  64. package/dist/rpc/transports/sse-server.mjs +1 -1
  65. package/dist/rpc/transports/ws-bun.d.mts +2 -2
  66. package/dist/rpc/transports/ws-bun.mjs +1 -1
  67. package/dist/rpc/transports/ws-client.d.mts +1 -1
  68. package/dist/rpc/transports/ws-deno.d.mts +2 -2
  69. package/dist/rpc/transports/ws-deno.mjs +1 -1
  70. package/dist/rpc/transports/ws-server.d.mts +1 -1
  71. package/dist/rpc/transports/ws-server.mjs +1 -1
  72. package/dist/{rpc-core-BlL-Ip8n.d.mts → rpc-core-B6n9MQsc.d.mts} +4 -4
  73. package/dist/{rpc-core-CvkU23bQ.mjs → rpc-core-BXyMjbKG.mjs} +1 -1
  74. package/dist/{services-install-Ben4yh52.mjs → services-install-D5YUwFXW.mjs} +17 -1
  75. package/dist/{sse-client-BcbYwXdD.d.mts → sse-client-DNdscfu_.d.mts} +2 -2
  76. package/dist/{storage-B70AXK64.mjs → storage-CHD1IkqU.mjs} +1 -1
  77. package/dist/tool-input-BAQXvvqL.mjs +393 -0
  78. package/dist/types/index.d.mts +4 -4
  79. package/dist/{types-D2vGd7-2.d.mts → types-BmDbfHCx.d.mts} +2 -3
  80. package/dist/utils/debounce.d.mts +50 -0
  81. package/dist/utils/debounce.mjs +88 -0
  82. package/dist/utils/events.d.mts +1 -1
  83. package/dist/utils/launch-editor.d.mts +8 -0
  84. package/dist/utils/launch-editor.mjs +36 -1
  85. package/dist/utils/nostics.d.mts +2 -2
  86. package/dist/utils/remote-assets.mjs +1 -1
  87. package/dist/utils/serve-static.mjs +1 -1
  88. package/dist/utils/shared-state.d.mts +1 -1
  89. package/dist/utils/simple-schema.d.mts +3 -2
  90. package/dist/utils/streaming-channel.d.mts +1 -1
  91. package/dist/utils/url.d.mts +31 -0
  92. package/dist/utils/url.mjs +58 -0
  93. package/dist/{ws-client-CNpP6Ium.d.mts → ws-client-6Mrz6eC4.d.mts} +2 -2
  94. package/dist/{ws-server-BB8jhxeT.d.mts → ws-server-y2R76aSW.d.mts} +2 -2
  95. package/package.json +10 -11
  96. package/dist/_shared-U8D-xzrp.mjs +0 -115
  97. package/dist/agent-tool-name-DGzeuWcO.mjs +0 -31
  98. package/dist/client-assets-DNdhagGm.mjs +0 -16
  99. package/dist/nostics-DD6gsDZA.mjs +0 -108
  100. package/dist/recipes/common-rpc-functions.d.mts +0 -70
  101. package/dist/recipes/common-rpc-functions.mjs +0 -115
  102. package/dist/simple-schema-Bi40l-P6.mjs +0 -154
@@ -1,4 +1,4 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
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-BLHBDQcZ.mjs";
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--tVkJw3W.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 { v as RpcFunctionDefinitionAny } from "./types-D2vGd7-2.mjs";
2
- import { ChannelOptions } from "birpc";
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 { v as RpcFunctionDefinitionAny } from "./types-D2vGd7-2.mjs";
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.9.20",
4
+ "version": "0.10.1",
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
- "@modelcontextprotocol/client": "^2.0.0",
80
+ "@devframes/agentic": "0.10.1",
80
81
  "cac": "^7.0.0"
81
82
  },
82
83
  "peerDependenciesMeta": {
83
- "@modelcontextprotocol/client": {
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
- "@modelcontextprotocol/client": "^2.0.0",
98
+ "@devframes/agentic": "0.10.1",
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 };
@@ -1,70 +0,0 @@
1
- import "../index-CiA6C705.mjs";
2
- import { S as RpcFunctionDefinitionWithSchemas } from "../types-D2vGd7-2.mjs";
3
- import { SimpleSchema } from "../utils/simple-schema.mjs";
4
- //#region src/recipes/common-rpc-functions.d.ts
5
- /**
6
- * Editor commands that `launch-editor` (the library behind
7
- * `devframe/utils/launch-editor`) recognizes with a tailored
8
- * `file:line:column` invocation. `openInEditor`'s optional second argument
9
- * is restricted to this union, so the RPC surface can't be used to spawn an
10
- * arbitrary command.
11
- */
12
- export type KnownEditor = 'atom' | 'subl' | 'sublime' | 'sublime_text' | 'wstorm' | 'charm' | 'zed' | 'notepad++' | 'vim' | 'mvim' | 'joe' | 'gvim' | 'emacs' | 'emacsclient' | 'rmate' | 'mate' | 'code' | 'code-insiders' | 'codium' | 'vscodium' | 'trae' | 'antigravity' | 'cursor' | 'appcode' | 'clion' | 'idea' | 'phpstorm' | 'pycharm' | 'rubymine' | 'webstorm' | 'goland' | 'rider';
13
- /** Runtime list of every {@link KnownEditor}. */
14
- export declare const KNOWN_EDITORS: KnownEditor[];
15
- /**
16
- * Prebuilt RPC action that opens a file in the user's configured editor.
17
- *
18
- * Registered name: `devframe:open-in-editor`.
19
- *
20
- * The optional second argument picks the editor command explicitly (must be
21
- * one of {@link KNOWN_EDITORS}); otherwise it's auto-detected per
22
- * `devframe/utils/launch-editor`.
23
- *
24
- * ```ts
25
- * import { openInEditor } from 'devframe/recipes/common-rpc-functions'
26
- *
27
- * defineDevframe({
28
- * id: 'my-tool',
29
- * name: 'My Tool',
30
- * setup(ctx) {
31
- * ctx.rpc.register(openInEditor)
32
- * },
33
- * })
34
- * ```
35
- *
36
- * @deprecated Use the `@devframes/service-open` wire service instead: one
37
- * host-level installation shared by every plugin and feature-detectable from
38
- * clients, with workspace-root path containment on top of the editor gating.
39
- */
40
- export declare const openInEditor: RpcFunctionDefinitionWithSchemas<"devframe:open-in-editor", "action", readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>], SimpleSchema<void, void>, undefined>;
41
- /**
42
- * Prebuilt RPC action that reveals a path in the OS file explorer.
43
- *
44
- * Registered name: `devframe:open-in-finder`.
45
- *
46
- * ```ts
47
- * import { openInFinder } from 'devframe/recipes/common-rpc-functions'
48
- *
49
- * ctx.rpc.register(openInFinder)
50
- * ```
51
- *
52
- * @deprecated Use the `@devframes/service-open` wire service instead: one
53
- * host-level installation shared by every plugin and feature-detectable from
54
- * clients, with workspace-root path containment.
55
- */
56
- export declare const openInFinder: RpcFunctionDefinitionWithSchemas<"devframe:open-in-finder", "action", readonly [SimpleSchema<string, string>], SimpleSchema<void, void>, undefined>;
57
- /**
58
- * Convenience array bundling both helpers so callers can register them
59
- * in a single `forEach`.
60
- *
61
- * ```ts
62
- * import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
63
- *
64
- * commonRpcFunctions.forEach(fn => ctx.rpc.register(fn))
65
- * ```
66
- *
67
- * @deprecated Use the `@devframes/service-open` wire service instead.
68
- */
69
- export declare const commonRpcFunctions: readonly [RpcFunctionDefinitionWithSchemas<"devframe:open-in-editor", "action", readonly [SimpleSchema<string, string>, SimpleSchema<KnownEditor | undefined, KnownEditor | undefined>], SimpleSchema<void, void>, undefined>, RpcFunctionDefinitionWithSchemas<"devframe:open-in-finder", "action", readonly [SimpleSchema<string, string>], SimpleSchema<void, void>, undefined>];
70
- //#endregion
@@ -1,115 +0,0 @@
1
- import { n as defineRpcFunction } from "../define-BLWPsH6y.mjs";
2
- import { t as s } from "../simple-schema-Bi40l-P6.mjs";
3
- //#region src/recipes/common-rpc-functions.ts
4
- /** Runtime list of every {@link KnownEditor}. */
5
- const KNOWN_EDITORS = [
6
- "atom",
7
- "subl",
8
- "sublime",
9
- "sublime_text",
10
- "wstorm",
11
- "charm",
12
- "zed",
13
- "notepad++",
14
- "vim",
15
- "mvim",
16
- "joe",
17
- "gvim",
18
- "emacs",
19
- "emacsclient",
20
- "rmate",
21
- "mate",
22
- "code",
23
- "code-insiders",
24
- "codium",
25
- "vscodium",
26
- "trae",
27
- "antigravity",
28
- "cursor",
29
- "appcode",
30
- "clion",
31
- "idea",
32
- "phpstorm",
33
- "pycharm",
34
- "rubymine",
35
- "webstorm",
36
- "goland",
37
- "rider"
38
- ];
39
- /**
40
- * Prebuilt RPC action that opens a file in the user's configured editor.
41
- *
42
- * Registered name: `devframe:open-in-editor`.
43
- *
44
- * The optional second argument picks the editor command explicitly (must be
45
- * one of {@link KNOWN_EDITORS}); otherwise it's auto-detected per
46
- * `devframe/utils/launch-editor`.
47
- *
48
- * ```ts
49
- * import { openInEditor } from 'devframe/recipes/common-rpc-functions'
50
- *
51
- * defineDevframe({
52
- * id: 'my-tool',
53
- * name: 'My Tool',
54
- * setup(ctx) {
55
- * ctx.rpc.register(openInEditor)
56
- * },
57
- * })
58
- * ```
59
- *
60
- * @deprecated Use the `@devframes/service-open` wire service instead: one
61
- * host-level installation shared by every plugin and feature-detectable from
62
- * clients, with workspace-root path containment on top of the editor gating.
63
- */
64
- const openInEditor = defineRpcFunction({
65
- name: "devframe:open-in-editor",
66
- type: "action",
67
- jsonSerializable: true,
68
- args: [s.string(), s.optional(s.picklist(KNOWN_EDITORS))],
69
- returns: s.void(),
70
- async handler(filename, editor) {
71
- const { launchEditor } = await import("../utils/launch-editor.mjs");
72
- launchEditor(filename, editor);
73
- }
74
- });
75
- /**
76
- * Prebuilt RPC action that reveals a path in the OS file explorer.
77
- *
78
- * Registered name: `devframe:open-in-finder`.
79
- *
80
- * ```ts
81
- * import { openInFinder } from 'devframe/recipes/common-rpc-functions'
82
- *
83
- * ctx.rpc.register(openInFinder)
84
- * ```
85
- *
86
- * @deprecated Use the `@devframes/service-open` wire service instead: one
87
- * host-level installation shared by every plugin and feature-detectable from
88
- * clients, with workspace-root path containment.
89
- */
90
- const openInFinder = defineRpcFunction({
91
- name: "devframe:open-in-finder",
92
- type: "action",
93
- jsonSerializable: true,
94
- args: [s.string()],
95
- returns: s.void(),
96
- async handler(path) {
97
- const { open } = await import("../utils/open.mjs");
98
- await open(path);
99
- }
100
- });
101
- /**
102
- * Convenience array bundling both helpers so callers can register them
103
- * in a single `forEach`.
104
- *
105
- * ```ts
106
- * import { commonRpcFunctions } from 'devframe/recipes/common-rpc-functions'
107
- *
108
- * commonRpcFunctions.forEach(fn => ctx.rpc.register(fn))
109
- * ```
110
- *
111
- * @deprecated Use the `@devframes/service-open` wire service instead.
112
- */
113
- const commonRpcFunctions = [openInEditor, openInFinder];
114
- //#endregion
115
- export { KNOWN_EDITORS, commonRpcFunctions, openInEditor, openInFinder };