@mearl/client 3.1.0 → 3.1.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.en.md CHANGED
@@ -184,6 +184,8 @@ Session release affects only that session and keeps pages/environments by defaul
184
184
 
185
185
  `page_download` listens before clicking and returns a browser artifact. CLI `--output` or SDK `saveArtifact(artifact, absolutePath, { session })` exports in 256 KiB chunks. `page_upload.files` accepts caller absolute `{filePath}` or browser `{artifactId}`; `filePaths` remains browser-host paths. Files are limited to 256 MiB. Caller-saved outputs are independent of temporary artifacts. Session release cleans temporary artifacts; `keepArtifactIds` retains selected ones. Sessionless artifacts expire after one idle hour; host exit clears staging.
186
186
 
187
+ Through the Chrome extension, `files` transfers up to 256 MiB total per upload in chunks to file inputs in HTTP(S) documents without **Allow access to file URLs**. With `filePaths`, Chrome reads host files directly. This supports large files and sites that require native file selection events. The extension requires the setting for `filePaths`. Direct CDP uploads do not require the extension setting.
188
+
187
189
  Extension downloads require matching page referrers or an explicit expected `url`; unowned downloads are not guessed from recent files. CDP uses temporary directories only for managed browsers; shared browsers retain defaults and fail explicitly if Chrome provides no completed path. Timeouts may follow triggered downloads: inspect state before continuing. Session/download adapters support Extension/CDP; external action-handling Providers reject unsupported capabilities explicitly.
188
190
 
189
191
  ### External browser Providers
package/README.md CHANGED
@@ -184,6 +184,8 @@ mearl session_manage --session '<sessionId>' --payload '{"operation":"end","clos
184
184
 
185
185
  `page_download` 先监听再点击,返回浏览器文件产物;CLI `--output` 或 SDK `saveArtifact(artifact, absolutePath, { session })` 以 256 KiB 分块导出到调用方。`page_upload.files` 接受调用方绝对路径 `{filePath}` 或浏览器 `{artifactId}`,`filePaths` 仍指浏览器宿主路径。单文件最多 256 MiB;保存到调用方的结果独立于临时产物。会话释放清理临时产物,`keepArtifactIds` 可保留指定产物;无会话产物空闲一小时回收,宿主退出清理暂存。
186
186
 
187
+ 通过 Chrome 扩展连接时,`files` 支持 HTTP(S) 页面的文件输入框,分块传输合计最多 256 MiB,无需开启「允许访问文件网址」。`filePaths` 由 Chrome 直接读取宿主文件,适用于大文件或要求原生文件选择事件的站点,在扩展连接中需要开启该设置。直连 CDP 的上传无需此扩展设置。
188
+
187
189
  扩展捕获下载需要匹配来源页 referrer 或明确的预期 `url`,无法归属时不会认领最近下载。CDP 只在托管浏览器中使用临时下载目录,共享浏览器保持默认目录,Chrome 未返回完成文件路径时明确报错。下载超时可能已经触发,需检查现场再决定下一步。当前会话与下载适配 Extension/CDP;直接处理页面动作的外部 Provider 对不支持的能力明确报错。
188
190
 
189
191
  ### 外部浏览器 Provider
@@ -1,7 +1,5 @@
1
- import { PAGE_ACT_ACTIONS } from '@mearl/browser-core';
1
+ import { PAGE_ACT_ACTIONS, PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS, } from '@mearl/browser-core';
2
2
  const SEND_REQUEST_FILE_TRANSFER_TIMEOUT_MS = 120_000;
3
- // Remote Providers may stage files before forwarding a page upload.
4
- const PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS = 180_000;
5
3
  // Persistent Providers may need to synchronize remote state before closing an instance.
6
4
  const BROWSER_CLOSE_TIMEOUT_SEC = 18 * 60;
7
5
  function boundedNumber(value, fallback, minimum, maximum) {
@@ -967,8 +967,8 @@ export declare const COMMANDS: readonly [{
967
967
  readonly description: "目标标签页 ID";
968
968
  }];
969
969
  readonly result: readonly ["默认返回 { action, observation };action.success 只表示动作成功,业务效果需结合 observation 和目标状态判断。", "observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。", "包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。CLI 单次调用失败以退出码 1 结束;脚本需检查 action.success。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
970
- readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。"];
971
- readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"filePaths\":[\"/Users/me/photo.jpg\"]}'"];
970
+ readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。", "Chrome 扩展连接中,files 分块传输,单次合计最多 256 MiB。filePaths 由 Chrome 直接读取,需要开启「允许访问文件网址」。直连 CDP 无需此扩展设置。"];
971
+ readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"files\":[{\"filePath\":\"/Users/me/photo.jpg\"}]}'"];
972
972
  }, {
973
973
  readonly name: "page_snapshot";
974
974
  readonly description: "获取带 @ref 的页面结构快照,默认使用无障碍树,也可显式读取渲染 DOM";
package/dist/commands.js CHANGED
@@ -1088,9 +1088,10 @@ export const COMMANDS = [
1088
1088
  result: PAGE_ACTION_RESULT,
1089
1089
  notes: [
1090
1090
  '直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。',
1091
+ 'Chrome 扩展连接中,files 分块传输,单次合计最多 256 MiB。filePaths 由 Chrome 直接读取,需要开启「允许访问文件网址」。直连 CDP 无需此扩展设置。',
1091
1092
  ],
1092
1093
  examples: [
1093
- `page_upload --payload '{"tabId":12345,"selector":"#file-input","filePaths":["/Users/me/photo.jpg"]}'`,
1094
+ `page_upload --payload '{"tabId":12345,"selector":"#file-input","files":[{"filePath":"/Users/me/photo.jpg"}]}'`,
1094
1095
  ],
1095
1096
  },
1096
1097
  // ── 页面感知 ──────────────────────────────────────────────────────────────
@@ -123,6 +123,8 @@ JS
123
123
 
124
124
  `files` 与 `filePaths` 互斥。确认页面显示附件或上传成功的业务状态;外部 Provider 的文件能力按其当前帮助执行。
125
125
 
126
+ 通过 Chrome 扩展连接时,`files` 支持 HTTP(S) 页面的文件输入框,分块传输合计最多 256 MiB,无需开启「允许访问文件网址」。`filePaths` 由 Chrome 直接读取宿主文件,适用于大文件或要求原生文件选择事件的站点,在扩展连接中需要开启该设置。直连 CDP 的上传无需此扩展设置。
127
+
126
128
  ## page_download
127
129
 
128
130
  先监听下载,再执行 `trigger` 点击并等待下载完成。`trigger` 使用不含 `tabId` 的 `page_click` 参数;目标页面由顶层 `tabId` 指定。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mearl/client",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "Unified Mearl SDK & CLI for local and remote browsers",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -68,11 +68,11 @@
68
68
  "commander": "^14.0.3",
69
69
  "fastest-levenshtein": "^1.0.16",
70
70
  "ws": "^8.18.0",
71
- "@mearl/daemon-core": "3.1.0",
72
- "@mearl/provider": "3.1.0",
73
- "@mearl/cloud-types": "3.1.0",
74
- "@mearl/browser-core": "3.1.0",
75
- "@mearl/agent-runtime": "3.1.0"
71
+ "@mearl/daemon-core": "3.1.1",
72
+ "@mearl/cloud-types": "3.1.1",
73
+ "@mearl/provider": "3.1.1",
74
+ "@mearl/agent-runtime": "3.1.1",
75
+ "@mearl/browser-core": "3.1.1"
76
76
  },
77
77
  "devDependencies": {
78
78
  "@types/node": "^24.9.1",