vite-plugin-opencode-assistant 1.1.25 → 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.
@@ -1,15 +1,30 @@
1
- const CUSTOM_TOOLS = [
2
- {
3
- name: "devtools_select_page",
4
- description: "\u9009\u62E9\u5F53\u524D\u9879\u76EE\u4E2D\u7684\u67D0\u4E2A\u9875\u9762\u4F5C\u4E3A\u540E\u7EED\u5DE5\u5177\u64CD\u4F5C\u7684\u76EE\u6807",
5
- inputSchema: {
6
- type: "object",
7
- properties: {
8
- pageId: { type: "number", description: "\u9875\u9762 ID\uFF08\u4ECE devtools_list_pages \u83B7\u53D6\uFF09" }
9
- },
10
- required: ["pageId"]
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]);
11
14
  }
12
- },
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
+ // ===== 页面管理 =====
13
28
  {
14
29
  name: "devtools_list_pages",
15
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",
@@ -18,280 +33,459 @@ const CUSTOM_TOOLS = [
18
33
  properties: {}
19
34
  }
20
35
  },
36
+ // ===== 截图与快照 =====
21
37
  {
22
38
  name: "devtools_snapshot",
23
- description: "\u83B7\u53D6\u5F53\u524D\u9875\u9762\u53EF\u8BBF\u95EE\u6027\u6811\u5FEB\u7167\uFF0C\u8FD4\u56DE\u5143\u7D20 uid\u3001\u89D2\u8272\u3001\u6587\u672C\u7B49",
24
- inputSchema: {
25
- type: "object",
26
- properties: {
27
- verbose: { type: "boolean", description: "\u662F\u5426\u83B7\u53D6\u5B8C\u6574\u8282\u70B9\u4FE1\u606F" }
28
- }
29
- }
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
+ }))
30
46
  },
31
47
  {
32
48
  name: "devtools_screenshot",
33
- description: "\u622A\u53D6\u5F53\u524D\u9875\u9762\u5C4F\u5E55\u622A\u56FE\uFF0C\u8FD4\u56DE base64 \u56FE\u7247\u6570\u636E",
34
- inputSchema: {
35
- type: "object",
36
- properties: {
37
- format: { type: "string", description: "\u56FE\u7247\u683C\u5F0F: png \u6216 jpeg" },
38
- quality: { type: "number", description: "jpeg \u8D28\u91CF 0-100" },
39
- fullPage: { type: "boolean", description: "\u662F\u5426\u622A\u53D6\u5B8C\u6574\u9875\u9762" }
40
- }
41
- }
42
- },
43
- {
44
- name: "devtools_evaluate",
45
- description: "\u5728\u5F53\u524D\u9875\u9762\u6267\u884C JavaScript \u4EE3\u7801\u5E76\u8FD4\u56DE\u7ED3\u679C\uFF08\u8FD4\u56DE\u503C\u9700\u53EF JSON \u5E8F\u5217\u5316\uFF09",
46
- inputSchema: {
47
- type: "object",
48
- properties: {
49
- function: { type: "string", description: "JS \u51FD\u6570\u58F0\u660E\uFF0C\u5982 () => document.title" }
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"
50
57
  },
51
- required: ["function"]
52
- }
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
+ }))
53
68
  },
69
+ // ===== 交互操作 =====
54
70
  {
55
71
  name: "devtools_click",
56
72
  description: "\u70B9\u51FB\u9875\u9762\u5143\u7D20",
57
- inputSchema: {
58
- type: "object",
59
- properties: {
73
+ inputSchema: __spreadValues({
74
+ type: "object"
75
+ }, withPageId(
76
+ {
60
77
  uid: { type: "string", description: "\u5143\u7D20 uid\uFF08\u4ECE devtools_snapshot \u83B7\u53D6\uFF09" },
61
- dblClick: { type: "boolean", description: "\u662F\u5426\u53CC\u51FB" }
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" }
62
80
  },
63
- required: ["uid"]
64
- }
81
+ ["uid"]
82
+ ))
65
83
  },
66
84
  {
67
85
  name: "devtools_hover",
68
86
  description: "\u9F20\u6807\u60AC\u505C\u5728\u9875\u9762\u5143\u7D20\u4E0A",
69
- inputSchema: {
70
- type: "object",
71
- properties: {
72
- uid: { type: "string", description: "\u5143\u7D20 uid" }
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" }
73
93
  },
74
- required: ["uid"]
75
- }
94
+ ["uid"]
95
+ ))
76
96
  },
