@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.
Files changed (300) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +139 -131
  3. package/dist/core/eko.d.ts +3 -2
  4. package/dist/extension/script/bing.js +0 -0
  5. package/dist/extension/script/build_dom_tree.js +661 -661
  6. package/dist/extension/script/common.js +0 -0
  7. package/dist/extension/script/duckduckgo.js +0 -0
  8. package/dist/extension/script/google.js +0 -0
  9. package/dist/extension/tools/cancel_workflow.d.ts +9 -0
  10. package/dist/extension/tools/get_all_tabs.d.ts +9 -0
  11. package/dist/extension/tools/index.d.ts +3 -1
  12. package/dist/extension/tools/tab_management.d.ts +1 -1
  13. package/dist/extension/utils.d.ts +1 -1
  14. package/dist/extension.cjs.js +749 -278
  15. package/dist/extension.esm.js +749 -278
  16. package/dist/extension_content_script.js +55 -55
  17. package/dist/fellou.cjs.js +18 -18
  18. package/dist/fellou.esm.js +18 -18
  19. package/dist/index.cjs.js +2034 -1609
  20. package/dist/index.d.ts +3 -1
  21. package/dist/index.esm.js +2033 -1610
  22. package/dist/jest.config.js +10 -0
  23. package/dist/jest.config.js.map +1 -0
  24. package/dist/models/action.d.ts +8 -4
  25. package/dist/models/workflow.d.ts +8 -3
  26. package/dist/nodejs/tools/index.d.ts +1 -0
  27. package/dist/nodejs.cjs.js +1832 -1623
  28. package/dist/nodejs.esm.js +1832 -1623
  29. package/dist/rollup.config.js +171 -0
  30. package/dist/rollup.config.js.map +1 -0
  31. package/dist/schemas/workflow.schema.d.ts +2 -13
  32. package/dist/script.js +10 -0
  33. package/dist/script.js.map +1 -0
  34. package/dist/services/llm/claude-provider.d.ts +2 -1
  35. package/dist/services/llm/deepseek-provider.d.ts +13 -0
  36. package/dist/services/llm/openai-provider.d.ts +2 -1
  37. package/dist/services/llm/provider-factory.d.ts +4 -0
  38. package/dist/services/llm/siliconflow-provider.d.ts +13 -0
  39. package/dist/services/parser/workflow-parser.d.ts +0 -7
  40. package/dist/services/workflow/generator.d.ts +1 -0
  41. package/dist/src/core/eko.js +99 -0
  42. package/dist/src/core/eko.js.map +1 -0
  43. package/dist/src/core/tool-registry.js +51 -0
  44. package/dist/src/core/tool-registry.js.map +1 -0
  45. package/dist/src/extension/content/index.js +409 -0
  46. package/dist/src/extension/content/index.js.map +1 -0
  47. package/dist/src/extension/core.js +29 -0
  48. package/dist/src/extension/core.js.map +1 -0
  49. package/dist/src/extension/index.js +12 -0
  50. package/dist/src/extension/index.js.map +1 -0
  51. package/dist/src/extension/script/bing.js +25 -0
  52. package/dist/src/extension/script/bing.js.map +1 -0
  53. package/dist/src/extension/script/build_dom_tree.js +585 -0
  54. package/dist/src/extension/script/build_dom_tree.js.map +1 -0
  55. package/dist/src/extension/script/common.js +203 -0
  56. package/dist/src/extension/script/common.js.map +1 -0
  57. package/dist/src/extension/script/duckduckgo.js +25 -0
  58. package/dist/src/extension/script/duckduckgo.js.map +1 -0
  59. package/dist/src/extension/script/google.js +26 -0
  60. package/dist/src/extension/script/google.js.map +1 -0
  61. package/dist/src/extension/tools/browser.js +174 -0
  62. package/dist/src/extension/tools/browser.js.map +1 -0
  63. package/dist/src/extension/tools/browser_use.js +186 -0
  64. package/dist/src/extension/tools/browser_use.js.map +1 -0
  65. package/dist/src/extension/tools/element_click.js +123 -0
  66. package/dist/src/extension/tools/element_click.js.map +1 -0
  67. package/dist/src/extension/tools/export_file.js +93 -0
  68. package/dist/src/extension/tools/export_file.js.map +1 -0
  69. package/dist/src/extension/tools/extract_content.js +38 -0
  70. package/dist/src/extension/tools/extract_content.js.map +1 -0
  71. package/dist/src/extension/tools/find_element_position.js +125 -0
  72. package/dist/src/extension/tools/find_element_position.js.map +1 -0
  73. package/dist/src/extension/tools/html_script.js +219 -0
  74. package/dist/src/extension/tools/html_script.js.map +1 -0
  75. package/dist/src/extension/tools/index.js +12 -0
  76. package/dist/src/extension/tools/index.js.map +1 -0
  77. package/dist/src/extension/tools/open_url.js +68 -0
  78. package/dist/src/extension/tools/open_url.js.map +1 -0
  79. package/dist/src/extension/tools/request_login.js +87 -0
  80. package/dist/src/extension/tools/request_login.js.map +1 -0
  81. package/dist/src/extension/tools/screenshot.js +26 -0
  82. package/dist/src/extension/tools/screenshot.js.map +1 -0
  83. package/dist/src/extension/tools/tab_management.js +160 -0
  84. package/dist/src/extension/tools/tab_management.js.map +1 -0
  85. package/dist/src/extension/tools/web_search.js +281 -0
  86. package/dist/src/extension/tools/web_search.js.map +1 -0
  87. package/dist/src/extension/utils.js +244 -0
  88. package/dist/src/extension/utils.js.map +1 -0
  89. package/dist/src/fellou/computer.js +104 -0
  90. package/dist/src/fellou/computer.js.map +1 -0
  91. package/dist/src/fellou/index.js +7 -0
  92. package/dist/src/fellou/index.js.map +1 -0
  93. package/dist/src/fellou/tools/computer_use.js +111 -0
  94. package/dist/src/fellou/tools/computer_use.js.map +1 -0
  95. package/dist/src/index.js +9 -0
  96. package/dist/src/index.js.map +1 -0
  97. package/dist/src/models/action.js +364 -0
  98. package/dist/src/models/action.js.map +1 -0
  99. package/dist/src/models/workflow.js +120 -0
  100. package/dist/src/models/workflow.js.map +1 -0
  101. package/dist/src/nodejs/core.js +18 -0
  102. package/dist/src/nodejs/core.js.map +1 -0
  103. package/dist/src/nodejs/index.js +6 -0
  104. package/dist/src/nodejs/index.js.map +1 -0
  105. package/dist/src/nodejs/script/build_dom_tree.js +586 -0
  106. package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
  107. package/dist/src/nodejs/tools/browser_use.js +458 -0
  108. package/dist/src/nodejs/tools/browser_use.js.map +1 -0
  109. package/dist/src/nodejs/tools/command_execute.js +65 -0
  110. package/dist/src/nodejs/tools/command_execute.js.map +1 -0
  111. package/dist/src/nodejs/tools/file_read.js +45 -0
  112. package/dist/src/nodejs/tools/file_read.js.map +1 -0
  113. package/dist/src/nodejs/tools/file_write.js +95 -0
  114. package/dist/src/nodejs/tools/file_write.js.map +1 -0
  115. package/dist/src/nodejs/tools/index.js +5 -0
  116. package/dist/src/nodejs/tools/index.js.map +1 -0
  117. package/dist/src/schemas/workflow.schema.js +64 -0
  118. package/dist/src/schemas/workflow.schema.js.map +1 -0
  119. package/dist/src/services/llm/claude-provider.js +140 -0
  120. package/dist/src/services/llm/claude-provider.js.map +1 -0
  121. package/dist/src/services/llm/deepseek-provider.js +432 -0
  122. package/dist/src/services/llm/deepseek-provider.js.map +1 -0
  123. package/dist/src/services/llm/glm-provider.js +317 -0
  124. package/dist/src/services/llm/glm-provider.js.map +1 -0
  125. package/dist/src/services/llm/openai-provider copy.js +317 -0
  126. package/dist/src/services/llm/openai-provider copy.js.map +1 -0
  127. package/dist/src/services/llm/openai-provider.js +317 -0
  128. package/dist/src/services/llm/openai-provider.js.map +1 -0
  129. package/dist/src/services/parser/workflow-parser.js +208 -0
  130. package/dist/src/services/parser/workflow-parser.js.map +1 -0
  131. package/dist/src/services/workflow/generator.js +105 -0
  132. package/dist/src/services/workflow/generator.js.map +1 -0
  133. package/dist/src/services/workflow/templates.js +42 -0
  134. package/dist/src/services/workflow/templates.js.map +1 -0
  135. package/dist/src/types/action.types.js +2 -0
  136. package/dist/src/types/action.types.js.map +1 -0
  137. package/dist/src/types/eko.types.js +2 -0
  138. package/dist/src/types/eko.types.js.map +1 -0
  139. package/dist/src/types/index.js +6 -0
  140. package/dist/src/types/index.js.map +1 -0
  141. package/dist/src/types/llm.types.js +2 -0
  142. package/dist/src/types/llm.types.js.map +1 -0
  143. package/dist/src/types/parser.types.js +2 -0
  144. package/dist/src/types/parser.types.js.map +1 -0
  145. package/dist/src/types/tools.types.js +2 -0
  146. package/dist/src/types/tools.types.js.map +1 -0
  147. package/dist/src/types/workflow.types.js +3 -0
  148. package/dist/src/types/workflow.types.js.map +1 -0
  149. package/dist/src/web/core.js +18 -0
  150. package/dist/src/web/core.js.map +1 -0
  151. package/dist/src/web/index.js +9 -0
  152. package/dist/src/web/index.js.map +1 -0
  153. package/dist/src/web/script/build_dom_tree.js +584 -0
  154. package/dist/src/web/script/build_dom_tree.js.map +1 -0
  155. package/dist/src/web/tools/browser.js +249 -0
  156. package/dist/src/web/tools/browser.js.map +1 -0
  157. package/dist/src/web/tools/browser_use.js +176 -0
  158. package/dist/src/web/tools/browser_use.js.map +1 -0
  159. package/dist/src/web/tools/element_click.js +121 -0
  160. package/dist/src/web/tools/element_click.js.map +1 -0
  161. package/dist/src/web/tools/export_file.js +74 -0
  162. package/dist/src/web/tools/export_file.js.map +1 -0
  163. package/dist/src/web/tools/extract_content.js +24 -0
  164. package/dist/src/web/tools/extract_content.js.map +1 -0
  165. package/dist/src/web/tools/find_element_position.js +121 -0
  166. package/dist/src/web/tools/find_element_position.js.map +1 -0
  167. package/dist/src/web/tools/html_script.js +219 -0
  168. package/dist/src/web/tools/html_script.js.map +1 -0
  169. package/dist/src/web/tools/index.js +8 -0
  170. package/dist/src/web/tools/index.js.map +1 -0
  171. package/dist/src/web/tools/screenshot.js +24 -0
  172. package/dist/src/web/tools/screenshot.js.map +1 -0
  173. package/dist/test/integration/claude-provider.test.js +170 -0
  174. package/dist/test/integration/claude-provider.test.js.map +1 -0
  175. package/dist/test/integration/deepseek-provider.test.js +171 -0
  176. package/dist/test/integration/deepseek-provider.test.js.map +1 -0
  177. package/dist/test/integration/glm-provider.test.js +173 -0
  178. package/dist/test/integration/glm-provider.test.js.map +1 -0
  179. package/dist/test/integration/openai-provider.test copy.js +170 -0
  180. package/dist/test/integration/openai-provider.test copy.js.map +1 -0
  181. package/dist/test/integration/openai-provider.test.js +170 -0
  182. package/dist/test/integration/openai-provider.test.js.map +1 -0
  183. package/dist/test/integration/qwen-provider.js +170 -0
  184. package/dist/test/integration/qwen-provider.js.map +1 -0
  185. package/dist/test/integration/qwen-provider.test copy.js +170 -0
  186. package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
  187. package/dist/test/integration/qwen-provider.test.js +170 -0
  188. package/dist/test/integration/qwen-provider.test.js.map +1 -0
  189. package/dist/test/integration/workflow.execution.test.js +152 -0
  190. package/dist/test/integration/workflow.execution.test.js.map +1 -0
  191. package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
  192. package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
  193. package/dist/test/integration/workflow.generator.test.js +207 -0
  194. package/dist/test/integration/workflow.generator.test.js.map +1 -0
  195. package/dist/test/unit/action.test.js +186 -0
  196. package/dist/test/unit/action.test.js.map +1 -0
  197. package/dist/test/unit/tool-registry.test.js +99 -0
  198. package/dist/test/unit/tool-registry.test.js.map +1 -0
  199. package/dist/test/unit/workflow-parser.test.js +189 -0
  200. package/dist/test/unit/workflow-parser.test.js.map +1 -0
  201. package/dist/test/unit/workflow.test.js +102 -0
  202. package/dist/test/unit/workflow.test.js.map +1 -0
  203. package/dist/types/action.types.d.ts +8 -3
  204. package/dist/types/jest.config.d.ts +10 -0
  205. package/dist/types/rollup.config.d.ts +16 -0
  206. package/dist/types/script.d.ts +1 -0
  207. package/dist/types/src/core/eko.d.ts +20 -0
  208. package/dist/types/src/core/tool-registry.d.ts +13 -0
  209. package/dist/types/src/extension/content/index.d.ts +16 -0
  210. package/dist/types/src/extension/core.d.ts +11 -0
  211. package/dist/types/src/extension/index.d.ts +7 -0
  212. package/dist/types/src/extension/script/bing.d.ts +0 -0
  213. package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
  214. package/dist/types/src/extension/script/common.d.ts +0 -0
  215. package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
  216. package/dist/types/src/extension/script/google.d.ts +0 -0
  217. package/dist/types/src/extension/tools/browser.d.ts +22 -0
  218. package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
  219. package/dist/types/src/extension/tools/element_click.d.ts +12 -0
  220. package/dist/types/src/extension/tools/export_file.d.ts +18 -0
  221. package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
  222. package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
  223. package/dist/types/src/extension/tools/html_script.d.ts +10 -0
  224. package/dist/types/src/extension/tools/index.d.ts +11 -0
  225. package/dist/types/src/extension/tools/open_url.d.ts +18 -0
  226. package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
  227. package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
  228. package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
  229. package/dist/types/src/extension/tools/web_search.d.ts +18 -0
  230. package/dist/types/src/extension/utils.d.ts +31 -0
  231. package/dist/types/src/fellou/computer.d.ts +20 -0
  232. package/dist/types/src/fellou/index.d.ts +6 -0
  233. package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
  234. package/dist/types/src/index.d.ts +8 -0
  235. package/dist/types/src/models/action.d.ts +22 -0
  236. package/dist/types/src/models/workflow.d.ts +16 -0
  237. package/dist/types/src/nodejs/core.d.ts +2 -0
  238. package/dist/types/src/nodejs/index.d.ts +3 -0
  239. package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
  240. package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
  241. package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
  242. package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
  243. package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
  244. package/dist/types/src/nodejs/tools/index.d.ts +4 -0
  245. package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
  246. package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
  247. package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
  248. package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
  249. package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
  250. package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
  251. package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
  252. package/dist/types/src/services/workflow/generator.d.ts +13 -0
  253. package/dist/types/src/services/workflow/templates.d.ts +8 -0
  254. package/dist/types/src/types/action.types.d.ts +38 -0
  255. package/dist/types/src/types/eko.types.d.ts +21 -0
  256. package/dist/types/src/types/index.d.ts +5 -0
  257. package/dist/types/src/types/llm.types.d.ts +54 -0
  258. package/dist/types/src/types/parser.types.d.ts +9 -0
  259. package/dist/types/src/types/tools.types.d.ts +88 -0
  260. package/dist/types/src/types/workflow.types.d.ts +39 -0
  261. package/dist/types/src/web/core.d.ts +2 -0
  262. package/dist/types/src/web/index.d.ts +5 -0
  263. package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
  264. package/dist/types/src/web/tools/browser.d.ts +21 -0
  265. package/dist/types/src/web/tools/browser_use.d.ts +19 -0
  266. package/dist/types/src/web/tools/element_click.d.ts +12 -0
  267. package/dist/types/src/web/tools/export_file.d.ts +18 -0
  268. package/dist/types/src/web/tools/extract_content.d.ts +17 -0
  269. package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
  270. package/dist/types/src/web/tools/html_script.d.ts +10 -0
  271. package/dist/types/src/web/tools/index.d.ts +7 -0
  272. package/dist/types/src/web/tools/screenshot.d.ts +18 -0
  273. package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
  274. package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
  275. package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
  276. package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
  277. package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
  278. package/dist/types/test/integration/qwen-provider.d.ts +1 -0
  279. package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
  280. package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
  281. package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
  282. package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
  283. package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
  284. package/dist/types/test/unit/action.test.d.ts +1 -0
  285. package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
  286. package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
  287. package/dist/types/test/unit/workflow.test.d.ts +1 -0
  288. package/dist/types/tools.types.d.ts +44 -1
  289. package/dist/types/workflow.types.d.ts +22 -9
  290. package/dist/universal_tools/cancel_workflow.d.ts +9 -0
  291. package/dist/universal_tools/human/text.d.ts +9 -0
  292. package/dist/universal_tools/human.d.ts +30 -0
  293. package/dist/universal_tools/index.d.ts +4 -0
  294. package/dist/universal_tools/summary_workflow.d.ts +9 -0
  295. package/dist/utils/execution-logger.d.ts +69 -0
  296. package/dist/web.cjs.js +117 -117
  297. package/dist/web.esm.js +117 -117
  298. package/package.json +106 -107
  299. package/dist/fellou/tools/index.d.ts +0 -2
  300. package/dist/types/framework.types.d.ts +0 -11
