devframe 0.1.21 → 0.2.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/README.md +40 -18
- package/dist/{_shared-iZy45oG3.mjs → _shared-BrKv3CYt.mjs} +5 -5
- package/dist/adapters/build.d.mts +5 -5
- package/dist/adapters/build.mjs +13 -12
- package/dist/adapters/cli.d.mts +4 -4
- package/dist/adapters/cli.mjs +5 -5
- package/dist/adapters/dev.d.mts +21 -12
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +5 -5
- package/dist/adapters/embedded.mjs +2 -2
- package/dist/adapters/mcp.d.mts +3 -3
- package/dist/adapters/mcp.mjs +5 -5
- package/dist/chunk-e9Ob2GDo.mjs +26 -0
- package/dist/client/index.d.mts +8 -5
- package/dist/client/index.mjs +12 -12
- package/dist/colors-DS7k8ljB.mjs +123 -0
- package/dist/{context-BJ4r2SmR.mjs → context-BBi2IQDm.mjs} +19 -37
- package/dist/{context-internal-saIAfNVw.d.mts → context-DRa0wGsC.d.mts} +2 -2
- package/dist/{dev-CdAy400a.mjs → dev-CewNNE2R.mjs} +24 -28
- package/dist/{devtool-CNvLs2_Y.d.mts → devframe-R5Ex5K5L.d.mts} +41 -66
- package/dist/{diagnostics-DxPnRoXO.mjs → diagnostics-Cg9ycFIM.mjs} +7 -2
- package/dist/hash-CIBte1yS.mjs +263 -0
- package/dist/helpers/vite.d.mts +65 -0
- package/dist/helpers/vite.mjs +94 -0
- package/dist/{human-id-BLoGo_e5.mjs → human-id-adtUWQLr.mjs} +12 -3
- package/dist/{index-CuLRIMto.d.mts → index-DB2Ie0Or.d.mts} +2 -3
- package/dist/index.d.mts +4 -5
- package/dist/index.mjs +2 -5
- package/dist/launch-editor-CX_n_0SS.mjs +581 -0
- package/dist/node/auth.d.mts +44 -0
- package/dist/node/auth.mjs +55 -0
- package/dist/node/index.d.mts +13 -55
- package/dist/node/index.mjs +6 -62
- package/dist/node/internal.d.mts +16 -0
- package/dist/node/internal.mjs +50 -0
- package/dist/{open-Dede_w9r.mjs → open-B2ah1IKK.mjs} +38 -24
- package/dist/recipes/open-helpers.d.mts +4 -9
- package/dist/recipes/open-helpers.mjs +7 -12
- package/dist/revoke-DIMz1r7-.mjs +35 -0
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +4 -4
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -1
- package/dist/{rpc-INbWfHoX.mjs → rpc-DAzoVCR0.mjs} +5 -4
- package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
- package/dist/{server-CBsxXIH5.mjs → server-DOk4grlJ.mjs} +4 -4
- package/dist/{server-BAqOajx_.d.mts → server-DzKz023G.d.mts} +8 -7
- package/dist/shared-state-q9-1EOSX.mjs +928 -0
- package/dist/{static-dump-D5VH8Iqk.mjs → static-dump-C67bCuse.mjs} +1 -1
- package/dist/{context-internal-Dx_NoSv1.mjs → storage-CNvfBGQ5.mjs} +5 -87
- package/dist/structured-clone-CD2l4fI3.mjs +221 -0
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +3 -3
- package/dist/utils/colors.d.mts +28 -0
- package/dist/utils/colors.mjs +2 -0
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.d.mts +7 -0
- package/dist/utils/hash.mjs +2 -0
- package/dist/utils/human-id.d.mts +6 -8
- package/dist/utils/human-id.mjs +1 -2
- package/dist/utils/launch-editor.d.mts +13 -0
- package/dist/utils/launch-editor.mjs +2 -0
- package/dist/utils/open.d.mts +16 -0
- package/dist/utils/open.mjs +2 -0
- package/dist/utils/serve-static.d.mts +40 -0
- package/dist/utils/serve-static.mjs +173 -0
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -35
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.d.mts +21 -0
- package/dist/utils/structured-clone.mjs +2 -0
- package/dist/utils/when.d.mts +33 -50
- package/dist/utils/when.mjs +21 -3
- package/dist/{ws-client-CjPuPFbA.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
- package/dist/{ws-server-C7LnhOHi.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
- package/package.json +38 -18
- package/skills/devframe/SKILL.md +64 -39
- package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +4 -4
- package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +5 -5
- package/skills/devframe/templates/vite-client.ts +2 -2
- package/dist/adapters/vite.d.mts +0 -33
- package/dist/adapters/vite.mjs +0 -32
- package/dist/internal/index.d.mts +0 -16
- package/dist/internal/index.mjs +0 -3
- package/dist/utils/state.d.mts +0 -50
- package/dist/utils/state.mjs +0 -26
- package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
- package/dist/{host-h3-9jeHcltx.mjs → host-h3-Dz8YnFgu.mjs} +1 -1
- /package/dist/{transports-DSV5_5QM.mjs → transports-BnCs4rj9.mjs} +0 -0
- /package/dist/{types-C5OVe4AC.d.mts → types-4rdUEi2R.d.mts} +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# devframe
|
|
2
2
|
|
|
3
|
-
Framework-
|
|
3
|
+
Framework- and build-tool-agnostic foundation for building generic DevTools. Define your devtool once — its RPC, its data, its SPA, its CLI shape — and deploy the same definition anywhere through a set of pluggable adapters.
|
|
4
|
+
|
|
5
|
+
Full documentation: [https://devfra.me/](https://devfra.me/).
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
@@ -8,18 +10,47 @@ Framework-neutral foundation for building generic DevTools — RPC layer (birpc
|
|
|
8
10
|
pnpm add devframe
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
13
|
+
## Hello, Devframe
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { defineDevframe, defineRpcFunction } from 'devframe'
|
|
17
|
+
import { createCli } from 'devframe/adapters/cli'
|
|
18
|
+
|
|
19
|
+
const devframe = defineDevframe({
|
|
20
|
+
id: 'my-devframe',
|
|
21
|
+
name: 'My Devframe',
|
|
22
|
+
setup(ctx) {
|
|
23
|
+
ctx.rpc.register(defineRpcFunction({
|
|
24
|
+
name: 'my-devframe:hello',
|
|
25
|
+
type: 'static',
|
|
26
|
+
jsonSerializable: true,
|
|
27
|
+
handler: () => ({ message: 'hello' }),
|
|
28
|
+
}))
|
|
29
|
+
},
|
|
30
|
+
})
|
|
12
31
|
|
|
13
|
-
|
|
32
|
+
await createCli(devframe).parse()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Adapters
|
|
36
|
+
|
|
37
|
+
| Adapter | Use case |
|
|
38
|
+
|---------|----------|
|
|
39
|
+
| `cli` | Standalone CLI tool with `dev` / `build` / `mcp` subcommands. |
|
|
40
|
+
| `build` | Generates a static, self-contained SPA snapshot. |
|
|
41
|
+
| `vite` | Mounts the devframe into Vite DevTools (or any compatible host) via `@vitejs/devtools-kit`. |
|
|
42
|
+
| `embedded` | Overlays inside another devtool's UI. |
|
|
43
|
+
| `mcp` | Surfaces the devframe's RPC to coding agents over MCP. |
|
|
14
44
|
|
|
15
45
|
## Agent-Native (experimental)
|
|
16
46
|
|
|
17
|
-
>
|
|
47
|
+
> [!WARNING]
|
|
48
|
+
> The agent-native surface — the `agent` field on `defineRpcFunction`, `DevToolsAgentHost`, and the `devframe/adapters/mcp` adapter — may change without a major version bump until it stabilizes.
|
|
18
49
|
|
|
19
|
-
|
|
50
|
+
Devframe surfaces a devframe's RPC functions, tools, and resources to coding agents over [MCP](https://modelcontextprotocol.io). Flag an RPC function with `agent: { description }` to expose it, then spin up an MCP server:
|
|
20
51
|
|
|
21
52
|
```ts
|
|
22
|
-
import {
|
|
53
|
+
import { defineDevframe, defineRpcFunction } from 'devframe'
|
|
23
54
|
import { createMcpServer } from 'devframe/adapters/mcp'
|
|
24
55
|
|
|
25
56
|
const getSummary = defineRpcFunction({
|
|
@@ -31,11 +62,10 @@ const getSummary = defineRpcFunction({
|
|
|
31
62
|
setup: ctx => ({ handler: async () => buildSummary() }),
|
|
32
63
|
})
|
|
33
64
|
|
|
34
|
-
const
|
|
65
|
+
const devframe = defineDevframe({
|
|
35
66
|
id: 'my-plugin',
|
|
36
67
|
setup(ctx) {
|
|
37
68
|
ctx.rpc.register(getSummary)
|
|
38
|
-
// Optional: register tools or resources directly.
|
|
39
69
|
ctx.agent.registerResource({
|
|
40
70
|
id: 'latest-build',
|
|
41
71
|
name: 'Latest build',
|
|
@@ -44,18 +74,10 @@ const devtool = defineDevtool({
|
|
|
44
74
|
},
|
|
45
75
|
})
|
|
46
76
|
|
|
47
|
-
await createMcpServer(
|
|
77
|
+
await createMcpServer(devframe, { transport: 'stdio' })
|
|
48
78
|
```
|
|
49
79
|
|
|
50
|
-
Or via the CLI:
|
|
51
|
-
|
|
52
|
-
```sh
|
|
53
|
-
devframe mcp
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
`@modelcontextprotocol/sdk` is a peer dependency — add it to your package when you want to ship MCP support.
|
|
57
|
-
|
|
58
|
-
See the [Agent-Native guide](https://devfra.me/agent-native) for the full API, safety model, and Claude Desktop integration example.
|
|
80
|
+
Or via the CLI: `devframe mcp`. `@modelcontextprotocol/sdk` is a peer dependency — add it when you want MCP support. See the [Agent-Native guide](https://devfra.me/guide/agent-native) for the full API and Claude Desktop integration example.
|
|
59
81
|
|
|
60
82
|
## License
|
|
61
83
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
//#region src/adapters/_shared.ts
|
|
2
2
|
/**
|
|
3
|
-
* Resolve the mount base path for a
|
|
4
|
-
* (`vite`, `
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Resolve the mount base path for a devframe's SPA. Hosted adapters
|
|
4
|
+
* (`vite`, `embedded`) default to `/__<id>/` so they don't collide
|
|
5
|
+
* with the host app; standalone adapters (`cli`, `spa`, `build`)
|
|
6
|
+
* default to `/` because they own the origin.
|
|
7
7
|
*
|
|
8
|
-
* The
|
|
8
|
+
* The devframe author can override with `basePath` on the definition.
|
|
9
9
|
*/
|
|
10
10
|
function resolveBasePath(def, kind) {
|
|
11
11
|
if (def.basePath) return normalizeBasePath(def.basePath);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as
|
|
1
|
+
import { r as DevframeDefinition } from "../devframe-R5Ex5K5L.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/build.d.ts
|
|
4
4
|
interface CreateBuildOptions {
|
|
@@ -8,7 +8,7 @@ interface CreateBuildOptions {
|
|
|
8
8
|
base?: string;
|
|
9
9
|
/**
|
|
10
10
|
* Override the SPA dist directory to copy into `outDir`. When omitted
|
|
11
|
-
* the adapter reads `
|
|
11
|
+
* the adapter reads `devframe.cli?.distDir` — authors typically set this
|
|
12
12
|
* once on the definition itself.
|
|
13
13
|
*/
|
|
14
14
|
distDir?: string;
|
|
@@ -20,9 +20,9 @@ interface CreateBuildOptions {
|
|
|
20
20
|
pretty?: boolean;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
23
|
-
* Produce a self-contained static deploy of a
|
|
23
|
+
* Produce a self-contained static deploy of a devframe:
|
|
24
24
|
*
|
|
25
|
-
* - Build a `mode: 'build'` context and run `
|
|
25
|
+
* - Build a `mode: 'build'` context and run `devframe.setup(ctx)`.
|
|
26
26
|
* - Copy the author's SPA dist into `<outDir>/`.
|
|
27
27
|
* - Write `<outDir>/__connection.json` (`{ backend: 'static' }`) and the
|
|
28
28
|
* sharded RPC dump under `<outDir>/__rpc-dump/` so the deployed SPA
|
|
@@ -32,6 +32,6 @@ interface CreateBuildOptions {
|
|
|
32
32
|
* `'none'`). The output is mount-path agnostic — the same bundle
|
|
33
33
|
* works at `/`, `/devtools/`, or any base, no rewriting required.
|
|
34
34
|
*/
|
|
35
|
-
declare function createBuild(d:
|
|
35
|
+
declare function createBuild(d: DevframeDefinition, options?: CreateBuildOptions): Promise<void>;
|
|
36
36
|
//#endregion
|
|
37
37
|
export { CreateBuildOptions, createBuild };
|
package/dist/adapters/build.mjs
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { n as strictJsonStringify
|
|
2
|
-
import {
|
|
3
|
-
import { t as
|
|
1
|
+
import { n as strictJsonStringify } from "../serialization-CwO31axa.mjs";
|
|
2
|
+
import { i as structuredCloneStringify } from "../structured-clone-CD2l4fI3.mjs";
|
|
3
|
+
import { t as colors } from "../colors-DS7k8ljB.mjs";
|
|
4
|
+
import { t as createHostContext } from "../context-BBi2IQDm.mjs";
|
|
5
|
+
import { t as createH3DevToolsHost } from "../host-h3-Dz8YnFgu.mjs";
|
|
4
6
|
import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
5
|
-
import { t as collectStaticRpcDump } from "../static-dump-
|
|
6
|
-
import { n as resolveBasePath } from "../_shared-
|
|
7
|
-
import c from "ansis";
|
|
7
|
+
import { t as collectStaticRpcDump } from "../static-dump-C67bCuse.mjs";
|
|
8
|
+
import { n as resolveBasePath } from "../_shared-BrKv3CYt.mjs";
|
|
8
9
|
import { existsSync } from "node:fs";
|
|
9
|
-
import { dirname, resolve } from "pathe";
|
|
10
10
|
import process from "node:process";
|
|
11
|
+
import { dirname, resolve } from "pathe";
|
|
11
12
|
import fs$1 from "node:fs/promises";
|
|
12
13
|
//#region src/adapters/build.ts
|
|
13
14
|
/**
|
|
14
|
-
* Produce a self-contained static deploy of a
|
|
15
|
+
* Produce a self-contained static deploy of a devframe:
|
|
15
16
|
*
|
|
16
|
-
* - Build a `mode: 'build'` context and run `
|
|
17
|
+
* - Build a `mode: 'build'` context and run `devframe.setup(ctx)`.
|
|
17
18
|
* - Copy the author's SPA dist into `<outDir>/`.
|
|
18
19
|
* - Write `<outDir>/__connection.json` (`{ backend: 'static' }`) and the
|
|
19
20
|
* sharded RPC dump under `<outDir>/__rpc-dump/` so the deployed SPA
|
|
@@ -29,7 +30,7 @@ async function createBuild(d, options = {}) {
|
|
|
29
30
|
if (!distDir) throw new Error(`[devframe] createBuild: no distDir for "${d.id}". Set \`cli.distDir\` on the definition or pass it as an option.`);
|
|
30
31
|
if (existsSync(outDir)) await fs$1.rm(outDir, { recursive: true });
|
|
31
32
|
await fs$1.mkdir(outDir, { recursive: true });
|
|
32
|
-
console.log(
|
|
33
|
+
console.log(colors.cyan`[devframe] copying SPA from ${distDir} -> ${outDir}`);
|
|
33
34
|
await fs$1.cp(distDir, outDir, { recursive: true });
|
|
34
35
|
const ctx = await createHostContext({
|
|
35
36
|
cwd: process.cwd(),
|
|
@@ -47,7 +48,7 @@ async function createBuild(d, options = {}) {
|
|
|
47
48
|
backend: "static",
|
|
48
49
|
jsonSerializableMethods
|
|
49
50
|
}, null, 2), "utf-8");
|
|
50
|
-
console.log(
|
|
51
|
+
console.log(colors.cyan`[devframe] writing RPC dump to ${resolve(outDir, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME)}`);
|
|
51
52
|
const dump = await collectStaticRpcDump(ctx.rpc.definitions.values(), ctx);
|
|
52
53
|
const indent = options.pretty ? 2 : void 0;
|
|
53
54
|
for (const [filepath, file] of Object.entries(dump.files)) {
|
|
@@ -66,7 +67,7 @@ async function createBuild(d, options = {}) {
|
|
|
66
67
|
};
|
|
67
68
|
await fs$1.writeFile(resolve(outDir, "spa-loader.json"), JSON.stringify(spaLoader, null, 2), "utf-8");
|
|
68
69
|
}
|
|
69
|
-
console.log(
|
|
70
|
+
console.log(colors.green`[devframe] built "${d.id}" -> ${outDir}`);
|
|
70
71
|
}
|
|
71
72
|
//#endregion
|
|
72
73
|
export { createBuild };
|
package/dist/adapters/cli.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ct as CliFlagsSchema, dt as parseCliFlags, lt as InferCliFlags, r as DevframeDefinition, ut as defineCliFlags } from "../devframe-R5Ex5K5L.mjs";
|
|
2
|
+
import { H3 } from "h3";
|
|
3
3
|
import { CAC } from "cac";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/cli.d.ts
|
|
@@ -19,7 +19,7 @@ interface CreateCliOptions {
|
|
|
19
19
|
onReady?: (info: {
|
|
20
20
|
origin: string;
|
|
21
21
|
port: number;
|
|
22
|
-
app:
|
|
22
|
+
app: H3;
|
|
23
23
|
}) => void | Promise<void>;
|
|
24
24
|
}
|
|
25
25
|
interface CliHandle {
|
|
@@ -30,6 +30,6 @@ interface CliHandle {
|
|
|
30
30
|
cli: CAC;
|
|
31
31
|
parse: (argv?: string[]) => Promise<void>;
|
|
32
32
|
}
|
|
33
|
-
declare function createCli(d:
|
|
33
|
+
declare function createCli(d: DevframeDefinition, options?: CreateCliOptions): CliHandle;
|
|
34
34
|
//#endregion
|
|
35
35
|
export { type CliFlagsSchema, CliHandle, CreateCliOptions, type InferCliFlags, createCli, defineCliFlags, parseCliFlags };
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { t as colors } from "../colors-DS7k8ljB.mjs";
|
|
1
2
|
import { createBuild } from "./build.mjs";
|
|
2
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
3
|
-
import c from "ansis";
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-CewNNE2R.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
|
@@ -15,7 +15,7 @@ import { safeParse } from "valibot";
|
|
|
15
15
|
* config: v.optional(v.string()),
|
|
16
16
|
* })
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* defineDevframe({
|
|
19
19
|
* cli: { flags: appFlags },
|
|
20
20
|
* setup(ctx, info) {
|
|
21
21
|
* const flags = info.flags as InferCliFlags<typeof appFlags>
|
|
@@ -102,7 +102,7 @@ function createCli(d, options = {}) {
|
|
|
102
102
|
onReady: options.onReady
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
cli.command("build", "Build a self-contained static deploy of the
|
|
105
|
+
cli.command("build", "Build a self-contained static deploy of the devframe").option("--out-dir <outDir>", "Output directory", { default: "dist-static" }).option("--base <base>", "URL base", { default: "/" }).option("--pretty", "Pretty-print dump JSON (larger on disk)").action(async (flags) => {
|
|
106
106
|
await createBuild(d, {
|
|
107
107
|
outDir: flags.outDir,
|
|
108
108
|
base: flags.base,
|
|
@@ -134,7 +134,7 @@ function resolveTypedFlags(d, raw) {
|
|
|
134
134
|
if (!d.cli?.flags) return raw;
|
|
135
135
|
const { flags, issues } = parseCliFlags(d.cli.flags, raw);
|
|
136
136
|
if (issues?.length) {
|
|
137
|
-
for (const issue of issues) console.error(
|
|
137
|
+
for (const issue of issues) console.error(colors.red`[devframe] invalid flag — ${issue}`);
|
|
138
138
|
process.exit(1);
|
|
139
139
|
}
|
|
140
140
|
return flags;
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as
|
|
2
|
-
import { n as StartedServer } from "../server-
|
|
3
|
-
import {
|
|
1
|
+
import { r as DevframeDefinition } from "../devframe-R5Ex5K5L.mjs";
|
|
2
|
+
import { n as StartedServer } from "../server-DzKz023G.mjs";
|
|
3
|
+
import { H3 } from "h3";
|
|
4
4
|
|
|
5
5
|
//#region src/adapters/dev.d.ts
|
|
6
6
|
interface CreateDevServerOptions {
|
|
@@ -19,8 +19,11 @@ interface CreateDevServerOptions {
|
|
|
19
19
|
*/
|
|
20
20
|
flags?: Record<string, unknown>;
|
|
21
21
|
/**
|
|
22
|
-
* Override `def.cli?.distDir`.
|
|
23
|
-
* server
|
|
22
|
+
* Override `def.cli?.distDir`. When neither this option nor
|
|
23
|
+
* `def.cli?.distDir` is set, the dev server runs in **bridge mode** —
|
|
24
|
+
* only `__connection.json` and the WS endpoint are mounted; the SPA
|
|
25
|
+
* is expected to be hosted elsewhere (e.g. by a parent Vite/Nuxt
|
|
26
|
+
* dev server via `viteDevBridge({ devMiddleware })`).
|
|
24
27
|
*/
|
|
25
28
|
distDir?: string;
|
|
26
29
|
/**
|
|
@@ -34,7 +37,7 @@ interface CreateDevServerOptions {
|
|
|
34
37
|
* middleware (auth, logging, extra static assets) before devframe's
|
|
35
38
|
* own handlers.
|
|
36
39
|
*/
|
|
37
|
-
app?:
|
|
40
|
+
app?: H3;
|
|
38
41
|
/**
|
|
39
42
|
* Auto-open the browser. When `undefined` the resolution falls
|
|
40
43
|
* through to `flags.open` (incl. string path) and finally
|
|
@@ -49,7 +52,7 @@ interface CreateDevServerOptions {
|
|
|
49
52
|
onReady?: (info: {
|
|
50
53
|
origin: string;
|
|
51
54
|
port: number;
|
|
52
|
-
app:
|
|
55
|
+
app: H3;
|
|
53
56
|
}) => void | Promise<void>;
|
|
54
57
|
}
|
|
55
58
|
interface ResolveDevServerPortOptions {
|
|
@@ -65,11 +68,17 @@ interface ResolveDevServerPortOptions {
|
|
|
65
68
|
* resolve a port up-front (to print it, log it, etc.) before starting
|
|
66
69
|
* the server.
|
|
67
70
|
*/
|
|
68
|
-
declare function resolveDevServerPort(def:
|
|
71
|
+
declare function resolveDevServerPort(def: DevframeDefinition, options?: ResolveDevServerPortOptions): Promise<number>;
|
|
69
72
|
/**
|
|
70
|
-
* Start a devframe dev server for a {@link
|
|
71
|
-
* h3 + WebSocket RPC + the author's SPA mounted at the
|
|
72
|
-
* path.
|
|
73
|
+
* Start a devframe dev server for a {@link DevframeDefinition} —
|
|
74
|
+
* h3 + WebSocket RPC + (optionally) the author's SPA mounted at the
|
|
75
|
+
* resolved base path.
|
|
76
|
+
*
|
|
77
|
+
* When `distDir` is omitted (and `def.cli?.distDir` is unset) the
|
|
78
|
+
* server runs in **bridge mode**: only `__connection.json` and the WS
|
|
79
|
+
* endpoint are mounted, with no SPA mount. The SPA is expected to be
|
|
80
|
+
* hosted elsewhere (e.g. by a parent Vite/Nuxt dev server) — see
|
|
81
|
+
* `viteDevBridge({ devMiddleware })`.
|
|
73
82
|
*
|
|
74
83
|
* Returns the underlying {@link StartedServer} handle so callers can
|
|
75
84
|
* close it gracefully (SIGINT, hot-reload, test teardown).
|
|
@@ -78,6 +87,6 @@ declare function resolveDevServerPort(def: DevtoolDefinition, options?: ResolveD
|
|
|
78
87
|
* framework (commander, yargs, hand-rolled CAC). For the all-in-one
|
|
79
88
|
* `dev` / `build` / `mcp` shell, reach for {@link createCli} instead.
|
|
80
89
|
*/
|
|
81
|
-
declare function createDevServer(def:
|
|
90
|
+
declare function createDevServer(def: DevframeDefinition, options?: CreateDevServerOptions): Promise<StartedServer>;
|
|
82
91
|
//#endregion
|
|
83
92
|
export { CreateDevServerOptions, ResolveDevServerPortOptions, createDevServer, resolveDevServerPort };
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-CewNNE2R.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { d as DevToolsNodeContext, r as
|
|
1
|
+
import { d as DevToolsNodeContext, r as DevframeDefinition } from "../devframe-R5Ex5K5L.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/adapters/embedded.d.ts
|
|
4
4
|
interface CreateEmbeddedOptions {
|
|
5
|
-
/** Target context the
|
|
5
|
+
/** Target context the devframe is registered into. Required. */
|
|
6
6
|
ctx: DevToolsNodeContext;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
|
-
* Register a
|
|
10
|
-
* runtime. Mirrors what the Vite plugin scan does for
|
|
9
|
+
* Register a devframe into an already-running devframe/Kit context at
|
|
10
|
+
* runtime. Mirrors what the Vite plugin scan does for devframes passed
|
|
11
11
|
* as plugin options, but exposes the same flow to callers that need
|
|
12
12
|
* dynamic, post-startup registration.
|
|
13
13
|
*
|
|
14
14
|
* The host owns the mount path; when a hosted mount is needed the
|
|
15
15
|
* effective default follows the hosted rule of `def.basePath ?? '/__<id>/'`.
|
|
16
16
|
*/
|
|
17
|
-
declare function createEmbedded(d:
|
|
17
|
+
declare function createEmbedded(d: DevframeDefinition, options: CreateEmbeddedOptions): Promise<void>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { CreateEmbeddedOptions, createEmbedded };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/adapters/embedded.ts
|
|
2
2
|
/**
|
|
3
|
-
* Register a
|
|
4
|
-
* runtime. Mirrors what the Vite plugin scan does for
|
|
3
|
+
* Register a devframe into an already-running devframe/Kit context at
|
|
4
|
+
* runtime. Mirrors what the Vite plugin scan does for devframes passed
|
|
5
5
|
* as plugin options, but exposes the same flow to callers that need
|
|
6
6
|
* dynamic, post-startup registration.
|
|
7
7
|
*
|
package/dist/adapters/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as
|
|
1
|
+
import { r as DevframeDefinition } from "../devframe-R5Ex5K5L.mjs";
|
|
2
2
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
|
|
4
4
|
//#region src/node/mcp/build-server.d.ts
|
|
@@ -28,12 +28,12 @@ interface McpServerHandle {
|
|
|
28
28
|
stop: () => Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
|
-
* Build an MCP server over the agent surface of a
|
|
31
|
+
* Build an MCP server over the agent surface of a devframe definition.
|
|
32
32
|
* Currently supports `stdio` transport only.
|
|
33
33
|
*
|
|
34
34
|
* @experimental The agent-native surface is experimental and may change
|
|
35
35
|
* without a major version bump until it stabilizes.
|
|
36
36
|
*/
|
|
37
|
-
declare function createMcpServer(definition:
|
|
37
|
+
declare function createMcpServer(definition: DevframeDefinition, options?: CreateMcpServerOptions): Promise<McpServerHandle>;
|
|
38
38
|
//#endregion
|
|
39
39
|
export { type CreateMcpServerOptions, type McpServerHandle, createMcpServer };
|
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { n as logger } from "../diagnostics-
|
|
2
|
-
import { t as createHostContext } from "../context-
|
|
3
|
-
import { join } from "pathe";
|
|
1
|
+
import { n as logger } from "../diagnostics-Cg9ycFIM.mjs";
|
|
2
|
+
import { t as createHostContext } from "../context-BBi2IQDm.mjs";
|
|
4
3
|
import { homedir } from "node:os";
|
|
5
4
|
import process from "node:process";
|
|
5
|
+
import { join } from "pathe";
|
|
6
6
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
7
7
|
import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
8
8
|
import { toJsonSchema } from "@valibot/to-json-schema";
|
|
@@ -113,7 +113,7 @@ function buildMcpServerFromContext(ctx, options) {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
116
|
-
* Build an MCP server over the agent surface of a
|
|
116
|
+
* Build an MCP server over the agent surface of a devframe definition.
|
|
117
117
|
* Currently supports `stdio` transport only.
|
|
118
118
|
*
|
|
119
119
|
* @experimental The agent-native surface is experimental and may change
|
|
@@ -140,7 +140,7 @@ async function createMcpServer(definition, options = {}) {
|
|
|
140
140
|
serverVersion: options.serverVersion ?? definition.version ?? "0.0.0",
|
|
141
141
|
exposeSharedState: options.exposeSharedState ?? true
|
|
142
142
|
});
|
|
143
|
-
const { startStdioTransport } = await import("../transports-
|
|
143
|
+
const { startStdioTransport } = await import("../transports-BnCs4rj9.mjs");
|
|
144
144
|
let stop;
|
|
145
145
|
try {
|
|
146
146
|
stop = await startStdioTransport(server);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
25
|
+
//#endregion
|
|
26
|
+
export { __require as n, __toESM as r, __commonJSMin as t };
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { T as StreamSink, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions,
|
|
2
|
-
import {
|
|
3
|
-
import { S as RpcFunctionsCollector } from "../types-
|
|
4
|
-
import { t as WsRpcChannelOptions } from "../ws-client-
|
|
1
|
+
import { T as StreamSink, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, at as EventEmitter, g as RpcSharedStateHost, l as ConnectionMeta, w as StreamReader } from "../devframe-R5Ex5K5L.mjs";
|
|
2
|
+
import { m as RpcCacheOptions, p as RpcCacheManager } from "../index-DB2Ie0Or.mjs";
|
|
3
|
+
import { S as RpcFunctionsCollector } from "../types-4rdUEi2R.mjs";
|
|
4
|
+
import { t as WsRpcChannelOptions } from "../ws-client-Bavoya6-.mjs";
|
|
5
5
|
import { BirpcOptions, BirpcReturn } from "birpc";
|
|
6
6
|
|
|
7
7
|
//#region src/client/rpc-streaming.d.ts
|
|
@@ -131,4 +131,7 @@ interface DevToolsRpcClientMode {
|
|
|
131
131
|
}
|
|
132
132
|
declare function getDevToolsRpcClient(options?: DevToolsRpcClientOptions): Promise<DevToolsRpcClient>;
|
|
133
133
|
//#endregion
|
|
134
|
-
|
|
134
|
+
//#region src/client/index.d.ts
|
|
135
|
+
declare const connectDevframe: typeof getDevToolsRpcClient;
|
|
136
|
+
//#endregion
|
|
137
|
+
export { DevToolsClientRpcHost, DevToolsRpcClient, DevToolsRpcClientCall, DevToolsRpcClientCallEvent, DevToolsRpcClientCallOptional, DevToolsRpcClientMode, DevToolsRpcClientOptions, DevToolsRpcContext, RpcClientEvents, RpcStreamingClientHost, StreamingSubscribeOptions, connectDevframe, createRpcStreamingClientHost, getDevToolsRpcClient };
|
package/dist/client/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { l as RpcCacheManager, o as RpcFunctionsCollectorBase } from "../rpc-
|
|
3
|
-
import { r as structuredCloneDeserialize } from "../serialization-DwKi05Pn.mjs";
|
|
1
|
+
import { t as hash } from "../hash-CIBte1yS.mjs";
|
|
2
|
+
import { l as RpcCacheManager, o as RpcFunctionsCollectorBase } from "../rpc-DAzoVCR0.mjs";
|
|
4
3
|
import { createRpcClient } from "../rpc/client.mjs";
|
|
4
|
+
import { t as structuredCloneDeserialize } from "../structured-clone-CD2l4fI3.mjs";
|
|
5
5
|
import { createWsRpcChannel } from "../rpc/transports/ws-client.mjs";
|
|
6
6
|
import { createEventEmitter } from "../utils/events.mjs";
|
|
7
|
-
import { createSharedState } from "../
|
|
7
|
+
import { t as createSharedState } from "../shared-state-q9-1EOSX.mjs";
|
|
8
8
|
import { createStreamReader, createStreamSink } from "../utils/streaming-channel.mjs";
|
|
9
9
|
import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
10
|
+
import { t as humanId } from "../human-id-adtUWQLr.mjs";
|
|
10
11
|
import { promiseWithResolver } from "../utils/promise.mjs";
|
|
11
|
-
import { hash } from "ohash";
|
|
12
12
|
//#region src/client/rpc-shared-state.ts
|
|
13
13
|
function createRpcSharedStateClientHost(rpc) {
|
|
14
14
|
const sharedState = /* @__PURE__ */ new Map();
|
|
@@ -277,7 +277,7 @@ function createRpcStreamingClientHost(rpc) {
|
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
279
|
//#endregion
|
|
280
|
-
//#region
|
|
280
|
+
//#region ../../node_modules/.pnpm/ua-parser-modern@0.1.1/node_modules/ua-parser-modern/dist/index.mjs
|
|
281
281
|
const EMPTY = "";
|
|
282
282
|
const UNKNOWN = "?";
|
|
283
283
|
const MAJOR = "major";
|
|
@@ -1500,7 +1500,7 @@ function createWsRpcClientMode(options) {
|
|
|
1500
1500
|
let clear = () => {};
|
|
1501
1501
|
await Promise.race([trustedPromise.promise.then(clear), new Promise((resolve, reject) => {
|
|
1502
1502
|
const id = setTimeout(() => {
|
|
1503
|
-
reject(/* @__PURE__ */ new Error("[
|
|
1503
|
+
reject(/* @__PURE__ */ new Error("[devframe] Timeout waiting for rpc to be trusted"));
|
|
1504
1504
|
}, timeout);
|
|
1505
1505
|
clear = () => clearTimeout(id);
|
|
1506
1506
|
})]);
|
|
@@ -1541,10 +1541,7 @@ function getConnectionAuthTokenFromWindows(userAuthToken) {
|
|
|
1541
1541
|
value = getter();
|
|
1542
1542
|
if (value) break;
|
|
1543
1543
|
} catch {}
|
|
1544
|
-
if (!value) value = (
|
|
1545
|
-
separator: "-",
|
|
1546
|
-
capitalize: false
|
|
1547
|
-
});
|
|
1544
|
+
if (!value) value = humanId();
|
|
1548
1545
|
localStorage.setItem(CONNECTION_AUTH_TOKEN_KEY, value);
|
|
1549
1546
|
globalThis[CONNECTION_AUTH_TOKEN_KEY] = value;
|
|
1550
1547
|
return value;
|
|
@@ -1661,4 +1658,7 @@ async function getDevToolsRpcClient(options = {}) {
|
|
|
1661
1658
|
return rpc;
|
|
1662
1659
|
}
|
|
1663
1660
|
//#endregion
|
|
1664
|
-
|
|
1661
|
+
//#region src/client/index.ts
|
|
1662
|
+
const connectDevframe = getDevToolsRpcClient;
|
|
1663
|
+
//#endregion
|
|
1664
|
+
export { connectDevframe, createRpcStreamingClientHost, getDevToolsRpcClient };
|