77
97
  {
78
98
  name: "devtools_drag",
79
- description: "\u62D6\u62FD\u9875\u9762\u5143\u7D20",
80
- inputSchema: {
81
- type: "object",
82
- properties: {
83
- uid: { type: "string", description: "\u6E90\u5143\u7D20 uid" },
84
- targetUid: { type: "string", description: "\u76EE\u6807\u5143\u7D20 uid" }
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" }
85
107
  },
86
- required: ["uid", "targetUid"]
87
- }
108
+ ["from_uid", "to_uid"]
109
+ ))
88
110
  },
89
111
  {
90
112
  name: "devtools_type",
91
- description: "\u5728\u805A\u7126\u5143\u7D20\u4E2D\u8F93\u5165\u6587\u672C",
92
- inputSchema: {
93
- type: "object",
94
- properties: {
95
- text: { type: "string", description: "\u8981\u8F93\u5165\u7684\u6587\u672C" }
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
+ }
96
123
  },
97
- required: ["text"]
98
- }
124
+ ["text"]
125
+ ))
99
126
  },
100
127
  {
101
128
  name: "devtools_press_key",
102
- description: "\u6309\u4E0B\u952E\u76D8\u6309\u952E",
103
- inputSchema: {
104
- type: "object",
105
- properties: {
106
- key: { type: "string", description: "\u6309\u952E\u540D\u79F0\uFF0C\u5982 Enter\u3001Control+A" }
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" }
107
139
  },
108
- required: ["key"]
109
- }
140
+ ["key"]
141
+ ))
110
142
  },
111
143
  {
112
144
  name: "devtools_fill",
113
- description: "\u586B\u5199\u8F93\u5165\u6846\u503C\u5E76\u89E6\u53D1 input/change \u4E8B\u4EF6",
114
- inputSchema: {
115
- type: "object",
116
- properties: {
117
- uid: { type: "string", description: "\u8F93\u5165\u6846\u5143\u7D20 uid" },
118
- value: { type: "string", description: "\u8981\u586B\u5165\u7684\u503C" }
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" }
119
156
  },
120
- required: ["uid", "value"]
121
- }
157
+ ["uid", "value"]
158
+ ))
122
159
  },
123
160
  {
124
161
  name: "devtools_fill_form",
125
- description: "\u6279\u91CF\u586B\u5199\u8868\u5355\u5B57\u6BB5",
126
- inputSchema: {
127
- type: "object",
128
- properties: {
129
- fields: {
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: {
130
168
  type: "array",
131
169
  items: {
132
170
  type: "object",
133
171
  properties: { uid: { type: "string" }, value: { type: "string" } }
134
172
  },
135
- description: "\u5B57\u6BB5\u6570\u7EC4 [{ uid, value }]"
136
- }
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" }
137
176
  },
138
- required: ["fields"]
139
- }
177
+ ["elements"]
178
+ ))
140
179
  },
180
+ // ===== 页面导航 =====
141
181
  {
142
182
  name: "devtools_navigate",
143
183
  description: "\u5BFC\u822A\u9875\u9762\uFF08url/reload/back/forward\uFF09",
144
- inputSchema: {
145
- type: "object",
146
- properties: {
147
- type: { type: "string", description: "url | reload | back | forward" },
148
- url: { type: "string", description: "\u76EE\u6807 URL\uFF08type=url \u65F6\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" }
149
205
  },
150
- required: ["type"]
151
- }
206
+ ["type"]
207
+ ))
152
208
  },
