@mearl/setup 2.22.0 → 3.0.0-beta.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.
Files changed (42) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +59 -59
  3. package/dist/browserExtension.d.ts +2 -2
  4. package/dist/browserExtension.js +25 -19
  5. package/dist/cli.d.ts +8 -3
  6. package/dist/cli.js +74 -17
  7. package/dist/index.d.ts +3 -1
  8. package/dist/index.js +2 -1
  9. package/dist/lifecycle.d.ts +11 -4
  10. package/dist/lifecycle.js +48 -15
  11. package/dist/managedPlugins.d.ts +21 -0
  12. package/dist/managedPlugins.js +76 -0
  13. package/dist/npmRegistry.d.ts +1 -1
  14. package/dist/npmRegistry.js +4 -16
  15. package/dist/plugin.d.ts +13 -3
  16. package/dist/plugin.js +106 -44
  17. package/dist/preset.d.ts +94 -0
  18. package/dist/preset.js +275 -0
  19. package/dist/presetBrowserTransfer.d.ts +11 -0
  20. package/dist/presetBrowserTransfer.js +72 -0
  21. package/dist/presetInstallationLease.d.ts +6 -0
  22. package/dist/presetInstallationLease.js +66 -0
  23. package/dist/presetStore.d.ts +48 -0
  24. package/dist/presetStore.js +252 -0
  25. package/dist/presetUpgrade.d.ts +13 -0
  26. package/dist/presetUpgrade.js +42 -0
  27. package/dist/provider.d.ts +2 -0
  28. package/dist/provider.js +24 -2
  29. package/dist/runtimeCleanup.js +1 -8
  30. package/dist/setupVersion.d.ts +2 -0
  31. package/dist/setupVersion.js +4 -0
  32. package/dist/skillSources.d.ts +46 -0
  33. package/dist/skillSources.js +276 -0
  34. package/dist/skills.d.ts +45 -0
  35. package/dist/skills.js +213 -0
  36. package/dist/version.d.ts +2 -0
  37. package/dist/version.js +6 -0
  38. package/package.json +27 -10
  39. package/dist/aliSkills.d.ts +0 -32
  40. package/dist/aliSkills.js +0 -212
  41. package/dist/internalPlugins.d.ts +0 -26
  42. package/dist/internalPlugins.js +0 -197
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,22 +1,24 @@
1
1
  # @mearl/setup
2
2
 
3
+ 3.0 当前以 beta 发行。使用 `@beta` 入口安装同版本的 setup、运行包和扩展;正式版 `latest` 保留 2.22。组织能力由独立 preset 分发。
4
+
3
5
  Mearl 环境的一次性安装、更新、卸载与配置工具。无需先全局安装 setup:
4
6
 
5
7
  ```bash
6
- npx @mearl/setup [install] [--local] [--cloud|--qoder-cloud] [--mcp]
7
- npx @mearl/setup update [--local] [--cloud|--qoder-cloud] [--mcp]
8
- npx @mearl/setup uninstall [--local] [--cloud|--qoder-cloud] [--mcp] [--full]
9
- npx @mearl/setup extension [--full] [--force]
10
- npx @mearl/setup plugin [name] <path>
11
- npx @mearl/setup plugin install <ali-skills add 参数...>
12
- npx @mearl/setup plugin uninstall <name>
13
- npx @mearl/setup provider <install|update|uninstall> <package|id>
8
+ npx @mearl/setup@beta [install] [--local] [--cloud|--qoder-cloud] [--mcp]
9
+ npx @mearl/setup@beta update [--local] [--cloud|--qoder-cloud] [--mcp]
10
+ npx @mearl/setup@beta uninstall [--local] [--cloud|--qoder-cloud] [--mcp] [--full]
11
+ npx @mearl/setup@beta extension [--full] [--force]
12
+ npx @mearl/setup@beta plugin [name] <path>
13
+ npx @mearl/setup@beta plugin install <skills add 参数...>
14
+ npx @mearl/setup@beta plugin uninstall <name>
15
+ npx @mearl/setup@beta provider <install|update|uninstall> <package|id>
14
16
  ```
15
17
 
16
18
  浏览器 Provider 独立安装和演进。安装后运行 `mearl <providerId>` 查看该版本声明的能力、
17
19
  配置和启动参数。
18
20
 
