page-recorder-mcp 1.8.0 → 1.8.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/README.md CHANGED
@@ -117,7 +117,7 @@ AI 会给每个接口起函数名(如 `searchProducts`),写标题、用途
117
117
  |---|---|
118
118
  | 导出脚本 .js | 可在浏览器执行的回放脚本,头部有自然语言写的步骤、接口说明和响应结构,适合交给 AI |
119
119
  | 复制说明 | Markdown 格式的步骤、接口、参数、响应结构和示例 |
120
- | 导出 JSON | 原始数据:全部请求和响应、工具定义(JSON Schema)、每个输入参数的说明(`paramInfo`) |
120
+ | 导出 JSON | 原始数据:全部请求和响应、工具定义(JSON Schema)、每个输入参数的说明(`paramInfo`)。也能「导入录制包」导回(录到的步骤、请求和 AI 写的接口说明都在,上传文件的路径要重新填),但不带来源页等录制状态,换机器优先用录制包 |
121
121
  | 导出录制包 | `<名称>.prpkg.json`,可以在另一台机器、另一个浏览器的脚本库里「导入录制包」(不带设置和 AI Key,请求已脱敏) |
122
122
 
123
123
  ### 脚本怎么执行
@@ -237,7 +237,7 @@ REST 接口(`/api/recordings/…/run`、`/call`)照旧返回完整的原始
237
237
 
238
238
  反过来,扩展不核对连上的是不是你的桥接:本机有程序抢先占住 17321 端口,扩展就会连上它、执行它发来的回放和调用。这一点不防,因为能这么做的一般是以你的身份运行的程序,它本来就能直接读你的文件和浏览器 Cookie。`--token` 防的是别的程序冒充扩展连桥接,防不了冒充桥接(口令是扩展连接时带过去的)。多人共用一台电脑时,不用的时候在扩展「设置」里关掉桥接连接。
239
239
 
240
- 自动更新时,桥接把自己这个 npm 包里的扩展文件写进扩展目录。npm 包由 GitHub Actions 带构建证明(provenance)发布,可以用 `npm audit signatures` 核验;不想自动更新的设 `PR_AUTO_UPDATE=0`,或在 AI 工具的配置里固定版本号(`npx page-recorder-mcp@1.8.0`)。
240
+ 自动更新时,桥接把自己这个 npm 包里的扩展文件写进扩展目录。npm 包由 GitHub Actions 带构建证明(provenance)发布,可以用 `npm audit signatures` 核验;不想自动更新的设 `PR_AUTO_UPDATE=0`,或在 AI 工具的配置里固定版本号(`npx page-recorder-mcp@1.8.1`)。
241
241
 
242
242
  可以直接对 Claude Code 说:
243
243
  > 用 page-recorder 看看脚本库,分析「商品搜索下单」每个接口是做什么的,把说明保存回去,然后搜索 macbook 第 2 页给我看结果。
package/background.js CHANGED
@@ -432,6 +432,7 @@ async function ingestRequest(c, ev, scrubbed) {
432
432
  // 发放接口按脱敏前的原值对(入库后令牌都打了码就对不上了);页面传来的同名字段不认
433
433
  ev = Object.assign({}, ev);
434
434
  delete ev.sources;
435
+ delete ev.generated; // 页面现算字段的标记只在打码时记
435
436
  const sources = PR_EXPORTER.findSources(ev, recentResponses);
436
437
  if (c.state.recording) rememberResponse(ev);
437
438
  // 追到发放接口的值是令牌一类(名字看不出来的也是):入库前按位置打码,直接请求时先调发放接口拿新的
@@ -2134,13 +2135,22 @@ function packageOf(item) {
2134
2135
  item: { name: item.name, description: item.description || '', state, events, apiOverrides: PR_EXPORTER.maskDeep(item.apiOverrides || {}, s.maskPasswords !== false), aiDocs: item.aiDocs || {} },
2135
2136
  };
2136
2137
  }
