vite-plugin-opencode-assistant 1.1.24 → 1.1.26

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.
@@ -0,0 +1,519 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ const PAGE_ID_PROP = {
18
+ pageId: { type: "number", description: "\u76EE\u6807\u9875\u9762 ID\uFF08\u4ECE devtools_list_pages \u83B7\u53D6\uFF09" }
19
+ };
20
+ function withPageId(properties, required = []) {
21
+ return {
22
+ properties: __spreadValues(__spreadValues({}, PAGE_ID_PROP), properties),
23
+ required: ["pageId", ...required]
24
+ };
25
+ }
26
+ const CUSTOM_TOOLS = [
27
+ // ===== 页面管理 =====
28
+ {
29
+ name: "devtools_list_pages",
30
+ description: "\u83B7\u53D6\u5F53\u524D\u9879\u76EE\u6240\u6709\u6253\u5F00\u7684\u9875\u9762\u5217\u8868\uFF0C\u542B active\uFF08\u7528\u6237\u6B63\u5728\u6D4F\u89C8\uFF09\u548C selected\uFF08Chrome DevTools \u5F53\u524D\u64CD\u4F5C\u76EE\u6807\uFF09\u6807\u8BB0",
31
+ inputSchema: {
32
+ type: "object",
33
+ properties: {}
34
+ }
35
+ },
36
+ // ===== 截图与快照 =====
37
+ {
38
+ name: "devtools_snapshot",
39
+ description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u53EF\u8BBF\u95EE\u6027\u6811\u5FEB\u7167\uFF0C\u8FD4\u56DE\u5143\u7D20 uid\u3001\u89D2\u8272\u3001\u6587\u672C\u7B49",
40
+ inputSchema: __spreadValues({
41
+ type: "object"
42
+ }, withPageId({
43
+ verbose: { type: "boolean", description: "\u662F\u5426\u83B7\u53D6\u5B8C\u6574 a11y \u6811\u4FE1\u606F\uFF0C\u9ED8\u8BA4 false" },
44
+ filePath: { type: "string", description: "\u4FDD\u5B58\u5FEB\u7167\u7684\u6587\u4EF6\u8DEF\u5F84\uFF0C\u7701\u7565\u5219\u5185\u8054\u8FD4\u56DE" }
45
+ }))
46
+ },
47
+ {
48
+ name: "devtools_screenshot",
49
+ description: "\u622A\u53D6\u6307\u5B9A\u9875\u9762\u6216\u5143\u7D20\u5C4F\u5E55\u622A\u56FE\uFF0C\u8FD4\u56DE base64 \u6216\u4FDD\u5B58\u5230\u6587\u4EF6",
50
+ inputSchema: __spreadValues({
51
+ type: "object"
52
+ }, withPageId({
53
+ format: {
54
+ type: "string",
55
+ enum: ["png", "jpeg", "webp"],
56
+ description: "\u56FE\u7247\u683C\u5F0F\uFF0C\u9ED8\u8BA4 png"
57
+ },
58
+ quality: {
59
+ type: "number",
60
+ minimum: 0,
61
+ maximum: 100,
62
+ description: "JPEG/WebP \u538B\u7F29\u8D28\u91CF 0-100"
63
+ },
64
+ uid: { type: "string", description: "\u5143\u7D20 uid\uFF08\u4ECE devtools_snapshot \u83B7\u53D6\uFF09\uFF0C\u7701\u7565\u622A\u53D6\u6574\u9875" },
65
+ fullPage: { type: "boolean", description: "\u662F\u5426\u622A\u53D6\u5B8C\u6574\u9875\u9762\uFF08\u4E0E uid \u4E92\u65A5\uFF09" },
66
+ filePath: { type: "string", description: "\u4FDD\u5B58\u622A\u56FE\u7684\u6587\u4EF6\u8DEF\u5F84\uFF0C\u7701\u7565\u8FD4\u56DE base64" }
67
+ }))
68
+ },
69
+ // ===== 交互操作 =====
70
+ {
71
+ name: "devtools_click",
72
+ description: "\u70B9\u51FB\u9875\u9762\u5143\u7D20",
73
+ inputSchema: __spreadValues({
74
+ type: "object"
75
+ }, withPageId(
76
+ {
77
+ uid: { type: "string", description: "\u5143\u7D20 uid\uFF08\u4ECE devtools_snapshot \u83B7\u53D6\uFF09" },
78
+ dblClick: { type: "boolean", description: "\u662F\u5426\u53CC\u51FB\uFF0C\u9ED8\u8BA4 false" },
79
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
80
+ },
81
+ ["uid"]
82
+ ))
83
+ },
84
+ {
85
+ name: "devtools_hover",
86
+ description: "\u9F20\u6807\u60AC\u505C\u5728\u9875\u9762\u5143\u7D20\u4E0A",
87
+ inputSchema: __spreadValues({
88
+ type: "object"
89
+ }, withPageId(
90
+ {
91
+ uid: { type: "string", description: "\u5143\u7D20 uid" },
92
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
93
+ },
94
+ ["uid"]
95
+ ))
96
+ },
97
+ {
98
+ name: "devtools_drag",
99
+ description: "\u62D6\u62FD\u9875\u9762\u5143\u7D20\u5230\u53E6\u4E00\u4E2A\u5143\u7D20\u4E0A",
100
+ inputSchema: __spreadValues({
101
+ type: "object"
102
+ }, withPageId(
103
+ {
104
+ from_uid: { type: "string", description: "\u88AB\u62D6\u62FD\u5143\u7D20\u7684 uid" },
105
+ to_uid: { type: "string", description: "\u76EE\u6807\u653E\u7F6E\u5143\u7D20\u7684 uid" },
106
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
107
+ },
108
+ ["from_uid", "to_uid"]
109
+ ))
110
+ },
111
+ {
112
+ name: "devtools_type",
113
+ description: "\u5728\u5DF2\u805A\u7126\u7684\u8F93\u5165\u6846\u4E2D\u4F7F\u7528\u952E\u76D8\u8F93\u5165\u6587\u672C",
114
+ inputSchema: __spreadValues({
115
+ type: "object"
116
+ }, withPageId(
117
+ {
118
+ text: { type: "string", description: "\u8981\u8F93\u5165\u7684\u6587\u672C" },
119
+ submitKey: {
120
+ type: "string",
121
+ description: '\u8F93\u5165\u540E\u6309\u4E0B\u7684\u6309\u952E\uFF0C\u5982 "Enter"\u3001"Tab"\u3001"Escape"'
122
+ }
123
+ },
124
+ ["text"]
125
+ ))
126
+ },
127
+ {
128
+ name: "devtools_press_key",
129
+ description: "\u6309\u4E0B\u952E\u76D8\u6309\u952E\u6216\u7EC4\u5408\u952E\uFF08\u5FEB\u6377\u952E\u3001\u5BFC\u822A\u952E\u7B49\uFF09",
130
+ inputSchema: __spreadValues({
131
+ type: "object"
132
+ }, withPageId(
133
+ {
134
+ key: {
135
+ type: "string",
136
+ description: '\u6309\u952E\u6216\u7EC4\u5408\u952E\uFF0C\u5982 "Enter"\u3001"Control+A"\u3002\u4FEE\u9970\u952E: Control, Shift, Alt, Meta'
137
+ },
138
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
139
+ },
140
+ ["key"]
141
+ ))
142
+ },
143
+ {
144
+ name: "devtools_fill",
145
+ description: "\u586B\u5199\u8F93\u5165\u6846\u503C\u6216\u9009\u62E9 select \u9009\u9879\uFF0C\u89E6\u53D1 input/change \u4E8B\u4EF6",
146
+ inputSchema: __spreadValues({
147
+ type: "object"
148
+ }, withPageId(
149
+ {
150
+ uid: { type: "string", description: "\u8F93\u5165\u6846/select \u5143\u7D20 uid" },
151
+ value: {
152
+ type: "string",
153
+ description: '\u8981\u586B\u5165\u7684\u503C\u3002checkbox/toggle \u7528 "true"/"false"\uFF0Cradio \u7528 "true"'
154
+ },
155
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
156
+ },
157
+ ["uid", "value"]
158
+ ))
159
+ },
160
+ {
161
+ name: "devtools_fill_form",
162
+ description: "\u6279\u91CF\u586B\u5199\u8868\u5355\u5B57\u6BB5\uFF0C\u6BD4\u591A\u6B21\u8C03\u7528 fill/click \u66F4\u5FEB\u66F4\u53EF\u9760",
163
+ inputSchema: __spreadValues({
164
+ type: "object"
165
+ }, withPageId(
166
+ {
167
+ elements: {
168
+ type: "array",
169
+ items: {
170
+ type: "object",
171
+ properties: { uid: { type: "string" }, value: { type: "string" } }
172
+ },
173
+ description: "\u8868\u5355\u5143\u7D20\u6570\u7EC4 [{ uid, value }]"
174
+ },
175
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
176
+ },
177
+ ["elements"]
178
+ ))
179
+ },
180
+ // ===== 页面导航 =====
181
+ {
182
+ name: "devtools_navigate",
183
+ description: "\u5BFC\u822A\u9875\u9762\uFF08url/reload/back/forward\uFF09",
184
+ inputSchema: __spreadValues({
185
+ type: "object"
186
+ }, withPageId(
187
+ {
188
+ type: {
189
+ type: "string",
190
+ enum: ["url", "back", "forward", "reload"],
191
+ description: "\u5BFC\u822A\u7C7B\u578B"
192
+ },
193
+ url: { type: "string", description: "\u76EE\u6807 URL\uFF08type=url \u65F6\u5FC5\u586B\uFF09" },
194
+ ignoreCache: { type: "boolean", description: "reload \u65F6\u662F\u5426\u5FFD\u7565\u7F13\u5B58" },
195
+ handleBeforeUnload: {
196
+ type: "string",
197
+ enum: ["accept", "dismiss"],
198
+ description: "beforeunload \u5BF9\u8BDD\u6846\u5904\u7406\u65B9\u5F0F"
199
+ },
200
+ initScript: {
201
+ type: "string",
202
+ description: "\u4E0B\u4E00\u6B21\u5BFC\u822A\u65F6\uFF0C\u5728\u6BCF\u4E2A\u65B0 document \u52A0\u8F7D\u524D\u6267\u884C\u7684 JS \u811A\u672C"
203
+ },
204
+ timeout: { type: "integer", description: "\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C0 \u4F7F\u7528\u9ED8\u8BA4\u8D85\u65F6" }
205
+ },
206
+ ["type"]
207
+ ))
208
+ },
209
+ {
210
+ name: "devtools_resize_page",
211
+ description: "\u8C03\u6574\u9875\u9762\u89C6\u53E3\u5927\u5C0F",
212
+ inputSchema: __spreadValues({
213
+ type: "object"
214
+ }, withPageId(
215
+ {
216
+ width: { type: "number", description: "\u89C6\u53E3\u5BBD\u5EA6" },
217
+ height: { type: "number", description: "\u89C6\u53E3\u9AD8\u5EA6" }
218
+ },
219
+ ["width", "height"]
220
+ ))
221
+ },
222
+ {
223
+ name: "devtools_emulate",
224
+ description: "\u6A21\u62DF\u8BBE\u5907\u7279\u6027\uFF08\u7F51\u7EDC\u8282\u6D41\u3001CPU \u964D\u901F\u3001\u5730\u7406\u4F4D\u7F6E\u3001UA\u3001\u989C\u8272\u65B9\u6848\u3001\u89C6\u53E3\u7B49\uFF09",
225
+ inputSchema: __spreadValues({
226
+ type: "object"
227
+ }, withPageId({
228
+ networkConditions: {
229
+ type: "string",
230
+ enum: ["Offline", "Slow 3G", "Fast 3G", "Slow 4G", "Fast 4G"],
231
+ description: "\u7F51\u7EDC\u8282\u6D41\u6A21\u5F0F"
232
+ },
233
+ cpuThrottlingRate: {
234
+ type: "number",
235
+ minimum: 1,
236
+ maximum: 20,
237
+ description: "CPU \u964D\u901F\u500D\u6570\uFF0C1 \u4E0D\u964D\u901F"
238
+ },
239
+ geolocation: { type: "string", description: "\u5730\u7406\u4F4D\u7F6E\uFF0C\u683C\u5F0F `<\u7EAC\u5EA6>,<\u7ECF\u5EA6>`" },
240
+ userAgent: { type: "string", description: "UA \u5B57\u7B26\u4E32\uFF0C\u7A7A\u5B57\u7B26\u4E32\u6E05\u9664" },
241
+ colorScheme: {
242
+ type: "string",
243
+ enum: ["dark", "light", "auto"],
244
+ description: '\u989C\u8272\u65B9\u6848\uFF0C"auto" \u6062\u590D\u9ED8\u8BA4'
245
+ },
246
+ viewport: {
247
+ type: "string",
248
+ description: "\u89C6\u53E3\u6A21\u62DF\uFF0C\u683C\u5F0F `<\u5BBD>x<\u9AD8>x<\u7F29\u653E\u6BD4>[,mobile][,touch][,landscape]`"
249
+ },
250
+ extraHttpHeaders: {
251
+ type: "string",
252
+ description: `\u989D\u5916 HTTP \u8BF7\u6C42\u5934 JSON\uFF0C\u5982 '{"X-Custom":"value"}'`
253
+ }
254
+ }))
255
+ },
256
+ // ===== JS 执行 =====
257
+ {
258
+ name: "devtools_evaluate",
259
+ description: "\u5728\u6307\u5B9A\u9875\u9762\u6267\u884C JavaScript \u51FD\u6570\u5E76\u8FD4\u56DE\u7ED3\u679C\uFF08\u8FD4\u56DE\u503C\u9700\u53EF JSON \u5E8F\u5217\u5316\uFF09",
260
+ inputSchema: __spreadValues({
261
+ type: "object"
262
+ }, withPageId(
263
+ {
264
+ function: {
265
+ type: "string",
266
+ description: "JS \u51FD\u6570\u58F0\u660E\u3002\u65E0\u53C2\u6570: `() => document.title`\uFF0C\u6709\u53C2\u6570: `(el) => el.innerText`"
267
+ },
268
+ args: {
269
+ type: "array",
270
+ items: { type: "string" },
271
+ description: "\u4F20\u7ED9\u51FD\u6570\u7684\u53C2\u6570\u5217\u8868\uFF08\u5143\u7D20 uid\uFF09"
272
+ },
273
+ filePath: { type: "string", description: "\u4FDD\u5B58\u8F93\u51FA\u5230\u6587\u4EF6\uFF0C\u7701\u7565\u5219\u5185\u8054\u8FD4\u56DE" },
274
+ dialogAction: {
275
+ type: "string",
276
+ description: '\u5BF9\u8BDD\u6846\u5904\u7406: "accept"\u3001"dismiss" \u6216 prompt \u6587\u672C'
277
+ }
278
+ },
279
+ ["function"]
280
+ ))
281
+ },
282
+ // ===== 网络监控 =====
283
+ {
284
+ name: "devtools_network",
285
+ description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u7F51\u7EDC\u8BF7\u6C42\u5217\u8868\uFF08\u652F\u6301\u5206\u9875\u548C\u8FC7\u6EE4\uFF09",
286
+ inputSchema: __spreadValues({
287
+ type: "object"
288
+ }, withPageId({
289
+ pageSize: { type: "integer", description: "\u6BCF\u9875\u6700\u5927\u8BF7\u6C42\u6570" },
290
+ pageIdx: { type: "integer", minimum: 0, description: "\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09" },
291
+ resourceTypes: {
292
+ type: "array",
293
+ items: {
294
+ type: "string",
295
+ enum: [
296
+ "document",
297
+ "stylesheet",
298
+ "image",
299
+ "media",
300
+ "font",
301
+ "script",
302
+ "xhr",
303
+ "fetch",
304
+ "websocket",
305
+ "manifest",
306
+ "other"
307
+ ]
308
+ },
309
+ description: "\u6309\u8D44\u6E90\u7C7B\u578B\u8FC7\u6EE4"
310
+ },
311
+ includePreservedRequests: {
312
+ type: "boolean",
313
+ description: "\u662F\u5426\u8FD4\u56DE\u6700\u8FD1 3 \u6B21\u5BFC\u822A\u7684\u4FDD\u7559\u8BF7\u6C42"
314
+ }
315
+ }))
316
+ },
317
+ {
318
+ name: "devtools_network_request",
319
+ description: "\u83B7\u53D6\u7F51\u7EDC\u8BF7\u6C42\u7684\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u53EF\u4FDD\u5B58\u8BF7\u6C42/\u54CD\u5E94\u4F53\u5230\u6587\u4EF6",
320
+ inputSchema: __spreadValues({
321
+ type: "object"
322
+ }, withPageId({
323
+ reqid: {
324
+ type: "number",
325
+ description: "\u8BF7\u6C42 ID\uFF08\u4ECE devtools_network \u83B7\u53D6\uFF09\uFF0C\u7701\u7565\u8FD4\u56DE\u5F53\u524D\u9009\u4E2D\u8BF7\u6C42"
326
+ },
327
+ requestFilePath: {
328
+ type: "string",
329
+ description: "\u4FDD\u5B58\u8BF7\u6C42\u4F53\u5230 .network-request \u6587\u4EF6\u7684\u8DEF\u5F84"
330
+ },
331
+ responseFilePath: {
332
+ type: "string",
333
+ description: "\u4FDD\u5B58\u54CD\u5E94\u4F53\u5230 .network-response \u6587\u4EF6\u7684\u8DEF\u5F84"
334
+ }
335
+ }))
336
+ },
337
+ // ===== 控制台 =====
338
+ {
339
+ name: "devtools_console",
340
+ description: "\u83B7\u53D6\u6307\u5B9A\u9875\u9762\u63A7\u5236\u53F0\u6D88\u606F\uFF08\u652F\u6301\u5206\u9875\u548C\u8FC7\u6EE4\uFF09",
341
+ inputSchema: __spreadValues({
342
+ type: "object"
343
+ }, withPageId({
344
+ pageSize: { type: "integer", description: "\u6BCF\u9875\u6700\u5927\u6D88\u606F\u6570" },
345
+ pageIdx: { type: "integer", minimum: 0, description: "\u9875\u7801\uFF08\u4ECE 0 \u5F00\u59CB\uFF09" },
346
+ types: {
347
+ type: "array",
348
+ items: {
349
+ type: "string",
350
+ enum: ["log", "debug", "info", "error", "warn", "trace", "verbose", "issue"]
351
+ },
352
+ description: "\u6309\u6D88\u606F\u7C7B\u578B\u8FC7\u6EE4"
353
+ },
354
+ includePreservedMessages: {
355
+ type: "boolean",
356
+ description: "\u662F\u5426\u8FD4\u56DE\u6700\u8FD1 3 \u6B21\u5BFC\u822A\u7684\u4FDD\u7559\u6D88\u606F"
357
+ },
358
+ serviceWorkerId: { type: "string", description: "\u6309 service worker ID \u8FC7\u6EE4" }
359
+ }))
360
+ },
361
+ {
362
+ name: "devtools_console_message",
363
+ description: "\u83B7\u53D6\u67D0\u6761\u63A7\u5236\u53F0\u6D88\u606F\u7684\u8BE6\u7EC6\u4FE1\u606F",
364
+ inputSchema: __spreadValues({
365
+ type: "object"
366
+ }, withPageId(
367
+ {
368
+ msgid: { type: "number", description: "\u6D88\u606F ID\uFF08\u4ECE devtools_console \u83B7\u53D6\uFF09" }
369
+ },
370
+ ["msgid"]
371
+ ))
372
+ },
373
+ // ===== 其他 =====
374
+ {
375
+ name: "devtools_wait_for",
376
+ description: "\u7B49\u5F85\u6307\u5B9A\u9875\u9762\u51FA\u73B0\u6307\u5B9A\u6587\u672C\uFF08\u4EFB\u4E00\u5339\u914D\u5373\u8FD4\u56DE\uFF09",
377
+ inputSchema: __spreadValues({
378
+ type: "object"
379
+ }, withPageId(
380
+ {
381
+ text: {
382
+ type: "array",
383
+ items: { type: "string" },
384
+ minItems: 1,
385
+ description: "\u7B49\u5F85\u51FA\u73B0\u7684\u6587\u672C\u5217\u8868"
386
+ },
387
+ timeout: { type: "integer", description: "\u6700\u5927\u7B49\u5F85\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C0 \u4F7F\u7528\u9ED8\u8BA4\u8D85\u65F6" }
388
+ },
389
+ ["text"]
390
+ ))
391
+ },
392
+ {
393
+ name: "devtools_handle_dialog",
394
+ description: "\u5904\u7406 JavaScript \u5BF9\u8BDD\u6846\uFF08alert/confirm/prompt\uFF09",
395
+ inputSchema: __spreadValues({
396
+ type: "object"
397
+ }, withPageId(
398
+ {
399
+ action: { type: "string", enum: ["accept", "dismiss"], description: "\u63A5\u53D7\u6216\u5173\u95ED\u5BF9\u8BDD\u6846" },
400
+ promptText: { type: "string", description: "prompt \u5BF9\u8BDD\u6846\u7684\u8F93\u5165\u6587\u672C" }
401
+ },
402
+ ["action"]
403
+ ))
404
+ },
405
+ {
406
+ name: "devtools_upload_file",
407
+ description: "\u4E0A\u4F20\u6587\u4EF6\u5230\u6587\u4EF6\u8F93\u5165\u6846",
408
+ inputSchema: __spreadValues({
409
+ type: "object"
410
+ }, withPageId(
411
+ {
412
+ uid: { type: "string", description: "\u6587\u4EF6\u8F93\u5165\u6846\u5143\u7D20 uid" },
413
+ filePath: { type: "string", description: "\u672C\u5730\u6587\u4EF6\u8DEF\u5F84" },
414
+ includeSnapshot: { type: "boolean", description: "\u662F\u5426\u5728\u54CD\u5E94\u4E2D\u5305\u542B\u5FEB\u7167\uFF0C\u9ED8\u8BA4 false" }
415
+ },
416
+ ["uid", "filePath"]
417
+ ))
418
+ },
419
+ // ===== 性能分析 =====
420
+ {
421
+ name: "devtools_performance_start",
422
+ description: "\u5728\u6307\u5B9A\u9875\u9762\u5F00\u59CB\u8BB0\u5F55\u6027\u80FD trace\uFF08\u7528\u4E8E\u53D1\u73B0 Core Web Vitals \u6027\u80FD\u95EE\u9898\uFF09",
423
+ inputSchema: __spreadValues({
424
+ type: "object"
425
+ }, withPageId({
426
+ reload: { type: "boolean", description: "\u5F00\u59CB\u540E\u662F\u5426\u81EA\u52A8\u5237\u65B0\u9875\u9762\uFF0C\u9ED8\u8BA4 true" },
427
+ autoStop: { type: "boolean", description: "\u662F\u5426\u81EA\u52A8\u505C\u6B62\u5F55\u5236\uFF0C\u9ED8\u8BA4 true" },
428
+ filePath: { type: "string", description: "\u4FDD\u5B58\u539F\u59CB trace \u6570\u636E\u7684\u8DEF\u5F84\uFF0C\u5982 trace.json.gz" }
429
+ }))
430
+ },
431
+ {
432
+ name: "devtools_performance_stop",
433
+ description: "\u505C\u6B62\u6027\u80FD trace \u8BB0\u5F55\u5E76\u8FD4\u56DE\u7ED3\u679C",
434
+ inputSchema: __spreadValues({
435
+ type: "object"
436
+ }, withPageId({
437
+ filePath: { type: "string", description: "\u4FDD\u5B58\u539F\u59CB trace \u6570\u636E\u7684\u8DEF\u5F84\uFF0C\u5982 trace.json.gz" }
438
+ }))
439
+ },
440
+ {
441
+ name: "devtools_performance_insight",
442
+ description: "\u83B7\u53D6\u7279\u5B9A\u6027\u80FD\u6307\u6807\u7684\u8BE6\u7EC6\u5206\u6790",
443
+ inputSchema: __spreadValues({
444
+ type: "object"
445
+ }, withPageId(
446
+ {
447
+ insightSetId: { type: "string", description: "\u6307\u6807\u96C6 ID\uFF08\u4ECE trace \u7ED3\u679C\u83B7\u53D6\uFF09" },
448
+ insightName: {
449
+ type: "string",
450
+ description: '\u6307\u6807\u540D\u79F0\uFF0C\u5982 "DocumentLatency"\u3001"LCPBreakdown"'
451
+ }
452
+ },
453
+ ["insightSetId", "insightName"]
454
+ ))
455
+ },
456
+ {
457
+ name: "devtools_lighthouse",
458
+ description: "\u5BF9\u6307\u5B9A\u9875\u9762\u8FD0\u884C Lighthouse \u5BA1\u8BA1\uFF08\u53EF\u8BBF\u95EE\u6027/SEO/\u6700\u4F73\u5B9E\u8DF5\uFF0C\u4E0D\u542B\u6027\u80FD\uFF09",
459
+ inputSchema: __spreadValues({
460
+ type: "object"
461
+ }, withPageId({
462
+ mode: {
463
+ type: "string",
464
+ enum: ["navigation", "snapshot"],
465
+ description: "navigation \u5237\u65B0\u5BA1\u8BA1\uFF0Csnapshot \u5206\u6790\u5F53\u524D\u72B6\u6001"
466
+ },
467
+ device: {
468
+ type: "string",
469
+ enum: ["desktop", "mobile"],
470
+ description: "\u6A21\u62DF\u8BBE\u5907\u7C7B\u578B\uFF0C\u9ED8\u8BA4 desktop"
471
+ },
472
+ outputDirPath: { type: "string", description: "\u62A5\u544A\u8F93\u51FA\u76EE\u5F55\uFF0C\u7701\u7565\u4F7F\u7528\u4E34\u65F6\u6587\u4EF6" }
473
+ }))
474
+ },
475
+ {
476
+ name: "devtools_heapsnapshot",
477
+ description: "\u6355\u83B7\u6307\u5B9A\u9875\u9762\u5806\u5185\u5B58\u5FEB\u7167\uFF0C\u7528\u4E8E\u5206\u6790 JS \u5BF9\u8C61\u5185\u5B58\u5206\u5E03\u548C\u8C03\u8BD5\u5185\u5B58\u6CC4\u6F0F",
478
+ inputSchema: __spreadValues({
479
+ type: "object"
480
+ }, withPageId(
481
+ {
482
+ filePath: { type: "string", description: "\u4FDD\u5B58 .heapsnapshot \u6587\u4EF6\u7684\u8DEF\u5F84" }
483
+ },
484
+ ["filePath"]
485
+ ))
486
+ }
487
+ ];
488
+ const TOOL_MAP = {
489
+ devtools_list_pages: "list_pages",
490
+ devtools_snapshot: "take_snapshot",
491
+ devtools_screenshot: "take_screenshot",
492
+ devtools_evaluate: "evaluate_script",
493
+ devtools_click: "click",
494
+ devtools_hover: "hover",
495
+ devtools_drag: "drag",
496
+ devtools_type: "type_text",
497
+ devtools_press_key: "press_key",
498
+ devtools_fill: "fill",
499
+ devtools_fill_form: "fill_form",
500
+ devtools_navigate: "navigate_page",
501
+ devtools_resize_page: "resize_page",
502
+ devtools_emulate: "emulate",
503
+ devtools_network: "list_network_requests",
504
+ devtools_network_request: "get_network_request",
505
+ devtools_console: "list_console_messages",
506
+ devtools_console_message: "get_console_message",
507
+ devtools_wait_for: "wait_for",
508
+ devtools_handle_dialog: "handle_dialog",
509
+ devtools_upload_file: "upload_file",
510
+ devtools_performance_start: "performance_start_trace",
511
+ devtools_performance_stop: "performance_stop_trace",
512
+ devtools_performance_insight: "performance_analyze_insight",
513
+ devtools_lighthouse: "lighthouse_audit",
514
+ devtools_heapsnapshot: "take_heapsnapshot"
515
+ };
516
+ export {
517
+ CUSTOM_TOOLS,
518
+ TOOL_MAP
519
+ };
@@ -0,0 +1,6 @@
1
+ import type { ViteDevServer } from "vite";
2
+ import type { PageContext } from "@vite-plugin-opencode-assistant/shared";
3
+ import { MCP_API_PATH } from "@vite-plugin-opencode-assistant/shared";
4
+ import { McpProxy } from "../core/mcp-proxy";
5
+ export { MCP_API_PATH };
6
+ export declare function setupMcpEndpoint(server: ViteDevServer, mcp: McpProxy, getPageContext: () => PageContext): void;