@eko-ai/eko 1.0.9 → 1.0.11

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 (286) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +139 -139
  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 +12 -4
  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/utils.d.ts +1 -1
  11. package/dist/extension.cjs.js +117 -111
  12. package/dist/extension.esm.js +117 -111
  13. package/dist/extension_content_script.js +79 -61
  14. package/dist/fellou.cjs.js +18 -18
  15. package/dist/fellou.esm.js +18 -18
  16. package/dist/index.cjs.js +262 -172
  17. package/dist/index.esm.js +262 -172
  18. package/dist/jest.config.js +10 -0
  19. package/dist/jest.config.js.map +1 -0
  20. package/dist/models/workflow.d.ts +3 -1
  21. package/dist/nodejs.cjs.js +1651 -1633
  22. package/dist/nodejs.esm.js +1651 -1633
  23. package/dist/rollup.config.js +171 -0
  24. package/dist/rollup.config.js.map +1 -0
  25. package/dist/script.js +10 -0
  26. package/dist/script.js.map +1 -0
  27. package/dist/services/llm/deepseek-provider.d.ts +13 -0
  28. package/dist/services/llm/provider-factory.d.ts +4 -0
  29. package/dist/services/llm/siliconflow-provider.d.ts +13 -0
  30. package/dist/services/parser/workflow-parser.d.ts +2 -1
  31. package/dist/services/workflow/generator.d.ts +3 -2
  32. package/dist/src/core/eko.js +99 -0
  33. package/dist/src/core/eko.js.map +1 -0
  34. package/dist/src/core/tool-registry.js +51 -0
  35. package/dist/src/core/tool-registry.js.map +1 -0
  36. package/dist/src/extension/content/index.js +409 -0
  37. package/dist/src/extension/content/index.js.map +1 -0
  38. package/dist/src/extension/core.js +29 -0
  39. package/dist/src/extension/core.js.map +1 -0
  40. package/dist/src/extension/index.js +12 -0
  41. package/dist/src/extension/index.js.map +1 -0
  42. package/dist/src/extension/script/bing.js +25 -0
  43. package/dist/src/extension/script/bing.js.map +1 -0
  44. package/dist/src/extension/script/build_dom_tree.js +585 -0
  45. package/dist/src/extension/script/build_dom_tree.js.map +1 -0
  46. package/dist/src/extension/script/common.js +203 -0
  47. package/dist/src/extension/script/common.js.map +1 -0
  48. package/dist/src/extension/script/duckduckgo.js +25 -0
  49. package/dist/src/extension/script/duckduckgo.js.map +1 -0
  50. package/dist/src/extension/script/google.js +26 -0
  51. package/dist/src/extension/script/google.js.map +1 -0
  52. package/dist/src/extension/tools/browser.js +174 -0
  53. package/dist/src/extension/tools/browser.js.map +1 -0
  54. package/dist/src/extension/tools/browser_use.js +186 -0
  55. package/dist/src/extension/tools/browser_use.js.map +1 -0
  56. package/dist/src/extension/tools/element_click.js +123 -0
  57. package/dist/src/extension/tools/element_click.js.map +1 -0
  58. package/dist/src/extension/tools/export_file.js +93 -0
  59. package/dist/src/extension/tools/export_file.js.map +1 -0
  60. package/dist/src/extension/tools/extract_content.js +38 -0
  61. package/dist/src/extension/tools/extract_content.js.map +1 -0
  62. package/dist/src/extension/tools/find_element_position.js +125 -0
  63. package/dist/src/extension/tools/find_element_position.js.map +1 -0
  64. package/dist/src/extension/tools/html_script.js +219 -0
  65. package/dist/src/extension/tools/html_script.js.map +1 -0
  66. package/dist/src/extension/tools/index.js +12 -0
  67. package/dist/src/extension/tools/index.js.map +1 -0
  68. package/dist/src/extension/tools/open_url.js +68 -0
  69. package/dist/src/extension/tools/open_url.js.map +1 -0
  70. package/dist/src/extension/tools/request_login.js +87 -0
  71. package/dist/src/extension/tools/request_login.js.map +1 -0
  72. package/dist/src/extension/tools/screenshot.js +26 -0
  73. package/dist/src/extension/tools/screenshot.js.map +1 -0
  74. package/dist/src/extension/tools/tab_management.js +160 -0
  75. package/dist/src/extension/tools/tab_management.js.map +1 -0
  76. package/dist/src/extension/tools/web_search.js +281 -0
  77. package/dist/src/extension/tools/web_search.js.map +1 -0
  78. package/dist/src/extension/utils.js +244 -0
  79. package/dist/src/extension/utils.js.map +1 -0
  80. package/dist/src/fellou/computer.js +104 -0
  81. package/dist/src/fellou/computer.js.map +1 -0
  82. package/dist/src/fellou/index.js +7 -0
  83. package/dist/src/fellou/index.js.map +1 -0
  84. package/dist/src/fellou/tools/computer_use.js +111 -0
  85. package/dist/src/fellou/tools/computer_use.js.map +1 -0
  86. package/dist/src/index.js +9 -0
  87. package/dist/src/index.js.map +1 -0
  88. package/dist/src/models/action.js +364 -0
  89. package/dist/src/models/action.js.map +1 -0
  90. package/dist/src/models/workflow.js +120 -0
  91. package/dist/src/models/workflow.js.map +1 -0
  92. package/dist/src/nodejs/core.js +18 -0
  93. package/dist/src/nodejs/core.js.map +1 -0
  94. package/dist/src/nodejs/index.js +6 -0
  95. package/dist/src/nodejs/index.js.map +1 -0
  96. package/dist/src/nodejs/script/build_dom_tree.js +586 -0
  97. package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
  98. package/dist/src/nodejs/tools/browser_use.js +458 -0
  99. package/dist/src/nodejs/tools/browser_use.js.map +1 -0
  100. package/dist/src/nodejs/tools/command_execute.js +65 -0
  101. package/dist/src/nodejs/tools/command_execute.js.map +1 -0
  102. package/dist/src/nodejs/tools/file_read.js +45 -0
  103. package/dist/src/nodejs/tools/file_read.js.map +1 -0
  104. package/dist/src/nodejs/tools/file_write.js +95 -0
  105. package/dist/src/nodejs/tools/file_write.js.map +1 -0
  106. package/dist/src/nodejs/tools/index.js +5 -0
  107. package/dist/src/nodejs/tools/index.js.map +1 -0
  108. package/dist/src/schemas/workflow.schema.js +64 -0
  109. package/dist/src/schemas/workflow.schema.js.map +1 -0
  110. package/dist/src/services/llm/claude-provider.js +140 -0
  111. package/dist/src/services/llm/claude-provider.js.map +1 -0
  112. package/dist/src/services/llm/deepseek-provider.js +432 -0
  113. package/dist/src/services/llm/deepseek-provider.js.map +1 -0
  114. package/dist/src/services/llm/glm-provider.js +317 -0
  115. package/dist/src/services/llm/glm-provider.js.map +1 -0
  116. package/dist/src/services/llm/openai-provider copy.js +317 -0
  117. package/dist/src/services/llm/openai-provider copy.js.map +1 -0
  118. package/dist/src/services/llm/openai-provider.js +317 -0
  119. package/dist/src/services/llm/openai-provider.js.map +1 -0
  120. package/dist/src/services/parser/workflow-parser.js +208 -0
  121. package/dist/src/services/parser/workflow-parser.js.map +1 -0
  122. package/dist/src/services/workflow/generator.js +105 -0
  123. package/dist/src/services/workflow/generator.js.map +1 -0
  124. package/dist/src/services/workflow/templates.js +42 -0
  125. package/dist/src/services/workflow/templates.js.map +1 -0
  126. package/dist/src/types/action.types.js +2 -0
  127. package/dist/src/types/action.types.js.map +1 -0
  128. package/dist/src/types/eko.types.js +2 -0
  129. package/dist/src/types/eko.types.js.map +1 -0
  130. package/dist/src/types/index.js +6 -0
  131. package/dist/src/types/index.js.map +1 -0
  132. package/dist/src/types/llm.types.js +2 -0
  133. package/dist/src/types/llm.types.js.map +1 -0
  134. package/dist/src/types/parser.types.js +2 -0
  135. package/dist/src/types/parser.types.js.map +1 -0
  136. package/dist/src/types/tools.types.js +2 -0
  137. package/dist/src/types/tools.types.js.map +1 -0
  138. package/dist/src/types/workflow.types.js +3 -0
  139. package/dist/src/types/workflow.types.js.map +1 -0
  140. package/dist/src/web/core.js +18 -0
  141. package/dist/src/web/core.js.map +1 -0
  142. package/dist/src/web/index.js +9 -0
  143. package/dist/src/web/index.js.map +1 -0
  144. package/dist/src/web/script/build_dom_tree.js +584 -0
  145. package/dist/src/web/script/build_dom_tree.js.map +1 -0
  146. package/dist/src/web/tools/browser.js +249 -0
  147. package/dist/src/web/tools/browser.js.map +1 -0
  148. package/dist/src/web/tools/browser_use.js +176 -0
  149. package/dist/src/web/tools/browser_use.js.map +1 -0
  150. package/dist/src/web/tools/element_click.js +121 -0
  151. package/dist/src/web/tools/element_click.js.map +1 -0
  152. package/dist/src/web/tools/export_file.js +74 -0
  153. package/dist/src/web/tools/export_file.js.map +1 -0
  154. package/dist/src/web/tools/extract_content.js +24 -0
  155. package/dist/src/web/tools/extract_content.js.map +1 -0
  156. package/dist/src/web/tools/find_element_position.js +121 -0
  157. package/dist/src/web/tools/find_element_position.js.map +1 -0
  158. package/dist/src/web/tools/html_script.js +219 -0
  159. package/dist/src/web/tools/html_script.js.map +1 -0
  160. package/dist/src/web/tools/index.js +8 -0
  161. package/dist/src/web/tools/index.js.map +1 -0
  162. package/dist/src/web/tools/screenshot.js +24 -0
  163. package/dist/src/web/tools/screenshot.js.map +1 -0
  164. package/dist/test/integration/claude-provider.test.js +170 -0
  165. package/dist/test/integration/claude-provider.test.js.map +1 -0
  166. package/dist/test/integration/deepseek-provider.test.js +171 -0
  167. package/dist/test/integration/deepseek-provider.test.js.map +1 -0
  168. package/dist/test/integration/glm-provider.test.js +173 -0
  169. package/dist/test/integration/glm-provider.test.js.map +1 -0
  170. package/dist/test/integration/openai-provider.test copy.js +170 -0
  171. package/dist/test/integration/openai-provider.test copy.js.map +1 -0
  172. package/dist/test/integration/openai-provider.test.js +170 -0
  173. package/dist/test/integration/openai-provider.test.js.map +1 -0
  174. package/dist/test/integration/qwen-provider.js +170 -0
  175. package/dist/test/integration/qwen-provider.js.map +1 -0
  176. package/dist/test/integration/qwen-provider.test copy.js +170 -0
  177. package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
  178. package/dist/test/integration/qwen-provider.test.js +170 -0
  179. package/dist/test/integration/qwen-provider.test.js.map +1 -0
  180. package/dist/test/integration/workflow.execution.test.js +152 -0
  181. package/dist/test/integration/workflow.execution.test.js.map +1 -0
  182. package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
  183. package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
  184. package/dist/test/integration/workflow.generator.test.js +207 -0
  185. package/dist/test/integration/workflow.generator.test.js.map +1 -0
  186. package/dist/test/unit/action.test.js +186 -0
  187. package/dist/test/unit/action.test.js.map +1 -0
  188. package/dist/test/unit/tool-registry.test.js +99 -0
  189. package/dist/test/unit/tool-registry.test.js.map +1 -0
  190. package/dist/test/unit/workflow-parser.test.js +189 -0
  191. package/dist/test/unit/workflow-parser.test.js.map +1 -0
  192. package/dist/test/unit/workflow.test.js +102 -0
  193. package/dist/test/unit/workflow.test.js.map +1 -0
  194. package/dist/types/action.types.d.ts +2 -0
  195. package/dist/types/eko.types.d.ts +4 -1
  196. package/dist/types/jest.config.d.ts +10 -0
  197. package/dist/types/llm.types.d.ts +0 -2
  198. package/dist/types/rollup.config.d.ts +16 -0
  199. package/dist/types/script.d.ts +1 -0
  200. package/dist/types/src/core/eko.d.ts +20 -0
  201. package/dist/types/src/core/tool-registry.d.ts +13 -0
  202. package/dist/types/src/extension/content/index.d.ts +16 -0
  203. package/dist/types/src/extension/core.d.ts +11 -0
  204. package/dist/types/src/extension/index.d.ts +7 -0
  205. package/dist/types/src/extension/script/bing.d.ts +0 -0
  206. package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
  207. package/dist/types/src/extension/script/common.d.ts +0 -0
  208. package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
  209. package/dist/types/src/extension/script/google.d.ts +0 -0
  210. package/dist/types/src/extension/tools/browser.d.ts +22 -0
  211. package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
  212. package/dist/types/src/extension/tools/element_click.d.ts +12 -0
  213. package/dist/types/src/extension/tools/export_file.d.ts +18 -0
  214. package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
  215. package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
  216. package/dist/types/src/extension/tools/html_script.d.ts +10 -0
  217. package/dist/types/src/extension/tools/index.d.ts +11 -0
  218. package/dist/types/src/extension/tools/open_url.d.ts +18 -0
  219. package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
  220. package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
  221. package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
  222. package/dist/types/src/extension/tools/web_search.d.ts +18 -0
  223. package/dist/types/src/extension/utils.d.ts +31 -0
  224. package/dist/types/src/fellou/computer.d.ts +20 -0
  225. package/dist/types/src/fellou/index.d.ts +6 -0
  226. package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
  227. package/dist/types/src/index.d.ts +8 -0
  228. package/dist/types/src/models/action.d.ts +22 -0
  229. package/dist/types/src/models/workflow.d.ts +16 -0
  230. package/dist/types/src/nodejs/core.d.ts +2 -0
  231. package/dist/types/src/nodejs/index.d.ts +3 -0
  232. package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
  233. package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
  234. package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
  235. package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
  236. package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
  237. package/dist/types/src/nodejs/tools/index.d.ts +4 -0
  238. package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
  239. package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
  240. package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
  241. package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
  242. package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
  243. package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
  244. package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
  245. package/dist/types/src/services/workflow/generator.d.ts +13 -0
  246. package/dist/types/src/services/workflow/templates.d.ts +8 -0
  247. package/dist/types/src/types/action.types.d.ts +38 -0
  248. package/dist/types/src/types/eko.types.d.ts +21 -0
  249. package/dist/types/src/types/index.d.ts +5 -0
  250. package/dist/types/src/types/llm.types.d.ts +54 -0
  251. package/dist/types/src/types/parser.types.d.ts +9 -0
  252. package/dist/types/src/types/tools.types.d.ts +88 -0
  253. package/dist/types/src/types/workflow.types.d.ts +39 -0
  254. package/dist/types/src/web/core.d.ts +2 -0
  255. package/dist/types/src/web/index.d.ts +5 -0
  256. package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
  257. package/dist/types/src/web/tools/browser.d.ts +21 -0
  258. package/dist/types/src/web/tools/browser_use.d.ts +19 -0
  259. package/dist/types/src/web/tools/element_click.d.ts +12 -0
  260. package/dist/types/src/web/tools/export_file.d.ts +18 -0
  261. package/dist/types/src/web/tools/extract_content.d.ts +17 -0
  262. package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
  263. package/dist/types/src/web/tools/html_script.d.ts +10 -0
  264. package/dist/types/src/web/tools/index.d.ts +7 -0
  265. package/dist/types/src/web/tools/screenshot.d.ts +18 -0
  266. package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
  267. package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
  268. package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
  269. package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
  270. package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
  271. package/dist/types/test/integration/qwen-provider.d.ts +1 -0
  272. package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
  273. package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
  274. package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
  275. package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
  276. package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
  277. package/dist/types/test/unit/action.test.d.ts +1 -0
  278. package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
  279. package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
  280. package/dist/types/test/unit/workflow.test.d.ts +1 -0
  281. package/dist/universal_tools/human/text.d.ts +9 -0
  282. package/dist/web.cjs.js +128 -121
  283. package/dist/web.esm.js +128 -121
  284. package/package.json +106 -106
  285. package/dist/fellou/tools/index.d.ts +0 -2
  286. package/dist/types/framework.types.d.ts +0 -11
