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