devframe 0.1.19 → 0.1.21

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 (78) hide show
  1. package/README.md +2 -2
  2. package/dist/{_shared-BcPXmcjq.mjs → _shared-iZy45oG3.mjs} +2 -2
  3. package/dist/adapters/build.d.mts +3 -3
  4. package/dist/adapters/build.mjs +12 -9
  5. package/dist/adapters/cli.d.mts +1 -1
  6. package/dist/adapters/cli.mjs +2 -2
  7. package/dist/adapters/dev.d.mts +2 -2
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +2 -2
  10. package/dist/adapters/embedded.mjs +1 -1
  11. package/dist/adapters/mcp.d.mts +1 -1
  12. package/dist/adapters/mcp.mjs +6 -2
  13. package/dist/adapters/vite.d.mts +5 -4
  14. package/dist/adapters/vite.mjs +4 -3
  15. package/dist/client/index.d.mts +51 -145
  16. package/dist/client/index.mjs +1664 -2
  17. package/dist/constants.d.mts +12 -15
  18. package/dist/constants.mjs +12 -29
  19. package/dist/context-BJ4r2SmR.mjs +1051 -0
  20. package/dist/context-internal-Dx_NoSv1.mjs +199 -0
  21. package/dist/context-internal-saIAfNVw.d.mts +51 -0
  22. package/dist/{dev-Djy5hbgs.mjs → dev-CdAy400a.mjs} +7 -6
  23. package/dist/{devtool-CIqONpYU.d.mts → devtool-CNvLs2_Y.d.mts} +367 -530
  24. package/dist/diagnostics-DxPnRoXO.mjs +51 -0
  25. package/dist/host-h3-9jeHcltx.mjs +24 -0
  26. package/dist/{human-id-CHS0s28X.mjs → human-id-BLoGo_e5.mjs} +0 -1
  27. package/dist/{index-BwrLhNmz.d.mts → index-CuLRIMto.d.mts} +1 -1
  28. package/dist/index.d.mts +4 -5
  29. package/dist/index.mjs +1 -4
  30. package/dist/internal/index.d.mts +16 -0
  31. package/dist/internal/index.mjs +3 -0
  32. package/dist/node/index.d.mts +45 -140
  33. package/dist/node/index.mjs +7 -6
  34. package/dist/recipes/open-helpers.d.mts +1 -1
  35. package/dist/recipes/open-helpers.mjs +3 -1
  36. package/dist/rpc/index.d.mts +2 -2
  37. package/dist/rpc/index.mjs +2 -2
  38. package/dist/rpc/transports/ws-client.d.mts +1 -1
  39. package/dist/rpc/transports/ws-client.mjs +1 -1
  40. package/dist/rpc/transports/ws-server.d.mts +1 -1
  41. package/dist/rpc/transports/ws-server.mjs +1 -1
  42. package/dist/{rpc-D7LxIh8t.mjs → rpc-INbWfHoX.mjs} +1 -1
  43. package/dist/{serialization-BN2ZQEE9.mjs → serialization-DwKi05Pn.mjs} +1 -1
  44. package/dist/{server-CaUeMcAh.d.mts → server-BAqOajx_.d.mts} +1 -1
  45. package/dist/{server-DrBxa6ZV.mjs → server-CBsxXIH5.mjs} +27 -2
  46. package/dist/{static-dump-cyGfMmRf.mjs → static-dump-D5VH8Iqk.mjs} +1 -1
  47. package/dist/types/index.d.mts +4 -4
  48. package/dist/utils/events.d.mts +1 -1
  49. package/dist/utils/human-id.mjs +1 -1
  50. package/dist/utils/shared-state.d.mts +2 -2
  51. package/dist/utils/shared-state.mjs +1 -1
  52. package/dist/utils/state.d.mts +2 -1
  53. package/dist/utils/state.mjs +1 -1
  54. package/dist/utils/streaming-channel.d.mts +2 -0
  55. package/dist/utils/streaming-channel.mjs +255 -0
  56. package/dist/utils/when.d.mts +401 -2
  57. package/dist/{ws-client-DOYwYluO.d.mts → ws-client-CjPuPFbA.d.mts} +1 -1
  58. package/dist/{ws-server-DHMeNOY_.d.mts → ws-server-C7LnhOHi.d.mts} +13 -1
  59. package/package.json +10 -21
  60. package/skills/devframe/README.md +13 -0
  61. package/skills/devframe/SKILL.md +406 -0
  62. package/skills/devframe/templates/counter-devtool.ts +24 -0
  63. package/skills/devframe/templates/spa-devtool.ts +28 -0
  64. package/skills/devframe/templates/vite-client.ts +11 -0
  65. package/dist/adapters/kit.d.mts +0 -23
  66. package/dist/adapters/kit.mjs +0 -16
  67. package/dist/client-C6w_NshP.mjs +0 -1569
  68. package/dist/context-BsNZMCnr.mjs +0 -6827
  69. package/dist/helpers/nuxt/index.d.mts +0 -46
  70. package/dist/helpers/nuxt/index.mjs +0 -58
  71. package/dist/helpers/nuxt/runtime/plugin.client.d.mts +0 -8
  72. package/dist/helpers/nuxt/runtime/plugin.client.mjs +0 -12
  73. package/dist/host-h3-w3c0t8ZO.mjs +0 -18
  74. package/dist/immer-HjMAm3b6.mjs +0 -894
  75. package/dist/main-CuGOfqoX.mjs +0 -601
  76. package/dist/when-BAE663Hv.d.mts +0 -401
  77. package/dist/{open-JfacLHs0.mjs → open-Dede_w9r.mjs} +4 -4
  78. /package/dist/{types-gWbe-b2R.d.mts → types-C5OVe4AC.d.mts} +0 -0
