@mearl/client 2.1.0 → 2.2.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/commands.js CHANGED
@@ -5,7 +5,7 @@ export const COMMANDS = [
5
5
  description: '获取最近的网络请求(mtop 或普通 xhr/fetch)',
6
6
  params: [
7
7
  { name: 'tabId', type: 'number', description: '目标标签页 ID,从 tab_list 获取' },
8
- { name: 'count', type: 'number', description: '返回条数,默认 20' },
8
+ { name: 'count', type: 'number', description: '返回条数,默认 10' },
9
9
  {
10
10
  name: 'source',
11
11
  type: '"mtop" | "requests"',
@@ -61,7 +61,11 @@ export const COMMANDS = [
61
61
  description: '获取 API 接口 schema(出入参定义)',
62
62
  params: [
63
63
  { name: 'api', type: 'string', required: true, description: 'API 名称' },
64
- { name: 'type', type: '"schema" | "hsf" | "all"', description: '返回类型,默认 all' },
64
+ {
65
+ name: 'fields',
66
+ type: '("schema" | "hsf")[]',
67
+ description: '指定返回内容;不填时返回全部可用内容',
68
+ },
65
69
  ],
66
70
  examples: [`get_api_schema --payload '{"api":"mtop.trade.order.detail"}'`],
67
71
  },
@@ -121,18 +125,30 @@ export const COMMANDS = [
121
125
  // ── 网络代理 ──────────────────────────────────────────────────────────────
122
126
  {
123
127
  name: 'send_request',
124
- description: '发送 HTTP 请求,自动携带浏览器 Cookie',
128
+ description: '发送 HTTP 请求,自动携带浏览器 Cookie,支持 multipart 文件上传',
125
129
  params: [
126
130
  { name: 'url', type: 'string', required: true, description: '完整目标 URL' },
127
131
  { name: 'method', type: 'string', description: 'HTTP 方法,默认 GET' },
128
132
  { name: 'headers', type: 'object', description: '自定义请求头' },
129
133
  { name: 'params', type: 'object', description: 'URL 查询参数' },
130
134
  { name: 'body', type: 'any', description: '请求体(传对象时自动 JSON 序列化)' },
135
+ {
136
+ name: 'formData',
137
+ type: 'object',
138
+ description: 'multipart 文本字段(值支持 string/number/boolean)',
139
+ },
140
+ {
141
+ name: 'files',
142
+ type: 'SendRequestFile[]',
143
+ description: 'multipart 文件,最多 20 个、总计不超过 40 MiB;Base64 文件总计不超过 7 MiB。每项传 fieldName 和绝对 filePath,或传 base64 + filename',
144
+ },
131
145
  { name: 'withCookies', type: 'boolean', description: '是否附加浏览器 Cookie,默认 true' },
132
- { name: 'cookieDomain', type: 'string', description: '指定 Cookie 域名,不填时从 url 提取' },
133
146
  { name: 'timeout', type: 'number', description: '超时毫秒数,默认 30000' },
134
147
  ],
135
- examples: [`send_request --payload '{"url":"https://api.example.com/data","method":"GET"}'`],
148
+ examples: [
149
+ `send_request --payload '{"url":"https://api.example.com/data","method":"GET"}'`,
150
+ `send_request --payload '{"url":"https://api.example.com/upload","method":"POST","formData":{"folder":"assets"},"files":[{"fieldName":"file","filePath":"/absolute/path/image.png"}]}'`,
151
+ ],
136
152
  },
137
153
  {
138
154
  name: 'send_mtop_request',
@@ -184,7 +200,7 @@ export const COMMANDS = [
184
200
  },
185
201
  {
186
202
  name: 'browser_release',
187
- description: '释放 Agent 对当前浏览器的调试控制,保留浏览器和全部标签页',
203
+ description: '按用户明确要求释放调试控制和会话级临时效果(含设备/时区模拟),保留浏览器和全部标签页;不用于普通任务收尾',
188
204
  examples: ['browser_release', 'browser_release --browser chrome-a'],
189
205
  },
190
206
  {
@@ -255,6 +271,11 @@ export const COMMANDS = [
255
271
  params: [
256
272
  { name: 'url', type: 'string', required: true, description: '要打开的 URL' },
257
273
  { name: 'active', type: 'boolean', description: '是否激活新 Tab,默认 false' },
274
+ {
275
+ name: 'openerTabId',
276
+ type: 'number',
277
+ description: '来源 Tab ID;用于把目标 Tab 关联到来源侧边栏对话',
278
+ },
258
279
  {
259
280
  name: 'closeExisting',
260
281
  type: 'boolean',
@@ -307,7 +328,7 @@ export const COMMANDS = [
307
328
  // ── 页面操作 ──────────────────────────────────────────────────────────────
308
329
  {
309
330
  name: 'page_click',
310
- description: '点击页面元素,支持 selector / text / point 三种定位方式;auto 在可见页按设备模拟状态使用可信 mouse/touch,隐藏页使用 DOM fallback',
331
+ description: '点击页面元素,支持 selector / text / point 三种定位方式;auto 在可见页按设备模拟状态使用可信 mouse/touch,隐藏页使用 DOM fallback;点击直接打开新标签页时 observation.openedTabs 返回目标信息',
311
332
  params: [
312
333
  {
313
334
  name: 'selector',
@@ -658,7 +679,7 @@ export const COMMANDS = [
658
679
  // ── 移动端模拟 ────────────────────────────────────────────────────────────
659
680
  {
660
681
  name: 'set_device_emulation',
661
- description: '把目标 tab 切换为移动端模拟(视口/UA/触摸),等价 DevTools 设备工具栏,作用域 per-tab',
682
+ description: '把目标 tab 切换为移动端模拟(视口/UA/触摸),等价 DevTools 设备工具栏,作用域 per-tab;需保持调试控制才持续生效',
662
683
  params: [
663
684
  { name: 'enabled', type: 'boolean', required: true, description: 'true=启用,false=清除' },
664
685
  {
@@ -799,4 +820,4 @@ export const COMMANDS = [
799
820
  ],
800
821
  },
801
822
  ];
802
- export const COMMAND_MAP = new Map(COMMANDS.map(c => [c.name, c]));
823
+ export const COMMAND_MAP = new Map(COMMANDS.map(command => [command.name, command]));