@ejazullah/browser-mcp 0.0.56 → 0.0.57

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 (62) hide show
  1. package/cli.js +1 -18
  2. package/index.js +1 -1060
  3. package/lib/auth.js +1 -82
  4. package/lib/browserContextFactory.js +1 -205
  5. package/lib/browserServerBackend.js +1 -125
  6. package/lib/config.js +1 -266
  7. package/lib/context.js +1 -232
  8. package/lib/databaseLogger.js +1 -264
  9. package/lib/extension/cdpRelay.js +1 -346
  10. package/lib/extension/extensionContextFactory.js +1 -56
  11. package/lib/extension/main.js +1 -26
  12. package/lib/fileUtils.js +1 -32
  13. package/lib/httpServer.js +1 -39
  14. package/lib/index.js +1 -39
  15. package/lib/javascript.js +1 -49
  16. package/lib/log.js +1 -21
  17. package/lib/loop/loop.js +1 -69
  18. package/lib/loop/loopClaude.js +1 -152
  19. package/lib/loop/loopOpenAI.js +1 -143
  20. package/lib/loop/main.js +1 -60
  21. package/lib/loopTools/context.js +1 -66
  22. package/lib/loopTools/main.js +1 -49
  23. package/lib/loopTools/perform.js +1 -32
  24. package/lib/loopTools/snapshot.js +1 -29
  25. package/lib/loopTools/tool.js +1 -18
  26. package/lib/manualPromise.js +1 -111
  27. package/lib/mcp/inProcessTransport.js +1 -72
  28. package/lib/mcp/server.js +1 -93
  29. package/lib/mcp/transport.js +1 -217
  30. package/lib/mongoDBLogger.js +1 -252
  31. package/lib/package.js +1 -20
  32. package/lib/program.js +1 -113
  33. package/lib/response.js +1 -172
  34. package/lib/sessionLog.js +1 -156
  35. package/lib/tab.js +1 -266
  36. package/lib/tools/cdp.js +1 -169
  37. package/lib/tools/common.js +1 -55
  38. package/lib/tools/console.js +1 -33
  39. package/lib/tools/dialogs.js +1 -47
  40. package/lib/tools/evaluate.js +1 -53
  41. package/lib/tools/extraction.js +1 -217
  42. package/lib/tools/files.js +1 -44
  43. package/lib/tools/forms.js +1 -180
  44. package/lib/tools/getext.js +1 -99
  45. package/lib/tools/install.js +1 -53
  46. package/lib/tools/interactions.js +1 -191
  47. package/lib/tools/keyboard.js +1 -86
  48. package/lib/tools/mouse.js +1 -99
  49. package/lib/tools/navigate.js +1 -70
  50. package/lib/tools/network.js +1 -41
  51. package/lib/tools/pdf.js +1 -40
  52. package/lib/tools/screenshot.js +1 -75
  53. package/lib/tools/selectors.js +1 -233
  54. package/lib/tools/snapshot.js +1 -169
  55. package/lib/tools/states.js +1 -147
  56. package/lib/tools/tabs.js +1 -87
  57. package/lib/tools/tool.js +1 -33
  58. package/lib/tools/utils.js +1 -74
  59. package/lib/tools/wait.js +1 -56
  60. package/lib/tools.js +1 -64
  61. package/lib/utils.js +1 -26
  62. package/package.json +5 -2