package/README.md CHANGED
@@ -10,7 +10,7 @@ pnpm add devframe
10
10
 
11
11
  ## Docs
12
12
 
13
- See the [DevFrame documentation](https://devtools.vite.dev/devframe/) for the full guide and API reference.
13
+ See the [DevFrame documentation](https://devfra.me/) for the full guide and API reference.
14
14
 
15
15
  ## Agent-Native (experimental)
16
16
 
@@ -55,7 +55,7 @@ devframe mcp
55
55
 
56
56
  `@modelcontextprotocol/sdk` is a peer dependency — add it to your package when you want to ship MCP support.
57
57
 
58
- See the [Agent-Native guide](https://devtools.vite.dev/devframe/agent-native) for the full API, safety model, and Claude Desktop integration example.
58
+ See the [Agent-Native guide](https://devfra.me/agent-native) for the full API, safety model, and Claude Desktop integration example.
59
59
 
60
60
  ## License
61
61
 
@@ -1,7 +1,7 @@
1
1
  //#region src/adapters/_shared.ts
2
2
  /**
3
3
  * Resolve the mount base path for a devtool's SPA. Hosted adapters
4
- * (`vite`, `kit`, `embedded`) default to `/.<id>/` so they don't
4
+ * (`vite`, `kit`, `embedded`) default to `/__<id>/` so they don't
5
5
  * collide with the host app; standalone adapters (`cli`, `spa`,
6
6
  * `build`) default to `/` because they own the origin.
7
7
  *
@@ -9,7 +9,7 @@
9
9
  */
10
10
  function resolveBasePath(def, kind) {
11
11
  if (def.basePath) return normalizeBasePath(def.basePath);
12
- return kind === "standalone" ? "/" : `/.${def.id}/`;
12
+ return kind === "standalone" ? "/" : `/__${def.id}/`;
13
13
  }
14
14
  function normalizeBasePath(base) {
15
15
  let out = base.startsWith("/") ? base : `/${base}`;
@@ -1,4 +1,4 @@
1
- import { r as DevtoolDefinition } from "../devtool-CIqONpYU.mjs";
1
+ import { r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
2
 
3
3
  //#region src/adapters/build.d.ts
4
4
  interface CreateBuildOptions {
@@ -24,8 +24,8 @@ interface CreateBuildOptions {
24
24
  *
25
25
  * - Build a `mode: 'build'` context and run `devtool.setup(ctx)`.
26
26
  * - Copy the author's SPA dist into `<outDir>/`.
27
- * - Write `<outDir>/.connection.json` (`{ backend: 'static' }`) and the
28
- * sharded RPC dump under `<outDir>/.rpc-dump/` so the deployed SPA
27
+ * - Write `<outDir>/__connection.json` (`{ backend: 'static' }`) and the
28
+ * sharded RPC dump under `<outDir>/__rpc-dump/` so the deployed SPA
29
29
  * discovers both via relative paths from `document.baseURI`.
30
30
  * - When `def.spa` is configured, also write `<outDir>/spa-loader.json`
31
31
  * describing the SPA's data-loader mode (`'query'` / `'upload'` /
@@ -1,13 +1,13 @@
1
- import { n as strictJsonStringify, o as structuredCloneStringify } from "../serialization-BN2ZQEE9.mjs";
2
- import { t as createHostContext } from "../context-BsNZMCnr.mjs";
1
+ import { n as strictJsonStringify, o as structuredCloneStringify } from "../serialization-DwKi05Pn.mjs";
2
+ import { t as createHostContext } from "../context-BJ4r2SmR.mjs";
3
+ import { t as createH3DevToolsHost } from "../host-h3-9jeHcltx.mjs";
3
4
  import { DEVTOOLS_CONNECTION_META_FILENAME, DEVTOOLS_RPC_DUMP_DIRNAME, DEVTOOLS_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
4
- import { t as createH3DevToolsHost } from "../host-h3-w3c0t8ZO.mjs";
5
- import { t as collectStaticRpcDump } from "../static-dump-cyGfMmRf.mjs";
6
- import { n as resolveBasePath } from "../_shared-BcPXmcjq.mjs";
5
+ import { t as collectStaticRpcDump } from "../static-dump-D5VH8Iqk.mjs";
6
+ import { n as resolveBasePath } from "../_shared-iZy45oG3.mjs";
7
+ import c from "ansis";
7
8
  import { existsSync } from "node:fs";
8
9
  import { dirname, resolve } from "pathe";
9
10
  import process from "node:process";
10
- import c from "ansis";
11
11
  import fs$1 from "node:fs/promises";
12
12
  //#region src/adapters/build.ts
13
13
  /**
@@ -15,8 +15,8 @@ import fs$1 from "node:fs/promises";
15
15
  *
16
16
  * - Build a `mode: 'build'` context and run `devtool.setup(ctx)`.
17
17
  * - Copy the author's SPA dist into `<outDir>/`.
18
- * - Write `<outDir>/.connection.json` (`{ backend: 'static' }`) and the
19
- * sharded RPC dump under `<outDir>/.rpc-dump/` so the deployed SPA
18
+ * - Write `<outDir>/__connection.json` (`{ backend: 'static' }`) and the
19
+ * sharded RPC dump under `<outDir>/__rpc-dump/` so the deployed SPA
20
20
  * discovers both via relative paths from `document.baseURI`.
21
21
  * - When `def.spa` is configured, also write `<outDir>/spa-loader.json`
22
22
  * describing the SPA's data-loader mode (`'query'` / `'upload'` /
@@ -34,7 +34,10 @@ async function createBuild(d, options = {}) {
34
34
  const ctx = await createHostContext({
35
35
  cwd: process.cwd(),
36
36
  mode: "build",
37
- host: createH3DevToolsHost({ origin: "http://localhost" })
37
+ host: createH3DevToolsHost({
38
+ origin: "http://localhost",
39
+ appName: d.id
40
+ })
38
41
  });
39
42
  await d.setup(ctx);
40
43
  await fs$1.mkdir(resolve(outDir, DEVTOOLS_RPC_DUMP_DIRNAME), { recursive: true });
@@ -1,4 +1,4 @@
1
- import { en as CliFlagsSchema, nn as defineCliFlags, r as DevtoolDefinition, rn as parseCliFlags, tn as InferCliFlags } from "../devtool-CIqONpYU.mjs";
1
+ import { dt as CliFlagsSchema, ft as InferCliFlags, mt as parseCliFlags, pt as defineCliFlags, r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
2
  import { App } from "h3";
3
3
  import { CAC } from "cac";
4
4
 
@@ -1,7 +1,7 @@
1
1
  import { createBuild } from "./build.mjs";
2
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-Djy5hbgs.mjs";
3
- import process from "node:process";
2
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-CdAy400a.mjs";
4
3
  import c from "ansis";
4
+ import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
7
7
  //#region src/adapters/flags.ts
@@ -1,5 +1,5 @@
1
- import { r as DevtoolDefinition } from "../devtool-CIqONpYU.mjs";
2
- import { n as StartedServer } from "../server-CaUeMcAh.mjs";
1
+ import { r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
+ import { n as StartedServer } from "../server-BAqOajx_.mjs";
3
3
  import { App } from "h3";
4
4
 
5
5
  //#region src/adapters/dev.d.ts
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-Djy5hbgs.mjs";
1
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-CdAy400a.mjs";
2
2
  export { createDevServer, resolveDevServerPort };
@@ -1,4 +1,4 @@
1
- import { d as DevToolsNodeContext, r as DevtoolDefinition } from "../devtool-CIqONpYU.mjs";
1
+ import { d as DevToolsNodeContext, r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
2
 
3
3
  //#region src/adapters/embedded.d.ts
4
4
  interface CreateEmbeddedOptions {
@@ -12,7 +12,7 @@ interface CreateEmbeddedOptions {
12
12
  * dynamic, post-startup registration.
13
13
  *
14
14
  * The host owns the mount path; when a hosted mount is needed the
15
- * effective default follows the hosted rule of `def.basePath ?? '/.<id>/'`.
15
+ * effective default follows the hosted rule of `def.basePath ?? '/__<id>/'`.
16
16
  */
17
17
  declare function createEmbedded(d: DevtoolDefinition, options: CreateEmbeddedOptions): Promise<void>;
18
18
  //#endregion
@@ -6,7 +6,7 @@
6
6
  * dynamic, post-startup registration.
7
7
  *
8
8
  * The host owns the mount path; when a hosted mount is needed the
9
- * effective default follows the hosted rule of `def.basePath ?? '/.<id>/'`.
9
+ * effective default follows the hosted rule of `def.basePath ?? '/__<id>/'`.
10
10
  */
11
11
  async function createEmbedded(d, options) {
12
12
  await d.setup(options.ctx);
@@ -1,4 +1,4 @@
1
- import { r as DevtoolDefinition } from "../devtool-CIqONpYU.mjs";
1
+ import { r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
2
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
3
 
4
4
  //#region src/node/mcp/build-server.d.ts
@@ -1,4 +1,7 @@
1
- import { m as logger, t as createHostContext } from "../context-BsNZMCnr.mjs";
1
+ import { n as logger } from "../diagnostics-DxPnRoXO.mjs";
2
+ import { t as createHostContext } from "../context-BJ4r2SmR.mjs";
3
+ import { join } from "pathe";
4
+ import { homedir } from "node:os";
2
5
  import process from "node:process";
3
6
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
7
  import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema } from "@modelcontextprotocol/sdk/types.js";
@@ -127,7 +130,8 @@ async function createMcpServer(definition, options = {}) {
127
130
  mode: "dev",
128
131
  host: {
129
132
  mountStatic: () => {},
130
- resolveOrigin: () => "mcp://devframe"
133
+ resolveOrigin: () => "mcp://devframe",
134
+ getStorageDir: (scope) => scope === "workspace" ? join(process.cwd(), `node_modules/.${definition.id}/devtools`) : join(homedir(), `.${definition.id}/devtools`)
131
135
  }
132
136
  });
133
137
  await definition.setup(ctx);
@@ -1,9 +1,9 @@
1
- import { r as DevtoolDefinition } from "../devtool-CIqONpYU.mjs";
1
+ import { r as DevtoolDefinition } from "../devtool-CNvLs2_Y.mjs";
2
2
 
3
3
  //#region src/adapters/vite.d.ts
4
4
  interface CreateVitePluginOptions {
5
5
  /**
6
- * Mount base. Defaults to `def.basePath ?? '/.<id>/'` for this hosted
6
+ * Mount base. Defaults to `def.basePath ?? '/__<id>/'` for this hosted
7
7
  * adapter — the devtool shares the origin with the host Vite app.
8
8
  */
9
9
  base?: string;
@@ -19,12 +19,13 @@ interface DevframeVitePlugin {
19
19
  }
20
20
  /**
21
21
  * Plain Vite plugin — mounts a devframe devtool's SPA into a user's
22
- * Vite dev server at `options.base` (default: `def.basePath ?? '/.<id>/'`).
22
+ * Vite dev server at `options.base` (default: `def.basePath ?? '/__<id>/'`).
23
23
  * Use this for tools that want the Vite dev experience without
24
24
  * pulling the full Vite DevTools Kit.
25
25
  *
26
26
  * Note: this does not yet spin up the RPC WS server — for the full
27
- * RPC path, use `createKitPlugin` alongside `@vitejs/devtools`, or the
27
+ * RPC path, use `createPluginFromDevframe` from
28
+ * `@vitejs/devtools-kit/node` alongside `@vitejs/devtools`, or the
28
29
  * standalone `createCli`.
29
30
  */
30
31
  declare function createVitePlugin(d: DevtoolDefinition, options?: CreateVitePluginOptions): DevframeVitePlugin;
@@ -1,15 +1,16 @@
1
- import { n as resolveBasePath } from "../_shared-BcPXmcjq.mjs";
1
+ import { n as resolveBasePath } from "../_shared-iZy45oG3.mjs";
2
2
  import { resolve } from "pathe";
3
3
  import sirv from "sirv";
4
4
  //#region src/adapters/vite.ts
5
5
  /**
6
6
  * Plain Vite plugin — mounts a devframe devtool's SPA into a user's
7
- * Vite dev server at `options.base` (default: `def.basePath ?? '/.<id>/'`).
7
+ * Vite dev server at `options.base` (default: `def.basePath ?? '/__<id>/'`).
8
8
  * Use this for tools that want the Vite dev experience without
9
9
  * pulling the full Vite DevTools Kit.
10
10
  *
11
11
  * Note: this does not yet spin up the RPC WS server — for the full
12
- * RPC path, use `createKitPlugin` alongside `@vitejs/devtools`, or the
12
+ * RPC path, use `createPluginFromDevframe` from
13
+ * `@vitejs/devtools-kit/node` alongside `@vitejs/devtools`, or the
13
14
  * standalone `createCli`.
14
15
  */
15
16
  function createVitePlugin(d, options = {}) {
@@ -1,11 +1,50 @@
1
- import { H as DevToolsRpcClientFunctions, It as DevToolsCommandKeybinding, Mt as DevToolsClientCommand, Pt as DevToolsCommandEntry, U as DevToolsRpcServerFunctions, V as DevToolsDocksUserSettings, Zt as EventEmitter, _t as DevToolsDockUserEntry, dt as DevToolsDockEntriesGrouped, ft as DevToolsDockEntry, l as ConnectionMeta, v as RpcSharedStateHost, w as SharedState } from "../devtool-CIqONpYU.mjs";
2
- import { _ as RpcCacheManager, v as RpcCacheOptions } from "../index-BwrLhNmz.mjs";
3
- import { S as RpcFunctionsCollector } from "../types-gWbe-b2R.mjs";
4
- import { t as WhenContext } from "../when-BAE663Hv.mjs";
5
- import { t as WsRpcChannelOptions } from "../ws-client-DOYwYluO.mjs";
1
+ import { T as StreamSink, U as DevToolsRpcClientFunctions, W as DevToolsRpcServerFunctions, ct as EventEmitter, g as RpcSharedStateHost, l as ConnectionMeta, w as StreamReader } from "../devtool-CNvLs2_Y.mjs";
2
+ import { _ as RpcCacheManager, v as RpcCacheOptions } from "../index-CuLRIMto.mjs";
3
+ import { S as RpcFunctionsCollector } from "../types-C5OVe4AC.mjs";
4
+ import { t as WsRpcChannelOptions } from "../ws-client-CjPuPFbA.mjs";
6
5
  import { BirpcOptions, BirpcReturn } from "birpc";
7
6
 
7
+ //#region src/client/rpc-streaming.d.ts
8
+ interface StreamingSubscribeOptions {
9
+ /** Maximum buffered chunks before the oldest is dropped. Default 256. */
10
+ highWaterMark?: number;
11
+ }
12
+ interface RpcStreamingClientHost {
13
+ /**
14
+ * Subscribe to a server-side stream by channel + id. Returns a reader
15
+ * that's both an `AsyncIterable<T>` (`for await`) and exposes
16
+ * `readable: ReadableStream<T>` for `pipeTo`-style consumption.
17
+ */
18
+ subscribe: <T = unknown>(channel: string, id: string, options?: StreamingSubscribeOptions) => StreamReader<T>;
19
+ /**
20
+ * Open the client side of a client-to-server upload. The id is
21
+ * typically obtained from a prior action call that ran
22
+ * `channel.openInbound()` on the server. Returns a `StreamSink<T>`
23
+ * that mirrors the server-side producer surface (write / close /
24
+ * error / writable / signal).
25
+ *
26
+ * The sink's `signal` aborts when the server cancels the upload.
27
+ */
28
+ upload: <T = unknown>(channel: string, id: string) => StreamSink<T>;
29
+ }
30
+ /**
31
+ * Client-side streaming host. Mirrors `createRpcSharedStateClientHost`:
32
+ * registers the two `:chunk` / `:end` event handlers once, then per-stream
33
+ * state lives in a `Map<streamKey, StreamReader>`.
34
+ */
35
+ declare function createRpcStreamingClientHost(rpc: DevToolsRpcClient): RpcStreamingClientHost;
36
+ //#endregion
8
37
  //#region src/client/rpc.d.ts
38
+ interface DevToolsRpcContext {
39
+ /**
40
+ * The RPC client to interact with the server
41
+ */
42
+ readonly rpc: DevToolsRpcClient;
43
+ }
44
+ type DevToolsClientRpcHost = RpcFunctionsCollector<DevToolsRpcClientFunctions, DevToolsRpcContext>;
45
+ interface RpcClientEvents {
46
+ 'rpc:is-trusted:updated': (isTrusted: boolean) => void;
47
+ }
9
48
  interface DevToolsRpcClientOptions {
10
49
  connectionMeta?: ConnectionMeta;
11
50
  baseURL?: string | string[];
@@ -70,6 +109,12 @@ interface DevToolsRpcClient {
70
109
  * The shared state host
71
110
  */
72
111
  sharedState: RpcSharedStateHost;
112
+ /**
113
+ * The streaming channel host. Subscribe to a server-side stream by
114
+ * channel + id; the returned reader is both `AsyncIterable<T>` and
115
+ * exposes `.readable: ReadableStream<T>` for `pipeTo` consumption.
116
+ */
117
+ streaming: RpcStreamingClientHost;
73
118
  /**
74
119
  * The RPC cache manager
75
120
  */
@@ -86,143 +131,4 @@ interface DevToolsRpcClientMode {
86
131
  }
87
132
  declare function getDevToolsRpcClient(options?: DevToolsRpcClientOptions): Promise<DevToolsRpcClient>;
88
133
  //#endregion
89
- //#region src/client/docks.d.ts
90
- interface DockPanelStorage {
91
- mode: 'float' | 'edge';
92
- width: number;
93
- height: number;
94
- top: number;
95
- left: number;
96
- position: 'left' | 'right' | 'bottom' | 'top';
97
- open: boolean;
98
- inactiveTimeout: number;
99
- }
100
- type DockClientType = 'embedded' | 'standalone';
101
- interface DevToolsRpcContext {
102
- /**
103
- * The RPC client to interact with the server
104
- */
105
- readonly rpc: DevToolsRpcClient;
106
- }
107
- interface DocksContext extends DevToolsRpcContext {
108
- /**
109
- * Type of the client environment
110
- *
111
- * 'embedded' - running inside an embedded floating panel
112
- * 'standalone' - running inside a standalone window (no user app)
113
- */
114
- readonly clientType: 'embedded' | 'standalone';
115
- /**
116
- * The panel context
117
- */
118
- readonly panel: DocksPanelContext;
119
- /**
120
- * The docks entries context
121
- */
122
- readonly docks: DocksEntriesContext;
123
- /**
124
- * The commands context for command palette and shortcuts
125
- */
126
- readonly commands: CommandsContext;
127
- /**
128
- * The when-clause context for conditional visibility
129
- */
130
- readonly when: WhenClauseContext;
131
- }
132
- interface WhenClauseContext {
133
- /**
134
- * Get the current when-clause context snapshot.
135
- * Returns a reactive object with built-in variables and any custom plugin variables.
136
- */
137
- readonly context: WhenContext;
138
- }
139
- type DevToolsClientRpcHost = RpcFunctionsCollector<DevToolsRpcClientFunctions, DevToolsRpcContext>;
140
- type DevToolsClientContext = DocksContext;
141
- interface DocksPanelContext {
142
- store: DockPanelStorage;
143
- isDragging: boolean;
144
- isResizing: boolean;
145
- readonly isVertical: boolean;
146
- }
147
- interface DocksEntriesContext {
148
- selectedId: string | null;
149
- readonly selected: DevToolsDockEntry | null;
150
- entries: DevToolsDockEntry[];
151
- entryToStateMap: Map<string, DockEntryState>;
152
- groupedEntries: DevToolsDockEntriesGrouped;
153
- settings: SharedState<DevToolsDocksUserSettings>;
154
- /**
155
- * Get the state of a dock entry by its ID
156
- */
157
- getStateById: (id: string) => DockEntryState | undefined;
158
- /**
159
- * Switch to the selected dock entry, pass `null` to clear the selection
160
- *
161
- * @returns Whether the selection was changed successfully
162
- */
163
- switchEntry: (id?: string | null) => Promise<boolean>;
164
- /**
165
- * Toggle the selected dock entry
166
- *
167
- * @returns Whether the selection was changed successfully
168
- */
169
- toggleEntry: (id: string) => Promise<boolean>;
170
- }
171
- interface DockEntryState {
172
- entryMeta: DevToolsDockEntry;
173
- readonly isActive: boolean;
174
- domElements: {
175
- iframe?: HTMLIFrameElement | null;
176
- panel?: HTMLDivElement | null;
177
- };
178
- events: EventEmitter<DockEntryStateEvents>;
179
- }
180
- interface DockEntryStateEvents {
181
- 'entry:activated': () => void;
182
- 'entry:deactivated': () => void;
183
- 'entry:updated': (newMeta: DevToolsDockUserEntry) => void;
184
- 'dom:panel:mounted': (panel: HTMLDivElement) => void;
185
- 'dom:iframe:mounted': (iframe: HTMLIFrameElement) => void;
186
- }
187
- interface RpcClientEvents {
188
- 'rpc:is-trusted:updated': (isTrusted: boolean) => void;
189
- }
190
- interface CommandsContext {
191
- /**
192
- * All commands (server + client)
193
- */
194
- readonly commands: DevToolsCommandEntry[];
195
- /**
196
- * Palette-visible commands only (filtered by `showInPalette !== false`)
197
- */
198
- readonly paletteCommands: DevToolsCommandEntry[];
199
- /**
200
- * Register client-side command(s). Returns cleanup function.
201
- */
202
- register: (cmd: DevToolsClientCommand | DevToolsClientCommand[]) => () => void;
203
- /**
204
- * Execute a command by ID. Delegates to RPC for server commands.
205
- */
206
- execute: (id: string, ...args: any[]) => Promise<unknown>;
207
- /**
208
- * Get effective keybindings for a command (defaults merged with overrides)
209
- */
210
- getKeybindings: (id: string) => DevToolsCommandKeybinding[];
211
- /**
212
- * User settings store (persisted, includes command shortcuts)
213
- */
214
- settings: SharedState<DevToolsDocksUserSettings>;
215
- /**
216
- * Whether the command palette is open
217
- */
218
- paletteOpen: boolean;
219
- }
220
- //#endregion
221
- //#region src/client/context.d.ts
222
- declare const CLIENT_CONTEXT_KEY = "__VITE_DEVTOOLS_CLIENT_CONTEXT__";
223
- /**
224
- * Get the global DevTools client context, or `undefined` if not yet initialized.
225
- */
226
- declare function getDevToolsClientContext(): DevToolsClientContext | undefined;
227
- //#endregion
228
- export { CLIENT_CONTEXT_KEY, CommandsContext, DevToolsClientContext, DevToolsClientRpcHost, DevToolsRpcClient, DevToolsRpcClientCall, DevToolsRpcClientCallEvent, DevToolsRpcClientCallOptional, DevToolsRpcClientMode, DevToolsRpcClientOptions, DevToolsRpcContext, DockClientType, DockEntryState, DockEntryStateEvents, DockPanelStorage, DocksContext, DocksEntriesContext, DocksPanelContext, RpcClientEvents, WhenClauseContext, getDevToolsRpcClient as connectDevtool, getDevToolsRpcClient, getDevToolsClientContext };
134
+ export { DevToolsClientRpcHost, DevToolsRpcClient, DevToolsRpcClientCall, DevToolsRpcClientCallEvent, DevToolsRpcClientCallOptional, DevToolsRpcClientMode, DevToolsRpcClientOptions, DevToolsRpcContext, RpcClientEvents, RpcStreamingClientHost, StreamingSubscribeOptions, getDevToolsRpcClient as connectDevtool, getDevToolsRpcClient, createRpcStreamingClientHost };