@mearl/browser-core 3.0.6 → 3.0.7
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.
|
@@ -135,7 +135,7 @@ export type BrowserJsonPrimitive = string | number | boolean | null;
|
|
|
135
135
|
export type BrowserJsonValue = BrowserJsonPrimitive | BrowserJsonValue[] | {
|
|
136
136
|
[key: string]: BrowserJsonValue;
|
|
137
137
|
};
|
|
138
|
-
export type BrowserProviderOperation = 'start' | 'close' | 'detach' | 'deleteData' | 'access' | 'syncCookies';
|
|
138
|
+
export type BrowserProviderOperation = 'start' | 'close' | 'detach' | 'deleteData' | 'access' | 'syncCookies' | 'handoff' | 'resume' | 'finish';
|
|
139
139
|
export interface BrowserProviderIdentity {
|
|
140
140
|
id: string;
|
|
141
141
|
name: string;
|
|
@@ -269,9 +269,16 @@ export interface BrowserReleaseParams {
|
|
|
269
269
|
keepArtifactIds?: string[];
|
|
270
270
|
}
|
|
271
271
|
export interface BrowserControlParams {
|
|
272
|
-
operation: 'handoff' | 'resume';
|
|
272
|
+
operation: 'handoff' | 'resume' | 'finish';
|
|
273
273
|
tabId?: number;
|
|
274
274
|
reason?: string;
|
|
275
|
+
/** External Provider finish only; retain these result pages. */
|
|
276
|
+
keepTabIds?: number[];
|
|
277
|
+
}
|
|
278
|
+
export interface ExternalBrowserControlResult {
|
|
279
|
+
controlSessionMode: 'external';
|
|
280
|
+
operation: BrowserControlParams['operation'];
|
|
281
|
+
control: 'agent' | 'user' | 'finished';
|
|
275
282
|
}
|
|
276
283
|
export interface BrowserArtifact {
|
|
277
284
|
artifactId: string;
|
|
@@ -848,7 +855,7 @@ export interface BrowserActionMap {
|
|
|
848
855
|
request: BrowserControlParams;
|
|
849
856
|
response: {
|
|
850
857
|
session: ControlSessionInfo;
|
|
851
|
-
};
|
|
858
|
+
} | ExternalBrowserControlResult;
|
|
852
859
|
};
|
|
853
860
|
page_download: {
|
|
854
861
|
request: PageDownloadParams;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** External task lifecycle calls must not silently discard page retention options. */
|
|
2
|
+
export function parseExternalBrowserControl(value) {
|
|
3
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
4
|
+
throw new Error('Invalid browser control request');
|
|
5
|
+
const data = value;
|
|
6
|
+
if (Object.keys(data).some(key => !['operation', 'tabId', 'reason', 'keepTabIds'].includes(key)))
|
|
7
|
+
throw new Error('Unsupported browser control parameter');
|
|
8
|
+
if (typeof data.operation !== 'string' ||
|
|
9
|
+
!['handoff', 'resume', 'finish'].includes(data.operation))
|
|
10
|
+
throw new Error('Invalid browser control operation');
|
|
11
|
+
if (data.tabId !== undefined && (!Number.isSafeInteger(data.tabId) || Number(data.tabId) < 0))
|
|
12
|
+
throw new Error('Invalid control tabId');
|
|
13
|
+
if (data.reason !== undefined && typeof data.reason !== 'string')
|
|
14
|
+
throw new Error('Invalid control reason');
|
|
15
|
+
if (data.keepTabIds !== undefined &&
|
|
16
|
+
(data.operation !== 'finish' ||
|
|
17
|
+
!Array.isArray(data.keepTabIds) ||
|
|
18
|
+
data.keepTabIds.some(id => !Number.isSafeInteger(id) || id < 0) ||
|
|
19
|
+
new Set(data.keepTabIds).size !== data.keepTabIds.length))
|
|
20
|
+
throw new Error('keepTabIds requires finish and unique nonnegative integer tab IDs');
|
|
21
|
+
return {
|
|
22
|
+
operation: data.operation,
|
|
23
|
+
...(data.tabId !== undefined ? { tabId: data.tabId } : {}),
|
|
24
|
+
...(data.reason !== undefined ? { reason: data.reason } : {}),
|
|
25
|
+
...(data.keepTabIds !== undefined ? { keepTabIds: [...data.keepTabIds] } : {}),
|
|
26
|
+
};
|
|
27
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './appProfileDefinition.js';
|
|
|
2
2
|
export * from './types.js';
|
|
3
3
|
export * from './browserEnhancement.js';
|
|
4
4
|
export * from './browserDiscovery.js';
|
|
5
|
+
export * from './externalBrowserControl.js';
|
|
5
6
|
export * from './providerAppResources.js';
|
|
6
7
|
export * from './eventFilters.js';
|
|
7
8
|
export * from './requestSerializer.js';
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ export * from './appProfileDefinition.js';
|
|
|
2
2
|
export * from './types.js';
|
|
3
3
|
export * from './browserEnhancement.js';
|
|
4
4
|
export * from './browserDiscovery.js';
|
|
5
|
+
export * from './externalBrowserControl.js';
|
|
5
6
|
export * from './providerAppResources.js';
|
|
6
7
|
export * from './eventFilters.js';
|
|
7
8
|
export * from './requestSerializer.js';
|
package/package.json
CHANGED