@mearl/client 2.22.0 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +40 -40
- package/dist/actionTimeouts.js +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/autoUpdate.js +1 -2
- package/dist/browserRegistry.d.ts +1 -1
- package/dist/check.d.ts +1 -1
- package/dist/check.js +4 -3
- package/dist/commands.d.ts +12 -12
- package/dist/commands.js +15 -14
- package/dist/index.d.ts +4 -7
- package/dist/index.js +1 -1
- package/dist/local.d.ts +3 -1
- package/dist/local.js +2 -1
- package/dist/pageEvalArguments.d.ts +1 -1
- package/dist/pageEvalArguments.js +1 -1
- package/dist/plugin.d.ts +1 -0
- package/dist/plugin.js +1 -0
- package/dist/pluginModelSessionWorker.d.ts +2 -2
- package/dist/plugins/clients/pluginHostConnection.d.ts +1 -1
- package/dist/plugins/clients/pluginHostConnection.js +1 -1
- package/dist/plugins/clients/pluginModels.d.ts +3 -3
- package/dist/plugins/clients/pluginPages.d.ts +2 -2
- package/dist/plugins/clients/pluginState.d.ts +2 -2
- package/dist/plugins/clients/pluginTasks.d.ts +3 -3
- package/dist/plugins/clients/pluginTasks.js +1 -1
- package/dist/plugins/officialPluginCatalog.d.ts +18 -21
- package/dist/plugins/officialPluginCatalog.js +120 -24
- package/dist/plugins/officialPluginInstaller.js +6 -1
- package/dist/plugins/pluginRegistry.d.ts +1 -1
- package/dist/plugins/pluginRegistry.js +2 -2
- package/dist/plugins/pluginTaskProtocol.d.ts +1 -1
- package/dist/plugins/runtime/pluginDiagnostics.d.ts +3 -3
- package/dist/plugins/runtime/pluginDiagnostics.js +2 -2
- package/dist/plugins/runtime/pluginExecution.d.ts +2 -2
- package/dist/plugins/runtime/pluginExecutor.d.ts +1 -1
- package/dist/plugins/runtime/pluginExecutorProtocol.d.ts +2 -2
- package/dist/plugins/runtime/pluginHost.d.ts +2 -2
- package/dist/plugins/runtime/pluginHostServer.js +1 -1
- package/dist/plugins/runtime/pluginModelCatalog.d.ts +1 -1
- package/dist/plugins/runtime/pluginPageManager.d.ts +3 -3
- package/dist/plugins/runtime/pluginPageManager.js +2 -2
- package/dist/plugins/runtime/pluginRevision.js +2 -1
- package/dist/plugins/runtime/pluginStateManager.d.ts +1 -1
- package/dist/plugins/runtime/pluginStateStore.d.ts +1 -1
- package/dist/plugins/runtime/pluginTaskManager.d.ts +10 -10
- package/dist/plugins/runtime/pluginTaskManager.js +1 -1
- package/dist/plugins/runtime/pluginTaskStore.d.ts +3 -3
- package/dist/plugins/runtime/pluginTaskStore.js +1 -1
- package/dist/plugins/runtime/pythonPlugin.d.ts +1 -1
- package/dist/plugins/sdk/plugin.d.ts +9 -12
- package/dist/plugins/sdk/plugin.js +4 -7
- package/dist/plugins/sdk/pluginAppProfiles.d.ts +1 -1
- package/dist/plugins/sdk/pluginAppProfiles.js +1 -1
- package/dist/plugins/sdk/pluginModelDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginPageDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginPageDefinition.js +1 -1
- package/dist/plugins/sdk/pluginRecoveryDefinition.d.ts +1 -1
- package/dist/plugins/sdk/pluginStateDefinition.d.ts +2 -2
- package/dist/plugins/skillManifest.d.ts +10 -0
- package/dist/plugins/skillManifest.js +56 -0
- package/dist/socket.d.ts +2 -0
- package/dist/socket.js +13 -3
- package/dist/unified.d.ts +1 -1
- package/dist/unified.js +1 -1
- package/package.json +9 -8
- package/dist/generated/app-profile-definition.d.ts +0 -130
- package/dist/generated/app-profile-definition.js +0 -458
- package/dist/generated/app-profile-runtime-types.d.ts +0 -213
- package/dist/generated/app-profile-runtime-types.js +0 -1
- package/dist/generated/browser-action-protocol.d.ts +0 -1147
- package/dist/generated/browser-action-protocol.js +0 -283
- package/dist/generated/plugin-diagnostics.d.ts +0 -110
- package/dist/generated/plugin-diagnostics.js +0 -1
- package/dist/generated/plugin-execution.d.ts +0 -27
- package/dist/generated/plugin-execution.js +0 -1
- package/dist/generated/plugin-models.d.ts +0 -64
- package/dist/generated/plugin-models.js +0 -1
- package/dist/generated/plugin-pages.d.ts +0 -76
- package/dist/generated/plugin-pages.js +0 -59
- package/dist/generated/plugin-recovery.d.ts +0 -32
- package/dist/generated/plugin-recovery.js +0 -1
- package/dist/generated/plugin-state.d.ts +0 -50
- package/dist/generated/plugin-state.js +0 -1
- package/dist/generated/plugin-tasks.d.ts +0 -74
- package/dist/generated/plugin-tasks.js +0 -7
- package/dist/generated/toolbox-icon.d.ts +0 -10
- package/dist/generated/toolbox-icon.js +0 -37
package/dist/commands.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, } from '
|
|
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(' | ');
|
|
@@ -298,6 +298,7 @@ export const COMMANDS = [
|
|
|
298
298
|
],
|
|
299
299
|
notes: [
|
|
300
300
|
'扩展模式规则持久化;CDP 仅支持会话级 modifyHeaders 请求头 set,不支持响应头、initiatorDomains 或其他动作。Provider 是否支持以其能力声明为准。',
|
|
301
|
+
'扩展模式会检查规则请求 URL 和显式来源域名的访问权限;缺失时仍保存规则,返回 warnings 和 missingOrigins,不自动弹窗。可在请求规则页面授权,或按提示调用 request_domain_permission。复杂 URL 表达式无法完整推断域名时会提示手动检查。',
|
|
301
302
|
],
|
|
302
303
|
examples: [
|
|
303
304
|
`set_rule --payload '{"actionType":"block","filter":"^https://example\\\\.com/ads/.*"}'`,
|
|
@@ -348,10 +349,10 @@ export const COMMANDS = [
|
|
|
348
349
|
{ name: 'timeout', type: 'number', description: '超时毫秒数,默认 30000' },
|
|
349
350
|
],
|
|
350
351
|
notes: [
|
|
351
|
-
'
|
|
352
|
+
'需要托管认证的接口使用相应能力插件;不要手工传入其管理的凭据。',
|
|
352
353
|
'body 不能与 formData/files 组合;bodyFile 以原始字节发送,不包 multipart boundary,不能用于 GET/HEAD。',
|
|
353
354
|
'bodyFile.filePath 属于 native-host,最大 40 MiB;base64 解码后最大 7 MiB。multipart 不手工设置 Content-Type,由 Mearl 生成 boundary。',
|
|
354
|
-
'filePath
|
|
355
|
+
'filePath 属于请求执行宿主;无法引用远端路径时用 base64。',
|
|
355
356
|
],
|
|
356
357
|
result: [
|
|
357
358
|
'返回 status、statusText、headers、body、bodyType、attachedCookieCount;bodyType 为 json/text/base64,二进制 body 需解码后保存。',
|
|
@@ -459,8 +460,8 @@ export const COMMANDS = [
|
|
|
459
460
|
{ name: 'executablePath', type: 'string', description: '自定义 Chrome 可执行文件路径' },
|
|
460
461
|
{
|
|
461
462
|
name: 'copyCookieDomains',
|
|
462
|
-
type: 'string[] |
|
|
463
|
-
description: '从控制浏览器复制 Cookie
|
|
463
|
+
type: 'string[] | string | { presets?: string[]; domains?: string[] }',
|
|
464
|
+
description: '从控制浏览器复制 Cookie:可传域名数组、已安装能力提供的范围名,或组合范围与额外域名',
|
|
464
465
|
},
|
|
465
466
|
],
|
|
466
467
|
examples: [
|
|
@@ -540,7 +541,7 @@ export const COMMANDS = [
|
|
|
540
541
|
{
|
|
541
542
|
name: 'appProfile',
|
|
542
543
|
type: 'string',
|
|
543
|
-
description: '
|
|
544
|
+
description: '按已安装档案应用 App 环境;内置基础档案只提供 UA/版本,完整桥由能力包提供。需要 iframe WebView 和系统栏时同时传 emulation.deviceShell=true',
|
|
544
545
|
},
|
|
545
546
|
{
|
|
546
547
|
name: 'os',
|
|
@@ -566,8 +567,8 @@ export const COMMANDS = [
|
|
|
566
567
|
`tab_open --payload '{"url":"https://example.com"}'`,
|
|
567
568
|
`tab_open --payload '{"url":"https://example.com/page","reuse":"prefer","match":{"ignoreSearch":true}}'`,
|
|
568
569
|
`tab_open --payload '{"url":"https://m.example.com","emulation":{"preset":"iphone-17-pro"}}'`,
|
|
569
|
-
`tab_open --payload '{"url":"https://
|
|
570
|
-
`tab_open --payload '{"url":"https://
|
|
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}}'`,
|
|
571
572
|
`tab_open --payload '{"url":"https://example.com","appProfile":"fliggy","os":"android"}'`,
|
|
572
573
|
`tab_open --payload '{"url":"https://example.com","group":"验证任务"}'`,
|
|
573
574
|
],
|
|
@@ -1166,7 +1167,7 @@ export const COMMANDS = [
|
|
|
1166
1167
|
},
|
|
1167
1168
|
{
|
|
1168
1169
|
name: 'set_app_profile',
|
|
1169
|
-
description: '
|
|
1170
|
+
description: '设置已安装的 App 档案;完整 JSBridge 由能力包提供。可同时设置 MTop 页面接口环境,传 emulation 时联动设备模拟',
|
|
1170
1171
|
summary: '设置或清除目标标签页的 App 容器模拟',
|
|
1171
1172
|
params: [
|
|
1172
1173
|
{ name: 'enabled', type: 'boolean', required: true, description: 'true=启用,false=清除' },
|
|
@@ -1200,7 +1201,7 @@ export const COMMANDS = [
|
|
|
1200
1201
|
{
|
|
1201
1202
|
name: 'mtopEnv',
|
|
1202
1203
|
type: '"default" | "prod" | "pre"',
|
|
1203
|
-
description: '可选 MTop 页面接口环境;default
|
|
1204
|
+
description: '可选 MTop 页面接口环境;default 关闭环境改写,省略时保持当前设置。仅作用于目标 tab',
|
|
1204
1205
|
},
|
|
1205
1206
|
{
|
|
1206
1207
|
name: 'emulation',
|
|
@@ -1280,8 +1281,8 @@ export const COMMANDS = [
|
|
|
1280
1281
|
examples: [
|
|
1281
1282
|
`get_cookie --payload '{"tabId":12345,"name":"feature_flag"}'`,
|
|
1282
1283
|
`get_cookie --payload '{"url":"https://www.taobao.com/","name":"tracknick"}'`,
|
|
1283
|
-
`get_cookie --payload '{"tabId":12345,"name":"
|
|
1284
|
-
`get_cookie --payload '{"tabId":12345,"name":"tracknick","url":"https://www.taobao.com/","domain":"
|
|
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":"/"}'`,
|
|
1285
1286
|
],
|
|
1286
1287
|
},
|
|
1287
1288
|
{
|
|
@@ -1327,7 +1328,7 @@ export const COMMANDS = [
|
|
|
1327
1328
|
examples: [
|
|
1328
1329
|
`set_cookie --payload '{"tabId":12345,"name":"feature_flag","value":"enabled"}'`,
|
|
1329
1330
|
`set_cookie --payload '{"url":"https://www.taobao.com/","name":"feature_flag","value":"enabled"}'`,
|
|
1330
|
-
`set_cookie --payload '{"tabId":12345,"name":"
|
|
1331
|
+
`set_cookie --payload '{"tabId":12345,"name":"feature_channel","value":"3.6.63","domain":"example.com","reload":true}'`,
|
|
1331
1332
|
],
|
|
1332
1333
|
},
|
|
1333
1334
|
// ── 其他 ──────────────────────────────────────────────────────────────────
|
|
@@ -1352,7 +1353,7 @@ export const COMMANDS = [
|
|
|
1352
1353
|
},
|
|
1353
1354
|
],
|
|
1354
1355
|
notes: [
|
|
1355
|
-
'domain 使用纯主机名,不传 URL
|
|
1356
|
+
'domain 使用纯主机名,不传 URL。在 send_request 或 set_rule 提示缺少浏览器域名权限时申请。',
|
|
1356
1357
|
'弹窗等待用户选择,90 秒超时或关闭按拒绝处理;granted=true 后才重试原请求。',
|
|
1357
1358
|
],
|
|
1358
1359
|
result: ['返回 granted、domain,授权成功时包含 origin。'],
|
package/dist/index.d.ts
CHANGED
|
@@ -12,10 +12,10 @@ export { executeRegisteredPlugin, type PluginExecutorOptions, type PluginExecuto
|
|
|
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
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 '
|
|
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 '
|
|
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 '
|
|
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'>>;
|
|
@@ -68,7 +68,4 @@ export declare function saveArtifact(artifact: Protocol.BrowserArtifact & {
|
|
|
68
68
|
}>;
|
|
69
69
|
export { PluginStateClient } from './plugins/clients/pluginState.js';
|
|
70
70
|
export { PluginModelClient } from './plugins/clients/pluginModels.js';
|
|
71
|
-
export type * from '
|
|
72
|
-
export type * from './generated/plugin-models.js';
|
|
73
|
-
export type * from './generated/plugin-recovery.js';
|
|
74
|
-
export type * from './generated/plugin-diagnostics.js';
|
|
71
|
+
export type * from '@mearl/browser-core';
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export { PluginTaskClient, } from './plugins/clients/pluginTasks.js';
|
|
|
9
9
|
export { PluginPageClient } from './plugins/clients/pluginPages.js';
|
|
10
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 '
|
|
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);
|
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 '
|
|
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 '
|
|
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) {
|
package/dist/plugin.d.ts
CHANGED
package/dist/plugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginModelDiagnostic, PluginModelRequest, PluginModelResult } from '
|
|
2
|
-
import type { PluginExecutionError } from '
|
|
1
|
+
import type { PluginModelDiagnostic, PluginModelRequest, PluginModelResult } from '@mearl/browser-core';
|
|
2
|
+
import type { PluginExecutionError } from '@mearl/browser-core';
|
|
3
3
|
export type ModelSessionRequest = {
|
|
4
4
|
request: PluginModelRequest;
|
|
5
5
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginInvocationSource, PluginExecutionHost } from '
|
|
1
|
+
import type { PluginInvocationSource, PluginExecutionHost } from '@mearl/browser-core';
|
|
2
2
|
import type { PluginExecutionContext } from '../sdk/plugin.js';
|
|
3
3
|
export interface PluginHostConnectionOptions {
|
|
4
4
|
source?: PluginInvocationSource;
|
|
@@ -4,7 +4,7 @@ import { createConnection } from 'node:net';
|
|
|
4
4
|
import { PLUGIN_TASK_HOST_PATH } from '../../runtimePaths.js';
|
|
5
5
|
import { claimRecord, isProcessOwnerAlive, processIdentity, readRecord, removeInvalidRecord, removeRecordIfPid, rotateLogIfNeeded, } from '@mearl/daemon-core';
|
|
6
6
|
import { pluginHostPaths } from '../runtime/pluginHostPaths.js';
|
|
7
|
-
import { PLUGIN_TASK_PROTOCOL_VERSION } from '
|
|
7
|
+
import { PLUGIN_TASK_PROTOCOL_VERSION } from '@mearl/browser-core';
|
|
8
8
|
import { readPluginTaskMessages, writePluginTaskMessage } from '../pluginTaskWire.js';
|
|
9
9
|
import { pluginExecutionError, serializePluginExecutionError, } from '../runtime/pluginExecutorProtocol.js';
|
|
10
10
|
const starting = new Map();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PluginHostClientOptions } from './pluginHostConnection.js';
|
|
2
2
|
import { PluginTaskClient } from './pluginTasks.js';
|
|
3
3
|
import type { PluginTaskStartOptions, PluginTaskWaitOptions } from './pluginTasks.js';
|
|
4
|
-
import type { PluginModelRequest, PluginModelResult, PluginModelCapability, PluginModelList } from '
|
|
5
|
-
import type { PluginTaskStartResult } from '
|
|
6
|
-
export type * from '
|
|
4
|
+
import type { PluginModelRequest, PluginModelResult, PluginModelCapability, PluginModelList } from '@mearl/browser-core';
|
|
5
|
+
import type { PluginTaskStartResult } from '@mearl/browser-core';
|
|
6
|
+
export type * from '@mearl/browser-core';
|
|
7
7
|
export declare class PluginModelClient {
|
|
8
8
|
readonly tasks: PluginTaskClient;
|
|
9
9
|
constructor(options?: PluginHostClientOptions);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { PluginHostConnection } from './pluginHostConnection.js';
|
|
2
2
|
import type { UnifiedClientOptions, UnifiedInvokeOptions } from '../../unified.js';
|
|
3
|
-
import type { PluginPageInstance, PluginPageEvents, PluginPageOperation } from '
|
|
4
|
-
export type { PluginPageInstance, PluginPageEvents, PluginPageRuntime, PluginPageActivation, PluginPageTarget, PluginPageOperation, } from '
|
|
3
|
+
import type { PluginPageInstance, PluginPageEvents, PluginPageOperation } from '@mearl/browser-core';
|
|
4
|
+
export type { PluginPageInstance, PluginPageEvents, PluginPageRuntime, PluginPageActivation, PluginPageTarget, PluginPageOperation, } from '@mearl/browser-core';
|
|
5
5
|
export declare class PluginPageClient {
|
|
6
6
|
private readonly connection?;
|
|
7
7
|
private readonly client?;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PluginHostConnection } from './pluginHostConnection.js';
|
|
2
2
|
import type { PluginHostClientOptions } from './pluginHostConnection.js';
|
|
3
3
|
import type { PluginOptions } from '../sdk/plugin.js';
|
|
4
|
-
import type { PluginStateOperation, PluginStateSnapshot, PluginStateList, PluginStateTransaction } from '
|
|
5
|
-
export type * from '
|
|
4
|
+
import type { PluginStateOperation, PluginStateSnapshot, PluginStateList, PluginStateTransaction } from '@mearl/browser-core';
|
|
5
|
+
export type * from '@mearl/browser-core';
|
|
6
6
|
export declare class PluginStateClient {
|
|
7
7
|
private readonly options;
|
|
8
8
|
readonly connection: PluginHostConnection;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { PluginHostConnection } from './pluginHostConnection.js';
|
|
2
2
|
import type { PluginHostClientOptions, HostStatus as PluginHostStatus } from './pluginHostConnection.js';
|
|
3
|
-
import type { PluginTaskCheckpoint } from '
|
|
4
|
-
import type { PluginDiagnosticOptions, PluginDiagnosticReport } from '
|
|
5
|
-
import type { PluginTask, PluginTaskEvents, PluginTaskListResult, PluginTaskResultChunk, PluginTaskStartResult } from '
|
|
3
|
+
import type { PluginTaskCheckpoint } from '@mearl/browser-core';
|
|
4
|
+
import type { PluginDiagnosticOptions, PluginDiagnosticReport } from '@mearl/browser-core';
|
|
5
|
+
import type { PluginTask, PluginTaskEvents, PluginTaskListResult, PluginTaskResultChunk, PluginTaskStartResult } from '@mearl/browser-core';
|
|
6
6
|
import type { PluginInvocation, PluginOptions } from '../sdk/plugin.js';
|
|
7
7
|
export type { PluginTask, PluginTaskEvents, PluginTaskListResult, PluginTaskStartResult };
|
|
8
8
|
export interface PluginTaskStartOptions extends PluginOptions {
|
|
@@ -3,7 +3,7 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
import { isProcessOwnerAlive, readRecord } from '@mearl/daemon-core';
|
|
4
4
|
import { pluginHostPaths } from '../runtime/pluginHostPaths.js';
|
|
5
5
|
import { UnifiedClient, decodeBrowserTarget } from '../../unified.js';
|
|
6
|
-
import { isPluginTaskActive } from '
|
|
6
|
+
import { isPluginTaskActive } from '@mearl/browser-core';
|
|
7
7
|
import { pluginExecutionError } from '../runtime/pluginExecutorProtocol.js';
|
|
8
8
|
function localWait(promise, signal, timeoutMs = Infinity) {
|
|
9
9
|
return new Promise((resolve, reject) => {
|
|
@@ -2,27 +2,24 @@ export declare const OFFICIAL_PLUGIN_MANAGER = "@mearl/setup:official";
|
|
|
2
2
|
export interface OfficialPluginDefinition {
|
|
3
3
|
description: string;
|
|
4
4
|
installArgs: readonly string[];
|
|
5
|
-
setup?:
|
|
5
|
+
setup?: string;
|
|
6
6
|
skill: string;
|
|
7
7
|
}
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export type OfficialPluginName = keyof typeof OFFICIAL_PLUGINS;
|
|
8
|
+
export type OfficialPluginName = string;
|
|
9
|
+
export declare const OFFICIAL_PLUGINS: Record<string, OfficialPluginDefinition>;
|
|
10
|
+
export interface PluginCatalogSelection {
|
|
11
|
+
path: string;
|
|
12
|
+
sha256: string;
|
|
13
|
+
}
|
|
14
|
+
export interface PluginCatalog {
|
|
15
|
+
schemaVersion: 1;
|
|
16
|
+
revision: string;
|
|
17
|
+
plugins: Record<string, OfficialPluginDefinition>;
|
|
18
|
+
selection?: PluginCatalogSelection;
|
|
19
|
+
}
|
|
20
|
+
export declare function validateOfficialPluginCatalog(value: unknown): PluginCatalog;
|
|
21
|
+
export declare function readOfficialPluginCatalog(): PluginCatalog | undefined;
|
|
22
|
+
/** Installation hosts persist only the catalog selected by an approved preset. */
|
|
23
|
+
export declare function replaceOfficialPluginCatalog(revision: string, plugins: Record<string, OfficialPluginDefinition>, selection?: PluginCatalogSelection): void;
|
|
27
24
|
export declare function findOfficialPlugin(name: string): OfficialPluginDefinition | undefined;
|
|
28
|
-
export declare function listOfficialPluginNames(setup?:
|
|
25
|
+
export declare function listOfficialPluginNames(setup?: string): string[];
|
|
@@ -1,29 +1,125 @@
|
|
|
1
|
+
import { constants, closeSync, fstatSync, lstatSync, mkdirSync, openSync, readSync, readFileSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { isAbsolute, join } from 'node:path';
|
|
4
|
+
import { assertPluginName, pluginDirectory } from './pluginRegistry.js';
|
|
1
5
|
export const OFFICIAL_PLUGIN_MANAGER = '@mearl/setup:official';
|
|
2
|
-
export const OFFICIAL_PLUGINS = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
6
|
+
export const OFFICIAL_PLUGINS = {};
|
|
7
|
+
const MAX_CATALOG_BYTES = 256 * 1024;
|
|
8
|
+
const catalogPath = () => join(pluginDirectory(), '.official-catalog.json');
|
|
9
|
+
export function validateOfficialPluginCatalog(value) {
|
|
10
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
11
|
+
throw new Error('Invalid managed plugin catalog');
|
|
12
|
+
const input = value;
|
|
13
|
+
if (input.schemaVersion !== 1 || typeof input.revision !== 'string' || !/^[a-f0-9]{64}$/.test(input.revision) ||
|
|
14
|
+
!input.plugins || typeof input.plugins !== 'object' || Array.isArray(input.plugins) ||
|
|
15
|
+
Object.keys(input).some(key => !['schemaVersion', 'revision', 'plugins', 'selection'].includes(key)) || Object.keys(input.plugins).length > 200)
|
|
16
|
+
throw new Error('Invalid managed plugin catalog');
|
|
17
|
+
const selection = input.selection;
|
|
18
|
+
if (selection !== undefined && (!selection || typeof selection !== 'object' || Array.isArray(selection) || Object.keys(selection).some(key => !['path', 'sha256'].includes(key)) || typeof selection.path !== 'string' || !isAbsolute(selection.path) || selection.path.length > 4096 || /[\0\r\n]/.test(selection.path) || typeof selection.sha256 !== 'string' || !/^[a-f0-9]{64}$/.test(selection.sha256)))
|
|
19
|
+
throw new Error('Invalid plugin catalog selection');
|
|
20
|
+
const plugins = {};
|
|
21
|
+
for (const [name, value] of Object.entries(input.plugins)) {
|
|
22
|
+
assertPluginName(name);
|
|
23
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
24
|
+
throw new Error('Invalid managed plugin declaration');
|
|
25
|
+
const item = value;
|
|
26
|
+
if (Object.keys(item).some(key => !['description', 'installArgs', 'setup', 'skill'].includes(key)) ||
|
|
27
|
+
typeof item.description !== 'string' || item.description.length > 1000 ||
|
|
28
|
+
typeof item.skill !== 'string' || !/^[a-z][a-z0-9-]*$/.test(item.skill) ||
|
|
29
|
+
!Array.isArray(item.installArgs) || item.installArgs.length === 0 || item.installArgs.length > 32 ||
|
|
30
|
+
item.installArgs.some(arg => typeof arg !== 'string' || arg.length > 2048 || /[\0\r\n]/.test(arg)) ||
|
|
31
|
+
(item.setup !== undefined && (typeof item.setup !== 'string' || !/^[a-z][a-z0-9-]*$/.test(item.setup))))
|
|
32
|
+
throw new Error('Invalid managed plugin declaration');
|
|
33
|
+
plugins[name] = { description: item.description, skill: item.skill, installArgs: [...item.installArgs], ...(item.setup !== undefined && { setup: item.setup }) };
|
|
34
|
+
}
|
|
35
|
+
const catalog = { schemaVersion: 1, revision: input.revision, plugins, ...(selection ? { selection: { path: selection.path, sha256: selection.sha256 } } : {}) };
|
|
36
|
+
if (Buffer.byteLength(JSON.stringify(catalog)) > MAX_CATALOG_BYTES)
|
|
37
|
+
throw new Error('Managed plugin catalog exceeds 256 KiB');
|
|
38
|
+
return catalog;
|
|
39
|
+
}
|
|
40
|
+
function selectionMatches(selection) {
|
|
41
|
+
try {
|
|
42
|
+
const before = lstatSync(selection.path);
|
|
43
|
+
if (!before.isFile() || before.isSymbolicLink() || before.size > 1024 * 1024)
|
|
44
|
+
return false;
|
|
45
|
+
const fd = openSync(selection.path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0));
|
|
46
|
+
try {
|
|
47
|
+
const stat = fstatSync(fd);
|
|
48
|
+
if (!stat.isFile() || stat.size > 1024 * 1024)
|
|
49
|
+
return false;
|
|
50
|
+
const bytes = Buffer.alloc(stat.size + 1);
|
|
51
|
+
let size = 0;
|
|
52
|
+
while (size < bytes.length) {
|
|
53
|
+
const count = readSync(fd, bytes, size, bytes.length - size, null);
|
|
54
|
+
if (!count)
|
|
55
|
+
break;
|
|
56
|
+
size += count;
|
|
57
|
+
}
|
|
58
|
+
return size === stat.size && createHash('sha256').update(bytes.subarray(0, size)).digest('hex') === selection.sha256;
|
|
59
|
+
}
|
|
60
|
+
finally {
|
|
61
|
+
closeSync(fd);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (error.code === 'ENOENT')
|
|
66
|
+
return false;
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
export function readOfficialPluginCatalog() {
|
|
71
|
+
let source;
|
|
72
|
+
try {
|
|
73
|
+
source = readFileSync(catalogPath(), 'utf8');
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (error.code === 'ENOENT')
|
|
77
|
+
return undefined;
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
if (Buffer.byteLength(source) > MAX_CATALOG_BYTES)
|
|
81
|
+
throw new Error('Managed plugin catalog exceeds 256 KiB');
|
|
82
|
+
const catalog = validateOfficialPluginCatalog(JSON.parse(source));
|
|
83
|
+
return catalog.selection && !selectionMatches(catalog.selection) ? undefined : catalog;
|
|
84
|
+
}
|
|
85
|
+
/** Installation hosts persist only the catalog selected by an approved preset. */
|
|
86
|
+
export function replaceOfficialPluginCatalog(revision, plugins, selection) {
|
|
87
|
+
const catalog = validateOfficialPluginCatalog({ schemaVersion: 1, revision, plugins, ...(selection ? { selection } : {}) });
|
|
88
|
+
const content = JSON.stringify(catalog);
|
|
89
|
+
if (Buffer.byteLength(content) > MAX_CATALOG_BYTES)
|
|
90
|
+
throw new Error('Managed plugin catalog exceeds 256 KiB');
|
|
91
|
+
if (catalog.selection && !selectionMatches(catalog.selection))
|
|
92
|
+
throw new Error('PLUGIN_CATALOG_SELECTION_CHANGED');
|
|
93
|
+
mkdirSync(pluginDirectory(), { recursive: true, mode: 0o700 });
|
|
94
|
+
const file = catalogPath();
|
|
95
|
+
const temporary = `${file}.${randomUUID()}.tmp`;
|
|
96
|
+
try {
|
|
97
|
+
writeFileSync(temporary, content, { mode: 0o600, flag: 'wx' });
|
|
98
|
+
if (catalog.selection && !selectionMatches(catalog.selection))
|
|
99
|
+
throw new Error('PLUGIN_CATALOG_SELECTION_CHANGED');
|
|
100
|
+
renameSync(temporary, file);
|
|
101
|
+
}
|
|
102
|
+
finally {
|
|
103
|
+
rmSync(temporary, { force: true });
|
|
104
|
+
}
|
|
105
|
+
refreshOfficialPlugins();
|
|
106
|
+
}
|
|
107
|
+
function refreshOfficialPlugins() {
|
|
108
|
+
let plugins = {};
|
|
109
|
+
try {
|
|
110
|
+
plugins = readOfficialPluginCatalog()?.plugins ?? {};
|
|
111
|
+
}
|
|
112
|
+
catch { /* An invalid optional catalog cannot disable registered plugin or browser commands. */ }
|
|
113
|
+
for (const name of Object.keys(OFFICIAL_PLUGINS))
|
|
114
|
+
delete OFFICIAL_PLUGINS[name];
|
|
115
|
+
Object.assign(OFFICIAL_PLUGINS, plugins);
|
|
116
|
+
return OFFICIAL_PLUGINS;
|
|
117
|
+
}
|
|
118
|
+
refreshOfficialPlugins();
|
|
20
119
|
export function findOfficialPlugin(name) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
: undefined;
|
|
120
|
+
const plugins = refreshOfficialPlugins();
|
|
121
|
+
return Object.hasOwn(plugins, name) ? plugins[name] : undefined;
|
|
24
122
|
}
|
|
25
123
|
export function listOfficialPluginNames(setup) {
|
|
26
|
-
return Object.entries(
|
|
27
|
-
.filter(([, definition]) => setup === undefined || ('setup' in definition && definition.setup === setup))
|
|
28
|
-
.map(([name]) => name);
|
|
124
|
+
return Object.entries(refreshOfficialPlugins()).filter(([, item]) => setup === undefined || item.setup === setup).map(([name]) => name);
|
|
29
125
|
}
|
|
@@ -2,7 +2,7 @@ import { closeSync, mkdirSync, openSync, rmSync, statSync, writeFileSync } from
|
|
|
2
2
|
import { CLIENT_VERSION } from '../runtimePaths.js';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import { spawn } from 'node:child_process';
|
|
5
|
-
import { findOfficialPlugin } from './officialPluginCatalog.js';
|
|
5
|
+
import { findOfficialPlugin, readOfficialPluginCatalog } from './officialPluginCatalog.js';
|
|
6
6
|
import { findPluginRegistration, pluginDirectory } from './pluginRegistry.js';
|
|
7
7
|
const INSTALL_TIMEOUT_MS = 180_000;
|
|
8
8
|
const INSTALL_LOCK_STALE_MS = 5 * 60_000;
|
|
@@ -105,8 +105,13 @@ async function installOfficialPlugin(name, progress) {
|
|
|
105
105
|
try {
|
|
106
106
|
if (findPluginRegistration(name))
|
|
107
107
|
return;
|
|
108
|
+
const accepted = JSON.stringify(readOfficialPluginCatalog());
|
|
109
|
+
if (!findOfficialPlugin(name))
|
|
110
|
+
throw new Error('PLUGIN_CATALOG_SELECTION_CHANGED');
|
|
108
111
|
progress?.(`正在安装官方插件 ${name}...`);
|
|
109
112
|
await installWithSetup(name);
|
|
113
|
+
if (JSON.stringify(readOfficialPluginCatalog()) !== accepted)
|
|
114
|
+
throw new Error('PLUGIN_CATALOG_SELECTION_CHANGED');
|
|
110
115
|
if (!findPluginRegistration(name)) {
|
|
111
116
|
throw new Error(`官方插件 ${name} 安装完成后仍未注册`);
|
|
112
117
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AppProfileContribution } from '
|
|
1
|
+
import { type AppProfileContribution } from '@mearl/browser-core';
|
|
2
2
|
export declare class PluginError extends Error {
|
|
3
3
|
readonly code: string;
|
|
4
4
|
constructor(code: string, message: string);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { validateAppProfileContribution, } from '
|
|
1
|
+
import { validateAppProfileContribution, } from '@mearl/browser-core';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { parseToolboxIcon } from '
|
|
3
|
+
import { parseToolboxIcon } from '@mearl/browser-core';
|
|
4
4
|
import { closeSync, mkdirSync, openSync, readFileSync, readSync, readdirSync, renameSync, rmSync, statSync, writeFileSync, } from 'node:fs';
|
|
5
5
|
import { homedir } from 'node:os';
|
|
6
6
|
import { isAbsolute, join, resolve } from 'node:path';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginExecutionError, PluginInvocationSource } from '
|
|
1
|
+
import type { PluginExecutionError, PluginInvocationSource } from '@mearl/browser-core';
|
|
2
2
|
import type { PluginOptions } from './sdk/plugin.js';
|
|
3
3
|
export interface PluginTaskScope {
|
|
4
4
|
access: 'public' | 'toolbox' | 'runtime';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { PluginModelDiagnostic } from '
|
|
2
|
-
import type { PluginDiagnosticFailure, PluginDiagnosticOptions, PluginDiagnosticPage, PluginDiagnosticPageBinding, PluginDiagnosticReport } from '
|
|
1
|
+
import type { PluginModelDiagnostic } from '@mearl/browser-core';
|
|
2
|
+
import type { PluginDiagnosticFailure, PluginDiagnosticOptions, PluginDiagnosticPage, PluginDiagnosticPageBinding, PluginDiagnosticReport } from '@mearl/browser-core';
|
|
3
3
|
import type { PluginTaskRecord } from './pluginTaskStore.js';
|
|
4
4
|
import type { PluginTaskScope } from '../pluginTaskProtocol.js';
|
|
5
|
-
import type { PluginExecutionHost } from '
|
|
5
|
+
import type { PluginExecutionHost } from '@mearl/browser-core';
|
|
6
6
|
export declare const MAX_PLUGIN_DIAGNOSTIC_BYTES: number;
|
|
7
7
|
export declare function normalizeDiagnosticOptions(value: unknown): PluginDiagnosticOptions;
|
|
8
8
|
export declare function diagnosticFailure(value: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isProcessOwnerAlive } from '@mearl/daemon-core';
|
|
2
2
|
import { basename } from 'node:path';
|
|
3
|
-
import { isPluginTaskId, PLUGIN_TASK_PROTOCOL_VERSION } from '
|
|
4
|
-
import { isPluginPageInstanceId } from '
|
|
3
|
+
import { isPluginTaskId, PLUGIN_TASK_PROTOCOL_VERSION } from '@mearl/browser-core';
|
|
4
|
+
import { isPluginPageInstanceId } from '@mearl/browser-core';
|
|
5
5
|
export const MAX_PLUGIN_DIAGNOSTIC_BYTES = 256 * 1024;
|
|
6
6
|
function text(value, maximum = 256) {
|
|
7
7
|
if (typeof value !== 'string')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { PluginExecutionHost, PluginInvocationIdentity, PluginInvocationSource } from '
|
|
1
|
+
import type { PluginExecutionHost, PluginInvocationIdentity, PluginInvocationSource } from '@mearl/browser-core';
|
|
2
2
|
import type { PluginApp } from '../sdk/plugin.js';
|
|
3
|
-
import type { PluginTaskRecoveryContext } from '
|
|
3
|
+
import type { PluginTaskRecoveryContext } from '@mearl/browser-core';
|
|
4
4
|
export type { PluginExecutionHost, PluginInvocationIdentity, PluginInvocationSource };
|
|
5
5
|
export interface PluginCommandContext extends Pick<PluginApp, 'invoke' | 'progress'> {
|
|
6
6
|
readonly identity: Readonly<PluginInvocationIdentity>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PluginModelDiagnostic, PluginModelRequest } from '
|
|
1
|
+
import type { PluginModelDiagnostic, PluginModelRequest } from '@mearl/browser-core';
|
|
2
2
|
import { type PluginRegistration } from '../pluginRegistry.js';
|
|
3
3
|
import type { PluginExecutionContext, PluginInvocation, PluginInvokeOptions } from '../sdk/plugin.js';
|
|
4
4
|
export interface PluginExecutorDependencies {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { PluginModelDiagnostic, PluginModelRequest } from '
|
|
2
|
-
import type { PluginInvocationIdentity, PluginExecutionError } from '
|
|
1
|
+
import type { PluginModelDiagnostic, PluginModelRequest } from '@mearl/browser-core';
|
|
2
|
+
import type { PluginInvocationIdentity, PluginExecutionError } from '@mearl/browser-core';
|
|
3
3
|
import type { PluginInvocation, PluginOptions, PluginProgress } from '../sdk/plugin.js';
|
|
4
4
|
import type { PluginRegistration } from '../pluginRegistry.js';
|
|
5
5
|
export type PluginWorkerRequest = {
|
|
@@ -4,7 +4,7 @@ import { PluginStateManager } from './pluginStateManager.js';
|
|
|
4
4
|
import { PluginPageManager } from './pluginPageManager.js';
|
|
5
5
|
import { PluginModelCatalog } from './pluginModelCatalog.js';
|
|
6
6
|
import { PluginModelSessions } from './pluginModelSessions.js';
|
|
7
|
-
import type { PluginDiagnosticOptions } from '
|
|
7
|
+
import type { PluginDiagnosticOptions } from '@mearl/browser-core';
|
|
8
8
|
import type { PluginTaskScope } from '../pluginTaskProtocol.js';
|
|
9
9
|
/** The host owns service composition; task execution receives explicit service dependencies. */
|
|
10
10
|
export declare class PluginHost {
|
|
@@ -15,6 +15,6 @@ export declare class PluginHost {
|
|
|
15
15
|
readonly modelSessions: PluginModelSessions;
|
|
16
16
|
private closing?;
|
|
17
17
|
constructor(configuration?: PluginTaskManagerOptions);
|
|
18
|
-
diagnose(value: PluginDiagnosticOptions, scope: PluginTaskScope): import("
|
|
18
|
+
diagnose(value: PluginDiagnosticOptions, scope: PluginTaskScope): import("@mearl/browser-core").PluginDiagnosticReport;
|
|
19
19
|
close(): Promise<void>;
|
|
20
20
|
}
|