@mearl/client 2.21.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.
Files changed (134) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +57 -27
  3. package/dist/actionTimeouts.js +1 -1
  4. package/dist/artifacts.d.ts +1 -1
  5. package/dist/autoUpdate.js +1 -2
  6. package/dist/browserRegistry.d.ts +1 -1
  7. package/dist/check.d.ts +1 -1
  8. package/dist/check.js +4 -3
  9. package/dist/cli.js +4 -3
  10. package/dist/commands.d.ts +20 -20
  11. package/dist/commands.js +17 -15
  12. package/dist/index.d.ts +12 -15
  13. package/dist/index.js +7 -7
  14. package/dist/local.d.ts +3 -1
  15. package/dist/local.js +2 -1
  16. package/dist/pageEvalArguments.d.ts +1 -1
  17. package/dist/pageEvalArguments.js +1 -1
  18. package/dist/plugin-task-host.js +1 -1
  19. package/dist/plugin-worker.js +2 -2
  20. package/dist/plugin.d.ts +2 -118
  21. package/dist/plugin.js +2 -672
  22. package/dist/pluginModelSessionWorker.d.ts +2 -2
  23. package/dist/pluginModelSessionWorker.js +4 -4
  24. package/dist/{pluginHostConnection.d.ts → plugins/clients/pluginHostConnection.d.ts} +2 -2
  25. package/dist/{pluginHostConnection.js → plugins/clients/pluginHostConnection.js} +6 -7
  26. package/dist/{pluginModels.d.ts → plugins/clients/pluginModels.d.ts} +3 -3
  27. package/dist/{pluginPages.d.ts → plugins/clients/pluginPages.d.ts} +3 -3
  28. package/dist/{pluginPages.js → plugins/clients/pluginPages.js} +1 -1
  29. package/dist/{pluginState.d.ts → plugins/clients/pluginState.d.ts} +3 -3
  30. package/dist/{pluginTasks.d.ts → plugins/clients/pluginTasks.d.ts} +4 -4
  31. package/dist/{pluginTasks.js → plugins/clients/pluginTasks.js} +4 -4
  32. package/dist/plugins/officialPluginCatalog.d.ts +25 -0
  33. package/dist/plugins/officialPluginCatalog.js +125 -0
  34. package/dist/{officialPluginInstaller.js → plugins/officialPluginInstaller.js} +7 -4
  35. package/dist/{pluginRegistry.d.ts → plugins/pluginRegistry.d.ts} +1 -1
  36. package/dist/{pluginRegistry.js → plugins/pluginRegistry.js} +3 -3
  37. package/dist/{pluginTaskProtocol.d.ts → plugins/pluginTaskProtocol.d.ts} +2 -2
  38. package/dist/{pluginCommandWorker.js → plugins/runtime/pluginCommandWorker.js} +3 -3
  39. package/dist/{pluginDiagnostics.d.ts → plugins/runtime/pluginDiagnostics.d.ts} +4 -4
  40. package/dist/{pluginDiagnostics.js → plugins/runtime/pluginDiagnostics.js} +2 -2
  41. package/dist/{pluginExecution.d.ts → plugins/runtime/pluginExecution.d.ts} +3 -3
  42. package/dist/{pluginExecution.js → plugins/runtime/pluginExecution.js} +1 -1
  43. package/dist/{pluginExecutor.d.ts → plugins/runtime/pluginExecutor.d.ts} +3 -3
  44. package/dist/{pluginExecutor.js → plugins/runtime/pluginExecutor.js} +4 -4
  45. package/dist/{pluginExecutorProtocol.d.ts → plugins/runtime/pluginExecutorProtocol.d.ts} +4 -4
  46. package/dist/{pluginHost.d.ts → plugins/runtime/pluginHost.d.ts} +3 -3
  47. package/dist/{pluginHostPaths.js → plugins/runtime/pluginHostPaths.js} +1 -1
  48. package/dist/{pluginHostServer.js → plugins/runtime/pluginHostServer.js} +3 -3
  49. package/dist/{pluginModelCatalog.d.ts → plugins/runtime/pluginModelCatalog.d.ts} +1 -1
  50. package/dist/{pluginModelSessions.js → plugins/runtime/pluginModelSessions.js} +3 -3
  51. package/dist/{pluginPageManager.d.ts → plugins/runtime/pluginPageManager.d.ts} +4 -4
  52. package/dist/{pluginPageManager.js → plugins/runtime/pluginPageManager.js} +5 -5
  53. package/dist/{pluginRevision.d.ts → plugins/runtime/pluginRevision.d.ts} +1 -1
  54. package/dist/{pluginRevision.js → plugins/runtime/pluginRevision.js} +3 -2
  55. package/dist/{pluginRuntimeCleanup.js → plugins/runtime/pluginRuntimeCleanup.js} +2 -2
  56. package/dist/{pluginStateManager.d.ts → plugins/runtime/pluginStateManager.d.ts} +2 -2
  57. package/dist/{pluginStateManager.js → plugins/runtime/pluginStateManager.js} +2 -2
  58. package/dist/{pluginStateStore.d.ts → plugins/runtime/pluginStateStore.d.ts} +1 -1
  59. package/dist/{pluginStateStore.js → plugins/runtime/pluginStateStore.js} +1 -1
  60. package/dist/{pluginTaskManager.d.ts → plugins/runtime/pluginTaskManager.d.ts} +12 -12
  61. package/dist/{pluginTaskManager.js → plugins/runtime/pluginTaskManager.js} +6 -6
  62. package/dist/{pluginTaskStore.d.ts → plugins/runtime/pluginTaskStore.d.ts} +4 -4
  63. package/dist/{pluginTaskStore.js → plugins/runtime/pluginTaskStore.js} +1 -1
  64. package/dist/{pythonPlugin.d.ts → plugins/runtime/pythonPlugin.d.ts} +2 -2
  65. package/dist/{pythonPlugin.js → plugins/runtime/pythonPlugin.js} +2 -2
  66. package/dist/plugins/sdk/plugin.d.ts +115 -0
  67. package/dist/plugins/sdk/plugin.js +669 -0
  68. package/dist/{pluginAppProfiles.d.ts → plugins/sdk/pluginAppProfiles.d.ts} +1 -1
  69. package/dist/{pluginAppProfiles.js → plugins/sdk/pluginAppProfiles.js} +2 -2
  70. package/dist/{pluginModelDefinition.d.ts → plugins/sdk/pluginModelDefinition.d.ts} +1 -1
  71. package/dist/{pluginPageDefinition.d.ts → plugins/sdk/pluginPageDefinition.d.ts} +1 -1
  72. package/dist/{pluginPageDefinition.js → plugins/sdk/pluginPageDefinition.js} +1 -1
  73. package/dist/{pluginRecoveryDefinition.d.ts → plugins/sdk/pluginRecoveryDefinition.d.ts} +1 -1
  74. package/dist/{pluginStateDefinition.d.ts → plugins/sdk/pluginStateDefinition.d.ts} +2 -2
  75. package/dist/plugins/skillManifest.d.ts +10 -0
  76. package/dist/plugins/skillManifest.js +56 -0
  77. package/dist/runtimePaths.d.ts +4 -0
  78. package/dist/runtimePaths.js +8 -0
  79. package/dist/socket.d.ts +4 -2
  80. package/dist/socket.js +17 -6
  81. package/dist/unified.d.ts +2 -2
  82. package/dist/unified.js +7 -7
  83. package/package.json +9 -8
  84. package/dist/generated-app-profile-definition.d.ts +0 -130
  85. package/dist/generated-app-profile-definition.js +0 -458
  86. package/dist/generated-app-profile-runtime-types.d.ts +0 -213
  87. package/dist/generated-app-profile-runtime-types.js +0 -1
  88. package/dist/generated-browser-action-protocol.d.ts +0 -1147
  89. package/dist/generated-browser-action-protocol.js +0 -283
  90. package/dist/generated-plugin-diagnostics.d.ts +0 -110
  91. package/dist/generated-plugin-diagnostics.js +0 -1
  92. package/dist/generated-plugin-execution.d.ts +0 -27
  93. package/dist/generated-plugin-execution.js +0 -1
  94. package/dist/generated-plugin-models.d.ts +0 -64
  95. package/dist/generated-plugin-models.js +0 -1
  96. package/dist/generated-plugin-pages.d.ts +0 -76
  97. package/dist/generated-plugin-pages.js +0 -59
  98. package/dist/generated-plugin-recovery.d.ts +0 -32
  99. package/dist/generated-plugin-recovery.js +0 -1
  100. package/dist/generated-plugin-state.d.ts +0 -50
  101. package/dist/generated-plugin-state.js +0 -1
  102. package/dist/generated-plugin-tasks.d.ts +0 -74
  103. package/dist/generated-plugin-tasks.js +0 -7
  104. package/dist/generated-toolbox-icon.d.ts +0 -10
  105. package/dist/generated-toolbox-icon.js +0 -37
  106. package/dist/officialPluginCatalog.d.ts +0 -28
  107. package/dist/officialPluginCatalog.js +0 -29
  108. /package/dist/{pluginModels.js → plugins/clients/pluginModels.js} +0 -0
  109. /package/dist/{pluginState.js → plugins/clients/pluginState.js} +0 -0
  110. /package/dist/{officialPluginInstaller.d.ts → plugins/officialPluginInstaller.d.ts} +0 -0
  111. /package/dist/{pluginPageBundle.d.ts → plugins/pluginPageBundle.d.ts} +0 -0
  112. /package/dist/{pluginPageBundle.js → plugins/pluginPageBundle.js} +0 -0
  113. /package/dist/{pluginSource.d.ts → plugins/pluginSource.d.ts} +0 -0
  114. /package/dist/{pluginSource.js → plugins/pluginSource.js} +0 -0
  115. /package/dist/{pluginTaskProtocol.js → plugins/pluginTaskProtocol.js} +0 -0
  116. /package/dist/{pluginTaskWire.d.ts → plugins/pluginTaskWire.d.ts} +0 -0
  117. /package/dist/{pluginTaskWire.js → plugins/pluginTaskWire.js} +0 -0
  118. /package/dist/{pluginCommandWorker.d.ts → plugins/runtime/pluginCommandWorker.d.ts} +0 -0
  119. /package/dist/{pluginExecutorProtocol.js → plugins/runtime/pluginExecutorProtocol.js} +0 -0
  120. /package/dist/{pluginExecutorSupervisor.d.ts → plugins/runtime/pluginExecutorSupervisor.d.ts} +0 -0
  121. /package/dist/{pluginExecutorSupervisor.js → plugins/runtime/pluginExecutorSupervisor.js} +0 -0
  122. /package/dist/{pluginHost.js → plugins/runtime/pluginHost.js} +0 -0
  123. /package/dist/{pluginHostFiles.d.ts → plugins/runtime/pluginHostFiles.d.ts} +0 -0
  124. /package/dist/{pluginHostFiles.js → plugins/runtime/pluginHostFiles.js} +0 -0
  125. /package/dist/{pluginHostPaths.d.ts → plugins/runtime/pluginHostPaths.d.ts} +0 -0
  126. /package/dist/{pluginHostServer.d.ts → plugins/runtime/pluginHostServer.d.ts} +0 -0
  127. /package/dist/{pluginModelCatalog.js → plugins/runtime/pluginModelCatalog.js} +0 -0
  128. /package/dist/{pluginModelSessions.d.ts → plugins/runtime/pluginModelSessions.d.ts} +0 -0
  129. /package/dist/{pluginProcessTree.d.ts → plugins/runtime/pluginProcessTree.d.ts} +0 -0
  130. /package/dist/{pluginProcessTree.js → plugins/runtime/pluginProcessTree.js} +0 -0
  131. /package/dist/{pluginRuntimeCleanup.d.ts → plugins/runtime/pluginRuntimeCleanup.d.ts} +0 -0
  132. /package/dist/{pluginModelDefinition.js → plugins/sdk/pluginModelDefinition.js} +0 -0
  133. /package/dist/{pluginRecoveryDefinition.js → plugins/sdk/pluginRecoveryDefinition.js} +0 -0
  134. /package/dist/{pluginStateDefinition.js → plugins/sdk/pluginStateDefinition.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { type BrowserCommandAction } from './generated-browser-action-protocol.js';
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 ["仅用于非 BUC 请求;BUC 接口使用 mearl buc,不手工传 Token、DPoP 或 Ticket。", "body 不能与 formData/files 组合;bodyFile 以原始字节发送,不包 multipart boundary,不能用于 GET/HEAD。", "bodyFile.filePath 属于 native-host,最大 40 MiB;base64 解码后最大 7 MiB。multipart 不手工设置 Content-Type,由 Mearl 生成 boundary。", "filePath 属于 native-host 所在机器;无法引用远端路径时用 base64。BUC 上传的路径属于插件执行宿主。"];
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[] | \"mearl-services\" | { presets?: [\"mearl-services\"]; domains?: string[] }";
461
- readonly description: "从控制浏览器复制 Cookie:可传域名数组、Mearl 登录态预设,或组合预设与额外域名";
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
  }, {
@@ -487,7 +487,7 @@ export declare const COMMANDS: readonly [{
487
487
  }, {
488
488
  readonly name: "active";
489
489
  readonly type: "boolean";
490
- readonly description: "是否激活目标 Tab 并恢复最小化窗口,默认 false;响应返回 activation 验证结果";
490
+ readonly description: "是否激活目标 Tab,默认 false;扩展免打扰默认开启,使用后台焦点模拟,关闭后才切换前台;响应返回 activation";
491
491
  }, {
492
492
  readonly name: "openerTabId";
493
493
  readonly type: "number";
@@ -519,7 +519,7 @@ export declare const COMMANDS: readonly [{
519
519
  }, {
520
520
  readonly name: "appProfile";
521
521
  readonly type: "string";
522
- readonly description: "开 tab 即注入 App 客户端环境与 JSBridge;档案名同 set_app_profile,如 \"fliggy\"。需要 iframe WebView 和系统栏时同时传 emulation.deviceShell=true";
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://market.m.taobao.com/app/trip/rx-home/pages/home\",\"appProfile\":\"fliggy\"}'", "tab_open --payload '{\"url\":\"https://market.m.taobao.com/app/trip/rx-home/pages/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\":\"验证任务\"}'"];
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: "关闭指定标签页";
@@ -613,7 +613,7 @@ export declare const COMMANDS: readonly [{
613
613
  readonly required: true;
614
614
  readonly description: "目标标签页 ID";
615
615
  }];
616
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
616
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
617
617
  readonly notes: readonly ["selector / text / point 必须且只能提供一个。隐藏页 auto 使用 DOM;只有明确依赖真实用户手势时才激活页面。", "原生 select 可按 option 文本点击;checkbox/radio 返回 controlState.checkedBefore/checkedAfter。"];
618
618
  readonly examples: ["page_click --payload '{\"tabId\":12345,\"text\":\"提交\"}'", "page_click --payload '{\"tabId\":12345,\"text\":\"退款明细\",\"role\":\"button\"}'", "page_click --payload '{\"tabId\":12345,\"text\":\"确定\",\"scope\":\"@e12\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\"@e3\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\".submit-btn\"}'", "page_click --payload '{\"tabId\":12345,\"selector\":\".gesture-btn\",\"clickMode\":\"touch\"}'", "page_click --payload '{\"tabId\":12345,\"point\":{\"x\":336,\"y\":117}}'", "page_click --payload '{\"tabId\":12345,\"point\":{\"x\":196,\"y\":240},\"coordinateSpace\":\"active-frame\"}'"];
619
619
  }, {
@@ -643,7 +643,7 @@ export declare const COMMANDS: readonly [{
643
643
  readonly required: true;
644
644
  readonly description: "目标标签页 ID";
645
645
  }];
646
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
646
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
647
647
  readonly notes: readonly ["起点会自动滚入视口,终点必须同时位于当前视口;否则先滚动页面。隐藏页 auto 使用 DOM,不切换活动页。"];
648
648
  readonly examples: ["page_drag --payload '{\"tabId\":12345,\"from\":{\"x\":350,\"y\":80},\"to\":{\"x\":80,\"y\":80}}'", "page_drag --payload '{\"tabId\":12345,\"from\":\"@e3\",\"to\":\"#drop-zone\",\"dragMode\":\"mouse\"}'"];
649
649
  }, {
@@ -669,7 +669,7 @@ export declare const COMMANDS: readonly [{
669
669
  readonly required: true;
670
670
  readonly description: "目标标签页 ID";
671
671
  }];
672
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
672
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
673
673
  readonly examples: ["page_type --payload '{\"tabId\":12345,\"selector\":\"@e6\",\"text\":\"搜索关键词\"}'"];
674
674
  }, {
675
675
  readonly name: "page_hover";
@@ -685,7 +685,7 @@ export declare const COMMANDS: readonly [{
685
685
  readonly required: true;
686
686
  readonly description: "目标标签页 ID";
687
687
  }];
688
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
688
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
689
689
  readonly examples: ["page_hover --payload '{\"tabId\":12345,\"selector\":\".nav-menu\"}'"];
690
690
  }, {
691
691
  readonly name: "page_scroll";
@@ -713,7 +713,7 @@ export declare const COMMANDS: readonly [{
713
713
  readonly required: true;
714
714
  readonly description: "目标标签页 ID";
715
715
  }];
716
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data 返回 moved、atTop/atBottom、scrollYBefore/After、maxScrollY、resolvedContainer 和 ancestorDistance;自动发现的内部容器提供可复用 containerSelector。"];
716
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data 返回 moved、atTop/atBottom、scrollYBefore/After、maxScrollY、resolvedContainer 和 ancestorDistance;自动发现的内部容器提供可复用 containerSelector。"];
717
717
  readonly examples: ["page_scroll --payload '{\"tabId\":12345,\"direction\":\"down\"}'", "page_scroll --payload '{\"tabId\":12345,\"direction\":\"bottom\"}'", "page_scroll --payload '{\"tabId\":12345,\"selector\":\".virtual-list\",\"direction\":\"down\",\"distance\":800}'", "page_scroll --payload '{\"tabId\":12345,\"selector\":\"@e8\",\"containerPolicy\":\"nearest\",\"direction\":\"bottom\"}'"];
718
718
  }, {
719
719
  readonly name: "page_runtime";
@@ -821,7 +821,7 @@ export declare const COMMANDS: readonly [{
821
821
  readonly description: "目标标签页 ID";
822
822
  }];
823
823
  readonly notes: readonly ["隐藏页 DOM 模式支持 Tab 焦点移动、原生控件 Enter/Space 激活和输入框 Enter 提交;编辑、选择、方向键和页面滚动等原生行为需可见页与 pressMode=keyboard。"];
824
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data.dispatchMode / fallbackReason / defaultAction 说明实际输入路径。"];
824
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。", "action.data.dispatchMode / fallbackReason / defaultAction 说明实际输入路径。"];
825
825
  readonly examples: ["page_press --payload '{\"tabId\":12345,\"key\":\"Enter\"}'"];
826
826
  }, {
827
827
  readonly name: "page_wait";
@@ -911,7 +911,7 @@ export declare const COMMANDS: readonly [{
911
911
  readonly required: true;
912
912
  readonly description: "目标标签页 ID";
913
913
  }];
914
- 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
914
+ 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 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。", "observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。", "effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。", "fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。", "显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。"];
915
915
  readonly notes: readonly ["直接写入 input[type=file],不依赖 file chooser;隐藏的文件节点也可上传。外部 Provider 的文件中转能力查询 mearl <providerId>。"];
916
916
  readonly examples: ["page_upload --payload '{\"tabId\":12345,\"selector\":\"#file-input\",\"filePaths\":[\"/Users/me/photo.jpg\"]}'"];
917
917
  }, {
@@ -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: "设置 App 客户端环境与 JSBridge;可同时设置 MTop 页面接口环境,传 emulation 时联动设备模拟";
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 关闭环境改写,省略时保持当前设置。扩展模式全局生效,CDP 模式仅作用于目标 tab";
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\":\"edith_switch_br.rx-vehicle-search_home\",\"domain\":\"taobao.com\"}'", "get_cookie --payload '{\"tabId\":12345,\"name\":\"tracknick\",\"url\":\"https://www.taobao.com/\",\"domain\":\"taobao.com\",\"path\":\"/\"}'"];
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\":\"edith_switch_br.rx-vehicle-search_home\",\"value\":\"3.6.63\",\"domain\":\"taobao.com\",\"reload\":true}'"];
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。仅在非 BUC send_request 报域权限缺失时申请,BUC 不使用浏览器域权限。", "弹窗等待用户选择,90 秒超时或关闭按拒绝处理;granted=true 后才重试原请求。"];
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
  }, {
package/dist/commands.js CHANGED
@@ -1,4 +1,4 @@
1
- import { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, } from './generated-browser-action-protocol.js';
1
+ import { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, } from '@mearl/browser-core';
2
2
  /** 容器档案名列表(拼进参数说明,新增档案无需改本文件) */
3
3
  const APP_PROFILE_NAME_LIST = APP_PROFILE_NAMES.join('/');
4
4
  const DEVICE_PRESET_TYPE = BROWSER_DEVICE_PRESET_NAMES.map(name => JSON.stringify(name)).join(' | ');
@@ -32,6 +32,7 @@ const PAGE_ACTION_RESULT = [
32
32
  'observe=false 且未开启 diagnostics 时返回裸动作结果(如 { clicked: true }),没有 action/observation;开启 diagnostics 时返回 { action, diagnostics }。',
33
33
  '包装结果中的 action.stage=precondition 表示未派发,省略 observation/diagnostics;dispatch-uncertain 表示可能已派发,先查看 action.attempt 与可用观察或最小快照核验,避免重复提交。失败以退出码 1 结束。',
34
34
  'observation.effects 返回通知、控件和焦点增量,可直接复用 node.ref/selector;changed=true 且 effects 为空不表示失败。',
35
+ 'effects.texts 按需返回普通可见文本的 selector/text,不代表可点击控件或业务成功;超限或覆盖不完整时仍提示补快照。',
35
36
  'fullSnapshotRecommended/snapshotReasons 提示是否补充快照;openedTabs 返回可继续操作的 tabId 和 ready。navigation 模式的 ready 表示新页面就绪。',
36
37
  '显式开启的诊断通道在 diagnostics 中返回动作期间增量,与 observe 独立。',
37
38
  ];
@@ -297,6 +298,7 @@ export const COMMANDS = [
297
298
  ],
298
299
  notes: [
299
300
  '扩展模式规则持久化;CDP 仅支持会话级 modifyHeaders 请求头 set,不支持响应头、initiatorDomains 或其他动作。Provider 是否支持以其能力声明为准。',
301
+ '扩展模式会检查规则请求 URL 和显式来源域名的访问权限;缺失时仍保存规则,返回 warnings 和 missingOrigins,不自动弹窗。可在请求规则页面授权,或按提示调用 request_domain_permission。复杂 URL 表达式无法完整推断域名时会提示手动检查。',
300
302
  ],
301
303
  examples: [
302
304
  `set_rule --payload '{"actionType":"block","filter":"^https://example\\\\.com/ads/.*"}'`,
@@ -347,10 +349,10 @@ export const COMMANDS = [
347
349
  { name: 'timeout', type: 'number', description: '超时毫秒数,默认 30000' },
348
350
  ],
349
351
  notes: [
350
- '仅用于非 BUC 请求;BUC 接口使用 mearl buc,不手工传 Token、DPoP 或 Ticket。',
352
+ '需要托管认证的接口使用相应能力插件;不要手工传入其管理的凭据。',
351
353
  'body 不能与 formData/files 组合;bodyFile 以原始字节发送,不包 multipart boundary,不能用于 GET/HEAD。',
352
354
  'bodyFile.filePath 属于 native-host,最大 40 MiB;base64 解码后最大 7 MiB。multipart 不手工设置 Content-Type,由 Mearl 生成 boundary。',
353
- 'filePath 属于 native-host 所在机器;无法引用远端路径时用 base64。BUC 上传的路径属于插件执行宿主。',
355
+ 'filePath 属于请求执行宿主;无法引用远端路径时用 base64。',
354
356
  ],
355
357
  result: [
356
358
  '返回 status、statusText、headers、body、bodyType、attachedCookieCount;bodyType 为 json/text/base64,二进制 body 需解码后保存。',
@@ -458,8 +460,8 @@ export const COMMANDS = [
458
460
  { name: 'executablePath', type: 'string', description: '自定义 Chrome 可执行文件路径' },
459
461
  {
460
462
  name: 'copyCookieDomains',
461
- type: 'string[] | "mearl-services" | { presets?: ["mearl-services"]; domains?: string[] }',
462
- description: '从控制浏览器复制 Cookie:可传域名数组、Mearl 登录态预设,或组合预设与额外域名',
463
+ type: 'string[] | string | { presets?: string[]; domains?: string[] }',
464
+ description: '从控制浏览器复制 Cookie:可传域名数组、已安装能力提供的范围名,或组合范围与额外域名',
463
465
  },
464
466
  ],
465
467
  examples: [
@@ -499,7 +501,7 @@ export const COMMANDS = [
499
501
  {
500
502
  name: 'active',
501
503
  type: 'boolean',
502
- description: '是否激活目标 Tab 并恢复最小化窗口,默认 false;响应返回 activation 验证结果',
504
+ description: '是否激活目标 Tab,默认 false;扩展免打扰默认开启,使用后台焦点模拟,关闭后才切换前台;响应返回 activation',
503
505
  },
504
506
  {
505
507
  name: 'openerTabId',
@@ -539,7 +541,7 @@ export const COMMANDS = [
539
541
  {
540
542
  name: 'appProfile',
541
543
  type: 'string',
542
- description: '开 tab 即注入 App 客户端环境与 JSBridge;档案名同 set_app_profile,如 "fliggy"。需要 iframe WebView 和系统栏时同时传 emulation.deviceShell=true',
544
+ description: '按已安装档案应用 App 环境;内置基础档案只提供 UA/版本,完整桥由能力包提供。需要 iframe WebView 和系统栏时同时传 emulation.deviceShell=true',
543
545
  },
544
546
  {
545
547
  name: 'os',
@@ -565,8 +567,8 @@ export const COMMANDS = [
565
567
  `tab_open --payload '{"url":"https://example.com"}'`,
566
568
  `tab_open --payload '{"url":"https://example.com/page","reuse":"prefer","match":{"ignoreSearch":true}}'`,
567
569
  `tab_open --payload '{"url":"https://m.example.com","emulation":{"preset":"iphone-17-pro"}}'`,
568
- `tab_open --payload '{"url":"https://market.m.taobao.com/app/trip/rx-home/pages/home","appProfile":"fliggy"}'`,
569
- `tab_open --payload '{"url":"https://market.m.taobao.com/app/trip/rx-home/pages/home","appProfile":"fliggy","emulation":{"preset":"ipad-mini-a17-pro","orientation":"landscape","deviceShell":true,"splitScreen":true}}'`,
570
+ `tab_open --payload '{"url":"https://example.com/app/home","appProfile":"fliggy"}'`,
571
+ `tab_open --payload '{"url":"https://example.com/app/home","appProfile":"fliggy","emulation":{"preset":"ipad-mini-a17-pro","orientation":"landscape","deviceShell":true,"splitScreen":true}}'`,
570
572
  `tab_open --payload '{"url":"https://example.com","appProfile":"fliggy","os":"android"}'`,
571
573
  `tab_open --payload '{"url":"https://example.com","group":"验证任务"}'`,
572
574
  ],
@@ -1165,7 +1167,7 @@ export const COMMANDS = [
1165
1167
  },
1166
1168
  {
1167
1169
  name: 'set_app_profile',
1168
- description: '设置 App 客户端环境与 JSBridge;可同时设置 MTop 页面接口环境,传 emulation 时联动设备模拟',
1170
+ description: '设置已安装的 App 档案;完整 JSBridge 由能力包提供。可同时设置 MTop 页面接口环境,传 emulation 时联动设备模拟',
1169
1171
  summary: '设置或清除目标标签页的 App 容器模拟',
1170
1172
  params: [
1171
1173
  { name: 'enabled', type: 'boolean', required: true, description: 'true=启用,false=清除' },
@@ -1199,7 +1201,7 @@ export const COMMANDS = [
1199
1201
  {
1200
1202
  name: 'mtopEnv',
1201
1203
  type: '"default" | "prod" | "pre"',
1202
- description: '可选 MTop 页面接口环境;default 关闭环境改写,省略时保持当前设置。扩展模式全局生效,CDP 模式仅作用于目标 tab',
1204
+ description: '可选 MTop 页面接口环境;default 关闭环境改写,省略时保持当前设置。仅作用于目标 tab',
1203
1205
  },
1204
1206
  {
1205
1207
  name: 'emulation',
@@ -1279,8 +1281,8 @@ export const COMMANDS = [
1279
1281
  examples: [
1280
1282
  `get_cookie --payload '{"tabId":12345,"name":"feature_flag"}'`,
1281
1283
  `get_cookie --payload '{"url":"https://www.taobao.com/","name":"tracknick"}'`,
1282
- `get_cookie --payload '{"tabId":12345,"name":"edith_switch_br.rx-vehicle-search_home","domain":"taobao.com"}'`,
1283
- `get_cookie --payload '{"tabId":12345,"name":"tracknick","url":"https://www.taobao.com/","domain":"taobao.com","path":"/"}'`,
1284
+ `get_cookie --payload '{"tabId":12345,"name":"feature_channel","domain":"example.com"}'`,
1285
+ `get_cookie --payload '{"tabId":12345,"name":"tracknick","url":"https://www.taobao.com/","domain":"example.com","path":"/"}'`,
1284
1286
  ],
1285
1287
  },
1286
1288
  {
@@ -1326,7 +1328,7 @@ export const COMMANDS = [
1326
1328
  examples: [
1327
1329
  `set_cookie --payload '{"tabId":12345,"name":"feature_flag","value":"enabled"}'`,
1328
1330
  `set_cookie --payload '{"url":"https://www.taobao.com/","name":"feature_flag","value":"enabled"}'`,
1329
- `set_cookie --payload '{"tabId":12345,"name":"edith_switch_br.rx-vehicle-search_home","value":"3.6.63","domain":"taobao.com","reload":true}'`,
1331
+ `set_cookie --payload '{"tabId":12345,"name":"feature_channel","value":"3.6.63","domain":"example.com","reload":true}'`,
1330
1332
  ],
1331
1333
  },
1332
1334
  // ── 其他 ──────────────────────────────────────────────────────────────────
@@ -1351,7 +1353,7 @@ export const COMMANDS = [
1351
1353
  },
1352
1354
  ],
1353
1355
  notes: [
1354
- 'domain 使用纯主机名,不传 URL。仅在非 BUC send_request 报域权限缺失时申请,BUC 不使用浏览器域权限。',
1356
+ 'domain 使用纯主机名,不传 URL。在 send_request 或 set_rule 提示缺少浏览器域名权限时申请。',
1355
1357
  '弹窗等待用户选择,90 秒超时或关闭按拒绝处理;granted=true 后才重试原请求。',
1356
1358
  ],
1357
1359
  result: ['返回 granted、domain,授权成功时包含 origin。'],
package/dist/index.d.ts CHANGED
@@ -1,21 +1,21 @@
1
- export { PluginHostConnection, type PluginHostConnectionOptions, type PluginHostClientOptions, } from './pluginHostConnection.js';
1
+ export { PluginHostConnection, type PluginHostConnectionOptions, type PluginHostClientOptions, } from './plugins/clients/pluginHostConnection.js';
2
2
  /**
3
3
  * @mearl/client — unified Mearl browser client
4
4
  *
5
5
  * Discovers browser targets on this machine and every configured cloud connector,
6
6
  * then routes actions using the global browser ids returned by browser_list.
7
7
  */
8
- export { PluginTaskClient, type PluginTaskStartOptions, type PluginTaskWaitOptions, type PluginTaskClientOptions, type PluginTask, type PluginTaskEvents, type PluginTaskListResult, type PluginTaskStartResult, } from './pluginTasks.js';
9
- export { PluginPageClient } from './pluginPages.js';
10
- export type { PluginPageInstance, PluginPageEvents, PluginPageRuntime, PluginPageActivation, PluginPageTarget, PluginPageOperation, } from './pluginPages.js';
11
- export { executeRegisteredPlugin, type PluginExecutorOptions, type PluginExecutorDependencies, type PluginCommandContext, type PluginExecutionHost, type PluginInvocationIdentity, type PluginInvocationSource, } from './plugin.js';
8
+ export { PluginTaskClient, type PluginTaskStartOptions, type PluginTaskWaitOptions, type PluginTaskClientOptions, type PluginTask, type PluginTaskEvents, type PluginTaskListResult, type PluginTaskStartResult, } from './plugins/clients/pluginTasks.js';
9
+ export { PluginPageClient } from './plugins/clients/pluginPages.js';
10
+ export type { PluginPageInstance, PluginPageEvents, PluginPageRuntime, PluginPageActivation, PluginPageTarget, PluginPageOperation, } from './plugins/clients/pluginPages.js';
11
+ export { executeRegisteredPlugin, type PluginExecutorOptions, type PluginExecutorDependencies, type PluginCommandContext, type PluginExecutionHost, type PluginInvocationIdentity, type PluginInvocationSource, } from './plugins/sdk/plugin.js';
12
12
  export { UnifiedClient, UnifiedClient as MearlClient, decodeBrowserTarget, invoke, invokePlugin, listCloudConnectors, } from './unified.js';
13
13
  export type { UnifiedClientOptions, UnifiedInvokeOptions, UnifiedInvokeOptions as InvokeOptions, } from './unified.js';
14
- export type { PluginInvocation, PluginInvokeOptions, PluginProgress, StructuredPluginProgress, } from './plugin.js';
15
- export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSER_CAPABILITY_ACTIONS, BROWSER_COMMAND_ACTIONS, EXTENSION_BROWSER_ACTIONS, PAGE_ACT_ACTIONS, SEND_REQUEST_MAX_FILES, SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES, SEND_REQUEST_MAX_TOTAL_FILE_BYTES, isBrowserAction, isBrowserCapabilityAction, isBrowserCommandAction, isExtensionBrowserAction, } from './generated-browser-action-protocol.js';
16
- export type { ActionStep, AppProfileName, BrowserAction, BrowserActionMap, BrowserActionRequest, BrowserActionResponse, BrowserCapabilities, BrowserCapabilityAction, BrowserCloseParams, BrowserCommandAction, BrowserInfo, BrowserInfoBase, BrowserJsonValue, BrowserLaunchParams, BrowserProviderOperation, BrowserListResult, BrowserPairingInfo, BrowserReleaseFailure, BrowserReleaseResult, BrowserProviderDefinition, BrowserProviderIdentity, BrowserProviderInputSchema, BrowserProviderListResult, BrowserReference, BrowserDetails, BrowserSource, BrowserStatus, BrowserScreenshotKind, BrowserTransport, CaptureCheckpointParams, CaptureCheckpointResult, BrowserDevicePresetName, BrowserEmulationOptions, ExtensionBrowserAction, GetCookieParams, GetCookieResult, GetEventsParams, GetLogsParams, GetMocksParams, GetRequestsParams, ManagedBrowserInfo, PageClickParams, PageDragEndpoint, PageDragParams, PageDragPoint, PageActAction, PageDiagnosticsOptions, PageDiagnosticsSetting, PageEvalParams, PageFramesParams, PageHoverParams, PageInspectFilter, PageInspectParams, PageNavigateParams, PageObservationWaitOptions, PagePressParams, PageScreenshotParams, PageScrollParams, PageSnapshotParams, PageSnapshotQuery, PageTypeParams, PageUploadParams, PageWaitParams, RegularBrowserInfo, RequestDomainPermissionParams, RulesResult, RunActionName, RunActionsParams, SelectBrowserParams, SelectBrowserResult, SendRequestFile, SendRequestBinaryBody, SendRequestFormValue, SendMtopRequestParams, SendRequestParams, SetAppProfileParams, SetCookieParams, SetCookieResult, SetDeviceEmulationParams, SetMockParams, SetRuleParams, SetTimezoneParams, SetTimezoneResult, TabCloseParams, TabOpenParams, } from './generated-browser-action-protocol.js';
14
+ export type { PluginInvocation, PluginInvokeOptions, PluginProgress, StructuredPluginProgress, } from './plugins/sdk/plugin.js';
15
+ export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSER_CAPABILITY_ACTIONS, BROWSER_COMMAND_ACTIONS, EXTENSION_BROWSER_ACTIONS, PAGE_ACT_ACTIONS, SEND_REQUEST_MAX_FILES, SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES, SEND_REQUEST_MAX_TOTAL_FILE_BYTES, isBrowserAction, isBrowserCapabilityAction, isBrowserCommandAction, isExtensionBrowserAction, } from '@mearl/browser-core';
16
+ export type { ActionStep, AppProfileName, BrowserAction, BrowserActionMap, BrowserActionRequest, BrowserActionResponse, BrowserCapabilities, BrowserCapabilityAction, BrowserCloseParams, BrowserCommandAction, BrowserInfo, BrowserInfoBase, BrowserJsonValue, BrowserLaunchParams, BrowserProviderOperation, BrowserListResult, BrowserPairingInfo, BrowserReleaseFailure, BrowserReleaseResult, BrowserProviderDefinition, BrowserProviderIdentity, BrowserProviderInputSchema, BrowserProviderListResult, BrowserReference, BrowserDetails, BrowserSource, BrowserStatus, BrowserScreenshotKind, BrowserTransport, CaptureCheckpointParams, CaptureCheckpointResult, BrowserDevicePresetName, BrowserEmulationOptions, ExtensionBrowserAction, GetCookieParams, GetCookieResult, GetEventsParams, GetLogsParams, GetMocksParams, GetRequestsParams, ManagedBrowserInfo, PageClickParams, PageDragEndpoint, PageDragParams, PageDragPoint, PageActAction, PageDiagnosticsOptions, PageDiagnosticsSetting, PageEvalParams, PageFramesParams, PageHoverParams, PageInspectFilter, PageInspectParams, PageNavigateParams, PageObservationWaitOptions, PagePressParams, PageScreenshotParams, PageScrollParams, PageSnapshotParams, PageSnapshotQuery, PageTypeParams, PageUploadParams, PageWaitParams, RegularBrowserInfo, RequestDomainPermissionParams, RulesResult, RunActionName, RunActionsParams, SelectBrowserParams, SelectBrowserResult, SendRequestFile, SendRequestBinaryBody, SendRequestFormValue, SendMtopRequestParams, SendRequestParams, SetAppProfileParams, SetCookieParams, SetCookieResult, SetDeviceEmulationParams, SetMockParams, SetRuleParams, SetTimezoneParams, SetTimezoneResult, TabCloseParams, TabOpenParams, } from '@mearl/browser-core';
17
17
  import { type UnifiedInvokeOptions } from './unified.js';
18
- import type * as Protocol from './generated-browser-action-protocol.js';
18
+ import type * as Protocol from '@mearl/browser-core';
19
19
  export declare function tabCheckpoint(params: Protocol.CaptureCheckpointParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_checkpoint'>>;
20
20
  /** Compatibility wrapper for tabCheckpoint. */
21
21
  export declare function captureCheckpoint(params: Protocol.CaptureCheckpointParams, options?: UnifiedInvokeOptions): Promise<Protocol.BrowserActionResponse<'tab_checkpoint'>>;
@@ -66,9 +66,6 @@ export declare function saveArtifact(artifact: Protocol.BrowserArtifact & {
66
66
  outputPath: string;
67
67
  bytes: number;
68
68
  }>;
69
- export { PluginStateClient } from './pluginState.js';
70
- export { PluginModelClient } from './pluginModels.js';
71
- export type * from './generated-plugin-state.js';
72
- export type * from './generated-plugin-models.js';
73
- export type * from './generated-plugin-recovery.js';
74
- export type * from './generated-plugin-diagnostics.js';
69
+ export { PluginStateClient } from './plugins/clients/pluginState.js';
70
+ export { PluginModelClient } from './plugins/clients/pluginModels.js';
71
+ export type * from '@mearl/browser-core';
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
- export { PluginHostConnection, } from './pluginHostConnection.js';
1
+ export { PluginHostConnection, } from './plugins/clients/pluginHostConnection.js';
2
2
  /**
3
3
  * @mearl/client — unified Mearl browser client
4
4
  *
5
5
  * Discovers browser targets on this machine and every configured cloud connector,
6
6
  * then routes actions using the global browser ids returned by browser_list.
7
7
  */
8
- export { PluginTaskClient, } from './pluginTasks.js';
9
- export { PluginPageClient } from './pluginPages.js';
10
- export { executeRegisteredPlugin, } from './plugin.js';
8
+ export { PluginTaskClient, } from './plugins/clients/pluginTasks.js';
9
+ export { PluginPageClient } from './plugins/clients/pluginPages.js';
10
+ export { executeRegisteredPlugin, } from './plugins/sdk/plugin.js';
11
11
  export { UnifiedClient, UnifiedClient as MearlClient, decodeBrowserTarget, invoke, invokePlugin, listCloudConnectors, } from './unified.js';
12
- export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSER_CAPABILITY_ACTIONS, BROWSER_COMMAND_ACTIONS, EXTENSION_BROWSER_ACTIONS, PAGE_ACT_ACTIONS, SEND_REQUEST_MAX_FILES, SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES, SEND_REQUEST_MAX_TOTAL_FILE_BYTES, isBrowserAction, isBrowserCapabilityAction, isBrowserCommandAction, isExtensionBrowserAction, } from './generated-browser-action-protocol.js';
12
+ export { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, BROWSER_ACTIONS, BROWSER_CAPABILITY_ACTIONS, BROWSER_COMMAND_ACTIONS, EXTENSION_BROWSER_ACTIONS, PAGE_ACT_ACTIONS, SEND_REQUEST_MAX_FILES, SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES, SEND_REQUEST_MAX_TOTAL_FILE_BYTES, isBrowserAction, isBrowserCapabilityAction, isBrowserCommandAction, isExtensionBrowserAction, } from '@mearl/browser-core';
13
13
  import { invoke } from './unified.js';
14
14
  export function tabCheckpoint(params, options) {
15
15
  return invoke('tab_checkpoint', params, options);
@@ -144,5 +144,5 @@ export async function saveArtifact(artifact, outputPath, options = {}) {
144
144
  const { exportArtifact } = await import('./artifacts.js');
145
145
  return exportArtifact({ invoke }, artifact, outputPath, options);
146
146
  }
147
- export { PluginStateClient } from './pluginState.js';
148
- export { PluginModelClient } from './pluginModels.js';
147
+ export { PluginStateClient } from './plugins/clients/pluginState.js';
148
+ export { PluginModelClient } from './plugins/clients/pluginModels.js';
package/dist/local.d.ts CHANGED
@@ -3,5 +3,7 @@
3
3
  * User-facing integrations should import from `@mearl/client` so browser routing
4
4
  * remains consistent across local and remote sources.
5
5
  */
6
- export { CLIENT_VERSION, SOCKET_PATH, decorateBrowserListResult, getDefaultBrowser, invoke, setDefaultBrowser, } from './socket.js';
6
+ export { CLIENT_VERSION, SOCKET_PATH, decorateBrowserListResult, getDefaultBrowser, invoke, invokeLocalHost, setDefaultBrowser, } from './socket.js';
7
7
  export type { InvokeOptions } from './socket.js';
8
+ export { listLiveBrowsers } from './browserRegistry.js';
9
+ export type { LiveBrowser } from './browserRegistry.js';
package/dist/local.js CHANGED
@@ -3,4 +3,5 @@
3
3
  * User-facing integrations should import from `@mearl/client` so browser routing
4
4
  * remains consistent across local and remote sources.
5
5
  */
6
- export { CLIENT_VERSION, SOCKET_PATH, decorateBrowserListResult, getDefaultBrowser, invoke, setDefaultBrowser, } from './socket.js';
6
+ export { CLIENT_VERSION, SOCKET_PATH, decorateBrowserListResult, getDefaultBrowser, invoke, invokeLocalHost, setDefaultBrowser, } from './socket.js';
7
+ export { listLiveBrowsers } from './browserRegistry.js';
@@ -1,3 +1,3 @@
1
- import { type PageEvalParams } from './generated-browser-action-protocol.js';
1
+ import { type PageEvalParams } from '@mearl/browser-core';
2
2
  /** Serialize page_eval arguments within transport limits while retaining the caller's execution world. */
3
3
  export declare function invokePageEvalWithArgs(invoke: (payload: Record<string, unknown>, transfer?: boolean) => Promise<any>, params: PageEvalParams): Promise<any>;
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { validatePageUserScriptParams, resolvePageEvalExpression, } from './generated-browser-action-protocol.js';
2
+ import { validatePageUserScriptParams, resolvePageEvalExpression, } from '@mearl/browser-core';
3
3
  const CHUNK_CHARACTERS = 48 * 1024;
4
4
  /** Serialize page_eval arguments within transport limits while retaining the caller's execution world. */
5
5
  export async function invokePageEvalWithArgs(invoke, params) {
@@ -1,4 +1,4 @@
1
- import { startPluginHostServer } from './pluginHostServer.js';
1
+ import { startPluginHostServer } from './plugins/runtime/pluginHostServer.js';
2
2
  try {
3
3
  const server = await startPluginHostServer();
4
4
  const close = () => {
@@ -1,9 +1,9 @@
1
- import { supervisePluginExecutor } from './pluginExecutorSupervisor.js';
1
+ import { supervisePluginExecutor } from './plugins/runtime/pluginExecutorSupervisor.js';
2
2
  if (process.argv[2] === '--command') {
3
3
  let command;
4
4
  // Register IPC before loading command code so startup messages retain their order.
5
5
  process.on('message', (message) => {
6
- void (command ??= import('./pluginCommandWorker.js'))
6
+ void (command ??= import('./plugins/runtime/pluginCommandWorker.js'))
7
7
  .then(worker => worker.handlePluginWorkerMessage(message))
8
8
  .catch(error => {
9
9
  process.stderr.write(String(error));
package/dist/plugin.d.ts CHANGED
@@ -1,118 +1,2 @@
1
- import type { PluginTaskRecoveryDeclaration, PluginTaskCheckpoint, PluginCheckpointMigrationInput } from './generated-plugin-recovery.js';
2
- import type { PluginStateDeclaration } from './generated-plugin-state.js';
3
- import type { PluginModelRequest, PluginModelResult } from './generated-plugin-models.js';
4
- import type { PluginPageRuntime } from './generated-plugin-pages.js';
5
- import type { AppProfileContribution } from './generated-app-profile-definition.js';
6
- export type { AppProfileContribution, AppProfileDefinition, } from './generated-app-profile-definition.js';
7
- export { invokePageEvalWithArgs } from './pageEvalArguments.js';
8
- import { type OfficialPluginInstaller } from './officialPluginInstaller.js';
9
- import { type PluginToolboxContribution, type PluginRegistration } from './pluginRegistry.js';
10
- import { type PluginCommandContext, type PluginInvocationIdentity, type PluginInvocationSource } from './pluginExecution.js';
11
- import type { UnifiedInvokeOptions } from './unified.js';
12
- export type { PluginCommandContext, PluginExecutionHost, PluginInvocationIdentity, PluginInvocationSource, } from './pluginExecution.js';
13
- export { executeRegisteredPlugin, type PluginExecutorOptions, type PluginExecutorDependencies, } from './pluginExecutor.js';
14
- export { PluginTaskClient } from './pluginTasks.js';
15
- export { cleanupPluginRuntime } from './pluginRuntimeCleanup.js';
16
- export { PluginPageClient } from './pluginPages.js';
17
- export { assertPluginName, findPluginDirectoryEntry, findPluginEntry, findPluginRegistration, listPluginNames, pluginDirectory, registerPlugin, resolvePluginEntry, unregisterPlugin, PluginError, readPluginPageBundleChunk, type PluginRegistration, type PluginRegistrationOptions, type PluginToolboxAgentConfig, type PluginPageBundleRegistration, type PluginToolboxContribution, type PluginToolboxLocale, type PluginToolboxSandboxPage, } from './pluginRegistry.js';
18
- export { findOfficialPlugin, listOfficialPluginNames, OFFICIAL_PLUGIN_MANAGER, OFFICIAL_PLUGINS, type OfficialPluginDefinition, type OfficialPluginName, } from './officialPluginCatalog.js';
19
- export type PluginOptions = UnifiedInvokeOptions;
20
- export interface StructuredPluginProgress {
21
- message: string;
22
- data?: Record<string, unknown>;
23
- }
24
- export type PluginProgress = string | StructuredPluginProgress;
25
- export interface PluginInvocation {
26
- command: string;
27
- input: Record<string, any>;
28
- }
29
- export interface PluginInvokeOptions extends UnifiedInvokeOptions {
30
- onProgress?: (progress: PluginProgress) => void;
31
- signal?: AbortSignal;
32
- /** Audit label supplied by the entry point, never an authorization decision. */
33
- source?: PluginInvocationSource;
34
- }
35
- export interface PluginExecutionContext {
36
- runModel?(plugin: string, request: PluginModelRequest, options: Pick<PluginInvokeOptions, 'signal' | 'onProgress'>): Promise<PluginModelResult>;
37
- ensurePlugin?: OfficialPluginInstaller;
38
- source?: PluginInvocationSource;
39
- parentInvocation?: PluginInvocationIdentity;
40
- invocation?: PluginInvocationIdentity;
41
- resolveRegistration?: (name: string) => PluginRegistration | undefined;
42
- invoke(action: string, payload?: Record<string, any>, options?: UnifiedInvokeOptions, onProgress?: PluginInvokeOptions['onProgress']): Promise<any>;
43
- }
44
- export interface PluginApp {
45
- readonly options: Readonly<PluginOptions>;
46
- /** Examples omit the `mearl <plugin>` prefix, which help adds when displayed. */
47
- command(signature: string, handler: PluginHandler, description?: string, examples?: string[]): void;
48
- /** Registers a page-only command, also declared in toolbox.page.commands. */
49
- state(collection: string, operation: string, input?: Record<string, unknown>): Promise<any>;
50
- model(request: PluginModelRequest, options?: Pick<PluginInvokeOptions, 'onProgress'>): Promise<PluginModelResult>;
51
- runtimeCommand(signature: string, handler: PluginHandler, description?: string, examples?: string[]): void;
52
- recoveryCommand(command: string, handler: PluginHandler): void;
53
- checkpointMigration(command: string, handler: (input: PluginCheckpointMigrationInput, context: PluginCommandContext) => unknown | Promise<unknown>): void;
54
- checkpoint(data: unknown, expectedSequence: number): Promise<PluginTaskCheckpoint>;
55
- page(operation: string, input?: Record<string, unknown>): Promise<any>;
56
- toolboxCommand(signature: string, handler: PluginHandler, description?: string, examples?: string[]): void;
57
- invoke(action: string, payload?: Record<string, any>, options?: UnifiedInvokeOptions): Promise<any>;
58
- progress(progress: PluginProgress): void;
59
- }
60
- export type PluginHandler = (input: Record<string, any>, context: PluginCommandContext) => unknown | Promise<unknown>;
61
- /** 工具列表仅检查入口;页面资源只在打开对应工具时检查。 */
62
- export declare function refreshRegisteredPlugin(name: string, includePage?: boolean): Promise<PluginRegistration | undefined>;
63
- /** 注册和执行复用同一宿主能力边界;仅 handler 执行期间开放浏览器调用。 */
64
- export declare function loadPlugin(entry: string, context: Pick<PluginApp, 'options' | 'progress'> & {
65
- invoke: PluginExecutionContext['invoke'];
66
- source?: PluginInvocationSource;
67
- parentInvocation?: PluginInvocationIdentity;
68
- invocation?: PluginInvocationIdentity;
69
- signal?: AbortSignal;
70
- runModel?: PluginExecutionContext['runModel'];
71
- onInvocation?: (identity: PluginInvocationIdentity | undefined) => void;
72
- }, pluginName?: string): Promise<{
73
- name: string | undefined;
74
- description: string | undefined;
75
- toolbox: PluginToolboxContribution | undefined;
76
- pageRuntime: PluginPageRuntime | undefined;
77
- stateStorage: PluginStateDeclaration | undefined;
78
- taskRecovery: PluginTaskRecoveryDeclaration | undefined;
79
- appProfiles: AppProfileContribution | undefined;
80
- profileSources: Record<string, string> | undefined;
81
- version: string | undefined;
82
- commandHelp(namespace: string): string;
83
- help(namespace: string, name?: string): string;
84
- run(positionals: string[], payload?: unknown, namedInput?: Record<string, unknown>): Promise<unknown>;
85
- runRuntime(invocation: PluginInvocation): Promise<unknown>;
86
- runRecovery(invocation: PluginInvocation): Promise<unknown>;
87
- runMigration(invocation: PluginInvocation): Promise<unknown>;
88
- runToolbox(invocation: PluginInvocation): Promise<unknown>;
89
- }>;
90
- export declare function loadRegisteredPlugin(name: string, context: PluginExecutionContext, options?: PluginInvokeOptions): Promise<{
91
- name: string | undefined;
92
- description: string | undefined;
93
- toolbox: PluginToolboxContribution | undefined;
94
- pageRuntime: PluginPageRuntime | undefined;
95
- stateStorage: PluginStateDeclaration | undefined;
96
- taskRecovery: PluginTaskRecoveryDeclaration | undefined;
97
- appProfiles: AppProfileContribution | undefined;
98
- profileSources: Record<string, string> | undefined;
99
- version: string | undefined;
100
- commandHelp(namespace: string): string;
101
- help(namespace: string, name?: string): string;
102
- run(positionals: string[], payload?: unknown, namedInput?: Record<string, unknown>): Promise<unknown>;
103
- runRuntime(invocation: PluginInvocation): Promise<unknown>;
104
- runRecovery(invocation: PluginInvocation): Promise<unknown>;
105
- runMigration(invocation: PluginInvocation): Promise<unknown>;
106
- runToolbox(invocation: PluginInvocation): Promise<unknown>;
107
- }>;
108
- export declare function invokeRegisteredPlugin(name: string, invocation: PluginInvocation, context: PluginExecutionContext, options?: PluginInvokeOptions): Promise<unknown>;
109
- /** Entry point for the native toolbox service; nested plugin calls retain public-command access. */
110
- export declare function invokeRegisteredToolboxPlugin(name: string, invocation: PluginInvocation, context: PluginExecutionContext, options?: PluginInvokeOptions): Promise<unknown>;
111
- export declare function invokeRegisteredRuntimePlugin(name: string, invocation: PluginInvocation, context: PluginExecutionContext, options?: PluginInvokeOptions): Promise<unknown>;
112
- export declare function invokeRegisteredRecoveryPlugin(name: string, invocation: PluginInvocation, context: PluginExecutionContext, options?: PluginInvokeOptions): Promise<unknown>;
113
- export { PluginStateClient } from './pluginState.js';
114
- export { PluginModelClient } from './pluginModels.js';
115
- export type * from './generated-plugin-state.js';
116
- export type * from './generated-plugin-models.js';
117
- export type * from './generated-plugin-recovery.js';
118
- export type * from './generated-plugin-diagnostics.js';
1
+ export * from './plugins/sdk/plugin.js';
2
+ export * from './plugins/skillManifest.js';