2138
+ // 别人给的 JSON 里的 __proto__ 键:复制对象时(Object.assign)会被当成原型,读到没经过地址校验的字段
2139
+ const noProto = (k, v) => (k === '__proto__' ? undefined : v);
2140
+ function untrusted(x) {
2141
+ if (typeof x === 'string') return JSON.parse(x, noProto);
2142
+ return x && typeof x === 'object' ? JSON.parse(JSON.stringify(x), noProto) : x;
2143
+ }
2137
2144
  async function importPackage(c, pkg) {
2138
- if (typeof pkg === 'string') { try { pkg = JSON.parse(pkg); } catch (e) { throw new Error('录制包不是有效的 JSON'); } }
2139
- if (!pkg || pkg.format !== 'page-recorder-package' || !pkg.item || !Array.isArray(pkg.item.events)) throw new Error('不是 Page Recorder 导出的录制包');
2145
+ try { pkg = untrusted(pkg); } catch (e) { throw new Error('录制包不是有效的 JSON'); }
2146
+ // 「导出 JSON」的文件也认:按里面的步骤、请求和接口说明还原
2147
+ const fromExport = PR_EXPORTER.exportedJson(pkg);
2148
+ if (fromExport) pkg = PR_EXPORTER.packageFromExport(pkg);
2149
+ if (!pkg || pkg.format !== 'page-recorder-package' || !pkg.item || !Array.isArray(pkg.item.events)) throw new Error('不是 Page Recorder 导出的录制包(.prpkg.json)或导出 JSON');
2140
2150
  if (pkg.version > 1) throw new Error(`录制包版本 ${pkg.version} 比扩展新,请先升级扩展`);
2141
2151
  const src = pkg.item;
2142
2152
  const events = src.events.filter((e) => e && typeof e === 'object' && (e.kind === 'step' || e.kind === 'request') && Number.isFinite(e.ts))
2143
- .map((e) => e.kind === 'step' && e.type === 'upload' ? { ...e, value: '', recordedValue: '' } : e);
2153
+ .map((e) => (e.kind !== 'step' ? e : PR_EXPORTER.bareStep(e.type === 'upload' ? { ...e, value: '', recordedValue: '' } : e)));
2144
2154
  if (!events.length) throw new Error('录制包里没有步骤');
2145
2155
  const id = uid();
2146
2156
  const state = Object.assign({}, src.state || {}, { id, recording: false });
@@ -2155,19 +2165,12 @@ async function importPackage(c, pkg) {
2155
2165
  const name = String(src.name || pkg.name || '导入的录制').slice(0, 100);
2156
2166
  if (!state.name) state.name = name;
2157
2167
  const item = { id, name, imported: true, description: String(src.description || ''), savedAt: Date.now(), state, events, apiOverrides: src.apiOverrides || {}, aiDocs: src.aiDocs || {}, settings: c.settings };
2158
- const cnt = counts({ events });
2159
- let params = {};
2160
- let direct = false;
2161
- try {
2162
- const A = PR_EXPORTER.analyze(events, c.settings, state, item.apiOverrides, item.aiDocs);
2163
- params = A.params;
2164
- direct = A.apis.some((a) => !a.ignore && /\{\{[^{}]+\}\}/.test(JSON.stringify(a.editParams || {})));
2165
- } catch (e) { /* ignore */ }
2166
- const entry = { id, name, description: item.description, startUrl: state.startUrl, savedAt: item.savedAt, steps: cnt.steps, requests: cnt.requests, hasDocs: !!(item.aiDocs && item.aiDocs.title), params, direct };
2167
- c.libIndex = [entry, ...c.libIndex];
2168
+ // 分析不了的进了脚本库也运行不了
2169
+ try { PR_EXPORTER.analyze(events, c.settings, state, item.apiOverrides, item.aiDocs); } catch (e) { throw new Error('录制包内容不对,分析不了:' + e.message); }
2170
+ c.libIndex = [libEntryOf(item), ...c.libIndex];
2168
2171
  await chrome.storage.local.set({ ['lib:' + id]: item, libIndex: c.libIndex });
2169
2172
  bridgeNotify('libraryChanged');
2170
- return { ok: true, id, name };
2173
+ return { ok: true, id, name, fromExport: fromExport || undefined };
2171
2174
  }
2172
2175
  // ---------- 合并:几条脚本按 AI 排好的顺序接成一条新脚本,原来的不动 ----------
2173
2176
  async function mergeRecordings(c, p) {
@@ -2226,6 +2229,7 @@ function libraryChunk(id, item, offset, limit) {
2226
2229
  return { chunk, done };
2227
2230
  }
2228
2231
  async function restoreLibItem(c, raw, sourceExtension) {
2232
+ raw = untrusted(raw);
2229
2233
  if (!validLibItem(raw)) throw new Error('本机保存的脚本格式不对');
2230
2234
  const deletedAt = ((await chrome.storage.local.get('libDeleted')).libDeleted || {})[raw.id] || 0;
2231
2235
  const cur = c.libIndex.find((x) => x.id === raw.id);
package/bridge/server.js CHANGED
@@ -992,7 +992,7 @@ const STATIC_TOOLS = [
992
992
  inputSchema: {
993
993
  type: 'object',
994
994
  properties: {
995
- pkg: { type: 'object', description: '录制包 JSON:{ "format": "page-recorder-package", "version": 1, "name": …, "item": {…} }', additionalProperties: true },
995
+ pkg: { type: 'object', description: '录制包 JSON:{ "format": "page-recorder-package", "version": 1, "name": …, "item": {…} };扩展「导出 JSON」的内容也行', additionalProperties: true },
996
996
  file: { type: 'string', description: '录制包文件的路径(.json 结尾,如 export_package 返回的 file)' },
997
997
  browser: Object.assign({}, BROWSER_PARAM, { description: '可选。多个浏览器资料都装了扩展时,指定导入到哪个浏览器:填 instanceId 或资料名。只连着一个浏览器时不用传' }),
998
998
  },
package/lib/exporter.js CHANGED
@@ -383,6 +383,7 @@ const PR_EXPORTER = (() => {
383
383
  if (Array.isArray(out.members) && out.members.some((x) => x && typeof x === 'object')) {
384
384
  out.members = out.members.map((x) => x && typeof x === 'object' ? maskStepUrls(x, true) : x);
385
385
  }
386
+ if (Array.isArray(out.memberSteps)) out.memberSteps = out.memberSteps.map((x) => x && typeof x === 'object' ? maskStepUrls(x, true) : x); // 导出 JSON 里语义步骤带着的原始操作
386
387
  return out;
387
388
  }
388
389
  // 导出原始请求时的脱敏:敏感请求头/响应头打码(按名字,非标准头再按值的样子),请求体里的密码、token 等字段清空
@@ -1365,11 +1366,14 @@ const PR_EXPORTER = (() => {
1365
1366
  // 被脱敏的字段(密码、令牌、签名):直接调用时用页面最新发出的同名字段值,拿不到就不发
1366
1367
  const masked = [];
1367
1368
  const pageGenerated = [];
1369
+ // 录制包、导出 JSON、本机备份里按位置打了码的页面现算字段:值没了,靠打码时记下的标记认(不然会当成用页面最新值补的脱敏字段)。
1370
+ // 每次调用都打了标记才算:合并进来的别的录制里同一接口还带着原值时,照原值判断
1371
+ const marked = (id) => a.calls.every((c) => Array.isArray(c.r.generated) && c.r.generated.includes(id));
1368
1372
  const rawQuery = queryOf(base.u);
1369
1373
  for (const sec of ['query', 'body']) {
1370
1374
  const raw = sec === 'query' ? rawQuery : bp.params;
1371
1375
  for (const [k, v] of Object.entries(orig[sec])) {
1372
- if (antiKey(k)) continue;
1376
+ if (antiKey(k) || marked(`${sec}.${k}`)) continue;
1373
1377
  if (v === '' && raw[k] !== '' && raw[k] != null && edit[sec][k] === '') {
1374
1378
  meta[`${sec}.${k}`] = '敏感字段,已脱敏:直接调用时用页面最新发出的值';
1375
1379
  masked.push(`${sec}.${k}`);
@@ -1411,13 +1415,13 @@ const PR_EXPORTER = (() => {
1411
1415
  for (const k of headerKeys) {
1412
1416
  const vals = a.calls.map((c) => (c.r.requestHeaders || {})[k]);
1413
1417
  if (DROP_HEADER.test(k) || sourced.has(`header.${k}`)) continue;
1414
- if (antiKey(k) || (!notGen(k) && everyNew(vals))) pageGenerated.push(`header.${k}`);
1418
+ if (antiKey(k) || marked(`header.${k}`) || (!notGen(k) && everyNew(vals))) pageGenerated.push(`header.${k}`);
1415
1419
  }
1416
1420
  for (const sec of ['query', 'body']) {
1417
1421
  for (const k of Object.keys(orig[sec] || {})) {
1418
1422
  if (sourced.has(`${sec}.${k}`) || masked.includes(`${sec}.${k}`) || tplNames(edit[sec][k]).length) continue;
1419
1423
  const vals = a.calls.map((c) => (fieldsOf(c)[sec] || {})[k]);
1420
- if (antiKey(k) || (!notGen(k) && everyNew(vals))) {
1424
+ if (antiKey(k) || marked(`${sec}.${k}`) || (!notGen(k) && everyNew(vals))) {
1421
1425
  pageGenerated.push(`${sec}.${k}`);
1422
1426
  meta[`${sec}.${k}`] = '页面每次请求现算的反爬串:直接请求不发旧值,由页面自己发';
1423
1427
  // 旧值发不了,也不该带去给 AI、导出:模板里清空(和录制值一样都是空,页面回放时也不会去改写页面现算的值)
@@ -1430,6 +1434,7 @@ const PR_EXPORTER = (() => {
1430
1434
  const ov = apiOverrides[name] || {};
1431
1435
  for (const sec of ['path', 'query', 'body']) {
1432
1436
  for (const [k, v] of Object.entries(ov[sec] || {})) {
1437
+ if (BAD_KEY_EXP(k)) continue;
1433
1438
  if (v && typeof v === 'object' && v.__deleted) delete edit[sec][k];
1434
1439
  else edit[sec][k] = v;
1435
1440
  }
@@ -2148,6 +2153,9 @@ const PR_EXPORTER = (() => {
2148
2153
  }
2149
2154
  function build(events, settings, state, apiOverrides, aiDocs) {
2150
2155
  const A = analyze(events, settings, state, apiOverrides, aiDocs);
2156
+ const on = (settings || {}).maskPasswords !== false;
2157
+ // 跟随输入参数的({{密码}})不是秘密,留着:导回时还认得出绑定
2158
+ const maskEdit = (k, v) => (typeof v === 'string' && /^\{\{[^{}]+\}\}$/.test(v) ? v : maskDeep({ [k]: v }, on)[k]);
2151
2159
  const raw = {
2152
2160
  generator: 'Page Recorder',
2153
2161
  exportedAt: new Date().toISOString(),
@@ -2157,7 +2165,16 @@ const PR_EXPORTER = (() => {
2157
2165
  title: A.title,
2158
2166
  steps: A.steps.map((s) => maskStepUrls(s, (settings || {}).maskPasswords !== false)),
2159
2167
  tools: toolSchemas(A),
2160
- apis: A.apis.map((a) => Object.assign({}, a, { rawResponse: undefined, url: maskUrl(a.url, true), requestHeaders: maskHeaderValues(a.requestHeaders, (settings || {}).maskHeaders !== false) })),
2168
+ // 改过的接口参数是用户自己填的,没经过入库脱敏:和录制包一样按名字打码
2169
+ apis: A.apis.map((a) => Object.assign({}, a, {
2170
+ rawResponse: undefined,
2171
+ url: maskUrl(a.url, true),
2172
+ pageUrl: maskUrl(a.pageUrl, on),
2173
+ hostUrl: maskUrl(a.hostUrl, on),
2174
+ requestHeaders: maskHeaderValues(a.requestHeaders, (settings || {}).maskHeaders !== false),
2175
+ editParams: Object.fromEntries(Object.entries(a.editParams || {}).map(([sec, o]) => [sec, Object.fromEntries(Object.entries(o || {}).map(([k, v]) => [k, maskEdit(k, v)]))])),
2176
+ toolArgs: (a.toolArgs || []).map((t) => (t.nested ? t : Object.assign({}, t, { default: maskEdit(t.key, t.default) }))),
2177
+ })),
2161
2178
  requests: maskGenerated(events, A).filter((e) => e.kind === 'request').sort((a, b) => a.ts - b.ts).map((r) => exportRequest(r, settings)),
2162
2179
  params: A.params,
2163
2180
  paramInfo: A.paramInfo,
@@ -2165,6 +2182,76 @@ const PR_EXPORTER = (() => {
2165
2182
  return { analysis: A, script: buildScript(A), raw, summary: buildSummary(A), bundle: bundleOf(A), tools: toolSchemas(A), prompt: aiPrompt(A) };
2166
2183
  }
2167
2184
 
2185
+ // 「导出 JSON」(给人和 AI 看的分析结果)导回成录制包:步骤、请求还原成录制事件,去掉分析时加上的字段(重新分析会再算出来;
2186
+ // 留着参数名的话,同一输入框较早那次不会重新起名);AI 写的接口说明、改过的接口参数从接口目录里带回来。没有来源页这些录制状态
2187
+ const ANALYZED_STEP = ['desc', 'requests', 'waitFor', 'param', 'overwrittenBy', 'dateOrder', 'memberSteps'];
2188
+ // 录制事件里本来没有这些字段;导入的文件带着(尤其预设的参数名)就去掉
2189
+ function bareStep(s) {
2190
+ const o = { ...s };
2191
+ for (const k of ANALYZED_STEP) delete o[k];
2192
+ return o;
2193
+ }
2194
+ function packageFromExport(x) {
2195
+ const isStep = (s) => !!(s && typeof s === 'object' && s.kind === 'step');
2196
+ const events = [];
2197
+ for (const s of Array.isArray(x.steps) ? x.steps : []) {
2198
+ if (!isStep(s)) continue;
2199
+ events.push(bareStep(maskStepUrls(s, true)));
2200
+ for (const m of Array.isArray(s.memberSteps) ? s.memberSteps : []) if (isStep(m)) events.push(bareStep(maskStepUrls(m, true)));
2201
+ }
2202
+ for (const r of Array.isArray(x.requests) ? x.requests : []) if (r && typeof r === 'object' && r.kind === 'request') events.push(r);
2203
+ const text = (v) => (typeof v === 'string' ? v : '');
2204
+ const docs = [];
2205
+ const overrides = [];
2206
+ let told = false;
2207
+ for (const a of Array.isArray(x.apis) ? x.apis : []) {
2208
+ if (!a || typeof a !== 'object' || typeof a.name !== 'string') continue;
2209
+ const params = (Array.isArray(a.toolArgs) ? a.toolArgs : [])
2210
+ .filter((t) => t && !t.nested && ['path', 'query', 'body'].includes(t.sec) && typeof t.key === 'string' && t.key && !BAD_KEY_EXP(t.key) && typeof t.desc === 'string' && t.desc)
2211
+ .map((t) => [`${t.sec}.${t.key}`, t.desc]);
2212
+ const said = !!(text(a.title) || text(a.description) || text(a.returns) || a.ignore === true || params.length);
2213
+ // 函数名不是自动起的(自动名或撞名后加的序号):只改了函数名也要带回来,不然工具名会变
2214
+ let auto = '';
2215
+ try { auto = autoFn(a); } catch (e) { /* 字段不全就当自己起的 */ }
2216
+ const fn = text(a.fn);
2217
+ const collided = (n) => x.apis.some((b) => b !== a && b && b.fn === n); // 撞名时先占的拿不带序号的名字
2218
+ const ownFn = !!fn && fn !== auto && !(auto && fn.startsWith(auto) && /^\d+$/.test(fn.slice(auto.length)) && collided(auto));
2219
+ if (said) told = true;
2220
+ if (said || ownFn) {
2221
+ docs.push([a.name, { fn, title: text(a.title), description: text(a.description), params: Object.fromEntries(params), returns: text(a.returns), ignore: a.ignore === true }]);
2222
+ }
2223
+ // 改过的参数:和录制值不同的记成改动,录制里有、改动里没有的记成删掉(相同的不记:打了码的值盖掉重新分析出的绑定)
2224
+ if (a.overridden && a.editParams && typeof a.editParams === 'object') {
2225
+ const ov = ['path', 'query', 'body'].map((sec) => {
2226
+ const edit = a.editParams[sec] && typeof a.editParams[sec] === 'object' ? a.editParams[sec] : {};
2227
+ const rec = a.params && a.params[sec] && typeof a.params[sec] === 'object' ? a.params[sec] : {};
2228
+ const has = (o, k) => Object.prototype.hasOwnProperty.call(o, k);
2229
+ const changed = Object.entries(edit).filter(([k, v]) => !has(rec, k) || JSON.stringify(v) !== JSON.stringify(rec[k]));
2230
+ const gone = Object.keys(rec).filter((k) => !has(edit, k)).map((k) => [k, { __deleted: true }]);
2231
+ return [sec, Object.fromEntries([...changed, ...gone])];
2232
+ }).filter(([, v]) => Object.keys(v).length);
2233
+ overrides.push([a.name, Object.fromEntries(ov)]);
2234
+ }
2235
+ }
2236
+ const name = text(x.name);
2237
+ const description = text(x.description);
2238
+ return {
2239
+ format: 'page-recorder-package',
2240
+ version: 1,
2241
+ exportedAt: x.exportedAt,
2242
+ name,
2243
+ item: {
2244
+ name,
2245
+ description,
2246
+ state: { startUrl: x.startUrl, name, description, title: text(x.title) },
2247
+ events,
2248
+ apiOverrides: Object.fromEntries(overrides),
2249
+ aiDocs: docs.length ? Object.assign(told ? { title: name || '导入的录制', description } : {}, { apis: Object.fromEntries(docs) }) : {},
2250
+ },
2251
+ };
2252
+ }
2253
+ const exportedJson = (x) => !!(x && typeof x === 'object' && x.generator === 'Page Recorder' && !x.format && Array.isArray(x.steps) && Array.isArray(x.requests));
2254
+
2168
2255
  // 分析时才认出的页面现算字段(名字看不出来的长乱串,入库时没打码):导出原始请求、录制包、备份前按接口和位置打码
2169
2256
  function maskGenerated(events, A) {
2170
2257
  const gen = new Map((A.apis || []).filter((a) => a.pageGenerated && a.pageGenerated.length).map((a) => [a.name, a.pageGenerated]));
@@ -2174,7 +2261,7 @@ const PR_EXPORTER = (() => {
2174
2261
  let u;
2175
2262
  try { u = new URL(e.url); } catch (x) { return e; }
2176
2263
  const f = gen.get(apiNameOf(e, u, A.mainHost));
2177
- return f ? maskSourced(e, Object.fromEntries(f.map((id) => [id, 1])), true) : e;
2264
+ return f ? Object.assign(maskSourced(e, Object.fromEntries(f.map((id) => [id, 1])), true), { generated: f }) : e;
2178
2265
  });
2179
2266
  }
2180
2267
  // 录制包、导出 JSON 里的一条请求:入库脱敏之外,再按对外导出的规则打码(请求头按名字和值、地址里的令牌、响应里的令牌)
@@ -2365,6 +2452,6 @@ const PR_EXPORTER = (() => {
2365
2452
  const refused = !!r.rejected || (r.status >= 400 && r.status < 500 && r.status !== 408 && r.status !== 429);
2366
2453
  return refused && /^(GET|HEAD)$/i.test(method || 'GET');
2367
2454
  }
2368
- return { analyze, build, pathTemplate, stepDesc, aiPrompt, toolSchemas, scrubRequest, exportRequest, maskDeep, maskUrl, maskStepUrls, sensitiveKey, antiKey, secretHeader, keyTokens, scrubBackup, canFallback, mergeRecordings, dynamicParam, stripDynamic, hasDynamic, pageKey, responseValues, findSources, maskSourced, maskGenerated, okCheck, writeApi, sideEffectApi };
2455
+ return { analyze, build, pathTemplate, stepDesc, aiPrompt, toolSchemas, scrubRequest, exportRequest, maskDeep, maskUrl, maskStepUrls, sensitiveKey, antiKey, secretHeader, keyTokens, scrubBackup, canFallback, mergeRecordings, packageFromExport, exportedJson, bareStep, dynamicParam, stripDynamic, hasDynamic, pageKey, responseValues, findSources, maskSourced, maskGenerated, okCheck, writeApi, sideEffectApi };
2369
2456
  })();
2370
2457
  if (typeof module !== 'undefined') module.exports = PR_EXPORTER;
package/manifest.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Page Recorder · 操作与接口录制",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "description": "录制页面操作,抓取接口请求与返回数据,导出为可在浏览器中执行、便于 AI 理解和调用的回放脚本。",
6
6
  "permissions": [
7
7
  "storage",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "page-recorder-mcp",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Record clicks and the fetch/XHR APIs behind them in your logged-in Chrome (including cross-origin iframes), then let AI tools replay them or call the APIs directly through MCP / HTTP. Zero dependencies. 录制页面操作和接口(含跨域 iframe),让 Claude Code、Accio 等 AI 工具通过 MCP / HTTP 在你已登录的浏览器里回放,或直接调用接口。",
5
5
  "keywords": [
6
6
  "mcp",
package/popup/popup.html CHANGED
@@ -112,7 +112,7 @@
112
112
  <button id="btnExportJs" class="primary">导出脚本 .js</button>
113
113
  <button id="btnCopyJs" class="ghost">复制脚本</button>
114
114
  <button id="btnCopyMd" class="ghost" title="Markdown 格式的步骤、接口与响应结构说明,适合直接发给 AI">复制说明</button>
115
- <button id="btnExportJson" class="ghost">导出 JSON</button>
115
+ <button id="btnExportJson" class="ghost" title="分析结果:步骤、请求和响应、接口说明,给人或 AI 看。也能「导入录制包」导回,但不带来源页等录制状态">导出 JSON</button>
116
116
  <button id="btnExportPkg" class="ghost" title="带版本号、已脱敏的录制包(.prpkg.json),可以在别的电脑或浏览器资料里「脚本库 → 导入录制包」导回">导出录制包</button>
117
117
  </footer>
118
118
 
package/popup/popup.js CHANGED
@@ -769,7 +769,7 @@ $('#pkgFile').addEventListener('change', async (e) => {
769
769
  }
770
770
  const r = await send({ type: 'importPackage', pkg });
771
771
  if (!r || r.error) { showNotice('导入录制包失败:' + esc((r && r.error) || '后台没有响应'), 'error'); return; }
772
- toast(`已导入「${r.name || f.name}」到脚本库`);
772
+ toast(`已导入「${r.name || f.name}」到脚本库${r.fromExport ? '(从导出 JSON 还原,不带来源页;换电脑优先用「导出录制包」)' : ''}`);
773
773
  await refresh(true);
774
774
  renderLibrary();
775
775
  });