153
209
  {
154
210
  name: "devtools_resize_page",
155
211
  description: "\u8C03\u6574\u9875\u9762\u89C6\u53E3\u5927\u5C0F",
156
- inputSchema: {
157
- type: "object",
158
- properties: {
212
+ inputSchema: __spreadValues({
213
+ type: "object"
214
+ }, withPageId(
215
+ {
159
216
  width: { type: "number", description: "\u89C6\u53E3\u5BBD\u5EA6" },
160
217
  height: { type: "number", description: "\u89C6\u53E3\u9AD8\u5EA6" }
161
218
  },
162
- required: ["width", "height"]
163
- }
219
+ ["width", "height"]
220
+ ))
164
221
  },
165
222
  {
166
223
  name: "devtools_emulate",
167
- description: "\u6A21\u62DF\u79FB\u52A8\u8BBE\u5907",
168
- inputSchema: {
169
- type: "object",
170
- properties: {
171
- device: { type: "string", description: "\u8BBE\u5907\u540D\u79F0\uFF0C\u5982 iPhone 15" }
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"
172
232
  },
173
- required: ["device"]
174
- }
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
+ ))
175
281
  },
282
+ // ===== 网络监控 =====
176
283
  {
177
284
  name: "devtools_network",
178
- description: "\u83B7\u53D6\u5F53\u524D\u9875\u9762\u7F51\u7EDC\u8BF7\u6C42\u5217\u8868",
179
- inputSchema: { type: "object", properties: {} }
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
+ }))
180
316
  },
181
317
  {
182
318
  name: "devtools_network_request",
183
- description: "\u83B7\u53D6\u67D0\u6761\u7F51\u7EDC\u8BF7\u6C42\u7684\u8BE6\u7EC6\u4FE1\u606F",
184
- inputSchema: {
185
- type: "object",
186
- properties: {
187
- reqid: { type: "number", description: "\u8BF7\u6C42 ID\uFF08\u4ECE devtools_network \u83B7\u53D6\uFF09" }
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"
188
326
  },
189
- required: ["reqid"]
190
- }
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
+ }))
191
336
  },
337
+ // ===== 控制台 =====
192
338
  {
193
339
  name: "devtools_console",
194
- description: "\u83B7\u53D6\u5F53\u524D\u9875\u9762\u63A7\u5236\u53F0\u6D88\u606F",
195
- inputSchema: { type: "object", properties: {} }
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
+ }))
196
360
  },
197
361
  {
198
362
  name: "devtools_console_message",
199
363
  description: "\u83B7\u53D6\u67D0\u6761\u63A7\u5236\u53F0\u6D88\u606F\u7684\u8BE6\u7EC6\u4FE1\u606F",
200
- inputSchema: {
201
- type: "object",
202
- properties: {
364
+ inputSchema: __spreadValues({
365
+ type: "object"
366
+ }, withPageId(
367
+ {
203
368
  msgid: { type: "number", description: "\u6D88\u606F ID\uFF08\u4ECE devtools_console \u83B7\u53D6\uFF09" }
204
369
  },
205
- required: ["msgid"]
206
- }
370
+ ["msgid"]
371
+ ))
207
372
  },
373
+ // ===== 其他 =====
208
374
  {
209
375
  name: "devtools_wait_for",
210
- description: "\u7B49\u5F85\u9875\u9762\u51FA\u73B0\u6307\u5B9A\u6587\u672C",
211
- inputSchema: {
212
- type: "object",
213
- properties: {
214
- text: { type: "string", description: "\u7B49\u5F85\u51FA\u73B0\u7684\u6587\u672C" }
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" }
215
388
  },
216
- required: ["text"]
217
- }
389
+ ["text"]
390
+ ))
218
391
  },
219
392
  {
220
393
  name: "devtools_handle_dialog",
221
- description: "\u5904\u7406 JavaScript \u5BF9\u8BDD\u6846\uFF08accept/dismiss/\u8F93\u5165\u6587\u672C\uFF09",
222
- inputSchema: {
223
- type: "object",
224
- properties: {
225
- action: { type: "string", description: "accept | dismiss | prompt \u8F93\u5165\u6587\u672C" }
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" }
226
401
  },
227
- required: ["action"]
228
- }
402
+ ["action"]
403
+ ))
229
404
  },