19
- 在 Qoder Cloud Agent 环境中,使用 `npx @mearl/setup --qoder-cloud --yes` 选择 Qoder
21
+ 在 Qoder Cloud Agent 环境中,使用 `npx @mearl/setup@beta --qoder-cloud --yes` 选择 Qoder
20
22
  配对模式。它与 `--cloud` 安装同一套 cloud-server、client 和 Skill,只把 cloud-server
21
23
  模式记录为 Qoder;`mearl-cloud-server` 的命令交互保持不变,`start` 和 `restart` 输出新的
22
24
  配对指令后退出,不监听端口或保留守护进程。配对 URL 不包含 Qoder PAT。
@@ -26,34 +28,25 @@ npx @mearl/setup provider <install|update|uninstall> <package|id>
26
28
  一个命令安装 skill 并注册它的 CLI、SDK 和 MCP 能力:
27
29
 
28
30
  ```bash
29
- npx @mearl/setup plugin install trip/mearl --skill yuque-doc-fetch --yes
30
- mearl yuque read "https://aliyuque.antfin.com/group/book/doc"
31
+ npx @mearl/setup@beta plugin install https://github.com/F-loat/mearl/tree/v3.0.0-beta.1 --skill browser-tab-manager --yes
32
+ mearl tabs summary
31
33
  ```
32
34
 
33
- 安装参数透传给 `npx -y ali-skills add`,统一使用全局 symlink 安装;不接受会截断后置选项的 `--` 参数分隔符,
34
- 确保 skill 存放在 `~/.agents/skills` 并共享给所选 agent。安装日志实时显示,保留交互;
35
- setup 从 `Installed … skill(s)` 成功区块提取路径,仅注册本次安装且包含 `scripts/main.mjs` 或 `scripts/main.py` 的 skill;两者同时存在时使用 JavaScript 入口。
36
- 普通 skill 正常安装。输出格式无法识别时提示手动注册,不扫描其他 skill 或猜测安装结果。
35
+ 安装参数传给固定版本的公共 Skills CLI(当前 skills@1.5.0,兼容项目的 Node 最低版本),使用全局共享目录。公共 CLI 的默认 symlink 和复制模式都可注册;复制模式通过 list --global --json 确认本次成功结果对应的 canonical path,不猜测目录,也不扫描其他 Skills。自定义 CLI 可通过 MEARL_SKILLS_PATH 指定。参数不接受截断后置选项的 -- 分隔符。
37
36
 
38
- 默认 `install` 和 `update` 会用最多 5 秒的 `npm ping` 检查阿里内网 registry。
39
- registry 可访问时通过 Ali Skills 批量处理 `mearl` 与 `tdbank-account`:安装使用一次
40
- `add` 并注册 TDBank 插件,更新已跟踪项使用一次 `update`;卸载时使用一次 `remove` 批量移除 setup 管理的 Skill。
41
- 更新发现 TDBank 插件缺少注册时,会在批量更新已跟踪项后通过一次 `add` 补装并恢复注册。
42
- 该 registry 不用于下载插件。
43
- 探测不可用时按普通外网流程只处理 Mearl Skill;内网批量命令失败时 setup 失败,不再逐项重试。
44
- `--skip-skill` 和 `--target-line` 安装不执行自动插件步骤。
37
+ 安装宿主提供的本地插件目录决定哪些能力由 preset 管理。install/update 只维护该目录中的托管注册,保留用户自行注册的同名插件;普通外网环境没有组织专属名单,也不探测组织 registry。卸载最后一个依赖环境时移除托管插件与 Mearl Skill;其他环境仍需要时保留。--skip-skill 与版本线安装维持原有跳过规则。整套 preset 准备、权限、宿主同步及实际安装状态通过统一安装合同处理。
45
38
 
46
- Mearl client 内置 `buc`、`authx` 与 `tdbank` 的安装来源。CLI、SDK、MCP 或另一个插件首次调用尚未注册的这些插件时,会通过内部幂等流程安装并重试一次;其他未注册名称不会触发安装。BUC 与 AuthX 不随 setup 预装。
39
+ Native preset 批次新建的插件注册使用 setup 托管归属,后续通过 Agent 更新仍保留该归属;同目录已有的用户注册保持原归属,自定义用户别名也会保留。托管卸载遇到用户别名共用同一 Skill 时,只清除托管注册并保留 Skill 文件。
47
40
 
48
41
  自动注册默认使用安装目录名;入口可声明 `name` 指定简短命令名。
49
42
  重装会刷新同名绑定。JavaScript 入口必须默认导出 `register(app)`,Python 入口必须导出 `register(app)` 函数;完整协议见
