devframe 0.0.0 → 0.1.17
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/LICENSE.md +21 -0
- package/README.md +62 -0
- package/dist/_shared-Bxa2_kq7.mjs +20 -0
- package/dist/adapters/build.d.mts +37 -0
- package/dist/adapters/build.mjs +68 -0
- package/dist/adapters/cli.d.mts +35 -0
- package/dist/adapters/cli.mjs +357 -0
- package/dist/adapters/embedded.d.mts +19 -0
- package/dist/adapters/embedded.mjs +15 -0
- package/dist/adapters/kit.d.mts +23 -0
- package/dist/adapters/kit.mjs +16 -0
- package/dist/adapters/mcp.d.mts +39 -0
- package/dist/adapters/mcp.mjs +278 -0
- package/dist/adapters/vite.d.mts +32 -0
- package/dist/adapters/vite.mjs +31 -0
- package/dist/client/index.d.mts +228 -0
- package/dist/client/index.mjs +2 -0
- package/dist/client-CsR1_h3o.mjs +1569 -0
- package/dist/constants.d.mts +20 -0
- package/dist/constants.mjs +34 -0
- package/dist/context-xQo1FcxX.mjs +6827 -0
- package/dist/define-CW9gLnyG.mjs +11 -0
- package/dist/devtool-CHT-4_OU.d.mts +1233 -0
- package/dist/helpers/nuxt/index.d.mts +46 -0
- package/dist/helpers/nuxt/index.mjs +58 -0
- package/dist/helpers/nuxt/runtime/plugin.client.d.mts +8 -0
- package/dist/helpers/nuxt/runtime/plugin.client.mjs +12 -0
- package/dist/human-id-CHS0s28X.mjs +844 -0
- package/dist/immer-DEqg5kOd.mjs +894 -0
- package/dist/index-Cei8vVcd.d.mts +140 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +2 -0
- package/dist/main-BJD9t8dk.mjs +601 -0
- package/dist/node/index.d.mts +393 -0
- package/dist/node/index.mjs +69 -0
- package/dist/open-BMO2_-wC.mjs +533 -0
- package/dist/recipes/open-helpers.d.mts +108 -0
- package/dist/recipes/open-helpers.mjs +69 -0
- package/dist/rpc/client.d.mts +9 -0
- package/dist/rpc/client.mjs +13 -0
- package/dist/rpc/index.d.mts +3 -0
- package/dist/rpc/index.mjs +4 -0
- package/dist/rpc/server.d.mts +8 -0
- package/dist/rpc/server.mjs +10 -0
- package/dist/rpc/transports/ws-client.d.mts +2 -0
- package/dist/rpc/transports/ws-client.mjs +58 -0
- package/dist/rpc/transports/ws-server.d.mts +2 -0
- package/dist/rpc/transports/ws-server.mjs +73 -0
- package/dist/rpc-hbRk8qtt.mjs +456 -0
- package/dist/serialization-CWcWE7x7.mjs +112 -0
- package/dist/server-DkJ2-s0Y.mjs +49 -0
- package/dist/src-DIKqQIjp.mjs +85 -0
- package/dist/static-dump-DwFfj4U_.mjs +97 -0
- package/dist/transports-4bqw6Fqg.mjs +15 -0
- package/dist/types/index.d.mts +4 -0
- package/dist/types/index.mjs +6 -0
- package/dist/types-BkyzI9r4.d.mts +273 -0
- package/dist/utils/events.d.mts +9 -0
- package/dist/utils/events.mjs +40 -0
- package/dist/utils/human-id.d.mts +10 -0
- package/dist/utils/human-id.mjs +3 -0
- package/dist/utils/nanoid.d.mts +4 -0
- package/dist/utils/nanoid.mjs +10 -0
- package/dist/utils/promise.d.mts +8 -0
- package/dist/utils/promise.mjs +15 -0
- package/dist/utils/shared-state.d.mts +2 -0
- package/dist/utils/shared-state.mjs +36 -0
- package/dist/utils/state.d.mts +49 -0
- package/dist/utils/state.mjs +26 -0
- package/dist/utils/when.d.mts +2 -0
- package/dist/utils/when.mjs +424 -0
- package/dist/when-aBBXAEh5.d.mts +401 -0
- package/dist/ws-client-CDGmViwt.d.mts +26 -0
- package/dist/ws-server-Cu8tmZcF.d.mts +49 -0
- package/package.json +116 -8
|
@@ -0,0 +1,1233 @@
|
|
|
1
|
+
import { g as RpcFunctionsCollectorBase } from "./index-Cei8vVcd.mjs";
|
|
2
|
+
import { t as DevToolsNodeRpcSessionMeta } from "./ws-server-Cu8tmZcF.mjs";
|
|
3
|
+
import { GenericSchema, InferOutput } from "valibot";
|
|
4
|
+
import { Logger, createLogger, defineDiagnostics } from "logs-sdk";
|
|
5
|
+
import { BirpcReturn } from "birpc";
|
|
6
|
+
import { CAC } from "cac";
|
|
7
|
+
import { ChildProcess } from "node:child_process";
|
|
8
|
+
|
|
9
|
+
//#region src/adapters/flags.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Schema map for typed CLI flags. Keys are flag names in camelCase —
|
|
12
|
+
* this matches CAC's parsed-flag output ( `--no-open` → `noOpen` ). Each
|
|
13
|
+
* value is a valibot schema used to both (a) derive the CAC option type
|
|
14
|
+
* when the flag is registered and (b) validate / coerce the parsed
|
|
15
|
+
* value before it's forwarded to `setup(ctx, { flags })`.
|
|
16
|
+
*/
|
|
17
|
+
type CliFlagsSchema = Record<string, GenericSchema>;
|
|
18
|
+
/**
|
|
19
|
+
* Identity helper that preserves the literal schema-map type — use this
|
|
20
|
+
* so `InferCliFlags<typeof myFlags>` resolves to the right object shape.
|
|
21
|
+
*
|
|
22
|
+
* ```ts
|
|
23
|
+
* const appFlags = defineCliFlags({
|
|
24
|
+
* depth: v.pipe(v.number(), v.integer()),
|
|
25
|
+
* config: v.optional(v.string()),
|
|
26
|
+
* })
|
|
27
|
+
*
|
|
28
|
+
* defineDevtool({
|
|
29
|
+
* cli: { flags: appFlags },
|
|
30
|
+
* setup(ctx, info) {
|
|
31
|
+
* const flags = info.flags as InferCliFlags<typeof appFlags>
|
|
32
|
+
* flags.depth // number
|
|
33
|
+
* flags.config // string | undefined
|
|
34
|
+
* },
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function defineCliFlags<T extends CliFlagsSchema>(flags: T): T;
|
|
39
|
+
/** Extract the parsed-output type from a {@link CliFlagsSchema}. */
|
|
40
|
+
type InferCliFlags<T extends CliFlagsSchema> = { [K in keyof T]: InferOutput<T[K]> };
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/types/events.d.ts
|
|
43
|
+
interface EventsMap {
|
|
44
|
+
[event: string]: any;
|
|
45
|
+
}
|
|
46
|
+
interface EventUnsubscribe {
|
|
47
|
+
(): void;
|
|
48
|
+
}
|
|
49
|
+
interface EventEmitter<Events extends EventsMap> {
|
|
50
|
+
/**
|
|
51
|
+
* Calls each of the listeners registered for a given event.
|
|
52
|
+
*
|
|
53
|
+
* ```js
|
|
54
|
+
* ee.emit('tick', tickType, tickDuration)
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* @param event The event name.
|
|
58
|
+
* @param args The arguments for listeners.
|
|
59
|
+
*/
|
|
60
|
+
emit: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Calls the listeners for a given event once and then removes the listener.
|
|
63
|
+
*
|
|
64
|
+
* @param event The event name.
|
|
65
|
+
* @param args The arguments for listeners.
|
|
66
|
+
*/
|
|
67
|
+
emitOnce: <K extends keyof Events>(event: K, ...args: Parameters<Events[K]>) => void;
|
|
68
|
+
/**
|
|
69
|
+
* Event names in keys and arrays with listeners in values.
|
|
70
|
+
*
|
|
71
|
+
* @internal
|
|
72
|
+
*/
|
|
73
|
+
_listeners: Partial<{ [E in keyof Events]: Events[E][] }>;
|
|
74
|
+
/**
|
|
75
|
+
* Add a listener for a given event.
|
|
76
|
+
*
|
|
77
|
+
* ```js
|
|
78
|
+
* const unbind = ee.on('tick', (tickType, tickDuration) => {
|
|
79
|
+
* count += 1
|
|
80
|
+
* })
|
|
81
|
+
*
|
|
82
|
+
* disable () {
|
|
83
|
+
* unbind()
|
|
84
|
+
* }
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* @param event The event name.
|
|
88
|
+
* @param cb The listener function.
|
|
89
|
+
* @returns Unbind listener from event.
|
|
90
|
+
*/
|
|
91
|
+
on: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
|
|
92
|
+
/**
|
|
93
|
+
* Add a listener for a given event once.
|
|
94
|
+
*
|
|
95
|
+
* ```js
|
|
96
|
+
* const unbind = ee.once('tick', (tickType, tickDuration) => {
|
|
97
|
+
* count += 1
|
|
98
|
+
* })
|
|
99
|
+
*
|
|
100
|
+
* disable () {
|
|
101
|
+
* unbind()
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param event The event name.
|
|
106
|
+
* @param cb The listener function.
|
|
107
|
+
* @returns Unbind listener from event.
|
|
108
|
+
*/
|
|
109
|
+
once: <K extends keyof Events>(event: K, cb: Events[K]) => EventUnsubscribe;
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
//#region src/types/agent.d.ts
|
|
113
|
+
/**
|
|
114
|
+
* Serializable description of an agent-exposed tool. This is the shape
|
|
115
|
+
* returned by the agent host manifest and surfaced over the wire by
|
|
116
|
+
* the `devframe:agent:list-tools` introspection RPC.
|
|
117
|
+
*
|
|
118
|
+
* @experimental The agent-native surface is experimental and may change
|
|
119
|
+
* without a major version bump until it stabilizes.
|
|
120
|
+
*/
|
|
121
|
+
interface AgentTool {
|
|
122
|
+
/** Stable identifier. For RPC-backed tools, matches the RPC name. */
|
|
123
|
+
id: string;
|
|
124
|
+
/** `'rpc'` when backed by a registered RPC function, `'tool'` when registered via `ctx.agent.registerTool()`. */
|
|
125
|
+
kind: 'rpc' | 'tool';
|
|
126
|
+
/** Display title (falls back to `id`). */
|
|
127
|
+
title: string;
|
|
128
|
+
/** Human-readable description shown to the agent. */
|
|
129
|
+
description: string;
|
|
130
|
+
/** Safety classification — drives MCP hint annotations downstream. */
|
|
131
|
+
safety: 'read' | 'action' | 'destructive';
|
|
132
|
+
/** Free-form tags for grouping/filtering. */
|
|
133
|
+
tags?: readonly string[];
|
|
134
|
+
/** Present for `kind === 'rpc'` — points to the RPC function name. */
|
|
135
|
+
rpcName?: string;
|
|
136
|
+
/** JSON Schema describing the input (positional args synthesized to an object). */
|
|
137
|
+
inputSchema?: unknown;
|
|
138
|
+
/** JSON Schema describing the output. */
|
|
139
|
+
outputSchema?: unknown;
|
|
140
|
+
/** Example invocations shown to agents. */
|
|
141
|
+
examples?: readonly {
|
|
142
|
+
args: unknown[];
|
|
143
|
+
description?: string;
|
|
144
|
+
}[];
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Input accepted by `DevToolsAgentHost.registerTool()`. Handler is
|
|
148
|
+
* stripped from the serializable `AgentTool` projection.
|
|
149
|
+
*
|
|
150
|
+
* @experimental
|
|
151
|
+
*/
|
|
152
|
+
interface AgentToolInput {
|
|
153
|
+
id: string;
|
|
154
|
+
title?: string;
|
|
155
|
+
description: string;
|
|
156
|
+
safety?: 'read' | 'action' | 'destructive';
|
|
157
|
+
tags?: readonly string[];
|
|
158
|
+
inputSchema?: unknown;
|
|
159
|
+
outputSchema?: unknown;
|
|
160
|
+
examples?: readonly {
|
|
161
|
+
args: unknown[];
|
|
162
|
+
description?: string;
|
|
163
|
+
}[];
|
|
164
|
+
/** Invoked when the tool is called. Receives args as provided by the caller. */
|
|
165
|
+
handler: (args: any) => unknown | Promise<unknown>;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Serializable description of an agent-readable resource. Resources
|
|
169
|
+
* surface structured or textual snapshots of devtools state.
|
|
170
|
+
*
|
|
171
|
+
* @experimental
|
|
172
|
+
*/
|
|
173
|
+
interface AgentResource {
|
|
174
|
+
id: string;
|
|
175
|
+
/** URI used by MCP clients. Defaults to `devframe://resource/<id>`. */
|
|
176
|
+
uri: string;
|
|
177
|
+
name: string;
|
|
178
|
+
description?: string;
|
|
179
|
+
/** Defaults to `application/json`. */
|
|
180
|
+
mimeType?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Input accepted by `DevToolsAgentHost.registerResource()`.
|
|
184
|
+
*
|
|
185
|
+
* @experimental
|
|
186
|
+
*/
|
|
187
|
+
interface AgentResourceInput {
|
|
188
|
+
id: string;
|
|
189
|
+
name: string;
|
|
190
|
+
description?: string;
|
|
191
|
+
mimeType?: string;
|
|
192
|
+
/** Optional URI override — if omitted, a `devframe://resource/<id>` URI is generated. */
|
|
193
|
+
uri?: string;
|
|
194
|
+
/** Snapshot reader. Called on each read. */
|
|
195
|
+
read: () => Promise<AgentResourceContent> | AgentResourceContent;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Payload returned by `AgentResourceInput.read`. Either `text` or `json` must be set.
|
|
199
|
+
*
|
|
200
|
+
* @experimental
|
|
201
|
+
*/
|
|
202
|
+
interface AgentResourceContent {
|
|
203
|
+
text?: string;
|
|
204
|
+
json?: unknown;
|
|
205
|
+
/** Override the resource's declared mimeType for this read. */
|
|
206
|
+
mimeType?: string;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Unified view of the agent-exposed surface.
|
|
210
|
+
*
|
|
211
|
+
* @experimental
|
|
212
|
+
*/
|
|
213
|
+
interface AgentManifest {
|
|
214
|
+
tools: readonly AgentTool[];
|
|
215
|
+
resources: readonly AgentResource[];
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Handle returned by `registerTool` / `registerResource`.
|
|
219
|
+
*
|
|
220
|
+
* @experimental
|
|
221
|
+
*/
|
|
222
|
+
interface AgentHandle {
|
|
223
|
+
unregister: () => void;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Events emitted by `DevToolsAgentHost`.
|
|
227
|
+
*
|
|
228
|
+
* @experimental
|
|
229
|
+
*/
|
|
230
|
+
interface DevToolsAgentHostEvents {
|
|
231
|
+
'agent:tool:registered': (tool: AgentTool) => void;
|
|
232
|
+
'agent:tool:unregistered': (id: string) => void;
|
|
233
|
+
'agent:resource:registered': (resource: AgentResource) => void;
|
|
234
|
+
'agent:resource:unregistered': (id: string) => void;
|
|
235
|
+
/**
|
|
236
|
+
* Fires when the unified manifest changes — including when a new
|
|
237
|
+
* RPC function with an `agent` field is registered on `ctx.rpc`.
|
|
238
|
+
*/
|
|
239
|
+
'agent:manifest:changed': () => void;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Host that aggregates the agent-exposed surface of a devtool: both
|
|
243
|
+
* RPC functions flagged with `agent` and plugin-registered tools /
|
|
244
|
+
* resources. Consumed by protocol adapters such as the devframe MCP
|
|
245
|
+
* adapter.
|
|
246
|
+
*
|
|
247
|
+
* @experimental The agent-native surface is experimental and may change
|
|
248
|
+
* without a major version bump until it stabilizes.
|
|
249
|
+
*/
|
|
250
|
+
interface DevToolsAgentHost {
|
|
251
|
+
readonly events: EventEmitter<DevToolsAgentHostEvents>;
|
|
252
|
+
/**
|
|
253
|
+
* Register a tool not backed by an RPC function. Use this when you
|
|
254
|
+
* want a plain agent action (e.g. a synthesized summary) that
|
|
255
|
+
* shouldn't exist as a full RPC.
|
|
256
|
+
*/
|
|
257
|
+
registerTool: (tool: AgentToolInput) => AgentHandle;
|
|
258
|
+
/** Unregister a previously registered tool by id. */
|
|
259
|
+
unregisterTool: (id: string) => boolean;
|
|
260
|
+
/** Register a readable resource. */
|
|
261
|
+
registerResource: (resource: AgentResourceInput) => AgentHandle;
|
|
262
|
+
/** Unregister a previously registered resource by id. */
|
|
263
|
+
unregisterResource: (id: string) => boolean;
|
|
264
|
+
/**
|
|
265
|
+
* Unified snapshot of agent-exposed surface: RPC functions with an
|
|
266
|
+
* `agent` field (auto-discovered from `ctx.rpc.definitions`) plus
|
|
267
|
+
* tools/resources registered on the host.
|
|
268
|
+
*/
|
|
269
|
+
list: () => AgentManifest;
|
|
270
|
+
/**
|
|
271
|
+
* Invoke any tool by id. Routes to the underlying RPC handler for
|
|
272
|
+
* `kind === 'rpc'`, or to the registered handler for `kind === 'tool'`.
|
|
273
|
+
*/
|
|
274
|
+
invoke: (id: string, args: unknown) => Promise<unknown>;
|
|
275
|
+
/** Read a resource by id. */
|
|
276
|
+
read: (id: string) => Promise<AgentResourceContent>;
|
|
277
|
+
/** Look up a tool by id (returns the serializable projection). */
|
|
278
|
+
getTool: (id: string) => AgentTool | undefined;
|
|
279
|
+
/** Look up a resource by id. */
|
|
280
|
+
getResource: (id: string) => AgentResource | undefined;
|
|
281
|
+
}
|
|
282
|
+
//#endregion
|
|
283
|
+
//#region src/types/commands.d.ts
|
|
284
|
+
interface DevToolsCommandKeybinding {
|
|
285
|
+
/**
|
|
286
|
+
* Keyboard shortcut string.
|
|
287
|
+
* Use "Mod" for platform-aware modifier (Cmd on macOS, Ctrl elsewhere).
|
|
288
|
+
* Examples: "Mod+K", "Mod+Shift+P", "Alt+N"
|
|
289
|
+
*/
|
|
290
|
+
key: string;
|
|
291
|
+
}
|
|
292
|
+
interface DevToolsCommandBase {
|
|
293
|
+
/**
|
|
294
|
+
* Unique namespaced ID, e.g. "vite:open-in-editor"
|
|
295
|
+
*/
|
|
296
|
+
id: string;
|
|
297
|
+
title: string;
|
|
298
|
+
description?: string;
|
|
299
|
+
/**
|
|
300
|
+
* Iconify icon string, e.g. "ph:pencil-duotone"
|
|
301
|
+
*/
|
|
302
|
+
icon?: string;
|
|
303
|
+
category?: string;
|
|
304
|
+
/**
|
|
305
|
+
* Whether to show in command palette. Default: true
|
|
306
|
+
*
|
|
307
|
+
* - `true` — show the command and flatten its children into search results
|
|
308
|
+
* - `false` — hide the command entirely from the palette
|
|
309
|
+
* - `'without-children'` — show the command but don't flatten children into top-level search (children are still accessible via drill-down)
|
|
310
|
+
*/
|
|
311
|
+
showInPalette?: boolean | 'without-children';
|
|
312
|
+
/**
|
|
313
|
+
* Optional context expression for conditional visibility.
|
|
314
|
+
* When set, the command is only shown in the palette and only executable
|
|
315
|
+
* when the expression evaluates to true.
|
|
316
|
+
*
|
|
317
|
+
* Uses the same syntax as keybinding `when` clauses.
|
|
318
|
+
* @example 'clientType == embedded'
|
|
319
|
+
* @example 'dockOpen && !paletteOpen'
|
|
320
|
+
*/
|
|
321
|
+
when?: string;
|
|
322
|
+
/**
|
|
323
|
+
* Default keyboard shortcut(s) for this command
|
|
324
|
+
*/
|
|
325
|
+
keybindings?: DevToolsCommandKeybinding[];
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* Server command input — what plugins pass to `ctx.commands.register()`.
|
|
329
|
+
*/
|
|
330
|
+
interface DevToolsServerCommandInput extends DevToolsCommandBase {
|
|
331
|
+
/**
|
|
332
|
+
* Handler for this command. Optional if the command only serves as a group for children.
|
|
333
|
+
*/
|
|
334
|
+
handler?: (...args: any[]) => any | Promise<any>;
|
|
335
|
+
/**
|
|
336
|
+
* Static sub-commands. Two levels max (parent → children).
|
|
337
|
+
* Each child must have a globally unique `id`.
|
|
338
|
+
*/
|
|
339
|
+
children?: DevToolsServerCommandInput[];
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Serializable server command entry — sent over RPC (no handler).
|
|
343
|
+
*/
|
|
344
|
+
interface DevToolsServerCommandEntry extends DevToolsCommandBase {
|
|
345
|
+
source: 'server';
|
|
346
|
+
children?: DevToolsServerCommandEntry[];
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Client command — registered in the webcomponent context.
|
|
350
|
+
*/
|
|
351
|
+
interface DevToolsClientCommand extends DevToolsCommandBase {
|
|
352
|
+
source: 'client';
|
|
353
|
+
/**
|
|
354
|
+
* Action for this command. Optional if the command only serves as a group for children.
|
|
355
|
+
* Return sub-commands for dynamic nested palette menus (runtime submenus).
|
|
356
|
+
*/
|
|
357
|
+
action?: (...args: any[]) => void | DevToolsClientCommand[] | Promise<void | DevToolsClientCommand[]>;
|
|
358
|
+
/**
|
|
359
|
+
* Static sub-commands. Two levels max (parent → children).
|
|
360
|
+
*/
|
|
361
|
+
children?: DevToolsClientCommand[];
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Union of command entries visible in the palette.
|
|
365
|
+
*/
|
|
366
|
+
type DevToolsCommandEntry = DevToolsServerCommandEntry | DevToolsClientCommand;
|
|
367
|
+
interface DevToolsCommandHandle {
|
|
368
|
+
readonly id: string;
|
|
369
|
+
update: (patch: Partial<Omit<DevToolsServerCommandInput, 'id'>>) => void;
|
|
370
|
+
unregister: () => void;
|
|
371
|
+
}
|
|
372
|
+
interface DevToolsCommandsHostEvents {
|
|
373
|
+
'command:registered': (command: DevToolsServerCommandEntry) => void;
|
|
374
|
+
'command:unregistered': (id: string) => void;
|
|
375
|
+
}
|
|
376
|
+
interface DevToolsCommandsHost {
|
|
377
|
+
readonly commands: Map<string, DevToolsServerCommandInput>;
|
|
378
|
+
readonly events: EventEmitter<DevToolsCommandsHostEvents>;
|
|
379
|
+
/**
|
|
380
|
+
* Register a command (with optional children).
|
|
381
|
+
*/
|
|
382
|
+
register: (command: DevToolsServerCommandInput) => DevToolsCommandHandle;
|
|
383
|
+
/**
|
|
384
|
+
* Unregister a command by ID (removes parent and all children).
|
|
385
|
+
*/
|
|
386
|
+
unregister: (id: string) => boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Execute a command by ID. Searches top-level and children.
|
|
389
|
+
* Throws if not found or if command has no handler.
|
|
390
|
+
*/
|
|
391
|
+
execute: (id: string, ...args: any[]) => Promise<unknown>;
|
|
392
|
+
/**
|
|
393
|
+
* Returns serializable list (no handlers), preserving tree structure.
|
|
394
|
+
*/
|
|
395
|
+
list: () => DevToolsServerCommandEntry[];
|
|
396
|
+
}
|
|
397
|
+
interface DevToolsCommandShortcutOverrides {
|
|
398
|
+
/**
|
|
399
|
+
* Command ID → keybinding overrides. Empty array = shortcut disabled.
|
|
400
|
+
*/
|
|
401
|
+
[commandId: string]: DevToolsCommandKeybinding[];
|
|
402
|
+
}
|
|
403
|
+
//#endregion
|
|
404
|
+
//#region src/types/diagnostics.d.ts
|
|
405
|
+
/**
|
|
406
|
+
* A diagnostics definition object built with `defineDiagnostics`. Typed as
|
|
407
|
+
* `unknown` because each integration's definition has a distinct narrow shape
|
|
408
|
+
* (e.g. specific code keys like `DF0001` / `MYP0001`), and TypeScript's mapped
|
|
409
|
+
* types don't allow assigning a narrow-keyed `DiagnosticsResult` to a
|
|
410
|
+
* generically-keyed one. The host stores them in a heterogeneous list and
|
|
411
|
+
* rebuilds the logger on `register()`.
|
|
412
|
+
*/
|
|
413
|
+
type DevToolsDiagnosticsDefinition = ReturnType<typeof defineDiagnostics<any>>;
|
|
414
|
+
/** A `logs-sdk` Logger instance built with `createLogger`. */
|
|
415
|
+
type DevToolsDiagnosticsLogger = Logger<readonly any[]>;
|
|
416
|
+
/**
|
|
417
|
+
* Host for structured diagnostics — a thin layer over `logs-sdk` that lets
|
|
418
|
+
* integrations register their own coded errors/warnings into the shared
|
|
419
|
+
* logger without taking a direct dependency on `logs-sdk`.
|
|
420
|
+
*
|
|
421
|
+
* Typical usage from a plugin's `setup(ctx)`:
|
|
422
|
+
*
|
|
423
|
+
* ```ts
|
|
424
|
+
* const myDiagnostics = ctx.diagnostics.defineDiagnostics({
|
|
425
|
+
* docsBase: 'https://example.com/errors',
|
|
426
|
+
* codes: {
|
|
427
|
+
* MYP0001: { message: 'Something went wrong' },
|
|
428
|
+
* },
|
|
429
|
+
* })
|
|
430
|
+
* ctx.diagnostics.register(myDiagnostics)
|
|
431
|
+
*
|
|
432
|
+
* // Later (loose typing):
|
|
433
|
+
* ctx.diagnostics.logger.MYP0001().warn()
|
|
434
|
+
*
|
|
435
|
+
* // Or with full typing, keep your own logger reference:
|
|
436
|
+
* const logger = ctx.diagnostics.createLogger({ diagnostics: [myDiagnostics] })
|
|
437
|
+
* logger.MYP0001().warn()
|
|
438
|
+
* ```
|
|
439
|
+
*/
|
|
440
|
+
interface DevToolsDiagnosticsHost {
|
|
441
|
+
/**
|
|
442
|
+
* The combined `logs-sdk` Logger including all registered diagnostic
|
|
443
|
+
* definitions. The getter always returns the freshest logger — it is
|
|
444
|
+
* rebuilt each time `register()` is called, so cached references to
|
|
445
|
+
* older loggers will not see codes registered later.
|
|
446
|
+
*/
|
|
447
|
+
readonly logger: DevToolsDiagnosticsLogger;
|
|
448
|
+
/**
|
|
449
|
+
* Register an additional diagnostic definition with this host. After
|
|
450
|
+
* registration, codes from the new definition are accessible on
|
|
451
|
+
* `host.logger`. Accepts any `DiagnosticsResult` produced by
|
|
452
|
+
* `defineDiagnostics` — the parameter is typed as `unknown` to avoid
|
|
453
|
+
* mapped-type variance issues with narrowly-keyed definitions.
|
|
454
|
+
*/
|
|
455
|
+
register: (definitions: unknown) => void;
|
|
456
|
+
/**
|
|
457
|
+
* Re-export of `logs-sdk`'s `defineDiagnostics`. Integrations can build
|
|
458
|
+
* their own diagnostic definitions without taking a direct dependency on
|
|
459
|
+
* `logs-sdk`.
|
|
460
|
+
*/
|
|
461
|
+
defineDiagnostics: typeof defineDiagnostics;
|
|
462
|
+
/**
|
|
463
|
+
* Re-export of `logs-sdk`'s `createLogger`. Use this when an integration
|
|
464
|
+
* wants its own typed Logger reference instead of going through
|
|
465
|
+
* `host.logger` (which is loosely typed).
|
|
466
|
+
*/
|
|
467
|
+
createLogger: typeof createLogger;
|
|
468
|
+
}
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/types/docks.d.ts
|
|
471
|
+
interface DevToolsDockHost {
|
|
472
|
+
readonly views: Map<string, DevToolsDockUserEntry>;
|
|
473
|
+
readonly events: EventEmitter<{
|
|
474
|
+
'dock:entry:updated': (entry: DevToolsDockUserEntry) => void;
|
|
475
|
+
}>;
|
|
476
|
+
register: <T extends DevToolsDockUserEntry>(entry: T, force?: boolean) => {
|
|
477
|
+
update: (patch: Partial<T>) => void;
|
|
478
|
+
};
|
|
479
|
+
update: (entry: DevToolsDockUserEntry) => void;
|
|
480
|
+
values: (options?: {
|
|
481
|
+
includeBuiltin?: boolean;
|
|
482
|
+
}) => DevToolsDockEntry[];
|
|
483
|
+
}
|
|
484
|
+
type DevToolsDockEntryCategory = 'app' | 'framework' | 'web' | 'advanced' | 'default' | '~viteplus' | '~builtin';
|
|
485
|
+
type DevToolsDockEntryIcon = string | {
|
|
486
|
+
light: string;
|
|
487
|
+
dark: string;
|
|
488
|
+
};
|
|
489
|
+
interface DevToolsDockEntryBase {
|
|
490
|
+
id: string;
|
|
491
|
+
title: string;
|
|
492
|
+
icon: DevToolsDockEntryIcon;
|
|
493
|
+
/**
|
|
494
|
+
* The default order of the entry in the dock.
|
|
495
|
+
* The higher the number the earlier it appears.
|
|
496
|
+
* @default 0
|
|
497
|
+
*/
|
|
498
|
+
defaultOrder?: number;
|
|
499
|
+
/**
|
|
500
|
+
* The category of the entry
|
|
501
|
+
* @default 'default'
|
|
502
|
+
*/
|
|
503
|
+
category?: DevToolsDockEntryCategory;
|
|
504
|
+
/**
|
|
505
|
+
* Conditional visibility expression.
|
|
506
|
+
* When set, the dock entry is only visible when the expression evaluates to true.
|
|
507
|
+
* Uses the same syntax as command `when` clauses.
|
|
508
|
+
*
|
|
509
|
+
* Set to `'false'` to unconditionally hide the entry.
|
|
510
|
+
*
|
|
511
|
+
* @example 'clientType == embedded'
|
|
512
|
+
* @see {@link import('../utils/when').evaluateWhen}
|
|
513
|
+
*/
|
|
514
|
+
when?: string;
|
|
515
|
+
/**
|
|
516
|
+
* Badge text to display on the dock icon (e.g., unread count)
|
|
517
|
+
*/
|
|
518
|
+
badge?: string;
|
|
519
|
+
}
|
|
520
|
+
interface ClientScriptEntry {
|
|
521
|
+
/**
|
|
522
|
+
* The filepath or module name to import from
|
|
523
|
+
*/
|
|
524
|
+
importFrom: string;
|
|
525
|
+
/**
|
|
526
|
+
* The name to import the module as
|
|
527
|
+
*
|
|
528
|
+
* @default 'default'
|
|
529
|
+
*/
|
|
530
|
+
importName?: string;
|
|
531
|
+
}
|
|
532
|
+
interface DevToolsViewIframe extends DevToolsDockEntryBase {
|
|
533
|
+
type: 'iframe';
|
|
534
|
+
url: string;
|
|
535
|
+
/**
|
|
536
|
+
* The id of the iframe, if multiple tabs is assigned with the same id, the iframe will be shared.
|
|
537
|
+
*
|
|
538
|
+
* When not provided, it would be treated as a unique frame.
|
|
539
|
+
*/
|
|
540
|
+
frameId?: string;
|
|
541
|
+
/**
|
|
542
|
+
* Optional client script to import into the iframe
|
|
543
|
+
*/
|
|
544
|
+
clientScript?: ClientScriptEntry;
|
|
545
|
+
/**
|
|
546
|
+
* Enable remote-UI mode: the core injects a connection descriptor
|
|
547
|
+
* (WS URL + pre-approved auth token) into the iframe URL so a hosted
|
|
548
|
+
* page can connect back via `connectRemoteDevTools()` from
|
|
549
|
+
* `@vitejs/devtools-kit/client` — without needing to ship a dist with
|
|
550
|
+
* the plugin.
|
|
551
|
+
*
|
|
552
|
+
* Requires dev mode (no effect in build mode — no WS server exists).
|
|
553
|
+
* When enabled, the dock is automatically hidden in build mode unless
|
|
554
|
+
* the author provides an explicit `when` clause.
|
|
555
|
+
*
|
|
556
|
+
* @example
|
|
557
|
+
* remote: true
|
|
558
|
+
* remote: { transport: 'query', originLock: false }
|
|
559
|
+
*/
|
|
560
|
+
remote?: boolean | RemoteDockOptions;
|
|
561
|
+
}
|
|
562
|
+
interface RemoteDockOptions {
|
|
563
|
+
/**
|
|
564
|
+
* How to pass the connection descriptor to the hosted page.
|
|
565
|
+
*
|
|
566
|
+
* - `'fragment'` (default): appended as `#vite-devtools-kit-connection=...`.
|
|
567
|
+
* Not sent in HTTP requests or Referer headers — safest for auth tokens.
|
|
568
|
+
* - `'query'`: appended as `?vite-devtools-kit-connection=...`. Use when
|
|
569
|
+
* your hosting platform rewrites fragments or your SPA router repurposes
|
|
570
|
+
* the fragment for navigation. The token will appear in server access
|
|
571
|
+
* logs and outbound Referer headers.
|
|
572
|
+
*
|
|
573
|
+
* @default 'fragment'
|
|
574
|
+
*/
|
|
575
|
+
transport?: 'fragment' | 'query';
|
|
576
|
+
/**
|
|
577
|
+
* Reject WS handshakes whose `Origin` header doesn't match the dock URL
|
|
578
|
+
* origin. Turn off when the same hosted app is served from multiple
|
|
579
|
+
* origins (e.g. preview deploys).
|
|
580
|
+
*
|
|
581
|
+
* @default true
|
|
582
|
+
*/
|
|
583
|
+
originLock?: boolean;
|
|
584
|
+
}
|
|
585
|
+
type DevToolsViewLauncherStatus = 'idle' | 'loading' | 'success' | 'error';
|
|
586
|
+
interface DevToolsViewLauncher extends DevToolsDockEntryBase {
|
|
587
|
+
type: 'launcher';
|
|
588
|
+
launcher: {
|
|
589
|
+
icon?: DevToolsDockEntryIcon;
|
|
590
|
+
title: string;
|
|
591
|
+
status?: DevToolsViewLauncherStatus;
|
|
592
|
+
error?: string;
|
|
593
|
+
description?: string;
|
|
594
|
+
buttonStart?: string;
|
|
595
|
+
buttonLoading?: string;
|
|
596
|
+
onLaunch: () => Promise<void>;
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
interface DevToolsViewAction extends DevToolsDockEntryBase {
|
|
600
|
+
type: 'action';
|
|
601
|
+
action: ClientScriptEntry;
|
|
602
|
+
}
|
|
603
|
+
interface DevToolsViewCustomRender extends DevToolsDockEntryBase {
|
|
604
|
+
type: 'custom-render';
|
|
605
|
+
renderer: ClientScriptEntry;
|
|
606
|
+
}
|
|
607
|
+
interface DevToolsViewBuiltin extends DevToolsDockEntryBase {
|
|
608
|
+
type: '~builtin';
|
|
609
|
+
id: '~terminals' | '~messages' | '~client-auth-notice' | '~settings' | '~popup';
|
|
610
|
+
}
|
|
611
|
+
interface JsonRenderElement {
|
|
612
|
+
type: string;
|
|
613
|
+
props?: Record<string, unknown>;
|
|
614
|
+
children?: string[];
|
|
615
|
+
/** json-render event bindings (e.g. `{ press: { action: "my:action" } }`) */
|
|
616
|
+
on?: Record<string, unknown>;
|
|
617
|
+
/** json-render visibility condition */
|
|
618
|
+
visible?: unknown;
|
|
619
|
+
/** json-render repeat binding */
|
|
620
|
+
repeat?: unknown;
|
|
621
|
+
/** Allow additional json-render element fields */
|
|
622
|
+
[key: string]: unknown;
|
|
623
|
+
}
|
|
624
|
+
interface JsonRenderSpec {
|
|
625
|
+
root: string;
|
|
626
|
+
elements: Record<string, JsonRenderElement>;
|
|
627
|
+
/** Initial client-side state model for $state/$bindState expressions */
|
|
628
|
+
state?: Record<string, unknown>;
|
|
629
|
+
}
|
|
630
|
+
interface JsonRenderer {
|
|
631
|
+
/** Replace the entire spec */
|
|
632
|
+
updateSpec: (spec: JsonRenderSpec) => void | Promise<void>;
|
|
633
|
+
/** Update json-render state values (shallow merge into spec.state) */
|
|
634
|
+
updateState: (state: Record<string, unknown>) => void | Promise<void>;
|
|
635
|
+
/** Internal: shared state key used by the client to subscribe */
|
|
636
|
+
readonly _stateKey: string;
|
|
637
|
+
}
|
|
638
|
+
interface DevToolsViewJsonRender extends DevToolsDockEntryBase {
|
|
639
|
+
type: 'json-render';
|
|
640
|
+
/** JsonRenderer handle created by ctx.createJsonRenderer() */
|
|
641
|
+
ui: JsonRenderer;
|
|
642
|
+
}
|
|
643
|
+
type DevToolsDockUserEntry = DevToolsViewIframe | DevToolsViewAction | DevToolsViewCustomRender | DevToolsViewLauncher | DevToolsViewJsonRender;
|
|
644
|
+
type DevToolsDockEntry = DevToolsDockUserEntry | DevToolsViewBuiltin;
|
|
645
|
+
type DevToolsDockEntriesGrouped = [category: string, entries: DevToolsDockEntry[]][];
|
|
646
|
+
//#endregion
|
|
647
|
+
//#region src/types/host.d.ts
|
|
648
|
+
interface DevToolsHost {
|
|
649
|
+
/**
|
|
650
|
+
* Serve a static directory at the given URL base. Called by
|
|
651
|
+
* `DevToolsViewHost.hostStatic`. Implementations map this to whatever
|
|
652
|
+
* the underlying runtime expects (Vite middleware, h3 handler, no-op
|
|
653
|
+
* for build snapshots).
|
|
654
|
+
*/
|
|
655
|
+
mountStatic: (base: string, distDir: string) => void | Promise<void>;
|
|
656
|
+
/**
|
|
657
|
+
* Return the public origin the host is reachable at, e.g.
|
|
658
|
+
* `http://localhost:5173`. Used by the dock host to enrich remote
|
|
659
|
+
* iframe URLs with a full `origin`. Called only when a dock needs an
|
|
660
|
+
* absolute URL; hosts that never serve remote docks can return any
|
|
661
|
+
* reasonable value.
|
|
662
|
+
*/
|
|
663
|
+
resolveOrigin: () => string;
|
|
664
|
+
}
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/types/messages.d.ts
|
|
667
|
+
type DevToolsMessageLevel = 'info' | 'warn' | 'error' | 'success' | 'debug';
|
|
668
|
+
type DevToolsMessageEntryFrom = 'server' | 'browser';
|
|
669
|
+
interface DevToolsMessageElementPosition {
|
|
670
|
+
/** CSS selector for the element */
|
|
671
|
+
selector?: string;
|
|
672
|
+
/** Bounding box of the element */
|
|
673
|
+
boundingBox?: {
|
|
674
|
+
x: number;
|
|
675
|
+
y: number;
|
|
676
|
+
width: number;
|
|
677
|
+
height: number;
|
|
678
|
+
};
|
|
679
|
+
/** Human-readable description of the element */
|
|
680
|
+
description?: string;
|
|
681
|
+
}
|
|
682
|
+
interface DevToolsMessageFilePosition {
|
|
683
|
+
/** Absolute or relative file path */
|
|
684
|
+
file: string;
|
|
685
|
+
/** Line number (1-based) */
|
|
686
|
+
line?: number;
|
|
687
|
+
/** Column number (1-based) */
|
|
688
|
+
column?: number;
|
|
689
|
+
}
|
|
690
|
+
interface DevToolsMessageEntry {
|
|
691
|
+
/**
|
|
692
|
+
* Unique identifier for this message entry (auto-generated if not provided)
|
|
693
|
+
*/
|
|
694
|
+
id: string;
|
|
695
|
+
/**
|
|
696
|
+
* Short title or summary of the message
|
|
697
|
+
*/
|
|
698
|
+
message: string;
|
|
699
|
+
/**
|
|
700
|
+
* Optional detailed description or explanation
|
|
701
|
+
*/
|
|
702
|
+
description?: string;
|
|
703
|
+
/**
|
|
704
|
+
* Severity level, determines color and icon
|
|
705
|
+
*/
|
|
706
|
+
level: DevToolsMessageLevel;
|
|
707
|
+
/**
|
|
708
|
+
* Optional stack trace string
|
|
709
|
+
*/
|
|
710
|
+
stacktrace?: string;
|
|
711
|
+
/**
|
|
712
|
+
* Optional DOM element position info (e.g., for a11y issues)
|
|
713
|
+
*/
|
|
714
|
+
elementPosition?: DevToolsMessageElementPosition;
|
|
715
|
+
/**
|
|
716
|
+
* Optional source file position info (e.g., for lint errors)
|
|
717
|
+
*/
|
|
718
|
+
filePosition?: DevToolsMessageFilePosition;
|
|
719
|
+
/**
|
|
720
|
+
* Whether this message should also appear as a toast notification
|
|
721
|
+
*/
|
|
722
|
+
notify?: boolean;
|
|
723
|
+
/**
|
|
724
|
+
* Origin of the message entry, automatically set by the context
|
|
725
|
+
*/
|
|
726
|
+
from: DevToolsMessageEntryFrom;
|
|
727
|
+
/**
|
|
728
|
+
* Grouping category (e.g., 'a11y', 'lint', 'runtime', 'test')
|
|
729
|
+
*/
|
|
730
|
+
category?: string;
|
|
731
|
+
/**
|
|
732
|
+
* Optional tags/labels for filtering
|
|
733
|
+
*/
|
|
734
|
+
labels?: string[];
|
|
735
|
+
/**
|
|
736
|
+
* Time in ms to auto-dismiss the toast notification (client-side)
|
|
737
|
+
*/
|
|
738
|
+
autoDismiss?: number;
|
|
739
|
+
/**
|
|
740
|
+
* Time in ms to auto-delete this message entry (server-side)
|
|
741
|
+
*/
|
|
742
|
+
autoDelete?: number;
|
|
743
|
+
/**
|
|
744
|
+
* Timestamp when the message was created (auto-generated if not provided)
|
|
745
|
+
*/
|
|
746
|
+
timestamp: number;
|
|
747
|
+
/**
|
|
748
|
+
* Status of the message entry (e.g., 'loading' while an operation is in progress).
|
|
749
|
+
* Defaults to 'idle' when not specified.
|
|
750
|
+
*/
|
|
751
|
+
status?: 'loading' | 'idle';
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Input type for creating a message entry.
|
|
755
|
+
* `id`, `timestamp`, and `from` are auto-filled by the host.
|
|
756
|
+
*/
|
|
757
|
+
type DevToolsMessageEntryInput = Omit<DevToolsMessageEntry, 'id' | 'timestamp' | 'from'> & {
|
|
758
|
+
id?: string;
|
|
759
|
+
timestamp?: number;
|
|
760
|
+
};
|
|
761
|
+
interface DevToolsMessageHandle {
|
|
762
|
+
/** The underlying message entry data */
|
|
763
|
+
readonly entry: DevToolsMessageEntry;
|
|
764
|
+
/** Shortcut to entry.id */
|
|
765
|
+
readonly id: string;
|
|
766
|
+
/** Partial update of this message entry */
|
|
767
|
+
update: (patch: Partial<DevToolsMessageEntryInput>) => Promise<DevToolsMessageEntry | undefined>;
|
|
768
|
+
/** Remove this message entry */
|
|
769
|
+
dismiss: () => Promise<void>;
|
|
770
|
+
}
|
|
771
|
+
interface DevToolsMessagesClient {
|
|
772
|
+
/**
|
|
773
|
+
* Add a message entry. Returns a Promise resolving to a handle for subsequent updates/dismissal.
|
|
774
|
+
* Can be used without `await` for fire-and-forget usage.
|
|
775
|
+
*/
|
|
776
|
+
add: (input: DevToolsMessageEntryInput) => Promise<DevToolsMessageHandle>;
|
|
777
|
+
/** Remove a message entry by id */
|
|
778
|
+
remove: (id: string) => Promise<void>;
|
|
779
|
+
/** Clear all message entries */
|
|
780
|
+
clear: () => Promise<void>;
|
|
781
|
+
}
|
|
782
|
+
interface DevToolsMessagesHost {
|
|
783
|
+
readonly entries: Map<string, DevToolsMessageEntry>;
|
|
784
|
+
readonly events: EventEmitter<{
|
|
785
|
+
'message:added': (entry: DevToolsMessageEntry) => void;
|
|
786
|
+
'message:updated': (entry: DevToolsMessageEntry) => void;
|
|
787
|
+
'message:removed': (id: string) => void;
|
|
788
|
+
'message:cleared': () => void;
|
|
789
|
+
}>;
|
|
790
|
+
/**
|
|
791
|
+
* Add a new message entry. If an entry with the same `id` already exists, it will be updated instead.
|
|
792
|
+
* Returns a handle for subsequent updates/dismissal. Can be used without `await` for fire-and-forget.
|
|
793
|
+
*/
|
|
794
|
+
add: (entry: DevToolsMessageEntryInput) => Promise<DevToolsMessageHandle>;
|
|
795
|
+
/**
|
|
796
|
+
* Update an existing message entry by id (partial update)
|
|
797
|
+
*/
|
|
798
|
+
update: (id: string, patch: Partial<DevToolsMessageEntryInput>) => Promise<DevToolsMessageEntry | undefined>;
|
|
799
|
+
/**
|
|
800
|
+
* Remove a message entry by id
|
|
801
|
+
*/
|
|
802
|
+
remove: (id: string) => Promise<void>;
|
|
803
|
+
/**
|
|
804
|
+
* Clear all message entries
|
|
805
|
+
*/
|
|
806
|
+
clear: () => Promise<void>;
|
|
807
|
+
}
|
|
808
|
+
/** @deprecated alias of {@link DevToolsMessageLevel}. Will be removed in a future release. */
|
|
809
|
+
type DevToolsLogLevel = DevToolsMessageLevel;
|
|
810
|
+
/** @deprecated alias of {@link DevToolsMessageEntryFrom}. Will be removed in a future release. */
|
|
811
|
+
type DevToolsLogEntryFrom = DevToolsMessageEntryFrom;
|
|
812
|
+
/** @deprecated alias of {@link DevToolsMessageElementPosition}. Will be removed in a future release. */
|
|
813
|
+
type DevToolsLogElementPosition = DevToolsMessageElementPosition;
|
|
814
|
+
/** @deprecated alias of {@link DevToolsMessageFilePosition}. Will be removed in a future release. */
|
|
815
|
+
type DevToolsLogFilePosition = DevToolsMessageFilePosition;
|
|
816
|
+
/** @deprecated alias of {@link DevToolsMessageEntry}. Will be removed in a future release. */
|
|
817
|
+
type DevToolsLogEntry = DevToolsMessageEntry;
|
|
818
|
+
/** @deprecated alias of {@link DevToolsMessageEntryInput}. Will be removed in a future release. */
|
|
819
|
+
type DevToolsLogEntryInput = DevToolsMessageEntryInput;
|
|
820
|
+
/** @deprecated alias of {@link DevToolsMessageHandle}. Will be removed in a future release. */
|
|
821
|
+
type DevToolsLogHandle = DevToolsMessageHandle;
|
|
822
|
+
/** @deprecated alias of {@link DevToolsMessagesClient}. Will be removed in a future release. */
|
|
823
|
+
type DevToolsLogsClient = DevToolsMessagesClient;
|
|
824
|
+
/** @deprecated alias of {@link DevToolsMessagesHost}. Will be removed in a future release. */
|
|
825
|
+
type DevToolsLogsHost = DevToolsMessagesHost;
|
|
826
|
+
//#endregion
|
|
827
|
+
//#region src/types/rpc-augments.d.ts
|
|
828
|
+
/**
|
|
829
|
+
* To be extended
|
|
830
|
+
*/
|
|
831
|
+
interface DevToolsRpcClientFunctions {}
|
|
832
|
+
/**
|
|
833
|
+
* To be extended
|
|
834
|
+
*/
|
|
835
|
+
interface DevToolsRpcServerFunctions {}
|
|
836
|
+
/**
|
|
837
|
+
* To be extended
|
|
838
|
+
*/
|
|
839
|
+
interface DevToolsRpcSharedStates {}
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/types/settings.d.ts
|
|
842
|
+
interface DevToolsDocksUserSettings {
|
|
843
|
+
docksHidden: string[];
|
|
844
|
+
docksCategoriesHidden: string[];
|
|
845
|
+
docksPinned: string[];
|
|
846
|
+
docksCustomOrder: Record<string, number>;
|
|
847
|
+
showIframeAddressBar: boolean;
|
|
848
|
+
closeOnOutsideClick: boolean;
|
|
849
|
+
commandShortcuts: DevToolsCommandShortcutOverrides;
|
|
850
|
+
}
|
|
851
|
+
//#endregion
|
|
852
|
+
//#region src/types/terminals.d.ts
|
|
853
|
+
interface DevToolsTerminalSessionStreamChunkEvent {
|
|
854
|
+
id: string;
|
|
855
|
+
chunks: string[];
|
|
856
|
+
ts: number;
|
|
857
|
+
}
|
|
858
|
+
interface DevToolsTerminalHost {
|
|
859
|
+
readonly sessions: Map<string, DevToolsTerminalSession>;
|
|
860
|
+
readonly events: EventEmitter<{
|
|
861
|
+
'terminal:session:updated': (session: DevToolsTerminalSession) => void;
|
|
862
|
+
'terminal:session:stream-chunk': (data: DevToolsTerminalSessionStreamChunkEvent) => void;
|
|
863
|
+
}>;
|
|
864
|
+
register: (session: DevToolsTerminalSession) => DevToolsTerminalSession;
|
|
865
|
+
update: (session: DevToolsTerminalSession) => void;
|
|
866
|
+
startChildProcess: (executeOptions: DevToolsChildProcessExecuteOptions, terminal: Omit<DevToolsTerminalSessionBase, 'status'>) => Promise<DevToolsChildProcessTerminalSession>;
|
|
867
|
+
}
|
|
868
|
+
type DevToolsTerminalStatus = 'running' | 'stopped' | 'error';
|
|
869
|
+
interface DevToolsTerminalSessionBase {
|
|
870
|
+
id: string;
|
|
871
|
+
title: string;
|
|
872
|
+
description?: string;
|
|
873
|
+
status: DevToolsTerminalStatus;
|
|
874
|
+
icon?: DevToolsDockEntryIcon;
|
|
875
|
+
}
|
|
876
|
+
interface DevToolsTerminalSession extends DevToolsTerminalSessionBase {
|
|
877
|
+
buffer?: string[];
|
|
878
|
+
stream?: ReadableStream<string>;
|
|
879
|
+
}
|
|
880
|
+
interface DevToolsChildProcessExecuteOptions {
|
|
881
|
+
command: string;
|
|
882
|
+
args: string[];
|
|
883
|
+
cwd?: string;
|
|
884
|
+
env?: Record<string, string>;
|
|
885
|
+
}
|
|
886
|
+
interface DevToolsChildProcessTerminalSession extends DevToolsTerminalSession {
|
|
887
|
+
type: 'child-process';
|
|
888
|
+
executeOptions: DevToolsChildProcessExecuteOptions;
|
|
889
|
+
getChildProcess: () => ChildProcess | undefined;
|
|
890
|
+
terminate: () => Promise<void>;
|
|
891
|
+
restart: () => Promise<void>;
|
|
892
|
+
}
|
|
893
|
+
//#endregion
|
|
894
|
+
//#region src/types/utils.d.ts
|
|
895
|
+
type Thenable<T> = T | Promise<T>;
|
|
896
|
+
type EntriesToObject<T extends readonly [string, any][]> = { [K in T[number] as K[0]]: K[1] };
|
|
897
|
+
type PartialWithoutId<T extends {
|
|
898
|
+
id: string;
|
|
899
|
+
}> = Partial<Omit<T, 'id'>> & {
|
|
900
|
+
id: string;
|
|
901
|
+
};
|
|
902
|
+
//#endregion
|
|
903
|
+
//#region src/types/views.d.ts
|
|
904
|
+
interface DevToolsViewHost {
|
|
905
|
+
/**
|
|
906
|
+
* @internal
|
|
907
|
+
*/
|
|
908
|
+
buildStaticDirs: {
|
|
909
|
+
baseUrl: string;
|
|
910
|
+
distDir: string;
|
|
911
|
+
}[];
|
|
912
|
+
/**
|
|
913
|
+
* Helper to host static files
|
|
914
|
+
* - In `dev` mode, it will register middleware to `viteServer.middlewares` to host the static files
|
|
915
|
+
* - In `build` mode, it will copy the static files to the dist directory
|
|
916
|
+
*/
|
|
917
|
+
hostStatic: (baseUrl: string, distDir: string) => void;
|
|
918
|
+
}
|
|
919
|
+
//#endregion
|
|
920
|
+
//#region ../../../node_modules/.pnpm/immer@11.1.4/node_modules/immer/dist/immer.d.ts
|
|
921
|
+
interface Patch {
|
|
922
|
+
op: "replace" | "remove" | "add";
|
|
923
|
+
path: (string | number)[];
|
|
924
|
+
value?: any;
|
|
925
|
+
}
|
|
926
|
+
type Objectish = AnyObject | AnyArray | AnyMap | AnySet;
|
|
927
|
+
type AnyObject = {
|
|
928
|
+
[key: string]: any;
|
|
929
|
+
};
|
|
930
|
+
type AnyArray = Array<any>;
|
|
931
|
+
type AnySet = Set<any>;
|
|
932
|
+
type AnyMap = Map<any, any>;
|
|
933
|
+
/** Returns true if the given value is an Immer draft */
|
|
934
|
+
//#endregion
|
|
935
|
+
//#region src/utils/shared-state.d.ts
|
|
936
|
+
type ImmutablePrimitive = undefined | null | boolean | string | number | Function;
|
|
937
|
+
type Immutable<T> = T extends ImmutablePrimitive ? T : T extends Array<infer U> ? ImmutableArray<U> : T extends Map<infer K, infer V> ? ImmutableMap<K, V> : T extends Set<infer M> ? ImmutableSet<M> : ImmutableObject<T>;
|
|
938
|
+
type ImmutableArray<T> = ReadonlyArray<Immutable<T>>;
|
|
939
|
+
type ImmutableMap<K, V> = ReadonlyMap<Immutable<K>, Immutable<V>>;
|
|
940
|
+
type ImmutableSet<T> = ReadonlySet<Immutable<T>>;
|
|
941
|
+
type ImmutableObject<T> = { readonly [K in keyof T]: Immutable<T[K]> };
|
|
942
|
+
/**
|
|
943
|
+
* State host that is immutable by default with explicit mutate.
|
|
944
|
+
*/
|
|
945
|
+
interface SharedState<T> {
|
|
946
|
+
/**
|
|
947
|
+
* Get the current state. Immutable.
|
|
948
|
+
*/
|
|
949
|
+
value: () => Immutable<T>;
|
|
950
|
+
/**
|
|
951
|
+
* Subscribe to state changes.
|
|
952
|
+
*/
|
|
953
|
+
on: EventEmitter<SharedStateEvents<T>>['on'];
|
|
954
|
+
/**
|
|
955
|
+
* Mutate the state.
|
|
956
|
+
*/
|
|
957
|
+
mutate: (fn: (state: T) => void, syncId?: string) => void;
|
|
958
|
+
/**
|
|
959
|
+
* Apply patches to the state.
|
|
960
|
+
*/
|
|
961
|
+
patch: (patches: Patch[], syncId?: string) => void;
|
|
962
|
+
/**
|
|
963
|
+
* Sync IDs that have been applied to the state.
|
|
964
|
+
*/
|
|
965
|
+
syncIds: Set<string>;
|
|
966
|
+
}
|
|
967
|
+
interface SharedStateEvents<T> {
|
|
968
|
+
updated: (fullState: T, patches: Patch[] | undefined, syncId: string) => void;
|
|
969
|
+
}
|
|
970
|
+
interface SharedStateOptions<T> {
|
|
971
|
+
/**
|
|
972
|
+
* Initial state.
|
|
973
|
+
*/
|
|
974
|
+
initialValue: T;
|
|
975
|
+
/**
|
|
976
|
+
* Enable patches.
|
|
977
|
+
*
|
|
978
|
+
* @default false
|
|
979
|
+
*/
|
|
980
|
+
enablePatches?: boolean;
|
|
981
|
+
}
|
|
982
|
+
declare function createSharedState<T extends Objectish>(options: SharedStateOptions<T>): SharedState<T>;
|
|
983
|
+
//#endregion
|
|
984
|
+
//#region src/types/rpc.d.ts
|
|
985
|
+
interface DevToolsNodeRpcSession {
|
|
986
|
+
meta: DevToolsNodeRpcSessionMeta;
|
|
987
|
+
rpc: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>;
|
|
988
|
+
}
|
|
989
|
+
interface RpcBroadcastOptions<METHOD, Args extends any[]> {
|
|
990
|
+
method: METHOD;
|
|
991
|
+
args: Args;
|
|
992
|
+
optional?: boolean;
|
|
993
|
+
event?: boolean;
|
|
994
|
+
filter?: (client: BirpcReturn<DevToolsRpcClientFunctions, DevToolsRpcServerFunctions, false>) => boolean | void;
|
|
995
|
+
}
|
|
996
|
+
type RpcFunctionsHost = RpcFunctionsCollectorBase<DevToolsRpcServerFunctions, DevToolsNodeContext> & {
|
|
997
|
+
/**
|
|
998
|
+
* Invoke a locally registered server RPC function directly.
|
|
999
|
+
*
|
|
1000
|
+
* This bypasses transport and is useful for server-side cross-function calls.
|
|
1001
|
+
*/
|
|
1002
|
+
invokeLocal: <T extends keyof DevToolsRpcServerFunctions, Args extends Parameters<DevToolsRpcServerFunctions[T]>>(method: T, ...args: Args) => Promise<Awaited<ReturnType<DevToolsRpcServerFunctions[T]>>>;
|
|
1003
|
+
/**
|
|
1004
|
+
* Broadcast a message to all connected clients
|
|
1005
|
+
*/
|
|
1006
|
+
broadcast: <T extends keyof DevToolsRpcClientFunctions, Args extends Parameters<DevToolsRpcClientFunctions[T]>>(options: RpcBroadcastOptions<T, Args>) => Promise<void>;
|
|
1007
|
+
/**
|
|
1008
|
+
* Get the current RPC client
|
|
1009
|
+
*
|
|
1010
|
+
* Available in RPC functions to get the current RPC client
|
|
1011
|
+
*/
|
|
1012
|
+
getCurrentRpcSession: () => DevToolsNodeRpcSession | undefined;
|
|
1013
|
+
/**
|
|
1014
|
+
* The shared state host
|
|
1015
|
+
*/
|
|
1016
|
+
sharedState: RpcSharedStateHost;
|
|
1017
|
+
};
|
|
1018
|
+
interface RpcSharedStateGetOptions<T> {
|
|
1019
|
+
sharedState?: SharedState<T>;
|
|
1020
|
+
initialValue?: T;
|
|
1021
|
+
}
|
|
1022
|
+
interface RpcSharedStateHost {
|
|
1023
|
+
get: <T extends keyof DevToolsRpcSharedStates>(key: T, options?: RpcSharedStateGetOptions<DevToolsRpcSharedStates[T]>) => Promise<SharedState<DevToolsRpcSharedStates[T]>>;
|
|
1024
|
+
keys: () => string[];
|
|
1025
|
+
/**
|
|
1026
|
+
* Subscribe to new shared-state keys becoming available. Fires when
|
|
1027
|
+
* `get(key, ...)` creates a fresh entry (not on subsequent gets).
|
|
1028
|
+
* Useful for protocol adapters (e.g. MCP) that surface shared state
|
|
1029
|
+
* as dynamic resources.
|
|
1030
|
+
*/
|
|
1031
|
+
onKeyAdded: (fn: (key: string) => void) => () => void;
|
|
1032
|
+
}
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src/types/context.d.ts
|
|
1035
|
+
interface DevToolsCapabilities {
|
|
1036
|
+
rpc?: boolean;
|
|
1037
|
+
views?: boolean;
|
|
1038
|
+
}
|
|
1039
|
+
interface DevToolsNodeContext {
|
|
1040
|
+
readonly workspaceRoot: string;
|
|
1041
|
+
readonly cwd: string;
|
|
1042
|
+
readonly mode: 'dev' | 'build';
|
|
1043
|
+
/**
|
|
1044
|
+
* Host runtime abstraction — exposes `mountStatic` / `resolveOrigin`.
|
|
1045
|
+
*/
|
|
1046
|
+
host: DevToolsHost;
|
|
1047
|
+
rpc: RpcFunctionsHost;
|
|
1048
|
+
docks: DevToolsDockHost;
|
|
1049
|
+
views: DevToolsViewHost;
|
|
1050
|
+
utils: DevToolsNodeUtils;
|
|
1051
|
+
terminals: DevToolsTerminalHost;
|
|
1052
|
+
/**
|
|
1053
|
+
* User-facing message subsystem — toast notifications and the
|
|
1054
|
+
* "Messages & Notifications" dock panel. Plugins call
|
|
1055
|
+
* `ctx.messages.add({ ... })` to surface activity to users.
|
|
1056
|
+
*/
|
|
1057
|
+
messages: DevToolsMessagesHost;
|
|
1058
|
+
/**
|
|
1059
|
+
* @deprecated Use `ctx.messages` instead. Will be removed in a future release.
|
|
1060
|
+
*/
|
|
1061
|
+
readonly logs: DevToolsMessagesHost;
|
|
1062
|
+
/**
|
|
1063
|
+
* Structured diagnostics host — wraps `logs-sdk` and lets integrations
|
|
1064
|
+
* register their own coded errors/warnings into the shared logger.
|
|
1065
|
+
*/
|
|
1066
|
+
diagnostics: DevToolsDiagnosticsHost;
|
|
1067
|
+
commands: DevToolsCommandsHost;
|
|
1068
|
+
/**
|
|
1069
|
+
* Agent host — aggregates the agent-exposed surface of this devtool.
|
|
1070
|
+
*
|
|
1071
|
+
* @experimental
|
|
1072
|
+
*/
|
|
1073
|
+
agent: DevToolsAgentHost;
|
|
1074
|
+
/**
|
|
1075
|
+
* Create a JsonRenderer handle for building json-render powered UIs.
|
|
1076
|
+
*/
|
|
1077
|
+
createJsonRenderer: (spec: JsonRenderSpec) => JsonRenderer;
|
|
1078
|
+
}
|
|
1079
|
+
interface DevToolsNodeUtils {
|
|
1080
|
+
/**
|
|
1081
|
+
* Create a simple client script from a function or stringified code.
|
|
1082
|
+
*
|
|
1083
|
+
* @deprecated testing helper; prefer a proper importable module.
|
|
1084
|
+
* @experimental
|
|
1085
|
+
*/
|
|
1086
|
+
createSimpleClientScript: (fn: string | ((ctx: any) => void)) => ClientScriptEntry;
|
|
1087
|
+
}
|
|
1088
|
+
interface ConnectionMeta {
|
|
1089
|
+
backend: 'websocket' | 'static';
|
|
1090
|
+
websocket?: number | string;
|
|
1091
|
+
/**
|
|
1092
|
+
* Names of RPC functions that have declared `jsonSerializable: true`.
|
|
1093
|
+
* Used by the WS / static client to dispatch the per-call wire
|
|
1094
|
+
* serializer (strict JSON for these methods, structured-clone for
|
|
1095
|
+
* the rest). Populated by the server / build adapter; absent on
|
|
1096
|
+
* legacy clients, in which case all outgoing messages fall back to
|
|
1097
|
+
* structured-clone.
|
|
1098
|
+
*/
|
|
1099
|
+
jsonSerializableMethods?: string[];
|
|
1100
|
+
}
|
|
1101
|
+
interface RemoteConnectionInfo extends ConnectionMeta {
|
|
1102
|
+
backend: 'websocket';
|
|
1103
|
+
websocket: string;
|
|
1104
|
+
v: 1;
|
|
1105
|
+
authToken: string;
|
|
1106
|
+
origin: string;
|
|
1107
|
+
}
|
|
1108
|
+
//#endregion
|
|
1109
|
+
//#region src/types/devtool.d.ts
|
|
1110
|
+
type DevtoolRuntime = 'cli' | 'build' | 'spa' | 'vite' | 'kit' | 'embedded';
|
|
1111
|
+
/**
|
|
1112
|
+
* Classification of how a devtool is being deployed. Hosted adapters
|
|
1113
|
+
* (`vite`, `kit`, `embedded`) share their origin with a host app and
|
|
1114
|
+
* must namespace their mount path under `/.<id>/`. Standalone adapters
|
|
1115
|
+
* (`cli`, `spa`, `build`) own the origin and default to `/`.
|
|
1116
|
+
*/
|
|
1117
|
+
type DevtoolDeploymentKind = 'standalone' | 'hosted';
|
|
1118
|
+
interface DevtoolCliOptions {
|
|
1119
|
+
/** Binary name; default: the devtool's `id`. */
|
|
1120
|
+
command?: string;
|
|
1121
|
+
/** Preferred port for the dev server (default 9999). */
|
|
1122
|
+
port?: number;
|
|
1123
|
+
/** Port scan range, forwarded to `get-port-please`. */
|
|
1124
|
+
portRange?: [number, number];
|
|
1125
|
+
/** Prefer a random open port. */
|
|
1126
|
+
random?: boolean;
|
|
1127
|
+
/** Default host to bind to; `--host` overrides. */
|
|
1128
|
+
host?: string;
|
|
1129
|
+
/**
|
|
1130
|
+
* Auto-open the browser when the dev server starts.
|
|
1131
|
+
* `true` opens the resolved origin; a string opens that relative path.
|
|
1132
|
+
* The `--open` / `--no-open` flags override this.
|
|
1133
|
+
*/
|
|
1134
|
+
open?: boolean | string;
|
|
1135
|
+
/**
|
|
1136
|
+
* Skip the RPC trust handshake. Set to `false` for trusted
|
|
1137
|
+
* single-user localhost tools. Default `true`.
|
|
1138
|
+
*
|
|
1139
|
+
* Forwarded to `startHttpAndWs` as a no-op placeholder until devframe
|
|
1140
|
+
* ships its own auth layer; `@vitejs/devtools` honors the equivalent
|
|
1141
|
+
* `devtools.clientAuth` today.
|
|
1142
|
+
*/
|
|
1143
|
+
auth?: boolean;
|
|
1144
|
+
/** Author's SPA dist directory (served as the devtool's UI). */
|
|
1145
|
+
distDir?: string;
|
|
1146
|
+
/**
|
|
1147
|
+
* Capability-side CAC hook. Called with the CAC instance after the
|
|
1148
|
+
* adapter registers its built-in commands (`build` / `spa` / `mcp`)
|
|
1149
|
+
* but before `createCli`'s own `configureCli` caller. Use this to
|
|
1150
|
+
* contribute tool-specific flags and subcommands from the definition
|
|
1151
|
+
* itself.
|
|
1152
|
+
*/
|
|
1153
|
+
configure?: (cli: CAC) => void;
|
|
1154
|
+
/**
|
|
1155
|
+
* Typed CLI flags for the default `dev` command, backed by valibot
|
|
1156
|
+
* schemas. The adapter registers matching `--kebab-key` options on
|
|
1157
|
+
* CAC, validates the parsed values, and forwards the typed bag to
|
|
1158
|
+
* `setup(ctx, { flags })`.
|
|
1159
|
+
*
|
|
1160
|
+
* Use {@link defineCliFlags} to preserve the literal schema-map
|
|
1161
|
+
* shape, and {@link InferCliFlags} to recover the typed output at the
|
|
1162
|
+
* call site:
|
|
1163
|
+
*
|
|
1164
|
+
* ```ts
|
|
1165
|
+
* const appFlags = defineCliFlags({
|
|
1166
|
+
* depth: v.pipe(v.number(), v.integer()),
|
|
1167
|
+
* config: v.optional(v.string()),
|
|
1168
|
+
* })
|
|
1169
|
+
*
|
|
1170
|
+
* defineDevtool({
|
|
1171
|
+
* cli: { flags: appFlags },
|
|
1172
|
+
* setup(ctx, info) {
|
|
1173
|
+
* const flags = info.flags as InferCliFlags<typeof appFlags>
|
|
1174
|
+
* },
|
|
1175
|
+
* })
|
|
1176
|
+
* ```
|
|
1177
|
+
*/
|
|
1178
|
+
flags?: CliFlagsSchema;
|
|
1179
|
+
}
|
|
1180
|
+
interface DevtoolSpaOptions {
|
|
1181
|
+
base?: string;
|
|
1182
|
+
/**
|
|
1183
|
+
* How the deployed SPA loads its data.
|
|
1184
|
+
* - `'query'` — read from URL search params.
|
|
1185
|
+
* - `'upload'` — accept a file drag-drop.
|
|
1186
|
+
* - `'none'` — use the baked RPC dump only.
|
|
1187
|
+
*/
|
|
1188
|
+
loader?: 'query' | 'upload' | 'none';
|
|
1189
|
+
}
|
|
1190
|
+
interface DevtoolBrowserContext {
|
|
1191
|
+
/**
|
|
1192
|
+
* The connected RPC client (may be write-disabled in static/spa modes).
|
|
1193
|
+
*/
|
|
1194
|
+
rpc: unknown;
|
|
1195
|
+
}
|
|
1196
|
+
/**
|
|
1197
|
+
* Runtime information threaded into `setup(ctx, info)`. Adapters
|
|
1198
|
+
* populate the fields that make sense for their deployment. In
|
|
1199
|
+
* particular, `createCli` fills `flags` with the parsed CAC bag.
|
|
1200
|
+
*/
|
|
1201
|
+
interface DevtoolSetupInfo {
|
|
1202
|
+
/** Parsed CLI flags, populated by the CLI adapter. */
|
|
1203
|
+
flags?: Record<string, unknown>;
|
|
1204
|
+
}
|
|
1205
|
+
interface DevtoolDefinition {
|
|
1206
|
+
id: string;
|
|
1207
|
+
name: string;
|
|
1208
|
+
icon?: string | {
|
|
1209
|
+
light: string;
|
|
1210
|
+
dark: string;
|
|
1211
|
+
};
|
|
1212
|
+
version?: string;
|
|
1213
|
+
/**
|
|
1214
|
+
* Mount path override. Defaults depend on the adapter:
|
|
1215
|
+
* `/` for standalone (`cli` / `spa` / `build`), `/.<id>/` for hosted
|
|
1216
|
+
* (`vite` / `kit` / `embedded`).
|
|
1217
|
+
*/
|
|
1218
|
+
basePath?: string;
|
|
1219
|
+
capabilities?: {
|
|
1220
|
+
dev?: boolean | Record<string, boolean>;
|
|
1221
|
+
build?: boolean | Record<string, boolean>;
|
|
1222
|
+
spa?: boolean | Record<string, boolean>;
|
|
1223
|
+
};
|
|
1224
|
+
/** Server-side setup — the primary entrypoint. Runs in every runtime. */
|
|
1225
|
+
setup: (ctx: DevToolsNodeContext, info?: DevtoolSetupInfo) => void | Promise<void>;
|
|
1226
|
+
/** Browser-only setup for the SPA adapter (bundled into the client). */
|
|
1227
|
+
setupBrowser?: (ctx: DevtoolBrowserContext) => void | Promise<void>;
|
|
1228
|
+
cli?: DevtoolCliOptions;
|
|
1229
|
+
spa?: DevtoolSpaOptions;
|
|
1230
|
+
}
|
|
1231
|
+
declare function defineDevtool(d: DevtoolDefinition): DevtoolDefinition;
|
|
1232
|
+
//#endregion
|
|
1233
|
+
export { DevToolsLogsHost as $, EventsMap as $t, DevToolsViewHost as A, DevToolsDiagnosticsHost as At, DevToolsTerminalStatus as B, DevToolsServerCommandEntry as Bt, ImmutableSet as C, DevToolsViewLauncher as Ct, createSharedState as D, JsonRenderer as Dt, SharedStateOptions as E, JsonRenderSpec as Et, DevToolsChildProcessTerminalSession as F, DevToolsCommandHandle as Ft, DevToolsLogElementPosition as G, AgentResourceContent as Gt, DevToolsRpcClientFunctions as H, AgentHandle as Ht, DevToolsTerminalHost as I, DevToolsCommandKeybinding as It, DevToolsLogEntryInput as J, AgentToolInput as Jt, DevToolsLogEntry as K, AgentResourceInput as Kt, DevToolsTerminalSession as L, DevToolsCommandShortcutOverrides as Lt, PartialWithoutId as M, DevToolsClientCommand as Mt, Thenable as N, DevToolsCommandBase as Nt, Objectish as O, RemoteDockOptions as Ot, DevToolsChildProcessExecuteOptions as P, DevToolsCommandEntry as Pt, DevToolsLogsClient as Q, EventUnsubscribe as Qt, DevToolsTerminalSessionBase as R, DevToolsCommandsHost as Rt, ImmutableObject as S, DevToolsViewJsonRender as St, SharedStateEvents as T, JsonRenderElement as Tt, DevToolsRpcServerFunctions as U, AgentManifest as Ut, DevToolsDocksUserSettings as V, DevToolsServerCommandInput as Vt, DevToolsRpcSharedStates as W, AgentResource as Wt, DevToolsLogHandle as X, DevToolsAgentHostEvents as Xt, DevToolsLogFilePosition as Y, DevToolsAgentHost as Yt, DevToolsLogLevel as Z, EventEmitter as Zt, RpcSharedStateGetOptions as _, DevToolsDockUserEntry as _t, DevtoolRuntime as a, DevToolsMessageHandle as at, ImmutableArray as b, DevToolsViewCustomRender as bt, defineDevtool as c, DevToolsMessagesHost as ct, DevToolsNodeContext as d, DevToolsDockEntriesGrouped as dt, CliFlagsSchema as en, DevToolsMessageElementPosition as et, DevToolsNodeUtils as f, DevToolsDockEntry as ft, RpcFunctionsHost as g, DevToolsDockHost as gt, RpcBroadcastOptions as h, DevToolsDockEntryIcon as ht, DevtoolDeploymentKind as i, DevToolsMessageFilePosition as it, EntriesToObject as j, DevToolsDiagnosticsLogger as jt, Patch as k, DevToolsDiagnosticsDefinition as kt, ConnectionMeta as l, DevToolsHost as lt, DevToolsNodeRpcSession as m, DevToolsDockEntryCategory as mt, DevtoolCliOptions as n, defineCliFlags as nn, DevToolsMessageEntryFrom as nt, DevtoolSetupInfo as o, DevToolsMessageLevel as ot, RemoteConnectionInfo as p, DevToolsDockEntryBase as pt, DevToolsLogEntryFrom as q, AgentTool as qt, DevtoolDefinition as r, DevToolsMessageEntryInput as rt, DevtoolSpaOptions as s, DevToolsMessagesClient as st, DevtoolBrowserContext as t, InferCliFlags as tn, DevToolsMessageEntry as tt, DevToolsCapabilities as u, ClientScriptEntry as ut, RpcSharedStateHost as v, DevToolsViewAction as vt, SharedState as w, DevToolsViewLauncherStatus as wt, ImmutableMap as x, DevToolsViewIframe as xt, Immutable as y, DevToolsViewBuiltin as yt, DevToolsTerminalSessionStreamChunkEvent as z, DevToolsCommandsHostEvents as zt };
|