@framers/agentos-ext-stealth-browser 1.0.0 → 1.1.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 +96 -21
- package/dist/StealthBrowserService.d.ts +101 -0
- package/dist/StealthBrowserService.d.ts.map +1 -0
- package/dist/StealthBrowserService.js +558 -0
- package/dist/StealthBrowserService.js.map +1 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/click.d.ts +39 -0
- package/dist/tools/click.d.ts.map +1 -0
- package/dist/tools/click.js +72 -0
- package/dist/tools/click.js.map +1 -0
- package/dist/tools/navigate.d.ts +43 -0
- package/dist/tools/navigate.d.ts.map +1 -0
- package/dist/tools/navigate.js +142 -0
- package/dist/tools/navigate.js.map +1 -0
- package/dist/tools/scrape.d.ts +40 -0
- package/dist/tools/scrape.d.ts.map +1 -0
- package/dist/tools/scrape.js +88 -0
- package/dist/tools/scrape.js.map +1 -0
- package/dist/tools/screenshot.d.ts +41 -0
- package/dist/tools/screenshot.d.ts.map +1 -0
- package/dist/tools/screenshot.js +85 -0
- package/dist/tools/screenshot.js.map +1 -0
- package/dist/tools/snapshot.d.ts +39 -0
- package/dist/tools/snapshot.d.ts.map +1 -0
- package/dist/tools/snapshot.js +68 -0
- package/dist/tools/snapshot.js.map +1 -0
- package/dist/tools/type.d.ts +41 -0
- package/dist/tools/type.d.ts.map +1 -0
- package/dist/tools/type.js +88 -0
- package/dist/tools/type.js.map +1 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/manifest.json +3 -3
- package/package.json +10 -6
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Stealth Scrape Tool
|
|
4
|
+
* Extract content from bot-protected pages using CSS selectors with stealth browser.
|
|
5
|
+
*
|
|
6
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tool for scraping content from bot-protected pages
|
|
10
|
+
*/
|
|
11
|
+
export class StealthScrapeTool {
|
|
12
|
+
browserService;
|
|
13
|
+
id = 'stealth-browser-scrape-v1';
|
|
14
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
15
|
+
name = 'stealth_scrape';
|
|
16
|
+
displayName = 'Stealth Scrape';
|
|
17
|
+
description = 'Extract content from the current page using a CSS selector via the stealth browser. ' +
|
|
18
|
+
'Use this for bot-protected sites where browser_scrape would be blocked.';
|
|
19
|
+
category = 'research';
|
|
20
|
+
hasSideEffects = false;
|
|
21
|
+
inputSchema = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
required: ['selector'],
|
|
24
|
+
properties: {
|
|
25
|
+
selector: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'CSS selector to match elements',
|
|
28
|
+
},
|
|
29
|
+
limit: {
|
|
30
|
+
type: 'number',
|
|
31
|
+
description: 'Maximum number of elements to return',
|
|
32
|
+
minimum: 1,
|
|
33
|
+
},
|
|
34
|
+
attributes: {
|
|
35
|
+
type: 'array',
|
|
36
|
+
items: { type: 'string' },
|
|
37
|
+
description: 'Specific attributes to extract',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
additionalProperties: false,
|
|
41
|
+
};
|
|
42
|
+
constructor(browserService) {
|
|
43
|
+
this.browserService = browserService;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Execute stealth scraping
|
|
47
|
+
*/
|
|
48
|
+
async execute(input, _context) {
|
|
49
|
+
try {
|
|
50
|
+
const result = await this.browserService.scrape(input.selector);
|
|
51
|
+
// Apply limit if specified
|
|
52
|
+
if (input.limit && result.elements.length > input.limit) {
|
|
53
|
+
result.elements = result.elements.slice(0, input.limit);
|
|
54
|
+
result.count = result.elements.length;
|
|
55
|
+
}
|
|
56
|
+
// Filter attributes if specified
|
|
57
|
+
if (input.attributes) {
|
|
58
|
+
result.elements = result.elements.map((el) => ({
|
|
59
|
+
...el,
|
|
60
|
+
attributes: Object.fromEntries(Object.entries(el.attributes).filter(([key]) => input.attributes.includes(key))),
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
return { success: true, output: result };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return { success: false, error: error.message };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validate input
|
|
71
|
+
*/
|
|
72
|
+
validateArgs(input) {
|
|
73
|
+
const errors = [];
|
|
74
|
+
if (!input.selector) {
|
|
75
|
+
errors.push('Selector is required');
|
|
76
|
+
}
|
|
77
|
+
else if (typeof input.selector !== 'string') {
|
|
78
|
+
errors.push('Selector must be a string');
|
|
79
|
+
}
|
|
80
|
+
if (input.limit !== undefined) {
|
|
81
|
+
if (typeof input.limit !== 'number' || input.limit <= 0) {
|
|
82
|
+
errors.push('Limit must be a positive number');
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return errors.length === 0 ? { isValid: true } : { isValid: false, errors };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=scrape.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scrape.js","sourceRoot":"","sources":["../../src/tools/scrape.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAiCR;IAhCJ,EAAE,GAAG,2BAA2B,CAAC;IACjD,qDAAqD;IACrC,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,gBAAgB,CAAC;IAC/B,WAAW,GACzB,sFAAsF;QACtF,yEAAyE,CAAC;IAC5D,QAAQ,GAAG,UAAU,CAAC;IACtB,cAAc,GAAG,KAAK,CAAC;IAEvB,WAAW,GAAqB;QAC9C,IAAI,EAAE,QA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@module @framers/agentos-ext-stealth-browser
|
|
6
|
+
*/
|
|
7
|
+
import type { ITool, JSONSchemaObject, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
8
|
+
import type { StealthBrowserService } from '../StealthBrowserService.js';
|
|
9
|
+
import type { ScreenshotResult } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Tool for taking screenshots via stealth browser
|
|
12
|
+
*/
|
|
13
|
+
export declare class StealthScreenshotTool implements ITool {
|
|
14
|
+
private browserService;
|
|
15
|
+
readonly id = "stealth-browser-screenshot-v1";
|
|
16
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
17
|
+
readonly name = "stealth_screenshot";
|
|
18
|
+
readonly displayName = "Stealth Screenshot";
|
|
19
|
+
readonly description: string;
|
|
20
|
+
readonly category = "research";
|
|
21
|
+
readonly hasSideEffects = false;
|
|
22
|
+
readonly inputSchema: JSONSchemaObject;
|
|
23
|
+
constructor(browserService: StealthBrowserService);
|
|
24
|
+
/**
|
|
25
|
+
* Execute stealth screenshot capture
|
|
26
|
+
*/
|
|
27
|
+
execute(input: {
|
|
28
|
+
fullPage?: boolean;
|
|
29
|
+
selector?: string;
|
|
30
|
+
format?: 'png' | 'jpeg' | 'webp';
|
|
31
|
+
quality?: number;
|
|
32
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult<ScreenshotResult>>;
|
|
33
|
+
/**
|
|
34
|
+
* Validate input
|
|
35
|
+
*/
|
|
36
|
+
validateArgs(input: Record<string, any>): {
|
|
37
|
+
isValid: boolean;
|
|
38
|
+
errors?: any[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=screenshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshot.d.ts","sourceRoot":"","sources":["../../src/tools/screenshot.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,KAAK;IAwCrC,OAAO,CAAC,cAAc;IAvClC,SAAgB,EAAE,mCAAmC;IACrD,qDAAqD;IACrD,SAAgB,IAAI,wBAAwB;IAC5C,SAAgB,WAAW,wBAAwB;IACnD,SAAgB,WAAW,SAE0E;IACrG,SAAgB,QAAQ,cAAc;IACtC,SAAgB,cAAc,SAAS;IAEvC,SAAgB,WAAW,EAAE,gBAAgB,CA2B3C;gBAEkB,cAAc,EAAE,qBAAqB;IAEzD;;OAEG;IACG,OAAO,CACX,KAAK,EAAE;QACL,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;QACjC,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,EACD,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,CAAC;IAejD;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE;CAe/E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Stealth Screenshot Tool
|
|
4
|
+
* Capture screenshot of bot-protected pages via stealth browser.
|
|
5
|
+
*
|
|
6
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tool for taking screenshots via stealth browser
|
|
10
|
+
*/
|
|
11
|
+
export class StealthScreenshotTool {
|
|
12
|
+
browserService;
|
|
13
|
+
id = 'stealth-browser-screenshot-v1';
|
|
14
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
15
|
+
name = 'stealth_screenshot';
|
|
16
|
+
displayName = 'Stealth Screenshot';
|
|
17
|
+
description = 'Capture a screenshot of the current page or a specific element via the stealth browser. ' +
|
|
18
|
+
'Use for bot-protected sites where regular browser screenshots would show CAPTCHA or block pages.';
|
|
19
|
+
category = 'research';
|
|
20
|
+
hasSideEffects = false;
|
|
21
|
+
inputSchema = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
fullPage: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: false,
|
|
27
|
+
description: 'Capture full scrollable page',
|
|
28
|
+
},
|
|
29
|
+
selector: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'CSS selector for specific element to capture',
|
|
32
|
+
},
|
|
33
|
+
format: {
|
|
34
|
+
type: 'string',
|
|
35
|
+
enum: ['png', 'jpeg', 'webp'],
|
|
36
|
+
default: 'png',
|
|
37
|
+
description: 'Image format',
|
|
38
|
+
},
|
|
39
|
+
quality: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
minimum: 0,
|
|
42
|
+
maximum: 100,
|
|
43
|
+
default: 80,
|
|
44
|
+
description: 'Quality for jpeg/webp (0-100)',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
additionalProperties: false,
|
|
48
|
+
};
|
|
49
|
+
constructor(browserService) {
|
|
50
|
+
this.browserService = browserService;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Execute stealth screenshot capture
|
|
54
|
+
*/
|
|
55
|
+
async execute(input, _context) {
|
|
56
|
+
try {
|
|
57
|
+
const result = await this.browserService.screenshot({
|
|
58
|
+
fullPage: input.fullPage,
|
|
59
|
+
selector: input.selector,
|
|
60
|
+
format: input.format,
|
|
61
|
+
quality: input.quality,
|
|
62
|
+
});
|
|
63
|
+
return { success: true, output: result };
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return { success: false, error: error.message };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Validate input
|
|
71
|
+
*/
|
|
72
|
+
validateArgs(input) {
|
|
73
|
+
const errors = [];
|
|
74
|
+
if (input.format && !['png', 'jpeg', 'webp'].includes(input.format)) {
|
|
75
|
+
errors.push('Format must be png, jpeg, or webp');
|
|
76
|
+
}
|
|
77
|
+
if (input.quality !== undefined) {
|
|
78
|
+
if (typeof input.quality !== 'number' || input.quality < 0 || input.quality > 100) {
|
|
79
|
+
errors.push('Quality must be a number between 0 and 100');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return errors.length === 0 ? { isValid: true } : { isValid: false, errors };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=screenshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenshot.js","sourceRoot":"","sources":["../../src/tools/screenshot.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAwCZ;IAvCJ,EAAE,GAAG,+BAA+B,CAAC;IACrD,qDAAqD;IACrC,IAAI,GAAG,oBAAoB,CAAC;IAC5B,WAAW,GAAG,oBAAoB,CAAC;IACnC,WAAW,GACzB,0FAA0F;QAC1F,kGAAkG,CAAC;IACrF,QAAQ,GAAG,UAAU,CAAC;IACtB,cAAc,GAAG,KAAK,CAAC;IAEvB,WAAW,GAAqB;QAC9C,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,KAAK;gBACd,WAAW,EAAE,8BAA8B;aAC5C;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8CAA8C;aAC5D;YACD,MAAM,EAAE;gBACN,I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AAO,KAAK,SAAS,EAAE,CAAC;YAChC,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC;gBAClF,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;YAC5D,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC9E,CAAC;CACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stealth Snapshot Tool
|
|
3
|
+
* Extract structured DOM snapshot from bot-protected pages via stealth browser.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
6
|
+
*/
|
|
7
|
+
import type { ITool, JSONSchemaObject, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
8
|
+
import type { StealthBrowserService } from '../StealthBrowserService.js';
|
|
9
|
+
import type { PageSnapshot } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Tool for getting page snapshot via stealth browser
|
|
12
|
+
*/
|
|
13
|
+
export declare class StealthSnapshotTool implements ITool {
|
|
14
|
+
private browserService;
|
|
15
|
+
readonly id = "stealth-browser-snapshot-v1";
|
|
16
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
17
|
+
readonly name = "stealth_snapshot";
|
|
18
|
+
readonly displayName = "Stealth Snapshot";
|
|
19
|
+
readonly description: string;
|
|
20
|
+
readonly category = "research";
|
|
21
|
+
readonly hasSideEffects = false;
|
|
22
|
+
readonly inputSchema: JSONSchemaObject;
|
|
23
|
+
constructor(browserService: StealthBrowserService);
|
|
24
|
+
/**
|
|
25
|
+
* Execute stealth snapshot capture
|
|
26
|
+
*/
|
|
27
|
+
execute(input: {
|
|
28
|
+
includeLinks?: boolean;
|
|
29
|
+
includeForms?: boolean;
|
|
30
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult<PageSnapshot>>;
|
|
31
|
+
/**
|
|
32
|
+
* Validate input
|
|
33
|
+
*/
|
|
34
|
+
validateArgs(_input: Record<string, any>): {
|
|
35
|
+
isValid: boolean;
|
|
36
|
+
errors?: any[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/tools/snapshot.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;GAEG;AACH,qBAAa,mBAAoB,YAAW,KAAK;IA4BnC,OAAO,CAAC,cAAc;IA3BlC,SAAgB,EAAE,iCAAiC;IACnD,qDAAqD;IACrD,SAAgB,IAAI,sBAAsB;IAC1C,SAAgB,WAAW,sBAAsB;IACjD,SAAgB,WAAW,SAE+B;IAC1D,SAAgB,QAAQ,cAAc;IACtC,SAAgB,cAAc,SAAS;IAEvC,SAAgB,WAAW,EAAE,gBAAgB,CAe3C;gBAEkB,cAAc,EAAE,qBAAqB;IAEzD;;OAEG;IACG,OAAO,CACX,KAAK,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAE,EACzD,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAoB7C;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE;CAGhF"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Stealth Snapshot Tool
|
|
4
|
+
* Extract structured DOM snapshot from bot-protected pages via stealth browser.
|
|
5
|
+
*
|
|
6
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tool for getting page snapshot via stealth browser
|
|
10
|
+
*/
|
|
11
|
+
export class StealthSnapshotTool {
|
|
12
|
+
browserService;
|
|
13
|
+
id = 'stealth-browser-snapshot-v1';
|
|
14
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
15
|
+
name = 'stealth_snapshot';
|
|
16
|
+
displayName = 'Stealth Snapshot';
|
|
17
|
+
description = 'Get an accessibility-like snapshot of the current page (interactive elements, links, forms) ' +
|
|
18
|
+
'via the stealth browser. Use for bot-protected sites.';
|
|
19
|
+
category = 'research';
|
|
20
|
+
hasSideEffects = false;
|
|
21
|
+
inputSchema = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
properties: {
|
|
24
|
+
includeLinks: {
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: true,
|
|
27
|
+
description: 'Include links in snapshot',
|
|
28
|
+
},
|
|
29
|
+
includeForms: {
|
|
30
|
+
type: 'boolean',
|
|
31
|
+
default: true,
|
|
32
|
+
description: 'Include forms in snapshot',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
};
|
|
37
|
+
constructor(browserService) {
|
|
38
|
+
this.browserService = browserService;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Execute stealth snapshot capture
|
|
42
|
+
*/
|
|
43
|
+
async execute(input, _context) {
|
|
44
|
+
try {
|
|
45
|
+
const snapshot = await this.browserService.getSnapshot();
|
|
46
|
+
const includeLinks = input.includeLinks !== false;
|
|
47
|
+
const includeForms = input.includeForms !== false;
|
|
48
|
+
return {
|
|
49
|
+
success: true,
|
|
50
|
+
output: {
|
|
51
|
+
...snapshot,
|
|
52
|
+
links: includeLinks ? snapshot.links : [],
|
|
53
|
+
forms: includeForms ? snapshot.forms : [],
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return { success: false, error: error.message };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Validate input
|
|
63
|
+
*/
|
|
64
|
+
validateArgs(_input) {
|
|
65
|
+
return { isValid: true };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=snapshot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshot.js","sourceRoot":"","sources":["../../src/tools/snapshot.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,mBAAmB;IA4BV;IA3BJ,EAAE,GAAG,6BAA6B,CAAC;IACnD,qDAAqD;IACrC,IAAI,GAAG,kBAAkB,CAAC;IAC1B,WAAW,GAAG,kBAAkB,CAAC;IACjC,WAAW,GACzB,8FAA8F;QAC9F,uDAAuD,CAAC;IAC1C,QAAQ,GAAG,UAAU,CAAC;IACtB,cAAc,GAAG,KAAK,CAAC;IAEvB,WAAW,GAAqB;QAC9C,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,YAAY,EAAE;gBACZ,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,2BAA2B;aACzC;YACD,YAAY,EAAE;gBACZ,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,2BAA2B;aACzC;SACF;QACD,oBAAoB,EAAE,KAAK;KAC5B,CAAC;IAEF,YAAoB,cAAqC;QAArC,mBAAc,GAAd,cAAc,CAAuB;IAAG,CAAC;IAE7D;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,KAAyD,EACzD,QAA8B;QAE9B,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC;YAEzD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC;YAClD,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,KAAK,KAAK,CAAC;YAElD,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAAE;oBACN,GAAG,QAAQ;oBACX,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;oBACzC,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;iBAC1C;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;QAClD,CAAC;IACH,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,MAA2B;QACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stealth Type Tool
|
|
3
|
+
* Type text into input fields with human-like keystroke timing in stealth browser.
|
|
4
|
+
*
|
|
5
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
6
|
+
*/
|
|
7
|
+
import type { ITool, JSONSchemaObject, ToolExecutionContext, ToolExecutionResult } from '@framers/agentos';
|
|
8
|
+
import type { StealthBrowserService } from '../StealthBrowserService.js';
|
|
9
|
+
import type { TypeResult } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Tool for typing into inputs with stealth browser
|
|
12
|
+
*/
|
|
13
|
+
export declare class StealthTypeTool implements ITool {
|
|
14
|
+
private browserService;
|
|
15
|
+
readonly id = "stealth-browser-type-v1";
|
|
16
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
17
|
+
readonly name = "stealth_type";
|
|
18
|
+
readonly displayName = "Stealth Type";
|
|
19
|
+
readonly description: string;
|
|
20
|
+
readonly category = "research";
|
|
21
|
+
readonly hasSideEffects = true;
|
|
22
|
+
readonly inputSchema: JSONSchemaObject;
|
|
23
|
+
constructor(browserService: StealthBrowserService);
|
|
24
|
+
/**
|
|
25
|
+
* Execute stealth typing
|
|
26
|
+
*/
|
|
27
|
+
execute(input: {
|
|
28
|
+
selector: string;
|
|
29
|
+
text: string;
|
|
30
|
+
delay?: number;
|
|
31
|
+
clear?: boolean;
|
|
32
|
+
}, _context: ToolExecutionContext): Promise<ToolExecutionResult<TypeResult>>;
|
|
33
|
+
/**
|
|
34
|
+
* Validate input
|
|
35
|
+
*/
|
|
36
|
+
validateArgs(input: Record<string, any>): {
|
|
37
|
+
isValid: boolean;
|
|
38
|
+
errors?: any[];
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/tools/type.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,qBAAa,eAAgB,YAAW,KAAK;IAqC/B,OAAO,CAAC,cAAc;IApClC,SAAgB,EAAE,6BAA6B;IAC/C,qDAAqD;IACrD,SAAgB,IAAI,kBAAkB;IACtC,SAAgB,WAAW,kBAAkB;IAC7C,SAAgB,WAAW,SAE2C;IACtE,SAAgB,QAAQ,cAAc;IACtC,SAAgB,cAAc,QAAQ;IAEtC,SAAgB,WAAW,EAAE,gBAAgB,CAwB3C;gBAEkB,cAAc,EAAE,qBAAqB;IAEzD;;OAEG;IACG,OAAO,CACX,KAAK,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAC1E,QAAQ,EAAE,oBAAoB,GAC7B,OAAO,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAiB3C;;OAEG;IACH,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE;CAiB/E"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Stealth Type Tool
|
|
4
|
+
* Type text into input fields with human-like keystroke timing in stealth browser.
|
|
5
|
+
*
|
|
6
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Tool for typing into inputs with stealth browser
|
|
10
|
+
*/
|
|
11
|
+
export class StealthTypeTool {
|
|
12
|
+
browserService;
|
|
13
|
+
id = 'stealth-browser-type-v1';
|
|
14
|
+
/** Tool call name used by the LLM / ToolExecutor. */
|
|
15
|
+
name = 'stealth_type';
|
|
16
|
+
displayName = 'Stealth Type';
|
|
17
|
+
description = 'Type text into an input field using a CSS selector via the stealth browser. ' +
|
|
18
|
+
'Defaults to human-like keystroke delay (50ms) to avoid detection.';
|
|
19
|
+
category = 'research';
|
|
20
|
+
hasSideEffects = true;
|
|
21
|
+
inputSchema = {
|
|
22
|
+
type: 'object',
|
|
23
|
+
required: ['selector', 'text'],
|
|
24
|
+
properties: {
|
|
25
|
+
selector: {
|
|
26
|
+
type: 'string',
|
|
27
|
+
description: 'CSS selector for the input element',
|
|
28
|
+
},
|
|
29
|
+
text: {
|
|
30
|
+
type: 'string',
|
|
31
|
+
description: 'Text to type',
|
|
32
|
+
},
|
|
33
|
+
delay: {
|
|
34
|
+
type: 'number',
|
|
35
|
+
description: 'Delay between keystrokes (ms). Defaults to 50 for human-like typing.',
|
|
36
|
+
default: 50,
|
|
37
|
+
},
|
|
38
|
+
clear: {
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
description: 'Clear existing text before typing',
|
|
41
|
+
default: false,
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
additionalProperties: false,
|
|
45
|
+
};
|
|
46
|
+
constructor(browserService) {
|
|
47
|
+
this.browserService = browserService;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Execute stealth typing
|
|
51
|
+
*/
|
|
52
|
+
async execute(input, _context) {
|
|
53
|
+
try {
|
|
54
|
+
const result = await this.browserService.type(input.selector, input.text, {
|
|
55
|
+
delay: input.delay,
|
|
56
|
+
clear: input.clear,
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
success: result.success,
|
|
60
|
+
output: result,
|
|
61
|
+
error: result.success ? undefined : 'Type failed',
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return { success: false, error: error.message };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Validate input
|
|
70
|
+
*/
|
|
71
|
+
validateArgs(input) {
|
|
72
|
+
const errors = [];
|
|
73
|
+
if (!input.selector) {
|
|
74
|
+
errors.push('Selector is required');
|
|
75
|
+
}
|
|
76
|
+
else if (typeof input.selector !== 'string') {
|
|
77
|
+
errors.push('Selector must be a string');
|
|
78
|
+
}
|
|
79
|
+
if (input.text === undefined || input.text === null) {
|
|
80
|
+
errors.push('Text is required');
|
|
81
|
+
}
|
|
82
|
+
else if (typeof input.text !== 'string') {
|
|
83
|
+
errors.push('Text must be a string');
|
|
84
|
+
}
|
|
85
|
+
return errors.length === 0 ? { isValid: true } : { isValid: false, errors };
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/tools/type.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,OAAO,eAAe;IAqCN;IApCJ,EAAE,GAAG,yBAAyB,CAAC;IAC/C,qDAAqD;IACrC,IAAI,GAAG,cAAc,CAAC;IACtB,WAAW,GAAG,cAAc,CAAC;IAC7B,WAAW,GACzB,8EAA8E;QAC9E,mEAAmE,CAAC;IACtD,QAAQ,GAAG,UAAU,CAAC;IACtB,cAAc,GAAG,IAAI,CAAC;IAEtB,WAAW,GAAqB;QAC9C,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;QAC9B,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oCAAoC;aAClD;YACD,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,cAAc;aAC5B;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,sEAAsE;gBACnF,OAAO,EAAE,EAAE;aACZ;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,mCAAmC;gBAChD,OAAO,EAAE,KAAK;aACf;SACF;QACD,oBAAoB,EAAE,KAAK;KAC5B,CAAC;IAEF,YAAoB,cAAqC;QAArC,mBAAc,GAAd,cAAc,CAAuB;IAAG,CAAC;IAE7D;;OAEG;IACH,KAAK,CAAC,OAAO,CACX,KAA0E,EAC1E,QAA8B;QAE9B,I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,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC9E,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stealth Browser Extension Types
|
|
3
|
+
* @module @framers/agentos-ext-stealth-browser
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Stealth browser configuration options
|
|
7
|
+
*/
|
|
8
|
+
export interface StealthBrowserConfig {
|
|
9
|
+
/** Run browser in headless mode */
|
|
10
|
+
headless?: boolean;
|
|
11
|
+
/** Default timeout for operations (ms) */
|
|
12
|
+
timeout?: number;
|
|
13
|
+
/** Custom user agent string (auto-rotated if not set) */
|
|
14
|
+
userAgent?: string;
|
|
15
|
+
/** Viewport dimensions */
|
|
16
|
+
viewport?: {
|
|
17
|
+
width: number;
|
|
18
|
+
height: number;
|
|
19
|
+
};
|
|
20
|
+
/** Executable path for browser (for puppeteer-core) */
|
|
21
|
+
executablePath?: string;
|
|
22
|
+
/** Enable all stealth evasion techniques (default: true) */
|
|
23
|
+
enableEvasions?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Result of a navigation operation
|
|
27
|
+
*/
|
|
28
|
+
export interface NavigationResult {
|
|
29
|
+
/** Final URL after any redirects */
|
|
30
|
+
url: string;
|
|
31
|
+
/** HTTP status code */
|
|
32
|
+
status: number;
|
|
33
|
+
/** Page title */
|
|
34
|
+
title: string;
|
|
35
|
+
/** Full HTML content */
|
|
36
|
+
html?: string;
|
|
37
|
+
/** Extracted text content */
|
|
38
|
+
text?: string;
|
|
39
|
+
/** Links found on the page */
|
|
40
|
+
links?: {
|
|
41
|
+
text: string;
|
|
42
|
+
href: string;
|
|
43
|
+
}[];
|
|
44
|
+
/** Time taken to load (ms) */
|
|
45
|
+
loadTime: number;
|
|
46
|
+
/** Any console messages */
|
|
47
|
+
consoleMessages?: string[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Result of a scrape operation
|
|
51
|
+
*/
|
|
52
|
+
export interface ScrapeResult {
|
|
53
|
+
/** Selector used */
|
|
54
|
+
selector: string;
|
|
55
|
+
/** Number of elements found */
|
|
56
|
+
count: number;
|
|
57
|
+
/** Extracted content */
|
|
58
|
+
elements: ScrapeElement[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A single scraped element
|
|
62
|
+
*/
|
|
63
|
+
export interface ScrapeElement {
|
|
64
|
+
/** Element tag name */
|
|
65
|
+
tag: string;
|
|
66
|
+
/** Element text content */
|
|
67
|
+
text: string;
|
|
68
|
+
/** Element HTML content */
|
|
69
|
+
html: string;
|
|
70
|
+
/** Element attributes */
|
|
71
|
+
attributes: Record<string, string>;
|
|
72
|
+
/** Href if it's a link */
|
|
73
|
+
href?: string;
|
|
74
|
+
/** Src if it's an image/media */
|
|
75
|
+
src?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Result of a click operation
|
|
79
|
+
*/
|
|
80
|
+
export interface ClickResult {
|
|
81
|
+
/** Whether click was successful */
|
|
82
|
+
success: boolean;
|
|
83
|
+
/** Element that was clicked (selector) */
|
|
84
|
+
element: string;
|
|
85
|
+
/** New URL if navigation occurred */
|
|
86
|
+
newUrl?: string;
|
|
87
|
+
/** Any text content change detected */
|
|
88
|
+
contentChanged?: boolean;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Result of a type operation
|
|
92
|
+
*/
|
|
93
|
+
export interface TypeResult {
|
|
94
|
+
/** Whether typing was successful */
|
|
95
|
+
success: boolean;
|
|
96
|
+
/** Element that received input */
|
|
97
|
+
element: string;
|
|
98
|
+
/** Text that was typed */
|
|
99
|
+
text: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Screenshot capture options
|
|
103
|
+
*/
|
|
104
|
+
export interface ScreenshotOptions {
|
|
105
|
+
/** Capture full scrollable page */
|
|
106
|
+
fullPage?: boolean;
|
|
107
|
+
/** CSS selector for specific element */
|
|
108
|
+
selector?: string;
|
|
109
|
+
/** Image format */
|
|
110
|
+
format?: 'png' | 'jpeg' | 'webp';
|
|
111
|
+
/** Quality for jpeg/webp (0-100) */
|
|
112
|
+
quality?: number;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Result of a screenshot operation
|
|
116
|
+
*/
|
|
117
|
+
export interface ScreenshotResult {
|
|
118
|
+
/** Base64-encoded image data */
|
|
119
|
+
data: string;
|
|
120
|
+
/** Image format */
|
|
121
|
+
format: 'png' | 'jpeg' | 'webp';
|
|
122
|
+
/** Width in pixels */
|
|
123
|
+
width: number;
|
|
124
|
+
/** Height in pixels */
|
|
125
|
+
height: number;
|
|
126
|
+
/** File size in bytes */
|
|
127
|
+
size: number;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Page snapshot for accessibility tree
|
|
131
|
+
*/
|
|
132
|
+
export interface PageSnapshot {
|
|
133
|
+
/** Current URL */
|
|
134
|
+
url: string;
|
|
135
|
+
/** Page title */
|
|
136
|
+
title: string;
|
|
137
|
+
/** Simplified DOM structure */
|
|
138
|
+
elements: SnapshotElement[];
|
|
139
|
+
/** Links on the page */
|
|
140
|
+
links: {
|
|
141
|
+
text: string;
|
|
142
|
+
href: string;
|
|
143
|
+
ref: string;
|
|
144
|
+
}[];
|
|
145
|
+
/** Forms on the page */
|
|
146
|
+
forms: {
|
|
147
|
+
id?: string;
|
|
148
|
+
action?: string;
|
|
149
|
+
fields: string[];
|
|
150
|
+
}[];
|
|
151
|
+
/** Interactive elements */
|
|
152
|
+
interactable: {
|
|
153
|
+
ref: string;
|
|
154
|
+
type: string;
|
|
155
|
+
label: string;
|
|
156
|
+
}[];
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Element in page snapshot
|
|
160
|
+
*/
|
|
161
|
+
export interface SnapshotElement {
|
|
162
|
+
/** Reference ID for interaction */
|
|
163
|
+
ref: string;
|
|
164
|
+
/** Element type */
|
|
165
|
+
type: string;
|
|
166
|
+
/** Accessible name/label */
|
|
167
|
+
label: string;
|
|
168
|
+
/** Role (button, link, input, etc.) */
|
|
169
|
+
role?: string;
|
|
170
|
+
/** Value for inputs */
|
|
171
|
+
value?: string;
|
|
172
|
+
/** Whether element is visible */
|
|
173
|
+
visible: boolean;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA;;;GAGG;AAEH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,uDAAuD;IACvD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACzC,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,eAAe,CAA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