230
405
  {
231
406
  name: "devtools_upload_file",
232
407
  description: "\u4E0A\u4F20\u6587\u4EF6\u5230\u6587\u4EF6\u8F93\u5165\u6846",
233
- inputSchema: {
234
- type: "object",
235
- properties: {
408
+ inputSchema: __spreadValues({
409
+ type: "object"
410
+ }, withPageId(
411
+ {
236
412
  uid: { type: "string", description: "\u6587\u4EF6\u8F93\u5165\u6846\u5143\u7D20 uid" },
237
- filePath: { type: "string", description: "\u6587\u4EF6\u7EDD\u5BF9\u8DEF\u5F84" }
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" }
238
415
  },
239
- required: ["uid", "filePath"]
240
- }
416
+ ["uid", "filePath"]
417
+ ))
241
418
  },
419
+ // ===== 性能分析 =====
242
420
  {
243
421
  name: "devtools_performance_start",
244
- description: "\u5F00\u59CB\u8BB0\u5F55\u6027\u80FD trace",
245
- inputSchema: {
246
- type: "object",
247
- properties: {
248
- reload: { type: "boolean", description: "\u662F\u5426\u81EA\u52A8\u5237\u65B0" },
249
- autoStop: { type: "boolean", description: "\u662F\u5426\u81EA\u52A8\u505C\u6B62" }
250
- }
251
- }
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
+ }))
252
430
  },
253
431
  {
254
432
  name: "devtools_performance_stop",
255
433
  description: "\u505C\u6B62\u6027\u80FD trace \u8BB0\u5F55\u5E76\u8FD4\u56DE\u7ED3\u679C",
256
- inputSchema: { type: "object", properties: {} }
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
+ }))
257
439
  },
258
440
  {
259
441
  name: "devtools_performance_insight",
260
- description: "\u83B7\u53D6\u6027\u80FD\u6307\u6807\u8BE6\u7EC6\u5206\u6790",
261
- inputSchema: {
262
- type: "object",
263
- properties: {
264
- insightSetId: { type: "string", description: "\u6307\u6807\u96C6 ID" },
265
- insightName: { type: "string", description: "\u6307\u6807\u540D\u79F0" }
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
+ }
266
452
  },
267
- required: ["insightSetId", "insightName"]
268
- }
453
+ ["insightSetId", "insightName"]
454
+ ))
269
455
  },
270
456
  {
271
457
  name: "devtools_lighthouse",
272
- description: "\u8FD0\u884C Lighthouse \u5BA1\u8BA1\uFF08\u53EF\u8BBF\u95EE\u6027/SEO/\u6700\u4F73\u5B9E\u8DF5\uFF0C\u4E0D\u542B\u6027\u80FD\uFF09",
273
- inputSchema: {
274
- type: "object",
275
- properties: {
276
- mode: { type: "string", description: "navigation \u6216 snapshot" },
277
- device: { type: "string", description: "desktop \u6216 mobile" }
278
- }
279
- }
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
+ }))
280
474
  },
281
475
  {
282
476
  name: "devtools_heapsnapshot",
283
- description: "\u6355\u83B7\u5806\u5185\u5B58\u5FEB\u7167",
284
- inputSchema: {
285
- type: "object",
286
- properties: {
287
- filePath: { type: "string", description: "\u4FDD\u5B58\u8DEF\u5F84" }
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" }
288
483
  },
289
- required: ["filePath"]
290
- }
484
+ ["filePath"]
485
+ ))
291
486
  }
292
487
  ];
293
488
  const TOOL_MAP = {
294
- devtools_select_page: "select_page",
295
489
  devtools_list_pages: "list_pages",
296
490
  devtools_snapshot: "take_snapshot",
297
491
  devtools_screenshot: "take_screenshot",