@@ -0,0 +1,207 @@
1
+ // test/integration/workflow.generator.test.ts
2
+ import { ClaudeProvider } from '../../src/services/llm/claude-provider';
3
+ import { WorkflowGenerator } from '../../src/services/workflow/generator';
4
+ import { ToolRegistry } from '../../src/core/tool-registry';
5
+ import { WorkflowParser } from '../../src/services/parser/workflow-parser';
6
+ import * as fs from 'fs/promises';
7
+ import * as path from 'path';
8
+ import dotenv from 'dotenv';
9
+ dotenv.config();
10
+ // Mock browser tool base class to avoid duplicate code
11
+ class BrowserTool {
12
+ constructor(name, description, input_schema) {
13
+ this.name = name;
14
+ this.description = description;
15
+ this.input_schema = input_schema;
16
+ }
17
+ async execute(params) {
18
+ throw new Error('Not implemented');
19
+ }
20
+ }
21
+ // Create mock browser tools
22
+ function createBrowserTools() {
23
+ return [
24
+ new BrowserTool('open_url', 'Opens a specified URL in the current browser tab', {
25
+ type: 'object',
26
+ properties: {
27
+ url: {
28
+ type: 'string',
29
+ description: 'The URL to open'
30
+ }
31
+ },
32
+ required: ['url']
33
+ }),
34
+ new BrowserTool('find_dom_object', 'Finds a DOM element using CSS selector, returns multiple elements if found', {
35
+ type: 'object',
36
+ properties: {
37
+ selector: {
38
+ type: 'string',
39
+ description: 'CSS selector to find elements'
40
+ },
41
+ waitForElement: {
42
+ type: 'boolean',
43
+ description: 'Whether to wait for elements to appear'
44
+ },
45
+ timeout: {
46
+ type: 'integer',
47
+ description: 'Maximum time to wait in milliseconds'
48
+ }
49
+ },
50
+ required: ['selector']
51
+ }),
52
+ new BrowserTool('click_dom_object', 'Clicks on a DOM element found by CSS selector', {
53
+ type: 'object',
54
+ properties: {
55
+ selector: {
56
+ type: 'string',
57
+ description: 'CSS selector of element to click'
58
+ }
59
+ },
60
+ required: ['selector']
61
+ }),
62
+ new BrowserTool('input_text', 'Types text into a form field', {
63
+ type: 'object',
64
+ properties: {
65
+ selector: {
66
+ type: 'string',
67
+ description: 'CSS selector of input element'
68
+ },
69
+ text: {
70
+ type: 'string',
71
+ description: 'Text to type'
72
+ },
73
+ clear: {
74
+ type: 'boolean',
75
+ description: 'Whether to clear existing text first'
76
+ }
77
+ },
78
+ required: ['selector', 'text']
79
+ }),
80
+ new BrowserTool('copy_dom_object_text', 'Extracts text content from DOM elements matching a selector', {
81
+ type: 'object',
82
+ properties: {
83
+ selector: {
84
+ type: 'string',
85
+ description: 'CSS selector of elements to copy text from'
86
+ }
87
+ },
88
+ required: ['selector']
89
+ }),
90
+ new BrowserTool('save_file', 'Saves content to a file', {
91
+ type: 'object',
92
+ properties: {
93
+ content: {
94
+ type: 'string',
95
+ description: 'Content to save'
96
+ },
97
+ filename: {
98
+ type: 'string',
99
+ description: 'Name of the file'
100
+ },
101
+ type: {
102
+ type: 'string',
103
+ description: 'File type',
104
+ enum: ['text/plain', 'text/csv', 'text/html', 'application/json']
105
+ }
106
+ },
107
+ required: ['content', 'filename']
108
+ })
109
+ ];
110
+ }
111
+ const ENABLE_INTEGRATION_TESTS = process.env.ENABLE_INTEGRATION_TESTS === 'true';
112
+ const describeIntegration = ENABLE_INTEGRATION_TESTS ? describe : describe.skip;
113
+ describeIntegration('WorkflowGenerator Integration', () => {
114
+ let toolRegistry;
115
+ let generator;
116
+ // Helper function to save workflow DSL to file
117
+ async function saveWorkflowToFile(dsl, filename) {
118
+ const testOutputDir = path.join(__dirname, '../fixtures/generated');
119
+ await fs.mkdir(testOutputDir, { recursive: true });
120
+ await fs.writeFile(path.join(testOutputDir, filename), dsl, 'utf-8');
121
+ }
122
+ beforeAll(() => {
123
+ const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
124
+ if (!ANTHROPIC_API_KEY) {
125
+ throw new Error('ANTHROPIC_API_KEY environment variable is required for integration tests');
126
+ }
127
+ // Set up registry with browser tools
128
+ toolRegistry = new ToolRegistry();
129
+ createBrowserTools().forEach(tool => toolRegistry.registerTool(tool));
130
+ // Create generator with Claude provider
131
+ const llmProvider = new ClaudeProvider(ANTHROPIC_API_KEY);
132
+ generator = new WorkflowGenerator(llmProvider, toolRegistry);
133
+ });
134
+ it('should generate workflow for finding Chromium developers', async () => {
135
+ const prompt = "Find Chromium developers from Github, collect the profiles, and summarize the results to CSV";
136
+ // Generate workflow
137
+ const workflow = await generator.generateWorkflow(prompt);
138
+ // Convert to DSL for validation and inspection
139
+ const dsl = WorkflowParser.serialize(workflow);
140
+ // Save DSL for human inspection
141
+ await saveWorkflowToFile(dsl, 'github_chromium_workflow.json');
142
+ // Validate the generated workflow
143
+ const validationResult = WorkflowParser.validate(JSON.parse(dsl));
144
+ // Log validation errors if any (helpful for debugging)
145
+ if (!validationResult.valid) {
146
+ console.error('Validation errors:', JSON.stringify(validationResult.errors, null, 2));
147
+ }
148
+ // Assert validation
149
+ expect(validationResult.valid).toBe(true);
150
+ expect(validationResult.errors).toHaveLength(0);
151
+ // Basic structure checks
152
+ expect(workflow.id).toBeDefined();
153
+ expect(workflow.name).toBeDefined();
154
+ expect(workflow.nodes).toBeDefined();
155
+ expect(workflow.nodes.length).toBeGreaterThan(0);
156
+ // Log workflow structure for inspection
157
+ console.log('\nGenerated Workflow Structure:');
158
+ console.log('ID:', workflow.id);
159
+ console.log('Name:', workflow.name);
160
+ console.log('Number of nodes:', workflow.nodes.length);
161
+ console.log('Nodes:', workflow.nodes.map(n => ({
162
+ id: n.id,
163
+ name: n.name,
164
+ dependencies: n.dependencies,
165
+ action: {
166
+ type: n.action.type,
167
+ tools: n.action.tools.map(t => t.name)
168
+ }
169
+ })));
170
+ // Verify tool usage
171
+ const usedTools = new Set();
172
+ workflow.nodes.forEach(node => {
173
+ node.action.tools.forEach(tool => {
174
+ usedTools.add(tool.name);
175
+ });
176
+ });
177
+ console.log('\nTools used:', Array.from(usedTools));
178
+ // Expected tools for this workflow
179
+ const expected_tools = new Set([
180
+ 'open_url', // For navigating to Github
181
+ 'input_text', // For entering search terms
182
+ 'click_dom_object', // For interaction
183
+ 'find_dom_object', // For finding profile elements
184
+ 'copy_dom_object_text', // For extracting profile data
185
+ 'save_file', // For saving the CSV
186
+ 'write_context' // For storing data in context
187
+ ]);
188
+ // Verify reasonable tool usage
189
+ expect(usedTools.size).toBeGreaterThanOrEqual(3);
190
+ usedTools.forEach(tool => {
191
+ expect(expected_tools).toContain(tool);
192
+ });
193
+ // Verify workflow has proper node dependencies
194
+ expect(workflow.validateDAG()).toBe(true);
195
+ // The last node should use save_file tool to create CSV
196
+ const lastNode = workflow.nodes[workflow.nodes.length - 1];
197
+ expect(lastNode.action.tools.some(t => t.name === 'save_file')).toBe(true);
198
+ // First node should have no dependencies
199
+ const firstNode = workflow.nodes[0];
200
+ expect(firstNode.dependencies.length).toBe(0);
201
+ // Other nodes should have dependencies
202
+ workflow.nodes.slice(1).forEach(node => {
203
+ expect(node.dependencies.length).toBeGreaterThan(0);
204
+ });
205
+ }, 30000); // Increased timeout for LLM
206
+ });
207
+ //# sourceMappingURL=workflow.generator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workflow.generator.test.js","sourceRoot":"","sources":["../../../test/integration/workflow.generator.test.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,uDAAuD;AACvD,MAAM,WAAW;IACf,YACS,IAAY,EACZ,WAAmB,EACnB,YAAyB;QAFzB,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAQ;QACnB,iBAAY,GAAZ,YAAY,CAAa;IAC/B,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,MAAe;QAC3B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;I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CAAC,CAAC,CAAC;QAC3D,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAE3E,yCAAyC;QACzC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,CAAC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAE9C,uCAAuC;QACvC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACrC,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,4BAA4B;AACzC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,186 @@
1
+ import { ActionImpl } from '../../src/models/action';
2
+ // Mock tool for testing
3
+ class MockTool {
4
+ constructor(name, description = 'Mock tool for testing', shouldFail = false) {
5
+ this.name = name;
6
+ this.description = description;
7
+ this.shouldFail = shouldFail;
8
+ this.input_schema = {
9
+ type: 'object',
10
+ properties: {
11
+ testParam: { type: 'string' },
12
+ },
13
+ required: ['testParam'],
14
+ };
15
+ }
16
+ async execute(context, params) {
17
+ if (this.shouldFail) {
18
+ throw new Error('Tool execution failed');
19
+ }
20
+ return { success: true, params };
21
+ }
22
+ }
23
+ // Mock LLM provider
24
+ class MockLLMProvider {
25
+ constructor(toolCallResponses = [], shouldFail = false, counter = 0) {
26
+ this.toolCallResponses = toolCallResponses;
27
+ this.shouldFail = shouldFail;
28
+ this.counter = counter;
29
+ }
30
+ async generateText() {
31
+ if (this.shouldFail) {
32
+ throw new Error('LLM generation failed');
33
+ }
34
+ return {
35
+ content: 'Test response',
36
+ toolCalls: this.toolCallResponses,
37
+ };
38
+ }
39
+ async generateStream(messages, params, handler) {
40
+ var _a, _b, _c, _d;
41
+ if (this.shouldFail) {
42
+ (_a = handler.onError) === null || _a === void 0 ? void 0 : _a.call(handler, new Error('Stream generation failed'));
43
+ return;
44
+ }
45
+ // Simulate thinking output
46
+ (_b = handler.onContent) === null || _b === void 0 ? void 0 : _b.call(handler, 'Thinking about the task...');
47
+ // Process each tool call
48
+ const toolCall = this.toolCallResponses[this.counter++];
49
+ (_c = handler.onToolUse) === null || _c === void 0 ? void 0 : _c.call(handler, {
50
+ id: `tool-${Math.random()}`,
51
+ name: toolCall.name,
52
+ input: toolCall.input,
53
+ });
54
+ // Final response
55
+ (_d = handler.onComplete) === null || _d === void 0 ? void 0 : _d.call(handler, {
56
+ content: [
57
+ { type: 'text', text: 'Thinking about the task...' },
58
+ {
59
+ type: 'tool_use',
60
+ id: `tool-${Math.random()}`,
61
+ name: toolCall.name,
62
+ input: toolCall.input
63
+ }
64
+ ],
65
+ toolCalls: [{
66
+ id: `tool-${Math.random()}`,
67
+ name: toolCall.name,
68
+ input: toolCall.input
69
+ }],
70
+ stop_reason: 'tool_use',
71
+ textContent: null // No text content when using tools
72
+ });
73
+ }
74
+ }
75
+ describe('ActionImpl', () => {
76
+ let mockTool;
77
+ let mockLLMProvider;
78
+ let context;
79
+ beforeEach(() => {
80
+ mockTool = new MockTool('test_tool');
81
+ mockLLMProvider = new MockLLMProvider();
82
+ context = {
83
+ llmProvider: mockLLMProvider,
84
+ variables: new Map(),
85
+ tools: new Map(),
86
+ };
87
+ });
88
+ describe('constructor', () => {
89
+ it('should create an action with tools including write_context', () => {
90
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
91
+ expect(action.tools).toHaveLength(2); // Original tool + write_context
92
+ expect(action.tools.some((t) => t.name === 'write_context')).toBeTruthy();
93
+ expect(action.tools.some((t) => t.name === 'test_tool')).toBeTruthy();
94
+ });
95
+ });
96
+ describe('execute', () => {
97
+ it('should handle successful tool execution', async () => {
98
+ // Setup LLM to make a tool call
99
+ mockLLMProvider = new MockLLMProvider([
100
+ { name: 'test_tool', input: { testParam: 'test' } },
101
+ { name: 'return_output', input: { value: 'test return' } },
102
+ ]);
103
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
104
+ await action.execute('Test input', context);
105
+ // Tool was successful, no errors thrown
106
+ });
107
+ it('should handle tool execution failure', async () => {
108
+ // Setup failing tool
109
+ mockTool = new MockTool('test_tool', 'Mock tool', true);
110
+ mockLLMProvider = new MockLLMProvider([
111
+ { name: 'test_tool', input: { testParam: 'test' } },
112
+ { name: 'return_output', input: { value: 'test return' } },
113
+ ]);
114
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
115
+ await action.execute('Test input', context);
116
+ // Should handle tool failure gracefully, no error thrown
117
+ });
118
+ it('should handle LLM provider failure', async () => {
119
+ mockLLMProvider = new MockLLMProvider([], true);
120
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
121
+ await expect(action.execute('Test input', context)).resolves.toBeDefined();
122
+ // Should handle LLM failure gracefully
123
+ });
124
+ it('should properly use write_context tool', async () => {
125
+ // Setup LLM to make a write_context call
126
+ mockLLMProvider = new MockLLMProvider([
127
+ {
128
+ name: 'write_context',
129
+ input: { key: 'test_key', value: JSON.stringify({ data: 'test' }) },
130
+ },
131
+ { name: 'return_output', input: { value: 'test return' } },
132
+ ]);
133
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
134
+ await action.execute('Test input', context);
135
+ // Check if value was written to context
136
+ expect(context.variables.get('test_key')).toEqual({ data: 'test' });
137
+ });
138
+ it('should handle non-JSON values in write_context', async () => {
139
+ // Setup LLM to make a write_context call with string value
140
+ mockLLMProvider = new MockLLMProvider([
141
+ {
142
+ name: 'write_context',
143
+ input: { key: 'test_key', value: 'plain text value' },
144
+ },
145
+ { name: 'return_output', input: { value: 'test return' } },
146
+ ]);
147
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
148
+ await action.execute('Test input', context);
149
+ // Check if value was written to context as string
150
+ expect(context.variables.get('test_key')).toBe('plain text value');
151
+ });
152
+ it('should include context variables in user prompt', async () => {
153
+ // Setup context with some variables
154
+ context.variables.set('existingVar', 'test value');
155
+ // Create mock LLM provider that captures messages
156
+ const capturedMessages = [];
157
+ const mockLLMProviderWithCapture = new MockLLMProvider();
158
+ mockLLMProviderWithCapture.generateStream = async (messages, params, handler) => {
159
+ var _a;
160
+ capturedMessages.push(...messages);
161
+ // Continue with normal stream handling
162
+ await ((_a = handler.onContent) === null || _a === void 0 ? void 0 : _a.call(handler, 'Test content'));
163
+ };
164
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProviderWithCapture);
165
+ await action.execute('Test input', context);
166
+ // Verify system prompt includes context variables
167
+ const initialPrompt = capturedMessages[1].content;
168
+ expect(initialPrompt).toContain('existingVar');
169
+ expect(initialPrompt).toContain('test value');
170
+ });
171
+ it('should merge action tools with context tools', async () => {
172
+ var _a;
173
+ const contextTool = new MockTool('context_tool');
174
+ (_a = context.tools) === null || _a === void 0 ? void 0 : _a.set(contextTool.name, contextTool);
175
+ mockLLMProvider = new MockLLMProvider([
176
+ { name: 'context_tool', input: { testParam: 'test' } },
177
+ { name: 'test_tool', input: { testParam: 'test' } },
178
+ { name: 'return_output', input: { value: 'test return' } },
179
+ ]);
180
+ const action = ActionImpl.createPromptAction('test_action', 'This is an action for testing purposes', [mockTool], mockLLMProvider);
181
+ await action.execute('Test input', context);
182
+ // Both tools should have been accessible
183
+ });
184
+ });
185
+ });
186
+ //# sourceMappingURL=action.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.test.js","sourceRoot":"","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EAAE,WAAW,CAAC,CAAC;YAElD,eAAe,GAAG,IAAI,eAAe,CAAC;gBACpC,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;gBACtD,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE;gBACnD,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE;aAC3D,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,aAAa,EAAE,wCAAwC,EAAE,CAAC,QAAQ,CAAC,EAAE,eAAe,CAAC,CAAC;YAEnI,MAAM,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAC5C,yCAAyC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,99 @@
1
+ import { ToolRegistry } from '../../src/core/tool-registry';
2
+ class MockTool {
3
+ constructor(name, description = 'Mock tool description', input_schema = {
4
+ type: 'object',
5
+ properties: {
6
+ param: { type: 'string' }
7
+ }
8
+ }) {
9
+ this.name = name;
10
+ this.description = description;
11
+ this.input_schema = input_schema;
12
+ }
13
+ async execute(params) {
14
+ return { executed: true };
15
+ }
16
+ }
17
+ describe('ToolRegistry', () => {
18
+ let registry;
19
+ let mockTool;
20
+ beforeEach(() => {
21
+ registry = new ToolRegistry();
22
+ mockTool = new MockTool('mock_tool');
23
+ });
24
+ describe('tool management', () => {
25
+ test('should register a tool successfully', () => {
26
+ registry.registerTool(mockTool);
27
+ expect(registry.getTool('mock_tool')).toBe(mockTool);
28
+ });
29
+ test('should throw when registering duplicate tool', () => {
30
+ registry.registerTool(mockTool);
31
+ expect(() => registry.registerTool(mockTool)).toThrow();
32
+ });
33
+ test('should unregister a tool successfully', () => {
34
+ registry.registerTool(mockTool);
35
+ registry.unregisterTool('mock_tool');
36
+ expect(() => registry.getTool('mock_tool')).toThrow();
37
+ });
38
+ test('should throw when unregistering non-existent tool', () => {
39
+ expect(() => registry.unregisterTool('non_existent')).toThrow();
40
+ });
41
+ test('should check for tool existence correctly', () => {
42
+ registry.registerTool(mockTool);
43
+ expect(registry.hasTools(['mock_tool'])).toBe(true);
44
+ expect(registry.hasTools(['non_existent'])).toBe(false);
45
+ expect(registry.hasTools(['mock_tool', 'non_existent'])).toBe(false);
46
+ });
47
+ });
48
+ describe('tool enumeration', () => {
49
+ beforeEach(() => {
50
+ registry.registerTool(new MockTool('tool1'));
51
+ registry.registerTool(new MockTool('tool2'));
52
+ });
53
+ test('should get all tools', () => {
54
+ const tools = registry.getAllTools();
55
+ expect(tools).toHaveLength(2);
56
+ expect(tools.map(t => t.name)).toEqual(['tool1', 'tool2']);
57
+ });
58
+ test('should get tool definitions', () => {
59
+ const definitions = registry.getToolDefinitions();
60
+ expect(definitions).toHaveLength(2);
61
+ expect(definitions[0]).toHaveProperty('name', 'tool1');
62
+ expect(definitions[0]).toHaveProperty('description');
63
+ expect(definitions[0]).toHaveProperty('input_schema');
64
+ });
65
+ test('should get tool enum', () => {
66
+ const enumValues = registry.getToolEnum();
67
+ expect(enumValues).toEqual(['tool1', 'tool2']);
68
+ });
69
+ });
70
+ describe('workflow schema generation', () => {
71
+ beforeEach(() => {
72
+ registry.registerTool(new MockTool('tool1'));
73
+ registry.registerTool(new MockTool('tool2'));
74
+ });
75
+ test('should generate valid workflow schema', () => {
76
+ const schema = registry.getWorkflowSchema();
77
+ // Basic schema structure
78
+ expect(schema).toHaveProperty('type', 'object');
79
+ expect(schema.properties).toHaveProperty('nodes');
80
+ // Tool enum in action schema
81
+ const actionTools = schema.properties.nodes.items.properties.action.properties.tools;
82
+ expect(actionTools.items.enum).toEqual(['tool1', 'tool2']);
83
+ });
84
+ test('should update schema when tools change', () => {
85
+ let schema = registry.getWorkflowSchema();
86
+ expect(schema.properties.nodes.items.properties.action.properties.tools.items.enum)
87
+ .toEqual(['tool1', 'tool2']);
88
+ registry.registerTool(new MockTool('tool3'));
89
+ schema = registry.getWorkflowSchema();
90
+ expect(schema.properties.nodes.items.properties.action.properties.tools.items.enum)
91
+ .toEqual(['tool1', 'tool2', 'tool3']);
92
+ registry.unregisterTool('tool2');
93
+ schema = registry.getWorkflowSchema();
94
+ expect(schema.properties.nodes.items.properties.action.properties.tools.items.enum)
95
+ .toEqual(['tool1', 'tool3']);
96
+ });
97
+ });
98
+ });
99
+ //# sourceMappingURL=tool-registry.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-registry.test.js","sourceRoot":"","sources":["../../../test/unit/tool-registry.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAG5D,MAAM,QAAQ;IACZ,YACS,IAAY,EACZ,cAAsB,uBAAuB,EAC7C,eAA4B;QACjC,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC1B;KACF;QAPM,SAAI,GAAJ,IAAI,CAAQ;QACZ,gBAAW,GAAX,WAAW,CAAkC;QAC7C,iBAAY,GAAZ,YAAY,CAKlB;IACA,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,MAAe;QAC3B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5B,CAAC;CACF;AAED,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,QAAsB,CAAC;IAC3B,IAAI,QAAwB,CAAC;IAE7B,UAAU,CAAC,GAAG,EAAE;QACd,QAAQ,GAAG,IAAI,YAAY,EAAE,CAAC;QAC9B,QAAQ,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC/B,IAAI,CAAC,qCAAqC,EAAE,GAA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