50
- [Skill 插件规范](../skills/mearl-skill-creator/references/cli-plugin.md)。
43
+ [插件运行时合同](../../docs/plugin-runtime.md)。
51
44
 
52
45
  已通过其他渠道分发的 skill 或自定义入口,可以直接传入路径注册:
53
46
 
54
47
  ```bash
55
- npx @mearl/setup plugin /absolute/path/to/yuque-doc-fetch
56
- npx @mearl/setup plugin custom ./skills/custom/entry.mjs
48
+ npx @mearl/setup@beta plugin /absolute/path/to/browser-tab-manager
49
+ npx @mearl/setup@beta plugin custom ./skills/custom/entry.mjs
57
50
  ```
58
51
 
59
52
  path 接受目录或具体文件;目录默认读取 `scripts/main.mjs` 或 `scripts/main.py`,相对路径基于调用工作目录解析。插件名优先使用显式 name,其次读取入口的 `name` metadata,最后回退到 Skill 目录名;常规注册只传 path,显式 name 仅用于覆盖或兼容旧入口。Python 插件要求 `python3 >= 3.9`,可通过 `MEARL_PYTHON` 指定解释器路径;setup 只验证入口可加载,不安装 Python,也不执行 `pip install`。
@@ -61,17 +54,17 @@ path 接受目录或具体文件;目录默认读取 `scripts/main.mjs` 或 `sc
61
54
  两种注册流程都会检查本机 `@mearl/client` 和 `@mearl/native-host`:缺失或低于当前 setup 版本时,
62
55
  复用已有包管理器安装 setup 的对应版本,更新后再次验证;更高版本保持不动。
63
56
  native-host 会幂等初始化 Skills 模式。基础环境补齐或初始化失败时保留已安装的 skill,并停止注册。
64
- 注册后可在任意目录运行 `mearl <name> --help`,也可通过 `@mearl/client` 的 `invokePlugin` 或 MCP 的 `plugin_invoke` 工具调用。已注册插件的日常调用不执行安装或版本检查;只有缺失的 `buc`、`authx` 或 `tdbank` 会触发一次按需安装。
57
+ 注册后可在任意目录运行 `mearl <name> --help`,也可通过 `@mearl/client` 的 `invokePlugin` 或 MCP 的 `plugin_invoke` 工具调用。已注册插件的日常调用不执行安装或版本检查;只有已选目录中的缺失插件会触发一次按需安装。
65
58
 
66
59
  不再需要插件时执行:
67
60
 
68
61
  ```bash
69
- npx @mearl/setup plugin uninstall yuque
62
+ npx @mearl/setup@beta plugin uninstall tabs
70
63
  ```
71
64
 
72
65
  若入口位于 `~/.agents/skills/<skill>/`,setup 会先执行
73
- `ali-skills remove <skill> --global --yes`,成功后清除该 Skill 对应的全部插件注册;
74
- 入口目录已被手动删除时会让 Ali Skills 仍能识别本次移除,从而一并清理其跟踪记录。
66
+ `skills remove <skill> --global --yes`,成功后清除该 Skill 对应的全部插件注册;
67
+ 入口目录已被手动删除时会让 Skills 仍能识别本次移除,从而一并清理其跟踪记录。
75
68
  移除失败时保留注册以便重试。手工注册的其他路径只解除 Mearl 注册,不删除源码。
76
69
  重复卸载未注册名称会成功返回,不产生改动。
77
70
 
@@ -82,13 +75,12 @@ Provider 由 npm 包分发,但包本身无需暴露 CLI 或安装脚本。setu
82
75
  可创建的浏览器类型名称及其表单参数:
83
76
 
84
77
  ```bash
