ghost-bridge 1.0.0 → 1.0.1

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/server.js CHANGED
@@ -11884,13 +11884,13 @@ var require_tokenizer2 = __commonJS({
11884
11884
  return null;
11885
11885
  };
11886
11886
  function unescape_string(s) {
11887
- var out = "", escaped = 0;
11887
+ var out2 = "", escaped = 0;
11888
11888
  var input_scan = new InputScanner(s);
11889
11889
  var matched = null;
11890
11890
  while (input_scan.hasNext()) {
11891
11891
  matched = input_scan.match(/([\s]|[^\\]|\\\\)+/g);
11892
11892
  if (matched) {
11893
- out += matched[0];
11893
+ out2 += matched[0];
11894
11894
  }
11895
11895
  if (input_scan.peek() === "\\") {
11896
11896
  input_scan.next();
@@ -11902,9 +11902,9 @@ var require_tokenizer2 = __commonJS({
11902
11902
  matched = input_scan.match(/u\{([0-9A-Fa-f]+)\}/g);
11903
11903
  }
11904
11904
  } else {
11905
- out += "\\";
11905
+ out2 += "\\";
11906
11906
  if (input_scan.hasNext()) {
11907
- out += input_scan.next();
11907
+ out2 += input_scan.next();
11908
11908
  }
11909
11909
  continue;
11910
11910
  }
@@ -11915,17 +11915,17 @@ var require_tokenizer2 = __commonJS({
11915
11915
  if (escaped > 126 && escaped <= 255 && matched[0].indexOf("x") === 0) {
11916
11916
  return s;
11917
11917
  } else if (escaped >= 0 && escaped < 32) {
11918
- out += "\\" + matched[0];
11918
+ out2 += "\\" + matched[0];
11919
11919
  } else if (escaped > 1114111) {
11920
- out += "\\" + matched[0];
11920
+ out2 += "\\" + matched[0];
11921
11921
  } else if (escaped === 34 || escaped === 39 || escaped === 92) {
11922
- out += "\\" + String.fromCharCode(escaped);
11922
+ out2 += "\\" + String.fromCharCode(escaped);
11923
11923
  } else {
11924
- out += String.fromCharCode(escaped);
11924
+ out2 += String.fromCharCode(escaped);
11925
11925
  }
11926
11926
  }
11927
11927
  }
11928
- return out;
11928
+ return out2;
11929
11929
  }
11930
11930
  Tokenizer.prototype._read_string_recursive = function(delimiter, allow_unescaped_newlines, start_sub) {
11931
11931
  var current_char;
@@ -12040,16 +12040,16 @@ var require_beautifier = __commonJS({
12040
12040
  }
12041
12041
  function split_linebreaks(s) {
12042
12042
  s = s.replace(acorn.allLineBreaks, "\n");
12043
- var out = [], idx = s.indexOf("\n");
12043
+ var out2 = [], idx = s.indexOf("\n");
12044
12044
  while (idx !== -1) {
12045
- out.push(s.substring(0, idx));
12045
+ out2.push(s.substring(0, idx));
12046
12046
  s = s.substring(idx + 1);
12047
12047
  idx = s.indexOf("\n");
12048
12048
  }
12049
12049
  if (s.length) {
12050
- out.push(s);
12050
+ out2.push(s);
12051
12051
  }
12052
- return out;
12052
+ return out2;
12053
12053
  }
12054
12054
  function is_array(mode) {
12055
12055
  return mode === MODE.ArrayLiteral;
@@ -25234,11 +25234,11 @@ var ZodPipe = /* @__PURE__ */ $constructor("ZodPipe", (inst, def) => {
25234
25234
  inst.in = def.in;
25235
25235
  inst.out = def.out;
25236
25236
  });
25237
- function pipe(in_, out) {
25237
+ function pipe(in_, out2) {
25238
25238
  return new ZodPipe({
25239
25239
  type: "pipe",
25240
25240
  in: in_,
25241
- out
25241
+ out: out2
25242
25242
  // ...util.normalizeParams(params),
25243
25243
  });
25244
25244
  }
@@ -25246,11 +25246,11 @@ var ZodCodec = /* @__PURE__ */ $constructor("ZodCodec", (inst, def) => {
25246
25246
  ZodPipe.init(inst, def);
25247
25247
  $ZodCodec.init(inst, def);
25248
25248
  });
25249
- function codec(in_, out, params) {
25249
+ function codec(in_, out2, params) {
25250
25250
  return new ZodCodec({
25251
25251
  type: "pipe",
25252
25252
  in: in_,
25253
- out,
25253
+ out: out2,
25254
25254
  transform: params.decode,
25255
25255
  reverseTransform: params.encode
25256
25256
  });
@@ -28553,8 +28553,27 @@ var pendingRequests = /* @__PURE__ */ new Map();
28553
28553
  var mcpClients = /* @__PURE__ */ new Set();
28554
28554
  var mcpClientSeq = 0;
28555
28555
  var LOCAL_CLIENT_ID = "local";
28556
+ var DAEMON_LOG_FILE = path2.join(os.homedir(), ".ghost-bridge", "daemon.log");
28557
+ function appendDaemonLog(line) {
28558
+ try {
28559
+ fs2.mkdirSync(path2.dirname(DAEMON_LOG_FILE), { recursive: true });
28560
+ try {
28561
+ const st = fs2.statSync(DAEMON_LOG_FILE);
28562
+ if (st.size > 2 * 1024 * 1024) {
28563
+ const tail = fs2.readFileSync(DAEMON_LOG_FILE).slice(-512 * 1024);
28564
+ fs2.writeFileSync(DAEMON_LOG_FILE, tail);
28565
+ }
28566
+ } catch {
28567
+ }
28568
+ fs2.appendFileSync(DAEMON_LOG_FILE, `${(/* @__PURE__ */ new Date()).toISOString()} ${line}
28569
+ `);
28570
+ } catch {
28571
+ }
28572
+ }
28556
28573
  function log(msg) {
28557
- console.error(`[ghost-bridge] ${msg}`);
28574
+ const line = `[ghost-bridge] ${msg}`;
28575
+ console.error(line);
28576
+ if (IS_DAEMON) appendDaemonLog(line);
28558
28577
  }
28559
28578
  function buildIdentityPayload() {
28560
28579
  return {
@@ -29112,9 +29131,61 @@ async function askChrome(command, params = {}, options = {}) {
29112
29131
  function jsonText(data) {
29113
29132
  return typeof data === "string" ? data : JSON.stringify(data);
29114
29133
  }
29134
+ function compact(value) {
29135
+ if (Array.isArray(value)) {
29136
+ const cleaned = value.map(compact).filter((v) => v !== void 0);
29137
+ return cleaned.length ? cleaned : void 0;
29138
+ }
29139
+ if (value && typeof value === "object") {
29140
+ const cleaned = {};
29141
+ for (const [k, v] of Object.entries(value)) {
29142
+ const c = compact(v);
29143
+ if (c !== void 0) cleaned[k] = c;
29144
+ }
29145
+ return Object.keys(cleaned).length ? cleaned : void 0;
29146
+ }
29147
+ if (value === null || value === "") return void 0;
29148
+ return value;
29149
+ }
29150
+ function out(data) {
29151
+ return jsonText(compact(data));
29152
+ }
29153
+ function shrinkListTabs(res, { fullUrl } = {}) {
29154
+ if (!res || !Array.isArray(res.tabs)) return res;
29155
+ const trimTab = (t) => {
29156
+ if (!t) return t;
29157
+ const item = { id: t.id, index: t.index, active: t.active, title: t.title, url: t.url };
29158
+ if (!fullUrl && typeof item.url === "string" && item.url.length > 200) {
29159
+ item.url = item.url.slice(0, 200) + "\u2026";
29160
+ item.urlTruncated = true;
29161
+ }
29162
+ return item;
29163
+ };
29164
+ const result = {
29165
+ clientId: res.clientId,
29166
+ targetMode: res.targetMode,
29167
+ focusedTabId: res.focusedTabId,
29168
+ pinnedTabId: res.pinnedTabId,
29169
+ attachedTabIds: res.attachedTabIds,
29170
+ targetTabId: res.targetTab?.id,
29171
+ viewingTabId: res.viewingTab?.id,
29172
+ targetError: res.targetError,
29173
+ targets: (res.targets || []).map((tg) => ({
29174
+ owner: tg.owner,
29175
+ name: tg.name,
29176
+ tabId: tg.tabId,
29177
+ attached: tg.attached,
29178
+ errorCount: tg.errorCount,
29179
+ networkCount: tg.networkCount
29180
+ })),
29181
+ tabs: res.tabs.map(trimTab)
29182
+ };
29183
+ if (!fullUrl) result.note = "URL \u8D85 200 \u5B57\u7B26\u5DF2\u622A\u65AD\uFF0C\u9700\u8981\u5B8C\u6574\u94FE\u63A5\u4F20 fullUrl:true\uFF1Bbind_tab \u5339\u914D\u4ECD\u57FA\u4E8E\u771F\u5B9E URL";
29184
+ return result;
29185
+ }
29115
29186
  var TARGET_ARG = {
29116
29187
  type: "string",
29117
- description: "\u547D\u540D\u6D4F\u89C8\u5668\u76EE\u6807\uFF0C\u5982 cases/app\u3002\u5148\u7528 bind_tab \u7ED1\u5B9A\uFF1B\u4E0D\u6307\u5B9A\u5219\u4F7F\u7528\u9ED8\u8BA4 focused/pinned \u76EE\u6807\u3002\u7ED1\u5B9A\u4E0E pin \u5747\u6309\u4F1A\u8BDD\u9694\u79BB"
29188
+ description: "\u547D\u540D\u76EE\u6807\uFF08bind_tab \u7ED1\u5B9A\uFF1B\u7F3A\u7701\u7528\u805A\u7126/\u9501\u5B9A\u9875\uFF0C\u6309\u4F1A\u8BDD\u9694\u79BB\uFF09"
29118
29189
  };
29119
29190
  function buildSnippet(source, line, column, { beautifyEnabled = true, contextLines = 20 } = {}) {
29120
29191
  const result = {};
@@ -29159,53 +29230,65 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29159
29230
  tools: [
29160
29231
  {
29161
29232
  name: "inspect_page",
29162
- description: "\u9875\u9762\u5206\u6790\u5165\u53E3\u3002\u8FD4\u56DE\u9875\u9762\u5143\u6570\u636E\u3001\u7ED3\u6784\u5316\u6458\u8981\u548C\u53EF\u4EA4\u4E92\u5143\u7D20\u6982\u89C8\uFF0C\u9002\u5408\u5148\u5FEB\u901F\u4E86\u89E3\u5F53\u524D\u9875\u9762\u3002",
29233
+ description: "\u9875\u9762\u5206\u6790\u5165\u53E3\uFF1A\u8FD4\u56DE\u5143\u6570\u636E\u3001\u7ED3\u6784\u8BA1\u6570\u4E0E\u53EF\u4EA4\u4E92\u5143\u7D20\u6570\u91CF\uFF08\u7D27\u51D1\u6A21\u5F0F\uFF09\u3002\u9700\u8981\u5B8C\u6574 page/interactive \u6570\u636E\u4F20 detail:true\u3002",
29163
29234
  inputSchema: {
29164
29235
  type: "object",
29165
29236
  properties: {
29166
29237
  target: TARGET_ARG,
29167
29238
  selector: {
29168
29239
  type: "string",
29169
- description: "CSS \u9009\u62E9\u5668\uFF0C\u9650\u5B9A\u5206\u6790\u8303\u56F4\u3002\u4E0D\u6307\u5B9A\u5219\u5206\u6790\u6574\u4E2A\u9875\u9762"
29240
+ description: "CSS \u9009\u62E9\u5668\uFF0C\u9650\u5B9A\u5206\u6790\u8303\u56F4"
29170
29241
  },
29171
29242
  includeInteractive: {
29172
29243
  type: "boolean",
29173
- description: "\u662F\u5426\u5305\u542B\u4EA4\u4E92\u5143\u7D20\u6982\u89C8\uFF0C\u9ED8\u8BA4 true"
29244
+ description: "\u662F\u5426\u7EDF\u8BA1\u53EF\u4EA4\u4E92\u5143\u7D20\uFF0C\u9ED8\u8BA4 true"
29174
29245
  },
29175
29246
  maxElements: {
29176
29247
  type: "number",
29177
- description: "\u4EA4\u4E92\u5143\u7D20\u6982\u89C8\u7684\u6700\u5927\u6570\u91CF\uFF0C\u9ED8\u8BA4 30"
29248
+ description: "detail \u6A21\u5F0F\u4E0B\u53EF\u4EA4\u4E92\u5143\u7D20\u4E0A\u9650\uFF0C\u9ED8\u8BA4 30"
29249
+ },
29250
+ detail: {
29251
+ type: "boolean",
29252
+ description: "\u9ED8\u8BA4 false \u53EA\u8FD4\u56DE\u7D27\u51D1 summary\uFF1Btrue \u8FD4\u56DE\u5168\u91CF page \u4E0E interactive"
29178
29253
  }
29179
29254
  }
29180
29255
  }
29181
29256
  },
29182
29257
  {
29183
29258
  name: "get_server_info",
29184
- description: "\u83B7\u53D6 ghost-bridge \u670D\u52A1\u5668\u72B6\u6001\uFF0C\u5305\u62EC\u5F53\u524D WebSocket \u7AEF\u53E3\u3001\u8FDE\u63A5\u72B6\u6001\u7B49",
29259
+ description: "\u670D\u52A1\u5668\u72B6\u6001\uFF1AWebSocket \u7AEF\u53E3\u3001Chrome \u8FDE\u63A5\u4E0E\u4F1A\u8BDD\u6570\u3002",
29185
29260
  inputSchema: { type: "object", properties: {} }
29186
29261
  },
29187
29262
  {
29188
29263
  name: "list_tabs",
29189
- description: "\u5217\u51FA\u5F53\u524D Chrome \u6807\u7B7E\u9875\uFF0C\u5E76\u8FD4\u56DE Ghost Bridge \u5F53\u524D\u76EE\u6807\u6A21\u5F0F\u4E0E\u76EE\u6807\u6807\u7B7E\u9875\u3002",
29190
- inputSchema: { type: "object", properties: {} }
29264
+ description: "\u5217\u51FA\u6807\u7B7E\u9875\u4E0E\u5F53\u524D\u76EE\u6807\u6A21\u5F0F\u3002URL \u8D85\u957F\u81EA\u52A8\u622A\u65AD\uFF0CfullUrl:true \u8F93\u51FA\u5B8C\u6574\u3002",
29265
+ inputSchema: {
29266
+ type: "object",
29267
+ properties: {
29268
+ fullUrl: {
29269
+ type: "boolean",
29270
+ description: "\u9ED8\u8BA4 false\uFF08\u8D85 200 \u5B57\u7B26\u622A\u65AD\uFF09\uFF1Btrue \u8F93\u51FA\u5B8C\u6574 URL"
29271
+ }
29272
+ }
29273
+ }
29191
29274
  },
29192
29275
  {
29193
29276
  name: "bind_tab",
29194
- description: "\u6309 tabId\u3001URL \u7247\u6BB5\u6216\u6807\u9898\u7247\u6BB5\u628A Chrome \u6807\u7B7E\u9875\u7ED1\u5B9A\u4E3A\u547D\u540D target\uFF0C\u4F8B\u5982 cases \u6216 app\u3002target \u547D\u540D\u7A7A\u95F4\u6309 MCP \u4F1A\u8BDD\u9694\u79BB\uFF1A\u591A\u4E2A Agent / \u540C\u4E00 Agent \u7684\u591A\u4E2A\u4F1A\u8BDD\u5404\u81EA\u7ED1\u5B9A\u7684 target\uFF08\u542B\u540C\u540D\uFF09\u4E92\u4E0D\u5E72\u6270\u3002",
29277
+ description: "\u6309 tabId/URL \u7247\u6BB5/\u6807\u9898\u7247\u6BB5\u628A\u6807\u7B7E\u9875\u7ED1\u5B9A\u4E3A\u547D\u540D target\uFF08\u5982 cases\u3001app\uFF09\u3002\u547D\u540D\u7A7A\u95F4\u6309\u4F1A\u8BDD\u9694\u79BB\u3002",
29195
29278
  inputSchema: {
29196
29279
  type: "object",
29197
29280
  properties: {
29198
- name: { type: "string", description: "target \u540D\u79F0\uFF0C\u5982 cases/app\u3002\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u3001\u4E0B\u5212\u7EBF\u548C\u8FDE\u5B57\u7B26" },
29199
- tabId: { type: "number", description: "Chrome \u6807\u7B7E\u9875 ID\uFF0C\u4F18\u5148\u4F7F\u7528" },
29200
- urlContains: { type: "string", description: "URL \u7247\u6BB5\u3002\u672A\u63D0\u4F9B tabId \u65F6\u6309\u5B83\u5339\u914D" },
29201
- titleContains: { type: "string", description: "\u6807\u9898\u7247\u6BB5\u3002\u53EF\u4E0E urlContains \u540C\u65F6\u4F7F\u7528" }
29281
+ name: { type: "string", description: "target \u540D\u79F0\uFF0C\u5982 cases/app\uFF08\u5B57\u6BCD\u6570\u5B57\u4E0B\u5212\u7EBF\u8FDE\u5B57\u7B26\uFF09" },
29282
+ tabId: { type: "number", description: "\u6807\u7B7E\u9875 ID\uFF0C\u4F18\u5148\u4F7F\u7528" },
29283
+ urlContains: { type: "string", description: "URL \u7247\u6BB5\u5339\u914D" },
29284
+ titleContains: { type: "string", description: "\u6807\u9898\u7247\u6BB5\u5339\u914D" }
29202
29285
  },
29203
29286
  required: ["name"]
29204
29287
  }
29205
29288
  },
29206
29289
  {
29207
29290
  name: "unbind_tab",
29208
- description: "\u89E3\u7ED1\u4E00\u4E2A\u547D\u540D target\u3002\u82E5\u8BE5 tab \u6CA1\u6709\u5176\u4ED6 target \u5F15\u7528\uFF0C\u4F1A\u91CA\u653E\u5BF9\u5E94 debugger session\u3002",
29291
+ description: "\u89E3\u7ED1\u547D\u540D target\uFF1B\u65E0\u5176\u4ED6\u5F15\u7528\u65F6\u91CA\u653E\u5BF9\u5E94\u8C03\u8BD5\u4F1A\u8BDD\u3002",
29209
29292
  inputSchema: {
29210
29293
  type: "object",
29211
29294
  properties: {
@@ -29216,39 +29299,39 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29216
29299
  },
29217
29300
  {
29218
29301
  name: "list_targets",
29219
- description: "\u67E5\u770B\u5F53\u524D\u5DF2\u7ED1\u5B9A\u7684\u547D\u540D targets\uFF0C\u4EE5\u53CA\u9ED8\u8BA4 focused/pinned \u76EE\u6807\u72B6\u6001\u3002",
29302
+ description: "\u67E5\u770B\u5DF2\u7ED1\u5B9A targets \u4E0E\u9ED8\u8BA4\u76EE\u6807\u72B6\u6001\u3002",
29220
29303
  inputSchema: { type: "object", properties: {} }
29221
29304
  },
29222
29305
  {
29223
29306
  name: "get_target_tab",
29224
- description: "\u67E5\u770B Ghost Bridge \u5F53\u524D\u64CD\u4F5C\u76EE\u6807\u3002\u76EE\u6807\u6A21\u5F0F\u4E3A focused \u65F6\u8DDF\u968F\u5F53\u524D\u805A\u7126\u6807\u7B7E\u9875\uFF1Bpinned \u65F6\u9501\u5B9A\u6307\u5B9A\u6807\u7B7E\u9875\u3002",
29307
+ description: "\u67E5\u770B\u5F53\u524D\u64CD\u4F5C\u76EE\u6807\uFF08focused \u8DDF\u968F\u805A\u7126\u9875 / pinned \u9501\u5B9A\uFF09\u3002",
29225
29308
  inputSchema: { type: "object", properties: {} }
29226
29309
  },
29227
29310
  {
29228
29311
  name: "pin_current_tab",
29229
- description: "\u9501\u5B9A\u5F53\u524D\u805A\u7126\u7684 Chrome \u6807\u7B7E\u9875\u3002\u9501\u5B9A\u540E\u7528\u6237\u5207\u6362\u5230\u5176\u4ED6\u9875\u9762\u4E5F\u4E0D\u4F1A\u6539\u53D8 Ghost Bridge \u7684\u64CD\u4F5C\u76EE\u6807\u3002",
29312
+ description: "\u9501\u5B9A\u5F53\u524D\u805A\u7126\u6807\u7B7E\u9875\u4E3A\u64CD\u4F5C\u76EE\u6807\uFF0C\u5207\u6362\u6807\u7B7E\u4E0D\u5F71\u54CD\u3002",
29230
29313
  inputSchema: { type: "object", properties: {} }
29231
29314
  },
29232
29315
  {
29233
29316
  name: "pin_tab",
29234
- description: "\u6309 tabId\u3001URL \u7247\u6BB5\u6216\u6807\u9898\u7247\u6BB5\u9501\u5B9A Chrome \u6807\u7B7E\u9875\u3002pin \u72B6\u6001\u6309 MCP \u4F1A\u8BDD\u9694\u79BB\uFF1A\u591A\u4E2A Agent / \u591A\u4E2A\u4F1A\u8BDD\u5404\u81EA pin \u7684\u9875\u9762\u4E92\u4E0D\u8986\u76D6\u3002",
29317
+ description: "\u6309 tabId/URL/\u6807\u9898\u9501\u5B9A\u6807\u7B7E\u9875\u3002pin \u72B6\u6001\u6309\u4F1A\u8BDD\u9694\u79BB\u3002",
29235
29318
  inputSchema: {
29236
29319
  type: "object",
29237
29320
  properties: {
29238
- tabId: { type: "number", description: "Chrome \u6807\u7B7E\u9875 ID\uFF0C\u4F18\u5148\u4F7F\u7528" },
29239
- urlContains: { type: "string", description: "URL \u7247\u6BB5\u3002\u672A\u63D0\u4F9B tabId \u65F6\u6309\u5B83\u5339\u914D" },
29240
- titleContains: { type: "string", description: "\u6807\u9898\u7247\u6BB5\u3002\u53EF\u4E0E urlContains \u540C\u65F6\u4F7F\u7528" }
29321
+ tabId: { type: "number", description: "\u6807\u7B7E\u9875 ID\uFF0C\u4F18\u5148\u4F7F\u7528" },
29322
+ urlContains: { type: "string", description: "URL \u7247\u6BB5\u5339\u914D" },
29323
+ titleContains: { type: "string", description: "\u6807\u9898\u7247\u6BB5\u5339\u914D" }
29241
29324
  }
29242
29325
  }
29243
29326
  },
29244
29327
  {
29245
29328
  name: "unpin_tab",
29246
- description: "\u89E3\u9664\u9501\u5B9A\uFF0C\u6062\u590D\u8DDF\u968F\u5F53\u524D\u805A\u7126\u6807\u7B7E\u9875\u3002",
29329
+ description: "\u89E3\u9664\u9501\u5B9A\uFF0C\u6062\u590D\u8DDF\u968F\u805A\u7126\u9875\u3002",
29247
29330
  inputSchema: { type: "object", properties: {} }
29248
29331
  },
29249
29332
  {
29250
29333
  name: "get_last_error",
29251
- description: "\u83B7\u53D6\u76EE\u6807\u6807\u7B7E\u9875\u6700\u8FD1\u7684\u63A7\u5236\u53F0\u3001\u5F02\u5E38\u548C\u7F51\u7EDC\u9519\u8BEF\u4E8B\u4EF6\u3002\u9ED8\u8BA4\u53EA\u8FD4\u56DE error\uFF1B\u5982\u9700\u67E5\u770B console.log / console.warn\uFF0C\u8BF7\u4F20 severity=info / warn / all\u3002",
29334
+ description: "\u6700\u8FD1\u63A7\u5236\u53F0/\u5F02\u5E38/\u7F51\u7EDC\u9519\u8BEF\u3002severity \u9ED8\u8BA4 error\uFF0C\u53EF\u4F20 info/warn/all\u3002",
29252
29335
  inputSchema: {
29253
29336
  type: "object",
29254
29337
  properties: {
@@ -29260,14 +29343,14 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29260
29343
  },
29261
29344
  limit: {
29262
29345
  type: "number",
29263
- description: "\u8FD4\u56DE\u6761\u6570\u9650\u5236\uFF0C\u9ED8\u8BA4 20\uFF0C\u6700\u5927 100"
29346
+ description: "\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 20\uFF0C\u6700\u5927 100"
29264
29347
  }
29265
29348
  }
29266
29349
  }
29267
29350
  },
29268
29351
  {
29269
29352
  name: "get_script_source",
29270
- description: "\u6293\u53D6\u76EE\u6807\u6807\u7B7E\u9875\u7684\u811A\u672C\u6E90\u7801\u7247\u6BB5\uFF0C\u652F\u6301\u6309 URL \u7247\u6BB5\u7B5B\u9009\u548C\u53EF\u9009 beautify\u3002",
29353
+ description: "\u6293\u53D6\u811A\u672C\u6E90\u7801\u7247\u6BB5\uFF0C\u652F\u6301 URL \u7B5B\u9009\u4E0E beautify\u3002",
29271
29354
  inputSchema: {
29272
29355
  type: "object",
29273
29356
  properties: {
@@ -29282,7 +29365,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29282
29365
  },
29283
29366
  {
29284
29367
  name: "coverage_snapshot",
29285
- description: "\u542F\u52A8\u5E76\u91C7\u96C6\u4E00\u6B21\u6267\u884C\u8986\u76D6\u7387\uFF0C\u8FD4\u56DE\u6700\u6D3B\u8DC3\u7684\u811A\u672C/\u51FD\u6570\u5217\u8868",
29368
+ description: "\u91C7\u96C6\u4E00\u6B21\u6267\u884C\u8986\u76D6\u7387\uFF0C\u5217\u51FA\u6700\u6D3B\u8DC3\u7684\u811A\u672C/\u51FD\u6570\u3002",
29286
29369
  inputSchema: {
29287
29370
  type: "object",
29288
29371
  properties: {
@@ -29293,7 +29376,7 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29293
29376
  },
29294
29377
  {
29295
29378
  name: "find_by_string",
29296
- description: "\u5728\u76EE\u6807\u6807\u7B7E\u9875\u811A\u672C\u5185\u6309\u5B57\u7B26\u4E32\u641C\u7D22\uFF0C\u8FD4\u56DE\u5339\u914D\u4E0A\u4E0B\u6587\u3002",
29379
+ description: "\u5728\u9875\u9762\u811A\u672C\u5185\u6309\u5B57\u7B26\u4E32\u641C\u7D22\uFF0C\u8FD4\u56DE\u5339\u914D\u4E0A\u4E0B\u6587\u3002",
29297
29380
  inputSchema: {
29298
29381
  type: "object",
29299
29382
  properties: {
@@ -29307,12 +29390,12 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29307
29390
  },
29308
29391
  {
29309
29392
  name: "symbolic_hints",
29310
- description: "\u6536\u96C6\u9875\u9762\u7684\u8D44\u6E90\u3001\u5168\u5C40\u7B26\u53F7\u4E0E UA/URL \u7EBF\u7D22\uFF0C\u5E2E\u52A9\u63A8\u65AD\u7248\u672C\u4E0E\u6A21\u5757\u5F52\u5C5E",
29393
+ description: "\u6536\u96C6\u9875\u9762\u8D44\u6E90\u3001\u5168\u5C40\u7B26\u53F7\u4E0E UA/URL \u7EBF\u7D22\uFF0C\u63A8\u65AD\u7248\u672C\u4E0E\u6A21\u5757\u5F52\u5C5E\u3002",
29311
29394
  inputSchema: { type: "object", properties: { target: TARGET_ARG } }
29312
29395
  },
29313
29396
  {
29314
29397
  name: "eval_script",
29315
- description: "\u5728\u76EE\u6807\u6807\u7B7E\u9875\u6267\u884C\u53EA\u8BFB JS \u8868\u8FBE\u5F0F\uFF08\u8C28\u614E\u4F7F\u7528\uFF09",
29398
+ description: "\u5728\u76EE\u6807\u9875\u6267\u884C\u53EA\u8BFB JS \u8868\u8FBE\u5F0F\uFF08\u8C28\u614E\u4F7F\u7528\uFF09\u3002",
29316
29399
  inputSchema: {
29317
29400
  type: "object",
29318
29401
  properties: { target: TARGET_ARG, code: { type: "string" } },
@@ -29321,63 +29404,57 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29321
29404
  },
29322
29405
  {
29323
29406
  name: "list_network_requests",
29324
- description: "\u5217\u51FA\u76EE\u6807\u6807\u7B7E\u9875\u6355\u83B7\u7684\u7F51\u7EDC\u8BF7\u6C42\uFF0C\u652F\u6301\u6309 URL\u3001\u65B9\u6CD5\u3001\u72B6\u6001\u548C\u7C7B\u578B\u8FC7\u6EE4\u3002\u9ED8\u8BA4\u6309\u6392\u969C\u4F18\u5148\u7EA7\u6392\u5E8F\uFF1Bdata URL \u548C\u8D85\u957F URL \u4F1A\u81EA\u52A8\u6458\u8981\u5316\u3002",
29407
+ description: "\u5217\u51FA\u6355\u83B7\u7684\u7F51\u7EDC\u8BF7\u6C42\uFF0C\u652F\u6301 URL/\u65B9\u6CD5/\u72B6\u6001/\u7C7B\u578B\u8FC7\u6EE4\uFF1B\u8D85\u957F URL \u81EA\u52A8\u6458\u8981\u3002",
29325
29408
  inputSchema: {
29326
29409
  type: "object",
29327
29410
  properties: {
29328
29411
  target: TARGET_ARG,
29329
29412
  filter: { type: "string", description: "URL \u5173\u952E\u8BCD\u8FC7\u6EE4" },
29330
- method: { type: "string", description: "\u8BF7\u6C42\u65B9\u6CD5\uFF1AGET/POST/PUT/DELETE \u7B49" },
29331
- status: { type: "string", description: "\u72B6\u6001\uFF1Asuccess/error/failed/pending" },
29332
- resourceType: { type: "string", description: "\u8D44\u6E90\u7C7B\u578B\uFF1AXHR/Fetch/Script/Image \u7B49" },
29333
- limit: { type: "number", description: "\u8FD4\u56DE\u6570\u91CF\u9650\u5236\uFF0C\u9ED8\u8BA4 50" },
29413
+ method: { type: "string" },
29414
+ status: { type: "string", description: "success/error/failed/pending" },
29415
+ resourceType: { type: "string" },
29416
+ limit: { type: "number" },
29334
29417
  priorityMode: {
29335
29418
  type: "string",
29336
29419
  enum: ["debug", "api", "recent"],
29337
- description: "\u6392\u5E8F\u6A21\u5F0F\uFF1Adebug=\u6392\u969C\u4F18\u5148\uFF08\u9ED8\u8BA4\uFF09\uFF0Capi=\u63A5\u53E3\u4F18\u5148\uFF0Crecent=\u6309\u65F6\u95F4\u5012\u5E8F"
29420
+ description: "\u6392\u5E8F\uFF1Adebug \u6392\u969C\u4F18\u5148\uFF08\u9ED8\u8BA4\uFF09/api \u63A5\u53E3\u4F18\u5148/recent \u65F6\u95F4\u5012\u5E8F"
29338
29421
  }
29339
29422
  }
29340
29423
  }
29341
29424
  },
29342
29425
  {
29343
29426
  name: "get_network_detail",
29344
- description: "\u83B7\u53D6\u5355\u4E2A\u7F51\u7EDC\u8BF7\u6C42\u8BE6\u60C5\uFF0C\u5305\u62EC\u8BF7\u6C42\u5934\u3001\u54CD\u5E94\u5934\u548C\u53EF\u9009\u54CD\u5E94\u4F53\uFF1B\u8D85\u957F URL \u4F1A\u81EA\u52A8\u6458\u8981\u5316\u3002",
29427
+ description: "\u5355\u4E2A\u8BF7\u6C42\u8BE6\u60C5\uFF1A\u8BF7\u6C42/\u54CD\u5E94\u5934\u4E0E\u53EF\u9009\u54CD\u5E94\u4F53\uFF1B\u8D85\u957F URL \u81EA\u52A8\u6458\u8981\u3002",
29345
29428
  inputSchema: {
29346
29429
  type: "object",
29347
29430
  properties: {
29348
29431
  target: TARGET_ARG,
29349
- requestId: { type: "string", description: "\u8BF7\u6C42 ID\uFF08\u4ECE list_network_requests \u83B7\u53D6\uFF09" },
29350
- includeBody: { type: "boolean", description: "\u662F\u5426\u5305\u542B\u54CD\u5E94\u4F53\uFF0C\u9ED8\u8BA4 false" }
29432
+ requestId: { type: "string", description: "\u6765\u81EA list_network_requests" },
29433
+ includeBody: { type: "boolean", description: "\u9ED8\u8BA4 false" }
29351
29434
  },
29352
29435
  required: ["requestId"]
29353
29436
  }
29354
29437
  },
29355
29438
  {
29356
29439
  name: "clear_network_requests",
29357
- description: "\u6E05\u7A7A\u5DF2\u6355\u83B7\u7684\u7F51\u7EDC\u8BF7\u6C42\u8BB0\u5F55",
29440
+ description: "\u6E05\u7A7A\u7F51\u7EDC\u8BF7\u6C42\u6355\u83B7\u8BB0\u5F55\u3002",
29358
29441
  inputSchema: { type: "object", properties: { target: TARGET_ARG } }
29359
29442
  },
29360
29443
  {
29361
29444
  name: "perf_metrics",
29362
- description: "\u83B7\u53D6\u9875\u9762\u6027\u80FD\u6307\u6807\uFF0C\u5305\u62EC\u5F15\u64CE\u7EA7\u6307\u6807\u3001Web Vitals \u548C\u8D44\u6E90\u52A0\u8F7D\u6458\u8981\u3002",
29445
+ description: "\u6027\u80FD\u6307\u6807\uFF1A\u5F15\u64CE\u6307\u6807\u3001Web Vitals\u3001\u8D44\u6E90\u52A0\u8F7D\u6458\u8981\u3002",
29363
29446
  inputSchema: {
29364
29447
  type: "object",
29365
29448
  properties: {
29366
29449
  target: TARGET_ARG,
29367
- includeTimings: {
29368
- type: "boolean",
29369
- description: "\u662F\u5426\u5305\u542B Navigation Timing \u548C Web Vitals\uFF0C\u9ED8\u8BA4 true"
29370
- },
29371
- includeResources: {
29372
- type: "boolean",
29373
- description: "\u662F\u5426\u5305\u542B\u8D44\u6E90\u52A0\u8F7D\u6458\u8981\uFF08\u6309\u7C7B\u578B\u7EDF\u8BA1\u3001\u6700\u6162\u8D44\u6E90\uFF09\uFF0C\u9ED8\u8BA4 true"
29374
- }
29450
+ includeTimings: { type: "boolean", description: "\u9ED8\u8BA4 true" },
29451
+ includeResources: { type: "boolean", description: "\u9ED8\u8BA4 true" }
29375
29452
  }
29376
29453
  }
29377
29454
  },
29378
29455
  {
29379
29456
  name: "capture_screenshot",
29380
- description: "\u622A\u53D6\u76EE\u6807\u6807\u7B7E\u9875\u622A\u56FE\uFF0C\u9002\u5408\u770B\u9875\u9762\u5B9E\u9645\u89C6\u89C9\u6548\u679C\u3001UI \u6837\u5F0F\u548C\u5E03\u5C40\u3002\u9ED8\u8BA4\u4F18\u5148\u4F7F\u7528 JPEG\uFF1B\u9700\u8981\u6587\u5B57\u3001\u7EC6\u7EBF\u6216\u900F\u660E\u80CC\u666F\u7EC6\u8282\u65F6\u6539\u7528 PNG\u3002",
29457
+ description: "\u622A\u53D6\u76EE\u6807\u6807\u7B7E\u9875\u622A\u56FE\u3002\u9ED8\u8BA4 JPEG(80)\uFF1B\u6587\u5B57/\u7EC6\u7EBF/\u900F\u660E\u80CC\u666F\u7EC6\u8282\u7528 png\uFF1B\u6574\u9875\u7528 fullPage\u3002",
29381
29458
  inputSchema: {
29382
29459
  type: "object",
29383
29460
  properties: {
@@ -29385,32 +29462,26 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29385
29462
  format: {
29386
29463
  type: "string",
29387
29464
  enum: ["png", "jpeg"],
29388
- description: "\u56FE\u7247\u683C\u5F0F\u3002\u9ED8\u8BA4\u4F7F\u7528 jpeg\uFF1B\u9700\u8981\u9AD8\u4FDD\u771F\u6587\u5B57\u3001\u7EC6\u7EBF\u3001\u900F\u660E\u80CC\u666F\u65F6\u7528 png"
29465
+ description: "\u9ED8\u8BA4 jpeg\uFF1B\u9AD8\u4FDD\u771F\u6587\u5B57\u7528 png"
29389
29466
  },
29390
29467
  quality: {
29391
29468
  type: "number",
29392
- description: "JPEG \u8D28\u91CF (0-100)\uFF0C\u4EC5\u5F53 format \u4E3A jpeg \u65F6\u6709\u6548\u3002\u9ED8\u8BA4\u666E\u901A\u622A\u56FE 80\uFF0C\u5B8C\u6574\u957F\u622A\u56FE 70"
29469
+ description: "JPEG \u8D28\u91CF 0-100\uFF0C\u9ED8\u8BA4 80\uFF08\u957F\u622A\u56FE 70\uFF09"
29393
29470
  },
29394
29471
  fullPage: {
29395
29472
  type: "boolean",
29396
- description: "\u662F\u5426\u622A\u53D6\u5B8C\u6574\u9875\u9762\u957F\u622A\u56FE\uFF08\u5305\u62EC\u6EDA\u52A8\u533A\u57DF\uFF09\uFF0C\u9ED8\u8BA4 false \u53EA\u622A\u53D6\u53EF\u89C1\u533A\u57DF\u3002\u7528\u4E8E\u67E5\u770B\u6574\u4E2A\u9875\u9762\u5185\u5BB9\u65F6\u8BBE\u4E3A true"
29473
+ description: "\u6574\u9875\u957F\u622A\u56FE\uFF08\u542B\u6EDA\u52A8\u533A\u57DF\uFF09\uFF0C\u9ED8\u8BA4 false"
29397
29474
  },
29398
29475
  clip: {
29399
29476
  type: "object",
29400
- description: "\u6307\u5B9A\u622A\u53D6\u533A\u57DF\uFF08\u50CF\u7D20\uFF09",
29401
- properties: {
29402
- x: { type: "number", description: "\u5DE6\u4E0A\u89D2 X \u5750\u6807" },
29403
- y: { type: "number", description: "\u5DE6\u4E0A\u89D2 Y \u5750\u6807" },
29404
- width: { type: "number", description: "\u5BBD\u5EA6" },
29405
- height: { type: "number", description: "\u9AD8\u5EA6" }
29406
- }
29477
+ description: "\u622A\u53D6\u533A\u57DF {x,y,width,height}\uFF08\u50CF\u7D20\uFF09"
29407
29478
  }
29408
29479
  }
29409
29480
  }
29410
29481
  },
29411
29482
  {
29412
29483
  name: "get_page_content",
29413
- description: "\u63D0\u53D6\u76EE\u6807\u6807\u7B7E\u9875\u7684\u6587\u672C\u3001HTML \u6216\u7ED3\u6784\u5316\u6570\u636E\u3002\u6BD4\u622A\u56FE\u66F4\u8F7B\u91CF\uFF0C\u9002\u5408\u5148\u770B\u6587\u5B57\u3001DOM \u7ED3\u6784\u548C\u9875\u9762\u5143\u6570\u636E\uFF1B\u4E0D\u53CD\u6620 CSS\uFF0C\u4E5F\u4E0D\u542B iframe \u5185\u5BB9\u3002",
29484
+ description: "\u63D0\u53D6\u9875\u9762\u6587\u672C/HTML/\u7ED3\u6784\u5316\u6570\u636E\uFF0C\u6BD4\u622A\u56FE\u8F7B\u91CF\u3002\u9ED8\u8BA4\u4E0A\u9650 8000 \u5B57\u7B26\uFF1B\u4E0D\u591F\u65F6\u8C03\u5927 maxLength \u6216\u7528 offset \u7FFB\u9875\u3001selector \u6536\u7A84\u3002\u4E0D\u53CD\u6620 CSS\uFF0C\u4E0D\u542B iframe\u3002",
29414
29485
  inputSchema: {
29415
29486
  type: "object",
29416
29487
  properties: {
@@ -29418,80 +29489,83 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
29418
29489
  mode: {
29419
29490
  type: "string",
29420
29491
  enum: ["text", "html", "structured"],
29421
- description: "\u63D0\u53D6\u6A21\u5F0F\uFF1Atext=\u7EAF\u6587\u672C\uFF08\u9ED8\u8BA4\uFF0C\u6700\u5FEB\uFF09; html=HTML\u7247\u6BB5; structured=\u7ED3\u6784\u5316\u6570\u636E\uFF08\u6807\u9898/\u94FE\u63A5/\u6309\u94AE/\u8868\u5355/\u56FE\u7247\uFF09"
29492
+ description: "text \u7EAF\u6587\u672C\uFF08\u9ED8\u8BA4\uFF09/html \u7247\u6BB5/structured \u7ED3\u6784\u5316\u6570\u636E"
29422
29493
  },
29423
29494
  selector: {
29424
29495
  type: "string",
29425
- description: "CSS \u9009\u62E9\u5668\uFF0C\u9650\u5B9A\u63D0\u53D6\u8303\u56F4\u3002\u5982 'main'\u3001'#content'\u3001'.article'\u3002\u4E0D\u6307\u5B9A\u5219\u63D0\u53D6\u6574\u4E2A body"
29496
+ description: "CSS \u9009\u62E9\u5668\u9650\u5B9A\u8303\u56F4\uFF0C\u5982 'main'\u3001'#content'"
29426
29497
  },
29427
29498
  maxLength: {
29428
29499
  type: "number",
29429
- description: "\u6700\u5927\u8FD4\u56DE\u957F\u5EA6\uFF08\u5B57\u7B26\u6570\uFF09\uFF0C\u9ED8\u8BA4 50000\u3002\u4EC5\u5BF9 text/html \u6A21\u5F0F\u6709\u6548"
29500
+ description: "\u672C\u6B21\u8FD4\u56DE\u4E0A\u9650\uFF08\u5B57\u7B26\uFF09\uFF0C\u9ED8\u8BA4 8000\uFF1Btext/html \u6709\u6548"
29501
+ },
29502
+ offset: {
29503
+ type: "number",
29504
+ description: "\u4ECE\u7B2C N \u5B57\u7B26\u5F00\u59CB\u53D6\uFF08text/html \u5206\u9875\u7FFB\u9875\u7528\uFF09"
29430
29505
  },
29431
29506
  includeMetadata: {
29432
29507
  type: "boolean",
29433
- description: "\u662F\u5426\u5305\u542B\u9875\u9762\u5143\u6570\u636E\uFF08title/url/description\uFF09\uFF0C\u9ED8\u8BA4 true"
29508
+ description: "\u9644\u5E26 title/url/description\uFF0C\u9ED8\u8BA4 true"
29434
29509
  }
29435
29510
  }
29436
29511
  }
29437
29512
  },
29438
29513
  {
29439
29514
  name: "get_interactive_snapshot",
29440
- description: "\u626B\u63CF\u5F53\u524D\u9875\u9762\u53EF\u89C1\u7684\u53EF\u4EA4\u4E92\u5143\u7D20\uFF0C\u8FD4\u56DE\u5E26 ref \u7684\u7CBE\u7B80\u5217\u8868\uFF0C\u4F9B\u540E\u7EED dispatch_action \u4F7F\u7528\u3002\u652F\u6301 Shadow DOM\uFF1B\u4EC5\u7528\u4E8E\u4EA4\u4E92\u5B9A\u4F4D\u3002",
29515
+ description: "\u626B\u63CF\u53EF\u89C1\u53EF\u4EA4\u4E92\u5143\u7D20\uFF0C\u8FD4\u56DE\u5E26 ref \u7684\u7CBE\u7B80\u5217\u8868\u4F9B dispatch_action \u4F7F\u7528\uFF08\u5148\u5FEB\u7167\u540E\u64CD\u4F5C\uFF09\u3002\u9ED8\u8BA4 30 \u4E2A\uFF0C\u9700\u8981\u66F4\u591A\u4F20 maxElements \u6216\u7528 selector \u6536\u7A84\u3002\u652F\u6301 Shadow DOM\u3002",
29441
29516
  inputSchema: {
29442
29517
  type: "object",
29443
29518
  properties: {
29444
29519
  target: TARGET_ARG,
29445
29520
  selector: {
29446
29521
  type: "string",
29447
- description: "CSS \u9009\u62E9\u5668\uFF0C\u9650\u5B9A\u626B\u63CF\u8303\u56F4\u3002\u4E0D\u6307\u5B9A\u5219\u626B\u63CF\u6574\u4E2A\u9875\u9762"
29522
+ description: "CSS \u9009\u62E9\u5668\u9650\u5B9A\u626B\u63CF\u8303\u56F4"
29448
29523
  },
29449
29524
  includeText: {
29450
29525
  type: "boolean",
29451
- description: "\u662F\u5426\u5305\u542B\u5143\u7D20\u7684\u6587\u672C/\u5360\u4F4D\u7B26\u7B49\u4FE1\u606F\uFF0C\u9ED8\u8BA4 true"
29526
+ description: "\u5305\u542B\u5143\u7D20\u6587\u672C/\u5360\u4F4D\u7B26\uFF0C\u9ED8\u8BA4 true"
29452
29527
  },
29453
29528
  maxElements: {
29454
29529
  type: "number",
29455
- description: "\u6700\u5927\u8FD4\u56DE\u5143\u7D20\u6570\u91CF\uFF0C\u9ED8\u8BA4 100"
29530
+ description: "\u8FD4\u56DE\u5143\u7D20\u4E0A\u9650\uFF0C\u9ED8\u8BA4 30"
29456
29531
  }
29457
29532
  }
29458
29533
  }
29459
29534
  },
29460
29535
  {
29461
29536
  name: "dispatch_action",
29462
- description: "\u5BF9 get_interactive_snapshot \u8FD4\u56DE\u7684\u5143\u7D20\u6267\u884C\u70B9\u51FB\u3001\u8F93\u5165\u3001\u6309\u952E\u3001\u6EDA\u52A8\u3001\u9009\u62E9\u3001\u60AC\u505C\u6216\u805A\u7126\u3002\u26A0\uFE0F \u4F7F\u7528\u524D\u5FC5\u987B\u5148\u8C03\u7528 get_interactive_snapshot \u83B7\u53D6 ref\uFF1B\u64CD\u4F5C\u540E\u5EFA\u8BAE\u518D\u9A8C\u8BC1\u9875\u9762\u72B6\u6001\u3002",
29537
+ description: "\u5BF9 get_interactive_snapshot \u8FD4\u56DE\u7684 ref \u6267\u884C\u64CD\u4F5C\uFF1Aclick/fill/press/scroll/select/hover/focus\u3002\u26A0\uFE0F \u5FC5\u987B\u5148\u5FEB\u7167\u62FF ref\uFF1B\u64CD\u4F5C\u540E\u5EFA\u8BAE\u590D\u67E5\u9875\u9762\u72B6\u6001\u3002",
29463
29538
  inputSchema: {
29464
29539
  type: "object",
29465
29540
  properties: {
29466
29541
  target: TARGET_ARG,
29467
29542
  ref: {
29468
29543
  type: "string",
29469
- description: "\u76EE\u6807\u5143\u7D20\u7684 ref \u6807\u8BC6\uFF0C\u5982 'e1'\u3001'e5'\uFF08\u4ECE get_interactive_snapshot \u83B7\u53D6\uFF09"
29544
+ description: "\u5143\u7D20 ref\uFF0C\u5982 'e1'\uFF08\u6765\u81EA get_interactive_snapshot\uFF09"
29470
29545
  },
29471
29546
  action: {
29472
29547
  type: "string",
29473
- enum: ["click", "fill", "press", "scroll", "select", "hover", "focus"],
29474
- description: "\u8981\u6267\u884C\u7684\u52A8\u4F5C\u7C7B\u578B"
29548
+ enum: ["click", "fill", "press", "scroll", "select", "hover", "focus"]
29475
29549
  },
29476
29550
  value: {
29477
29551
  type: "string",
29478
- description: "fill \u65F6\u4E3A\u8981\u8F93\u5165\u7684\u6587\u672C\uFF1Bselect \u65F6\u4E3A\u8981\u9009\u62E9\u7684 option value\uFF1Bpress \u65F6\u4E3A\u6309\u952E\u540D\uFF08\u53EF\u9009\uFF09"
29552
+ description: "fill \u7684\u6587\u672C / select \u7684 option value"
29479
29553
  },
29480
29554
  key: {
29481
29555
  type: "string",
29482
- description: "press \u52A8\u4F5C\u7684\u6309\u952E\u540D\uFF0C\u5982 'Enter'\u3001'Escape'\u3001'Tab'\u3001'Backspace'\u3002\u9ED8\u8BA4 'Enter'"
29556
+ description: "press \u6309\u952E\uFF0C\u9ED8\u8BA4 'Enter'"
29483
29557
  },
29484
29558
  deltaX: {
29485
29559
  type: "number",
29486
- description: "scroll \u52A8\u4F5C\u7684\u6C34\u5E73\u6EDA\u52A8\u91CF\uFF08\u50CF\u7D20\uFF09\uFF0C\u9ED8\u8BA4 0"
29560
+ description: "\u6C34\u5E73\u6EDA\u52A8\u91CF\uFF0C\u9ED8\u8BA4 0"
29487
29561
  },
29488
29562
  deltaY: {
29489
29563
  type: "number",
29490
- description: "scroll \u52A8\u4F5C\u7684\u5782\u76F4\u6EDA\u52A8\u91CF\uFF08\u50CF\u7D20\uFF09\uFF0C\u9ED8\u8BA4 300\uFF08\u6B63\u6570\u5411\u4E0B\uFF0C\u8D1F\u6570\u5411\u4E0A\uFF09"
29564
+ description: "\u5782\u76F4\u6EDA\u52A8\u91CF\uFF0C\u9ED8\u8BA4 300\uFF08\u6B63\u6570\u5411\u4E0B\uFF09"
29491
29565
  },
29492
29566
  waitMs: {
29493
29567
  type: "number",
29494
- description: "\u64CD\u4F5C\u540E\u7B49\u5F85\u9875\u9762\u54CD\u5E94\u7684\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09\uFF0C\u9ED8\u8BA4 500\uFF0C\u6700\u5927 3000"
29568
+ description: "\u64CD\u4F5C\u540E\u7B49\u5F85 ms\uFF0C\u9ED8\u8BA4 500\uFF0C\u6700\u5927 3000"
29495
29569
  }
29496
29570
  },
29497
29571
  required: ["ref", "action"]
@@ -29504,7 +29578,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29504
29578
  const args = request.params.arguments || {};
29505
29579
  try {
29506
29580
  if (name === "inspect_page") {
29507
- const { target, selector, includeInteractive = true, maxElements = 30 } = args;
29581
+ const { target, selector, includeInteractive = true, maxElements = 30, detail = false } = args;
29508
29582
  const snapshot = await askChrome("inspectPageSnapshot", {
29509
29583
  target,
29510
29584
  selector,
@@ -29517,24 +29591,30 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29517
29591
  const buttons = page?.counts?.buttons;
29518
29592
  const forms = page?.counts?.forms;
29519
29593
  const interactiveCount = Array.isArray(interactive?.elements) ? interactive.elements.length : Array.isArray(interactive) ? interactive.length : void 0;
29594
+ const summary = {
29595
+ title: page?.metadata?.title,
29596
+ url: page?.metadata?.url,
29597
+ description: page?.metadata?.description,
29598
+ links,
29599
+ buttons,
29600
+ forms,
29601
+ interactiveCount
29602
+ };
29520
29603
  return {
29521
29604
  content: [
29522
29605
  {
29523
29606
  type: "text",
29524
- text: jsonText({
29525
- summary: {
29526
- title: page?.metadata?.title,
29527
- url: page?.metadata?.url,
29528
- description: page?.metadata?.description,
29529
- links,
29530
- buttons,
29531
- forms,
29532
- interactiveCount
29533
- },
29534
- page,
29535
- interactive,
29536
- nextStepHint: "\u5982\u679C\u9700\u8981\u770B\u89C6\u89C9\u6548\u679C\uFF0C\u7EE7\u7EED\u7528 capture_screenshot\uFF1B\u5982\u679C\u9700\u8981\u70B9\u51FB\u6216\u8F93\u5165\uFF0C\u7EE7\u7EED\u7528 dispatch_action\uFF1B\u5982\u679C\u9700\u8981\u6392\u67E5\u8BF7\u6C42\u6216\u6027\u80FD\uFF0C\u7EE7\u7EED\u7528 list_network_requests / perf_metrics\u3002"
29537
- })
29607
+ text: out(
29608
+ detail ? {
29609
+ summary,
29610
+ page,
29611
+ interactive,
29612
+ nextStepHint: "\u89C6\u89C9\u7528 capture_screenshot\uFF1B\u70B9\u51FB/\u8F93\u5165\u7528 get_interactive_snapshot + dispatch_action\uFF1B\u8BF7\u6C42/\u6027\u80FD\u7528 list_network_requests / perf_metrics\u3002"
29613
+ } : {
29614
+ summary,
29615
+ nextStepHint: "\u4F20 detail:true \u67E5\u770B\u5B8C\u6574 page/interactive\uFF1B\u89C6\u89C9\u7528 capture_screenshot\uFF1B\u4EA4\u4E92\u5148 get_interactive_snapshot \u518D dispatch_action\u3002"
29616
+ }
29617
+ )
29538
29618
  }
29539
29619
  ]
29540
29620
  };
@@ -29564,7 +29644,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29564
29644
  content: [
29565
29645
  {
29566
29646
  type: "text",
29567
- text: jsonText({
29647
+ text: out({
29568
29648
  service: "ghost-bridge",
29569
29649
  version: GHOST_BRIDGE_VERSION,
29570
29650
  role: isMainInstance ? "daemon (\u5E38\u9A7B WebSocket \u670D\u52A1)" : "\u4F1A\u8BDD\u5BA2\u6237\u7AEF (\u8FDE\u63A5\u5E38\u9A7B\u670D\u52A1)",
@@ -29587,43 +29667,43 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29587
29667
  }
29588
29668
  if (name === "list_tabs") {
29589
29669
  const res = await askChrome("listTabs");
29590
- return { content: [{ type: "text", text: jsonText(res) }] };
29670
+ return { content: [{ type: "text", text: out(shrinkListTabs(res, args)) }] };
29591
29671
  }
29592
29672
  if (name === "bind_tab") {
29593
29673
  const { name: targetName, tabId, urlContains, titleContains } = args;
29594
29674
  const res = await askChrome("bindTab", { name: targetName, tabId, urlContains, titleContains }, { timeoutMs: 1e4 });
29595
- return { content: [{ type: "text", text: jsonText(res) }] };
29675
+ return { content: [{ type: "text", text: out(res) }] };
29596
29676
  }
29597
29677
  if (name === "unbind_tab") {
29598
29678
  const { name: targetName } = args;
29599
29679
  const res = await askChrome("unbindTab", { name: targetName }, { timeoutMs: 1e4 });
29600
- return { content: [{ type: "text", text: jsonText(res) }] };
29680
+ return { content: [{ type: "text", text: out(res) }] };
29601
29681
  }
29602
29682
  if (name === "list_targets") {
29603
29683
  const res = await askChrome("listTargets");
29604
- return { content: [{ type: "text", text: jsonText(res) }] };
29684
+ return { content: [{ type: "text", text: out(res) }] };
29605
29685
  }
29606
29686
  if (name === "get_target_tab") {
29607
29687
  const res = await askChrome("getTargetTab");
29608
- return { content: [{ type: "text", text: jsonText(res) }] };
29688
+ return { content: [{ type: "text", text: out(res) }] };
29609
29689
  }
29610
29690
  if (name === "pin_current_tab") {
29611
29691
  const res = await askChrome("pinCurrentTab", {}, { timeoutMs: 1e4 });
29612
- return { content: [{ type: "text", text: jsonText(res) }] };
29692
+ return { content: [{ type: "text", text: out(res) }] };
29613
29693
  }
29614
29694
  if (name === "pin_tab") {
29615
29695
  const { tabId, urlContains, titleContains } = args;
29616
29696
  const res = await askChrome("pinTab", { tabId, urlContains, titleContains }, { timeoutMs: 1e4 });
29617
- return { content: [{ type: "text", text: jsonText(res) }] };
29697
+ return { content: [{ type: "text", text: out(res) }] };
29618
29698
  }
29619
29699
  if (name === "unpin_tab") {
29620
29700
  const res = await askChrome("unpinTab", {}, { timeoutMs: 1e4 });
29621
- return { content: [{ type: "text", text: jsonText(res) }] };
29701
+ return { content: [{ type: "text", text: out(res) }] };
29622
29702
  }
29623
29703
  if (name === "get_last_error") {
29624
29704
  const { target, severity = "error", limit = 20 } = args;
29625
29705
  const data = await askChrome("getLastError", { target, severity, limit });
29626
- return { content: [{ type: "text", text: jsonText(data) }] };
29706
+ return { content: [{ type: "text", text: out(data) }] };
29627
29707
  }
29628
29708
  if (name === "get_script_source") {
29629
29709
  const {
@@ -29648,7 +29728,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29648
29728
  content: [
29649
29729
  {
29650
29730
  type: "text",
29651
- text: jsonText({
29731
+ text: out({
29652
29732
  url: res?.url,
29653
29733
  scriptId: res?.scriptId,
29654
29734
  location: res?.location,
@@ -29666,39 +29746,39 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29666
29746
  const { target } = args;
29667
29747
  const durationMs = args.durationMs || 1500;
29668
29748
  const res = await askChrome("coverageSnapshot", { target, durationMs }, { timeoutMs: durationMs + 4e3 });
29669
- return { content: [{ type: "text", text: jsonText(res) }] };
29749
+ return { content: [{ type: "text", text: out(res) }] };
29670
29750
  }
29671
29751
  if (name === "find_by_string") {
29672
29752
  const { target, query, scriptUrlContains, maxMatches = 5 } = args;
29673
29753
  const res = await askChrome("findByString", { target, query, scriptUrlContains, maxMatches });
29674
- return { content: [{ type: "text", text: jsonText(res) }] };
29754
+ return { content: [{ type: "text", text: out(res) }] };
29675
29755
  }
29676
29756
  if (name === "symbolic_hints") {
29677
29757
  const res = await askChrome("symbolicHints", { target: args.target });
29678
- return { content: [{ type: "text", text: jsonText(res) }] };
29758
+ return { content: [{ type: "text", text: out(res) }] };
29679
29759
  }
29680
29760
  if (name === "eval_script") {
29681
29761
  const res = await askChrome("eval", { target: args.target, code: args.code });
29682
- return { content: [{ type: "text", text: jsonText(res) }] };
29762
+ return { content: [{ type: "text", text: out(res) }] };
29683
29763
  }
29684
29764
  if (name === "list_network_requests") {
29685
29765
  const { target, filter, method, status, resourceType, limit, priorityMode = "debug" } = args;
29686
29766
  const res = await askChrome("listNetworkRequests", { target, filter, method, status, resourceType, limit, priorityMode });
29687
- return { content: [{ type: "text", text: jsonText(res) }] };
29767
+ return { content: [{ type: "text", text: out(res) }] };
29688
29768
  }
29689
29769
  if (name === "get_network_detail") {
29690
29770
  const { target, requestId, includeBody } = args;
29691
29771
  const res = await askChrome("getNetworkDetail", { target, requestId, includeBody });
29692
- return { content: [{ type: "text", text: jsonText(res) }] };
29772
+ return { content: [{ type: "text", text: out(res) }] };
29693
29773
  }
29694
29774
  if (name === "clear_network_requests") {
29695
29775
  const res = await askChrome("clearNetworkRequests", { target: args.target });
29696
- return { content: [{ type: "text", text: jsonText(res) }] };
29776
+ return { content: [{ type: "text", text: out(res) }] };
29697
29777
  }
29698
29778
  if (name === "perf_metrics") {
29699
29779
  const { target, includeTimings, includeResources } = args;
29700
29780
  const res = await askChrome("perfMetrics", { target, includeTimings, includeResources });
29701
- return { content: [{ type: "text", text: jsonText(res) }] };
29781
+ return { content: [{ type: "text", text: out(res) }] };
29702
29782
  }
29703
29783
  if (name === "capture_screenshot") {
29704
29784
  const { target, format, quality, fullPage, clip } = args;
@@ -29721,12 +29801,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29721
29801
  };
29722
29802
  contents.push({
29723
29803
  type: "text",
29724
- text: jsonText(metadata)
29804
+ text: out(metadata)
29725
29805
  });
29726
29806
  return { content: contents };
29727
29807
  }
29728
29808
  if (name === "get_page_content") {
29729
- const { target, mode = "text", selector, maxLength = 5e4, includeMetadata = true } = args;
29809
+ const { target, mode = "text", selector, maxLength = 8e3, offset = 0, includeMetadata = true } = args;
29730
29810
  const validModes = ["text", "html", "structured"];
29731
29811
  if (mode && !validModes.includes(mode)) {
29732
29812
  return {
@@ -29736,18 +29816,33 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
29736
29816
  }]
29737
29817
  };
29738
29818
  }
29819
+ if (offset > 0 && mode === "text") {
29820
+ const selectorExpr = selector ? `(document.querySelector(${JSON.stringify(selector)}) || document.body)` : "document.body";
29821
+ const code = `(function(){try{var text=(${selectorExpr}).innerText||"";var start=${offset};var end=${offset + maxLength};return {content:text.slice(start,end),offset:start,totalLength:text.length,hasMore:text.length>end};}catch(e){return {error:e.message}}})()`;
29822
+ const res2 = await askChrome("eval", { target, code });
29823
+ return { content: [{ type: "text", text: out(res2) }] };
29824
+ }
29825
+ if (offset > 0 && mode === "html") {
29826
+ const res2 = await askChrome("getPageContent", { target, mode, selector, maxLength: offset + maxLength, includeMetadata: false });
29827
+ if (typeof res2?.content === "string") {
29828
+ res2.content = res2.content.slice(offset, offset + maxLength);
29829
+ res2.offset = offset;
29830
+ res2.hasMore = (res2.contentLength || 0) > offset + maxLength;
29831
+ }
29832
+ return { content: [{ type: "text", text: out(res2) }] };
29833
+ }
29739
29834
  const res = await askChrome("getPageContent", { target, mode, selector, maxLength, includeMetadata });
29740
- return { content: [{ type: "text", text: jsonText(res) }] };
29835
+ return { content: [{ type: "text", text: out(res) }] };
29741
29836
  }
29742
29837
  if (name === "get_interactive_snapshot") {
29743
29838
  const { target, selector, includeText, maxElements } = args;
29744
- const res = await askChrome("getInteractiveSnapshot", { target, selector, includeText, maxElements });
29745
- return { content: [{ type: "text", text: jsonText(res) }] };
29839
+ const res = await askChrome("getInteractiveSnapshot", { target, selector, includeText, maxElements: maxElements ?? 30 });
29840
+ return { content: [{ type: "text", text: out(res) }] };
29746
29841
  }
29747
29842
  if (name === "dispatch_action") {
29748
29843
  const { target, ref, action, value, key, deltaX, deltaY, waitMs } = args;
29749
29844
  const res = await askChrome("dispatchAction", { target, ref, action, value, key, deltaX, deltaY, waitMs }, { timeoutMs: 1e4 });
29750
- return { content: [{ type: "text", text: jsonText(res) }] };
29845
+ return { content: [{ type: "text", text: out(res) }] };
29751
29846
  }
29752
29847
  return { content: [{ type: "text", text: `\u672A\u77E5\u5DE5\u5177\uFF1A${name}` }] };
29753
29848
  } catch (e) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Ghost Bridge",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "description": "Zero-restart Chrome debugger bridge for Claude MCP, optimized for no-sourcemap production debugging.",
6
6
  "permissions": [
7
7
  "debugger",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghost-bridge",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Ghost Bridge: Zero-restart Chrome debugger bridge for Claude MCP. Includes CLI for easy setup.",