@attson/atwebpilot-mcp 0.0.29 → 0.0.31
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/dist/index.js +235 -51
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -638,6 +638,29 @@ function capabilityForTool(tool, opts) {
|
|
|
638
638
|
return opts?.httpCookied ? "httpRequest:cookied" : "httpRequest:no-cookie";
|
|
639
639
|
case "askUser":
|
|
640
640
|
return "read:dom";
|
|
641
|
+
case "screenshot":
|
|
642
|
+
return "read:image";
|
|
643
|
+
// Round 5 — meta / UI helpers
|
|
644
|
+
case "closeTab":
|
|
645
|
+
case "switchToTab":
|
|
646
|
+
return "tab:open";
|
|
647
|
+
case "searchBookmarks":
|
|
648
|
+
case "searchHistory":
|
|
649
|
+
return "read:dom";
|
|
650
|
+
case "downloadImage":
|
|
651
|
+
return "submit:form";
|
|
652
|
+
// writes to user's disk — treat as side-effect
|
|
653
|
+
case "takeSnapshot":
|
|
654
|
+
return "read:dom";
|
|
655
|
+
case "clickByUid":
|
|
656
|
+
return "interact:form";
|
|
657
|
+
case "fillByUid":
|
|
658
|
+
case "fillForm":
|
|
659
|
+
return "interact:form";
|
|
660
|
+
case "highlightElement":
|
|
661
|
+
case "highlightText":
|
|
662
|
+
return "read:dom";
|
|
663
|
+
// visual-only overlay
|
|
641
664
|
default: {
|
|
642
665
|
const _exhaustive = tool;
|
|
643
666
|
throw new Error(`capabilityForTool: unknown tool ${_exhaustive}`);
|
|
@@ -1034,75 +1057,79 @@ var CONTROL_TOOLS = [
|
|
|
1034
1057
|
];
|
|
1035
1058
|
|
|
1036
1059
|
// ../shared/src/llm/builtin-tool-defs.ts
|
|
1060
|
+
var TAB_ID_FIELD = {
|
|
1061
|
+
type: "integer",
|
|
1062
|
+
description: "\u76EE\u6807 tab\u3002\u8981\u64CD\u4F5C\u4E3B\u4F1A\u8BDD tab \u65F6\u6574\u4E2A\u5B57\u6BB5\u4E0D\u8981\u5E26\uFF08\u4E0D\u8981 0 / null\uFF09\uFF1B\u8981\u64CD\u4F5C\u5176\u5B83 tab \u65F6\u5B83\u5FC5\u987B\u5148\u5728 attachedTabs\uFF08\u7528 attachTab \u7533\u8BF7\uFF09"
|
|
1063
|
+
};
|
|
1037
1064
|
var TOOL_DEFS = [
|
|
1038
1065
|
{
|
|
1039
1066
|
name: "snapshotDOM",
|
|
1040
|
-
description: "\
|
|
1067
|
+
description: "[FIRST\xB7LEGACY] \u8FD4\u56DE\u9875\u9762 DOM \u7B80\u5316\u6811\uFF08tag/id/classes/\u76F4\u63A5\u6587\u672C/children\uFF09\u3002\n\u5982\u679C\u4F60\u53EA\u662F\u8981\u627E\u4EA4\u4E92\u5143\u7D20\u5E76\u968F\u540E\u64CD\u4F5C\uFF0C**\u4F18\u5148\u7528 takeSnapshot**\uFF08UID \u7A33\u5B9A\uFF0CclickByUid \u5065\u58EE\uFF09\uFF1B\nsnapshotDOM \u66F4\u9002\u5408\u300C\u6211\u8981\u5206\u6790\u6574\u4E2A\u9875\u9762\u7ED3\u6784\u300D\u8FD9\u79CD\u63A2\u67E5\u7C7B\u9700\u6C42\u3002\n\n\u793A\u4F8B\uFF1A\n- \u770B\u6574\u9875\uFF1A{ }\uFF08\u9ED8\u8BA4 maxDepth=3\uFF09\n- \u770B\u67D0\u533A\u57DF\uFF1A{ root: '.main-content', maxDepth: 5 }\n- \u770B\u5230\u5E95\uFF1A{ maxDepth: 8 }",
|
|
1041
1068
|
input_schema: {
|
|
1042
1069
|
type: "object",
|
|
1043
1070
|
properties: {
|
|
1044
1071
|
maxDepth: { type: "integer", default: 3 },
|
|
1045
1072
|
root: { type: "string", description: "\u53EF\u9009\u7684 CSS \u9009\u62E9\u5668\uFF1B\u627E\u4E0D\u5230\u65F6\u9000\u56DE\u5230 <html>" },
|
|
1046
|
-
tabId:
|
|
1073
|
+
tabId: TAB_ID_FIELD
|
|
1047
1074
|
}
|
|
1048
1075
|
}
|
|
1049
1076
|
},
|
|
1050
1077
|
{
|
|
1051
1078
|
name: "querySelector",
|
|
1052
|
-
description: "\u8FD4\u56DE\u9996\u4E2A\u5339\u914D\u5143\u7D20\u7684\u6D45\u5C42\u6458\u8981 (tag/id/classes/text/attrs)\u3002",
|
|
1079
|
+
description: "[FAST] \u8FD4\u56DE\u9996\u4E2A\u5339\u914D\u5143\u7D20\u7684\u6D45\u5C42\u6458\u8981 (tag/id/classes/text/attrs)\u3002\u4EC5\u63A2\u67E5\u7528\u3002\n\u8981\u540E\u7EED\u70B9\u51FB\u6216\u586B\u503C\uFF0C\u914D\u5408 selector \u76F4\u63A5\u4F20\u7ED9 click / fillInput\uFF0C\u6216\u7528 takeSnapshot \u62FF UID\u3002\n\n\u793A\u4F8B\uFF1A\n- \u627E\u6309\u94AE\uFF1A{ selector: 'button[type=submit]' }\n- \u627E\u8F93\u5165\uFF1A{ selector: 'input[name=email]' }",
|
|
1053
1080
|
input_schema: {
|
|
1054
1081
|
type: "object",
|
|
1055
1082
|
properties: {
|
|
1056
1083
|
selector: { type: "string" },
|
|
1057
1084
|
root: { type: "string" },
|
|
1058
|
-
tabId:
|
|
1085
|
+
tabId: TAB_ID_FIELD
|
|
1059
1086
|
},
|
|
1060
1087
|
required: ["selector"]
|
|
1061
1088
|
}
|
|
1062
1089
|
},
|
|
1063
1090
|
{
|
|
1064
1091
|
name: "querySelectorAll",
|
|
1065
|
-
description: "\u8FD4\u56DE\u6240\u6709\u5339\u914D\u5143\u7D20\u7684\u6D45\u5C42\u6458\u8981\u6570\u7EC4\u3002",
|
|
1092
|
+
description: "[FAST] \u8FD4\u56DE\u6240\u6709\u5339\u914D\u5143\u7D20\u7684\u6D45\u5C42\u6458\u8981\u6570\u7EC4\u3002\n\n\u793A\u4F8B\uFF1A\n- \u6240\u6709\u8BC4\u8BBA\uFF1A{ selector: '.comment-item', limit: 50 }\n- \u6240\u6709\u94FE\u63A5\uFF1A{ selector: 'a[href]', limit: 20 }",
|
|
1066
1093
|
input_schema: {
|
|
1067
1094
|
type: "object",
|
|
1068
1095
|
properties: {
|
|
1069
1096
|
selector: { type: "string" },
|
|
1070
1097
|
root: { type: "string" },
|
|
1071
1098
|
limit: { type: "integer" },
|
|
1072
|
-
tabId:
|
|
1099
|
+
tabId: TAB_ID_FIELD
|
|
1073
1100
|
},
|
|
1074
1101
|
required: ["selector"]
|
|
1075
1102
|
}
|
|
1076
1103
|
},
|
|
1077
1104
|
{
|
|
1078
1105
|
name: "extractText",
|
|
1079
|
-
description: "\u63D0\u53D6\u9009\u62E9\u5668\u547D\u4E2D\
|
|
1106
|
+
description: "[FAST] \u63D0\u53D6\u9009\u62E9\u5668\u547D\u4E2D\u5143\u7D20\u7684\u6587\u672C\u3002single=true \u8FD4\u56DE\u5B57\u7B26\u4E32\uFF0C\u5426\u5219\u8FD4\u56DE\u6570\u7EC4\u3002\n\n\u793A\u4F8B\uFF1A\n- \u63D0\u53D6\u6807\u9898\uFF1A{ selector: 'h1', single: true }\n- \u63D0\u53D6\u6240\u6709\u6BB5\u843D\uFF1A{ selector: 'article p' }",
|
|
1080
1107
|
input_schema: {
|
|
1081
1108
|
type: "object",
|
|
1082
1109
|
properties: {
|
|
1083
1110
|
selector: { type: "string" },
|
|
1084
1111
|
root: { type: "string" },
|
|
1085
1112
|
single: { type: "boolean" },
|
|
1086
|
-
tabId:
|
|
1113
|
+
tabId: TAB_ID_FIELD
|
|
1087
1114
|
},
|
|
1088
1115
|
required: ["selector"]
|
|
1089
1116
|
}
|
|
1090
1117
|
},
|
|
1091
1118
|
{
|
|
1092
1119
|
name: "extractImages",
|
|
1093
|
-
description: "\u5728 root \u8303\u56F4\u5185\u63D0\u53D6\u6240\u6709 <img> \u7684 src/data-src/srcset\uFF1BincludeBg=true \u65F6\u4E5F\u63D0\u53D6\u80CC\u666F\u56FE\u3002\u8FD4\u56DE {url, via}
|
|
1120
|
+
description: "[FAST] \u5728 root \u8303\u56F4\u5185\u63D0\u53D6\u6240\u6709 <img> \u7684 src/data-src/srcset\uFF1BincludeBg=true \u65F6\u4E5F\u63D0\u53D6\u80CC\u666F\u56FE\u3002\u8FD4\u56DE [{url, via}].\n\n\u793A\u4F8B\uFF1A\n- \u5168\u9875\u56FE\uFF1A{ }\uFF08\u9ED8\u8BA4 root=document\uFF09\n- \u5546\u54C1\u4E3B\u56FE\uFF1A{ root: '.product-gallery' }",
|
|
1094
1121
|
input_schema: {
|
|
1095
1122
|
type: "object",
|
|
1096
1123
|
properties: {
|
|
1097
1124
|
root: { type: "string" },
|
|
1098
1125
|
includeBg: { type: "boolean", default: false },
|
|
1099
|
-
tabId:
|
|
1126
|
+
tabId: TAB_ID_FIELD
|
|
1100
1127
|
}
|
|
1101
1128
|
}
|
|
1102
1129
|
},
|
|
1103
1130
|
{
|
|
1104
1131
|
name: "scroll",
|
|
1105
|
-
description: "\u6EDA\u52A8\u9875\u9762\u3002to \u53EF\u4E3A 'bottom'
|
|
1132
|
+
description: "[FLOW] \u6EDA\u52A8\u9875\u9762\u3002to \u53EF\u4E3A 'bottom' / 'top' / number\u3002max \u662F\u6EDA\u52A8\u6B21\u6570\uFF1BuntilSelector \u51FA\u73B0\u65F6\u63D0\u524D\u505C\u3002\n\n\u793A\u4F8B\uFF1A\n- \u89E6\u53D1\u61D2\u52A0\u8F7D\uFF1A{ to: 'bottom', max: 5 }\n- \u6EDA\u5230\u951A\u70B9\uFF1A{ to: 'top' } \u540E\u7528 element.scrollIntoView \u4E5F\u53EF\n- \u7B49\u5F85\u65B0\u5143\u7D20\uFF1A{ to: 'bottom', max: 10, untilSelector: '.item:nth-child(20)' }",
|
|
1106
1133
|
input_schema: {
|
|
1107
1134
|
type: "object",
|
|
1108
1135
|
properties: {
|
|
@@ -1110,195 +1137,197 @@ var TOOL_DEFS = [
|
|
|
1110
1137
|
max: { type: "integer", default: 1 },
|
|
1111
1138
|
intervalMs: { type: "integer", default: 250 },
|
|
1112
1139
|
untilSelector: { type: "string" },
|
|
1113
|
-
tabId:
|
|
1140
|
+
tabId: TAB_ID_FIELD
|
|
1114
1141
|
},
|
|
1115
1142
|
required: ["to"]
|
|
1116
1143
|
}
|
|
1117
1144
|
},
|
|
1118
1145
|
{
|
|
1119
1146
|
name: "waitFor",
|
|
1120
|
-
description: "\u7B49\u5F85\u56FA\u5B9A ms\uFF0C\u6216\u7B49\u5F85\u9009\u62E9\u5668\u51FA\u73B0\uFF08\u5E26 timeoutMs \u515C\u5E95\uFF09\u3002",
|
|
1147
|
+
description: "[FLOW] \u7B49\u5F85\u56FA\u5B9A ms\uFF0C\u6216\u7B49\u5F85\u9009\u62E9\u5668\u51FA\u73B0\uFF08\u5E26 timeoutMs \u515C\u5E95\uFF09\u3002\n\n\u793A\u4F8B\uFF1A\n- \u7B49 500ms\uFF1A{ ms: 500 }\n- \u7B49\u5143\u7D20\u51FA\u73B0\uFF1A{ selector: '.lazy-loaded', timeoutMs: 8000 }",
|
|
1121
1148
|
input_schema: {
|
|
1122
1149
|
type: "object",
|
|
1123
1150
|
properties: {
|
|
1124
1151
|
ms: { type: "integer" },
|
|
1125
1152
|
selector: { type: "string" },
|
|
1126
1153
|
timeoutMs: { type: "integer", default: 5e3 },
|
|
1127
|
-
tabId:
|
|
1154
|
+
tabId: TAB_ID_FIELD
|
|
1128
1155
|
}
|
|
1129
1156
|
}
|
|
1130
1157
|
},
|
|
1131
1158
|
{
|
|
1132
1159
|
name: "click",
|
|
1133
|
-
description: "\u70B9\u51FB\u9009\u62E9\u5668\u547D\u4E2D\u7684\u5143\u7D20\u3002required=false \u65F6\u627E\u4E0D\u5230\u4E0D\u62A5\u9519\u3002\
|
|
1160
|
+
description: "[ACT] \u70B9\u51FB\u9009\u62E9\u5668\u547D\u4E2D\u7684\u5143\u7D20\u3002required=false \u65F6\u627E\u4E0D\u5230\u4E0D\u62A5\u9519\u3002\u4F1A\u7ECF\u8FC7\u5BA1\u9605\uFF08caution\uFF09\u3002\n\u7528 takeSnapshot \u62FF\u5230 UID \u540E\u5EFA\u8BAE\u6539\u7528 clickByUid\uFF0C\u66F4\u7A33\u3002",
|
|
1134
1161
|
input_schema: {
|
|
1135
1162
|
type: "object",
|
|
1136
1163
|
properties: {
|
|
1137
1164
|
selector: { type: "string" },
|
|
1138
1165
|
required: { type: "boolean", default: true },
|
|
1139
|
-
tabId:
|
|
1166
|
+
tabId: TAB_ID_FIELD
|
|
1140
1167
|
},
|
|
1141
1168
|
required: ["selector"]
|
|
1142
1169
|
}
|
|
1143
1170
|
},
|
|
1144
1171
|
{
|
|
1145
1172
|
name: "httpRequest",
|
|
1146
|
-
description: "\u901A\u8FC7\u540E\u53F0\u4EE3\u7406\u53D1\u8BF7\u6C42\u3002withCredentials=true \u65F6\u5E26 cookie\uFF0C\
|
|
1173
|
+
description: "[ACT] \u901A\u8FC7\u540E\u53F0\u4EE3\u7406\u53D1\u8BF7\u6C42\u3002withCredentials=true \u65F6\u5E26 cookie\uFF08dangerous\uFF0C\u8981\u5BA1\u9605\uFF09\uFF1B\u9ED8\u8BA4 omit\u3002\n\n\u793A\u4F8B\uFF1A\n- \u7FFB\u8BC4\u8BBA\u9875\uFF1A{ url: 'https://x.com/api/comments?page=2', withCredentials: false }\n- \u5E26\u767B\u5F55\u6001\u8C03\u5185\u90E8\u63A5\u53E3\uFF1A{ url: '...', withCredentials: true }",
|
|
1147
1174
|
input_schema: {
|
|
1148
1175
|
type: "object",
|
|
1149
1176
|
properties: {
|
|
1177
|
+
method: { type: "string", default: "GET" },
|
|
1150
1178
|
url: { type: "string" },
|
|
1151
|
-
method: { type: "string", enum: ["GET", "POST", "PUT", "DELETE", "PATCH"], default: "GET" },
|
|
1152
1179
|
headers: { type: "object" },
|
|
1153
|
-
body: {
|
|
1180
|
+
body: { description: "any JSON-able value" },
|
|
1154
1181
|
withCredentials: { type: "boolean", default: false },
|
|
1155
|
-
tabId:
|
|
1182
|
+
tabId: TAB_ID_FIELD
|
|
1156
1183
|
},
|
|
1157
1184
|
required: ["url"]
|
|
1158
1185
|
}
|
|
1159
1186
|
},
|
|
1160
1187
|
{
|
|
1161
1188
|
name: "readStorage",
|
|
1162
|
-
description: "\u8BFB localStorage \u6216 sessionStorage \
|
|
1189
|
+
description: "[DANGER] \u8BFB localStorage \u6216 sessionStorage \u6307\u5B9A key\u3002\u9700\u8981\u5BA1\u9605\u3002",
|
|
1163
1190
|
input_schema: {
|
|
1164
1191
|
type: "object",
|
|
1165
1192
|
properties: {
|
|
1166
1193
|
store: { type: "string", enum: ["local", "session"] },
|
|
1167
1194
|
key: { type: "string" },
|
|
1168
|
-
tabId:
|
|
1195
|
+
tabId: TAB_ID_FIELD
|
|
1169
1196
|
},
|
|
1170
1197
|
required: ["store", "key"]
|
|
1171
1198
|
}
|
|
1172
1199
|
},
|
|
1173
1200
|
{
|
|
1174
1201
|
name: "fillInput",
|
|
1175
|
-
description: "\u5F80 input/textarea/contenteditable \u586B\u503C\uFF1B\u89E6\u53D1 input/change \u4E8B\u4EF6\
|
|
1202
|
+
description: "[ACT] \u5F80 input/textarea/contenteditable \u586B\u503C\uFF1B\u89E6\u53D1 input/change \u4E8B\u4EF6\u517C\u5BB9 React/Vue\u3002\n**\u6279\u91CF\u586B\u8868\u8BF7\u7528 fillForm**\uFF08\u66F4\u9AD8\u6548\uFF09\u3002\n\n\u793A\u4F8B\uFF1A\n- \u586B\u90AE\u7BB1\uFF1A{ selector: 'input[name=email]', value: 'a@b.c' }\n- \u4E0D\u6E05\u7A7A\u76F4\u63A5\u8FFD\u52A0\uFF1A{ selector: '.editor', value: 'tail', clear: false }",
|
|
1176
1203
|
input_schema: {
|
|
1177
1204
|
type: "object",
|
|
1178
1205
|
properties: {
|
|
1179
1206
|
selector: { type: "string" },
|
|
1180
1207
|
value: { type: "string" },
|
|
1181
1208
|
clear: { type: "boolean", default: true },
|
|
1182
|
-
tabId:
|
|
1209
|
+
tabId: TAB_ID_FIELD
|
|
1183
1210
|
},
|
|
1184
1211
|
required: ["selector", "value"]
|
|
1185
1212
|
}
|
|
1186
1213
|
},
|
|
1187
1214
|
{
|
|
1188
1215
|
name: "setCheckbox",
|
|
1189
|
-
description: "\u8BBE\u7F6E checkbox \u52FE\u9009\u72B6\u6001\uFF1B\u6D3E\u53D1 change \u4E8B\u4EF6\u3002",
|
|
1216
|
+
description: "[ACT] \u8BBE\u7F6E checkbox \u52FE\u9009\u72B6\u6001\uFF1B\u6D3E\u53D1 change \u4E8B\u4EF6\u3002",
|
|
1190
1217
|
input_schema: {
|
|
1191
1218
|
type: "object",
|
|
1192
1219
|
properties: {
|
|
1193
1220
|
selector: { type: "string" },
|
|
1194
1221
|
checked: { type: "boolean" },
|
|
1195
|
-
tabId:
|
|
1222
|
+
tabId: TAB_ID_FIELD
|
|
1196
1223
|
},
|
|
1197
1224
|
required: ["selector", "checked"]
|
|
1198
1225
|
}
|
|
1199
1226
|
},
|
|
1200
1227
|
{
|
|
1201
1228
|
name: "selectOption",
|
|
1202
|
-
description: "<select> \u5143\u7D20\u6309 value \u6216 label \u9009\u9879\u3002\u540C\u65F6\u7ED9\u4E24\u8005\u65F6\u4F18\u5148 value\u3002",
|
|
1229
|
+
description: "[ACT] <select> \u5143\u7D20\u6309 value \u6216 label \u9009\u9879\u3002\u540C\u65F6\u7ED9\u4E24\u8005\u65F6\u4F18\u5148 value\u3002",
|
|
1203
1230
|
input_schema: {
|
|
1204
1231
|
type: "object",
|
|
1205
1232
|
properties: {
|
|
1206
1233
|
selector: { type: "string" },
|
|
1207
1234
|
value: { type: "string" },
|
|
1208
1235
|
label: { type: "string" },
|
|
1209
|
-
tabId:
|
|
1236
|
+
tabId: TAB_ID_FIELD
|
|
1210
1237
|
},
|
|
1211
1238
|
required: ["selector"]
|
|
1212
1239
|
}
|
|
1213
1240
|
},
|
|
1214
1241
|
{
|
|
1215
1242
|
name: "submitForm",
|
|
1216
|
-
description: "\u63D0\u4EA4 <form>\u3002\u4F1A\u89E6\u53D1\u670D\u52A1\u7AEF\u52A8\u4F5C\uFF08\u4E0B\u5355\u3001\u7559\u8A00\u7B49\uFF09\uFF0C\
|
|
1243
|
+
description: "[CONFIRM\xB7DANGER] \u63D0\u4EA4 <form>\u3002\u4F1A\u89E6\u53D1\u670D\u52A1\u7AEF\u52A8\u4F5C\uFF08\u4E0B\u5355\u3001\u7559\u8A00\u7B49\uFF09\uFF0C\u7528\u6237\u5FC5\u987B\u5BA1\u9605\u3002\n\u8C03\u7528\u524D\u5EFA\u8BAE\u5148\u7528 askUser \u8BA9\u7528\u6237\u6700\u7EC8\u786E\u8BA4\u3002",
|
|
1217
1244
|
input_schema: {
|
|
1218
1245
|
type: "object",
|
|
1219
1246
|
properties: {
|
|
1220
|
-
selector: { type: "string"
|
|
1221
|
-
tabId:
|
|
1222
|
-
}
|
|
1247
|
+
selector: { type: "string" },
|
|
1248
|
+
tabId: TAB_ID_FIELD
|
|
1249
|
+
},
|
|
1250
|
+
required: ["selector"]
|
|
1223
1251
|
}
|
|
1224
1252
|
},
|
|
1225
1253
|
{
|
|
1226
1254
|
name: "hover",
|
|
1227
|
-
description: "\u628A\u9F20\u6807\u60AC\u505C\u5728\u5143\u7D20\u4E0A\uFF08\u89E6\u53D1 mouseenter / mouseover / mousemove\uFF09\u3002",
|
|
1255
|
+
description: "[ACT] \u628A\u9F20\u6807\u60AC\u505C\u5728\u5143\u7D20\u4E0A\uFF08\u89E6\u53D1 mouseenter / mouseover / mousemove\uFF09\u3002",
|
|
1228
1256
|
input_schema: {
|
|
1229
1257
|
type: "object",
|
|
1230
1258
|
properties: {
|
|
1231
1259
|
selector: { type: "string" },
|
|
1232
|
-
tabId:
|
|
1260
|
+
tabId: TAB_ID_FIELD
|
|
1233
1261
|
},
|
|
1234
1262
|
required: ["selector"]
|
|
1235
1263
|
}
|
|
1236
1264
|
},
|
|
1237
1265
|
{
|
|
1238
1266
|
name: "focus",
|
|
1239
|
-
description: "\u628A\u7126\u70B9\u7ED9\u67D0\u5143\u7D20\uFF08\u89E6\u53D1 focus / focusin\uFF09\u3002",
|
|
1267
|
+
description: "[ACT] \u628A\u7126\u70B9\u7ED9\u67D0\u5143\u7D20\uFF08\u89E6\u53D1 focus / focusin\uFF09\u3002",
|
|
1240
1268
|
input_schema: {
|
|
1241
1269
|
type: "object",
|
|
1242
1270
|
properties: {
|
|
1243
1271
|
selector: { type: "string" },
|
|
1244
|
-
tabId:
|
|
1272
|
+
tabId: TAB_ID_FIELD
|
|
1245
1273
|
},
|
|
1246
1274
|
required: ["selector"]
|
|
1247
1275
|
}
|
|
1248
1276
|
},
|
|
1249
1277
|
{
|
|
1250
1278
|
name: "uploadFile",
|
|
1251
|
-
description: "\u628A\u540E\u7AEF\u4EE3\u7406\u62C9\u5230\u7684\u6587\u4EF6\u586B\u5230 <input type=file>\u3002\u67D0\u4E9B\u7AD9\u70B9\u4F1A\u62D2\u7EDD\u5408\u6210 File\
|
|
1279
|
+
description: "[CONFIRM\xB7DANGER] \u628A\u540E\u7AEF\u4EE3\u7406\u62C9\u5230\u7684\u6587\u4EF6\u586B\u5230 <input type=file>\u3002\u67D0\u4E9B\u7AD9\u70B9\u4F1A\u62D2\u7EDD\u5408\u6210 File\u3002",
|
|
1252
1280
|
input_schema: {
|
|
1253
1281
|
type: "object",
|
|
1254
1282
|
properties: {
|
|
1255
1283
|
selector: { type: "string" },
|
|
1256
1284
|
url: { type: "string" },
|
|
1257
1285
|
filename: { type: "string" },
|
|
1258
|
-
|
|
1259
|
-
tabId:
|
|
1286
|
+
mimeType: { type: "string" },
|
|
1287
|
+
tabId: TAB_ID_FIELD
|
|
1260
1288
|
},
|
|
1261
1289
|
required: ["selector", "url"]
|
|
1262
1290
|
}
|
|
1263
1291
|
},
|
|
1264
1292
|
{
|
|
1265
1293
|
name: "getValue",
|
|
1266
|
-
description: "\u8BFB input/select/textarea/contenteditable \u7684\u5F53\u524D\u503C\u3002",
|
|
1294
|
+
description: "[FAST] \u8BFB input/select/textarea/contenteditable \u7684\u5F53\u524D\u503C\u3002",
|
|
1267
1295
|
input_schema: {
|
|
1268
1296
|
type: "object",
|
|
1269
1297
|
properties: {
|
|
1270
1298
|
selector: { type: "string" },
|
|
1271
|
-
tabId:
|
|
1299
|
+
tabId: TAB_ID_FIELD
|
|
1272
1300
|
},
|
|
1273
1301
|
required: ["selector"]
|
|
1274
1302
|
}
|
|
1275
1303
|
},
|
|
1276
1304
|
{
|
|
1277
1305
|
name: "extractFormState",
|
|
1278
|
-
description: "\u628A <form> \u5185\u6240\u6709\u53EF\u586B\u5B57\u6BB5\u8BFB\u6210 {name: value} \u5BF9\u8C61\uFF08radio \u53D6\u9009\u4E2D\u503C\uFF1Bcheckbox \u591A\u9009\u53D6\u6570\u7EC4\uFF09\u3002",
|
|
1306
|
+
description: "[FAST\xB7USE BEFORE FILL] \u628A <form> \u5185\u6240\u6709\u53EF\u586B\u5B57\u6BB5\u8BFB\u6210 {name: value} \u5BF9\u8C61\uFF08radio \u53D6\u9009\u4E2D\u503C\uFF1Bcheckbox \u591A\u9009\u53D6\u6570\u7EC4\uFF09\u3002\n\u586B\u8868\u524D\u5148\u8C03\u4E00\u6B21\uFF0C\u80FD\u7701\u4E0B\u5927\u91CF\u76F2\u586B\u3002",
|
|
1279
1307
|
input_schema: {
|
|
1280
1308
|
type: "object",
|
|
1281
1309
|
properties: {
|
|
1282
|
-
|
|
1283
|
-
tabId:
|
|
1310
|
+
form: { type: "string", description: "\u53EF\u9009\uFF1A<form> \u7684 CSS selector\uFF1B\u7701\u7565=\u7B2C\u4E00\u4E2A form" },
|
|
1311
|
+
tabId: TAB_ID_FIELD
|
|
1284
1312
|
}
|
|
1285
1313
|
}
|
|
1286
1314
|
},
|
|
1287
1315
|
{
|
|
1288
1316
|
name: "runJS",
|
|
1289
|
-
description: "\u5728 MAIN world \u6CE8\u5165\u5E76\u6267\u884C
|
|
1317
|
+
description: "[LAST RESORT\xB7DANGER] \u5728 MAIN world \u6CE8\u5165\u5E76\u6267\u884C async \u51FD\u6570\u4F53\uFF08receives `ctx` = bindings\uFF09\u3002\u5FC5\u987B return \u503C\u3002\n**\u4EC5\u5728\u7ED3\u6784\u5316\u5DE5\u5177\u4E0D\u591F\u7528\u65F6\u4F7F\u7528**\u2014\u2014\u4F1A\u7ECF\u8FC7\u9759\u6001\u626B\u63CF\u4E0E\u4EBA\u5DE5\u5BA1\u9605\u3002",
|
|
1290
1318
|
input_schema: {
|
|
1291
1319
|
type: "object",
|
|
1292
1320
|
properties: {
|
|
1293
1321
|
source: { type: "string", description: "async function body" },
|
|
1294
|
-
tabId:
|
|
1322
|
+
tabId: TAB_ID_FIELD
|
|
1295
1323
|
},
|
|
1296
1324
|
required: ["source"]
|
|
1297
1325
|
}
|
|
1298
1326
|
},
|
|
1327
|
+
// ─── Cross-tab control plane ─────────────────────────────────
|
|
1299
1328
|
{
|
|
1300
1329
|
name: "listTabs",
|
|
1301
|
-
description: "\u5217\u51FA\u6240\u6709\u7A97\u53E3\u7684\u53EF\u8BBF\u95EE tab\uFF1B\u8FD4\u56DE [{tabId, windowId, url, title, attached, isCurrent}]\u3002\
|
|
1330
|
+
description: "[META] \u5217\u51FA\u6240\u6709\u7A97\u53E3\u7684\u53EF\u8BBF\u95EE tab\uFF1B\u8FD4\u56DE [{tabId, windowId, url, title, attached, isCurrent}]\u3002\n\u5728\u4F60\u9700\u8981\u8BC6\u522B / \u627E\u65B0 tab \u65F6\u8C03\u7528\u3002",
|
|
1302
1331
|
input_schema: {
|
|
1303
1332
|
type: "object",
|
|
1304
1333
|
properties: {
|
|
@@ -1308,7 +1337,7 @@ var TOOL_DEFS = [
|
|
|
1308
1337
|
},
|
|
1309
1338
|
{
|
|
1310
1339
|
name: "openTab",
|
|
1311
|
-
description: "\u6253\u5F00\u65B0 tab\uFF0C\u6210\u529F\u540E\u81EA\u52A8\u52A0\u5165\u4F1A\u8BDD attachedTabs\uFF08source=ai-open\uFF09\u3002\u8FD4\u56DE {tabId, url, title}\u3002",
|
|
1340
|
+
description: "[META] \u6253\u5F00\u65B0 tab\uFF0C\u6210\u529F\u540E\u81EA\u52A8\u52A0\u5165\u4F1A\u8BDD attachedTabs\uFF08source=ai-open\uFF09\u3002\u8FD4\u56DE {tabId, url, title}\u3002",
|
|
1312
1341
|
input_schema: {
|
|
1313
1342
|
type: "object",
|
|
1314
1343
|
properties: {
|
|
@@ -1320,7 +1349,7 @@ var TOOL_DEFS = [
|
|
|
1320
1349
|
},
|
|
1321
1350
|
{
|
|
1322
1351
|
name: "attachTab",
|
|
1323
|
-
description: "\u8BF7\u6C42\u628A\
|
|
1352
|
+
description: "[META] \u8BF7\u6C42\u628A\u5DF2\u6253\u5F00\u7684 tab \u7EB3\u5165\u4F1A\u8BDD attachedTabs\uFF1B\u672A\u9884\u6279\u51C6\u65F6\u4F1A\u5411\u7528\u6237\u7D22\u53D6\u5BA1\u6279\u3002",
|
|
1324
1353
|
input_schema: {
|
|
1325
1354
|
type: "object",
|
|
1326
1355
|
properties: {
|
|
@@ -1332,16 +1361,46 @@ var TOOL_DEFS = [
|
|
|
1332
1361
|
},
|
|
1333
1362
|
{
|
|
1334
1363
|
name: "detachTab",
|
|
1335
|
-
description: "\u4ECE\u4F1A\u8BDD attachedTabs \u79FB\u9664
|
|
1364
|
+
description: "[META] \u4ECE\u4F1A\u8BDD attachedTabs \u79FB\u9664 tab\uFF1B\u4E0D\u5173\u95ED\u8BE5 tab\u3002",
|
|
1336
1365
|
input_schema: {
|
|
1337
1366
|
type: "object",
|
|
1338
1367
|
properties: { tabId: { type: "integer" } },
|
|
1339
1368
|
required: ["tabId"]
|
|
1340
1369
|
}
|
|
1341
1370
|
},
|
|
1371
|
+
{
|
|
1372
|
+
name: "closeTab",
|
|
1373
|
+
description: "[META] \u771F\u6B63\u5173\u95ED\u4E00\u4E2A tab\u3002**\u53EA\u80FD\u5173 attachedTabs \u91CC\u7684 tab**\uFF08\u9632\u6B62\u8BEF\u5173\u7528\u6237\u5176\u5B83\u7A97\u53E3\uFF09\u3002",
|
|
1374
|
+
input_schema: {
|
|
1375
|
+
type: "object",
|
|
1376
|
+
properties: { tabId: { type: "integer" } },
|
|
1377
|
+
required: ["tabId"]
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
name: "switchToTab",
|
|
1382
|
+
description: "[META] \u628A Chrome \u524D\u53F0\u5207\u5230\u76EE\u6807 tab\u3002tabId \u5FC5\u987B\u5DF2\u5728 attachedTabs \u6216\u5F53\u524D tab\u3002",
|
|
1383
|
+
input_schema: {
|
|
1384
|
+
type: "object",
|
|
1385
|
+
properties: { tabId: { type: "integer" } },
|
|
1386
|
+
required: ["tabId"]
|
|
1387
|
+
}
|
|
1388
|
+
},
|
|
1389
|
+
// ─── User-side helpers ───────────────────────────────────────
|
|
1390
|
+
{
|
|
1391
|
+
name: "screenshot",
|
|
1392
|
+
description: "[VISION] \u622A\u5F53\u524D tab \u53EF\u89C1\u533A\u57DF\u4E3A PNG\uFF08\u81EA\u52A8\u4F5C\u4E3A image block \u6CE8\u5165\u4E0B\u8F6E\uFF09\u3002\u7528\u4E8E\u89C6\u89C9\u8C03\u8BD5 selector / \u770B\u56FE\u56DE\u7B54 / \u7559\u8BC1\u636E\u3002\u8FD4\u56DE {ok: true, byteLen}\u3002",
|
|
1393
|
+
input_schema: {
|
|
1394
|
+
type: "object",
|
|
1395
|
+
properties: {
|
|
1396
|
+
selector: { type: "string", description: "\u53EF\u9009\uFF1ACSS selector\u3002\u57FA\u7840\u7248\u65E0\u89C6\uFF0C\u59CB\u7EC8\u622A viewport\u3002" },
|
|
1397
|
+
tabId: TAB_ID_FIELD
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
},
|
|
1342
1401
|
{
|
|
1343
1402
|
name: "askUser",
|
|
1344
|
-
description: "\u5411\u7528\u6237\u4E3B\u52A8\u5F81\u8BE2\uFF08\u4E0D\u662F\u6267\u884C\u64CD\u4F5C\uFF09\u3002\
|
|
1403
|
+
description: "[ASK] \u5411\u7528\u6237\u4E3B\u52A8\u5F81\u8BE2\uFF08\u4E0D\u662F\u6267\u884C\u64CD\u4F5C\uFF09\u3002\u4EFB\u52A1\u6709\u591A\u4E2A\u5019\u9009 / \u4E8C\u6B21\u786E\u8BA4 / \u7F3A\u5173\u952E\u4FE1\u606F\u65F6\u8C03\u7528\u3002\u8FD4\u56DE {choice} / {value} / {cancelled:true}\u3002\n**\u4EC5\u5728\u4F60\u786E\u5B9E\u5361\u4F4F\u65F6\u624D\u7528**\u2014\u2014\u522B\u7528\u5B83\u505A\u95F2\u804A\u3002",
|
|
1345
1404
|
input_schema: {
|
|
1346
1405
|
type: "object",
|
|
1347
1406
|
properties: {
|
|
@@ -1367,6 +1426,131 @@ var TOOL_DEFS = [
|
|
|
1367
1426
|
},
|
|
1368
1427
|
required: ["prompt", "kind"]
|
|
1369
1428
|
}
|
|
1429
|
+
},
|
|
1430
|
+
// ─── Tier 3 · bookmark / history / downloads ────────────────
|
|
1431
|
+
{
|
|
1432
|
+
name: "searchBookmarks",
|
|
1433
|
+
description: "[META] \u641C\u7D22\u6D4F\u89C8\u5668\u4E66\u7B7E\uFF08chrome.bookmarks.search\uFF09\u3002\u8FD4\u56DE [{id, title, url}]\u3002\n\n\u793A\u4F8B\uFF1A{ query: 'react', limit: 20 }",
|
|
1434
|
+
input_schema: {
|
|
1435
|
+
type: "object",
|
|
1436
|
+
properties: {
|
|
1437
|
+
query: { type: "string" },
|
|
1438
|
+
limit: { type: "integer", default: 50 }
|
|
1439
|
+
},
|
|
1440
|
+
required: ["query"]
|
|
1441
|
+
}
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
name: "searchHistory",
|
|
1445
|
+
description: "[META] \u641C\u7D22\u6D4F\u89C8\u5668\u5386\u53F2\u3002daysBack \u9ED8\u8BA4 7\u3002\u8FD4\u56DE [{url, title, lastVisitTime, visitCount}]\u3002",
|
|
1446
|
+
input_schema: {
|
|
1447
|
+
type: "object",
|
|
1448
|
+
properties: {
|
|
1449
|
+
query: { type: "string" },
|
|
1450
|
+
daysBack: { type: "integer", default: 7 },
|
|
1451
|
+
limit: { type: "integer", default: 50 }
|
|
1452
|
+
},
|
|
1453
|
+
required: ["query"]
|
|
1454
|
+
}
|
|
1455
|
+
},
|
|
1456
|
+
{
|
|
1457
|
+
name: "downloadImage",
|
|
1458
|
+
description: "[ACT] \u628A\u4E00\u4E2A URL \u4E0B\u8F7D\u5230\u672C\u5730\uFF08Chrome Downloads\uFF09\u3002\u8FD4\u56DE {downloadId, filename}\u3002caution \u7EA7\u3002",
|
|
1459
|
+
input_schema: {
|
|
1460
|
+
type: "object",
|
|
1461
|
+
properties: {
|
|
1462
|
+
url: { type: "string" },
|
|
1463
|
+
filename: { type: "string", description: "\u53EF\u9009\uFF1A\u5EFA\u8BAE\u7684\u6587\u4EF6\u540D\uFF08\u542B\u540E\u7F00\uFF09" }
|
|
1464
|
+
},
|
|
1465
|
+
required: ["url"]
|
|
1466
|
+
}
|
|
1467
|
+
},
|
|
1468
|
+
// ─── Tier 4 · UID-based interaction + visual + batch ────────
|
|
1469
|
+
{
|
|
1470
|
+
name: "takeSnapshot",
|
|
1471
|
+
description: "[FIRST\xB7UID] \u6293\u53D6\u9875\u9762 accessibility snapshot\uFF1A\u8FD4\u56DE [{uid, role, name, tag, text, bounds}]\u3002\nUID \u5728\u672C\u6B21 snapshot \u5185\u7A33\u5B9A\uFF0C\u540E\u7EED clickByUid / fillByUid \u5F15\u7528\uFF1B\u6BD4 selector \u5065\u58EE\uFF0C\u4E0D\u6015 class \u6539\u540D\u3002\n\u6BCF\u6B21\u5927\u52A8\u4F5C\u524D\u5237\u65B0\u4E00\u6B21\u3002snapshot \u9ED8\u8BA4\u53EA\u8FD4\u56DE\u4EA4\u4E92\u5143\u7D20\uFF08button / link / input / textarea / select / [role] / [data-testid]\uFF09\u3002",
|
|
1472
|
+
input_schema: {
|
|
1473
|
+
type: "object",
|
|
1474
|
+
properties: {
|
|
1475
|
+
includeAll: { type: "boolean", default: false, description: "true=\u5168\u90E8 element\uFF1Bfalse=\u53EA interactive\uFF08\u9ED8\u8BA4\uFF09" },
|
|
1476
|
+
tabId: TAB_ID_FIELD
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
},
|
|
1480
|
+
{
|
|
1481
|
+
name: "clickByUid",
|
|
1482
|
+
description: "[ACT\xB7UID] \u7528 takeSnapshot \u8FD4\u56DE\u7684 uid \u70B9\u51FB\u5143\u7D20\u3002\u6BD4 selector \u7248\u7A33\u5B9A\u3002",
|
|
1483
|
+
input_schema: {
|
|
1484
|
+
type: "object",
|
|
1485
|
+
properties: {
|
|
1486
|
+
uid: { type: "string" },
|
|
1487
|
+
tabId: TAB_ID_FIELD
|
|
1488
|
+
},
|
|
1489
|
+
required: ["uid"]
|
|
1490
|
+
}
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
name: "fillByUid",
|
|
1494
|
+
description: "[ACT\xB7UID] \u7528 takeSnapshot \u8FD4\u56DE\u7684 uid \u586B\u503C\uFF08input/textarea/contenteditable\uFF09\u3002",
|
|
1495
|
+
input_schema: {
|
|
1496
|
+
type: "object",
|
|
1497
|
+
properties: {
|
|
1498
|
+
uid: { type: "string" },
|
|
1499
|
+
value: { type: "string" },
|
|
1500
|
+
clear: { type: "boolean", default: true },
|
|
1501
|
+
tabId: TAB_ID_FIELD
|
|
1502
|
+
},
|
|
1503
|
+
required: ["uid", "value"]
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
name: "highlightElement",
|
|
1508
|
+
description: "[VISUAL] \u7ED9\u9875\u9762\u67D0\u5143\u7D20\u52A0\u7EA2\u8272\u865A\u7EBF\u6846\uFF08\u9ED8\u8BA4 3s \u81EA\u52A8\u6D88\u5931\uFF09\uFF0C\u8BA9\u7528\u6237\u770B\u6E05\u4F60\u8BF4\u7684\u662F\u54EA\u4E2A\u3002\u4EC5\u89C6\u89C9\uFF0C\u4E0D\u6539 DOM\u3002\n\u53EF\u7528 selector \u6216 uid \u4EFB\u4E00\u79CD\u3002",
|
|
1509
|
+
input_schema: {
|
|
1510
|
+
type: "object",
|
|
1511
|
+
properties: {
|
|
1512
|
+
selector: { type: "string" },
|
|
1513
|
+
uid: { type: "string", description: "\u6216 takeSnapshot \u8FD4\u56DE\u7684 uid" },
|
|
1514
|
+
ms: { type: "integer", default: 3e3 },
|
|
1515
|
+
tabId: TAB_ID_FIELD
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
name: "highlightText",
|
|
1521
|
+
description: "[VISUAL] \u5728\u9875\u9762\u6587\u672C\u91CC\u9AD8\u4EAE\u67D0\u6BB5\u6587\u5B57\uFF08\u9EC4\u8272\u80CC\u666F\uFF0C3s \u540E\u8FD8\u539F\uFF09\u3002\u4EC5\u627E\u5230\u7B2C\u4E00\u6B21\u51FA\u73B0\u7684\u4F4D\u7F6E\u3002",
|
|
1522
|
+
input_schema: {
|
|
1523
|
+
type: "object",
|
|
1524
|
+
properties: {
|
|
1525
|
+
text: { type: "string" },
|
|
1526
|
+
ms: { type: "integer", default: 3e3 },
|
|
1527
|
+
tabId: TAB_ID_FIELD
|
|
1528
|
+
},
|
|
1529
|
+
required: ["text"]
|
|
1530
|
+
}
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
name: "fillForm",
|
|
1534
|
+
description: "[BATCH\xB7ACT] \u4E00\u6B21\u6027\u586B\u591A\u4E2A\u5B57\u6BB5\u3002\u6BCF\u9879\u5199 selector + value \u6216 uid + value\u3002\u8FD4\u56DE {filled: N, failed: [{at, error}]}\u3002\n\u6BD4\u5FAA\u73AF\u8C03 fillInput \u5FEB\u5F97\u591A\uFF0C\u4E5F\u7701 round-trip\u3002\n\n\u793A\u4F8B\uFF1A\n{ fields: [\n { selector: 'input[name=name]', value: '\u5F20\u4E09' },\n { selector: 'input[name=phone]', value: '13800000000' },\n { uid: 'el_5', value: 'mushroom' }\n] }",
|
|
1535
|
+
input_schema: {
|
|
1536
|
+
type: "object",
|
|
1537
|
+
properties: {
|
|
1538
|
+
fields: {
|
|
1539
|
+
type: "array",
|
|
1540
|
+
items: {
|
|
1541
|
+
type: "object",
|
|
1542
|
+
properties: {
|
|
1543
|
+
selector: { type: "string" },
|
|
1544
|
+
uid: { type: "string" },
|
|
1545
|
+
value: { type: "string" }
|
|
1546
|
+
},
|
|
1547
|
+
required: ["value"]
|
|
1548
|
+
}
|
|
1549
|
+
},
|
|
1550
|
+
tabId: TAB_ID_FIELD
|
|
1551
|
+
},
|
|
1552
|
+
required: ["fields"]
|
|
1553
|
+
}
|
|
1370
1554
|
}
|
|
1371
1555
|
];
|
|
1372
1556
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attson/atwebpilot-mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "MCP server for the atwebpilot browser extension — let Claude Code drive your browser.",
|
|
6
6
|
"homepage": "https://github.com/attson/atwebpilot#readme",
|