@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,283 +0,0 @@
1
- // Generated by scripts/generate-client-action-protocol.mjs.
2
- // Do not edit directly; update browser-core/src/browserActionProtocol.ts.
3
- export const SEND_REQUEST_MAX_FILES = 20;
4
- // Bounds multipart buffering in native-host and the extension service worker.
5
- export const SEND_REQUEST_MAX_TOTAL_FILE_BYTES = 40 * 1024 * 1024;
6
- // Base64 expands by 4/3; 7 MiB leaves roughly 680 KiB for JSON framing under
7
- // the 10 MiB cloud message limit.
8
- export const SEND_REQUEST_MAX_TOTAL_BASE64_FILE_BYTES = 7 * 1024 * 1024;
9
- export const BROWSER_DEVICE_PRESET_NAMES = [
10
- 'iphone-duo-folded',
11
- 'iphone-duo-unfolded',
12
- 'iphone-17-pro',
13
- 'iphone-17e',
14
- 'pixel-11',
15
- 'ipad-mini-a17-pro',
16
- 'galaxy-s26',
17
- 'pura-x-max',
18
- // 旧名称保留具体机型语义,供已有调用与历史回归基线继续使用。
19
- 'iphone-15-pro',
20
- 'iphone-se',
21
- 'pixel-8',
22
- 'ipad-mini',
23
- 'galaxy-s23',
24
- ];
25
- /**
26
- * 客户端容器模拟可用档案名。
27
- *
28
- * 档案数据(UA / 桥对象 / 方法映射)在 @mearl/app-profiles 维护,但名单属于协议:
29
- * 它是 set_app_profile.profile 与 tab_open.appProfile 的取值域,CLI 帮助与 MCP 工具
30
- * schema 的 enum 也由它生成。app-profiles 反向引用本清单约束自己的档案表,
31
- * 因此新增档案时只需改两处(名单 + 档案数据),且漏改会在类型检查时暴露。
32
- */
33
- export const APP_PROFILE_NAMES = [
34
- 'fliggy',
35
- 'taobao',
36
- 'wechat',
37
- 'tmall',
38
- 'alipay',
39
- 'koubei',
40
- 'taobao-tj',
41
- 'taobao-live',
42
- 'xianyu',
43
- 'etao',
44
- 'eleme',
45
- 'damai',
46
- 'btrip',
47
- 'amap',
48
- 'qianwen',
49
- 'lingyou',
50
- 'didi',
51
- 'easybike',
52
- ];
53
- export function resolvePageEvalExpression(params) {
54
- if (typeof params.expression !== 'string' || !params.expression.trim())
55
- throw new Error('Invalid expression');
56
- if (params.args === undefined)
57
- return params.expression;
58
- if (!Array.isArray(params.args))
59
- throw new Error('page_eval args must be an array');
60
- return `(${params.expression})(...JSON.parse(${JSON.stringify(JSON.stringify(params.args))}))`;
61
- }
62
- export function validatePageUserScriptParams(params) {
63
- if (!Number.isSafeInteger(params?.tabId) || params.tabId < 0) {
64
- throw new Error('Invalid target tab');
65
- }
66
- if (typeof params.worldId !== 'string' || !/^[a-z][a-z0-9-]{0,63}$/.test(params.worldId)) {
67
- throw new Error('Invalid user script worldId');
68
- }
69
- if (typeof params.code !== 'string' || !params.code.trim() || params.code.length > 256 * 1024) {
70
- throw new Error('User script code must be non-empty and within 256 KiB characters');
71
- }
72
- }
73
- export const TAB_ID_REQUIRED_ACTIONS = [
74
- 'tab_checkpoint',
75
- 'capture_checkpoint',
76
- 'get_requests',
77
- 'get_logs',
78
- 'get_events',
79
- 'set_mock',
80
- 'get_mocks',
81
- 'page_screenshot',
82
- 'tab_close',
83
- 'page_click',
84
- 'page_drag',
85
- 'page_type',
86
- 'page_scroll',
87
- 'page_hover',
88
- 'page_eval',
89
- 'page_inspect',
90
- 'page_snapshot',
91
- 'page_press',
92
- 'page_wait',
93
- 'page_navigate',
94
- 'page_upload',
95
- 'page_download',
96
- 'page_frames',
97
- 'set_device_emulation',
98
- 'set_app_profile',
99
- 'set_timezone',
100
- 'run_actions',
101
- ];
102
- const TAB_ID_REQUIRED_ACTION_SET = new Set(TAB_ID_REQUIRED_ACTIONS);
103
- export function actionRequiresTabId(action) {
104
- return typeof action === 'string' && TAB_ID_REQUIRED_ACTION_SET.has(action);
105
- }
106
- export function validateRequiredActionTabId(action, data) {
107
- const cookieAction = action === 'get_cookie' || action === 'set_cookie';
108
- if (!actionRequiresTabId(action) && !cookieAction)
109
- return;
110
- const input = data && typeof data === 'object' && !Array.isArray(data)
111
- ? data
112
- : undefined;
113
- const tabId = input?.tabId;
114
- if (cookieAction && tabId === undefined) {
115
- if (action === 'set_cookie' && input?.reload === true) {
116
- throw new Error('set_cookie: reload requires tabId');
117
- }
118
- if (typeof input?.url !== 'string' || !input.url.trim()) {
119
- throw new Error(`${action}: specify url or tabId`);
120
- }
121
- return;
122
- }
123
- if (typeof tabId !== 'number' || !Number.isSafeInteger(tabId) || tabId < 0) {
124
- throw new Error(`${action} requires a numeric tabId. Call tab_open or tab_list to obtain a tabId.`);
125
- }
126
- }
127
- export const PAGE_ACT_ACTIONS = [
128
- 'page_click',
129
- 'page_drag',
130
- 'page_type',
131
- 'page_hover',
132
- 'page_scroll',
133
- 'page_press',
134
- 'page_upload',
135
- 'page_eval',
136
- ];
137
- export const BROWSER_ACTIONS = {
138
- tab_checkpoint: true,
139
- capture_checkpoint: true,
140
- get_requests: true,
141
- get_logs: true,
142
- get_events: true,
143
- set_mock: true,
144
- get_mocks: true,
145
- set_rule: true,
146
- get_rules: true,
147
- send_request: true,
148
- send_mtop_request: true,
149
- browser_list: true,
150
- browser_select_browser: true,
151
- browser_release: true,
152
- browser_control: true,
153
- page_download: true,
154
- browser_launch: true,
155
- browser_close: true,
156
- page_screenshot: true,
157
- tab_open: true,
158
- tab_close: true,
159
- tab_list: true,
160
- tab_group: true,
161
- page_click: true,
162
- page_drag: true,
163
- page_type: true,
164
- page_scroll: true,
165
- page_hover: true,
166
- page_eval: true,
167
- page_runtime: true,
168
- page_inspect: true,
169
- page_snapshot: true,
170
- page_press: true,
171
- page_wait: true,
172
- page_navigate: true,
173
- page_upload: true,
174
- page_frames: true,
175
- set_device_emulation: true,
176
- set_app_profile: true,
177
- set_timezone: true,
178
- get_cookie: true,
179
- set_cookie: true,
180
- request_domain_permission: true,
181
- run_actions: true,
182
- };
183
- export const BROWSER_COMMAND_ACTIONS = {
184
- tab_checkpoint: true,
185
- capture_checkpoint: true,
186
- get_requests: true,
187
- get_logs: true,
188
- get_events: true,
189
- set_mock: true,
190
- get_mocks: true,
191
- set_rule: true,
192
- get_rules: true,
193
- send_request: true,
194
- send_mtop_request: true,
195
- browser_list: true,
196
- browser_release: true,
197
- browser_control: true,
198
- page_download: true,
199
- browser_launch: true,
200
- browser_close: true,
201
- page_screenshot: true,
202
- tab_open: true,
203
- tab_close: true,
204
- tab_list: true,
205
- tab_group: true,
206
- page_click: true,
207
- page_drag: true,
208
- page_type: true,
209
- page_scroll: true,
210
- page_hover: true,
211
- page_eval: true,
212
- page_runtime: true,
213
- page_inspect: true,
214
- page_snapshot: true,
215
- page_press: true,
216
- page_wait: true,
217
- page_navigate: true,
218
- page_upload: true,
219
- page_frames: true,
220
- set_device_emulation: true,
221
- set_app_profile: true,
222
- set_timezone: true,
223
- get_cookie: true,
224
- set_cookie: true,
225
- request_domain_permission: true,
226
- run_actions: true,
227
- };
228
- export const EXTENSION_BROWSER_ACTIONS = {
229
- tab_checkpoint: true,
230
- capture_checkpoint: true,
231
- get_requests: true,
232
- get_logs: true,
233
- get_events: true,
234
- set_mock: true,
235
- get_mocks: true,
236
- set_rule: true,
237
- get_rules: true,
238
- send_request: true,
239
- send_mtop_request: true,
240
- browser_release: true,
241
- page_screenshot: true,
242
- tab_open: true,
243
- tab_close: true,
244
- tab_list: true,
245
- tab_group: true,
246
- page_click: true,
247
- page_drag: true,
248
- page_type: true,
249
- page_scroll: true,
250
- page_hover: true,
251
- page_eval: true,
252
- page_runtime: true,
253
- page_inspect: true,
254
- page_snapshot: true,
255
- page_press: true,
256
- page_wait: true,
257
- page_navigate: true,
258
- page_upload: true,
259
- page_frames: true,
260
- set_device_emulation: true,
261
- set_app_profile: true,
262
- set_timezone: true,
263
- get_cookie: true,
264
- set_cookie: true,
265
- request_domain_permission: true,
266
- run_actions: true,
267
- };
268
- export const BROWSER_CAPABILITY_ACTIONS = {
269
- ...EXTENSION_BROWSER_ACTIONS,
270
- page_download: true,
271
- };
272
- export function isBrowserAction(value) {
273
- return typeof value === 'string' && Object.hasOwn(BROWSER_ACTIONS, value);
274
- }
275
- export function isBrowserCommandAction(value) {
276
- return typeof value === 'string' && Object.hasOwn(BROWSER_COMMAND_ACTIONS, value);
277
- }
278
- export function isBrowserCapabilityAction(value) {
279
- return typeof value === 'string' && Object.hasOwn(BROWSER_CAPABILITY_ACTIONS, value);
280
- }
281
- export function isExtensionBrowserAction(value) {
282
- return typeof value === 'string' && Object.hasOwn(EXTENSION_BROWSER_ACTIONS, value);
283
- }
@@ -1,110 +0,0 @@
1
- import type { PluginExecutionHost, PluginInvocationSource } from './generated-plugin-execution.js';
2
- import type { PluginTaskState, PluginTaskResultReference } from './generated-plugin-tasks.js';
3
- import type { PluginTaskCheckpointReference } from './generated-plugin-recovery.js';
4
- import type { PluginModelDiagnostic } from './generated-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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,27 +0,0 @@
1
- import type { PluginPageBinding } from './generated-plugin-pages.js';
2
- import type { PluginTaskRecoveryContext } from './generated-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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,64 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,76 +0,0 @@
1
- import type { PluginExecutionError, PluginExecutionHost } from './generated-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;
@@ -1,59 +0,0 @@
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
- }
@@ -1,32 +0,0 @@
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
- }
@@ -1 +0,0 @@
1
- export {};