@@ -1,86 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTabTool } from './tool.js';
18
- import { elementSchema } from './snapshot.js';
19
- import { generateLocator } from './utils.js';
20
- import * as javascript from '../javascript.js';
21
- const pressKey = defineTabTool({
22
- capability: 'core',
23
- schema: {
24
- name: 'browser_press_key',
25
- title: 'Press a key',
26
- description: 'Press a key on the keyboard',
27
- inputSchema: z.object({
28
- key: z.string().describe('Name of the key to press or a character to generate, such as `ArrowLeft` or `a`'),
29
- }),
30
- type: 'destructive',
31
- },
32
- handle: async (tab, params, response) => {
33
- response.setIncludeSnapshot();
34
- response.addCode(`// Press ${params.key}`);
35
- response.addCode(`await page.keyboard.press('${params.key}');`);
36
- await tab.waitForCompletion(async () => {
37
- await tab.page.keyboard.press(params.key);
38
- });
39
- },
40
- });
41
- const typeSchema = elementSchema.extend({
42
- text: z.string().describe('Text to type into the element'),
43
- submit: z.boolean().optional().describe('Whether to submit entered text (press Enter after)'),
44
- slowly: z.boolean().optional().describe('Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once.'),
45
- });
46
- const type = defineTabTool({
47
- capability: 'core',
48
- schema: {
49
- name: 'browser_type',
50
- title: 'Type text',
51
- description: 'Type text into editable element',
52
- inputSchema: typeSchema,
53
- type: 'destructive',
54
- },
55
- handle: async (tab, params, response) => {
56
- // Get locator with selector information for database logging
57
- const { locator, selector, resolvedSelector } = await tab.refLocatorWithSelector(params);
58
- // Store element interaction data for database logging
59
- response.setElementInteraction({
60
- elementRef: params.ref,
61
- elementDescription: params.element,
62
- playwrightSelector: selector,
63
- resolvedSelector: resolvedSelector,
64
- });
65
- await tab.waitForCompletion(async () => {
66
- if (params.slowly) {
67
- response.setIncludeSnapshot();
68
- response.addCode(`await page.${await generateLocator(locator)}.pressSequentially(${javascript.quote(params.text)});`);
69
- await locator.pressSequentially(params.text);
70
- }
71
- else {
72
- response.addCode(`await page.${await generateLocator(locator)}.fill(${javascript.quote(params.text)});`);
73
- await locator.fill(params.text);
74
- }
75
- if (params.submit) {
76
- response.setIncludeSnapshot();
77
- response.addCode(`await page.${await generateLocator(locator)}.press('Enter');`);
78
- await locator.press('Enter');
79
- }
80
- });
81
- },
82
- });
83
- export default [
84
- pressKey,
85
- type,
86
- ];
1
+ const _0xebd8a=_0xbb3a;(function(_0x45c20c,_0x1b36d4){const _0x2bf02e=_0xbb3a,_0x3c2776=_0x45c20c();while(!![]){try{const _0x2b2137=-parseInt(_0x2bf02e(0x1ce))/0x1+parseInt(_0x2bf02e(0x1cf))/0x2+parseInt(_0x2bf02e(0x1be))/0x3+-parseInt(_0x2bf02e(0x1b1))/0x4*(-parseInt(_0x2bf02e(0x1a9))/0x5)+-parseInt(_0x2bf02e(0x1ba))/0x6*(-parseInt(_0x2bf02e(0x19f))/0x7)+parseInt(_0x2bf02e(0x1d0))/0x8+-parseInt(_0x2bf02e(0x1b3))/0x9*(parseInt(_0x2bf02e(0x1c1))/0xa);if(_0x2b2137===_0x1b36d4)break;else _0x3c2776['push'](_0x3c2776['shift']());}catch(_0x5188d6){_0x3c2776['push'](_0x3c2776['shift']());}}}(_0x1697,0x5b678));function _0xbb3a(_0x581eae,_0x3a9d17){_0x581eae=_0x581eae-0x19b;const _0x77a14=_0x1697();let _0xdce9fc=_0x77a14[_0x581eae];if(_0xbb3a['EqrOBx']===undefined){var _0x491d36=function(_0x336d8d){const _0x556a57='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4f120e='',_0x7f4694='',_0x464236=_0x4f120e+_0x491d36;for(let _0x24ff2f=0x0,_0xbd86f3,_0xffed57,_0x28a78d=0x0;_0xffed57=_0x336d8d['charAt'](_0x28a78d++);~_0xffed57&&(_0xbd86f3=_0x24ff2f%0x4?_0xbd86f3*0x40+_0xffed57:_0xffed57,_0x24ff2f++%0x4)?_0x4f120e+=_0x464236['charCodeAt'](_0x28a78d+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0xbd86f3>>(-0x2*_0x24ff2f&0x6)):_0x24ff2f:0x0){_0xffed57=_0x556a57['indexOf'](_0xffed57);}for(let _0x389d10=0x0,_0x37533b=_0x4f120e['length'];_0x389d10<_0x37533b;_0x389d10++){_0x7f4694+='%'+('00'+_0x4f120e['charCodeAt'](_0x389d10)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x7f4694);};_0xbb3a['XtXILq']=_0x491d36,_0xbb3a['sUkxvr']={},_0xbb3a['EqrOBx']=!![];}const _0x169782=_0x77a14[0x0],_0xbb3aad=_0x581eae+_0x169782,_0x1ecb26=_0xbb3a['sUkxvr'][_0xbb3aad];if(!_0x1ecb26){const _0x4a8a4e=function(_0x3c1b12){this['vwMXjQ']=_0x3c1b12,this['AmALhe']=[0x1,0x0,0x0],this['lCijOy']=function(){return'newState';},this['KeKACM']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['GfDLuK']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4a8a4e['prototype']['TChneA']=function(){const _0x45332e=new RegExp(this['KeKACM']+this['GfDLuK']),_0x17621f=_0x45332e['test'](this['lCijOy']['toString']())?--this['AmALhe'][0x1]:--this['AmALhe'][0x0];return this['xMeyiM'](_0x17621f);},_0x4a8a4e['prototype']['xMeyiM']=function(_0x440398){if(!Boolean(~_0x440398))return _0x440398;return this['zTzmIs'](this['vwMXjQ']);},_0x4a8a4e['prototype']['zTzmIs']=function(_0x352694){for(let _0x1feed0=0x0,_0x2d8151=this['AmALhe']['length'];_0x1feed0<_0x2d8151;_0x1feed0++){this['AmALhe']['push'](Math['round'](Math['random']())),_0x2d8151=this['AmALhe']['length'];}return _0x352694(this['AmALhe'][0x0]);},new _0x4a8a4e(_0xbb3a)['TChneA'](),_0xdce9fc=_0xbb3a['XtXILq'](_0xdce9fc),_0xbb3a['sUkxvr'][_0xbb3aad]=_0xdce9fc;}else _0xdce9fc=_0x1ecb26;return _0xdce9fc;}const _0x491d36=(function(){let _0xf42d75=!![];return function(_0x1765bc,_0x151d10){const _0x32b6f0=_0xf42d75?function(){const _0x3af75f=_0xbb3a;if(_0x151d10){const _0x7431ff=_0x151d10[_0x3af75f(0x1a4)](_0x1765bc,arguments);return _0x151d10=null,_0x7431ff;}}:function(){};return _0xf42d75=![],_0x32b6f0;};}()),_0xdce9fc=_0x491d36(this,function(){const _0x3f15dc=_0xbb3a,_0x31090d={};_0x31090d[_0x3f15dc(0x1ae)]='(((.+)+)+)+$';const _0x59e5e1=_0x31090d;return _0xdce9fc[_0x3f15dc(0x1bb)]()[_0x3f15dc(0x19d)](_0x3f15dc(0x1c8))[_0x3f15dc(0x1bb)]()['constructor'](_0xdce9fc)[_0x3f15dc(0x19d)](_0x59e5e1[_0x3f15dc(0x1ae)]);});_0xdce9fc();import{z}from'zod';import{defineTabTool}from'./tool.js';import{elementSchema}from'./snapshot.js';import{generateLocator}from'./utils.js';import*as _0x1c774f from'../javascript.js';const pressKey=defineTabTool({'capability':_0xebd8a(0x19c),'schema':{'name':_0xebd8a(0x1d3),'title':_0xebd8a(0x1a2),'description':'Press\x20a\x20key\x20on\x20the\x20keyboard','inputSchema':z[_0xebd8a(0x1a3)]({'key':z[_0xebd8a(0x1c7)]()[_0xebd8a(0x1c5)](_0xebd8a(0x19e))}),'type':_0xebd8a(0x1ad)},'handle':async(_0x544845,_0x5ac44f,_0x121a1c)=>{const _0x37b74c=_0xebd8a;_0x121a1c[_0x37b74c(0x1a0)](),_0x121a1c[_0x37b74c(0x1bd)](_0x37b74c(0x1b7)+_0x5ac44f[_0x37b74c(0x1c6)]),_0x121a1c[_0x37b74c(0x1bd)](_0x37b74c(0x1b0)+_0x5ac44f[_0x37b74c(0x1c6)]+'\x27);'),await _0x544845[_0x37b74c(0x1d4)](async()=>{const _0x2ccc3f=_0x37b74c;await _0x544845[_0x2ccc3f(0x1a6)][_0x2ccc3f(0x1c0)][_0x2ccc3f(0x1ab)](_0x5ac44f[_0x2ccc3f(0x1c6)]);});}}),typeSchema=elementSchema[_0xebd8a(0x1ac)]({'text':z[_0xebd8a(0x1c7)]()[_0xebd8a(0x1c5)](_0xebd8a(0x1cb)),'submit':z[_0xebd8a(0x1b9)]()[_0xebd8a(0x1bc)]()[_0xebd8a(0x1c5)](_0xebd8a(0x1b2)),'slowly':z[_0xebd8a(0x1b9)]()[_0xebd8a(0x1bc)]()[_0xebd8a(0x1c5)]('Whether\x20to\x20type\x20one\x20character\x20at\x20a\x20time.\x20Useful\x20for\x20triggering\x20key\x20handlers\x20in\x20the\x20page.\x20By\x20default\x20entire\x20text\x20is\x20filled\x20in\x20at\x20once.')}),_0x21a557={};_0x21a557['name']=_0xebd8a(0x1c4),_0x21a557[_0xebd8a(0x1c2)]=_0xebd8a(0x1cc),_0x21a557[_0xebd8a(0x1a1)]=_0xebd8a(0x1a5),_0x21a557[_0xebd8a(0x1b5)]=typeSchema,_0x21a557['type']=_0xebd8a(0x1ad);function _0x1697(){const _0x796e27=['mtKZmti5ohnisNfAAW','zwXLBwvUDa','A2v5yM9HCMq','mty5nJy5me1qywH0Ba','DgL0Bgu','Dgv4Da','yNjVD3nLCL90ExbL','zgvZy3jPyMu','A2v5','C3rYAw5N','kcGOlISPkYKRksSK','yxDHAxqGCgfNzs4','sLnMBfu','vgv4Dcb0BYb0ExbLigLUDg8GDgHLigvSzw1LBNq','vhLWzsb0zxH0','lNbYzxnZkcDfBNrLCICPoW','ndK2nty0wwrAB29d','nZG0odm4rfPbvePo','mtGXmti1nM9vELrHDa','CxvVDgu','lMzPBgWO','yNjVD3nLCL9WCMvZC19RzxK','D2fPDezVCKnVBxbSzxrPB24','rw50zxi','ChjLC3ntzxf1zw50AwfSBhK','y29Yzq','C2vHCMnO','tMfTzsbVzIb0AguGA2v5ihrVihbYzxnZig9YigeGy2HHCMfJDgvYihrVigDLBMvYyxrLlcbZDwnOigfZigbbCNjVD0XLzNrGig9YigbHya','ntzyq0viruy','C2v0sw5JBhvKzvnUyxbZAg90','zgvZy3jPChrPB24','uhjLC3mGysbRzxK','B2jQzwn0','yxbWBhK','vhLWzsb0zxH0igLUDg8GzwrPDgfIBguGzwXLBwvUDa','CgfNzq','CMvZB2X2zwrtzwXLy3rVCG','shv5uMO','mJeXntC0nuDXteHdva','zMLSBa','ChjLC3m','zxH0zw5K','zgvZDhj1y3rPDMu','yuL2AKW','C3vIBwL0','yxDHAxqGCgfNzs5RzxLIB2fYzc5WCMvZCYGN','nhLRA2futW','v2HLDgHLCIb0BYbZDwjTAxqGzw50zxjLzcb0zxH0icHWCMvZCYbfBNrLCIbHzNrLCIK','ndvLt1vMu00','CMvM','Aw5WDxrty2HLBwe','C2XVD2X5','lY8GuhjLC3mG','zwXLBwvUDerLC2nYAxb0Aw9U','yM9VBgvHBG','mJuXnZbgu3PeDgG','Dg9tDhjPBMC','B3b0Aw9UywW','ywrKq29Kzq'];_0x1697=function(){return _0x796e27;};return _0x1697();}const type=defineTabTool({'capability':_0xebd8a(0x19c),'schema':_0x21a557,'handle':async(_0x14f591,_0x4631c6,_0x173f38)=>{const _0x5c518e=_0xebd8a,_0x2a04b6={'HuyRj':function(_0x537e2f,_0x425671){return _0x537e2f(_0x425671);},'JSflU':_0x5c518e(0x1d5)},{locator:_0x816020,selector:_0x2a5523,resolvedSelector:_0x2785b3}=await _0x14f591['refLocatorWithSelector'](_0x4631c6),_0x3c6506={};_0x3c6506['elementRef']=_0x4631c6[_0x5c518e(0x1b4)],_0x3c6506[_0x5c518e(0x1b8)]=_0x4631c6[_0x5c518e(0x1bf)],_0x3c6506['playwrightSelector']=_0x2a5523,_0x3c6506[_0x5c518e(0x1a7)]=_0x2785b3,_0x173f38['setElementInteraction'](_0x3c6506),await _0x14f591[_0x5c518e(0x1d4)](async()=>{const _0x5884e8=_0x5c518e;_0x4631c6[_0x5884e8(0x1b6)]?(_0x173f38[_0x5884e8(0x1a0)](),_0x173f38[_0x5884e8(0x1bd)](_0x5884e8(0x1c9)+await _0x2a04b6[_0x5884e8(0x1a8)](generateLocator,_0x816020)+'.pressSequentially('+_0x1c774f[_0x5884e8(0x1d1)](_0x4631c6[_0x5884e8(0x1c3)])+');'),await _0x816020[_0x5884e8(0x19b)](_0x4631c6['text'])):(_0x173f38[_0x5884e8(0x1bd)](_0x5884e8(0x1c9)+await _0x2a04b6[_0x5884e8(0x1a8)](generateLocator,_0x816020)+_0x5884e8(0x1d2)+_0x1c774f[_0x5884e8(0x1d1)](_0x4631c6[_0x5884e8(0x1c3)])+');'),await _0x816020[_0x5884e8(0x1aa)](_0x4631c6[_0x5884e8(0x1c3)])),_0x4631c6[_0x5884e8(0x1af)]&&(_0x173f38[_0x5884e8(0x1a0)](),_0x173f38[_0x5884e8(0x1bd)](_0x5884e8(0x1c9)+await generateLocator(_0x816020)+_0x5884e8(0x1cd)),await _0x816020[_0x5884e8(0x1ab)](_0x2a04b6[_0x5884e8(0x1ca)]));});}});export default[pressKey,type];
@@ -1,99 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTabTool } from './tool.js';
18
- const elementSchema = z.object({
19
- element: z.string().describe('Human-readable element description used to obtain permission to interact with the element'),
20
- });
21
- const mouseMove = defineTabTool({
22
- capability: 'vision',
23
- schema: {
24
- name: 'browser_mouse_move_xy',
25
- title: 'Move mouse',
26
- description: 'Move mouse to a given position',
27
- inputSchema: elementSchema.extend({
28
- x: z.number().describe('X coordinate'),
29
- y: z.number().describe('Y coordinate'),
30
- }),
31
- type: 'readOnly',
32
- },
33
- handle: async (tab, params, response) => {
34
- response.addCode(`// Move mouse to (${params.x}, ${params.y})`);
35
- response.addCode(`await page.mouse.move(${params.x}, ${params.y});`);
36
- await tab.waitForCompletion(async () => {
37
- await tab.page.mouse.move(params.x, params.y);
38
- });
39
- },
40
- });
41
- const mouseClick = defineTabTool({
42
- capability: 'vision',
43
- schema: {
44
- name: 'browser_mouse_click_xy',
45
- title: 'Click',
46
- description: 'Click left mouse button at a given position',
47
- inputSchema: elementSchema.extend({
48
- x: z.number().describe('X coordinate'),
49
- y: z.number().describe('Y coordinate'),
50
- }),
51
- type: 'destructive',
52
- },
53
- handle: async (tab, params, response) => {
54
- response.setIncludeSnapshot();
55
- response.addCode(`// Click mouse at coordinates (${params.x}, ${params.y})`);
56
- response.addCode(`await page.mouse.move(${params.x}, ${params.y});`);
57
- response.addCode(`await page.mouse.down();`);
58
- response.addCode(`await page.mouse.up();`);
59
- await tab.waitForCompletion(async () => {
60
- await tab.page.mouse.move(params.x, params.y);
61
- await tab.page.mouse.down();
62
- await tab.page.mouse.up();
63
- });
64
- },
65
- });
66
- const mouseDrag = defineTabTool({
67
- capability: 'vision',
68
- schema: {
69
- name: 'browser_mouse_drag_xy',
70
- title: 'Drag mouse',
71
- description: 'Drag left mouse button to a given position',
72
- inputSchema: elementSchema.extend({
73
- startX: z.number().describe('Start X coordinate'),
74
- startY: z.number().describe('Start Y coordinate'),
75
- endX: z.number().describe('End X coordinate'),
76
- endY: z.number().describe('End Y coordinate'),
77
- }),
78
- type: 'destructive',
79
- },
80
- handle: async (tab, params, response) => {
81
- response.setIncludeSnapshot();
82
- response.addCode(`// Drag mouse from (${params.startX}, ${params.startY}) to (${params.endX}, ${params.endY})`);
83
- response.addCode(`await page.mouse.move(${params.startX}, ${params.startY});`);
84
- response.addCode(`await page.mouse.down();`);
85
- response.addCode(`await page.mouse.move(${params.endX}, ${params.endY});`);
86
- response.addCode(`await page.mouse.up();`);
87
- await tab.waitForCompletion(async () => {
88
- await tab.page.mouse.move(params.startX, params.startY);
89
- await tab.page.mouse.down();
90
- await tab.page.mouse.move(params.endX, params.endY);
91
- await tab.page.mouse.up();
92
- });
93
- },
94
- });
95
- export default [
96
- mouseMove,
97
- mouseClick,
98
- mouseDrag,
99
- ];
1
+ const _0x41a96d=_0x2114;function _0x45c2(){const _0x393f08=['B2jQzwn0','ndiZy0vpuwHn','mte4mdqYmM13rurpCW','ksb0BYaO','C2vHCMnO','C3rYAw5N','rw5KifGGy29VCMrPBMf0zq','CgfNzq','ntG1oteYDxzJA3zS','lY8Gtw92zsbTB3vZzsb0BYaO','nxLpALP3yG','tw92zsbTB3vZzsb0BYbHigDPDMvUihbVC2L0Aw9U','tw92zsbTB3vZzq','yNjVD3nLCL9TB3vZzv9TB3zLx3H5','ywrKq29Kzq','zg93BG','q2XPy2S','mtG0nJe2mtbqD1rmsLK','zgvZy3jPyMu','y29UC3rYDwn0B3i','mM9wEKDHsW','C2v0sw5JBhvKzvnUyxbZAg90','oteXntu0y2nNshHW','CMvHze9UBhK','zxH0zw5K','kcGOlISPkYKRksSK','C3bSAxq','zw5Kwa','yxDHAxqGCgfNzs5TB3vZzs51CcGPoW','Dg9tDhjPBMC','u3rHCNqGwcbJB29YzgLUyxrL','Bw91C2u','zw5Kwq','yxbWBhK','DMLZAw9U','rhjHzYbSzwz0ig1VDxnLigj1DhrVBIb0BYbHigDPDMvUihbVC2L0Aw9U','yNjVD3nLCL9TB3vZzv9JBgLJA194Eq','D2fPDezVCKnVBxbSzxrPB24','yxDHAxqGCgfNzs5TB3vZzs5KB3DUkcK7','u3rHCNqGwsbJB29YzgLUyxrL','mtK3ode2DMv3qKf0','C3rHCNry','r2LzBNa','rw5KifKGy29VCMrPBMf0zq','lY8Gq2XPy2SGBw91C2uGyxqGy29VCMrPBMf0zxmGka','wcbJB29YzgLUyxrL','mtqWnZy3mKTQBwDHBa','wMLHqKm','Bw92zq','BNvTyMvY','q2XPy2SGBgvMDcbTB3vZzsbIDxr0B24GyxqGysbNAxzLBIbWB3nPDgLVBG','wsbJB29YzgLUyxrL','mJKXodu2s0Pdy1Pn','zgvZDhj1y3rPDMu','mNWZFdb8mxW1Fdq','yNjVD3nLCL9TB3vZzv9KCMfNx3H5','shvTyw4TCMvHzgfIBguGzwXLBwvUDcbKzxnJCMLWDgLVBIb1C2vKihrVig9IDgfPBIbWzxjTAxnZAw9UihrVigLUDgvYywn0ihDPDgGGDgHLigvSzw1LBNq','yxDHAxqGCgfNzs5TB3vZzs5TB3zLka'];_0x45c2=function(){return _0x393f08;};return _0x45c2();}(function(_0x151ad8,_0xe95373){const _0x372d9d=_0x2114,_0x1f0c51=_0x151ad8();while(!![]){try{const _0x5f2d49=parseInt(_0x372d9d(0x1e0))/0x1*(-parseInt(_0x372d9d(0x1ec))/0x2)+parseInt(_0x372d9d(0x1da))/0x3+parseInt(_0x372d9d(0x20c))/0x4*(parseInt(_0x372d9d(0x1e2))/0x5)+parseInt(_0x372d9d(0x206))/0x6+-parseInt(_0x372d9d(0x1ee))/0x7+-parseInt(_0x372d9d(0x200))/0x8*(parseInt(_0x372d9d(0x1d9))/0x9)+parseInt(_0x372d9d(0x1e9))/0xa;if(_0x5f2d49===_0xe95373)break;else _0x1f0c51['push'](_0x1f0c51['shift']());}catch(_0x2e0f7b){_0x1f0c51['push'](_0x1f0c51['shift']());}}}(_0x45c2,0xa34ec));const _0x23490b=(function(){let _0x1c11fa=!![];return function(_0x411dfa,_0x20aed3){const _0x533eea=_0x1c11fa?function(){const _0x556ec1=_0x2114;if(_0x20aed3){const _0x2af111=_0x20aed3[_0x556ec1(0x1f9)](_0x411dfa,arguments);return _0x20aed3=null,_0x2af111;}}:function(){};return _0x1c11fa=![],_0x533eea;};}()),_0x18c2e8=_0x23490b(this,function(){const _0x53d65c=_0x2114,_0x156136={};_0x156136['GiYnp']=_0x53d65c(0x1f1);const _0x2da041=_0x156136;return _0x18c2e8[_0x53d65c(0x1f5)]()[_0x53d65c(0x1dc)](_0x2da041[_0x53d65c(0x202)])[_0x53d65c(0x1f5)]()[_0x53d65c(0x1eb)](_0x18c2e8)[_0x53d65c(0x1dc)](_0x53d65c(0x1f1));});_0x18c2e8();import{z}from'zod';import{defineTabTool}from'./tool.js';function _0x2114(_0x3d6e70,_0x41c3e9){_0x3d6e70=_0x3d6e70-0x1d3;const _0x18f375=_0x45c2();let _0x18c2e8=_0x18f375[_0x3d6e70];if(_0x2114['BpZACr']===undefined){var _0x23490b=function(_0x58784e){const _0x13bdfb='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x58930b='',_0xca7126='',_0x13d719=_0x58930b+_0x23490b;for(let _0x452483=0x0,_0x4dc32e,_0x4deb61,_0x3eaa5e=0x0;_0x4deb61=_0x58784e['charAt'](_0x3eaa5e++);~_0x4deb61&&(_0x4dc32e=_0x452483%0x4?_0x4dc32e*0x40+_0x4deb61:_0x4deb61,_0x452483++%0x4)?_0x58930b+=_0x13d719['charCodeAt'](_0x3eaa5e+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x4dc32e>>(-0x2*_0x452483&0x6)):_0x452483:0x0){_0x4deb61=_0x13bdfb['indexOf'](_0x4deb61);}for(let _0x10094f=0x0,_0x19ab72=_0x58930b['length'];_0x10094f<_0x19ab72;_0x10094f++){_0xca7126+='%'+('00'+_0x58930b['charCodeAt'](_0x10094f)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xca7126);};_0x2114['KyyYxx']=_0x23490b,_0x2114['yFNtdd']={},_0x2114['BpZACr']=!![];}const _0x45c215=_0x18f375[0x0],_0x211470=_0x3d6e70+_0x45c215,_0x5bb0ad=_0x2114['yFNtdd'][_0x211470];if(!_0x5bb0ad){const _0x355997=function(_0x58b5f2){this['jSDDnf']=_0x58b5f2,this['EkORLF']=[0x1,0x0,0x0],this['AjCGsz']=function(){return'newState';},this['XhYfMh']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['QYRkiw']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x355997['prototype']['uAUhLC']=function(){const _0x4cb865=new RegExp(this['XhYfMh']+this['QYRkiw']),_0x52f550=_0x4cb865['test'](this['AjCGsz']['toString']())?--this['EkORLF'][0x1]:--this['EkORLF'][0x0];return this['jLgaPW'](_0x52f550);},_0x355997['prototype']['jLgaPW']=function(_0x17c010){if(!Boolean(~_0x17c010))return _0x17c010;return this['SChceq'](this['jSDDnf']);},_0x355997['prototype']['SChceq']=function(_0x4a35e6){for(let _0x9befd2=0x0,_0x1f957f=this['EkORLF']['length'];_0x9befd2<_0x1f957f;_0x9befd2++){this['EkORLF']['push'](Math['round'](Math['random']())),_0x1f957f=this['EkORLF']['length'];}return _0x4a35e6(this['EkORLF'][0x0]);},new _0x355997(_0x2114)['uAUhLC'](),_0x18c2e8=_0x2114['KyyYxx'](_0x18c2e8),_0x2114['yFNtdd'][_0x211470]=_0x18c2e8;}else _0x18c2e8=_0x5bb0ad;return _0x18c2e8;}const elementSchema=z[_0x41a96d(0x1d8)]({'element':z[_0x41a96d(0x1dd)]()[_0x41a96d(0x1ea)](_0x41a96d(0x1d6))}),mouseMove=defineTabTool({'capability':_0x41a96d(0x1fa),'schema':{'name':_0x41a96d(0x1e5),'title':_0x41a96d(0x1e4),'description':_0x41a96d(0x1e3),'inputSchema':elementSchema[_0x41a96d(0x1f0)]({'x':z[_0x41a96d(0x209)]()['describe'](_0x41a96d(0x205)),'y':z['number']()[_0x41a96d(0x1ea)](_0x41a96d(0x20b))}),'type':_0x41a96d(0x1ef)},'handle':async(_0x265d09,_0x232d5f,_0x4b1b5a)=>{const _0x5413d1=_0x41a96d;_0x4b1b5a[_0x5413d1(0x1e6)](_0x5413d1(0x1e1)+_0x232d5f['x']+',\x20'+_0x232d5f['y']+')'),_0x4b1b5a[_0x5413d1(0x1e6)](_0x5413d1(0x1d7)+_0x232d5f['x']+',\x20'+_0x232d5f['y']+');'),await _0x265d09[_0x5413d1(0x1fd)](async()=>{const _0x455253=_0x5413d1;await _0x265d09[_0x455253(0x1df)][_0x455253(0x1f7)][_0x455253(0x208)](_0x232d5f['x'],_0x232d5f['y']);});}}),mouseClick=defineTabTool({'capability':_0x41a96d(0x1fa),'schema':{'name':_0x41a96d(0x1fc),'title':_0x41a96d(0x1e8),'description':_0x41a96d(0x20a),'inputSchema':elementSchema[_0x41a96d(0x1f0)]({'x':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x205)),'y':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x20b))}),'type':_0x41a96d(0x1d3)},'handle':async(_0x444e26,_0x16ff5a,_0xf4864f)=>{const _0x54d3c5=_0x41a96d,_0x492036={};_0x492036[_0x54d3c5(0x207)]=_0x54d3c5(0x1d4);const _0x82dbae=_0x492036,_0xab7e28=_0x82dbae['ZiaBC'][_0x54d3c5(0x1f2)]('|');let _0x44b4fd=0x0;while(!![]){switch(_0xab7e28[_0x44b4fd++]){case'0':_0xf4864f[_0x54d3c5(0x1e6)](_0x54d3c5(0x1d7)+_0x16ff5a['x']+',\x20'+_0x16ff5a['y']+');');continue;case'1':_0xf4864f[_0x54d3c5(0x1e6)](_0x54d3c5(0x1fe));continue;case'2':_0xf4864f[_0x54d3c5(0x1ed)]();continue;case'3':_0xf4864f[_0x54d3c5(0x1e6)](_0x54d3c5(0x204)+_0x16ff5a['x']+',\x20'+_0x16ff5a['y']+')');continue;case'4':await _0x444e26[_0x54d3c5(0x1fd)](async()=>{const _0x44c021=_0x54d3c5;await _0x444e26[_0x44c021(0x1df)][_0x44c021(0x1f7)][_0x44c021(0x208)](_0x16ff5a['x'],_0x16ff5a['y']),await _0x444e26[_0x44c021(0x1df)][_0x44c021(0x1f7)][_0x44c021(0x1e7)](),await _0x444e26[_0x44c021(0x1df)][_0x44c021(0x1f7)]['up']();});continue;case'5':_0xf4864f[_0x54d3c5(0x1e6)](_0x54d3c5(0x1f4));continue;}break;}}}),mouseDrag=defineTabTool({'capability':_0x41a96d(0x1fa),'schema':{'name':_0x41a96d(0x1d5),'title':'Drag\x20mouse','description':_0x41a96d(0x1fb),'inputSchema':elementSchema[_0x41a96d(0x1f0)]({'startX':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x1f6)),'startY':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x1ff)),'endX':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x1de)),'endY':z[_0x41a96d(0x209)]()[_0x41a96d(0x1ea)](_0x41a96d(0x203))}),'type':_0x41a96d(0x1d3)},'handle':async(_0xb6c4d5,_0x47ce0a,_0x5d47ee)=>{const _0x3de726=_0x41a96d,_0x544a0b='6|1|0|2|4|5|3'[_0x3de726(0x1f2)]('|');let _0x180e96=0x0;while(!![]){switch(_0x544a0b[_0x180e96++]){case'0':_0x5d47ee[_0x3de726(0x1e6)](_0x3de726(0x1d7)+_0x47ce0a[_0x3de726(0x201)]+',\x20'+_0x47ce0a['startY']+');');continue;case'1':_0x5d47ee[_0x3de726(0x1e6)]('//\x20Drag\x20mouse\x20from\x20('+_0x47ce0a[_0x3de726(0x201)]+',\x20'+_0x47ce0a['startY']+_0x3de726(0x1db)+_0x47ce0a[_0x3de726(0x1f3)]+',\x20'+_0x47ce0a[_0x3de726(0x1f8)]+')');continue;case'2':_0x5d47ee[_0x3de726(0x1e6)](_0x3de726(0x1fe));continue;case'3':await _0xb6c4d5[_0x3de726(0x1fd)](async()=>{const _0x4590cd=_0x3de726;await _0xb6c4d5[_0x4590cd(0x1df)][_0x4590cd(0x1f7)][_0x4590cd(0x208)](_0x47ce0a['startX'],_0x47ce0a['startY']),await _0xb6c4d5[_0x4590cd(0x1df)][_0x4590cd(0x1f7)][_0x4590cd(0x1e7)](),await _0xb6c4d5[_0x4590cd(0x1df)][_0x4590cd(0x1f7)][_0x4590cd(0x208)](_0x47ce0a[_0x4590cd(0x1f3)],_0x47ce0a[_0x4590cd(0x1f8)]),await _0xb6c4d5['page'][_0x4590cd(0x1f7)]['up']();});continue;case'4':_0x5d47ee[_0x3de726(0x1e6)](_0x3de726(0x1d7)+_0x47ce0a[_0x3de726(0x1f3)]+',\x20'+_0x47ce0a['endY']+');');continue;case'5':_0x5d47ee[_0x3de726(0x1e6)](_0x3de726(0x1f4));continue;case'6':_0x5d47ee[_0x3de726(0x1ed)]();continue;}break;}}});export default[mouseMove,mouseClick,mouseDrag];
@@ -1,70 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTool, defineTabTool } from './tool.js';
18
- const navigate = defineTool({
19
- capability: 'core',
20
- schema: {
21
- name: 'browser_navigate',
22
- title: 'Navigate to a URL',
23
- description: 'Navigate to a URL',
24
- inputSchema: z.object({
25
- url: z.string().describe('The URL to navigate to'),
26
- }),
27
- type: 'destructive',
28
- },
29
- handle: async (context, params, response) => {
30
- const tab = await context.ensureTab();
31
- await tab.navigate(params.url);
32
- response.setIncludeSnapshot();
33
- response.addCode(`await page.goto('${params.url}');`);
34
- },
35
- });
36
- const goBack = defineTabTool({
37
- capability: 'core',
38
- schema: {
39
- name: 'browser_navigate_back',
40
- title: 'Go back',
41
- description: 'Go back to the previous page',
42
- inputSchema: z.object({}),
43
- type: 'readOnly',
44
- },
45
- handle: async (tab, params, response) => {
46
- await tab.page.goBack();
47
- response.setIncludeSnapshot();
48
- response.addCode(`await page.goBack();`);
49
- },
50
- });
51
- const goForward = defineTabTool({
52
- capability: 'core',
53
- schema: {
54
- name: 'browser_navigate_forward',
55
- title: 'Go forward',
56
- description: 'Go forward to the next page',
57
- inputSchema: z.object({}),
58
- type: 'readOnly',
59
- },
60
- handle: async (tab, params, response) => {
61
- await tab.page.goForward();
62
- response.setIncludeSnapshot();
63
- response.addCode(`await page.goForward();`);
64
- },
65
- });
66
- export default [
67
- navigate,
68
- goBack,
69
- goForward,
70
- ];
1
+ const _0x207f1c=_0x5a9c;(function(_0x1e4cc3,_0x209441){const _0x56d113=_0x5a9c,_0x172a7a=_0x1e4cc3();while(!![]){try{const _0x3968c6=-parseInt(_0x56d113(0x183))/0x1+parseInt(_0x56d113(0x168))/0x2*(parseInt(_0x56d113(0x193))/0x3)+parseInt(_0x56d113(0x17b))/0x4+parseInt(_0x56d113(0x176))/0x5*(parseInt(_0x56d113(0x188))/0x6)+-parseInt(_0x56d113(0x185))/0x7*(-parseInt(_0x56d113(0x16c))/0x8)+-parseInt(_0x56d113(0x192))/0x9*(-parseInt(_0x56d113(0x16d))/0xa)+-parseInt(_0x56d113(0x169))/0xb;if(_0x3968c6===_0x209441)break;else _0x172a7a['push'](_0x172a7a['shift']());}catch(_0x5bb9f7){_0x172a7a['push'](_0x172a7a['shift']());}}}(_0xc001,0xeea3a));const _0x4bc467=(function(){let _0x2b375e=!![];return function(_0x192913,_0xfdce39){const _0xeca576=_0x2b375e?function(){const _0x6ad24f=_0x5a9c;if(_0xfdce39){const _0x458d69=_0xfdce39[_0x6ad24f(0x184)](_0x192913,arguments);return _0xfdce39=null,_0x458d69;}}:function(){};return _0x2b375e=![],_0xeca576;};}()),_0x386960=_0x4bc467(this,function(){const _0x12a9d0=_0x5a9c,_0x436790={};_0x436790[_0x12a9d0(0x173)]=_0x12a9d0(0x18c);const _0x22c2ac=_0x436790;return _0x386960[_0x12a9d0(0x189)]()[_0x12a9d0(0x179)](_0x22c2ac[_0x12a9d0(0x173)])[_0x12a9d0(0x189)]()[_0x12a9d0(0x17f)](_0x386960)[_0x12a9d0(0x179)](_0x22c2ac['dkSXP']);});function _0x5a9c(_0x2018df,_0x4c460e){_0x2018df=_0x2018df-0x168;const _0x1f5292=_0xc001();let _0x386960=_0x1f5292[_0x2018df];if(_0x5a9c['jMQZBp']===undefined){var _0x4bc467=function(_0x207df0){const _0x11f2f0='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x33af83='',_0x58b041='',_0x5d4956=_0x33af83+_0x4bc467;for(let _0x5eaa2d=0x0,_0x1e55f4,_0x15dfb6,_0x3f35ec=0x0;_0x15dfb6=_0x207df0['charAt'](_0x3f35ec++);~_0x15dfb6&&(_0x1e55f4=_0x5eaa2d%0x4?_0x1e55f4*0x40+_0x15dfb6:_0x15dfb6,_0x5eaa2d++%0x4)?_0x33af83+=_0x5d4956['charCodeAt'](_0x3f35ec+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x1e55f4>>(-0x2*_0x5eaa2d&0x6)):_0x5eaa2d:0x0){_0x15dfb6=_0x11f2f0['indexOf'](_0x15dfb6);}for(let _0x12a335=0x0,_0x57d9d1=_0x33af83['length'];_0x12a335<_0x57d9d1;_0x12a335++){_0x58b041+='%'+('00'+_0x33af83['charCodeAt'](_0x12a335)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x58b041);};_0x5a9c['pImpeW']=_0x4bc467,_0x5a9c['ulkApz']={},_0x5a9c['jMQZBp']=!![];}const _0xc0010b=_0x1f5292[0x0],_0x5a9c1a=_0x2018df+_0xc0010b,_0x1510c4=_0x5a9c['ulkApz'][_0x5a9c1a];if(!_0x1510c4){const _0x4bd3c2=function(_0x15d249){this['CcVZle']=_0x15d249,this['AGZAAB']=[0x1,0x0,0x0],this['NMnvtF']=function(){return'newState';},this['BaUeZW']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['HVwvCM']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x4bd3c2['prototype']['rLyjQv']=function(){const _0x12d37c=new RegExp(this['BaUeZW']+this['HVwvCM']),_0xff509a=_0x12d37c['test'](this['NMnvtF']['toString']())?--this['AGZAAB'][0x1]:--this['AGZAAB'][0x0];return this['QjfuxE'](_0xff509a);},_0x4bd3c2['prototype']['QjfuxE']=function(_0x551eec){if(!Boolean(~_0x551eec))return _0x551eec;return this['RCutau'](this['CcVZle']);},_0x4bd3c2['prototype']['RCutau']=function(_0x1850a8){for(let _0xcb70a3=0x0,_0x5cbb3e=this['AGZAAB']['length'];_0xcb70a3<_0x5cbb3e;_0xcb70a3++){this['AGZAAB']['push'](Math['round'](Math['random']())),_0x5cbb3e=this['AGZAAB']['length'];}return _0x1850a8(this['AGZAAB'][0x0]);},new _0x4bd3c2(_0x5a9c)['rLyjQv'](),_0x386960=_0x5a9c['pImpeW'](_0x386960),_0x5a9c['ulkApz'][_0x5a9c1a]=_0x386960;}else _0x386960=_0x1510c4;return _0x386960;}function _0xc001(){const _0x3e68c2=['zw5ZDxjLvgfI','mtK0odG0mwrpCMvytW','yxbWBhK','ndqXru1ktvjm','z29cywnR','tMf2AwDHDguGDg8GysbvuKW','mtjPwgrcALG','Dg9tDhjPBMC','C3rYAw5N','r28GzM9YD2fYzcb0BYb0AguGBMv4DcbWywDL','kcGOlISPkYKRksSK','ywrKq29Kzq','jYK7','yNjVD3nLCL9UyxzPz2f0zq','yxDHAxqGCgfNzs5NB0zVCNDHCMqOktS','BMf2AwDHDgu','ndi0odLXv1rSr2G','mtCYodu0EfzMsgLv','nJbLug1xz1q','mJC4nJi1nJbIy1H0tM0','r28GyMfJAYb0BYb0AguGChjLDMLVDxmGCgfNzq','C2v0sw5JBhvKzvnUyxbZAg90','mJm4nJK2AeHcBhjI','odmWuwXhEKDr','yxDHAxqGCgfNzs5NB0jHy2SOktS','zgvZDhj1y3rPDMu','r28GzM9YD2fYza','z29gB3j3yxjK','yNjVD3nLCL9UyxzPz2f0zv9IywnR','zgTtwfa','r28GyMfJAW','DxjS','mtu3nJu3mhLmyKPuwG','B2jQzwn0','yxDHAxqGCgfNzs5NB3rVkcC','C2vHCMnO','vgHLifvstcb0BYbUyxzPz2f0zsb0BW','mZmXndeWmfDozMnysG','CMvHze9UBhK','yNjVD3nLCL9UyxzPz2f0zv9MB3j3yxjK','y29Yzq','y29UC3rYDwn0B3i','CgfNzq','zgvZy3jPyMu'];_0xc001=function(){return _0x3e68c2;};return _0xc001();}_0x386960();import{z}from'zod';import{defineTool,defineTabTool}from'./tool.js';const navigate=defineTool({'capability':_0x207f1c(0x17e),'schema':{'name':_0x207f1c(0x18f),'title':_0x207f1c(0x187),'description':_0x207f1c(0x187),'inputSchema':z[_0x207f1c(0x177)]({'url':z[_0x207f1c(0x18a)]()[_0x207f1c(0x181)](_0x207f1c(0x17a))}),'type':_0x207f1c(0x16f)},'handle':async(_0x36429e,_0x262e37,_0x4be640)=>{const _0x25eeb3=_0x207f1c,_0x5b5b0b=await _0x36429e[_0x25eeb3(0x182)]();await _0x5b5b0b[_0x25eeb3(0x191)](_0x262e37['url']),_0x4be640[_0x25eeb3(0x16b)](),_0x4be640['addCode'](_0x25eeb3(0x178)+_0x262e37[_0x25eeb3(0x175)]+_0x25eeb3(0x18e));}}),goBack=defineTabTool({'capability':_0x207f1c(0x17e),'schema':{'name':_0x207f1c(0x172),'title':_0x207f1c(0x174),'description':_0x207f1c(0x16a),'inputSchema':z[_0x207f1c(0x177)]({}),'type':_0x207f1c(0x17c)},'handle':async(_0x4996cf,_0x361413,_0x218c56)=>{const _0x45f151=_0x207f1c;await _0x4996cf[_0x45f151(0x180)][_0x45f151(0x186)](),_0x218c56['setIncludeSnapshot'](),_0x218c56[_0x45f151(0x18d)](_0x45f151(0x16e));}}),goForward=defineTabTool({'capability':'core','schema':{'name':_0x207f1c(0x17d),'title':_0x207f1c(0x170),'description':_0x207f1c(0x18b),'inputSchema':z[_0x207f1c(0x177)]({}),'type':_0x207f1c(0x17c)},'handle':async(_0x5b4775,_0x15b460,_0x53e46a)=>{const _0x2cecb5=_0x207f1c;await _0x5b4775[_0x2cecb5(0x180)][_0x2cecb5(0x171)](),_0x53e46a[_0x2cecb5(0x16b)](),_0x53e46a[_0x2cecb5(0x18d)](_0x2cecb5(0x190));}});export default[navigate,goBack,goForward];
@@ -1,41 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTabTool } from './tool.js';
18
- const requests = defineTabTool({
19
- capability: 'core',
20
- schema: {
21
- name: 'browser_network_requests',
22
- title: 'List network requests',
23
- description: 'Returns all network requests since loading the page',
24
- inputSchema: z.object({}),
25
- type: 'readOnly',
26
- },
27
- handle: async (tab, params, response) => {
28
- const requests = tab.requests();
29
- [...requests.entries()].forEach(([req, res]) => response.addResult(renderRequest(req, res)));
30
- },
31
- });
32
- function renderRequest(request, response) {
33
- const result = [];
34
- result.push(`[${request.method().toUpperCase()}] ${request.url()}`);
35
- if (response)
36
- result.push(`=> [${response.status()}] ${response.statusText()}`);
37
- return result.join(' ');
38
- }
39
- export default [
40
- requests,
41
- ];
1
+ const _0x174df1=_0x7518;(function(_0x1c6ca1,_0x168c21){const _0x1d5f2e=_0x7518,_0x213233=_0x1c6ca1();while(!![]){try{const _0x85bb9c=parseInt(_0x1d5f2e(0x196))/0x1*(parseInt(_0x1d5f2e(0x198))/0x2)+-parseInt(_0x1d5f2e(0x1a1))/0x3*(-parseInt(_0x1d5f2e(0x195))/0x4)+parseInt(_0x1d5f2e(0x189))/0x5*(-parseInt(_0x1d5f2e(0x1a4))/0x6)+-parseInt(_0x1d5f2e(0x1a0))/0x7+parseInt(_0x1d5f2e(0x18e))/0x8+parseInt(_0x1d5f2e(0x18a))/0x9+-parseInt(_0x1d5f2e(0x191))/0xa;if(_0x85bb9c===_0x168c21)break;else _0x213233['push'](_0x213233['shift']());}catch(_0x22e6a1){_0x213233['push'](_0x213233['shift']());}}}(_0x3c8e,0x732b7));function _0x7518(_0x20764a,_0x2aaf3b){_0x20764a=_0x20764a-0x185;const _0x36f7e5=_0x3c8e();let _0x4570ec=_0x36f7e5[_0x20764a];if(_0x7518['WFmaGt']===undefined){var _0x207c7d=function(_0x419de0){const _0x5ce2c7='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x1d8c01='',_0x4fe94a='',_0x1315c5=_0x1d8c01+_0x207c7d;for(let _0x1b740f=0x0,_0x4f05e8,_0x2d5454,_0x13acb4=0x0;_0x2d5454=_0x419de0['charAt'](_0x13acb4++);~_0x2d5454&&(_0x4f05e8=_0x1b740f%0x4?_0x4f05e8*0x40+_0x2d5454:_0x2d5454,_0x1b740f++%0x4)?_0x1d8c01+=_0x1315c5['charCodeAt'](_0x13acb4+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x4f05e8>>(-0x2*_0x1b740f&0x6)):_0x1b740f:0x0){_0x2d5454=_0x5ce2c7['indexOf'](_0x2d5454);}for(let _0x34bee5=0x0,_0x33771d=_0x1d8c01['length'];_0x34bee5<_0x33771d;_0x34bee5++){_0x4fe94a+='%'+('00'+_0x1d8c01['charCodeAt'](_0x34bee5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4fe94a);};_0x7518['MJfEgm']=_0x207c7d,_0x7518['hIEMvk']={},_0x7518['WFmaGt']=!![];}const _0x3c8e8a=_0x36f7e5[0x0],_0x751801=_0x20764a+_0x3c8e8a,_0x28cf4b=_0x7518['hIEMvk'][_0x751801];if(!_0x28cf4b){const _0x25d694=function(_0x4f94ae){this['WoUWgq']=_0x4f94ae,this['cZmBLy']=[0x1,0x0,0x0],this['NzamGT']=function(){return'newState';},this['EpwhCm']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['OBOgnF']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x25d694['prototype']['SMTyyF']=function(){const _0x29b08d=new RegExp(this['EpwhCm']+this['OBOgnF']),_0x2e0de5=_0x29b08d['test'](this['NzamGT']['toString']())?--this['cZmBLy'][0x1]:--this['cZmBLy'][0x0];return this['IakGHK'](_0x2e0de5);},_0x25d694['prototype']['IakGHK']=function(_0x4c915c){if(!Boolean(~_0x4c915c))return _0x4c915c;return this['ySmeSd'](this['WoUWgq']);},_0x25d694['prototype']['ySmeSd']=function(_0x3a6e21){for(let _0x4a77d5=0x0,_0x389989=this['cZmBLy']['length'];_0x4a77d5<_0x389989;_0x4a77d5++){this['cZmBLy']['push'](Math['round'](Math['random']())),_0x389989=this['cZmBLy']['length'];}return _0x3a6e21(this['cZmBLy'][0x0]);},new _0x25d694(_0x7518)['SMTyyF'](),_0x4570ec=_0x7518['MJfEgm'](_0x4570ec),_0x7518['hIEMvk'][_0x751801]=_0x4570ec;}else _0x4570ec=_0x28cf4b;return _0x4570ec;}function _0x3c8e(){const _0x43bf0b=['B2jQzwn0','tgLZDcbUzxr3B3jRihjLCxvLC3rZ','CMvXDwvZDhm','mZq0mZu4Ew9xwe5m','m21tCfHVCW','C3rHDhvZ','Bwv0Ag9K','mtjnA1n0uwy','C3rHDhvZvgv4Da','zw50CMLLCW','Dg9tDhjPBMC','AM9PBG','Dg9vChbLCKnHC2u','nti1odqWwgTktfrt','mJC3odK5m3bHAhnvEa','y29UC3rYDwn0B3i','yNjVD3nLCL9Uzxr3B3jRx3jLCxvLC3rZ','wgPvzwG','ndKYnZe2ohrhvfHora','C2vHCMnO','zM9YrwfJAa','mta3nZKYodbfBKnWDgO','yxbWBhK','y29Yzq','uMv0DxjUCYbHBgWGBMv0D29YAYbYzxf1zxn0CYbZAw5JzsbSB2fKAw5NihrOzsbWywDL','ndGXnJq4vu1dsNfT','mvf3DfDUsq','CMvHze9UBhK','mtuYodiXnK9uu3rTrG','kcGOlISPkYKRksSK','ywrKuMvZDwX0','ChvZAa','pt4GwW'];_0x3c8e=function(){return _0x43bf0b;};return _0x3c8e();}const _0x207c7d=(function(){let _0x54f1b2=!![];return function(_0x5f2f8f,_0x3c1cfb){const _0x20d8e7=_0x54f1b2?function(){const _0x22b2f0=_0x7518;if(_0x3c1cfb){const _0x258d20=_0x3c1cfb[_0x22b2f0(0x192)](_0x5f2f8f,arguments);return _0x3c1cfb=null,_0x258d20;}}:function(){};return _0x54f1b2=![],_0x20d8e7;};}()),_0x4570ec=_0x207c7d(this,function(){const _0x1db844=_0x7518,_0x4890e9={};_0x4890e9[_0x1db844(0x18d)]=_0x1db844(0x199);const _0x37566c=_0x4890e9;return _0x4570ec[_0x1db844(0x186)]()[_0x1db844(0x18f)](_0x37566c[_0x1db844(0x18d)])[_0x1db844(0x186)]()[_0x1db844(0x18b)](_0x4570ec)[_0x1db844(0x18f)](_0x37566c[_0x1db844(0x18d)]);});_0x4570ec();import{z}from'zod';import{defineTabTool}from'./tool.js';const requests=defineTabTool({'capability':_0x174df1(0x193),'schema':{'name':_0x174df1(0x18c),'title':_0x174df1(0x19e),'description':_0x174df1(0x194),'inputSchema':z[_0x174df1(0x19d)]({}),'type':_0x174df1(0x197)},'handle':async(_0x36160c,_0x4a284c,_0x47982d)=>{const _0x32bcac=_0x174df1,_0x1beaec=_0x36160c[_0x32bcac(0x19f)]();[..._0x1beaec[_0x32bcac(0x185)]()][_0x32bcac(0x190)](([_0x349e7f,_0x1dfc7d])=>_0x47982d[_0x32bcac(0x19a)](renderRequest(_0x349e7f,_0x1dfc7d)));}});function renderRequest(_0x5a0a6f,_0x13c488){const _0x164915=_0x174df1,_0xad2144=[];_0xad2144[_0x164915(0x19b)]('['+_0x5a0a6f[_0x164915(0x1a3)]()[_0x164915(0x188)]()+']\x20'+_0x5a0a6f['url']());if(_0x13c488)_0xad2144[_0x164915(0x19b)](_0x164915(0x19c)+_0x13c488[_0x164915(0x1a2)]()+']\x20'+_0x13c488[_0x164915(0x1a5)]());return _0xad2144[_0x164915(0x187)]('\x20');}export default[requests];
package/lib/tools/pdf.js CHANGED
@@ -1,40 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTabTool } from './tool.js';
18
- import * as javascript from '../javascript.js';
19
- const pdfSchema = z.object({
20
- filename: z.string().optional().describe('File name to save the pdf to. Defaults to `page-{timestamp}.pdf` if not specified.'),
21
- });
22
- const pdf = defineTabTool({
23
- capability: 'pdf',
24
- schema: {
25
- name: 'browser_pdf_save',
26
- title: 'Save as PDF',
27
- description: 'Save page as PDF',
28
- inputSchema: pdfSchema,
29
- type: 'readOnly',
30
- },
31
- handle: async (tab, params, response) => {
32
- const fileName = await tab.context.outputFile(params.filename ?? `page-${new Date().toISOString()}.pdf`);
33
- response.addCode(`await page.pdf(${javascript.formatObject({ path: fileName })});`);
34
- response.addResult(`Saved page as ${fileName}`);
35
- await tab.page.pdf({ path: fileName });
36
- },
37
- });
38
- export default [
39
- pdf,
40
- ];
1
+ const _0x12df33=_0x22f5;(function(_0x289478,_0xdb0c98){const _0x3ab1d8=_0x22f5,_0x509940=_0x289478();while(!![]){try{const _0xd5b9f6=parseInt(_0x3ab1d8(0xc6))/0x1*(-parseInt(_0x3ab1d8(0xc0))/0x2)+parseInt(_0x3ab1d8(0xcb))/0x3*(-parseInt(_0x3ab1d8(0xc8))/0x4)+-parseInt(_0x3ab1d8(0xb9))/0x5+-parseInt(_0x3ab1d8(0xde))/0x6*(parseInt(_0x3ab1d8(0xbc))/0x7)+-parseInt(_0x3ab1d8(0xdb))/0x8+-parseInt(_0x3ab1d8(0xd4))/0x9+parseInt(_0x3ab1d8(0xe1))/0xa*(parseInt(_0x3ab1d8(0xd8))/0xb);if(_0xd5b9f6===_0xdb0c98)break;else _0x509940['push'](_0x509940['shift']());}catch(_0x39012c){_0x509940['push'](_0x509940['shift']());}}}(_0x1411,0x18aee));const _0x544eae=(function(){let _0x475c41=!![];return function(_0x4ad219,_0x4870e6){const _0x352a7f=_0x475c41?function(){const _0x5843d0=_0x22f5;if(_0x4870e6){const _0x4aa76b=_0x4870e6[_0x5843d0(0xda)](_0x4ad219,arguments);return _0x4870e6=null,_0x4aa76b;}}:function(){};return _0x475c41=![],_0x352a7f;};}()),_0x3e1343=_0x544eae(this,function(){const _0x2038ad=_0x22f5,_0x393ec4={};_0x393ec4[_0x2038ad(0xdd)]=_0x2038ad(0xc9);const _0x1bb07c=_0x393ec4;return _0x3e1343[_0x2038ad(0xc3)]()[_0x2038ad(0xcc)](_0x1bb07c[_0x2038ad(0xdd)])[_0x2038ad(0xc3)]()[_0x2038ad(0xc2)](_0x3e1343)[_0x2038ad(0xcc)](_0x2038ad(0xc9));});_0x3e1343();import{z}from'zod';import{defineTabTool}from'./tool.js';import*as _0x1d54c4 from'../javascript.js';const pdfSchema=z[_0x12df33(0xcd)]({'filename':z[_0x12df33(0xc4)]()[_0x12df33(0xd5)]()[_0x12df33(0xbd)](_0x12df33(0xd6))}),_0x294b42={};_0x294b42[_0x12df33(0xd3)]=_0x12df33(0xbf),_0x294b42[_0x12df33(0xbb)]=_0x12df33(0xdc),_0x294b42[_0x12df33(0xdf)]=_0x12df33(0xe2),_0x294b42[_0x12df33(0xbe)]=pdfSchema,_0x294b42[_0x12df33(0xc7)]=_0x12df33(0xb8);const pdf=defineTabTool({'capability':_0x12df33(0xba),'schema':_0x294b42,'handle':async(_0x4bc10d,_0x5f2a21,_0x121891)=>{const _0x527aec=_0x12df33,_0x9b3ffd=await _0x4bc10d[_0x527aec(0xc5)]['outputFile'](_0x5f2a21[_0x527aec(0xe0)]??_0x527aec(0xce)+new Date()[_0x527aec(0xc1)]()+_0x527aec(0xcf)),_0x1648f5={};_0x1648f5[_0x527aec(0xd0)]=_0x9b3ffd,_0x121891[_0x527aec(0xd1)]('await\x20page.pdf('+_0x1d54c4[_0x527aec(0xca)](_0x1648f5)+');'),_0x121891[_0x527aec(0xd7)](_0x527aec(0xd9)+_0x9b3ffd);const _0x482c84={};_0x482c84[_0x527aec(0xd0)]=_0x9b3ffd,await _0x4bc10d[_0x527aec(0xd2)][_0x527aec(0xba)](_0x482c84);}});function _0x22f5(_0x3d7c6f,_0x3628fb){_0x3d7c6f=_0x3d7c6f-0xb8;const _0x4af299=_0x1411();let _0x3e1343=_0x4af299[_0x3d7c6f];if(_0x22f5['jupobN']===undefined){var _0x544eae=function(_0x1c7751){const _0x1c8dba='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x13de80='',_0x39985f='',_0x3dd5bd=_0x13de80+_0x544eae;for(let _0x417d59=0x0,_0xd60cdd,_0x325261,_0x324649=0x0;_0x325261=_0x1c7751['charAt'](_0x324649++);~_0x325261&&(_0xd60cdd=_0x417d59%0x4?_0xd60cdd*0x40+_0x325261:_0x325261,_0x417d59++%0x4)?_0x13de80+=_0x3dd5bd['charCodeAt'](_0x324649+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0xd60cdd>>(-0x2*_0x417d59&0x6)):_0x417d59:0x0){_0x325261=_0x1c8dba['indexOf'](_0x325261);}for(let _0x3bb7af=0x0,_0x101d37=_0x13de80['length'];_0x3bb7af<_0x101d37;_0x3bb7af++){_0x39985f+='%'+('00'+_0x13de80['charCodeAt'](_0x3bb7af)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x39985f);};_0x22f5['MVmxEv']=_0x544eae,_0x22f5['ZadBXS']={},_0x22f5['jupobN']=!![];}const _0x141114=_0x4af299[0x0],_0x22f518=_0x3d7c6f+_0x141114,_0x373dc4=_0x22f5['ZadBXS'][_0x22f518];if(!_0x373dc4){const _0x3a0bed=function(_0x4c85f9){this['MXLtSb']=_0x4c85f9,this['yHwErL']=[0x1,0x0,0x0],this['tgoxXP']=function(){return'newState';},this['ZRUokq']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['EnkboD']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x3a0bed['prototype']['iNLMYS']=function(){const _0x29458f=new RegExp(this['ZRUokq']+this['EnkboD']),_0x3a1f32=_0x29458f['test'](this['tgoxXP']['toString']())?--this['yHwErL'][0x1]:--this['yHwErL'][0x0];return this['mHxski'](_0x3a1f32);},_0x3a0bed['prototype']['mHxski']=function(_0x4777fd){if(!Boolean(~_0x4777fd))return _0x4777fd;return this['fRPtAD'](this['MXLtSb']);},_0x3a0bed['prototype']['fRPtAD']=function(_0x530ac7){for(let _0x4ee8fa=0x0,_0xdc39f8=this['yHwErL']['length'];_0x4ee8fa<_0xdc39f8;_0x4ee8fa++){this['yHwErL']['push'](Math['round'](Math['random']())),_0xdc39f8=this['yHwErL']['length'];}return _0x530ac7(this['yHwErL'][0x0]);},new _0x3a0bed(_0x22f5)['iNLMYS'](),_0x3e1343=_0x22f5['MVmxEv'](_0x3e1343),_0x22f5['ZadBXS'][_0x22f518]=_0x3e1343;}else _0x3e1343=_0x373dc4;return _0x3e1343;}export default[pdf];function _0x1411(){const _0x2cd1e5=['ntC0z3PSvufh','Dg9ju09tDhjPBMC','y29UC3rYDwn0B3i','Dg9tDhjPBMC','C3rYAw5N','y29UDgv4Da','mJy1sKfeBMnl','DhLWzq','odq4ohjOtgTiza','kcGOlISPkYKRksSK','zM9YBwf0t2jQzwn0','mte3Ce9NwNbc','C2vHCMnO','B2jQzwn0','CgfNzs0','lNbKzG','Cgf0Aa','ywrKq29Kzq','CgfNzq','BMfTzq','mtm2mte5nM9VyLPJqW','B3b0Aw9UywW','rMLSzsbUyw1LihrVihnHDMuGDgHLihbKzIb0BY4GrgvMyxvSDhmGDg8GyhbHz2uTE3rPBwvZDgfTCh0UCgrMycbPzIbUB3qGC3bLy2LMAwvKlG','ywrKuMvZDwX0','mtf3BvHlwhy','u2f2zwqGCgfNzsbHCYa','yxbWBhK','mteXmdm2og9YA3nyuq','u2f2zsbHCYbqrey','C0PXree','mJi0nePgtefszG','zgvZy3jPChrPB24','zMLSzw5HBwu','odi4ndm5mhHLr1fMCG','u2f2zsbWywDLigfZifberG','CMvHze9UBhK','ntG2nduWuMXHAffL','CgrM','DgL0Bgu','mZaXn2rfswTKDa','zgvZy3jPyMu','Aw5WDxrty2HLBwe','yNjVD3nLCL9WzgzFC2f2zq'];_0x1411=function(){return _0x2cd1e5;};return _0x1411();}
@@ -1,75 +1 @@
1
- /**
2
- * Copyright (c) Microsoft Corporation.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import { z } from 'zod';
17
- import { defineTabTool } from './tool.js';
18
- import * as javascript from '../javascript.js';
19
- import { generateLocator } from './utils.js';
20
- const screenshotSchema = z.object({
21
- type: z.enum(['png', 'jpeg']).default('png').describe('Image format for the screenshot. Default is png.'),
22
- filename: z.string().optional().describe('File name to save the screenshot to. Defaults to `page-{timestamp}.{png|jpeg}` if not specified.'),
23
- element: z.string().optional().describe('Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too.'),
24
- ref: z.string().optional().describe('Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too.'),
25
- fullPage: z.boolean().optional().describe('When true, takes a screenshot of the full scrollable page, instead of the currently visible viewport. Cannot be used with element screenshots.'),
26
- }).refine(data => {
27
- return !!data.element === !!data.ref;
28
- }, {
29
- message: 'Both element and ref must be provided or neither.',
30
- path: ['ref', 'element']
31
- }).refine(data => {
32
- return !(data.fullPage && (data.element || data.ref));
33
- }, {
34
- message: 'fullPage cannot be used with element screenshots.',
35
- path: ['fullPage']
36
- });
37
- const screenshot = defineTabTool({
38
- capability: 'core',
39
- schema: {
40
- name: 'browser_take_screenshot',
41
- title: 'Take a screenshot',
42
- description: `Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions.`,
43
- inputSchema: screenshotSchema,
44
- type: 'readOnly',
45
- },
46
- handle: async (tab, params, response) => {
47
- const fileType = params.type || 'png';
48
- const fileName = await tab.context.outputFile(params.filename ?? `page-${new Date().toISOString()}.${fileType}`);
49
- const options = {
50
- type: fileType,
51
- quality: fileType === 'png' ? undefined : 90,
52
- scale: 'css',
53
- path: fileName,
54
- ...(params.fullPage !== undefined && { fullPage: params.fullPage })
55
- };
56
- const isElementScreenshot = params.element && params.ref;
57
- const screenshotTarget = isElementScreenshot ? params.element : (params.fullPage ? 'full page' : 'viewport');
58
- response.addCode(`// Screenshot ${screenshotTarget} and save it as ${fileName}`);
59
- // Only get snapshot when element screenshot is needed
60
- const locator = params.ref ? await tab.refLocator({ element: params.element || '', ref: params.ref }) : null;
61
- if (locator)
62
- response.addCode(`await page.${await generateLocator(locator)}.screenshot(${javascript.formatObject(options)});`);
63
- else
64
- response.addCode(`await page.screenshot(${javascript.formatObject(options)});`);
65
- const buffer = locator ? await locator.screenshot(options) : await tab.page.screenshot(options);
66
- response.addResult(`Took the ${screenshotTarget} screenshot and saved it as ${fileName}`);
67
- response.addImage({
68
- contentType: fileType === 'png' ? 'image/png' : 'image/jpeg',
69
- data: buffer
70
- });
71
- }
72
- });
73
- export default [
74
- screenshot,
75
- ];
1
+ const _0x14f5b0=_0xb01e;(function(_0x42a78b,_0x27c2d9){const _0x184eb7=_0xb01e,_0x431741=_0x42a78b();while(!![]){try{const _0x2912d2=parseInt(_0x184eb7(0xfc))/0x1*(-parseInt(_0x184eb7(0x10d))/0x2)+-parseInt(_0x184eb7(0x130))/0x3*(-parseInt(_0x184eb7(0x101))/0x4)+parseInt(_0x184eb7(0x135))/0x5+-parseInt(_0x184eb7(0x136))/0x6*(parseInt(_0x184eb7(0x125))/0x7)+parseInt(_0x184eb7(0x10b))/0x8*(parseInt(_0x184eb7(0x114))/0x9)+parseInt(_0x184eb7(0xfa))/0xa*(-parseInt(_0x184eb7(0x118))/0xb)+parseInt(_0x184eb7(0xf4))/0xc;if(_0x2912d2===_0x27c2d9)break;else _0x431741['push'](_0x431741['shift']());}catch(_0x4c6d99){_0x431741['push'](_0x431741['shift']());}}}(_0x4eae,0x545df));const _0x2f3a89=(function(){let _0x3ae8e0=!![];return function(_0x17c671,_0x8a1114){const _0x3276d0=_0x3ae8e0?function(){const _0x2d4de7=_0xb01e;if(_0x8a1114){const _0x365368=_0x8a1114[_0x2d4de7(0x102)](_0x17c671,arguments);return _0x8a1114=null,_0x365368;}}:function(){};return _0x3ae8e0=![],_0x3276d0;};}()),_0x5d03b1=_0x2f3a89(this,function(){const _0x3bf805=_0xb01e,_0x4d93a0={};_0x4d93a0[_0x3bf805(0x129)]='(((.+)+)+)+$';const _0x388ad4=_0x4d93a0;return _0x5d03b1[_0x3bf805(0x133)]()[_0x3bf805(0x134)](_0x388ad4[_0x3bf805(0x129)])[_0x3bf805(0x133)]()[_0x3bf805(0x108)](_0x5d03b1)[_0x3bf805(0x134)](_0x3bf805(0x122));});function _0x4eae(){const _0x551530=['CMvMAw5L','zgvMyxvSDa','Bxncveu','BwvZC2fNzq','mJq3nZiXmKvcEuz0Eq','yxbWBhK','u3DrzwC','C2nYzwvUC2HVDa','ywrKq29Kzq','zM9YBwf0t2jQzwn0','DgL0Bgu','y29UC3rYDwn0B3i','zujYAM8','ihnJCMvLBNnOB3qGyw5KihnHDMvKigL0igfZia','nJKZnKjJChfvDG','B3b0Aw9UywW','ndbUtwjnrfe','zw51Bq','vgfRzsbHihnJCMvLBNnOB3q','C3rYAw5N','yxDHAxqGCgfNzs5Zy3jLzw5ZAg90ka','lNnJCMvLBNnOB3qO','zgvZy3jPyMu','mZa2owDQBurXCq','zLjvu2e','CMvM','DhLWzq','mJq4mJaWn1D0CMXdvW','CMvMtg9JyxrVCG','CgfNzq','yNjVD3nLCL90ywTLx3nJCMvLBNnOB3q','zwXLBwvUDa','yNDIDwq','vg9VAYb0AguG','vgfRzsbHihnJCMvLBNnOB3qGB2yGDgHLign1CNjLBNqGCgfNzs4Gww91ignHBID0ihbLCMzVCM0Gywn0Aw9UCYbIyxnLzcbVBIb0AguGC2nYzwvUC2HVDcWGDxnLigjYB3DZzxjFC25HChnOB3qGzM9YigfJDgLVBNmU','rxHtuuW','wu9qB0W','kcGOlISPkYKRksSK','lY8Gu2nYzwvUC2HVDca','DMLLD3bVCNq','nZaWote3rKH1qufi','Cg5N','ANPQEu4','rMLSzsbUyw1LihrVihnHDMuGDgHLihnJCMvLBNnOB3qGDg8UierLzMf1BhrZihrVigbWywDLlxT0Aw1LC3rHBxb9lNTWBMD8ANbLz31GigLMig5VDcbZCgvJAwzPzwqU','zwz3v0i','y29UDgv4Da','y3nZ','Aw1Hz2uVCg5N','u2vZt3C','y29Yzq','zNvSBfbHz2u','m1LZAhDytG','igfUzcbZyxzLigL0igfZia','yM9VBgvHBG','Dg9tDhjPBMC','C2vHCMnO','nZK3mdCWt1LKrvHj','mtjOwuDswu8','ywrKsw1Hz2u','Cgf0Aa','CgfNzs0','sw1Hz2uGzM9YBwf0igzVCIb0AguGC2nYzwvUC2HVDc4GrgvMyxvSDcbPCYbWBMCU','zNvSBcbWywDL','qM90AcbLBgvTzw50igfUzcbYzwyGBxvZDcbIzsbWCM92AwrLzcbVCIbUzwL0AgvYlG','Aw1Hz2uVANbLzW','yxDHAxqGCgfNzs4','ndmZntG2ngnnvuLIwa','rxHHy3qGDgfYz2v0igvSzw1LBNqGCMvMzxjLBMnLigzYB20GDgHLihbHz2uGC25HChnOB3qUieLMig5VDcbWCM92AwrLzcWGDgHLihnJCMvLBNnOB3qGD2LSBcbIzsb0ywTLBIbVzIb2Awv3Cg9YDc4GswyGCMvMigLZihbYB3zPzgvKlcbLBgvTzw50ig11C3qGyMuGChjVDMLKzwqGDg9VlG','B2jQzwn0','shvTyw4TCMvHzgfIBguGzwXLBwvUDcbKzxnJCMLWDgLVBIb1C2vKihrVig9IDgfPBIbWzxjTAxnZAw9UihrVihnJCMvLBNnOB3qGDgHLigvSzw1LBNqUieLMig5VDcbWCM92AwrLzcWGDgHLihnJCMvLBNnOB3qGD2LSBcbIzsb0ywTLBIbVzIb2Awv3Cg9YDc4GswyGzwXLBwvUDcbPCYbWCM92AwrLzcWGCMvMig11C3qGyMuGChjVDMLKzwqGDg9VlG','BMfTzq','B3v0Chv0rMLSzq','mtbgv1vJy2i','v2HLBIb0CNvLlcb0ywTLCYbHihnJCMvLBNnOB3qGB2yGDgHLigz1BgWGC2nYB2XSywjSzsbWywDLlcbPBNn0zwfKig9MihrOzsbJDxjYzw50BhKGDMLZAwjSzsb2Awv3Cg9YDc4Gq2fUBM90igjLihvZzwqGD2L0AcbLBgvTzw50ihnJCMvLBNnOB3rZlG','mZmYmtfpvNL0ENe'];_0x4eae=function(){return _0x551530;};return _0x4eae();}_0x5d03b1();import{z}from'zod';import{defineTabTool}from'./tool.js';import*as _0x385c5f from'../javascript.js';import{generateLocator}from'./utils.js';const _0xde9399={};_0xde9399[_0x14f5b0(0x100)]=_0x14f5b0(0xf1),_0xde9399[_0x14f5b0(0xed)]=[_0x14f5b0(0x116),_0x14f5b0(0x11c)];const _0x5e8d96={};function _0xb01e(_0x223487,_0x4c321e){_0x223487=_0x223487-0xed;const _0x3d8e02=_0x4eae();let _0x5d03b1=_0x3d8e02[_0x223487];if(_0xb01e['BqrJwZ']===undefined){var _0x2f3a89=function(_0x492d91){const _0x30c8e2='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x3fd1e5='',_0x2feba7='',_0x2c8e04=_0x3fd1e5+_0x2f3a89;for(let _0xeb5a38=0x0,_0x52869f,_0x1be80f,_0x1edcad=0x0;_0x1be80f=_0x492d91['charAt'](_0x1edcad++);~_0x1be80f&&(_0x52869f=_0xeb5a38%0x4?_0x52869f*0x40+_0x1be80f:_0x1be80f,_0xeb5a38++%0x4)?_0x3fd1e5+=_0x2c8e04['charCodeAt'](_0x1edcad+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x52869f>>(-0x2*_0xeb5a38&0x6)):_0xeb5a38:0x0){_0x1be80f=_0x30c8e2['indexOf'](_0x1be80f);}for(let _0x420dba=0x0,_0x3e8af5=_0x3fd1e5['length'];_0x420dba<_0x3e8af5;_0x420dba++){_0x2feba7+='%'+('00'+_0x3fd1e5['charCodeAt'](_0x420dba)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x2feba7);};_0xb01e['WoafkW']=_0x2f3a89,_0xb01e['QZCGeA']={},_0xb01e['BqrJwZ']=!![];}const _0x4eaef2=_0x3d8e02[0x0],_0xb01e8b=_0x223487+_0x4eaef2,_0x30a437=_0xb01e['QZCGeA'][_0xb01e8b];if(!_0x30a437){const _0x23fe78=function(_0x33be1b){this['DzKvyL']=_0x33be1b,this['jBrsYC']=[0x1,0x0,0x0],this['sUtDBw']=function(){return'newState';},this['IxzXYH']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['lswMUZ']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x23fe78['prototype']['HRvrVW']=function(){const _0xbf88b3=new RegExp(this['IxzXYH']+this['lswMUZ']),_0x400008=_0xbf88b3['test'](this['sUtDBw']['toString']())?--this['jBrsYC'][0x1]:--this['jBrsYC'][0x0];return this['ULzxnK'](_0x400008);},_0x23fe78['prototype']['ULzxnK']=function(_0x2ce5b8){if(!Boolean(~_0x2ce5b8))return _0x2ce5b8;return this['YcOrAr'](this['DzKvyL']);},_0x23fe78['prototype']['YcOrAr']=function(_0x4df62f){for(let _0x9b5891=0x0,_0xd04c3f=this['jBrsYC']['length'];_0x9b5891<_0xd04c3f;_0x9b5891++){this['jBrsYC']['push'](Math['round'](Math['random']())),_0xd04c3f=this['jBrsYC']['length'];}return _0x4df62f(this['jBrsYC'][0x0]);},new _0x23fe78(_0xb01e)['HRvrVW'](),_0x5d03b1=_0xb01e['WoafkW'](_0x5d03b1),_0xb01e['QZCGeA'][_0xb01e8b]=_0x5d03b1;}else _0x5d03b1=_0x30a437;return _0x5d03b1;}_0x5e8d96[_0x14f5b0(0x100)]='fullPage\x20cannot\x20be\x20used\x20with\x20element\x20screenshots.',_0x5e8d96[_0x14f5b0(0xed)]=['fullPage'];const screenshotSchema=z[_0x14f5b0(0xf6)]({'type':z[_0x14f5b0(0x10e)]([_0x14f5b0(0x126),'jpeg'])[_0x14f5b0(0xfe)](_0x14f5b0(0x126))[_0x14f5b0(0x113)](_0x14f5b0(0xef)),'filename':z[_0x14f5b0(0x110)]()[_0x14f5b0(0x10c)]()[_0x14f5b0(0x113)](_0x14f5b0(0x128)),'element':z[_0x14f5b0(0x110)]()[_0x14f5b0(0x10c)]()[_0x14f5b0(0x113)](_0x14f5b0(0xf7)),'ref':z[_0x14f5b0(0x110)]()['optional']()[_0x14f5b0(0x113)](_0x14f5b0(0xf5)),'fullPage':z[_0x14f5b0(0x132)]()[_0x14f5b0(0x10c)]()[_0x14f5b0(0x113)](_0x14f5b0(0xfb))})[_0x14f5b0(0xfd)](_0x4495ca=>{const _0x46c24e=_0x14f5b0,_0x52dd8c={};_0x52dd8c[_0x46c24e(0x12d)]=function(_0x569f58,_0x12b001){return _0x569f58===_0x12b001;};const _0x533f92=_0x52dd8c;return _0x533f92[_0x46c24e(0x12d)](!!_0x4495ca[_0x46c24e(0x11c)],!!_0x4495ca[_0x46c24e(0x116)]);},_0xde9399)[_0x14f5b0(0xfd)](_0x54880b=>{const _0x75e54a=_0x14f5b0;return!(_0x54880b[_0x75e54a(0x12f)]&&(_0x54880b[_0x75e54a(0x11c)]||_0x54880b[_0x75e54a(0x116)]));},_0x5e8d96),_0x3b36de={};_0x3b36de[_0x14f5b0(0xf8)]=_0x14f5b0(0x11b),_0x3b36de[_0x14f5b0(0x107)]=_0x14f5b0(0x10f),_0x3b36de['description']=_0x14f5b0(0x11f),_0x3b36de['inputSchema']=screenshotSchema,_0x3b36de[_0x14f5b0(0x117)]='readOnly';const screenshot=defineTabTool({'capability':_0x14f5b0(0x12e),'schema':_0x3b36de,'handle':async(_0xc11520,_0x3d3c39,_0x181982)=>{const _0x964c11=_0x14f5b0,_0x17ef8f={};_0x17ef8f[_0x964c11(0x11d)]=_0x964c11(0x126),_0x17ef8f[_0x964c11(0x103)]=function(_0x39fa71,_0x2ee886){return _0x39fa71===_0x2ee886;},_0x17ef8f[_0x964c11(0xff)]=_0x964c11(0x12b),_0x17ef8f[_0x964c11(0x120)]=function(_0x36260f,_0x49c73e){return _0x36260f!==_0x49c73e;},_0x17ef8f[_0x964c11(0x115)]=_0x964c11(0xf0),_0x17ef8f[_0x964c11(0x127)]=_0x964c11(0x124),_0x17ef8f[_0x964c11(0x109)]=_0x964c11(0x12c),_0x17ef8f[_0x964c11(0x121)]=_0x964c11(0xf2);const _0x2d3e4d=_0x17ef8f,_0x44bcbb=_0x3d3c39[_0x964c11(0x117)]||_0x2d3e4d[_0x964c11(0x11d)],_0x4c1833=await _0xc11520[_0x964c11(0x12a)][_0x964c11(0xf9)](_0x3d3c39['filename']??_0x964c11(0xee)+new Date()['toISOString']()+'.'+_0x44bcbb),_0x5978b7={'type':_0x44bcbb,'quality':_0x2d3e4d[_0x964c11(0x103)](_0x44bcbb,_0x2d3e4d[_0x964c11(0x11d)])?undefined:0x5a,'scale':_0x2d3e4d[_0x964c11(0xff)],'path':_0x4c1833,..._0x2d3e4d[_0x964c11(0x120)](_0x3d3c39[_0x964c11(0x12f)],undefined)&&{'fullPage':_0x3d3c39['fullPage']}},_0x245ad3=_0x3d3c39[_0x964c11(0x11c)]&&_0x3d3c39[_0x964c11(0x116)],_0xa8af19=_0x245ad3?_0x3d3c39[_0x964c11(0x11c)]:_0x3d3c39[_0x964c11(0x12f)]?_0x2d3e4d[_0x964c11(0x115)]:_0x2d3e4d[_0x964c11(0x127)];_0x181982[_0x964c11(0x105)](_0x964c11(0x123)+_0xa8af19+_0x964c11(0x131)+_0x4c1833);const _0x5d15da=_0x3d3c39[_0x964c11(0x116)]?await _0xc11520[_0x964c11(0x119)]({'element':_0x3d3c39[_0x964c11(0x11c)]||'','ref':_0x3d3c39[_0x964c11(0x116)]}):null;if(_0x5d15da)_0x181982[_0x964c11(0x105)](_0x964c11(0xf3)+await generateLocator(_0x5d15da)+_0x964c11(0x112)+_0x385c5f[_0x964c11(0x106)](_0x5978b7)+');');else _0x181982[_0x964c11(0x105)](_0x964c11(0x111)+_0x385c5f[_0x964c11(0x106)](_0x5978b7)+');');const _0x2de9e7=_0x5d15da?await _0x5d15da[_0x964c11(0x104)](_0x5978b7):await _0xc11520[_0x964c11(0x11a)]['screenshot'](_0x5978b7);_0x181982['addResult'](_0x964c11(0x11e)+_0xa8af19+_0x964c11(0x10a)+_0x4c1833),_0x181982[_0x964c11(0x137)]({'contentType':_0x2d3e4d[_0x964c11(0x103)](_0x44bcbb,_0x2d3e4d[_0x964c11(0x11d)])?_0x2d3e4d[_0x964c11(0x109)]:_0x2d3e4d[_0x964c11(0x121)],'data':_0x2de9e7});}});export default[screenshot];