@mearl/client 2.20.6 → 2.22.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/README.md +153 -3
- package/dist/actionTimeouts.js +1 -1
- package/dist/artifacts.d.ts +1 -1
- package/dist/browserRegistry.d.ts +1 -1
- package/dist/check.d.ts +1 -1
- package/dist/cli.js +14 -8
- package/dist/commands.d.ts +23 -14
- package/dist/commands.js +24 -4
- package/dist/{generated-app-profile-definition.d.ts → generated/app-profile-definition.d.ts} +2 -2
- package/dist/{generated-app-profile-runtime-types.d.ts → generated/app-profile-runtime-types.d.ts} +2 -2
- package/dist/{generated-browser-action-protocol.d.ts → generated/browser-action-protocol.d.ts} +11 -1
- package/dist/{generated-browser-action-protocol.js → generated/browser-action-protocol.js} +3 -0
- package/dist/generated/plugin-diagnostics.d.ts +110 -0
- package/dist/generated/plugin-diagnostics.js +1 -0
- package/dist/generated/plugin-execution.d.ts +27 -0
- package/dist/generated/plugin-execution.js +1 -0
- package/dist/generated/plugin-models.d.ts +64 -0
- package/dist/generated/plugin-models.js +1 -0
- package/dist/generated/plugin-pages.d.ts +76 -0
- package/dist/generated/plugin-pages.js +59 -0
- package/dist/generated/plugin-recovery.d.ts +32 -0
- package/dist/generated/plugin-recovery.js +1 -0
- package/dist/generated/plugin-state.d.ts +50 -0
- package/dist/generated/plugin-state.js +1 -0
- package/dist/generated/plugin-tasks.d.ts +74 -0
- package/dist/generated/plugin-tasks.js +7 -0
- package/dist/generated/toolbox-icon.d.ts +10 -0
- package/dist/generated/toolbox-icon.js +37 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +7 -1
- package/dist/pageEvalArguments.d.ts +1 -1
- package/dist/pageEvalArguments.js +1 -1
- package/dist/plugin-task-host.d.ts +1 -0
- package/dist/plugin-task-host.js +14 -0
- package/dist/plugin-worker.d.ts +1 -0
- package/dist/plugin-worker.js +17 -0
- package/dist/plugin.d.ts +1 -65
- package/dist/plugin.js +1 -391
- package/dist/pluginCliOutput.d.ts +2 -0
- package/dist/pluginCliOutput.js +7 -0
- package/dist/pluginModelSessionWorker.d.ts +23 -0
- package/dist/pluginModelSessionWorker.js +60 -0
- package/dist/plugins/clients/pluginHostConnection.d.ts +35 -0
- package/dist/plugins/clients/pluginHostConnection.js +256 -0
- package/dist/plugins/clients/pluginModels.d.ts +17 -0
- package/dist/plugins/clients/pluginModels.js +47 -0
- package/dist/plugins/clients/pluginPages.d.ts +21 -0
- package/dist/plugins/clients/pluginPages.js +46 -0
- package/dist/plugins/clients/pluginState.d.ts +26 -0
- package/dist/plugins/clients/pluginState.js +28 -0
- package/dist/plugins/clients/pluginTasks.d.ts +51 -0
- package/dist/plugins/clients/pluginTasks.js +181 -0
- package/dist/{officialPluginInstaller.js → plugins/officialPluginInstaller.js} +1 -3
- package/dist/{pluginPageBundle.js → plugins/pluginPageBundle.js} +74 -17
- package/dist/{pluginRegistry.d.ts → plugins/pluginRegistry.d.ts} +3 -4
- package/dist/{pluginRegistry.js → plugins/pluginRegistry.js} +16 -15
- package/dist/plugins/pluginTaskProtocol.d.ts +47 -0
- package/dist/plugins/pluginTaskProtocol.js +1 -0
- package/dist/plugins/pluginTaskWire.d.ts +4 -0
- package/dist/plugins/pluginTaskWire.js +42 -0
- package/dist/plugins/runtime/pluginCommandWorker.d.ts +2 -0
- package/dist/plugins/runtime/pluginCommandWorker.js +174 -0
- package/dist/plugins/runtime/pluginDiagnostics.d.ts +26 -0
- package/dist/plugins/runtime/pluginDiagnostics.js +309 -0
- package/dist/plugins/runtime/pluginExecution.d.ts +21 -0
- package/dist/plugins/runtime/pluginExecution.js +43 -0
- package/dist/plugins/runtime/pluginExecutor.d.ts +29 -0
- package/dist/plugins/runtime/pluginExecutor.js +223 -0
- package/dist/plugins/runtime/pluginExecutorProtocol.d.ts +55 -0
- package/dist/plugins/runtime/pluginExecutorProtocol.js +47 -0
- package/dist/plugins/runtime/pluginExecutorSupervisor.d.ts +4 -0
- package/dist/plugins/runtime/pluginExecutorSupervisor.js +63 -0
- package/dist/plugins/runtime/pluginHost.d.ts +20 -0
- package/dist/plugins/runtime/pluginHost.js +53 -0
- package/dist/plugins/runtime/pluginHostFiles.d.ts +1 -0
- package/dist/plugins/runtime/pluginHostFiles.js +21 -0
- package/dist/plugins/runtime/pluginHostPaths.d.ts +11 -0
- package/dist/plugins/runtime/pluginHostPaths.js +22 -0
- package/dist/plugins/runtime/pluginHostServer.d.ts +7 -0
- package/dist/plugins/runtime/pluginHostServer.js +252 -0
- package/dist/plugins/runtime/pluginModelCatalog.d.ts +14 -0
- package/dist/plugins/runtime/pluginModelCatalog.js +51 -0
- package/dist/plugins/runtime/pluginModelSessions.d.ts +16 -0
- package/dist/plugins/runtime/pluginModelSessions.js +234 -0
- package/dist/plugins/runtime/pluginPageManager.d.ts +57 -0
- package/dist/plugins/runtime/pluginPageManager.js +877 -0
- package/dist/plugins/runtime/pluginProcessTree.d.ts +2 -0
- package/dist/plugins/runtime/pluginProcessTree.js +31 -0
- package/dist/plugins/runtime/pluginRevision.d.ts +14 -0
- package/dist/plugins/runtime/pluginRevision.js +227 -0
- package/dist/plugins/runtime/pluginRuntimeCleanup.d.ts +2 -0
- package/dist/plugins/runtime/pluginRuntimeCleanup.js +55 -0
- package/dist/plugins/runtime/pluginStateManager.d.ts +24 -0
- package/dist/plugins/runtime/pluginStateManager.js +132 -0
- package/dist/plugins/runtime/pluginStateStore.d.ts +57 -0
- package/dist/plugins/runtime/pluginStateStore.js +396 -0
- package/dist/plugins/runtime/pluginTaskManager.d.ts +92 -0
- package/dist/plugins/runtime/pluginTaskManager.js +1080 -0
- package/dist/plugins/runtime/pluginTaskStore.d.ts +53 -0
- package/dist/plugins/runtime/pluginTaskStore.js +319 -0
- package/dist/plugins/runtime/pythonPlugin.d.ts +31 -0
- package/dist/{pythonPlugin.js → plugins/runtime/pythonPlugin.js} +236 -31
- package/dist/plugins/sdk/plugin.d.ts +118 -0
- package/dist/plugins/sdk/plugin.js +672 -0
- package/dist/{pluginAppProfiles.d.ts → plugins/sdk/pluginAppProfiles.d.ts} +1 -1
- package/dist/{pluginAppProfiles.js → plugins/sdk/pluginAppProfiles.js} +2 -2
- package/dist/plugins/sdk/pluginModelDefinition.d.ts +6 -0
- package/dist/plugins/sdk/pluginModelDefinition.js +75 -0
- package/dist/plugins/sdk/pluginPageDefinition.d.ts +3 -0
- package/dist/plugins/sdk/pluginPageDefinition.js +62 -0
- package/dist/plugins/sdk/pluginRecoveryDefinition.d.ts +3 -0
- package/dist/plugins/sdk/pluginRecoveryDefinition.js +56 -0
- package/dist/plugins/sdk/pluginStateDefinition.d.ts +4 -0
- package/dist/plugins/sdk/pluginStateDefinition.js +68 -0
- package/dist/runtimePaths.d.ts +4 -0
- package/dist/runtimePaths.js +8 -0
- package/dist/socket.d.ts +2 -2
- package/dist/socket.js +10 -6
- package/dist/unified.d.ts +3 -2
- package/dist/unified.js +83 -2
- package/package.json +7 -3
- package/dist/pythonPlugin.d.ts +0 -20
- /package/dist/{generated-app-profile-definition.js → generated/app-profile-definition.js} +0 -0
- /package/dist/{generated-app-profile-runtime-types.js → generated/app-profile-runtime-types.js} +0 -0
- /package/dist/{officialPluginCatalog.d.ts → plugins/officialPluginCatalog.d.ts} +0 -0
- /package/dist/{officialPluginCatalog.js → plugins/officialPluginCatalog.js} +0 -0
- /package/dist/{officialPluginInstaller.d.ts → plugins/officialPluginInstaller.d.ts} +0 -0
- /package/dist/{pluginPageBundle.d.ts → plugins/pluginPageBundle.d.ts} +0 -0
- /package/dist/{pluginSource.d.ts → plugins/pluginSource.d.ts} +0 -0
- /package/dist/{pluginSource.js → plugins/pluginSource.js} +0 -0
package/dist/commands.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, } from './generated
|
|
1
|
+
import { APP_PROFILE_NAMES, BROWSER_DEVICE_PRESET_NAMES, } from './generated/browser-action-protocol.js';
|
|
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
|
];
|
|
@@ -116,7 +117,11 @@ export const COMMANDS = [
|
|
|
116
117
|
type: 'string',
|
|
117
118
|
description: '只返回指定 tab checkpoint 或同类查询 cursor 之后的请求',
|
|
118
119
|
},
|
|
119
|
-
{
|
|
120
|
+
{
|
|
121
|
+
name: 'includeBody',
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
description: '是否包含请求/响应体;指定 fields 时默认 false,否则默认 true',
|
|
124
|
+
},
|
|
120
125
|
{ name: 'includeHeaders', type: 'boolean', description: '是否包含请求/响应头,默认 false' },
|
|
121
126
|
{ name: 'maxBodySize', type: 'number', description: '单个请求/响应体最大字符数,默认 50000' },
|
|
122
127
|
{ name: 'fields', type: 'string[]', description: '从响应体提取指定字段路径,最多 100 个' },
|
|
@@ -127,6 +132,7 @@ export const COMMANDS = [
|
|
|
127
132
|
],
|
|
128
133
|
result: [
|
|
129
134
|
'nextCursor 用于同类查询续读,hasMore 表示还有数据,gap 表示缓冲区淘汰造成缺口;checkpoint cursor 可分别用于三类查询的初始边界。',
|
|
135
|
+
'省略正文时不返回 postData / responseBody 字段;指定 fields 后需要同时读取全文时显式传 includeBody:true。',
|
|
130
136
|
'isPending 标记未完成请求;SSE 的 responseBody 保存按序到达的 event/data/timestamp/duration 分片。敏感请求头返回脱敏值。',
|
|
131
137
|
],
|
|
132
138
|
examples: [
|
|
@@ -494,7 +500,7 @@ export const COMMANDS = [
|
|
|
494
500
|
{
|
|
495
501
|
name: 'active',
|
|
496
502
|
type: 'boolean',
|
|
497
|
-
description: '是否激活目标 Tab
|
|
503
|
+
description: '是否激活目标 Tab,默认 false;扩展免打扰默认开启,使用后台焦点模拟,关闭后才切换前台;响应返回 activation',
|
|
498
504
|
},
|
|
499
505
|
{
|
|
500
506
|
name: 'openerTabId',
|
|
@@ -783,6 +789,18 @@ export const COMMANDS = [
|
|
|
783
789
|
`page_scroll --payload '{"tabId":12345,"selector":"@e8","containerPolicy":"nearest","direction":"bottom"}'`,
|
|
784
790
|
],
|
|
785
791
|
},
|
|
792
|
+
{
|
|
793
|
+
name: 'page_runtime',
|
|
794
|
+
description: '页面运行时传输适配器;插件使用 PluginPageClient 或 app.page',
|
|
795
|
+
params: [
|
|
796
|
+
{
|
|
797
|
+
name: 'operation',
|
|
798
|
+
type: 'string',
|
|
799
|
+
required: true,
|
|
800
|
+
description: 'resolve/attach/get/send/detach/activation',
|
|
801
|
+
},
|
|
802
|
+
],
|
|
803
|
+
},
|
|
786
804
|
{
|
|
787
805
|
name: 'page_eval',
|
|
788
806
|
description: '在页面上下文中执行任意 JavaScript 表达式',
|
|
@@ -834,7 +852,7 @@ export const COMMANDS = [
|
|
|
834
852
|
},
|
|
835
853
|
{
|
|
836
854
|
name: 'page_inspect',
|
|
837
|
-
description: '查询 DOM
|
|
855
|
+
description: '查询 DOM 元素的控件状态、数量、边框盒、计算样式、遮挡、溢出和最近滚动容器',
|
|
838
856
|
params: [
|
|
839
857
|
{
|
|
840
858
|
name: 'selector',
|
|
@@ -865,6 +883,7 @@ export const COMMANDS = [
|
|
|
865
883
|
],
|
|
866
884
|
result: [
|
|
867
885
|
'matches[] 包含 boundingBox、computedStyle、hitTest、scroll 溢出量及可用的 scrollContainer。receivesPointerEvents=false 时读取 occludedBy。',
|
|
886
|
+
'state 返回原生/ARIA 状态及来源;缺失字段表示未知。',
|
|
868
887
|
'$0 还返回 resolvedSelector、属性、XPath 和可用框架信息。',
|
|
869
888
|
],
|
|
870
889
|
examples: [
|
|
@@ -1050,6 +1069,7 @@ export const COMMANDS = [
|
|
|
1050
1069
|
],
|
|
1051
1070
|
result: [
|
|
1052
1071
|
'返回 snapshot、elementCount、outputNodeCount、mode;截断时 truncated=true。',
|
|
1072
|
+
'snapshot 中的 @eN 可直接用于操作;内部节点映射仅保存在运行时。无名称、无 ref 且无状态的分组折叠到子节点。',
|
|
1053
1073
|
'query 返回 matches 与完整 matchCount,matches 最多 100 项,裁剪时 matchesTruncated=true。容器/iframe 的视口裁剪返回 outerViewport、contentViewport 和滚动位置。',
|
|
1054
1074
|
],
|
|
1055
1075
|
examples: [
|
package/dist/{generated-app-profile-definition.d.ts → generated/app-profile-definition.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { BrowserDevicePresetName, AppBridgeConfig } from './
|
|
2
|
-
import type { AppBridgeSpec, AppImagePickerConfig, AppLayerUrlProxyConfig, AppMiniProgramConfig, AppNativeBackConfig, AppOverlayConfig, AppSchemeRule, AppTitleBarHostStyle, BridgeActionMap } from './
|
|
1
|
+
import type { BrowserDevicePresetName, AppBridgeConfig } from './browser-action-protocol.js';
|
|
2
|
+
import type { AppBridgeSpec, AppImagePickerConfig, AppLayerUrlProxyConfig, AppMiniProgramConfig, AppNativeBackConfig, AppOverlayConfig, AppSchemeRule, AppTitleBarHostStyle, BridgeActionMap } from './app-profile-runtime-types.js';
|
|
3
3
|
export interface AppProfilePolicies {
|
|
4
4
|
titleBar?: 'default' | 'taobao' | 'fliggy' | 'alipay' | 'wechat';
|
|
5
5
|
navigatorLanguage?: boolean;
|
package/dist/{generated-app-profile-runtime-types.d.ts → generated/app-profile-runtime-types.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppProfileBinding, AppProfilePolicies, AppProfileSetting } from './
|
|
2
|
-
import type { BrowserDevicePresetName } from './
|
|
1
|
+
import type { AppProfileBinding, AppProfilePolicies, AppProfileSetting } from './app-profile-definition.js';
|
|
2
|
+
import type { BrowserDevicePresetName } from './browser-action-protocol.js';
|
|
3
3
|
type DeviceCutout = 'none' | 'dynamic-island' | 'notch' | 'side-camera';
|
|
4
4
|
/** 桥调用风格,与页面适配器使用的端内调用约定一一对应。 */
|
|
5
5
|
export type AppBridgeStyle = 'windvane' | 'fliggy' | 'alipay' | 'callback' | 'btrip' | 'invoke' | 'callHandler' | 'amap' | 'didi' | 'easybikeNative' | 'mega' | 'wechat' | 'wechatMiniProgram';
|
package/dist/{generated-browser-action-protocol.d.ts → generated/browser-action-protocol.d.ts}
RENAMED
|
@@ -6,6 +6,7 @@ export interface GetRequestsParams {
|
|
|
6
6
|
since?: number;
|
|
7
7
|
/** Opaque cursor returned by tab_checkpoint or a previous query. */
|
|
8
8
|
after?: string;
|
|
9
|
+
/** Defaults to false when fields are selected, otherwise true. */
|
|
9
10
|
includeBody?: boolean;
|
|
10
11
|
includeHeaders?: boolean;
|
|
11
12
|
maxBodySize?: number;
|
|
@@ -892,6 +893,10 @@ export interface BrowserActionMap {
|
|
|
892
893
|
request: PageEvalParams;
|
|
893
894
|
response: unknown;
|
|
894
895
|
};
|
|
896
|
+
page_runtime: {
|
|
897
|
+
request: Record<string, unknown>;
|
|
898
|
+
response: unknown;
|
|
899
|
+
};
|
|
895
900
|
page_inspect: {
|
|
896
901
|
request: PageInspectParams;
|
|
897
902
|
response: unknown;
|
|
@@ -952,7 +957,8 @@ export interface BrowserActionMap {
|
|
|
952
957
|
export type BrowserAction = keyof BrowserActionMap;
|
|
953
958
|
export type BrowserActionRequest<A extends BrowserAction> = BrowserActionMap[A]['request'];
|
|
954
959
|
export type BrowserActionResponse<A extends BrowserAction> = BrowserActionMap[A]['response'] & {
|
|
955
|
-
|
|
960
|
+
/** Routing and execution state; browser_control returns the full tab inventory. */
|
|
961
|
+
session?: Omit<ControlSessionInfo, 'tabs'>;
|
|
956
962
|
};
|
|
957
963
|
export type BrowserCommandAction = Exclude<BrowserAction, 'browser_select_browser'>;
|
|
958
964
|
export type ExtensionBrowserAction = Exclude<BrowserCommandAction, 'browser_list' | 'browser_launch' | 'browser_close' | 'browser_control' | 'page_download'>;
|
|
@@ -992,6 +998,7 @@ export declare const BROWSER_ACTIONS: {
|
|
|
992
998
|
readonly page_scroll: true;
|
|
993
999
|
readonly page_hover: true;
|
|
994
1000
|
readonly page_eval: true;
|
|
1001
|
+
readonly page_runtime: true;
|
|
995
1002
|
readonly page_inspect: true;
|
|
996
1003
|
readonly page_snapshot: true;
|
|
997
1004
|
readonly page_press: true;
|
|
@@ -1036,6 +1043,7 @@ export declare const BROWSER_COMMAND_ACTIONS: {
|
|
|
1036
1043
|
readonly page_scroll: true;
|
|
1037
1044
|
readonly page_hover: true;
|
|
1038
1045
|
readonly page_eval: true;
|
|
1046
|
+
readonly page_runtime: true;
|
|
1039
1047
|
readonly page_inspect: true;
|
|
1040
1048
|
readonly page_snapshot: true;
|
|
1041
1049
|
readonly page_press: true;
|
|
@@ -1075,6 +1083,7 @@ export declare const EXTENSION_BROWSER_ACTIONS: {
|
|
|
1075
1083
|
readonly page_scroll: true;
|
|
1076
1084
|
readonly page_hover: true;
|
|
1077
1085
|
readonly page_eval: true;
|
|
1086
|
+
readonly page_runtime: true;
|
|
1078
1087
|
readonly page_inspect: true;
|
|
1079
1088
|
readonly page_snapshot: true;
|
|
1080
1089
|
readonly page_press: true;
|
|
@@ -1115,6 +1124,7 @@ export declare const BROWSER_CAPABILITY_ACTIONS: {
|
|
|
1115
1124
|
readonly page_scroll: true;
|
|
1116
1125
|
readonly page_hover: true;
|
|
1117
1126
|
readonly page_eval: true;
|
|
1127
|
+
readonly page_runtime: true;
|
|
1118
1128
|
readonly page_inspect: true;
|
|
1119
1129
|
readonly page_snapshot: true;
|
|
1120
1130
|
readonly page_press: true;
|
|
@@ -164,6 +164,7 @@ export const BROWSER_ACTIONS = {
|
|
|
164
164
|
page_scroll: true,
|
|
165
165
|
page_hover: true,
|
|
166
166
|
page_eval: true,
|
|
167
|
+
page_runtime: true,
|
|
167
168
|
page_inspect: true,
|
|
168
169
|
page_snapshot: true,
|
|
169
170
|
page_press: true,
|
|
@@ -208,6 +209,7 @@ export const BROWSER_COMMAND_ACTIONS = {
|
|
|
208
209
|
page_scroll: true,
|
|
209
210
|
page_hover: true,
|
|
210
211
|
page_eval: true,
|
|
212
|
+
page_runtime: true,
|
|
211
213
|
page_inspect: true,
|
|
212
214
|
page_snapshot: true,
|
|
213
215
|
page_press: true,
|
|
@@ -247,6 +249,7 @@ export const EXTENSION_BROWSER_ACTIONS = {
|
|
|
247
249
|
page_scroll: true,
|
|
248
250
|
page_hover: true,
|
|
249
251
|
page_eval: true,
|
|
252
|
+
page_runtime: true,
|
|
250
253
|
page_inspect: true,
|
|
251
254
|
page_snapshot: true,
|
|
252
255
|
page_press: true,
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { PluginExecutionHost, PluginInvocationSource } from './plugin-execution.js';
|
|
2
|
+
import type { PluginTaskState, PluginTaskResultReference } from './plugin-tasks.js';
|
|
3
|
+
import type { PluginTaskCheckpointReference } from './plugin-recovery.js';
|
|
4
|
+
import type { PluginModelDiagnostic } from './plugin-models.js';
|
|
5
|
+
export interface PluginDiagnosticOptions {
|
|
6
|
+
taskId?: string;
|
|
7
|
+
plugin?: string;
|
|
8
|
+
instanceId?: string;
|
|
9
|
+
includeErrorMessages?: boolean;
|
|
10
|
+
includeLocalPaths?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface PluginDiagnosticPageBinding {
|
|
13
|
+
instanceId: string;
|
|
14
|
+
browserSessionId: string;
|
|
15
|
+
tabId: number;
|
|
16
|
+
frameId: string | number;
|
|
17
|
+
documentId: string;
|
|
18
|
+
}
|
|
19
|
+
export interface PluginTaskDiagnosticMetadata {
|
|
20
|
+
invocationId?: string;
|
|
21
|
+
page?: PluginDiagnosticPageBinding;
|
|
22
|
+
executorAttempted?: boolean;
|
|
23
|
+
executorStoppedAt?: number;
|
|
24
|
+
model?: PluginModelDiagnostic;
|
|
25
|
+
updatesDropped?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export interface PluginDiagnosticFailure {
|
|
28
|
+
code: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
messageTruncated?: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface PluginDiagnosticTask {
|
|
33
|
+
taskId: string;
|
|
34
|
+
plugin: string;
|
|
35
|
+
kind: 'command' | 'model';
|
|
36
|
+
command: string;
|
|
37
|
+
state: PluginTaskState;
|
|
38
|
+
source: PluginInvocationSource;
|
|
39
|
+
host: PluginExecutionHost;
|
|
40
|
+
installationId: string;
|
|
41
|
+
revision: string;
|
|
42
|
+
invocationId?: string;
|
|
43
|
+
createdAt: number;
|
|
44
|
+
updatedAt: number;
|
|
45
|
+
sequence: number;
|
|
46
|
+
page?: PluginDiagnosticPageBinding;
|
|
47
|
+
routing?: {
|
|
48
|
+
browser?: string;
|
|
49
|
+
session?: string;
|
|
50
|
+
connector?: string;
|
|
51
|
+
local?: boolean;
|
|
52
|
+
transport?: 'extension' | 'cdp';
|
|
53
|
+
};
|
|
54
|
+
executionTimeoutMs?: number;
|
|
55
|
+
executor: {
|
|
56
|
+
state: 'never-started' | 'observed-alive' | 'stop-confirmed' | 'unknown';
|
|
57
|
+
observedAt: number;
|
|
58
|
+
pid?: number;
|
|
59
|
+
stoppedAt?: number;
|
|
60
|
+
};
|
|
61
|
+
failure?: PluginDiagnosticFailure;
|
|
62
|
+
checkpoint?: PluginTaskCheckpointReference;
|
|
63
|
+
result?: PluginTaskResultReference;
|
|
64
|
+
model?: PluginModelDiagnostic;
|
|
65
|
+
metadataIncomplete: boolean;
|
|
66
|
+
history: {
|
|
67
|
+
firstRetainedSequence: number;
|
|
68
|
+
gap: boolean;
|
|
69
|
+
omitted: number;
|
|
70
|
+
events: Array<{
|
|
71
|
+
sequence: number;
|
|
72
|
+
time: number;
|
|
73
|
+
state: PluginTaskState;
|
|
74
|
+
type: string;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface PluginDiagnosticPage {
|
|
79
|
+
plugin: string;
|
|
80
|
+
installationId: string;
|
|
81
|
+
revision: string;
|
|
82
|
+
host: PluginExecutionHost;
|
|
83
|
+
binding: PluginDiagnosticPageBinding;
|
|
84
|
+
observation: 'service-snapshot' | 'historical-binding';
|
|
85
|
+
state?: 'active' | 'detached' | 'invalidated';
|
|
86
|
+
lastReceived?: number;
|
|
87
|
+
queued?: number;
|
|
88
|
+
running?: number;
|
|
89
|
+
failure?: PluginDiagnosticFailure;
|
|
90
|
+
}
|
|
91
|
+
export interface PluginDiagnosticReport {
|
|
92
|
+
version: 1;
|
|
93
|
+
generatedAt: number;
|
|
94
|
+
host: PluginExecutionHost;
|
|
95
|
+
protocolVersion: number;
|
|
96
|
+
selection: Pick<PluginDiagnosticOptions, 'taskId' | 'plugin' | 'instanceId'>;
|
|
97
|
+
coverage: {
|
|
98
|
+
scanLimited: boolean;
|
|
99
|
+
tasksOmitted: number;
|
|
100
|
+
pagesOmitted: number;
|
|
101
|
+
byteLimited: boolean;
|
|
102
|
+
};
|
|
103
|
+
tasks: PluginDiagnosticTask[];
|
|
104
|
+
pages: PluginDiagnosticPage[];
|
|
105
|
+
links: Array<{
|
|
106
|
+
from: string;
|
|
107
|
+
to: string;
|
|
108
|
+
kind: 'parent' | 'resume';
|
|
109
|
+
}>;
|
|
110
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { PluginPageBinding } from './plugin-pages.js';
|
|
2
|
+
import type { PluginTaskRecoveryContext } from './plugin-recovery.js';
|
|
3
|
+
/** Identifies an execution environment separately from a process incarnation. */
|
|
4
|
+
export interface PluginExecutionHost {
|
|
5
|
+
hostId: string;
|
|
6
|
+
epoch: string;
|
|
7
|
+
}
|
|
8
|
+
export type PluginInvocationSource = 'cli' | 'sdk' | 'mcp' | 'toolbox' | 'runtime';
|
|
9
|
+
/** Created by the entry point; business input cannot replace this identity. */
|
|
10
|
+
export interface PluginInvocationIdentity {
|
|
11
|
+
invocationId: string;
|
|
12
|
+
host: PluginExecutionHost;
|
|
13
|
+
source: PluginInvocationSource;
|
|
14
|
+
plugin: string;
|
|
15
|
+
parentInvocationId?: string;
|
|
16
|
+
taskId?: string;
|
|
17
|
+
installationId?: string;
|
|
18
|
+
revision?: string;
|
|
19
|
+
page?: PluginPageBinding;
|
|
20
|
+
recovery?: PluginTaskRecoveryContext;
|
|
21
|
+
}
|
|
22
|
+
export interface PluginExecutionError {
|
|
23
|
+
message: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
details?: Record<string, unknown>;
|
|
26
|
+
metadata?: Record<string, string | number | boolean | null>;
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export type PluginModelMode = 'generate' | 'agent';
|
|
2
|
+
export interface PluginModelRequest {
|
|
3
|
+
provider: string;
|
|
4
|
+
mode: PluginModelMode;
|
|
5
|
+
prompt: string;
|
|
6
|
+
instructions?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
reasoningEffort?: 'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
9
|
+
outputSchema?: Record<string, unknown>;
|
|
10
|
+
/** Opt-in conversation scoped to the bound document or calling command execution. */
|
|
11
|
+
conversation?: string;
|
|
12
|
+
/** Required for an agent task; never inferred from a pure-generation request. */
|
|
13
|
+
permissions?: 'read-only';
|
|
14
|
+
}
|
|
15
|
+
export interface PluginModelCapability {
|
|
16
|
+
provider: string;
|
|
17
|
+
modes: PluginModelMode[];
|
|
18
|
+
permissions: Array<'read-only'>;
|
|
19
|
+
structuredOutput: boolean;
|
|
20
|
+
streaming: boolean;
|
|
21
|
+
cancellation: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface PluginModelOption {
|
|
24
|
+
id: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
isDefault?: boolean;
|
|
28
|
+
reasoningEfforts?: NonNullable<PluginModelRequest['reasoningEffort']>[];
|
|
29
|
+
defaultReasoningEffort?: PluginModelRequest['reasoningEffort'];
|
|
30
|
+
}
|
|
31
|
+
export interface PluginModelList {
|
|
32
|
+
provider: string;
|
|
33
|
+
models: PluginModelOption[];
|
|
34
|
+
}
|
|
35
|
+
export interface PluginModelResult {
|
|
36
|
+
text: string;
|
|
37
|
+
output?: unknown;
|
|
38
|
+
provider: string;
|
|
39
|
+
mode: PluginModelMode;
|
|
40
|
+
model?: string;
|
|
41
|
+
}
|
|
42
|
+
/** Execution observations contain no prompts, account identities or credential values. */
|
|
43
|
+
export interface PluginModelDiagnostic {
|
|
44
|
+
requestedModel?: string;
|
|
45
|
+
selectedModel?: string;
|
|
46
|
+
activeModel?: string;
|
|
47
|
+
runtime?: {
|
|
48
|
+
executable?: string;
|
|
49
|
+
version?: string;
|
|
50
|
+
selection: 'explicit' | 'automatic';
|
|
51
|
+
started?: boolean;
|
|
52
|
+
};
|
|
53
|
+
configuration?: {
|
|
54
|
+
source: 'default' | 'environment';
|
|
55
|
+
home?: string;
|
|
56
|
+
filePresent: boolean;
|
|
57
|
+
baseProvider?: string;
|
|
58
|
+
credentialStore?: 'file' | 'keyring' | 'auto' | 'ephemeral' | 'unknown';
|
|
59
|
+
};
|
|
60
|
+
authentication?: 'apikey' | 'chatgpt' | 'chatgptAuthTokens' | 'unknown';
|
|
61
|
+
threadRestrictionsAccepted?: boolean;
|
|
62
|
+
turnRestrictionsAccepted?: boolean;
|
|
63
|
+
retryCount?: number;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { PluginExecutionError, PluginExecutionHost } from './plugin-execution.js';
|
|
2
|
+
export declare const PLUGIN_PAGE_LEASE_MS = 30000;
|
|
3
|
+
/** Document or access-scope invalidation can cross transports that preserve only a message. */
|
|
4
|
+
export declare function isPluginPageInvalidation(error: unknown): boolean;
|
|
5
|
+
export declare function isPluginPageUnavailable(error: unknown): boolean;
|
|
6
|
+
export declare function pluginPageUnavailable(error: unknown): Error;
|
|
7
|
+
/** main/business selectors, Chrome numeric frame IDs, or CDP opaque frame IDs. */
|
|
8
|
+
export type PluginPageFrame = string | number;
|
|
9
|
+
export type PluginPageOperation = 'attach' | 'get' | 'list' | 'send' | 'detach' | 'events' | 'activation';
|
|
10
|
+
export interface PluginPageEventBinding {
|
|
11
|
+
command: string;
|
|
12
|
+
schema: Record<string, unknown>;
|
|
13
|
+
policy?: 'serial' | 'latest' | 'parallel';
|
|
14
|
+
concurrency?: number;
|
|
15
|
+
maxPending?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface PluginPageRuntime {
|
|
18
|
+
version: 1;
|
|
19
|
+
matches: string[];
|
|
20
|
+
/** Self-contained function expression receiving {input, signal, emit, identity}. */
|
|
21
|
+
code: string;
|
|
22
|
+
initialize?: string;
|
|
23
|
+
events?: Record<string, PluginPageEventBinding>;
|
|
24
|
+
}
|
|
25
|
+
export interface PluginPageTarget {
|
|
26
|
+
browserSessionId: string;
|
|
27
|
+
tabId: number;
|
|
28
|
+
frameId: string | number;
|
|
29
|
+
documentId: string;
|
|
30
|
+
url: string;
|
|
31
|
+
}
|
|
32
|
+
export interface PluginPageInstance {
|
|
33
|
+
instanceId: string;
|
|
34
|
+
plugin: string;
|
|
35
|
+
installationId: string;
|
|
36
|
+
revision: string;
|
|
37
|
+
host: PluginExecutionHost;
|
|
38
|
+
target: PluginPageTarget;
|
|
39
|
+
state: 'active' | 'detached' | 'invalidated';
|
|
40
|
+
sequence: number;
|
|
41
|
+
createdAt: number;
|
|
42
|
+
error?: PluginExecutionError;
|
|
43
|
+
}
|
|
44
|
+
export interface PluginPageEvent {
|
|
45
|
+
sequence: number;
|
|
46
|
+
time: number;
|
|
47
|
+
type: 'received' | 'running' | 'success' | 'error' | 'superseded' | 'navigation' | 'invalidated';
|
|
48
|
+
eventSequence?: number;
|
|
49
|
+
name?: string;
|
|
50
|
+
payload?: unknown;
|
|
51
|
+
taskId?: string;
|
|
52
|
+
error?: PluginExecutionError;
|
|
53
|
+
}
|
|
54
|
+
export interface PluginPageEvents {
|
|
55
|
+
instance: PluginPageInstance;
|
|
56
|
+
events: PluginPageEvent[];
|
|
57
|
+
nextCursor: number;
|
|
58
|
+
firstAvailableSequence: number;
|
|
59
|
+
gap: boolean;
|
|
60
|
+
}
|
|
61
|
+
export interface PluginPageActivation {
|
|
62
|
+
plugin: string;
|
|
63
|
+
installationId: string;
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
matches: string[];
|
|
66
|
+
persistence: 'session' | 'persistent';
|
|
67
|
+
frame: PluginPageFrame;
|
|
68
|
+
input: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
export interface PluginPageBinding {
|
|
71
|
+
instanceId: string;
|
|
72
|
+
target: PluginPageTarget;
|
|
73
|
+
}
|
|
74
|
+
export declare function isPluginPageMatchPattern(value: unknown): value is string;
|
|
75
|
+
export declare function matchesPluginPageURL(matches: readonly string[], value: string): boolean;
|
|
76
|
+
export declare function isPluginPageInstanceId(value: unknown): value is string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const PLUGIN_PAGE_LEASE_MS = 30000;
|
|
2
|
+
/** Document or access-scope invalidation can cross transports that preserve only a message. */
|
|
3
|
+
export function isPluginPageInvalidation(error) {
|
|
4
|
+
const value = error;
|
|
5
|
+
const codes = [
|
|
6
|
+
'PLUGIN_PAGE_INVALIDATED',
|
|
7
|
+
'PLUGIN_PAGE_NOT_FOUND',
|
|
8
|
+
'PLUGIN_PAGE_TARGET_CHANGED',
|
|
9
|
+
'DOMAIN_PERMISSION_REQUIRED',
|
|
10
|
+
];
|
|
11
|
+
const message = typeof value?.message === 'string' ? value.message : '';
|
|
12
|
+
return codes.includes(String(value?.code)) || codes.some(code => message.startsWith(`${code}:`));
|
|
13
|
+
}
|
|
14
|
+
export function isPluginPageUnavailable(error) {
|
|
15
|
+
return error?.code === 'PLUGIN_PAGE_UNAVAILABLE';
|
|
16
|
+
}
|
|
17
|
+
export function pluginPageUnavailable(error) {
|
|
18
|
+
return Object.assign(new Error('Plugin page host is temporarily unavailable', { cause: error }), {
|
|
19
|
+
code: 'PLUGIN_PAGE_UNAVAILABLE',
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const pattern = /^(https?|\*):\/\/(\*|\*\.[a-z0-9.-]+|[a-z0-9.-]+|localhost)(:\d+)?(\/[^#]*)$/i;
|
|
23
|
+
export function isPluginPageMatchPattern(value) {
|
|
24
|
+
return typeof value === 'string' && value.length <= 2048 && pattern.test(value);
|
|
25
|
+
}
|
|
26
|
+
export function matchesPluginPageURL(matches, value) {
|
|
27
|
+
let url;
|
|
28
|
+
try {
|
|
29
|
+
url = new URL(value);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
if (!['http:', 'https:'].includes(url.protocol))
|
|
35
|
+
return false;
|
|
36
|
+
return matches.some(item => {
|
|
37
|
+
const match = item.match(pattern);
|
|
38
|
+
if (!match || (match[1] !== '*' && match[1].toLowerCase() + ':' !== url.protocol))
|
|
39
|
+
return false;
|
|
40
|
+
const host = match[2].toLowerCase();
|
|
41
|
+
if (host !== '*' &&
|
|
42
|
+
host !== url.hostname &&
|
|
43
|
+
!(host.startsWith('*.') &&
|
|
44
|
+
(url.hostname === host.slice(2) || url.hostname.endsWith(host.slice(1)))))
|
|
45
|
+
return false;
|
|
46
|
+
if (match[3] && match[3].slice(1) !== (url.port || (url.protocol === 'https:' ? '443' : '80')))
|
|
47
|
+
return false;
|
|
48
|
+
const expression = '^' +
|
|
49
|
+
match[4]
|
|
50
|
+
.split('*')
|
|
51
|
+
.map(part => part.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
|
|
52
|
+
.join('.*') +
|
|
53
|
+
'$';
|
|
54
|
+
return new RegExp(expression).test(url.pathname + url.search);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
export function isPluginPageInstanceId(value) {
|
|
58
|
+
return typeof value === 'string' && /^pi_[0-9a-f-]{36}$/i.test(value);
|
|
59
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PluginTaskRecoveryDeclaration {
|
|
2
|
+
version: 1;
|
|
3
|
+
commands: Record<string, {
|
|
4
|
+
checkpointVersion: number;
|
|
5
|
+
schema: Record<string, unknown>;
|
|
6
|
+
migrateFrom?: Array<{
|
|
7
|
+
version: number;
|
|
8
|
+
schema: Record<string, unknown>;
|
|
9
|
+
}>;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export interface PluginTaskCheckpointReference {
|
|
13
|
+
sequence: number;
|
|
14
|
+
version: number;
|
|
15
|
+
schemaHash: string;
|
|
16
|
+
updatedAt: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PluginTaskCheckpoint extends PluginTaskCheckpointReference {
|
|
19
|
+
data: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface PluginTaskRecoveryContext {
|
|
22
|
+
fromTaskId: string;
|
|
23
|
+
fromRevision: string;
|
|
24
|
+
declarationHash: string;
|
|
25
|
+
sourceCheckpoint: PluginTaskCheckpointReference;
|
|
26
|
+
checkpoint: PluginTaskCheckpoint;
|
|
27
|
+
}
|
|
28
|
+
export interface PluginCheckpointMigrationInput {
|
|
29
|
+
checkpoint: PluginTaskCheckpoint;
|
|
30
|
+
fromRevision: string;
|
|
31
|
+
toRevision: string;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type PluginStateScope = 'installation' | 'host' | 'browser-session' | 'instance';
|
|
2
|
+
export interface PluginStateCollection {
|
|
3
|
+
scope: PluginStateScope;
|
|
4
|
+
storage: 'persistent' | 'cache' | 'memory';
|
|
5
|
+
schemaVersion: number;
|
|
6
|
+
schema: Record<string, unknown>;
|
|
7
|
+
maxEntries?: number;
|
|
8
|
+
maxBytes?: number;
|
|
9
|
+
ttlMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface PluginStateDeclaration {
|
|
12
|
+
version: 1;
|
|
13
|
+
collections: Record<string, PluginStateCollection>;
|
|
14
|
+
}
|
|
15
|
+
export interface PluginStateEntry {
|
|
16
|
+
key: string;
|
|
17
|
+
exists: boolean;
|
|
18
|
+
/** Live entry revision, or the collection revision for absence; opaque to callers. */
|
|
19
|
+
version: string;
|
|
20
|
+
value?: unknown;
|
|
21
|
+
expiresAt?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface PluginStateSnapshot extends PluginStateEntry {
|
|
24
|
+
revision: number;
|
|
25
|
+
schemaVersion: number;
|
|
26
|
+
}
|
|
27
|
+
export interface PluginStateList {
|
|
28
|
+
entries: PluginStateEntry[];
|
|
29
|
+
revision: number;
|
|
30
|
+
schemaVersion: number;
|
|
31
|
+
nextCursor?: string;
|
|
32
|
+
}
|
|
33
|
+
export type PluginStateMutation = {
|
|
34
|
+
type: 'put';
|
|
35
|
+
key: string;
|
|
36
|
+
expectedVersion: string;
|
|
37
|
+
value: unknown;
|
|
38
|
+
ttlMs?: number;
|
|
39
|
+
} | {
|
|
40
|
+
type: 'delete';
|
|
41
|
+
key: string;
|
|
42
|
+
expectedVersion: string;
|
|
43
|
+
};
|
|
44
|
+
export interface PluginStateTransaction {
|
|
45
|
+
operations: PluginStateMutation[];
|
|
46
|
+
expectedRevision?: number;
|
|
47
|
+
migrateFromVersion?: number;
|
|
48
|
+
idempotencyKey?: string;
|
|
49
|
+
}
|
|
50
|
+
export type PluginStateOperation = 'get' | 'get-many' | 'list' | 'transact';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|