@eko-ai/eko 1.0.2 → 1.0.3

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.
@@ -1,7 +1,15 @@
1
1
  declare const eko: any;
2
- declare function key(request: any): any;
3
- declare function type(request: any): any;
2
+ declare function type(request: any): boolean;
4
3
  declare function mouse_move(request: any): boolean;
5
4
  declare function simulateMouseEvent(request: any, eventTypes: Array<string>, button: 0 | 1 | 2): boolean;
6
- declare function scroll_to(request: any): void;
7
- declare function left_click_drag(request: any, steps?: number): boolean;
5
+ declare function scroll_to(request: any): boolean;
6
+ declare function get_dropdown_options(request: any): {
7
+ options: {
8
+ index: any;
9
+ text: any;
10
+ value: any;
11
+ }[];
12
+ id: any;
13
+ name: any;
14
+ } | null;
15
+ declare function select_dropdown_option(request: any): any;
@@ -3,5 +3,3 @@ import * as utils from './utils';
3
3
  export { utils };
4
4
  import * as tools from './tools';
5
5
  export { tools };
6
- import * as browser from './tools/browser';
7
- export { browser };
@@ -6,9 +6,7 @@
6
6
  * @returns { element_str, selector_map }
7
7
  */
8
8
  declare function get_clickable_elements(doHighlightElements: any | undefined, includeAttributes: any): string;
9
- /**
10
- * Remove highlight
11
- */
9
+ declare function get_highlight_element(highlightIndex: any): any;
12
10
  declare function remove_highlight(): void;
13
11
  declare function clickable_elements_to_string(element_tree: any, includeAttributes: any): string;
14
12
  declare function create_selector_map(element_tree: any): {};
@@ -6,6 +6,7 @@
6
6
  * @returns { element_str, selector_map }
7
7
  */
8
8
  function get_clickable_elements(doHighlightElements = true, includeAttributes) {
9
+ window.clickable_elements = {};
9
10
  let page_tree = build_dom_tree(doHighlightElements);
10
11
  let element_tree = parse_node(page_tree);
11
12
  let selector_map = create_selector_map(element_tree);
@@ -13,9 +14,10 @@ function get_clickable_elements(doHighlightElements = true, includeAttributes) {
13
14
  return { element_str, selector_map };
14
15
  }
15
16
 
16
- /**
17
- * Remove highlight
18
- */
17
+ function get_highlight_element(highlightIndex) {
18
+ return window.clickable_elements[highlightIndex];
19
+ }
20
+
19
21
  function remove_highlight() {
20
22
  let highlight = document.getElementById('playwright-highlight-container');
21
23
  if (highlight) {
@@ -604,6 +606,7 @@ function build_dom_tree(doHighlightElements) {
604
606
  // Highlight if element meets all criteria and highlighting is enabled
605
607
  if (isInteractive && isVisible && isTop) {
606
608
  nodeData.highlightIndex = highlightIndex++;
609
+ window.clickable_elements[nodeData.highlightIndex] = node;
607
610
  if (doHighlightElements) {
608
611
  highlightElement(node, nodeData.highlightIndex, parentIframe);
609
612
  }
@@ -654,4 +657,5 @@ function build_dom_tree(doHighlightElements) {
654
657
  }
655
658
 
656
659
  window.get_clickable_elements = get_clickable_elements;
660
+ window.get_highlight_element = get_highlight_element;
657
661
  window.remove_highlight = remove_highlight;
@@ -1,20 +1,20 @@
1
1
  import { ScreenshotResult } from '../../types/tools.types';
2
- export declare function key(tabId: number, key: string, coordinate?: [number, number]): Promise<any>;
3
2
  export declare function type(tabId: number, text: string, coordinate?: [number, number]): Promise<any>;
4
- export declare function type_by_xpath(tabId: number, text: string, xpath: string): Promise<any>;
3
+ export declare function type_by(tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
5
4
  export declare function clear_input(tabId: number, coordinate?: [number, number]): Promise<any>;
6
- export declare function clear_input_by_xpath(tabId: number, xpath: string): Promise<any>;
5
+ export declare function clear_input_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
7
6
  export declare function mouse_move(tabId: number, coordinate: [number, number]): Promise<any>;
8
7
  export declare function left_click(tabId: number, coordinate?: [number, number]): Promise<any>;
9
- export declare function left_click_by_xpath(tabId: number, xpath: string): Promise<any>;
10
- export declare function left_click_drag(tabId: number, coordinate: [number, number]): Promise<any>;
8
+ export declare function left_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
11
9
  export declare function right_click(tabId: number, coordinate?: [number, number]): Promise<any>;
12
- export declare function right_click_by_xpath(tabId: number, xpath: string): Promise<any>;
10
+ export declare function right_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
13
11
  export declare function double_click(tabId: number, coordinate?: [number, number]): Promise<any>;
14
- export declare function double_click_by_xpath(tabId: number, xpath: string): Promise<any>;
12
+ export declare function double_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
15
13
  export declare function screenshot(windowId: number): Promise<ScreenshotResult>;
16
14
  export declare function scroll_to(tabId: number, coordinate: [number, number]): Promise<any>;
17
- export declare function scroll_to_xpath(tabId: number, xpath: string): Promise<any>;
15
+ export declare function scroll_to_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
16
+ export declare function get_dropdown_options(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
17
+ export declare function select_dropdown_option(tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
18
18
  export declare function cursor_position(tabId: number): Promise<{
19
19
  coordinate: [number, number];
20
20
  }>;
@@ -15,4 +15,5 @@ export declare class BrowserUse implements Tool<BrowserUseParam, BrowserUseResul
15
15
  * @returns > { success: true, image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' }, text?: string }
16
16
  */
17
17
  execute(context: ExecutionContext, params: BrowserUseParam): Promise<BrowserUseResult>;
18
+ destroy(context: ExecutionContext): void;
18
19
  }
@@ -1,18 +1,7 @@
1
1
  import { ElementRect } from '../../types/tools.types';
2
2
  export declare function exportFile(filename: string, type: string, content: string): void;
3
3
  export declare function xpath(element: any): string;
4
- export declare function queryWithXpath(xpath: string): Node | null;
5
- export declare function queryAllWithXpath(xpath: string): Array<any>;
6
- export declare function getDropdownOptions(xpath: string): {
7
- options: Array<{
8
- index: number;
9
- text: string;
10
- value?: string;
11
- }>;
12
- id?: string;
13
- name?: string;
14
- } | null;
15
- export declare function selectDropdownOption(xpath: string, text: string): any;
4
+ export declare function queryWithXpath(xpath: string): any;
16
5
  /**
17
6
  * Extract the elements related to html operability and wrap them into pseudo-html code.
18
7
  */