85
- npx @mearl/setup provider install @ali/mearl-provider-brow
86
- npx @mearl/setup provider update brow
87
- npx @mearl/setup provider uninstall brow
78
+ npx @mearl/setup@beta provider install @example/mearl-provider-device
79
+ npx @mearl/setup@beta provider update example-device
80
+ npx @mearl/setup@beta provider uninstall example-device
88
81
  ```
89
82
 
90
- 安装参数接受包名、版本或 dist-tag;更新和卸载可使用 `providerId` 或完整包名。`@ali/*` 包的
91
- 安装和更新固定使用 `https://registry.anpm.alibaba-inc.com/`。安装沿用启动 setup 的包管理器,
83
+ 安装参数接受包名、版本或 dist-tag;更新和卸载可使用 providerId 或完整包名。核心 @mearl 包固定使用公共 npm registry;其余 scope 沿用调用方的包管理器配置,组织 registry 由能力安装引导提供。安装沿用启动 setup 的包管理器,
92
84
  更新和卸载沿用当前 Provider 的原包管理器。Provider 登记只保存
93
85
  经过校验的包名、安装目录和包内入口;不接受包自行注入启动命令、参数、工作目录或环境变量。
94
86
  卸载仅在包管理器成功移除包后清除登记,以便失败时可以重试。
@@ -96,8 +88,8 @@ npx @mearl/setup provider uninstall brow
96
88
  ## 行为
97
89
 
98
90
  - Mearl 自有 npm 包的安装和更新固定使用 `https://registry.npmjs.org/`,与最新版本查询使用同一来源;第三方包沿用当前包管理器的源配置。
99
- - `install` 可以省略;直接执行 `npx @mearl/setup` 等同于 `npx @mearl/setup install`。
100
- 以选项开头时也默认安装,例如 `npx @mearl/setup --cloud --yes`。
91
+ - `install` 可以省略;直接执行 `npx @mearl/setup@beta` 等同于 `npx @mearl/setup@beta install`。
92
+ 以选项开头时也默认安装,例如 `npx @mearl/setup@beta --cloud --yes`。
101
93
  - `install` 未指定环境时默认 `--local`。
102
94
  - `-h` / `--help` 显示帮助,`-v` / `--version` 显示 setup 版本。
103
95
  - `update` 和 `uninstall` 未指定环境时,从当前 `PATH` 中的
@@ -113,23 +105,23 @@ npx @mearl/setup provider uninstall brow
113
105
  新配对但不起服务;卸载前均调用 `stop`。
114
106
  - local/cloud 共用一份 `@mearl/client`;组合安装只处理一次,卸载单个环境时若另一个环境仍在使用则保留。
115
107
  - 从 2.5.x 更新 cloud 环境时会先卸载旧 `@mearl/cloud-client`,避免它遗留的 `mearl` bin 与统一 client 冲突。
116
- - local/cloud 共用的全局 mearl skill 通过 `ali-skills` 的 JSON 清单定位,只处理一次。
117
- - 安装始终通过 `ali-skills add` 以 symlink 方式写入最新的全局 mearl skill,并关联当前检测到的 Agent;
108
+ - local/cloud 共用的全局 mearl skill 通过 `skills` 的 JSON 清单定位,只处理一次。
109
+ - 安装和更新通过 `skills add` 从公开仓库重新安装全局 mearl skill,并关联当前检测到的 Agent;更新须确认本次安装完成并核对全局 JSON 清单,不能仅依据第三方更新命令的退出码。
118
110
  可用 `--skip-skill` 跳过。
119
111
  - 卸载一个环境但另一个仍依赖全局 mearl skill 时会保留 skill。
112
+ - 已选择 preset 的自动维护保留用户注册;托管卸载遇到同目录的用户别名时只移除托管注册并保留共享 Skill。
120
113
  - `uninstall --full` 在环境卸载之外,还会逐项卸载所有已注册 CLI 插件与浏览器 Provider。
121
- Ali Skills 安装的插件会同时移除 Skill;手工注册的外部插件只清除注册、保留源码;Provider
114
+ Skills 安装的插件会同时移除 Skill;手工注册的外部插件只清除注册、保留源码;Provider
122
115
  只有在包管理器成功卸载 npm 包后才清除注册。单项失败不阻止其他项继续清理,命令最终返回非零。
123
116
  该选项不删除 Chrome 扩展;`extension --full` 仍表示安装扩展及完整本地环境。
124
117
  - `uninstall --full` 在所有环境、插件与 Provider 成功移除后统一收尾:停止插件执行服务,
125
- 确认没有活跃或退出状态未明的任务,再删除任务历史、源码快照、服务日志、AuthX SDK 缓存、
126
- 旧设计稿缓存和已结束宿主的页面会话文件。只卸载部分环境、单项失败或服务重新启动时保留共享缓存。
118
+ 确认没有活跃或退出状态未明的任务,再删除任务历史、源码快照、服务日志和已结束宿主的页面会话文件。只卸载部分环境、单项失败或服务重新启动时保留共享缓存。
127
119
  即使包和注册已移除,也可以再次运行该命令完成缓存收尾。自定义 `MEARL_PLUGIN_DIR` 只清理该注册表的执行缓存。
128
120
  记事本、迭代记录、配置与身份、插件持久状态、Provider 私有数据、浏览器配置及用户导出的设计稿均保留;
129
121
  CDP 标签 ID 计数也保留,防止旧请求命中新标签。
130
122
  - `--mcp` 的客户端配置和清理由 `@mearl/mcp-server` 自己的命令完成。
131
123
  - 默认的 `install` / `update` 不处理浏览器扩展。`extension` 是独立命令:从
132
- `https://mearl.alibaba-inc.com/` 识别并下载最新的 `mearl-chrome-v*.zip`,原子解压到
124
+ `https://github.com/F-loat/mearl/releases/download/v3.0.0-beta.1/` 读取同版本 beta 扩展发行元数据(正式 setup 使用 `releases/latest/download/`)并下载对应的 `mearl-chrome-v*.zip`,原子解压到
133
125
  `~/.mearl/chrome-extension`。首次安装通过浏览器级 CDP 的 `Extensions.loadUnpacked`
134
126
  加载;后续更新由 `mearl check --local --json` 确认当前扩展仍来自 setup 管理目录后,直接替换
135
127
  文件并通过 Native Host 触发扩展 reload。固定目录和 manifest 中的 `key` 保证扩展 ID
@@ -145,19 +137,19 @@ npx @mearl/setup provider uninstall brow
145
137
  ## 安装或更新浏览器扩展
146
138
 
147
139
  ```bash
148
- npx @mearl/setup extension
140
+ npx @mearl/setup@beta extension
149
141
  ```
150
142
 
151
143
  首次使用时可一次安装完整的本地浏览器环境:
152
144
 
153
145
  ```bash
154
- npx @mearl/setup extension --full
146
+ npx @mearl/setup@beta extension --full
155
147
  ```
156
148
 
157
149
  首次安装、旧版 setup 扩展首次迁移,或 Native Host reload 不可用时才需要 CDP。如果
158
150
  Chrome 尚未开放 CDP,交互命令会提示打开
159
151
  `chrome://inspect/#remote-debugging`、启用远程调试并允许连接,然后等待安装完成。面向人的
160
- 安装指引不要添加 `--yes`。无 TTY 环境使用 `npx @mearl/setup extension --yes`;它只尝试
152
+ 安装指引不要添加 `--yes`。无 TTY 环境使用 `npx @mearl/setup@beta extension --yes`;它只尝试
161
153
  一次,CDP 不可用时立即中断。无法确认 setup 管理来源且 CDP 不可用时不会下载或修改插件
162
154
  目录,打开 CDP 后重新执行同一命令即可。Chrome 版本过低、缺少扩展安装所需的 CDP 方法时,
163
155
  命令会中断并提示升级 Chrome。
@@ -187,7 +179,7 @@ DevTools 面板的设置按钮会显示红点,快捷设置中提供“立即
187
179
 
188
180
  自动更新不会降级较新的 Host,也不会改动 cloud、MCP 或独立安装的 Mearl Skill。
189
181
  目标 npm 版本尚未发布、网络不可用或更新失败时,旧 Host 会继续运行;下一次扩展后台
190
- 生命周期可重新尝试,也可手动执行 `npx @mearl/setup update --local`。
182
+ 生命周期可重新尝试,也可手动执行 `npx @mearl/setup@beta update --local`。
191
183
 
192
184
  ## 人工与 Agent 使用
193
185
 
@@ -205,38 +197,46 @@ DevTools 面板的设置按钮会显示红点,快捷设置中提供“立即
205
197
  npx @mearl/setup
206
198
 
207
199
  # 与上一条等价
208
- npx @mearl/setup install
200
+ npx @mearl/setup@beta install
209
201
 
210
202
  # Agent / CI 无交互安装
211
- npx @mearl/setup --yes
203
+ npx @mearl/setup@beta --yes
212
204
 
213
205
  # 安装云端 Agent 环境
214
- npx @mearl/setup --cloud
206
+ npx @mearl/setup@beta --cloud
215
207
 
216
208
  # 同一台机器同时作为本地浏览器宿主和云端 Agent
217
- npx @mearl/setup --local --cloud
209
+ npx @mearl/setup@beta --local --cloud
218
210
 
219
211
  # 自动更新当前 PATH 中检测到的全部 Mearl 环境
220
- npx @mearl/setup update
212
+ npx @mearl/setup@beta update
221
213
 
222
214
  # 独立安装或更新到最新浏览器扩展
223
- npx @mearl/setup extension
215
+ npx @mearl/setup@beta extension
224
216
 
225
217
  # 安装完整本地环境(client、Native Host、Skill 和扩展)
226
- npx @mearl/setup extension --full
218
+ npx @mearl/setup@beta extension --full
227
219
 
228
220
  # 只卸载本地环境
229
- npx @mearl/setup uninstall --local
221
+ npx @mearl/setup@beta uninstall --local
230
222
 
231
223
  # 自动检测并无交互卸载
232
- npx @mearl/setup uninstall --yes
224
+ npx @mearl/setup@beta uninstall --yes
233
225
 
234
226
  # 卸载环境,并清理全部 CLI 插件与 Provider
235
- npx @mearl/setup uninstall --full
227
+ npx @mearl/setup@beta uninstall --full
236
228
 
237
229
  # 安装可选浏览器 Provider
238
- npx @mearl/setup provider install @ali/mearl-provider-brow
239
- npx @mearl/setup provider install @ali/mearl-provider-agentbay
230
+ npx @mearl/setup@beta provider install @example/mearl-provider-device
231
+ npx @mearl/setup@beta provider install @example/mearl-provider-cloud
240
232
  ```
241
233
 
242
234
  原有 Mearl 环境包的 npm/npx 安装方式和 CLI 保持可用;setup 是统一的便利入口。
235
+
236
+ ## Preset 安装
237
+
238
+ `mearl-setup preset apply <source-url-or-path>` 准备确切资源、激活本机 Node 选择,并向兼容扩展同步同一批浏览器资源;`preset update` 保留用户覆盖,`preset status` 只读检查实际就绪状态。退出码 3 表示存在待同步/安装组件。完整扩展、默认设置、Skills/Provider 和网页一键安装使用同一实际状态核验,见 [本机安装合同](../../docs/preset-installation.md)。
239
+
240
+ 普通 install/update 在替换包前保存选中 preset 的确切资源和期望选择,运行时初始化后再同步宿主和安装 Skills;`extension --full` 也在替换扩展前完成准备。已有本机 preset 优先保留,显式 `--preset` 可更新或修复资源;检测到已安装包为 3.0 以前版本且尚无选择时,读取公共部署目录的 `legacyPreset`。配置或资源不可用会在包变更前停止,不回退到无内部能力的安装。部分升级后的重试使用已保存安装记录,即使包版本已变为 3.x 也不重新下载。维护旧版本线和卸载不自动迁移。
241
+
242
+ 默认目录为公共站点的 `installation.json`,可通过 `MEARL_INSTALLATION_CONFIG_URL` 指定其他 HTTPS 目录(本地验证允许回环 HTTP)。核心不包含组织 ID 或私有来源;目录沿用网页安装的校验合同。本机与浏览器未全部确认时仍报告 pending,准备成功不表示已发行或已完成真实企业授权验收。
@@ -1,5 +1,5 @@
1
- export declare const MEARL_EXTENSION_DOWNLOAD_PAGE = "https://mearl.alibaba-inc.com/";
2
- export declare const MEARL_EXTENSION_REMOTE_CONFIG_URL = "https://mearl.alibaba-inc.com/config.json";
1
+ export declare const MEARL_EXTENSION_DOWNLOAD_PAGE: string;
2
+ export declare const MEARL_EXTENSION_REMOTE_CONFIG_URL: string;
3
3
  export declare const MEARL_EXTENSION_DIRECTORY_NAME = "chrome-extension";
4
4
  export declare const MEARL_EXTENSION_ID = "aoehhjnofngknnjefamjbplchbolghkm";
5
5
  export declare const MEARL_EXTENSION_SETUP_MARKER = ".mearl-setup.json";
@@ -1,3 +1,5 @@
1
+ import { SETUP_VERSION } from './setupVersion.js';
2
+ import { readExtensionReleaseVersion } from '@mearl/browser-core';
1
3
  import fs from 'node:fs';
2
4
  import os from 'node:os';
3
5
  import path from 'node:path';
@@ -7,8 +9,12 @@ import { CLIENT_VERSION, invoke as invokeLocalMearl } from '@mearl/client/local'
7
9
  import extractZip from 'extract-zip';
8
10
  import WebSocket from 'ws';
9
11
  import { compareMearlReleaseVersions, isMearlReleaseVersion } from './version.js';
10
- export const MEARL_EXTENSION_DOWNLOAD_PAGE = 'https://mearl.alibaba-inc.com/';
11
- export const MEARL_EXTENSION_REMOTE_CONFIG_URL = `${MEARL_EXTENSION_DOWNLOAD_PAGE}config.json`;
12
+ export const MEARL_EXTENSION_DOWNLOAD_PAGE = SETUP_VERSION.includes('-beta.')
13
+ ? `https://github.com/F-loat/mearl/releases/tag/v${SETUP_VERSION}`
14
+ : 'https://github.com/F-loat/mearl/releases/latest';
15
+ export const MEARL_EXTENSION_REMOTE_CONFIG_URL = SETUP_VERSION.includes('-beta.')
16
+ ? `https://github.com/F-loat/mearl/releases/download/v${SETUP_VERSION}/config.json`
17
+ : 'https://github.com/F-loat/mearl/releases/latest/download/config.json';
12
18
  export const MEARL_EXTENSION_DIRECTORY_NAME = 'chrome-extension';
13
19
  export const MEARL_EXTENSION_ID = 'aoehhjnofngknnjefamjbplchbolghkm';
14
20
  export const MEARL_EXTENSION_SETUP_MARKER = '.mearl-setup.json';
@@ -46,13 +52,16 @@ export function extensionArchiveUrl(version) {
46
52
  if (!isMearlReleaseVersion(version)) {
47
53
  throw new Error(`Invalid Mearl browser extension version: ${version}`);
48
54
  }
49
- return new URL(`mearl-chrome-v${version}.zip`, MEARL_EXTENSION_DOWNLOAD_PAGE).toString();
55
+ return `https://github.com/F-loat/mearl/releases/download/v${version}/mearl-chrome-v${version}.zip`;
50
56
  }
51
57
  function validateExtensionRelease(release) {
52
58
  if (!isMearlReleaseVersion(release.version)) {
53
59
  throw new Error('Remote extension config has an invalid latestVersion');
54
60
  }
55
- const expectedArchiveUrl = extensionArchiveUrl(release.version);
61
+ const configSource = process.env.MEARL_EXTENSION_CONFIG_URL;
62
+ const expectedArchiveUrl = configSource && configSource !== MEARL_EXTENSION_REMOTE_CONFIG_URL
63
+ ? new URL(`mearl-chrome-v${release.version}.zip`, configSource).toString()
64
+ : extensionArchiveUrl(release.version);
56
65
  let archiveUrl;
57
66
  try {
58
67
  archiveUrl = new URL(release.archiveUrl).toString();
@@ -73,7 +82,7 @@ function validateExtensionRelease(release) {
73
82
  };
74
83
  }
75
84
  export async function fetchBrowserExtensionRelease(fetchImpl = fetch) {
76
- const response = await fetchImpl(MEARL_EXTENSION_REMOTE_CONFIG_URL, { cache: 'no-store' });
85
+ const response = await fetchImpl(process.env.MEARL_EXTENSION_CONFIG_URL || MEARL_EXTENSION_REMOTE_CONFIG_URL, { cache: 'no-store' });
77
86
  if (!response.ok) {
78
87
  throw new Error(`Extension config returned HTTP ${response.status}`);
79
88
  }
@@ -84,16 +93,6 @@ export async function fetchBrowserExtensionRelease(fetchImpl = fetch) {
84
93
  version: typeof config.latestVersion === 'string' ? config.latestVersion : '',
85
94
  });
86
95
  }
87
- async function resolveExtensionArchive(fetchImpl) {
88
- const response = await fetchImpl(MEARL_EXTENSION_DOWNLOAD_PAGE, { redirect: 'follow' });
89
- if (!response.ok) {
90
- throw new Error(`Extension release page returned HTTP ${response.status}`);
91
- }
92
- const version = findLatestExtensionVersion(await response.text());
93
- if (!version)
94
- throw new Error('No Mearl browser extension archive was found on the release page');
95
- return { version, archiveUrl: extensionArchiveUrl(version) };
96
- }
97
96
  function readDevToolsActivePort(userDataDirectory) {
98
97
  try {
99
98
  const content = fs
@@ -282,12 +281,19 @@ async function inspectInstallationWithConnection(connection) {
282
281
  typeof installed.version !== 'string') {
283
282
  throw new Error('Chrome returned incomplete Mearl extension metadata');
284
283
  }
284
+ let version = installed.version;
285
+ try {
286
+ const manifest = JSON.parse(fs.readFileSync(path.join(installed.path, 'manifest.json'), 'utf8'));
287
+ if (manifest.version === installed.version)
288
+ version = readExtensionReleaseVersion(manifest) ?? version;
289
+ }
290
+ catch { }
285
291
  return {
286
292
  id: MEARL_EXTENSION_ID,
287
293
  location: installed.location,
288
294
  name: installed.name,
289
295
  path: installed.path,
290
- version: installed.version,
296
+ version,
291
297
  };
292
298
  }
293
299
  finally {
@@ -403,7 +409,7 @@ function readExtensionManifest(directory) {
403
409
  parsed.key.length === 0) {
404
410
  throw new Error('Downloaded archive is not a valid Manifest V3 extension');
405
411
  }
406
- if (!isMearlReleaseVersion(parsed.version)) {
412
+ if (!readExtensionReleaseVersion(parsed)) {
407
413
  throw new Error('Downloaded extension manifest has an invalid version');
408
414
  }
409
415
  return parsed;
@@ -437,7 +443,7 @@ async function downloadAndReplaceExtension(releaseInput, targetDirectory, fetchI
437
443
  await fs.promises.mkdir(stagingDirectory, { recursive: true });
438
444
  await extractArchive(archivePath, stagingDirectory);
439
445
  const manifest = readExtensionManifest(stagingDirectory);
440
- if (manifest.version !== release.version) {
446
+ if (readExtensionReleaseVersion(manifest) !== release.version) {
441
447
  throw new Error(`Extension archive version ${String(manifest.version)} does not match ${release.version}`);
442
448
  }
443
449
  await writeSetupMarker(stagingDirectory, targetDirectory);
@@ -475,7 +481,7 @@ export async function installMearlBrowserExtension(options = {}, dependencies =
475
481
  const targetDirectory = path.resolve(options.targetDirectory ?? resolveMearlExtensionDirectory());
476
482
  const release = options.release
477
483
  ? validateExtensionRelease(options.release)
478
- : await resolveExtensionArchive(fetchImpl);
484
+ : await fetchBrowserExtensionRelease(fetchImpl);
479
485
  const chromeUserDataDirectory = options.chromeUserDataDirectory ?? resolveChromeUserDataDirectory();
480
486
  const waitForCdpMs = Math.max(0, options.waitForCdpMs ?? 0);
481
487
  const useSharedCdpSession = !dependencies.inspectInstallation && !dependencies.loadUnpacked;
package/dist/cli.d.ts CHANGED
@@ -4,13 +4,17 @@ import { runMearlLifecycle, type MearlLifecycleOperation } from './lifecycle.js'
4
4
  import type { MearlProfile } from './profiles.js';
5
5
  import { ensureOfficialPlugin, installPlugins, setupPlugin, uninstallPlugin } from './plugin.js';
6
6
  import { installProviderPackage, uninstallProviderPackage, updateProviderPackage } from './provider.js';
7
- export declare const SETUP_VERSION: string;
7
+ import { runPresetCommand } from './preset.js';
8
+ import { prepareSetupPreset } from './presetUpgrade.js';
9
+ export { SETUP_VERSION } from './setupVersion.js';
8
10
  interface ParsedArgs {
9
11
  cloudMode?: 'websocket' | 'qoder';
10
12
  force?: boolean;
11
13
  full?: boolean;
12
14
  help: boolean;
13
- operation?: MearlLifecycleOperation | 'extension' | 'plugin' | 'provider';
15
+ operation?: MearlLifecycleOperation | 'extension' | 'plugin' | 'provider' | 'preset';
16
+ presetCommand?: 'apply' | 'update' | 'status';
17
+ presetSource?: string;
14
18
  pluginName?: string;
15
19
  pluginPath?: string;
16
20
  pluginInstallArgs?: string[];
@@ -25,6 +29,8 @@ interface ParsedArgs {
25
29
  yes: boolean;
26
30
  }
27
31
  export interface SetupCliDependencies {
32
+ preparePreset?: typeof prepareSetupPreset;
33
+ runPreset?: typeof runPresetCommand;
28
34
  registerPlugin?: typeof setupPlugin;
29
35
  ensureOfficialPlugin?: typeof ensureOfficialPlugin;
30
36
  installPlugins?: typeof installPlugins;
@@ -37,4 +43,3 @@ export interface SetupCliDependencies {
37
43
  }
38
44
  export declare function parseSetupArgs(argv: string[]): ParsedArgs;
39
45
  export declare function main(argv?: string[], interactiveTerminal?: boolean, dependencies?: SetupCliDependencies): Promise<number>;
40
- export {};