@mearl/client 2.22.0 → 3.0.0-beta.0
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/LICENSE +201 -0
- package/README.md +40 -40
- package/dist/actionTimeouts.js +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/autoUpdate.js +1 -2
- package/dist/browserRegistry.d.ts +1 -1
- package/dist/check.d.ts +1 -1
- package/dist/check.js +4 -3
- package/dist/commands.d.ts +12 -12
- package/dist/commands.js +15 -14
- package/dist/index.d.ts +4 -7
- package/dist/index.js +1 -1
- package/dist/local.d.ts +3 -1
- package/dist/local.js +2 -1
- package/dist/pageEvalArguments.d.ts +1 -1
- package/dist/pageEvalArguments.js +1 -1
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +1 -0
- package/dist/pluginModelSessionWorker.d.ts +2 -2
- package/dist/plugins/clients/pluginHostConnection.d.ts +1 -1
- package/dist/plugins/clients/pluginHostConnection.js +1 -1
- package/dist/plugins/clients/pluginModels.d.ts +3 -3
- package/dist/plugins/clients/pluginPages.d.ts +2 -2
- package/dist/plugins/clients/pluginState.d.ts +2 -2
- package/dist/plugins/clients/pluginTasks.d.ts +3 -3
- package/dist/plugins/clients/pluginTasks.js +1 -1
- package/dist/plugins/officialPluginCatalog.d.ts +18 -21
- package/dist/plugins/officialPluginCatalog.js +120 -24
- package/dist/plugins/officialPluginInstaller.js +6 -1
- package/dist/plugins/pluginRegistry.d.ts +1 -1
- package/dist/plugins/pluginRegistry.js +2 -2
- package/dist/plugins/pluginTaskProtocol.d.ts +1 -1
- package/dist/plugins/runtime/pluginDiagnostics.d.ts +3 -3
- package/dist/plugins/runtime/pluginDiagnostics.js +2 -2
- package/dist/plugins/runtime/pluginExecution.d.ts +2 -2
- package/dist/plugins/runtime/pluginExecutor.d.ts +1 -1
- package/dist/plugins/runtime/pluginExecutorProtocol.d.ts +2 -2
- package/dist/plugins/runtime/pluginHost.d.ts +2 -2
- package/dist/plugins/runtime/pluginHostServer.js +1 -1
- package/dist/plugins/runtime/pluginModelCatalog.d.ts +1 -1
- package/dist/plugins/runtime/pluginPageManager.d.ts +3 -3
- package/dist/plugins/runtime/pluginPageManager.js +2 -2
- package/dist/plugins/runtime/pluginRevision.js +2 -1
- package/dist/plugins/runtime/pluginStateManager.d.ts +1 -1
- package/dist/plugins/runtime/pluginStateStore.d.ts +1 -1
- package/dist/plugins/runtime/pluginTaskManager.d.ts +10 -10
- package/dist/plugins/runtime/pluginTaskManager.js +1 -1
- package/dist/plugins/runtime/pluginTaskStore.d.ts +3 -3
- package/dist/plugins/runtime/pluginTaskStore.js +1 -1
- package/dist/plugins/runtime/pythonPlugin.d.ts +1 -1
- package/dist/plugins/sdk/plugin.d.ts +9 -12
- package/dist/plugins/sdk/plugin.js +4 -7
- package/dist/plugins/sdk/pluginAppProfiles.d.ts +1 -1
- package/dist/plugins/sdk/pluginAppProfiles.js +1 -1
- package/dist/plugins/sdk/pluginModelDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginPageDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginPageDefinition.js +1 -1
- package/dist/plugins/sdk/pluginRecoveryDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginStateDefinition.d.ts +2 -2
- package/dist/plugins/skillManifest.d.ts +10 -0
- package/dist/plugins/skillManifest.js +56 -0
- package/dist/socket.d.ts +2 -0
- package/dist/socket.js +13 -3
- package/dist/unified.d.ts +1 -1
- package/dist/unified.js +1 -1
- package/package.json +9 -8
- package/dist/generated/app-profile-definition.d.ts +0 -130
- package/dist/generated/app-profile-definition.js +0 -458
- package/dist/generated/app-profile-runtime-types.d.ts +0 -213
- package/dist/generated/app-profile-runtime-types.js +0 -1
- package/dist/generated/browser-action-protocol.d.ts +0 -1147
- package/dist/generated/browser-action-protocol.js +0 -283
- package/dist/generated/plugin-diagnostics.d.ts +0 -110
- package/dist/generated/plugin-diagnostics.js +0 -1
- package/dist/generated/plugin-execution.d.ts +0 -27
- package/dist/generated/plugin-execution.js +0 -1
- package/dist/generated/plugin-models.d.ts +0 -64
- package/dist/generated/plugin-models.js +0 -1
- package/dist/generated/plugin-pages.d.ts +0 -76
- package/dist/generated/plugin-pages.js +0 -59
- package/dist/generated/plugin-recovery.d.ts +0 -32
- package/dist/generated/plugin-recovery.js +0 -1
- package/dist/generated/plugin-state.d.ts +0 -50
- package/dist/generated/plugin-state.js +0 -1
- package/dist/generated/plugin-tasks.d.ts +0 -74
- package/dist/generated/plugin-tasks.js +0 -7
- package/dist/generated/toolbox-icon.d.ts +0 -10
- package/dist/generated/toolbox-icon.js +0 -37
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @mearl/client
|
|
2
2
|
|
|
3
|
+
本仓库仍在迁移完整宿主。此包已可独立构建和测试,setup/native-host/extension 的公开发行接入尚未完成;下列产品命令描述其现有合同,不代表已发布 3.0。
|
|
4
|
+
|
|
3
5
|
统一浏览器 SDK 与 CLI。它会发现当前机器及已配置 cloud-server 下所有 connector 的浏览器,并根据 `browser_list` 返回的全局 `browserId` 自动选择本地 Socket 或云端 WebSocket 链路。
|
|
4
6
|
|
|
5
7
|
提供两种用法:类型安全的具名方法(`getRequests`、`sendRequest` 等),以及灵活的底层 `invoke(action, payload)`。
|
|
@@ -103,15 +105,13 @@ Provider 浏览器与扩展、CDP 浏览器一起出现在 `browser_list` 中,
|
|
|
103
105
|
全局 `browserId` 参与路由。Provider 的安装、更新和卸载由 `@mearl/setup` 管理:
|
|
104
106
|
|
|
105
107
|
```bash
|
|
106
|
-
npx @mearl/setup provider install @
|
|
107
|
-
npx @mearl/setup provider install @ali/mearl-provider-agentbay
|
|
108
|
+
npx @mearl/setup provider install @example/mearl-provider-device
|
|
108
109
|
|
|
109
110
|
# 查看 Provider 当前版本的能力、参数与使用流程
|
|
110
|
-
mearl
|
|
111
|
-
mearl agentbay --help
|
|
111
|
+
mearl example-device --help
|
|
112
112
|
|
|
113
113
|
# Provider 启动参数统一放在 providerOptions
|
|
114
|
-
mearl browser_launch --payload '{"provider":"
|
|
114
|
+
mearl browser_launch --payload '{"provider":"example-device","providerOptions":{}}'
|
|
115
115
|
mearl browser_list
|
|
116
116
|
|
|
117
117
|
# 后续操作使用 browser_list 返回的全局 Browser ID
|
|
@@ -190,15 +190,13 @@ client、native-host、cloud-server 和 MCP server 的已安装版本。发现
|
|
|
190
190
|
安装 skill 并自动注册命令,或直接注册已有入口:
|
|
191
191
|
|
|
192
192
|
```bash
|
|
193
|
-
npx @mearl/setup plugin install
|
|
194
|
-
npx @mearl/setup plugin
|
|
195
|
-
npx @mearl/setup plugin
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
mearl
|
|
199
|
-
mearl
|
|
200
|
-
mearl yuque --help
|
|
201
|
-
mearl yuque --version
|
|
193
|
+
npx @mearl/setup plugin install https://github.com/F-loat/mearl --skill browser-tab-manager --yes
|
|
194
|
+
npx @mearl/setup plugin /absolute/path/to/browser-tab-manager
|
|
195
|
+
npx @mearl/setup plugin uninstall tabs
|
|
196
|
+
mearl tabs summary
|
|
197
|
+
mearl tabs --payload '{"command":"summary","input":{}}'
|
|
198
|
+
mearl tabs --help
|
|
199
|
+
mearl tabs --version
|
|
202
200
|
```
|
|
203
201
|
|
|
204
202
|
当已注册插件与 Provider 使用同一名称时,`mearl <name> --help` 会先显示 Provider 的启动和生命周期说明,
|
|
@@ -209,21 +207,7 @@ Provider 与插件仍可独立安装、更新和卸载,帮助聚合不会启
|
|
|
209
207
|
注册动作、`app.invoke(action, payload, options?)` 复用当前浏览器上下文,并用 `app.progress(message)` 报告可选进度。JavaScript 插件还可传入 `{ message, data }`,让工具页通过可 JSON 序列化的 `data` 获取稳定的阶段、对象 ID 等机器信息;CLI 仍只显示 `message`。Python 的 `app.invoke` 是同步调用,handler 可以是普通函数或 `async def`。Python 插件要求 `python3 >= 3.9`,可用 `MEARL_PYTHON` 指定解释器路径;Mearl 不安装 Python 或执行 `pip install`。调用另一个插件时,payload 使用 `{ command, input }` envelope;嵌套调用继承宿主选项并拒绝循环依赖。CLI 默认只输出最终结果,传入
|
|
210
208
|
`--verbose` 时才把进度写入 stderr。handler 返回文本或 JSON,宿主统一处理 `--output`、连接和错误。写命令在用户调用后直接执行,业务模块负责目标、状态、幂等和结果校验。
|
|
211
209
|
注册名优先使用显式名称,其次读取入口的 `name` metadata,最后回退到 skill 目录名;常规注册只传路径。
|
|
212
|
-
setup 会补齐缺失或低于自身版本的 client、native-host
|
|
213
|
-
|
|
214
|
-
`mearl-bbrowser` Skill 提供 `bbrowser` 插件,可直接加载 bb-browser 格式的社区及私有站点适配器,无需安装 bb-browser:
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
npx @mearl/setup plugin install trip/mearl --skill mearl-bbrowser --yes
|
|
218
|
-
mearl bbrowser site list
|
|
219
|
-
mearl bbrowser site fliggy-ebooking/whoami
|
|
220
|
-
mearl bbrowser site ./fliggy-ebooking/ai-agent.js
|
|
221
|
-
mearl bbrowser site zhihu/hot 10
|
|
222
|
-
mearl bbrowser site zhihu/hot 10 --cdp
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
插件通过同一 `page_eval` 接口调用扩展或直连 CDP。适配器来源、私有目录、更新与结构化调用见
|
|
226
|
-
[mearl-bbrowser Skill](../skills/mearl-bbrowser/SKILL.md)。插件默认输出 JSON。
|
|
210
|
+
setup 会补齐缺失或低于自身版本的 client、native-host;安装参数由 setup 的 Skills 安装器处理,并固定全局共享安装。
|
|
227
211
|
|
|
228
212
|
需要单独检查插件时运行 `mearl <name> --version`。命令会解析注册记录并加载入口,但不连接浏览器;
|
|
229
213
|
退出码为 0 表示插件已注册且入口可加载,stdout 返回同目录 `SKILL.md` 的版本,缺少版本元数据时返回 `unknown`。
|
|
@@ -242,13 +226,13 @@ skill 的字段约定处理。`browser`、`timeout`、`output` 等宿主选项
|
|
|
242
226
|
import { invokePlugin } from '@mearl/client';
|
|
243
227
|
|
|
244
228
|
const result = await invokePlugin(
|
|
245
|
-
'
|
|
246
|
-
{ command: '
|
|
229
|
+
'tabs',
|
|
230
|
+
{ command: 'summary', input: {} },
|
|
247
231
|
{ browser: 'work' },
|
|
248
232
|
);
|
|
249
233
|
```
|
|
250
234
|
|
|
251
|
-
MCP Server 通过固定工具 `plugin_invoke` 接受同样的 `plugin`、`command` 和 `input`,不会把插件子命令动态扩展成 MCP 工具。SDK 与 MCP
|
|
235
|
+
MCP Server 通过固定工具 `plugin_invoke` 接受同样的 `plugin`、`command` 和 `input`,不会把插件子命令动态扩展成 MCP 工具。SDK 与 MCP 不接受任意入口路径;本地受管理目录中的插件未注册时,会通过匹配当前 client 版本的 setup 自动安装并重试一次。目录由安装宿主显式保存,核心没有组织专属名单;其他未注册名称返回 `PLUGIN_NOT_REGISTERED`。
|
|
252
236
|
|
|
253
237
|
长命令使用本机持久任务服务。服务按注册目录隔离并自动启动,CLI、SDK、MCP 与工具箱共享任务记录;调用方退出不取消执行。服务重启后将未完成任务标记为 `interrupted`,不自动重放。后台任务固定接受时的源码快照、工作目录与环境;静态第三方 JS 依赖需要预先打包进 Skill,状态文件放在源码目录之外。
|
|
254
238
|
|
|
@@ -275,16 +259,24 @@ try {
|
|
|
275
259
|
`tasks.diagnose({ taskId?, plugin?, instanceId?, includeErrorMessages?, includeLocalPaths? })` 读取当前调用范围内的有界诊断报告。默认不包含业务输入、提示词、进度正文、检查点数据、结果正文、完整 URL、环境变量和凭证,也省略错误消息及本地路径;后两项可显式选择包含。报告的 coverage 和历史 gap 表示采集范围及保留历史限制。
|
|
276
260
|
|
|
277
261
|
注册记录在 `~/.mearl/plugins/<name>.json`,保存入口路径和可选的简短描述;skill 业务代码原地更新直接生效,换路径或更新描述后重新注册。
|
|
278
|
-
`plugin uninstall <name>` 会对 `~/.agents/skills` 中的全局 Skill 调用
|
|
279
|
-
成功后清除相关注册;即使入口目录已被手动删除,也会完成
|
|
262
|
+
`plugin uninstall <name>` 会对 `~/.agents/skills` 中的全局 Skill 调用 Skills 安装器执行全局卸载,
|
|
263
|
+
成功后清除相关注册;即使入口目录已被手动删除,也会完成 Skills 跟踪记录的清理。
|
|
280
264
|
手工路径只解除注册并保留源码。
|
|
281
265
|
`PLUGIN_NOT_REGISTERED` 表示插件尚未注册。`PLUGIN_ENTRY_MISSING` 会显示失效入口,并给出带有实际插件名的
|
|
282
266
|
卸载清理命令。其他错误按实际原因处理。
|
|
283
|
-
|
|
267
|
+
下文描述插件工具箱、页面、状态与任务的通用合同。
|
|
284
268
|
|
|
285
269
|
插件可选导出 `toolbox`,注册后会出现在扩展 Popup 的工具箱中。页面资源放在 Skill 目录内,注册时由
|
|
286
270
|
Mearl 将入口 HTML 引用的本地 CSS、JavaScript 和图片内联为不可变页面包,不需要启动 HTTP 服务,
|
|
287
|
-
也不要求普通 HTML/CSS/JS
|
|
271
|
+
也不要求普通 HTML/CSS/JS 页面自行构建。
|
|
272
|
+
|
|
273
|
+
右键工具箱中的工具可单独禁用或启用对应 Skill;禁用状态显示在标题右侧,工具页面和命令仍可使用。禁用将该目录的
|
|
274
|
+
`SKILL.md` 重命名为 `SKILL.md.mearl-disabled`,启用时恢复,作用于共享此目录的所有 Agent;
|
|
275
|
+
软链接安装会作用于源目录。已有会话可能仍保留已载入的 Skill,需要重启 Agent 或新建会话。
|
|
276
|
+
工具箱内更新和重新安装会保留禁用状态;外部安装器的更新不受此状态管理,若出现两份清单,需先处理冲突。
|
|
277
|
+
独立复制安装的同名 Skill 需分别禁用。没有 Skill 清单的普通插件不显示此开关。
|
|
278
|
+
|
|
279
|
+
工具箱元数据示例:
|
|
288
280
|
|
|
289
281
|
```javascript
|
|
290
282
|
export const toolbox = {
|
|
@@ -458,7 +450,7 @@ pnpm typecheck # 仅类型检查
|
|
|
458
450
|
|
|
459
451
|
## License
|
|
460
452
|
|
|
461
|
-
|
|
453
|
+
Apache-2.0
|
|
462
454
|
|
|
463
455
|
### 插件页面实例
|
|
464
456
|
|
|
@@ -476,7 +468,7 @@ try {
|
|
|
476
468
|
} finally { pages.disconnect(); }
|
|
477
469
|
```
|
|
478
470
|
|
|
479
|
-
后台事件声明 schema 和串行、latest 合并或有限并发策略,处理器用 `app.runtimeCommand()` 注册并通过 `context.page` 访问固定文档。文档绑定任务可用 `app.page('activation')` 只读查询本插件激活规则,不允许设置或关闭规则。页面消息/结果各上限 24 MiB,宿主自动分块并校验;事件负载上限 32 KiB。工具箱使用 `host.page.*`,UI 订阅实例历史与后台执行独立。完整契约见 [插件宿主能力](
|
|
471
|
+
后台事件声明 schema 和串行、latest 合并或有限并发策略,处理器用 `app.runtimeCommand()` 注册并通过 `context.page` 访问固定文档。文档绑定任务可用 `app.page('activation')` 只读查询本插件激活规则,不允许设置或关闭规则。页面消息/结果各上限 24 MiB,宿主自动分块并校验;事件负载上限 32 KiB。工具箱使用 `host.page.*`,UI 订阅实例历史与后台执行独立。完整契约见 [插件宿主能力](../../docs/plugin-runtime.md#页面运行时和事件)。
|
|
480
472
|
|
|
481
473
|
Python 入口同样导出 `pageRuntime` 字典,其中 `code` 仍是运行于网页中的 JavaScript 函数字符串;后台初始化与事件处理器通过 `app.runtimeCommand(...)` 或其装饰器注册。`app.page(operation, payload)`、`context.page.send(message)` 和 `context.page.get()` 都是同步调用,后两者仅在绑定页面实例的处理器中可用。JS 和 Python 的 `context.page.send(message, {timeoutSec: 120})` 可指定单次响应超时(大于 0 且最多 300 秒,Python 使用字典);`app.page("send", {instanceId, message, timeoutSec})` 和 SDK `pages.send(plugin, instanceId, message, {timeoutSec})` 同样支持。该设置不改变其他请求,任务取消和文档解绑仍立即中断执行,传输失败也会取消对应网页请求。runtime-only 命令不出现在公开命令帮助中,也不能由 CLI 或工具箱直接执行;声明在页面事件中的普通 `app.command` 仍保留公开调用能力。
|
|
482
474
|
|
|
@@ -512,7 +504,7 @@ export default app => app.command('save', async (input, context) => {
|
|
|
512
504
|
});
|
|
513
505
|
```
|
|
514
506
|
|
|
515
|
-
SDK `PluginStateClient.get/getMany/list/transact` 与工具箱 `host.state.*` 共享集合。每次写入需 CAS,冲突后重新读取、合并再重试;`schemaVersion` 升级用显式迁移事务。浏览器会话/实例可声明 `cache` 或 `memory`,页面身份由宿主验证。`memory` 只保存在插件执行宿主进程中,支持同样的 CAS、schema、TTL 与分块值限制;刷新文档时保留浏览器会话范围,浏览器会话变化后隔离,执行宿主重启时清空。内存状态全宿主合计最多 128 MiB / 512 个集合命名空间,按需占用;单集合 `maxBytes` 最大 128 MiB,实例结束释放其内存。容量、TTL 和完整契约见[插件宿主能力](
|
|
507
|
+
SDK `PluginStateClient.get/getMany/list/transact` 与工具箱 `host.state.*` 共享集合。每次写入需 CAS,冲突后重新读取、合并再重试;`schemaVersion` 升级用显式迁移事务。浏览器会话/实例可声明 `cache` 或 `memory`,页面身份由宿主验证。`memory` 只保存在插件执行宿主进程中,支持同样的 CAS、schema、TTL 与分块值限制;刷新文档时保留浏览器会话范围,浏览器会话变化后隔离,执行宿主重启时清空。内存状态全宿主合计最多 128 MiB / 512 个集合命名空间,按需占用;单集合 `maxBytes` 最大 128 MiB,实例结束释放其内存。容量、TTL 和完整契约见[插件宿主能力](../../docs/plugin-runtime.md#状态和激活)。二进制资产继续使用文件或资源通道。
|
|
516
508
|
|
|
517
509
|
### 显式任务恢复
|
|
518
510
|
|
|
@@ -520,7 +512,7 @@ SDK `PluginStateClient.get/getMany/list/transact` 与工具箱 `host.state.*`
|
|
|
520
512
|
|
|
521
513
|
`tasks.checkpoint(taskId)` 读取检查点;`tasks.resume(taskId, { environment?, revision? })` 为终态根命令建立新 attempt,保持旧任务终态,固定原安装、源码快照、输入、目录和路由。默认提交调用进程的新环境,旧环境不持久化。恢复入口读取 `context.recovery`,先核对外部操作状态;宿主不重放原 handler,也不保证外部提交与检查点原子。
|
|
522
514
|
|
|
523
|
-
SDK 使用 `tasks.checkpoint(taskId)` / `tasks.resume(taskId)`。当前仅支持 public/service 根命令,拒绝模型、子任务、页面绑定和 caller 路由恢复,且必须确认原执行树已经停止。默认固定原代码;显式 `revision: 'current'` 选择请求进入时的当前快照。同格式版本需 schema 相同,跨格式版本需目标 `taskRecovery` 声明 `migrateFrom: [{ version, schema }]` 并注册隐藏 `app.checkpointMigration(command, handler)`,返回目标检查点数据。宿主先核验历史 schemaHash,禁止转换中的宿主及嵌套插件 API,以 10 秒期限管理进程;转换必须可重试、无副作用,可信代码不构成 OS 沙箱。并发恢复合并为一个转换与后继任务,旧任务和数据保持不变。完整资格与故障域见[检查点与显式恢复](
|
|
515
|
+
SDK 使用 `tasks.checkpoint(taskId)` / `tasks.resume(taskId)`。当前仅支持 public/service 根命令,拒绝模型、子任务、页面绑定和 caller 路由恢复,且必须确认原执行树已经停止。默认固定原代码;显式 `revision: 'current'` 选择请求进入时的当前快照。同格式版本需 schema 相同,跨格式版本需目标 `taskRecovery` 声明 `migrateFrom: [{ version, schema }]` 并注册隐藏 `app.checkpointMigration(command, handler)`,返回目标检查点数据。宿主先核验历史 schemaHash,禁止转换中的宿主及嵌套插件 API,以 10 秒期限管理进程;转换必须可重试、无副作用,可信代码不构成 OS 沙箱。并发恢复合并为一个转换与后继任务,旧任务和数据保持不变。完整资格与故障域见[检查点与显式恢复](../../docs/plugin-runtime.md#检查点与显式恢复)。
|
|
524
516
|
|
|
525
517
|
插件 CLI 调用失败以非零退出码和 stderr JSON `{ "error": { "code", "message" } }` 返回,保留 SDK/MCP 的 code,不输出任意异常附加字段。`PLUGIN_TASK_WAIT_TIMEOUT` 仅停止等待;`PLUGIN_EXECUTION_CANCELLED` / `PLUGIN_EXECUTION_DEADLINE` 表示执行取消或到期;`PLUGIN_PAGE_TARGET_CHANGED` / `PLUGIN_PAGE_INVALIDATED` 要求重新获取页面实例;`PLUGIN_STATE_CONFLICT` 需重新读取 CAS 版本;`PLUGIN_MODEL_CAPABILITY_UNSUPPORTED` 表示声明能力不支持;`PLUGIN_INVOCATION_CYCLE` / `PLUGIN_INVOCATION_DEPTH` 拒绝循环或过深组合。进程树无法确认停止时保留失败记录并拒绝恢复。
|
|
526
518
|
|
|
@@ -532,3 +524,11 @@ SDK 使用 `tasks.checkpoint(taskId)` / `tasks.resume(taskId)`。当前仅支持
|
|
|
532
524
|
插件宿主由 `PluginHost` 组装任务、状态、页面与模型目录服务,统一关闭和诊断。`PluginTaskManager` 接收明确的服务依赖并管理执行树;页面和状态服务不反向修改调度器。SDK 的连接、服务发现、握手、重连和调用桥接由 `PluginHostConnection` 管理。需要共享连接时,在 Task/Model/State 客户端构造选项中传入 `connection`,Page 客户端通过第二个构造参数传入;注入连接由创建者关闭,各客户端的 `disconnect()` 只关闭自己创建的连接。连接始终绑定单个调用范围,不能跨插件、交互渠道或来源复用。
|
|
533
525
|
|
|
534
526
|
后台连续模型调用可以显式传 `conversation`(1–80 个字母、数字或 `:_-`)。同名会话仅在当前页面实例或宿主管理的当前命令执行内复用;插件、版本、模型、指令、环境和调用归属分别隔离。未指定时每次调用独立。页面解除绑定或命令结束会释放会话;取消、失败和超时会销毁当前会话,空闲 5 分钟释放,每 32 轮重新建立临时会话以限制历史增长。会话仅驻留内存,不新增顶层 CLI/MCP 命令。
|
|
527
|
+
|
|
528
|
+
## 受管理插件目录
|
|
529
|
+
|
|
530
|
+
安装宿主可通过 client/plugin 的 replaceOfficialPluginCatalog(revision, plugins) 保存已选 preset 的插件目录。revision 为确切清单摘要,每项声明 description、skill 和安装器参数 installArgs,可选 setup 分组。目录以原子文件替换保存于当前插件注册目录的 .official-catalog.json;默认不存在任何预装组织项。安装源码与 preset 的信任校验由安装宿主负责,目录本身不触发安装。
|
|
531
|
+
|
|
532
|
+
findOfficialPlugin/listOfficialPluginNames 每次读取当前目录,继续复用同一 setup 入口完成缺失插件安装。readOfficialPluginCatalog 向安装状态页报告损坏;普通插件和浏览器命令忽略损坏的可选目录,不影响已注册能力。OFFICIAL_PLUGINS 兼容导出反映本进程最近读取的目录。
|
|
533
|
+
|
|
534
|
+
扩展版本检查默认读取 GitHub 最新正式发行物中的 config.json;发行宿主可用 MEARL_EXTENSION_CONFIG_URL 提供返回 version 或 latestVersion 的配置端点。尚未上传扩展发行元数据时,更新信息显示不可用,核心源码版本不作为已发布扩展版本;检查失败仅影响更新提示。
|
package/dist/actionTimeouts.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PAGE_ACT_ACTIONS } from '
|
|
1
|
+
import { PAGE_ACT_ACTIONS } from '@mearl/browser-core';
|
|
2
2
|
const SEND_REQUEST_FILE_TRANSFER_TIMEOUT_MS = 120_000;
|
|
3
3
|
// Remote Providers may stage files before forwarding a page upload.
|
|
4
4
|
const PAGE_UPLOAD_FILE_TRANSFER_TIMEOUT_MS = 180_000;
|
package/dist/artifacts.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BrowserArtifact } from '
|
|
1
|
+
import type { BrowserArtifact } from '@mearl/browser-core';
|
|
2
2
|
import type { UnifiedInvokeOptions } from './unified.js';
|
|
3
3
|
interface Invoker {
|
|
4
4
|
invoke(action: string, data?: Record<string, any>, options?: UnifiedInvokeOptions): Promise<any>;
|
package/dist/autoUpdate.js
CHANGED
|
@@ -226,8 +226,7 @@ export function setupUpdateCommand(version, packageRoot, profiles, updateClient)
|
|
|
226
226
|
`@mearl/setup@${version}`,
|
|
227
227
|
'update',
|
|
228
228
|
'--yes',
|
|
229
|
-
'--target-line',
|
|
230
|
-
`${major}.${minor}.x`,
|
|
229
|
+
...(version.includes('-beta.') ? [] : ['--target-line', `${major}.${minor}.x`]),
|
|
231
230
|
'--skip-skill',
|
|
232
231
|
],
|
|
233
232
|
env,
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* registry directory and record shape; reading scans every *.json in the dir,
|
|
9
9
|
* so it never needs to replicate daemon-core's filename hashing.
|
|
10
10
|
*/
|
|
11
|
-
import type { BrowserCapabilities, BrowserDetails, BrowserPairingInfo, BrowserProviderIdentity, BrowserProviderOperation, BrowserReference, BrowserTransport } from '
|
|
11
|
+
import type { BrowserCapabilities, BrowserDetails, BrowserPairingInfo, BrowserProviderIdentity, BrowserProviderOperation, BrowserReference, BrowserTransport } from '@mearl/browser-core';
|
|
12
12
|
export interface LiveBrowser {
|
|
13
13
|
pid: number;
|
|
14
14
|
browserId: string;
|
package/dist/check.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CloudConnectorInfo } from '@mearl/cloud-types';
|
|
2
2
|
import { type NativeHostDiagnostic } from './nativeHost.js';
|
|
3
|
-
import type { BrowserCapabilities, BrowserProviderIdentity, BrowserProviderOperation } from '
|
|
3
|
+
import type { BrowserCapabilities, BrowserProviderIdentity, BrowserProviderOperation } from '@mearl/browser-core';
|
|
4
4
|
import { type UnifiedClientOptions, type UnifiedInvokeOptions } from './unified.js';
|
|
5
5
|
export interface UnifiedCheckVersions {
|
|
6
6
|
nativeHost?: string;
|
package/dist/check.js
CHANGED
|
@@ -4,7 +4,7 @@ const UPDATE_SOURCES = {
|
|
|
4
4
|
client: 'https://registry.npmjs.org/@mearl%2Fclient/latest',
|
|
5
5
|
'native-host': 'https://registry.npmjs.org/@mearl%2Fnative-host/latest',
|
|
6
6
|
'cloud-connector': 'https://registry.npmjs.org/@mearl%2Fcloud-connector/latest',
|
|
7
|
-
extension: 'https://
|
|
7
|
+
extension: 'https://github.com/F-loat/mearl/releases/latest/download/config.json',
|
|
8
8
|
};
|
|
9
9
|
export function parseReleaseVersion(value) {
|
|
10
10
|
if (typeof value !== 'string')
|
|
@@ -30,13 +30,14 @@ export function isNewerRelease(latest, installed) {
|
|
|
30
30
|
return false;
|
|
31
31
|
}
|
|
32
32
|
async function fetchLatestVersion(component) {
|
|
33
|
-
const
|
|
33
|
+
const source = component === 'extension' ? process.env.MEARL_EXTENSION_CONFIG_URL || UPDATE_SOURCES.extension : UPDATE_SOURCES[component];
|
|
34
|
+
const response = await fetch(source, {
|
|
34
35
|
signal: AbortSignal.timeout(1500),
|
|
35
36
|
});
|
|
36
37
|
if (!response.ok)
|
|
37
38
|
throw new Error(`HTTP ${response.status}`);
|
|
38
39
|
const payload = (await response.json());
|
|
39
|
-
const version = component === 'extension' ? payload.latestVersion : payload.version;
|
|
40
|
+
const version = component === 'extension' ? (payload.latestVersion ?? payload.version) : payload.version;
|
|
40
41
|
if (!parseReleaseVersion(version))
|
|
41
42
|
throw new Error('Invalid release version');
|
|
42
43
|
return version;
|
package/dist/commands.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BrowserCommandAction } from '
|
|
1
|
+
import { type BrowserCommandAction } from '@mearl/browser-core';
|
|
2
2
|
export interface ParamDef {
|
|
3
3
|
name: string;
|
|
4
4
|
type: string;
|
|
@@ -297,7 +297,7 @@ export declare const COMMANDS: readonly [{
|
|
|
297
297
|
readonly type: "string";
|
|
298
298
|
readonly description: "规则说明";
|
|
299
299
|
}];
|
|
300
|
-
readonly notes: readonly ["扩展模式规则持久化;CDP 仅支持会话级 modifyHeaders 请求头 set,不支持响应头、initiatorDomains 或其他动作。Provider 是否支持以其能力声明为准。"];
|
|
300
|
+
readonly notes: readonly ["扩展模式规则持久化;CDP 仅支持会话级 modifyHeaders 请求头 set,不支持响应头、initiatorDomains 或其他动作。Provider 是否支持以其能力声明为准。", "扩展模式会检查规则请求 URL 和显式来源域名的访问权限;缺失时仍保存规则,返回 warnings 和 missingOrigins,不自动弹窗。可在请求规则页面授权,或按提示调用 request_domain_permission。复杂 URL 表达式无法完整推断域名时会提示手动检查。"];
|
|
301
301
|
readonly examples: ["set_rule --payload '{\"actionType\":\"block\",\"filter\":\"^https://example\\\\.com/ads/.*\"}'", "set_rule --payload '{\"ruleId\":42,\"enabled\":false}'"];
|
|
302
302
|
}, {
|
|
303
303
|
readonly name: "get_rules";
|
|
@@ -353,7 +353,7 @@ export declare const COMMANDS: readonly [{
|
|
|
353
353
|
readonly type: "number";
|
|
354
354
|
readonly description: "超时毫秒数,默认 30000";
|
|
355
355
|
}];
|
|
356
|
-
readonly notes: readonly ["
|
|
356
|
+
readonly notes: readonly ["需要托管认证的接口使用相应能力插件;不要手工传入其管理的凭据。", "body 不能与 formData/files 组合;bodyFile 以原始字节发送,不包 multipart boundary,不能用于 GET/HEAD。", "bodyFile.filePath 属于 native-host,最大 40 MiB;base64 解码后最大 7 MiB。multipart 不手工设置 Content-Type,由 Mearl 生成 boundary。", "filePath 属于请求执行宿主;无法引用远端路径时用 base64。"];
|
|
357
357
|
readonly result: readonly ["返回 status、statusText、headers、body、bodyType、attachedCookieCount;bodyType 为 json/text/base64,二进制 body 需解码后保存。"];
|
|
358
358
|
readonly examples: ["send_request --payload '{\"url\":\"https://api.example.com/data\",\"method\":\"GET\"}'", "send_request --payload '{\"url\":\"https://api.example.com/upload\",\"method\":\"POST\",\"formData\":{\"folder\":\"assets\"},\"files\":[{\"fieldName\":\"file\",\"filePath\":\"/absolute/path/image.png\"}]}'", "send_request --payload '{\"url\":\"https://api.example.com/upload\",\"method\":\"POST\",\"bodyFile\":{\"filePath\":\"/absolute/path/image.png\",\"contentType\":\"image/png\"}}'"];
|
|
359
359
|
}, {
|
|
@@ -457,8 +457,8 @@ export declare const COMMANDS: readonly [{
|
|
|
457
457
|
readonly description: "自定义 Chrome 可执行文件路径";
|
|
458
458
|
}, {
|
|
459
459
|
readonly name: "copyCookieDomains";
|
|
460
|
-
readonly type: "string[] |
|
|
461
|
-
readonly description: "从控制浏览器复制 Cookie
|
|
460
|
+
readonly type: "string[] | string | { presets?: string[]; domains?: string[] }";
|
|
461
|
+
readonly description: "从控制浏览器复制 Cookie:可传域名数组、已安装能力提供的范围名,或组合范围与额外域名";
|
|
462
462
|
}];
|
|
463
463
|
readonly examples: ["browser_launch --payload '{\"provider\":\"brow\",\"providerOptions\":{}}'", "browser_launch --payload '{\"name\":\"figma\",\"userAgentMode\":\"desktop\",\"copyCookieDomains\":[\"figma.com\"]}'", "browser_launch --payload '{\"name\":\"with-cookies\",\"copyCookieDomains\":[\"example.com\",\"sub.example.org\"]}'"];
|
|
464
464
|
}, {
|
|
@@ -519,7 +519,7 @@ export declare const COMMANDS: readonly [{
|
|
|
519
519
|
}, {
|
|
520
520
|
readonly name: "appProfile";
|
|
521
521
|
readonly type: "string";
|
|
522
|
-
readonly description: "
|
|
522
|
+
readonly description: "按已安装档案应用 App 环境;内置基础档案只提供 UA/版本,完整桥由能力包提供。需要 iframe WebView 和系统栏时同时传 emulation.deviceShell=true";
|
|
523
523
|
}, {
|
|
524
524
|
readonly name: "os";
|
|
525
525
|
readonly type: "\"ios\" | \"android\"";
|
|
@@ -531,7 +531,7 @@ export declare const COMMANDS: readonly [{
|
|
|
531
531
|
}];
|
|
532
532
|
readonly notes: readonly ["emulation / appProfile 只应用到新建 Tab;复用 Tab 要切换状态时用对应设置 action。", "closeExisting 不能与复用或 openerTabId 组合;多匹配默认报错,match.onMultiple=first 可显式选择第一个。"];
|
|
533
533
|
readonly result: readonly ["返回 tabId、url、title、opened/reused;reused=true 的既有页面应保留。", "active=true 时 activation 包含 tabActive、windowFocused、windowState、visibilityState;emulation 返回实际生效配置。", "capture.cursor 是导航前诊断边界,可分别用于 get_logs/get_requests/get_events 的 after。"];
|
|
534
|
-
readonly examples: ["tab_open --payload '{\"url\":\"https://example.com\"}'", "tab_open --payload '{\"url\":\"https://example.com/page\",\"reuse\":\"prefer\",\"match\":{\"ignoreSearch\":true}}'", "tab_open --payload '{\"url\":\"https://m.example.com\",\"emulation\":{\"preset\":\"iphone-17-pro\"}}'", "tab_open --payload '{\"url\":\"https://
|
|
534
|
+
readonly examples: ["tab_open --payload '{\"url\":\"https://example.com\"}'", "tab_open --payload '{\"url\":\"https://example.com/page\",\"reuse\":\"prefer\",\"match\":{\"ignoreSearch\":true}}'", "tab_open --payload '{\"url\":\"https://m.example.com\",\"emulation\":{\"preset\":\"iphone-17-pro\"}}'", "tab_open --payload '{\"url\":\"https://example.com/app/home\",\"appProfile\":\"fliggy\"}'", "tab_open --payload '{\"url\":\"https://example.com/app/home\",\"appProfile\":\"fliggy\",\"emulation\":{\"preset\":\"ipad-mini-a17-pro\",\"orientation\":\"landscape\",\"deviceShell\":true,\"splitScreen\":true}}'", "tab_open --payload '{\"url\":\"https://example.com\",\"appProfile\":\"fliggy\",\"os\":\"android\"}'", "tab_open --payload '{\"url\":\"https://example.com\",\"group\":\"验证任务\"}'"];
|
|
535
535
|
}, {
|
|
536
536
|
readonly name: "tab_close";
|
|
537
537
|
readonly description: "关闭指定标签页";
|
|
@@ -1055,7 +1055,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1055
1055
|
readonly examples: ["set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"iphone-17-pro\"}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"pixel-11\",\"orientation\":\"landscape\"}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":true,\"preset\":\"ipad-mini-a17-pro\",\"orientation\":\"landscape\",\"deviceShell\":true,\"splitScreen\":true}'", "set_device_emulation --payload '{\"tabId\":12345,\"enabled\":false}'"];
|
|
1056
1056
|
}, {
|
|
1057
1057
|
readonly name: "set_app_profile";
|
|
1058
|
-
readonly description: "
|
|
1058
|
+
readonly description: "设置已安装的 App 档案;完整 JSBridge 由能力包提供。可同时设置 MTop 页面接口环境,传 emulation 时联动设备模拟";
|
|
1059
1059
|
readonly summary: "设置或清除目标标签页的 App 容器模拟";
|
|
1060
1060
|
readonly params: [{
|
|
1061
1061
|
readonly name: "enabled";
|
|
@@ -1093,7 +1093,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1093
1093
|
}, {
|
|
1094
1094
|
readonly name: "mtopEnv";
|
|
1095
1095
|
readonly type: "\"default\" | \"prod\" | \"pre\"";
|
|
1096
|
-
readonly description: "可选 MTop 页面接口环境;default
|
|
1096
|
+
readonly description: "可选 MTop 页面接口环境;default 关闭环境改写,省略时保持当前设置。仅作用于目标 tab";
|
|
1097
1097
|
}, {
|
|
1098
1098
|
readonly name: "emulation";
|
|
1099
1099
|
readonly type: "object";
|
|
@@ -1153,7 +1153,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1153
1153
|
}];
|
|
1154
1154
|
readonly notes: readonly ["只读取指定非分区 Cookie,不列举全部、不回退分区 Cookie,拒绝 HttpOnly;禁止读取认证 Token。指定 url 不导航,指定 tabId 仅选择存储区时不启动采集。"];
|
|
1155
1155
|
readonly result: readonly ["找到时 found=true 并返回 value/domain/path;不存在时 found=false。"];
|
|
1156
|
-
readonly examples: ["get_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\"}'", "get_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"tracknick\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"
|
|
1156
|
+
readonly examples: ["get_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\"}'", "get_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"tracknick\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"feature_channel\",\"domain\":\"example.com\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"tracknick\",\"url\":\"https://www.taobao.com/\",\"domain\":\"example.com\",\"path\":\"/\"}'"];
|
|
1157
1157
|
}, {
|
|
1158
1158
|
readonly name: "set_cookie";
|
|
1159
1159
|
readonly description: "在目标浏览器设置一个指定非分区 session Cookie,可选刷新指定页面";
|
|
@@ -1190,7 +1190,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1190
1190
|
}];
|
|
1191
1191
|
readonly notes: readonly ["仅写非分区 session Cookie,不支持删除。reload=true 时校验目标域与刷新页域的授权。"];
|
|
1192
1192
|
readonly result: readonly ["返回 url/name/domain/path/reloaded,指定标签页时包含 tabId;不回显 Cookie 值。"];
|
|
1193
|
-
readonly examples: ["set_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"tabId\":12345,\"name\":\"
|
|
1193
|
+
readonly examples: ["set_cookie --payload '{\"tabId\":12345,\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"url\":\"https://www.taobao.com/\",\"name\":\"feature_flag\",\"value\":\"enabled\"}'", "set_cookie --payload '{\"tabId\":12345,\"name\":\"feature_channel\",\"value\":\"3.6.63\",\"domain\":\"example.com\",\"reload\":true}'"];
|
|
1194
1194
|
}, {
|
|
1195
1195
|
readonly name: "page_frames";
|
|
1196
1196
|
readonly description: "获取页面主 frame 与所有 iframe 列表";
|
|
@@ -1211,7 +1211,7 @@ export declare const COMMANDS: readonly [{
|
|
|
1211
1211
|
readonly required: true;
|
|
1212
1212
|
readonly description: "需要授权的域名,如 example.com";
|
|
1213
1213
|
}];
|
|
1214
|
-
readonly notes: readonly ["domain 使用纯主机名,不传 URL
|
|
1214
|
+
readonly notes: readonly ["domain 使用纯主机名,不传 URL。在 send_request 或 set_rule 提示缺少浏览器域名权限时申请。", "弹窗等待用户选择,90 秒超时或关闭按拒绝处理;granted=true 后才重试原请求。"];
|
|
1215
1215
|
readonly result: readonly ["返回 granted、domain,授权成功时包含 origin。"];
|
|
1216
1216
|
readonly examples: ["request_domain_permission --payload '{\"domain\":\"example.com\"}'"];
|
|
1217
1217
|
}, {
|