@eko-ai/eko 1.0.8 → 1.0.10
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 +21 -21
- package/README.md +139 -131
- package/dist/core/eko.d.ts +3 -2
- package/dist/extension/script/bing.js +0 -0
- package/dist/extension/script/build_dom_tree.js +661 -661
- package/dist/extension/script/common.js +0 -0
- package/dist/extension/script/duckduckgo.js +0 -0
- package/dist/extension/script/google.js +0 -0
- package/dist/extension/tools/cancel_workflow.d.ts +9 -0
- package/dist/extension/tools/get_all_tabs.d.ts +9 -0
- package/dist/extension/tools/index.d.ts +3 -1
- package/dist/extension/tools/tab_management.d.ts +1 -1
- package/dist/extension/utils.d.ts +1 -1
- package/dist/extension.cjs.js +749 -278
- package/dist/extension.esm.js +749 -278
- package/dist/extension_content_script.js +55 -55
- package/dist/fellou.cjs.js +18 -18
- package/dist/fellou.esm.js +18 -18
- package/dist/index.cjs.js +2034 -1609
- package/dist/index.d.ts +3 -1
- package/dist/index.esm.js +2033 -1610
- package/dist/jest.config.js +10 -0
- package/dist/jest.config.js.map +1 -0
- package/dist/models/action.d.ts +8 -4
- package/dist/models/workflow.d.ts +8 -3
- package/dist/nodejs/tools/index.d.ts +1 -0
- package/dist/nodejs.cjs.js +1832 -1623
- package/dist/nodejs.esm.js +1832 -1623
- package/dist/rollup.config.js +171 -0
- package/dist/rollup.config.js.map +1 -0
- package/dist/schemas/workflow.schema.d.ts +2 -13
- package/dist/script.js +10 -0
- package/dist/script.js.map +1 -0
- package/dist/services/llm/claude-provider.d.ts +2 -1
- package/dist/services/llm/deepseek-provider.d.ts +13 -0
- package/dist/services/llm/openai-provider.d.ts +2 -1
- package/dist/services/llm/provider-factory.d.ts +4 -0
- package/dist/services/llm/siliconflow-provider.d.ts +13 -0
- package/dist/services/parser/workflow-parser.d.ts +0 -7
- package/dist/services/workflow/generator.d.ts +1 -0
- package/dist/src/core/eko.js +99 -0
- package/dist/src/core/eko.js.map +1 -0
- package/dist/src/core/tool-registry.js +51 -0
- package/dist/src/core/tool-registry.js.map +1 -0
- package/dist/src/extension/content/index.js +409 -0
- package/dist/src/extension/content/index.js.map +1 -0
- package/dist/src/extension/core.js +29 -0
- package/dist/src/extension/core.js.map +1 -0
- package/dist/src/extension/index.js +12 -0
- package/dist/src/extension/index.js.map +1 -0
- package/dist/src/extension/script/bing.js +25 -0
- package/dist/src/extension/script/bing.js.map +1 -0
- package/dist/src/extension/script/build_dom_tree.js +585 -0
- package/dist/src/extension/script/build_dom_tree.js.map +1 -0
- package/dist/src/extension/script/common.js +203 -0
- package/dist/src/extension/script/common.js.map +1 -0
- package/dist/src/extension/script/duckduckgo.js +25 -0
- package/dist/src/extension/script/duckduckgo.js.map +1 -0
- package/dist/src/extension/script/google.js +26 -0
- package/dist/src/extension/script/google.js.map +1 -0
- package/dist/src/extension/tools/browser.js +174 -0
- package/dist/src/extension/tools/browser.js.map +1 -0
- package/dist/src/extension/tools/browser_use.js +186 -0
- package/dist/src/extension/tools/browser_use.js.map +1 -0
- package/dist/src/extension/tools/element_click.js +123 -0
- package/dist/src/extension/tools/element_click.js.map +1 -0
- package/dist/src/extension/tools/export_file.js +93 -0
- package/dist/src/extension/tools/export_file.js.map +1 -0
- package/dist/src/extension/tools/extract_content.js +38 -0
- package/dist/src/extension/tools/extract_content.js.map +1 -0
- package/dist/src/extension/tools/find_element_position.js +125 -0
- package/dist/src/extension/tools/find_element_position.js.map +1 -0
- package/dist/src/extension/tools/html_script.js +219 -0
- package/dist/src/extension/tools/html_script.js.map +1 -0
- package/dist/src/extension/tools/index.js +12 -0
- package/dist/src/extension/tools/index.js.map +1 -0
- package/dist/src/extension/tools/open_url.js +68 -0
- package/dist/src/extension/tools/open_url.js.map +1 -0
- package/dist/src/extension/tools/request_login.js +87 -0
- package/dist/src/extension/tools/request_login.js.map +1 -0
- package/dist/src/extension/tools/screenshot.js +26 -0
- package/dist/src/extension/tools/screenshot.js.map +1 -0
- package/dist/src/extension/tools/tab_management.js +160 -0
- package/dist/src/extension/tools/tab_management.js.map +1 -0
- package/dist/src/extension/tools/web_search.js +281 -0
- package/dist/src/extension/tools/web_search.js.map +1 -0
- package/dist/src/extension/utils.js +244 -0
- package/dist/src/extension/utils.js.map +1 -0
- package/dist/src/fellou/computer.js +104 -0
- package/dist/src/fellou/computer.js.map +1 -0
- package/dist/src/fellou/index.js +7 -0
- package/dist/src/fellou/index.js.map +1 -0
- package/dist/src/fellou/tools/computer_use.js +111 -0
- package/dist/src/fellou/tools/computer_use.js.map +1 -0
- package/dist/src/index.js +9 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/models/action.js +364 -0
- package/dist/src/models/action.js.map +1 -0
- package/dist/src/models/workflow.js +120 -0
- package/dist/src/models/workflow.js.map +1 -0
- package/dist/src/nodejs/core.js +18 -0
- package/dist/src/nodejs/core.js.map +1 -0
- package/dist/src/nodejs/index.js +6 -0
- package/dist/src/nodejs/index.js.map +1 -0
- package/dist/src/nodejs/script/build_dom_tree.js +586 -0
- package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
- package/dist/src/nodejs/tools/browser_use.js +458 -0
- package/dist/src/nodejs/tools/browser_use.js.map +1 -0
- package/dist/src/nodejs/tools/command_execute.js +65 -0
- package/dist/src/nodejs/tools/command_execute.js.map +1 -0
- package/dist/src/nodejs/tools/file_read.js +45 -0
- package/dist/src/nodejs/tools/file_read.js.map +1 -0
- package/dist/src/nodejs/tools/file_write.js +95 -0
- package/dist/src/nodejs/tools/file_write.js.map +1 -0
- package/dist/src/nodejs/tools/index.js +5 -0
- package/dist/src/nodejs/tools/index.js.map +1 -0
- package/dist/src/schemas/workflow.schema.js +64 -0
- package/dist/src/schemas/workflow.schema.js.map +1 -0
- package/dist/src/services/llm/claude-provider.js +140 -0
- package/dist/src/services/llm/claude-provider.js.map +1 -0
- package/dist/src/services/llm/deepseek-provider.js +432 -0
- package/dist/src/services/llm/deepseek-provider.js.map +1 -0
- package/dist/src/services/llm/glm-provider.js +317 -0
- package/dist/src/services/llm/glm-provider.js.map +1 -0
- package/dist/src/services/llm/openai-provider copy.js +317 -0
- package/dist/src/services/llm/openai-provider copy.js.map +1 -0
- package/dist/src/services/llm/openai-provider.js +317 -0
- package/dist/src/services/llm/openai-provider.js.map +1 -0
- package/dist/src/services/parser/workflow-parser.js +208 -0
- package/dist/src/services/parser/workflow-parser.js.map +1 -0
- package/dist/src/services/workflow/generator.js +105 -0
- package/dist/src/services/workflow/generator.js.map +1 -0
- package/dist/src/services/workflow/templates.js +42 -0
- package/dist/src/services/workflow/templates.js.map +1 -0
- package/dist/src/types/action.types.js +2 -0
- package/dist/src/types/action.types.js.map +1 -0
- package/dist/src/types/eko.types.js +2 -0
- package/dist/src/types/eko.types.js.map +1 -0
- package/dist/src/types/index.js +6 -0
- package/dist/src/types/index.js.map +1 -0
- package/dist/src/types/llm.types.js +2 -0
- package/dist/src/types/llm.types.js.map +1 -0
- package/dist/src/types/parser.types.js +2 -0
- package/dist/src/types/parser.types.js.map +1 -0
- package/dist/src/types/tools.types.js +2 -0
- package/dist/src/types/tools.types.js.map +1 -0
- package/dist/src/types/workflow.types.js +3 -0
- package/dist/src/types/workflow.types.js.map +1 -0
- package/dist/src/web/core.js +18 -0
- package/dist/src/web/core.js.map +1 -0
- package/dist/src/web/index.js +9 -0
- package/dist/src/web/index.js.map +1 -0
- package/dist/src/web/script/build_dom_tree.js +584 -0
- package/dist/src/web/script/build_dom_tree.js.map +1 -0
- package/dist/src/web/tools/browser.js +249 -0
- package/dist/src/web/tools/browser.js.map +1 -0
- package/dist/src/web/tools/browser_use.js +176 -0
- package/dist/src/web/tools/browser_use.js.map +1 -0
- package/dist/src/web/tools/element_click.js +121 -0
- package/dist/src/web/tools/element_click.js.map +1 -0
- package/dist/src/web/tools/export_file.js +74 -0
- package/dist/src/web/tools/export_file.js.map +1 -0
- package/dist/src/web/tools/extract_content.js +24 -0
- package/dist/src/web/tools/extract_content.js.map +1 -0
- package/dist/src/web/tools/find_element_position.js +121 -0
- package/dist/src/web/tools/find_element_position.js.map +1 -0
- package/dist/src/web/tools/html_script.js +219 -0
- package/dist/src/web/tools/html_script.js.map +1 -0
- package/dist/src/web/tools/index.js +8 -0
- package/dist/src/web/tools/index.js.map +1 -0
- package/dist/src/web/tools/screenshot.js +24 -0
- package/dist/src/web/tools/screenshot.js.map +1 -0
- package/dist/test/integration/claude-provider.test.js +170 -0
- package/dist/test/integration/claude-provider.test.js.map +1 -0
- package/dist/test/integration/deepseek-provider.test.js +171 -0
- package/dist/test/integration/deepseek-provider.test.js.map +1 -0
- package/dist/test/integration/glm-provider.test.js +173 -0
- package/dist/test/integration/glm-provider.test.js.map +1 -0
- package/dist/test/integration/openai-provider.test copy.js +170 -0
- package/dist/test/integration/openai-provider.test copy.js.map +1 -0
- package/dist/test/integration/openai-provider.test.js +170 -0
- package/dist/test/integration/openai-provider.test.js.map +1 -0
- package/dist/test/integration/qwen-provider.js +170 -0
- package/dist/test/integration/qwen-provider.js.map +1 -0
- package/dist/test/integration/qwen-provider.test copy.js +170 -0
- package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
- package/dist/test/integration/qwen-provider.test.js +170 -0
- package/dist/test/integration/qwen-provider.test.js.map +1 -0
- package/dist/test/integration/workflow.execution.test.js +152 -0
- package/dist/test/integration/workflow.execution.test.js.map +1 -0
- package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
- package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
- package/dist/test/integration/workflow.generator.test.js +207 -0
- package/dist/test/integration/workflow.generator.test.js.map +1 -0
- package/dist/test/unit/action.test.js +186 -0
- package/dist/test/unit/action.test.js.map +1 -0
- package/dist/test/unit/tool-registry.test.js +99 -0
- package/dist/test/unit/tool-registry.test.js.map +1 -0
- package/dist/test/unit/workflow-parser.test.js +189 -0
- package/dist/test/unit/workflow-parser.test.js.map +1 -0
- package/dist/test/unit/workflow.test.js +102 -0
- package/dist/test/unit/workflow.test.js.map +1 -0
- package/dist/types/action.types.d.ts +8 -3
- package/dist/types/jest.config.d.ts +10 -0
- package/dist/types/rollup.config.d.ts +16 -0
- package/dist/types/script.d.ts +1 -0
- package/dist/types/src/core/eko.d.ts +20 -0
- package/dist/types/src/core/tool-registry.d.ts +13 -0
- package/dist/types/src/extension/content/index.d.ts +16 -0
- package/dist/types/src/extension/core.d.ts +11 -0
- package/dist/types/src/extension/index.d.ts +7 -0
- package/dist/types/src/extension/script/bing.d.ts +0 -0
- package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
- package/dist/types/src/extension/script/common.d.ts +0 -0
- package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
- package/dist/types/src/extension/script/google.d.ts +0 -0
- package/dist/types/src/extension/tools/browser.d.ts +22 -0
- package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
- package/dist/types/src/extension/tools/element_click.d.ts +12 -0
- package/dist/types/src/extension/tools/export_file.d.ts +18 -0
- package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
- package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
- package/dist/types/src/extension/tools/html_script.d.ts +10 -0
- package/dist/types/src/extension/tools/index.d.ts +11 -0
- package/dist/types/src/extension/tools/open_url.d.ts +18 -0
- package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
- package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
- package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
- package/dist/types/src/extension/tools/web_search.d.ts +18 -0
- package/dist/types/src/extension/utils.d.ts +31 -0
- package/dist/types/src/fellou/computer.d.ts +20 -0
- package/dist/types/src/fellou/index.d.ts +6 -0
- package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
- package/dist/types/src/index.d.ts +8 -0
- package/dist/types/src/models/action.d.ts +22 -0
- package/dist/types/src/models/workflow.d.ts +16 -0
- package/dist/types/src/nodejs/core.d.ts +2 -0
- package/dist/types/src/nodejs/index.d.ts +3 -0
- package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
- package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
- package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
- package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
- package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
- package/dist/types/src/nodejs/tools/index.d.ts +4 -0
- package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
- package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
- package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
- package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
- package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
- package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
- package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
- package/dist/types/src/services/workflow/generator.d.ts +13 -0
- package/dist/types/src/services/workflow/templates.d.ts +8 -0
- package/dist/types/src/types/action.types.d.ts +38 -0
- package/dist/types/src/types/eko.types.d.ts +21 -0
- package/dist/types/src/types/index.d.ts +5 -0
- package/dist/types/src/types/llm.types.d.ts +54 -0
- package/dist/types/src/types/parser.types.d.ts +9 -0
- package/dist/types/src/types/tools.types.d.ts +88 -0
- package/dist/types/src/types/workflow.types.d.ts +39 -0
- package/dist/types/src/web/core.d.ts +2 -0
- package/dist/types/src/web/index.d.ts +5 -0
- package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
- package/dist/types/src/web/tools/browser.d.ts +21 -0
- package/dist/types/src/web/tools/browser_use.d.ts +19 -0
- package/dist/types/src/web/tools/element_click.d.ts +12 -0
- package/dist/types/src/web/tools/export_file.d.ts +18 -0
- package/dist/types/src/web/tools/extract_content.d.ts +17 -0
- package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
- package/dist/types/src/web/tools/html_script.d.ts +10 -0
- package/dist/types/src/web/tools/index.d.ts +7 -0
- package/dist/types/src/web/tools/screenshot.d.ts +18 -0
- package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
- package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
- package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
- package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
- package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
- package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
- package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
- package/dist/types/test/unit/action.test.d.ts +1 -0
- package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
- package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
- package/dist/types/test/unit/workflow.test.d.ts +1 -0
- package/dist/types/tools.types.d.ts +44 -1
- package/dist/types/workflow.types.d.ts +22 -9
- package/dist/universal_tools/cancel_workflow.d.ts +9 -0
- package/dist/universal_tools/human/text.d.ts +9 -0
- package/dist/universal_tools/human.d.ts +30 -0
- package/dist/universal_tools/index.d.ts +4 -0
- package/dist/universal_tools/summary_workflow.d.ts +9 -0
- package/dist/utils/execution-logger.d.ts +69 -0
- package/dist/web.cjs.js +117 -117
- package/dist/web.esm.js +117 -117
- package/package.json +106 -107
- package/dist/fellou/tools/index.d.ts +0 -2
- package/dist/types/framework.types.d.ts +0 -11
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { OpenUrlParam, OpenUrlResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Open Url
|
|
5
|
+
*/
|
|
6
|
+
export declare class OpenUrl implements Tool<OpenUrlParam, OpenUrlResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Open Url
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params { url: 'https://www.google.com', newWindow: true }
|
|
15
|
+
* @returns > { tabId, windowId, title, success: true }
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: OpenUrlParam): Promise<OpenUrlResult>;
|
|
18
|
+
}
|
package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts}
RENAMED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
-
|
|
3
|
-
* Form Autofill
|
|
4
|
-
*/
|
|
5
|
-
export declare class FormAutofill implements Tool<any, any> {
|
|
2
|
+
export declare class RequestLogin implements Tool<any, any> {
|
|
6
3
|
name: string;
|
|
7
4
|
description: string;
|
|
8
5
|
input_schema: InputSchema;
|
|
9
6
|
constructor();
|
|
10
7
|
execute(context: ExecutionContext, params: any): Promise<any>;
|
|
8
|
+
awaitLogin(tabId: number, task_id: string): Promise<boolean>;
|
|
9
|
+
isLoginIn(context: ExecutionContext): Promise<boolean>;
|
|
11
10
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
+
import { ScreenshotResult } from '../../types/tools.types';
|
|
3
|
+
/**
|
|
4
|
+
* Current Page Screenshot
|
|
5
|
+
*/
|
|
6
|
+
export declare class Screenshot implements Tool<any, ScreenshotResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Current Page Screenshot
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params {}
|
|
15
|
+
* @returns > { image: { type: 'base64', media_type: 'image/png', data } }
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: unknown): Promise<ScreenshotResult>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TabManagementParam, TabManagementResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Browser tab management
|
|
5
|
+
*/
|
|
6
|
+
export declare class TabManagement implements Tool<TabManagementParam, TabManagementResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* Tab management
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params { commond: `new_tab [url]` | 'tab_all' | 'current_tab' | 'go_back' | 'close_tab' | 'switch_tab [tabId]' | `change_url [url]` }
|
|
15
|
+
* @returns > { result, success: true }
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: TabManagementParam): Promise<TabManagementResult>;
|
|
18
|
+
destroy(context: ExecutionContext): void;
|
|
19
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { WebSearchParam, WebSearchResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Web Search
|
|
5
|
+
*/
|
|
6
|
+
export declare class WebSearch implements Tool<WebSearchParam, WebSearchResult[]> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* search
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params { url: 'https://www.google.com', query: 'ai agent', maxResults: 5 }
|
|
15
|
+
* @returns > [{ title, url, content }]
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: WebSearchParam): Promise<WebSearchResult[]>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ExecutionContext } from '../types/action.types';
|
|
2
|
+
export declare function getWindowId(context: ExecutionContext): Promise<number>;
|
|
3
|
+
export declare function getTabId(context: ExecutionContext): Promise<number>;
|
|
4
|
+
export declare function getCurrentTabId(windowId?: number | undefined): Promise<number | undefined>;
|
|
5
|
+
export declare function open_new_tab(url: string, newWindow: boolean, windowId?: number): Promise<chrome.tabs.Tab>;
|
|
6
|
+
export declare function executeScript(tabId: number, func: any, args: any[]): Promise<any>;
|
|
7
|
+
export declare function waitForTabComplete(tabId: number, timeout?: number): Promise<chrome.tabs.Tab>;
|
|
8
|
+
export declare function doesTabExists(tabId: number): Promise<unknown>;
|
|
9
|
+
export declare function getPageSize(tabId?: number): Promise<[number, number]>;
|
|
10
|
+
export declare function sleep(time: number): Promise<void>;
|
|
11
|
+
export declare function injectScript(tabId: number, filename?: string): Promise<void>;
|
|
12
|
+
export declare class MsgEvent {
|
|
13
|
+
eventMap: {
|
|
14
|
+
[key: string]: Function;
|
|
15
|
+
};
|
|
16
|
+
constructor();
|
|
17
|
+
addListener(callback: Function, id: string): string;
|
|
18
|
+
removeListener(id: string): void;
|
|
19
|
+
publish(msg: any): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Counter (Function: Wait for all asynchronous tasks to complete)
|
|
23
|
+
*/
|
|
24
|
+
export declare class CountDownLatch {
|
|
25
|
+
resolve?: Function;
|
|
26
|
+
currentCount: number;
|
|
27
|
+
constructor(count: number);
|
|
28
|
+
countDown(): void;
|
|
29
|
+
await(timeout: number): Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
export declare function isPromise(obj: any): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare function can_use_computer(): Promise<boolean>;
|
|
2
|
+
export declare function key(key: string, coordinate?: [number, number]): Promise<boolean>;
|
|
3
|
+
export declare function type(text: string, coordinate?: [number, number]): Promise<boolean>;
|
|
4
|
+
export declare function mouse_move(coordinate: [number, number]): Promise<boolean>;
|
|
5
|
+
export declare function left_click(coordinate?: [number, number]): Promise<boolean>;
|
|
6
|
+
export declare function left_click_drag(coordinate: [number, number]): Promise<boolean>;
|
|
7
|
+
export declare function right_click(coordinate?: [number, number]): Promise<boolean>;
|
|
8
|
+
export declare function double_click(coordinate?: [number, number]): Promise<boolean>;
|
|
9
|
+
export declare function screenshot(windowId?: number): Promise<{
|
|
10
|
+
image: {
|
|
11
|
+
type: 'base64';
|
|
12
|
+
media_type: 'image/png' | 'image/jpeg';
|
|
13
|
+
data: string;
|
|
14
|
+
};
|
|
15
|
+
}>;
|
|
16
|
+
export declare function cursor_position(): Promise<{
|
|
17
|
+
coordinate: [number, number];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function size(): Promise<[number, number]>;
|
|
20
|
+
export declare function scroll(coordinate: [number, number]): Promise<boolean>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComputerUseParam, ComputerUseResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Computer Use for fellou
|
|
5
|
+
*/
|
|
6
|
+
export declare class ComputerUse implements Tool<ComputerUseParam, ComputerUseResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
constructor();
|
|
11
|
+
/**
|
|
12
|
+
* computer
|
|
13
|
+
*
|
|
14
|
+
* @param {*} params { action: 'mouse_move', coordinate: [100, 200] }
|
|
15
|
+
* @returns { success: true, coordinate?: [], image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' } }
|
|
16
|
+
*/
|
|
17
|
+
execute(context: ExecutionContext, params: ComputerUseParam): Promise<ComputerUseResult>;
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import Eko from './core/eko';
|
|
2
|
+
import { ToolRegistry } from './core/tool-registry';
|
|
3
|
+
import { ClaudeProvider } from './services/llm/claude-provider';
|
|
4
|
+
import { OpenaiProvider } from './services/llm/openai-provider';
|
|
5
|
+
import { WorkflowParser } from './services/parser/workflow-parser';
|
|
6
|
+
import { WorkflowGenerator } from "./services/workflow/generator";
|
|
7
|
+
export default Eko;
|
|
8
|
+
export { Eko, WorkflowGenerator, ClaudeProvider, OpenaiProvider, ToolRegistry, WorkflowParser };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Action, Tool, ExecutionContext } from '../types/action.types';
|
|
2
|
+
import { LLMProvider, LLMParameters } from '../types/llm.types';
|
|
3
|
+
export declare class ActionImpl implements Action {
|
|
4
|
+
type: 'prompt';
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
tools: Tool<any, any>[];
|
|
8
|
+
private llmProvider;
|
|
9
|
+
private llmConfig?;
|
|
10
|
+
private readonly maxRounds;
|
|
11
|
+
private writeContextTool;
|
|
12
|
+
constructor(type: 'prompt', // Only support prompt type
|
|
13
|
+
name: string, description: string, tools: Tool<any, any>[], llmProvider: LLMProvider, llmConfig?: LLMParameters | undefined, config?: {
|
|
14
|
+
maxRounds?: number;
|
|
15
|
+
});
|
|
16
|
+
private executeSingleRound;
|
|
17
|
+
private handleHistoryImageMessages;
|
|
18
|
+
execute(input: unknown, context: ExecutionContext, outputSchema?: unknown): Promise<unknown>;
|
|
19
|
+
private formatSystemPrompt;
|
|
20
|
+
private formatUserPrompt;
|
|
21
|
+
static createPromptAction(name: string, description: string, tools: Tool<any, any>[], llmProvider: LLMProvider, llmConfig?: LLMParameters): Action;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Workflow, WorkflowNode, LLMProvider, WorkflowCallback } from "../types";
|
|
2
|
+
export declare class WorkflowImpl implements Workflow {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
nodes: WorkflowNode[];
|
|
7
|
+
variables: Map<string, unknown>;
|
|
8
|
+
llmProvider?: LLMProvider | undefined;
|
|
9
|
+
abort?: boolean;
|
|
10
|
+
constructor(id: string, name: string, description?: string | undefined, nodes?: WorkflowNode[], variables?: Map<string, unknown>, llmProvider?: LLMProvider | undefined);
|
|
11
|
+
execute(callback?: WorkflowCallback): Promise<void>;
|
|
12
|
+
addNode(node: WorkflowNode): void;
|
|
13
|
+
removeNode(nodeId: string): void;
|
|
14
|
+
getNode(nodeId: string): WorkflowNode;
|
|
15
|
+
validateDAG(): boolean;
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function run_build_dom_tree(): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BrowserUseParam, BrowserUseResult } from '../../types/tools.types';
|
|
2
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
3
|
+
/**
|
|
4
|
+
* Browser Use => `npx playwright install`
|
|
5
|
+
*/
|
|
6
|
+
export declare class BrowserUse implements Tool<BrowserUseParam, BrowserUseResult> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
private browser;
|
|
11
|
+
private browser_context;
|
|
12
|
+
private current_page;
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* browser
|
|
16
|
+
*
|
|
17
|
+
* @param {*} params { action: 'input_text', index: 1, text: 'string' }
|
|
18
|
+
* @returns > { success: true, image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' }, text?: string }
|
|
19
|
+
*/
|
|
20
|
+
execute(context: ExecutionContext, params: BrowserUseParam): Promise<BrowserUseResult>;
|
|
21
|
+
private open_url;
|
|
22
|
+
private injectScript;
|
|
23
|
+
private get_highlight_element;
|
|
24
|
+
private extractHtmlContent;
|
|
25
|
+
private get_dropdown_options;
|
|
26
|
+
private select_dropdown_option;
|
|
27
|
+
destroy(context: ExecutionContext): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
+
export interface CommandExecuteParams {
|
|
3
|
+
command: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare class CommandExecute implements Tool<CommandExecuteParams, any> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
private getUserConfirmation;
|
|
11
|
+
execute(context: ExecutionContext, params: CommandExecuteParams): Promise<any>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
+
export interface FileReadParams {
|
|
3
|
+
path: string;
|
|
4
|
+
encoding?: BufferEncoding;
|
|
5
|
+
}
|
|
6
|
+
export declare class FileRead implements Tool<FileReadParams, any> {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
input_schema: InputSchema;
|
|
10
|
+
execute(context: ExecutionContext, params: FileReadParams): Promise<any>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
|
|
2
|
+
export interface FileWriteParams {
|
|
3
|
+
path: string;
|
|
4
|
+
content: string;
|
|
5
|
+
append?: boolean;
|
|
6
|
+
encoding?: BufferEncoding;
|
|
7
|
+
}
|
|
8
|
+
export declare class FileWrite implements Tool<FileWriteParams, any> {
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
input_schema: InputSchema;
|
|
12
|
+
private checkFileExists;
|
|
13
|
+
private getUserConfirmation;
|
|
14
|
+
execute(context: ExecutionContext, params: FileWriteParams): Promise<any>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export declare const workflowSchema: {
|
|
2
|
+
type: string;
|
|
3
|
+
required: string[];
|
|
4
|
+
properties: {
|
|
5
|
+
id: {
|
|
6
|
+
type: string;
|
|
7
|
+
};
|
|
8
|
+
name: {
|
|
9
|
+
type: string;
|
|
10
|
+
};
|
|
11
|
+
description: {
|
|
12
|
+
type: string;
|
|
13
|
+
};
|
|
14
|
+
nodes: {
|
|
15
|
+
type: string;
|
|
16
|
+
items: {
|
|
17
|
+
type: string;
|
|
18
|
+
required: string[];
|
|
19
|
+
properties: {
|
|
20
|
+
id: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
type: {
|
|
24
|
+
type: string;
|
|
25
|
+
enum: string[];
|
|
26
|
+
};
|
|
27
|
+
dependencies: {
|
|
28
|
+
type: string;
|
|
29
|
+
items: {
|
|
30
|
+
type: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
input: {
|
|
34
|
+
type: string;
|
|
35
|
+
properties: {
|
|
36
|
+
type: {
|
|
37
|
+
type: string;
|
|
38
|
+
};
|
|
39
|
+
schema: {
|
|
40
|
+
type: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
output: {
|
|
45
|
+
type: string;
|
|
46
|
+
properties: {
|
|
47
|
+
type: {
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
schema: {
|
|
51
|
+
type: string;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
action: {
|
|
56
|
+
type: string;
|
|
57
|
+
required: string[];
|
|
58
|
+
properties: {
|
|
59
|
+
type: {
|
|
60
|
+
type: string;
|
|
61
|
+
enum: string[];
|
|
62
|
+
};
|
|
63
|
+
name: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
description: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
params: {
|
|
70
|
+
type: string;
|
|
71
|
+
};
|
|
72
|
+
tools: {
|
|
73
|
+
type: string;
|
|
74
|
+
items: {
|
|
75
|
+
type: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
variables: {
|
|
84
|
+
type: string;
|
|
85
|
+
additionalProperties: boolean;
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from '@anthropic-ai/sdk';
|
|
2
|
+
import { LLMProvider, LLMParameters, LLMResponse, Message, LLMStreamHandler } from '../../types/llm.types';
|
|
3
|
+
export declare class ClaudeProvider implements LLMProvider {
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options: ClientOptions, defaultModel?: string);
|
|
7
|
+
constructor(apiKey: string, defaultModel?: string | null, options?: ClientOptions);
|
|
8
|
+
private processResponse;
|
|
9
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
10
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ClientOptions } from 'openai';
|
|
2
|
+
import { LLMProvider, LLMParameters, LLMResponse, Message, LLMStreamHandler } from '../../types/llm.types';
|
|
3
|
+
export declare class DeepseekProvider implements LLMProvider {
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options: ClientOptions, defaultModel?: string);
|
|
7
|
+
constructor(apiKey: string, defaultModel?: string | null, options?: ClientOptions);
|
|
8
|
+
private buildTools;
|
|
9
|
+
private buildToolChoice;
|
|
10
|
+
private buildMessages;
|
|
11
|
+
private buildParams;
|
|
12
|
+
foo(messages: Message[]): void;
|
|
13
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
14
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from 'openai';
|
|
2
|
+
import { LLMProvider, LLMParameters, LLMResponse, Message, LLMStreamHandler } from '../../types/llm.types';
|
|
3
|
+
export declare class OpenaiProvider implements LLMProvider {
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options: ClientOptions, defaultModel?: string);
|
|
7
|
+
constructor(apiKey: string, defaultModel?: string | null, options?: ClientOptions);
|
|
8
|
+
private buildParams;
|
|
9
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
10
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from 'openai';
|
|
2
|
+
import { LLMProvider, LLMParameters, LLMResponse, Message, LLMStreamHandler } from '../../types/llm.types';
|
|
3
|
+
export declare class OpenaiProvider implements LLMProvider {
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options: ClientOptions, defaultModel?: string);
|
|
7
|
+
constructor(apiKey: string, defaultModel?: string | null, options?: ClientOptions);
|
|
8
|
+
private buildParams;
|
|
9
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
10
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClientOptions } from 'openai';
|
|
2
|
+
import { LLMProvider, LLMParameters, LLMResponse, Message, LLMStreamHandler } from '../../types/llm.types';
|
|
3
|
+
export declare class OpenaiProvider implements LLMProvider {
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options: ClientOptions, defaultModel?: string);
|
|
7
|
+
constructor(apiKey: string, defaultModel?: string | null, options?: ClientOptions);
|
|
8
|
+
private buildParams;
|
|
9
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
10
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Workflow } from '../../types/workflow.types';
|
|
2
|
+
import { ValidationResult } from '../../types/parser.types';
|
|
3
|
+
export declare class WorkflowParser {
|
|
4
|
+
/**
|
|
5
|
+
* Parse JSON string into runtime Workflow object
|
|
6
|
+
* @throws {Error} if JSON is invalid or schema validation fails
|
|
7
|
+
*/
|
|
8
|
+
static parse(json: string): Workflow;
|
|
9
|
+
/**
|
|
10
|
+
* Convert runtime Workflow object to JSON string
|
|
11
|
+
*/
|
|
12
|
+
static serialize(workflow: Workflow): string;
|
|
13
|
+
/**
|
|
14
|
+
* Validate workflow JSON structure against schema
|
|
15
|
+
*/
|
|
16
|
+
static validate(json: unknown): ValidationResult;
|
|
17
|
+
/**
|
|
18
|
+
* Convert parsed JSON to runtime Workflow object
|
|
19
|
+
*/
|
|
20
|
+
private static toRuntime;
|
|
21
|
+
/**
|
|
22
|
+
* Convert runtime Workflow object to JSON structure
|
|
23
|
+
*/
|
|
24
|
+
private static fromRuntime;
|
|
25
|
+
/**
|
|
26
|
+
* Helper to convert IO definitions
|
|
27
|
+
*/
|
|
28
|
+
private static convertIO;
|
|
29
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LLMProvider, Message } from '../../types/llm.types';
|
|
2
|
+
import { Workflow } from '../../types/workflow.types';
|
|
3
|
+
import { ToolRegistry } from '../../core/tool-registry';
|
|
4
|
+
export declare class WorkflowGenerator {
|
|
5
|
+
private llmProvider;
|
|
6
|
+
private toolRegistry;
|
|
7
|
+
message_history: Message[];
|
|
8
|
+
constructor(llmProvider: LLMProvider, toolRegistry: ToolRegistry);
|
|
9
|
+
generateWorkflow(prompt: string): Promise<Workflow>;
|
|
10
|
+
modifyWorkflow(prompt: string): Promise<Workflow>;
|
|
11
|
+
private doGenerateWorkflow;
|
|
12
|
+
private createWorkflowFromData;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ToolDefinition } from '../../types/llm.types';
|
|
2
|
+
import { ToolRegistry } from '../../core/tool-registry';
|
|
3
|
+
export declare function createWorkflowPrompts(tools: ToolDefinition[]): {
|
|
4
|
+
formatSystemPrompt: () => string;
|
|
5
|
+
formatUserPrompt: (requirement: string) => string;
|
|
6
|
+
modifyUserPrompt: (prompt: string) => string;
|
|
7
|
+
};
|
|
8
|
+
export declare function createWorkflowGenerationTool(registry: ToolRegistry): ToolDefinition;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { LLMProvider } from "./llm.types";
|
|
2
|
+
import { WorkflowCallback } from "./workflow.types";
|
|
3
|
+
export interface Tool<T, R> {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
input_schema: InputSchema;
|
|
7
|
+
execute: (context: ExecutionContext, params: T) => Promise<R>;
|
|
8
|
+
destroy?: (context: ExecutionContext) => void;
|
|
9
|
+
}
|
|
10
|
+
export interface InputSchema {
|
|
11
|
+
type: 'object';
|
|
12
|
+
properties?: Properties;
|
|
13
|
+
required?: Array<string>;
|
|
14
|
+
}
|
|
15
|
+
export interface Properties {
|
|
16
|
+
[key: string]: Property;
|
|
17
|
+
}
|
|
18
|
+
export interface Property {
|
|
19
|
+
type: 'string' | 'integer' | 'boolean' | 'array' | 'object';
|
|
20
|
+
description?: string;
|
|
21
|
+
items?: InputSchema;
|
|
22
|
+
enum?: Array<string | number>;
|
|
23
|
+
properties?: Properties;
|
|
24
|
+
}
|
|
25
|
+
export interface ExecutionContext {
|
|
26
|
+
llmProvider: LLMProvider;
|
|
27
|
+
variables: Map<string, unknown>;
|
|
28
|
+
tools?: Map<string, Tool<any, any>>;
|
|
29
|
+
callback?: WorkflowCallback;
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
}
|
|
32
|
+
export interface Action {
|
|
33
|
+
type: 'prompt' | 'script' | 'hybrid';
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
execute: (input: unknown, context: ExecutionContext) => Promise<unknown>;
|
|
37
|
+
tools: Tool<any, any>[];
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ClientOptions as OpenAiClientOptions } from 'openai';
|
|
2
|
+
import { ClientOptions as ClaudeClientOption } from '@anthropic-ai/sdk';
|
|
3
|
+
import { LLMProvider } from './llm.types';
|
|
4
|
+
import { Tool } from './action.types';
|
|
5
|
+
export interface ClaudeConfig {
|
|
6
|
+
llm: 'claude';
|
|
7
|
+
apiKey: string;
|
|
8
|
+
modelName?: string;
|
|
9
|
+
options?: ClaudeClientOption;
|
|
10
|
+
}
|
|
11
|
+
export interface OpenaiConfig {
|
|
12
|
+
llm: 'openai';
|
|
13
|
+
apiKey: string;
|
|
14
|
+
modelName?: string;
|
|
15
|
+
options?: OpenAiClientOptions;
|
|
16
|
+
}
|
|
17
|
+
export type ClaudeApiKey = string;
|
|
18
|
+
export type EkoConfig = ClaudeApiKey | ClaudeConfig | OpenaiConfig | LLMProvider;
|
|
19
|
+
export interface EkoInvokeParam {
|
|
20
|
+
tools?: Array<string> | Array<Tool<any, any>>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
role: 'user' | 'assistant' | 'system';
|
|
3
|
+
content: string | unknown[];
|
|
4
|
+
}
|
|
5
|
+
export interface ToolDefinition {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
input_schema: {
|
|
9
|
+
type: "object";
|
|
10
|
+
properties: Record<string, unknown>;
|
|
11
|
+
required?: string[];
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface LLMConfig {
|
|
15
|
+
}
|
|
16
|
+
export interface ToolCall {
|
|
17
|
+
id: string;
|
|
18
|
+
name: string;
|
|
19
|
+
input: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export interface ToolResult {
|
|
22
|
+
tool_use_id: string;
|
|
23
|
+
content: string | Array<{
|
|
24
|
+
type: string;
|
|
25
|
+
text: string;
|
|
26
|
+
}>;
|
|
27
|
+
}
|
|
28
|
+
export interface LLMParameters {
|
|
29
|
+
model?: string;
|
|
30
|
+
temperature?: number;
|
|
31
|
+
maxTokens?: number;
|
|
32
|
+
tools?: ToolDefinition[];
|
|
33
|
+
toolChoice?: {
|
|
34
|
+
type: 'auto' | 'tool' | 'any';
|
|
35
|
+
name?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface LLMResponse {
|
|
39
|
+
textContent: string | null;
|
|
40
|
+
content: string | unknown[];
|
|
41
|
+
toolCalls: ToolCall[];
|
|
42
|
+
stop_reason: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface LLMStreamHandler {
|
|
45
|
+
onStart?: () => void;
|
|
46
|
+
onContent?: (content: string) => void;
|
|
47
|
+
onToolUse?: (toolCall: ToolCall) => void;
|
|
48
|
+
onComplete?: (response: LLMResponse) => void;
|
|
49
|
+
onError?: (error: Error) => void;
|
|
50
|
+
}
|
|
51
|
+
export interface LLMProvider {
|
|
52
|
+
generateText(messages: Message[], params: LLMParameters): Promise<LLMResponse>;
|
|
53
|
+
generateStream(messages: Message[], params: LLMParameters, handler: LLMStreamHandler): Promise<void>;
|
|
54
|
+
}
|