@@ -0,0 +1,189 @@
1
+ import { WorkflowParser } from '../../src/services/parser/workflow-parser';
2
+ describe('WorkflowParser', () => {
3
+ const validWorkflowJson = {
4
+ version: "1.0",
5
+ id: "test-workflow",
6
+ name: "Test Workflow",
7
+ description: "A test workflow",
8
+ nodes: [
9
+ {
10
+ id: "node1",
11
+ name: "First Node",
12
+ action: {
13
+ type: "script",
14
+ name: "testAction",
15
+ tools: ["tool1", "tool2"]
16
+ }
17
+ },
18
+ {
19
+ id: "node2",
20
+ name: "Second Node",
21
+ dependencies: ["node1"],
22
+ action: {
23
+ type: "prompt",
24
+ name: "promptAction"
25
+ }
26
+ }
27
+ ],
28
+ variables: {
29
+ testVar: "value"
30
+ }
31
+ };
32
+ describe('parse', () => {
33
+ it('should successfully parse valid workflow JSON', () => {
34
+ const json = JSON.stringify(validWorkflowJson);
35
+ const workflow = WorkflowParser.parse(json);
36
+ expect(workflow.id).toBe("test-workflow");
37
+ expect(workflow.name).toBe("Test Workflow");
38
+ expect(workflow.description).toBe("A test workflow");
39
+ expect(workflow.nodes).toHaveLength(2);
40
+ expect(workflow.variables.get("testVar")).toBe("value");
41
+ });
42
+ it('should throw on invalid JSON', () => {
43
+ const invalidJson = '{ invalid json';
44
+ expect(() => WorkflowParser.parse(invalidJson)).toThrow('Invalid JSON');
45
+ });
46
+ it('should throw on validation errors', () => {
47
+ const invalidWorkflow = {
48
+ ...validWorkflowJson,
49
+ nodes: [
50
+ {
51
+ id: "node1",
52
+ name: "Invalid Node"
53
+ // Missing required action
54
+ }
55
+ ]
56
+ };
57
+ expect(() => WorkflowParser.parse(JSON.stringify(invalidWorkflow)))
58
+ .toThrow('Invalid workflow');
59
+ });
60
+ });
61
+ describe('serialize', () => {
62
+ it('should serialize workflow back to JSON', () => {
63
+ const json = JSON.stringify(validWorkflowJson);
64
+ const workflow = WorkflowParser.parse(json);
65
+ const serialized = WorkflowParser.serialize(workflow);
66
+ const parsed = JSON.parse(serialized);
67
+ expect(parsed.id).toBe(validWorkflowJson.id);
68
+ expect(parsed.name).toBe(validWorkflowJson.name);
69
+ expect(parsed.nodes).toHaveLength(validWorkflowJson.nodes.length);
70
+ });
71
+ });
72
+ describe('validate', () => {
73
+ it('should validate correct workflow structure', () => {
74
+ const result = WorkflowParser.validate(validWorkflowJson);
75
+ expect(result.valid).toBe(true);
76
+ expect(result.errors).toHaveLength(0);
77
+ });
78
+ it('should catch missing required fields', () => {
79
+ const invalidWorkflow = {
80
+ id: "test-workflow",
81
+ // Missing name and nodes
82
+ };
83
+ const result = WorkflowParser.validate(invalidWorkflow);
84
+ expect(result.valid).toBe(false);
85
+ expect(result.errors.some(e => e.message.includes('Missing required field'))).toBe(true);
86
+ });
87
+ it('should catch invalid node references', () => {
88
+ const workflowWithBadRef = {
89
+ ...validWorkflowJson,
90
+ nodes: [
91
+ {
92
+ id: "node1",
93
+ name: "Node",
94
+ action: { type: "script", name: "test" },
95
+ dependencies: ["non-existent-node"]
96
+ }
97
+ ]
98
+ };
99
+ const result = WorkflowParser.validate(workflowWithBadRef);
100
+ expect(result.valid).toBe(false);
101
+ expect(result.errors.some(e => e.type === 'reference')).toBe(true);
102
+ });
103
+ it('should catch duplicate node ids', () => {
104
+ const workflowWithDuplicates = {
105
+ ...validWorkflowJson,
106
+ nodes: [
107
+ {
108
+ id: "node1",
109
+ name: "Node 1",
110
+ action: { type: "script", name: "test" }
111
+ },
112
+ {
113
+ id: "node1", // Duplicate ID
114
+ name: "Node 2",
115
+ action: { type: "script", name: "test" }
116
+ }
117
+ ]
118
+ };
119
+ const result = WorkflowParser.validate(workflowWithDuplicates);
120
+ expect(result.valid).toBe(false);
121
+ expect(result.errors.some(e => e.message.includes('Duplicate node id'))).toBe(true);
122
+ });
123
+ it('should validate action types', () => {
124
+ const workflowWithInvalidAction = {
125
+ ...validWorkflowJson,
126
+ nodes: [
127
+ {
128
+ id: "node1",
129
+ name: "Node",
130
+ action: { type: "invalid-type", name: "test" }
131
+ }
132
+ ]
133
+ };
134
+ const result = WorkflowParser.validate(workflowWithInvalidAction);
135
+ expect(result.valid).toBe(false);
136
+ expect(result.errors.some(e => e.message.includes('Invalid action type'))).toBe(true);
137
+ });
138
+ });
139
+ describe('runtime conversion', () => {
140
+ it('should preserve node dependencies', () => {
141
+ const json = JSON.stringify(validWorkflowJson);
142
+ const workflow = WorkflowParser.parse(json);
143
+ const node2 = workflow.getNode('node2');
144
+ expect(node2.dependencies).toContain('node1');
145
+ });
146
+ it('should set default values for optional fields', () => {
147
+ const minimalNode = {
148
+ version: "1.0",
149
+ id: "test",
150
+ name: "Test",
151
+ nodes: [{
152
+ id: "node1",
153
+ action: { type: "script", name: "test" }
154
+ }]
155
+ };
156
+ const workflow = WorkflowParser.parse(JSON.stringify(minimalNode));
157
+ const node = workflow.getNode('node1');
158
+ expect(node.dependencies).toEqual([]);
159
+ expect(node.input).toBeDefined();
160
+ expect(node.output).toBeDefined();
161
+ });
162
+ it('should preserve custom IO schemas', () => {
163
+ const workflowWithIO = {
164
+ ...validWorkflowJson,
165
+ nodes: [
166
+ {
167
+ id: "node1",
168
+ action: { type: "script", name: "test" },
169
+ input: {
170
+ type: "object",
171
+ schema: { required: ["test"], properties: { test: { type: "string" } } }
172
+ },
173
+ output: {
174
+ type: "array",
175
+ schema: { items: { type: "number" } }
176
+ }
177
+ }
178
+ ]
179
+ };
180
+ const workflow = WorkflowParser.parse(JSON.stringify(workflowWithIO));
181
+ const node = workflow.getNode('node1');
182
+ expect(node.input.type).toBe('object');
183
+ expect(node.output.type).toBe('array');
184
+ expect(node.input.schema).toEqual(workflowWithIO.nodes[0].input.schema);
185
+ expect(node.output.schema).toEqual(workflowWithIO.nodes[0].output.schema);
186
+ });
187
+ });
188
+ });
189
+ //# sourceMappingURL=workflow-parser.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow-parser.test.js","sourceRoot":"","sources":["../../../test/unit/workflow-parser.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAI3E,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,MAAM,iBAAiB,GAAG;QACxB,OAAO,EAAE,KAAK;QACd,EAAE,EAAE,eAAe;QACnB,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,iBAAiB;QAC9B,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,YAAY;gBAClB,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,YAAY;oBAClB,KAAK,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;iBAC1B;aACF;YACD;gBACE,EAAE,EAAE,OAAO;gBACX,IAAI,EAAE,aAAa;gBACnB,YAAY,EAAE,CAAC,OAAO,CAAC;gBACvB,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,cAAc;iBACrB;aACF;SACF;QACD,SAAS,EAAE;YACT,OAAO,EAAE,OAAO;SACjB;KACF,CAAC;IAEF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;QACrB,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;YACvD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;YAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAA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BACb,MAAM,EAAE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;yBACtC;qBACF;iBACF;aACF,CAAC;YACF,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;YACtE,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACvC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YACxE,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,102 @@
1
+ import { WorkflowImpl } from '../../src/models/workflow';
2
+ describe('WorkflowImpl', () => {
3
+ let workflow;
4
+ beforeEach(() => {
5
+ workflow = new WorkflowImpl('test-id', 'Test Workflow');
6
+ });
7
+ const createMockNode = (id, dependencies = []) => ({
8
+ id,
9
+ name: `Node ${id}`,
10
+ input: { type: 'object', schema: {}, value: null },
11
+ output: { type: 'object', schema: {}, value: null },
12
+ dependencies,
13
+ action: {
14
+ type: 'script',
15
+ name: 'test',
16
+ description: 'test',
17
+ tools: [],
18
+ execute: async () => ({ result: `Executed ${id}` }),
19
+ }
20
+ });
21
+ describe('node management', () => {
22
+ test('should add node successfully', () => {
23
+ const node = createMockNode('node1');
24
+ workflow.addNode(node);
25
+ expect(workflow.nodes).toHaveLength(1);
26
+ expect(workflow.getNode('node1')).toBe(node);
27
+ });
28
+ test('should throw when adding duplicate node', () => {
29
+ const node = createMockNode('node1');
30
+ workflow.addNode(node);
31
+ expect(() => workflow.addNode(node)).toThrow();
32
+ });
33
+ test('should remove node successfully', () => {
34
+ const node = createMockNode('node1');
35
+ workflow.addNode(node);
36
+ workflow.removeNode('node1');
37
+ expect(workflow.nodes).toHaveLength(0);
38
+ });
39
+ test('should throw when removing non-existent node', () => {
40
+ expect(() => workflow.removeNode('nonexistent')).toThrow();
41
+ });
42
+ test('should throw when removing node with dependents', () => {
43
+ const node1 = createMockNode('node1');
44
+ const node2 = createMockNode('node2', ['node1']);
45
+ workflow.addNode(node1);
46
+ workflow.addNode(node2);
47
+ expect(() => workflow.removeNode('node1')).toThrow();
48
+ });
49
+ });
50
+ describe('DAG validation', () => {
51
+ test('should detect simple cycle', () => {
52
+ const node1 = createMockNode('node1', ['node2']);
53
+ const node2 = createMockNode('node2', ['node1']);
54
+ workflow.addNode(node1);
55
+ workflow.addNode(node2);
56
+ expect(workflow.validateDAG()).toBe(false);
57
+ });
58
+ test('should validate acyclic graph', () => {
59
+ const node1 = createMockNode('node1');
60
+ const node2 = createMockNode('node2', ['node1']);
61
+ const node3 = createMockNode('node3', ['node1', 'node2']);
62
+ workflow.addNode(node1);
63
+ workflow.addNode(node2);
64
+ workflow.addNode(node3);
65
+ expect(workflow.validateDAG()).toBe(true);
66
+ });
67
+ });
68
+ describe('execution', () => {
69
+ test('should execute nodes in correct order', async () => {
70
+ const executed = [];
71
+ const createExecutableNode = (id, dependencies = []) => ({
72
+ ...createMockNode(id, dependencies),
73
+ action: {
74
+ type: 'script',
75
+ name: 'test',
76
+ description: 'test',
77
+ tools: [],
78
+ execute: async () => {
79
+ executed.push(id);
80
+ return { result: `Executed ${id}` };
81
+ }
82
+ }
83
+ });
84
+ const node1 = createExecutableNode('node1');
85
+ const node2 = createExecutableNode('node2', ['node1']);
86
+ const node3 = createExecutableNode('node3', ['node1', 'node2']);
87
+ workflow.addNode(node1);
88
+ workflow.addNode(node2);
89
+ workflow.addNode(node3);
90
+ await workflow.execute();
91
+ expect(executed).toEqual(['node1', 'node2', 'node3']);
92
+ });
93
+ test('should throw on cyclic dependencies during execution', async () => {
94
+ const node1 = createMockNode('node1', ['node2']);
95
+ const node2 = createMockNode('node2', ['node1']);
96
+ workflow.addNode(node1);
97
+ workflow.addNode(node2);
98
+ await expect(workflow.execute()).rejects.toThrow();
99
+ });
100
+ });
101
+ });
102
+ //# sourceMappingURL=workflow.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.test.js","sourceRoot":"","sources":["../../../test/unit/workflow.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,QAAsB,CAAC;IAE3B,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,YAAY,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,CAAC,EAAU,EAAE,eAAyB,EAAE,EAAgB,EAAE,CAAC,CAAC;QACjF,EAAE;QACF,IAAI,EAAE,QAAQ,EAAE,EAAE;QAClB,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QAClD,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;QACnD,YAAY;QACZ,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,MAAM;YACZ,WAAW,EAAE,MAAM;YACnB,KAAK,EAAE,EAAE;YACT,OAAO,EAAE,KAAK,IAAI,EAAE,CAA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O,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACxD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,sDAAsD,EAAE,KAAK,IAAI,EAAE;YACtE,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;YACjD,MAAM,KAAK,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;YACjD,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YACxB,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAExB,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACrD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,5 +1,7 @@
1
+ import { Workflow } from "./workflow.types";
1
2
  import { LLMProvider } from "./llm.types";
