@eko-ai/eko 1.0.1 → 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.
Files changed (44) hide show
  1. package/README.md +56 -44
  2. package/dist/core/eko.d.ts +1 -0
  3. package/dist/core/tool-registry.d.ts +1 -1
  4. package/dist/extension/content/index.d.ts +12 -4
  5. package/dist/extension/index.d.ts +0 -2
  6. package/dist/extension/script/build_dom_tree.d.ts +38 -0
  7. package/dist/extension/script/build_dom_tree.js +7 -3
  8. package/dist/extension/tools/browser.d.ts +8 -8
  9. package/dist/extension/tools/browser_use.d.ts +1 -0
  10. package/dist/extension/tools/html_script.d.ts +1 -12
  11. package/dist/extension/tools/index.d.ts +1 -2
  12. package/dist/extension.cjs.js +171 -346
  13. package/dist/extension.esm.js +172 -346
  14. package/dist/extension_content_script.js +105 -76
  15. package/dist/index.cjs.js +59 -49
  16. package/dist/index.esm.js +59 -49
  17. package/dist/models/action.d.ts +3 -2
  18. package/dist/nodejs/core.d.ts +2 -0
  19. package/dist/nodejs/index.d.ts +1 -0
  20. package/dist/nodejs/tools/command_execute.d.ts +12 -0
  21. package/dist/nodejs/tools/file_read.d.ts +11 -0
  22. package/dist/nodejs/tools/file_write.d.ts +15 -0
  23. package/dist/nodejs/tools/index.d.ts +3 -1
  24. package/dist/nodejs.cjs.js +227 -3
  25. package/dist/nodejs.esm.js +226 -3
  26. package/dist/schemas/workflow.schema.d.ts +3 -0
  27. package/dist/services/llm/claude-provider.d.ts +1 -0
  28. package/dist/services/llm/openai-provider.d.ts +1 -0
  29. package/dist/types/action.types.d.ts +2 -0
  30. package/dist/web/core.d.ts +2 -0
  31. package/dist/web/index.d.ts +1 -0
  32. package/dist/web/script/build_dom_tree.d.ts +10 -0
  33. package/dist/web/tools/browser.d.ts +20 -0
  34. package/dist/web/tools/browser_use.d.ts +19 -0
  35. package/dist/web/tools/element_click.d.ts +12 -0
  36. package/dist/web/tools/export_file.d.ts +18 -0
  37. package/dist/web/tools/extract_content.d.ts +17 -0
  38. package/dist/web/tools/find_element_position.d.ts +12 -0
  39. package/dist/web/tools/html_script.d.ts +10 -0
  40. package/dist/web/tools/index.d.ts +7 -1
  41. package/dist/web/tools/screenshot.d.ts +18 -0
  42. package/dist/web.cjs.js +9377 -3
  43. package/dist/web.esm.js +9376 -3
  44. package/package.json +2 -1
package/README.md CHANGED
@@ -1,70 +1,82 @@
1
- # **Eko**
1
+ # Eko
2
2
 