2
- import { WorkflowCallback } from "./workflow.types";
3
+ import { NodeOutput, WorkflowCallback } from "./workflow.types";
4
+ import { NodeInput } from "./workflow.types";
3
5
  export interface Tool<T, R> {
4
6
  name: string;
5
7
  description: string;
@@ -25,14 +27,17 @@ export interface Property {
25
27
  export interface ExecutionContext {
26
28
  llmProvider: LLMProvider;
27
29
  variables: Map<string, unknown>;
30
+ workflow?: Workflow;
28
31
  tools?: Map<string, Tool<any, any>>;
29
32
  callback?: WorkflowCallback;
33
+ signal?: AbortSignal;
30
34
  [key: string]: any;
31
35
  }
32
36
  export interface Action {
33
37
  type: 'prompt' | 'script' | 'hybrid';
34
38
  name: string;
35
39
  description: string;
36
- execute: (input: unknown, context: ExecutionContext) => Promise<unknown>;
37
- tools: Tool<any, any>[];
40
+ execute: (input: NodeInput, output: NodeOutput, context: ExecutionContext) => Promise<unknown>;
41
+ tools: Array<Tool<any, any>>;
42
+ llmProvider?: LLMProvider;
38
43
  }
@@ -0,0 +1,10 @@
1
+ declare namespace _default {
2
+ let preset: string;
3
+ let testEnvironment: string;
4
+ let roots: string[];
5
+ let testMatch: string[];
6
+ let moduleNameMapper: {
7
+ '^@/(.*)$': string;
8
+ };
9
+ }
10
+ export default _default;
@@ -0,0 +1,16 @@
1
+ declare const _default: ({
2
+ input: string;
3
+ output: {
4
+ file: string;
5
+ format: string;
6
+ }[];
7
+ plugins: import("rollup").Plugin<any>[];
8
+ } | {
9
+ input: string;
10
+ output: {
11
+ file: string;
12
+ format: string;
13
+ };
14
+ plugins: import("rollup").Plugin<any>[];
15
+ })[];
16
+ export default _default;
@@ -0,0 +1 @@
1
+ export const __esModule: boolean;
@@ -0,0 +1,20 @@
1
+ import { EkoConfig, EkoInvokeParam, Tool, Workflow, WorkflowCallback } from '../types';
2
+ /**
3
+ * Eko core
4
+ */
5
+ export declare class Eko {
6
+ static tools: Map<string, Tool<any, any>>;
7
+ private llmProvider;
8
+ private toolRegistry;
9
+ private workflowGeneratorMap;
10
+ constructor(config: EkoConfig);
11
+ generate(prompt: string, param?: EkoInvokeParam): Promise<Workflow>;
12
+ execute(workflow: Workflow, callback?: WorkflowCallback): Promise<void>;
13
+ modify(workflow: Workflow, prompt: string): Promise<Workflow>;
14
+ private getTool;
15
+ callTool(toolName: string, input: object, callback?: WorkflowCallback): Promise<any>;
16
+ callTool(tool: Tool<any, any>, input: object, callback?: WorkflowCallback): Promise<any>;
17
+ registerTool(tool: Tool<any, any>): void;
18
+ unregisterTool(toolName: string): void;
19
+ }
20
+ export default Eko;
@@ -0,0 +1,13 @@
1
+ import { Tool } from '../types/action.types';
2
+ import { ToolDefinition } from '../types/llm.types';
3
+ export declare class ToolRegistry {
4
+ private tools;
5
+ registerTool(tool: Tool<any, any>): void;
6
+ unregisterTool(toolName: string): boolean;
7
+ getTool(toolName: string): Tool<any, any>;
8
+ hasTools(toolNames: string[]): boolean;
9
+ getAllTools(): Tool<any, any>[];
10
+ getToolDefinitions(): ToolDefinition[];
11
+ getToolEnum(): string[];
12
+ getWorkflowSchema(): object;
13
+ }
@@ -0,0 +1,16 @@
1
+ declare const eko: any;
2
+ declare function type(request: any): boolean;
3
+ declare function mouse_move(request: any): boolean;
4
+ declare function simulateMouseEvent(request: any, eventTypes: Array<string>, button: 0 | 1 | 2): 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;
16
+ declare function request_user_help(task_id: string, failure_type: string, failure_message: string): void;
@@ -0,0 +1,11 @@
1
+ import { Tool } from '../types';
2
+ export declare function pub(tabId: number, event: string, params: any): Promise<any>;
3
+ export declare function getLLMConfig(name?: string): Promise<{
4
+ llm?: string;
5
+ apiKey?: string;
6
+ modelName?: string;
7
+ options?: {
8
+ [key: string]: any;
9
+ };
10
+ } | undefined>;
11
+ export declare function loadTools(): Map<string, Tool<any, any>>;
@@ -0,0 +1,7 @@
1
+ export * from './core';
2
+ import * as utils from './utils';
3
+ export { utils };
4
+ import * as tools from './tools';
5
+ export { tools };
6
+ import * as browser from './tools/browser';
7
+ export { browser };
File without changes
@@ -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;
File without changes
File without changes
@@ -0,0 +1,22 @@
1
+ import { ScreenshotResult } from '../../types/tools.types';
2
+ export declare function type(tabId: number, text: string, coordinate?: [number, number]): Promise<any>;
3
+ export declare function type_by(tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
4
+ export declare function clear_input(tabId: number, coordinate?: [number, number]): Promise<any>;
5
+ export declare function clear_input_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
6
+ export declare function mouse_move(tabId: number, coordinate: [number, number]): Promise<any>;
7
+ export declare function left_click(tabId: number, coordinate?: [number, number]): Promise<any>;
8
+ export declare function left_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
9
+ export declare function right_click(tabId: number, coordinate?: [number, number]): Promise<any>;
10
+ export declare function right_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
11
+ export declare function double_click(tabId: number, coordinate?: [number, number]): Promise<any>;
12
+ export declare function double_click_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
13
+ export declare function screenshot(windowId: number, compress?: boolean): Promise<ScreenshotResult>;
14
+ export declare function compress_image(dataUrl: string, scale?: number, quality?: number): Promise<string>;
15
+ export declare function scroll_to(tabId: number, coordinate: [number, number]): Promise<any>;
16
+ export declare function scroll_to_by(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
17
+ export declare function get_dropdown_options(tabId: number, xpath?: string, highlightIndex?: number): Promise<any>;
18
+ export declare function select_dropdown_option(tabId: number, text: string, xpath?: string, highlightIndex?: number): Promise<any>;
19
+ export declare function cursor_position(tabId: number): Promise<{
20
+ coordinate: [number, number];
21
+ }>;
22
+ export declare function size(tabId?: number): Promise<[number, number]>;
@@ -0,0 +1,19 @@
1
+ import { BrowserUseParam, BrowserUseResult } from '../../types/tools.types';
2
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
3
+ /**
4
+ * Browser Use for general
5
+ */
6
+ export declare class BrowserUse implements Tool<BrowserUseParam, BrowserUseResult> {
7
+ name: string;
8
+ description: string;
9
+ input_schema: InputSchema;
10
+ constructor();
11
+ /**
12
+ * browser
13
+ *
14
+ * @param {*} params { action: 'input_text', index: 1, text: 'string' }
15
+ * @returns > { success: true, image?: { type: 'base64', media_type: 'image/jpeg', data: '/9j...' }, text?: string }
16
+ */
17
+ execute(context: ExecutionContext, params: BrowserUseParam): Promise<BrowserUseResult>;
18
+ destroy(context: ExecutionContext): void;
19
+ }
@@ -0,0 +1,12 @@
1
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
2
+ import { TaskPrompt } from '../../types/tools.types';
3
+ /**
4
+ * Element click
5
+ */
6
+ export declare class ElementClick implements Tool<TaskPrompt, any> {
7
+ name: string;
8
+ description: string;
9
+ input_schema: InputSchema;
10
+ constructor();
11
+ execute(context: ExecutionContext, params: TaskPrompt): Promise<any>;
12
+ }
@@ -0,0 +1,18 @@
1
+ import { ExportFileParam } from '../../types/tools.types';
2
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
3
+ /**
4
+ * Export file
5
+ */
6
+ export declare class ExportFile implements Tool<ExportFileParam, unknown> {
7
+ name: string;
8
+ description: string;
9
+ input_schema: InputSchema;
10
+ constructor();
11
+ /**
12
+ * export
13
+ *
14
+ * @param {*} params { fileType: 'csv', content: 'field1,field2\ndata1,data2' }
15
+ * @returns > { success: true }
16
+ */
17
+ execute(context: ExecutionContext, params: ExportFileParam): Promise<unknown>;
18
+ }
@@ -0,0 +1,18 @@
1
+ import { ExtractContentResult } from '../../types/tools.types';
2
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
3
+ /**
4
+ * Extract Page Content
5
+ */
6
+ export declare class ExtractContent implements Tool<any, ExtractContentResult> {
7
+ name: string;
8
+ description: string;
9
+ input_schema: InputSchema;
10
+ constructor();
11
+ /**
12
+ * Extract Page Content
13
+ *
14
+ * @param {*} params {}
15
+ * @returns > { tabId, result: { title, url, content }, success: true }
16
+ */
17
+ execute(context: ExecutionContext, params: any): Promise<ExtractContentResult>;
18
+ }
@@ -0,0 +1,12 @@
1
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
2
+ import { TaskPrompt, ElementRect } from '../../types/tools.types';
3
+ /**
4
+ * Find Element Position
5
+ */
6
+ export declare class FindElementPosition implements Tool<TaskPrompt, ElementRect | null> {
7
+ name: string;
8
+ description: string;
9
+ input_schema: InputSchema;
10
+ constructor();
11
+ execute(context: ExecutionContext, params: TaskPrompt): Promise<ElementRect | null>;
12
+ }
@@ -0,0 +1,10 @@
1
+ import { ElementRect } from '../../types/tools.types';
2
+ export declare function exportFile(filename: string, type: string, content: string): void;
3
+ export declare function xpath(element: any): string;
4
+ export declare function queryWithXpath(xpath: string): any;
5
+ /**
6
+ * Extract the elements related to html operability and wrap them into pseudo-html code.
7
+ */
8
+ export declare function extractOperableElements(): string;
9
+ export declare function clickOperableElement(id: any): any;
10
+ export declare function getOperableElementRect(id: any): ElementRect | null;
@@ -0,0 +1,11 @@
1
+ import { BrowserUse } from './browser_use';
2
+ import { ElementClick } from './element_click';
3
+ import { ExportFile } from './export_file';
4
+ import { ExtractContent } from './extract_content';
5
+ import { FindElementPosition } from './find_element_position';
6
+ import { OpenUrl } from './open_url';
7
+ import { Screenshot } from './screenshot';
8
+ import { TabManagement } from './tab_management';
9
+ import { WebSearch } from './web_search';
10
+ import { RequestLogin } from './request_login';
11
+ export { BrowserUse, ElementClick, ExportFile, ExtractContent, FindElementPosition, OpenUrl, Screenshot, TabManagement, WebSearch, RequestLogin, };