3
- [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://example.com/build-status) [![Version](https://img.shields.io/badge/version-0.1.0-yellow.svg)](https://example.com/version)
3
+ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE) [![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)](https://example.com/build-status) [![Version](https://img.shields.io/badge/version-0.1.0-yellow.svg)](https://example.com/version)
4
4
 
5
5
  **Eko** is a revolutionary framework designed to empower developers and users alike to program their browser and operating system using natural language. With seamless integration of browser APIs, OS-level capabilities, and cutting-edge AI tools like Claude 3.5, Eko redefines how we interact with technology, making it intuitive, powerful, and accessible.
6
6
 
7
- ---
7
+ ## Key Features
8
8
 
9
- ## **Table of Contents**
9
+ - **Natural Language Programming**: Transform human instructions into executable actions using advanced AI models
10
+ - **Cross-Platform Operation**: Run in browser extensions, web applications, or Node.js environments
11
+ - **Powerful Tooling**: Built-in tools for browser automation, OS operations, and system control
12
+ - **Flexible Integration**: Seamless integration with Claude 3.5 and other LLM models
13
+ - **Developer-Friendly**: Comprehensive TypeScript support and extensive documentation
10
14
 
11
- 1. [Introduction](#introduction)
12
- 2. [Features](#features)
13
- 3. [Installation](#installation)
14
- 4. [Usage](#usage)
15
- 5. [API Documentation](#api-documentation)
16
- 6. [Contributing](#contributing)
17
- 7. [License](#license)
15
+ ## Quick Start
18
16
 
19
- ---
17
+ ```bash
18
+ npm install @eko-ai/eko
19
+ ```
20
20
 
21
- ## **Introduction**
21
+ ```typescript
22
+ import { Eko } from '@eko-ai/eko';
22
23
 
23
- **Eko** is a full-stack agent development framework built on the [Fellou AI browser](https://fellou.ai), which transforms human words into actions. By leveraging natural language processing and advanced AI capabilities, it bridges the gap between user intent and system execution. Whether you're automating workflows, building browser agents, or accessing system-level operations, Eko provides the tools to make it effortless.
24
+ const eko = new Eko({
25
+ apiKey: 'your_anthropic_api_key',
26
+ });
24
27
 
25
- ## **Why use the Eko**
26
- - The biggest advantage of using Eko is that developers don’t need to build client software, and users don’t need to install any additional client to enjoy the most advanced AI-powered computer use capabilities. These capabilities span across both the browser and the operating system.
27
- - **Eko** changes the paradigm of programming, shifting from developers telling computers how to do something to developers telling computers what to do and what goals to achieve.
28
+ // Example: Browser automation
29
+ await eko.run("Search for 'Eko framework' on Google and save the first result");
28
30
 
31
+ // Example: System operation
32
+ await eko.run("Create a new folder named 'reports' and move all PDF files there");
33
+ ```
29
34
 
30
- ### **Key Benefits**
31
- - **Language as Code**: Use natural language to write commands and create workflows.
32
- - **Cross-Platform Integration**: Access browser and operating system APIs seamlessly.
33
- - **AI-Powered**: Harness the capabilities of AI systems like Claude 3.5, OpenAI for advanced automation.
34
- - **Developer-Friendly**: Simplify complex tasks with an intuitive and flexible framework.
35
+ ## Use Cases
35
36
 
36
- ---
37
+ - Browser automation and web scraping
38
+ - System file and process management
39
+ - Workflow automation
40
+ - Data processing and organization
41
+ - GUI automation
42
+ - Multi-step task orchestration
37
43
 
38
- ## **Features**
44
+ ## Documentation
39
45
 
40
- - **Natural Language Programming**: Write code in plain English to interact with your system and browser.
41
- - **Unified API Access**: A single interface for browser APIs, OS-level operations, and AI tools.
42
- - **Event-Driven Automation**: Trigger workflows based on browser or system events.
43
- - **Customizable Agents**: Build intelligent agents to perform repetitive or complex tasks.
44
- - **AI Integration**: Leverage advanced AI models to understand and execute complex commands.
46
+ Visit our [documentation site](https://eko.fellou.ai/docs) for:
45
47
 
46
- ---
48
+ - Getting started guide
49
+ - API reference
50
+ - Usage examples
51
+ - Best practices
52
+ - Configuration options
47
53
 
48
- ## **Installation**
54
+ ## Development Environments
49
55
 
50
- ### **Using npm**
56
+ Eko can be used in multiple environments:
51
57
 
52
- ```bash
53
- npm install @eko-ai/eko
54
- ```
58
+ - Browser Extension
59
+ - Web Applications
60
+ - Node.js Applications
61
+ - [Fellou AI Browser](https://fellou.ai)
62
+
63
+ ## Community and Support
64
+
65
+ - Report issues on [GitHub Issues](https://github.com/FellouAI/eko/issues)
66
+ - Contribute tools and improvements
67
+ - Share your use cases and feedback
68
+ - Join our community discussions
55
69
 
56
70
  ## Contributing
57
71
 
58
- Contributions are welcome! Please follow these steps to contribute:
72
+ We welcome contributions! See our [Contributing Guide](CONTRIBUTING.md) for details on:
59
73
 
60
- 1. Fork the repository.
61
- 2. Create a new branch: git checkout -b feature/- your-feature-name.
62
- 3. Make your changes and commit them: git commit -m 'Add some feature'.
63
- 4. Push to the branch: git push origin feature/your-feature-name.
64
- 5. Submit a pull request.
65
- 6. For detailed guidelines, see CONTRIBUTING.md.
74
+ - Setting up the development environment
75
+ - Code style guidelines
76
+ - Submission process
77
+ - Tool development
78
+ - Use case optimization
66
79
 
67
80
  ## License
68
- This project is licensed under the MIT License.
69
81
 
70
- ## Acknowledgments
82
+ Eko is released under the MIT License. See the [LICENSE](LICENSE) file for details.
@@ -3,6 +3,7 @@ import { EkoConfig, EkoInvokeParam, Tool, Workflow, WorkflowCallback } from '../
3
3
  * Eko core
4
4
  */
5
5
  export declare class Eko {
6
+ static tools: Map<string, Tool<any, any>>;
6
7
  private llmProvider;
7
8
  private toolRegistry;
8
9
  constructor(config: EkoConfig);
@@ -3,7 +3,7 @@ import { ToolDefinition } from '../types/llm.types';
3
3
  export declare class ToolRegistry {
4
4
  private tools;
5
5
  registerTool(tool: Tool<any, any>): void;
6
- unregisterTool(toolName: string): void;
6
+ unregisterTool(toolName: string): boolean;
7
7
  getTool(toolName: string): Tool<any, any>;
8
8
  hasTools(toolNames: string[]): boolean;
9
9
  getAllTools(): Tool<any, any>[];
@@ -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 };
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Get clickable elements on the page
3
+ *
4
+ * @param {*} doHighlightElements Is highlighted
5
+ * @param {*} includeAttributes [attr_names...]
6
+ * @returns { element_str, selector_map }
7
+ */
8
+ declare function get_clickable_elements(doHighlightElements: any | undefined, includeAttributes: any): string;
9
+ declare function get_highlight_element(highlightIndex: any): any;
10
+ declare function remove_highlight(): void;
11
+ declare function clickable_elements_to_string(element_tree: any, includeAttributes: any): string;
12
+ declare function create_selector_map(element_tree: any): {};
13
+ declare function parse_node(node_data: any, parent: any): {
14
+ tagName: any;
15
+ xpath: any;
16
+ highlightIndex: any;
17
+ attributes: any;
18
+ isVisible: any;
19
+ isInteractive: any;
20
+ isTopElement: any;
21
+ shadowRoot: any;
22
+ children: never[];
23
+ parent: any;
24
+ } | {
25
+ text: any;
26
+ isVisible: any;
27
+ parent: any;
28
+ } | undefined;
29
+ declare function build_dom_tree(doHighlightElements: any): {
30
+ tagName: any;
31
+ attributes: {};
32
+ xpath: string | null;
33
+ children: never[];
34
+ } | {
35
+ type: string;
36
+ text: any;
37
+ isVisible: boolean;
38
+ } | null;
@@ -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
  */
@@ -3,9 +3,8 @@ import { ElementClick } from './element_click';
3
3
  import { ExportFile } from './export_file';
4
4
  import { ExtractContent } from './extract_content';
5
5
  import { FindElementPosition } from './find_element_position';
6
- import { FormAutofill } from './form_autofill';
7
6
  import { OpenUrl } from './open_url';
8
7
  import { Screenshot } from './screenshot';
9
8
  import { TabManagement } from './tab_management';
10
9
  import { WebSearch } from './web_search';
11
- export { BrowserUse, ElementClick, ExportFile, ExtractContent, FindElementPosition, FormAutofill, OpenUrl, Screenshot, TabManagement, WebSearch, };
10
+ export { BrowserUse, ElementClick, ExportFile, ExtractContent, FindElementPosition, OpenUrl, Screenshot, TabManagement, WebSearch, };