@eko-ai/eko 1.0.9 → 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 (280) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +139 -139
  3. package/dist/extension/script/bing.js +0 -0
  4. package/dist/extension/script/build_dom_tree.js +661 -661
  5. package/dist/extension/script/common.js +0 -0
  6. package/dist/extension/script/duckduckgo.js +0 -0
  7. package/dist/extension/script/google.js +0 -0
  8. package/dist/extension/tools/cancel_workflow.d.ts +9 -0
  9. package/dist/extension.cjs.js +75 -75
  10. package/dist/extension.esm.js +75 -75
  11. package/dist/extension_content_script.js +55 -55
  12. package/dist/fellou.cjs.js +18 -18
  13. package/dist/fellou.esm.js +18 -18
  14. package/dist/index.cjs.js +4356 -4255
  15. package/dist/index.d.ts +2 -1
  16. package/dist/index.esm.js +4356 -4256
  17. package/dist/jest.config.js +10 -0
  18. package/dist/jest.config.js.map +1 -0
  19. package/dist/nodejs.cjs.js +1627 -1627
  20. package/dist/nodejs.esm.js +1627 -1627
  21. package/dist/rollup.config.js +171 -0
  22. package/dist/rollup.config.js.map +1 -0
  23. package/dist/script.js +10 -0
  24. package/dist/script.js.map +1 -0
  25. package/dist/services/llm/deepseek-provider.d.ts +13 -0
  26. package/dist/services/llm/provider-factory.d.ts +4 -0
  27. package/dist/services/llm/siliconflow-provider.d.ts +13 -0
  28. package/dist/services/workflow/generator.d.ts +1 -0
  29. package/dist/src/core/eko.js +99 -0
  30. package/dist/src/core/eko.js.map +1 -0
  31. package/dist/src/core/tool-registry.js +51 -0
  32. package/dist/src/core/tool-registry.js.map +1 -0
  33. package/dist/src/extension/content/index.js +409 -0
  34. package/dist/src/extension/content/index.js.map +1 -0
  35. package/dist/src/extension/core.js +29 -0
  36. package/dist/src/extension/core.js.map +1 -0
  37. package/dist/src/extension/index.js +12 -0
  38. package/dist/src/extension/index.js.map +1 -0
  39. package/dist/src/extension/script/bing.js +25 -0
  40. package/dist/src/extension/script/bing.js.map +1 -0
  41. package/dist/src/extension/script/build_dom_tree.js +585 -0
  42. package/dist/src/extension/script/build_dom_tree.js.map +1 -0
  43. package/dist/src/extension/script/common.js +203 -0
  44. package/dist/src/extension/script/common.js.map +1 -0
  45. package/dist/src/extension/script/duckduckgo.js +25 -0
  46. package/dist/src/extension/script/duckduckgo.js.map +1 -0
  47. package/dist/src/extension/script/google.js +26 -0
  48. package/dist/src/extension/script/google.js.map +1 -0
  49. package/dist/src/extension/tools/browser.js +174 -0
  50. package/dist/src/extension/tools/browser.js.map +1 -0
  51. package/dist/src/extension/tools/browser_use.js +186 -0
  52. package/dist/src/extension/tools/browser_use.js.map +1 -0
  53. package/dist/src/extension/tools/element_click.js +123 -0
  54. package/dist/src/extension/tools/element_click.js.map +1 -0
  55. package/dist/src/extension/tools/export_file.js +93 -0
  56. package/dist/src/extension/tools/export_file.js.map +1 -0
  57. package/dist/src/extension/tools/extract_content.js +38 -0
  58. package/dist/src/extension/tools/extract_content.js.map +1 -0
  59. package/dist/src/extension/tools/find_element_position.js +125 -0
  60. package/dist/src/extension/tools/find_element_position.js.map +1 -0
  61. package/dist/src/extension/tools/html_script.js +219 -0
  62. package/dist/src/extension/tools/html_script.js.map +1 -0
  63. package/dist/src/extension/tools/index.js +12 -0
  64. package/dist/src/extension/tools/index.js.map +1 -0
  65. package/dist/src/extension/tools/open_url.js +68 -0
  66. package/dist/src/extension/tools/open_url.js.map +1 -0
  67. package/dist/src/extension/tools/request_login.js +87 -0
  68. package/dist/src/extension/tools/request_login.js.map +1 -0
  69. package/dist/src/extension/tools/screenshot.js +26 -0
  70. package/dist/src/extension/tools/screenshot.js.map +1 -0
  71. package/dist/src/extension/tools/tab_management.js +160 -0
  72. package/dist/src/extension/tools/tab_management.js.map +1 -0
  73. package/dist/src/extension/tools/web_search.js +281 -0
  74. package/dist/src/extension/tools/web_search.js.map +1 -0
  75. package/dist/src/extension/utils.js +244 -0
  76. package/dist/src/extension/utils.js.map +1 -0
  77. package/dist/src/fellou/computer.js +104 -0
  78. package/dist/src/fellou/computer.js.map +1 -0
  79. package/dist/src/fellou/index.js +7 -0
  80. package/dist/src/fellou/index.js.map +1 -0
  81. package/dist/src/fellou/tools/computer_use.js +111 -0
  82. package/dist/src/fellou/tools/computer_use.js.map +1 -0
  83. package/dist/src/index.js +9 -0
  84. package/dist/src/index.js.map +1 -0
  85. package/dist/src/models/action.js +364 -0
  86. package/dist/src/models/action.js.map +1 -0
  87. package/dist/src/models/workflow.js +120 -0
  88. package/dist/src/models/workflow.js.map +1 -0
  89. package/dist/src/nodejs/core.js +18 -0
  90. package/dist/src/nodejs/core.js.map +1 -0
  91. package/dist/src/nodejs/index.js +6 -0
  92. package/dist/src/nodejs/index.js.map +1 -0
  93. package/dist/src/nodejs/script/build_dom_tree.js +586 -0
  94. package/dist/src/nodejs/script/build_dom_tree.js.map +1 -0
  95. package/dist/src/nodejs/tools/browser_use.js +458 -0
  96. package/dist/src/nodejs/tools/browser_use.js.map +1 -0
  97. package/dist/src/nodejs/tools/command_execute.js +65 -0
  98. package/dist/src/nodejs/tools/command_execute.js.map +1 -0
  99. package/dist/src/nodejs/tools/file_read.js +45 -0
  100. package/dist/src/nodejs/tools/file_read.js.map +1 -0
  101. package/dist/src/nodejs/tools/file_write.js +95 -0
  102. package/dist/src/nodejs/tools/file_write.js.map +1 -0
  103. package/dist/src/nodejs/tools/index.js +5 -0
  104. package/dist/src/nodejs/tools/index.js.map +1 -0
  105. package/dist/src/schemas/workflow.schema.js +64 -0
  106. package/dist/src/schemas/workflow.schema.js.map +1 -0
  107. package/dist/src/services/llm/claude-provider.js +140 -0
  108. package/dist/src/services/llm/claude-provider.js.map +1 -0
  109. package/dist/src/services/llm/deepseek-provider.js +432 -0
  110. package/dist/src/services/llm/deepseek-provider.js.map +1 -0
  111. package/dist/src/services/llm/glm-provider.js +317 -0
  112. package/dist/src/services/llm/glm-provider.js.map +1 -0
  113. package/dist/src/services/llm/openai-provider copy.js +317 -0
  114. package/dist/src/services/llm/openai-provider copy.js.map +1 -0
  115. package/dist/src/services/llm/openai-provider.js +317 -0
  116. package/dist/src/services/llm/openai-provider.js.map +1 -0
  117. package/dist/src/services/parser/workflow-parser.js +208 -0
  118. package/dist/src/services/parser/workflow-parser.js.map +1 -0
  119. package/dist/src/services/workflow/generator.js +105 -0
  120. package/dist/src/services/workflow/generator.js.map +1 -0
  121. package/dist/src/services/workflow/templates.js +42 -0
  122. package/dist/src/services/workflow/templates.js.map +1 -0
  123. package/dist/src/types/action.types.js +2 -0
  124. package/dist/src/types/action.types.js.map +1 -0
  125. package/dist/src/types/eko.types.js +2 -0
  126. package/dist/src/types/eko.types.js.map +1 -0
  127. package/dist/src/types/index.js +6 -0
  128. package/dist/src/types/index.js.map +1 -0
  129. package/dist/src/types/llm.types.js +2 -0
  130. package/dist/src/types/llm.types.js.map +1 -0
  131. package/dist/src/types/parser.types.js +2 -0
  132. package/dist/src/types/parser.types.js.map +1 -0
  133. package/dist/src/types/tools.types.js +2 -0
  134. package/dist/src/types/tools.types.js.map +1 -0
  135. package/dist/src/types/workflow.types.js +3 -0
  136. package/dist/src/types/workflow.types.js.map +1 -0
  137. package/dist/src/web/core.js +18 -0
  138. package/dist/src/web/core.js.map +1 -0
  139. package/dist/src/web/index.js +9 -0
  140. package/dist/src/web/index.js.map +1 -0
  141. package/dist/src/web/script/build_dom_tree.js +584 -0
  142. package/dist/src/web/script/build_dom_tree.js.map +1 -0
  143. package/dist/src/web/tools/browser.js +249 -0
  144. package/dist/src/web/tools/browser.js.map +1 -0
  145. package/dist/src/web/tools/browser_use.js +176 -0
  146. package/dist/src/web/tools/browser_use.js.map +1 -0
  147. package/dist/src/web/tools/element_click.js +121 -0
  148. package/dist/src/web/tools/element_click.js.map +1 -0
  149. package/dist/src/web/tools/export_file.js +74 -0
  150. package/dist/src/web/tools/export_file.js.map +1 -0
  151. package/dist/src/web/tools/extract_content.js +24 -0
  152. package/dist/src/web/tools/extract_content.js.map +1 -0
  153. package/dist/src/web/tools/find_element_position.js +121 -0
  154. package/dist/src/web/tools/find_element_position.js.map +1 -0
  155. package/dist/src/web/tools/html_script.js +219 -0
  156. package/dist/src/web/tools/html_script.js.map +1 -0
  157. package/dist/src/web/tools/index.js +8 -0
  158. package/dist/src/web/tools/index.js.map +1 -0
  159. package/dist/src/web/tools/screenshot.js +24 -0
  160. package/dist/src/web/tools/screenshot.js.map +1 -0
  161. package/dist/test/integration/claude-provider.test.js +170 -0
  162. package/dist/test/integration/claude-provider.test.js.map +1 -0
  163. package/dist/test/integration/deepseek-provider.test.js +171 -0
  164. package/dist/test/integration/deepseek-provider.test.js.map +1 -0
  165. package/dist/test/integration/glm-provider.test.js +173 -0
  166. package/dist/test/integration/glm-provider.test.js.map +1 -0
  167. package/dist/test/integration/openai-provider.test copy.js +170 -0
  168. package/dist/test/integration/openai-provider.test copy.js.map +1 -0
  169. package/dist/test/integration/openai-provider.test.js +170 -0
  170. package/dist/test/integration/openai-provider.test.js.map +1 -0
  171. package/dist/test/integration/qwen-provider.js +170 -0
  172. package/dist/test/integration/qwen-provider.js.map +1 -0
  173. package/dist/test/integration/qwen-provider.test copy.js +170 -0
  174. package/dist/test/integration/qwen-provider.test copy.js.map +1 -0
  175. package/dist/test/integration/qwen-provider.test.js +170 -0
  176. package/dist/test/integration/qwen-provider.test.js.map +1 -0
  177. package/dist/test/integration/workflow.execution.test.js +152 -0
  178. package/dist/test/integration/workflow.execution.test.js.map +1 -0
  179. package/dist/test/integration/workflow.generation-and-execution.test.js +131 -0
  180. package/dist/test/integration/workflow.generation-and-execution.test.js.map +1 -0
  181. package/dist/test/integration/workflow.generator.test.js +207 -0
  182. package/dist/test/integration/workflow.generator.test.js.map +1 -0
  183. package/dist/test/unit/action.test.js +186 -0
  184. package/dist/test/unit/action.test.js.map +1 -0
  185. package/dist/test/unit/tool-registry.test.js +99 -0
  186. package/dist/test/unit/tool-registry.test.js.map +1 -0
  187. package/dist/test/unit/workflow-parser.test.js +189 -0
  188. package/dist/test/unit/workflow-parser.test.js.map +1 -0
  189. package/dist/test/unit/workflow.test.js +102 -0
  190. package/dist/test/unit/workflow.test.js.map +1 -0
  191. package/dist/types/jest.config.d.ts +10 -0
  192. package/dist/types/rollup.config.d.ts +16 -0
  193. package/dist/types/script.d.ts +1 -0
  194. package/dist/types/src/core/eko.d.ts +20 -0
  195. package/dist/types/src/core/tool-registry.d.ts +13 -0
  196. package/dist/types/src/extension/content/index.d.ts +16 -0
  197. package/dist/types/src/extension/core.d.ts +11 -0
  198. package/dist/types/src/extension/index.d.ts +7 -0
  199. package/dist/types/src/extension/script/bing.d.ts +0 -0
  200. package/dist/types/src/extension/script/build_dom_tree.d.ts +38 -0
  201. package/dist/types/src/extension/script/common.d.ts +0 -0
  202. package/dist/types/src/extension/script/duckduckgo.d.ts +0 -0
  203. package/dist/types/src/extension/script/google.d.ts +0 -0
  204. package/dist/types/src/extension/tools/browser.d.ts +22 -0
  205. package/dist/types/src/extension/tools/browser_use.d.ts +19 -0
  206. package/dist/types/src/extension/tools/element_click.d.ts +12 -0
  207. package/dist/types/src/extension/tools/export_file.d.ts +18 -0
  208. package/dist/types/src/extension/tools/extract_content.d.ts +18 -0
  209. package/dist/types/src/extension/tools/find_element_position.d.ts +12 -0
  210. package/dist/types/src/extension/tools/html_script.d.ts +10 -0
  211. package/dist/types/src/extension/tools/index.d.ts +11 -0
  212. package/dist/types/src/extension/tools/open_url.d.ts +18 -0
  213. package/dist/{extension/tools/form_autofill.d.ts → types/src/extension/tools/request_login.d.ts} +3 -4
  214. package/dist/types/src/extension/tools/screenshot.d.ts +18 -0
  215. package/dist/types/src/extension/tools/tab_management.d.ts +19 -0
  216. package/dist/types/src/extension/tools/web_search.d.ts +18 -0
  217. package/dist/types/src/extension/utils.d.ts +31 -0
  218. package/dist/types/src/fellou/computer.d.ts +20 -0
  219. package/dist/types/src/fellou/index.d.ts +6 -0
  220. package/dist/types/src/fellou/tools/computer_use.d.ts +18 -0
  221. package/dist/types/src/index.d.ts +8 -0
  222. package/dist/types/src/models/action.d.ts +22 -0
  223. package/dist/types/src/models/workflow.d.ts +16 -0
  224. package/dist/types/src/nodejs/core.d.ts +2 -0
  225. package/dist/types/src/nodejs/index.d.ts +3 -0
  226. package/dist/types/src/nodejs/script/build_dom_tree.d.ts +1 -0
  227. package/dist/types/src/nodejs/tools/browser_use.d.ts +28 -0
  228. package/dist/types/src/nodejs/tools/command_execute.d.ts +12 -0
  229. package/dist/types/src/nodejs/tools/file_read.d.ts +11 -0
  230. package/dist/types/src/nodejs/tools/file_write.d.ts +15 -0
  231. package/dist/types/src/nodejs/tools/index.d.ts +4 -0
  232. package/dist/types/src/schemas/workflow.schema.d.ts +88 -0
  233. package/dist/types/src/services/llm/claude-provider.d.ts +11 -0
  234. package/dist/types/src/services/llm/deepseek-provider.d.ts +15 -0
  235. package/dist/types/src/services/llm/glm-provider.d.ts +11 -0
  236. package/dist/types/src/services/llm/openai-provider copy.d.ts +11 -0
  237. package/dist/types/src/services/llm/openai-provider.d.ts +11 -0
  238. package/dist/types/src/services/parser/workflow-parser.d.ts +29 -0
  239. package/dist/types/src/services/workflow/generator.d.ts +13 -0
  240. package/dist/types/src/services/workflow/templates.d.ts +8 -0
  241. package/dist/types/src/types/action.types.d.ts +38 -0
  242. package/dist/types/src/types/eko.types.d.ts +21 -0
  243. package/dist/types/src/types/index.d.ts +5 -0
  244. package/dist/types/src/types/llm.types.d.ts +54 -0
  245. package/dist/types/src/types/parser.types.d.ts +9 -0
  246. package/dist/types/src/types/tools.types.d.ts +88 -0
  247. package/dist/types/src/types/workflow.types.d.ts +39 -0
  248. package/dist/types/src/web/core.d.ts +2 -0
  249. package/dist/types/src/web/index.d.ts +5 -0
  250. package/dist/types/src/web/script/build_dom_tree.d.ts +10 -0
  251. package/dist/types/src/web/tools/browser.d.ts +21 -0
  252. package/dist/types/src/web/tools/browser_use.d.ts +19 -0
  253. package/dist/types/src/web/tools/element_click.d.ts +12 -0
  254. package/dist/types/src/web/tools/export_file.d.ts +18 -0
  255. package/dist/types/src/web/tools/extract_content.d.ts +17 -0
  256. package/dist/types/src/web/tools/find_element_position.d.ts +12 -0
  257. package/dist/types/src/web/tools/html_script.d.ts +10 -0
  258. package/dist/types/src/web/tools/index.d.ts +7 -0
  259. package/dist/types/src/web/tools/screenshot.d.ts +18 -0
  260. package/dist/types/test/integration/claude-provider.test.d.ts +1 -0
  261. package/dist/types/test/integration/deepseek-provider.test.d.ts +1 -0
  262. package/dist/types/test/integration/glm-provider.test.d.ts +1 -0
  263. package/dist/types/test/integration/openai-provider.test copy.d.ts +1 -0
  264. package/dist/types/test/integration/openai-provider.test.d.ts +1 -0
  265. package/dist/types/test/integration/qwen-provider.d.ts +1 -0
  266. package/dist/types/test/integration/qwen-provider.test copy.d.ts +1 -0
  267. package/dist/types/test/integration/qwen-provider.test.d.ts +1 -0
  268. package/dist/types/test/integration/workflow.execution.test.d.ts +1 -0
  269. package/dist/types/test/integration/workflow.generation-and-execution.test.d.ts +1 -0
  270. package/dist/types/test/integration/workflow.generator.test.d.ts +1 -0
  271. package/dist/types/test/unit/action.test.d.ts +1 -0
  272. package/dist/types/test/unit/tool-registry.test.d.ts +1 -0
  273. package/dist/types/test/unit/workflow-parser.test.d.ts +1 -0
  274. package/dist/types/test/unit/workflow.test.d.ts +1 -0
  275. package/dist/universal_tools/human/text.d.ts +9 -0
  276. package/dist/web.cjs.js +117 -117
  277. package/dist/web.esm.js +117 -117
  278. package/package.json +106 -106
  279. package/dist/fellou/tools/index.d.ts +0 -2
  280. package/dist/types/framework.types.d.ts +0 -11
File without changes
File without changes
File without changes
@@ -0,0 +1,9 @@
1
+ import { CancelWorkflowInput } from '../../types/tools.types';
2
+ import { Tool, InputSchema, ExecutionContext } from '../../types/action.types';
3
+ export declare class CancelWorkflow implements Tool<CancelWorkflowInput, void> {
4
+ name: string;
5
+ description: string;
6
+ input_schema: InputSchema;
7
+ constructor();
8
+ execute(context: ExecutionContext, params: CancelWorkflowInput): Promise<void>;
9
+ }
@@ -647,35 +647,35 @@ var browser = /*#__PURE__*/Object.freeze({
647
647
  class BrowserUse {
648
648
  constructor() {
649
649
  this.name = 'browser_use';
650
- this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
651
- * This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
652
- * Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
653
- * ELEMENT INTERACTION:
654
- - Only use indexes that exist in the provided element list
655
- - Each element has a unique index number (e.g., "[33]:<button>")
656
- - Elements marked with "[]:" are non-interactive (for context only)
657
- * NAVIGATION & ERROR HANDLING:
658
- - If no suitable elements exist, use other functions to complete the task
659
- - If stuck, try alternative approaches
660
- - Handle popups/cookies by accepting or closing them
650
+ this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
651
+ * This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
652
+ * Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
653
+ * ELEMENT INTERACTION:
654
+ - Only use indexes that exist in the provided element list
655
+ - Each element has a unique index number (e.g., "[33]:<button>")
656
+ - Elements marked with "[]:" are non-interactive (for context only)
657
+ * NAVIGATION & ERROR HANDLING:
658
+ - If no suitable elements exist, use other functions to complete the task
659
+ - If stuck, try alternative approaches
660
+ - Handle popups/cookies by accepting or closing them
661
661
  - Use scroll to find elements you are looking for`;
662
662
  this.input_schema = {
663
663
  type: 'object',
664
664
  properties: {
665
665
  action: {
666
666
  type: 'string',
667
- description: `The action to perform. The available actions are:
668
- * \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
669
- - Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
670
- - Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
671
- - In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
672
- * \`input_text\`: Enter a string in the interactive element.
673
- * \`click\`: Click to element.
674
- * \`right_click\`: Right-click on the element.
675
- * \`double_click\`: Double-click on the element.
676
- * \`scroll_to\`: Scroll to the specified element.
677
- * \`extract_content\`: Extract the text content of the current webpage.
678
- * \`get_dropdown_options\`: Get all options from a native dropdown element.
667
+ description: `The action to perform. The available actions are:
668
+ * \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
669
+ - Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
670
+ - Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
671
+ - In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
672
+ * \`input_text\`: Enter a string in the interactive element.
673
+ * \`click\`: Click to element.
674
+ * \`right_click\`: Right-click on the element.
675
+ * \`double_click\`: Double-click on the element.
676
+ * \`scroll_to\`: Scroll to the specified element.
677
+ * \`extract_content\`: Extract the text content of the current webpage.
678
+ * \`get_dropdown_options\`: Get all options from a native dropdown element.
679
679
  * \`select_dropdown_option\`: Select dropdown option for interactive element index by the text of the option you want to select.`,
680
680
  enum: [
681
681
  'screenshot_extract_element',
@@ -828,7 +828,7 @@ class BrowserUse {
828
828
  }
829
829
  catch (e) {
830
830
  console.error('Browser use error:', e);
831
- return { success: false, error: e === null || e === void 0 ? void 0 : e.message };
831
+ return { success: false, error: e === null || e === undefined ? undefined : e.message };
832
832
  }
833
833
  }
834
834
  destroy(context) {
@@ -906,7 +906,7 @@ function extractOperableElements() {
906
906
  return NodeFilter.FILTER_SKIP;
907
907
  }
908
908
  // text <= 100
909
- const text = (_a = node.innerText) === null || _a === void 0 ? void 0 : _a.trim();
909
+ const text = (_a = node.innerText) === null || _a === undefined ? undefined : _a.trim();
910
910
  if (isElementVisible(node) &&
911
911
  text &&
912
912
  text.length <= 100 &&
@@ -1012,21 +1012,21 @@ async function executeWithHtmlElement$1(context, task_prompt) {
1012
1012
  let messages = [
1013
1013
  {
1014
1014
  role: 'user',
1015
- content: `# Task
1016
- Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1017
- Output JSON format, no explanation required.
1018
-
1019
- # User input
1020
- ${task_prompt}
1021
-
1022
- # Output example (when the element exists)
1023
- {"elementId": "1", "operationType": "click"}
1024
-
1025
- # Output example (when the element does not exist)
1026
- {"elementId": null, "operationType": "unknown"}
1027
-
1028
- # HTML
1029
- ${pseudoHtml}
1015
+ content: `# Task
1016
+ Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1017
+ Output JSON format, no explanation required.
1018
+
1019
+ # User input
1020
+ ${task_prompt}
1021
+
1022
+ # Output example (when the element exists)
1023
+ {"elementId": "1", "operationType": "click"}
1024
+
1025
+ # Output example (when the element does not exist)
1026
+ {"elementId": null, "operationType": "unknown"}
1027
+
1028
+ # HTML
1029
+ ${pseudoHtml}
1030
1030
  `,
1031
1031
  },
1032
1032
  ];
@@ -1168,7 +1168,7 @@ class ExportFile {
1168
1168
  }
1169
1169
  catch (e) {
1170
1170
  let tab = await open_new_tab('https://www.google.com', true);
1171
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1171
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1172
1172
  let tabId = tab.id;
1173
1173
  await chrome.scripting.executeScript({
1174
1174
  target: { tabId: tabId },
@@ -1262,21 +1262,21 @@ async function executeWithHtmlElement(context, task_prompt) {
1262
1262
  let messages = [
1263
1263
  {
1264
1264
  role: 'user',
1265
- content: `# Task
1266
- Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1267
- Output JSON format, no explanation required.
1268
-
1269
- # User input
1270
- ${task_prompt}
1271
-
1272
- # Output example (when the element exists)
1273
- {"elementId": "1"}
1274
-
1275
- # Output example (when the element does not exist)
1276
- {"elementId": null}
1277
-
1278
- # HTML
1279
- ${pseudoHtml}
1265
+ content: `# Task
1266
+ Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1267
+ Output JSON format, no explanation required.
1268
+
1269
+ # User input
1270
+ ${task_prompt}
1271
+
1272
+ # Output example (when the element exists)
1273
+ {"elementId": "1"}
1274
+
1275
+ # Output example (when the element does not exist)
1276
+ {"elementId": null}
1277
+
1278
+ # HTML
1279
+ ${pseudoHtml}
1280
1280
  `,
1281
1281
  },
1282
1282
  ];
@@ -1425,12 +1425,12 @@ class OpenUrl {
1425
1425
  let tab;
1426
1426
  if (newWindow) {
1427
1427
  tab = await open_new_tab(url, true);
1428
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1428
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1429
1429
  }
1430
1430
  else {
1431
1431
  let windowId = await getWindowId(context);
1432
1432
  tab = await open_new_tab(url, false, windowId);
1433
- (_f = (_e = (_d = context.callback) === null || _d === void 0 ? void 0 : _d.hooks) === null || _e === void 0 ? void 0 : _e.onTabCreated) === null || _f === void 0 ? void 0 : _f.call(_e, tab.id);
1433
+ (_f = (_e = (_d = context.callback) === null || _d === undefined ? undefined : _d.hooks) === null || _e === undefined ? undefined : _e.onTabCreated) === null || _f === undefined ? undefined : _f.call(_e, tab.id);
1434
1434
  }
1435
1435
  let windowId = tab.windowId;
1436
1436
  let tabId = tab.id;
@@ -1489,13 +1489,13 @@ class TabManagement {
1489
1489
  properties: {
1490
1490
  command: {
1491
1491
  type: 'string',
1492
- description: `The command to perform. The available commands are:
1493
- * \`tab_all\`: View all tabs and return the tabId and title.
1494
- * \`current_tab\`: Get current tab information (tabId, url, title).
1495
- * \`go_back\`: Go back to the previous page in the current tab.
1496
- * \`change_url [url]\`: open URL in the current tab, eg: \`change_url https://www.google.com\`.
1497
- * \`close_tab\`: Close the current tab.
1498
- * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1492
+ description: `The command to perform. The available commands are:
1493
+ * \`tab_all\`: View all tabs and return the tabId and title.
1494
+ * \`current_tab\`: Get current tab information (tabId, url, title).
1495
+ * \`go_back\`: Go back to the previous page in the current tab.
1496
+ * \`change_url [url]\`: open URL in the current tab, eg: \`change_url https://www.google.com\`.
1497
+ * \`close_tab\`: Close the current tab.
1498
+ * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1499
1499
  * \`new_tab [url]\`: Open a new tab window and open the URL, eg: \`new_tab https://www.google.com\``,
1500
1500
  },
1501
1501
  },
@@ -1596,12 +1596,12 @@ class TabManagement {
1596
1596
  let tab;
1597
1597
  if (newWindow) {
1598
1598
  tab = await open_new_tab(url, true);
1599
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1599
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1600
1600
  }
1601
1601
  else {
1602
1602
  let windowId = await getWindowId(context);
1603
1603
  tab = await open_new_tab(url, false, windowId);
1604
- (_f = (_e = (_d = context.callback) === null || _d === void 0 ? void 0 : _d.hooks) === null || _e === void 0 ? void 0 : _e.onTabCreated) === null || _f === void 0 ? void 0 : _f.call(_e, tab.id);
1604
+ (_f = (_e = (_d = context.callback) === null || _d === undefined ? undefined : _d.hooks) === null || _e === undefined ? undefined : _e.onTabCreated) === null || _f === undefined ? undefined : _f.call(_e, tab.id);
1605
1605
  }
1606
1606
  let windowId = tab.windowId;
1607
1607
  let tabId = tab.id;
@@ -1681,7 +1681,7 @@ class WebSearch {
1681
1681
  let taskId = new Date().getTime() + '';
1682
1682
  let searchs = [{ url: url, keyword: query }];
1683
1683
  let searchInfo = await deepSearch(context, taskId, searchs, maxResults || 5);
1684
- let links = ((_a = searchInfo.result[0]) === null || _a === void 0 ? void 0 : _a.links) || [];
1684
+ let links = ((_a = searchInfo.result[0]) === null || _a === undefined ? undefined : _a.links) || [];
1685
1685
  return links.filter((s) => s.content);
1686
1686
  }
1687
1687
  }
@@ -1872,7 +1872,7 @@ async function doPageContent(context, taskId, detailLinkGroups, window) {
1872
1872
  url: link.url,
1873
1873
  windowId: window.id,
1874
1874
  });
1875
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1875
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1876
1876
  searchInfo.running++;
1877
1877
  let eventId = taskId + '_' + i + '_' + j;
1878
1878
  // Create a timeout promise
@@ -2046,7 +2046,7 @@ class CancelWorkflow {
2046
2046
  }
2047
2047
  const reason = params.reason;
2048
2048
  console.log("The workflow has been cancelled because: " + reason);
2049
- await ((_a = context.workflow) === null || _a === void 0 ? void 0 : _a.cancel());
2049
+ await ((_a = context.workflow) === null || _a === undefined ? undefined : _a.cancel());
2050
2050
  return;
2051
2051
  }
2052
2052
  }
@@ -2073,7 +2073,7 @@ class HumanInputText {
2073
2073
  }
2074
2074
  const question = params.question;
2075
2075
  console.log("question: " + question);
2076
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputText) === null || _c === void 0 ? void 0 : _c.call(_b, question));
2076
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputText) === null || _c === undefined ? undefined : _c.call(_b, question));
2077
2077
  if (!answer) {
2078
2078
  console.error("Cannot get user's answer.");
2079
2079
  return { status: "Error: Cannot get user's answer.", answer: "" };
@@ -2112,7 +2112,7 @@ class HumanInputSingleChoice {
2112
2112
  const choices = params.choices;
2113
2113
  console.log("question: " + question);
2114
2114
  console.log("choices: " + choices);
2115
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputSingleChoice) === null || _c === void 0 ? void 0 : _c.call(_b, question, choices));
2115
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputSingleChoice) === null || _c === undefined ? undefined : _c.call(_b, question, choices));
2116
2116
  if (!answer) {
2117
2117
  console.error("Cannot get user's answer.");
2118
2118
  return { status: "Error: Cannot get user's answer.", answer: "" };
@@ -2151,7 +2151,7 @@ class HumanInputMultipleChoice {
2151
2151
  const choices = params.choices;
2152
2152
  console.log("question: " + question);
2153
2153
  console.log("choices: " + choices);
2154
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputMultipleChoice) === null || _c === void 0 ? void 0 : _c.call(_b, question, choices));
2154
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputMultipleChoice) === null || _c === undefined ? undefined : _c.call(_b, question, choices));
2155
2155
  if (!answer) {
2156
2156
  console.error("Cannot get user's answer.");
2157
2157
  return { status: "Error: Cannot get user's answer.", answer: [] };
@@ -2184,7 +2184,7 @@ class HumanOperate {
2184
2184
  }
2185
2185
  const reason = params.reason;
2186
2186
  console.log("reason: " + reason);
2187
- let userOperation = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanOperate) === null || _c === void 0 ? void 0 : _c.call(_b, reason));
2187
+ let userOperation = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanOperate) === null || _c === undefined ? undefined : _c.call(_b, reason));
2188
2188
  if (!userOperation) {
2189
2189
  console.error("Cannot get user's operation.");
2190
2190
  return { status: "Error: Cannot get user's operation.", userOperation: "" };
@@ -2218,7 +2218,7 @@ class SummaryWorkflow {
2218
2218
  }
2219
2219
  const summary = params.summary;
2220
2220
  console.log("summary: " + summary);
2221
- await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onSummaryWorkflow) === null || _c === void 0 ? void 0 : _c.call(_b, summary));
2221
+ await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onSummaryWorkflow) === null || _c === undefined ? undefined : _c.call(_b, summary));
2222
2222
  return { status: "OK" };
2223
2223
  }
2224
2224
  }
@@ -645,35 +645,35 @@ var browser = /*#__PURE__*/Object.freeze({
645
645
  class BrowserUse {
646
646
  constructor() {
647
647
  this.name = 'browser_use';
648
- this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
649
- * This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
650
- * Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
651
- * ELEMENT INTERACTION:
652
- - Only use indexes that exist in the provided element list
653
- - Each element has a unique index number (e.g., "[33]:<button>")
654
- - Elements marked with "[]:" are non-interactive (for context only)
655
- * NAVIGATION & ERROR HANDLING:
656
- - If no suitable elements exist, use other functions to complete the task
657
- - If stuck, try alternative approaches
658
- - Handle popups/cookies by accepting or closing them
648
+ this.description = `Use structured commands to interact with the browser, manipulating page elements through screenshots and webpage element extraction.
649
+ * This is a browser GUI interface where you need to analyze webpages by taking screenshots and extracting page element structures, and specify action sequences to complete designated tasks.
650
+ * Before any operation, you must first call the \`screenshot_extract_element\` command, which will return the browser page screenshot and structured element information, both specially processed.
651
+ * ELEMENT INTERACTION:
652
+ - Only use indexes that exist in the provided element list
653
+ - Each element has a unique index number (e.g., "[33]:<button>")
654
+ - Elements marked with "[]:" are non-interactive (for context only)
655
+ * NAVIGATION & ERROR HANDLING:
656
+ - If no suitable elements exist, use other functions to complete the task
657
+ - If stuck, try alternative approaches
658
+ - Handle popups/cookies by accepting or closing them
659
659
  - Use scroll to find elements you are looking for`;
660
660
  this.input_schema = {
661
661
  type: 'object',
662
662
  properties: {
663
663
  action: {
664
664
  type: 'string',
665
- description: `The action to perform. The available actions are:
666
- * \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
667
- - Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
668
- - Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
669
- - In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
670
- * \`input_text\`: Enter a string in the interactive element.
671
- * \`click\`: Click to element.
672
- * \`right_click\`: Right-click on the element.
673
- * \`double_click\`: Double-click on the element.
674
- * \`scroll_to\`: Scroll to the specified element.
675
- * \`extract_content\`: Extract the text content of the current webpage.
676
- * \`get_dropdown_options\`: Get all options from a native dropdown element.
665
+ description: `The action to perform. The available actions are:
666
+ * \`screenshot_extract_element\`: Take a screenshot of the web page and extract operable elements.
667
+ - Screenshots are used to understand page layouts, with labeled bounding boxes corresponding to element indexes. Each bounding box and its label share the same color, with labels typically positioned in the top-right corner of the box.
668
+ - Screenshots help verify element positions and relationships. Labels may sometimes overlap, so extracted elements are used to verify the correct elements.
669
+ - In addition to screenshots, simplified information about interactive elements is returned, with element indexes corresponding to those in the screenshots.
670
+ * \`input_text\`: Enter a string in the interactive element.
671
+ * \`click\`: Click to element.
672
+ * \`right_click\`: Right-click on the element.
673
+ * \`double_click\`: Double-click on the element.
674
+ * \`scroll_to\`: Scroll to the specified element.
675
+ * \`extract_content\`: Extract the text content of the current webpage.
676
+ * \`get_dropdown_options\`: Get all options from a native dropdown element.
677
677
  * \`select_dropdown_option\`: Select dropdown option for interactive element index by the text of the option you want to select.`,
678
678
  enum: [
679
679
  'screenshot_extract_element',
@@ -826,7 +826,7 @@ class BrowserUse {
826
826
  }
827
827
  catch (e) {
828
828
  console.error('Browser use error:', e);
829
- return { success: false, error: e === null || e === void 0 ? void 0 : e.message };
829
+ return { success: false, error: e === null || e === undefined ? undefined : e.message };
830
830
  }
831
831
  }
832
832
  destroy(context) {
@@ -904,7 +904,7 @@ function extractOperableElements() {
904
904
  return NodeFilter.FILTER_SKIP;
905
905
  }
906
906
  // text <= 100
907
- const text = (_a = node.innerText) === null || _a === void 0 ? void 0 : _a.trim();
907
+ const text = (_a = node.innerText) === null || _a === undefined ? undefined : _a.trim();
908
908
  if (isElementVisible(node) &&
909
909
  text &&
910
910
  text.length <= 100 &&
@@ -1010,21 +1010,21 @@ async function executeWithHtmlElement$1(context, task_prompt) {
1010
1010
  let messages = [
1011
1011
  {
1012
1012
  role: 'user',
1013
- content: `# Task
1014
- Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1015
- Output JSON format, no explanation required.
1016
-
1017
- # User input
1018
- ${task_prompt}
1019
-
1020
- # Output example (when the element exists)
1021
- {"elementId": "1", "operationType": "click"}
1022
-
1023
- # Output example (when the element does not exist)
1024
- {"elementId": null, "operationType": "unknown"}
1025
-
1026
- # HTML
1027
- ${pseudoHtml}
1013
+ content: `# Task
1014
+ Determine the operation intent based on user input, find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1015
+ Output JSON format, no explanation required.
1016
+
1017
+ # User input
1018
+ ${task_prompt}
1019
+
1020
+ # Output example (when the element exists)
1021
+ {"elementId": "1", "operationType": "click"}
1022
+
1023
+ # Output example (when the element does not exist)
1024
+ {"elementId": null, "operationType": "unknown"}
1025
+
1026
+ # HTML
1027
+ ${pseudoHtml}
1028
1028
  `,
1029
1029
  },
1030
1030
  ];
@@ -1166,7 +1166,7 @@ class ExportFile {
1166
1166
  }
1167
1167
  catch (e) {
1168
1168
  let tab = await open_new_tab('https://www.google.com', true);
1169
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1169
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1170
1170
  let tabId = tab.id;
1171
1171
  await chrome.scripting.executeScript({
1172
1172
  target: { tabId: tabId },
@@ -1260,21 +1260,21 @@ async function executeWithHtmlElement(context, task_prompt) {
1260
1260
  let messages = [
1261
1261
  {
1262
1262
  role: 'user',
1263
- content: `# Task
1264
- Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1265
- Output JSON format, no explanation required.
1266
-
1267
- # User input
1268
- ${task_prompt}
1269
-
1270
- # Output example (when the element exists)
1271
- {"elementId": "1"}
1272
-
1273
- # Output example (when the element does not exist)
1274
- {"elementId": null}
1275
-
1276
- # HTML
1277
- ${pseudoHtml}
1263
+ content: `# Task
1264
+ Find the element ID that the user needs to operate on in the webpage HTML, and if the element does not exist, do nothing.
1265
+ Output JSON format, no explanation required.
1266
+
1267
+ # User input
1268
+ ${task_prompt}
1269
+
1270
+ # Output example (when the element exists)
1271
+ {"elementId": "1"}
1272
+
1273
+ # Output example (when the element does not exist)
1274
+ {"elementId": null}
1275
+
1276
+ # HTML
1277
+ ${pseudoHtml}
1278
1278
  `,
1279
1279
  },
1280
1280
  ];
@@ -1423,12 +1423,12 @@ class OpenUrl {
1423
1423
  let tab;
1424
1424
  if (newWindow) {
1425
1425
  tab = await open_new_tab(url, true);
1426
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1426
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1427
1427
  }
1428
1428
  else {
1429
1429
  let windowId = await getWindowId(context);
1430
1430
  tab = await open_new_tab(url, false, windowId);
1431
- (_f = (_e = (_d = context.callback) === null || _d === void 0 ? void 0 : _d.hooks) === null || _e === void 0 ? void 0 : _e.onTabCreated) === null || _f === void 0 ? void 0 : _f.call(_e, tab.id);
1431
+ (_f = (_e = (_d = context.callback) === null || _d === undefined ? undefined : _d.hooks) === null || _e === undefined ? undefined : _e.onTabCreated) === null || _f === undefined ? undefined : _f.call(_e, tab.id);
1432
1432
  }
1433
1433
  let windowId = tab.windowId;
1434
1434
  let tabId = tab.id;
@@ -1487,13 +1487,13 @@ class TabManagement {
1487
1487
  properties: {
1488
1488
  command: {
1489
1489
  type: 'string',
1490
- description: `The command to perform. The available commands are:
1491
- * \`tab_all\`: View all tabs and return the tabId and title.
1492
- * \`current_tab\`: Get current tab information (tabId, url, title).
1493
- * \`go_back\`: Go back to the previous page in the current tab.
1494
- * \`change_url [url]\`: open URL in the current tab, eg: \`change_url https://www.google.com\`.
1495
- * \`close_tab\`: Close the current tab.
1496
- * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1490
+ description: `The command to perform. The available commands are:
1491
+ * \`tab_all\`: View all tabs and return the tabId and title.
1492
+ * \`current_tab\`: Get current tab information (tabId, url, title).
1493
+ * \`go_back\`: Go back to the previous page in the current tab.
1494
+ * \`change_url [url]\`: open URL in the current tab, eg: \`change_url https://www.google.com\`.
1495
+ * \`close_tab\`: Close the current tab.
1496
+ * \`switch_tab [tabId]\`: Switch to the specified tab using tabId, eg: \`switch_tab 1000\`.
1497
1497
  * \`new_tab [url]\`: Open a new tab window and open the URL, eg: \`new_tab https://www.google.com\``,
1498
1498
  },
1499
1499
  },
@@ -1594,12 +1594,12 @@ class TabManagement {
1594
1594
  let tab;
1595
1595
  if (newWindow) {
1596
1596
  tab = await open_new_tab(url, true);
1597
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1597
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1598
1598
  }
1599
1599
  else {
1600
1600
  let windowId = await getWindowId(context);
1601
1601
  tab = await open_new_tab(url, false, windowId);
1602
- (_f = (_e = (_d = context.callback) === null || _d === void 0 ? void 0 : _d.hooks) === null || _e === void 0 ? void 0 : _e.onTabCreated) === null || _f === void 0 ? void 0 : _f.call(_e, tab.id);
1602
+ (_f = (_e = (_d = context.callback) === null || _d === undefined ? undefined : _d.hooks) === null || _e === undefined ? undefined : _e.onTabCreated) === null || _f === undefined ? undefined : _f.call(_e, tab.id);
1603
1603
  }
1604
1604
  let windowId = tab.windowId;
1605
1605
  let tabId = tab.id;
@@ -1679,7 +1679,7 @@ class WebSearch {
1679
1679
  let taskId = new Date().getTime() + '';
1680
1680
  let searchs = [{ url: url, keyword: query }];
1681
1681
  let searchInfo = await deepSearch(context, taskId, searchs, maxResults || 5);
1682
- let links = ((_a = searchInfo.result[0]) === null || _a === void 0 ? void 0 : _a.links) || [];
1682
+ let links = ((_a = searchInfo.result[0]) === null || _a === undefined ? undefined : _a.links) || [];
1683
1683
  return links.filter((s) => s.content);
1684
1684
  }
1685
1685
  }
@@ -1870,7 +1870,7 @@ async function doPageContent(context, taskId, detailLinkGroups, window) {
1870
1870
  url: link.url,
1871
1871
  windowId: window.id,
1872
1872
  });
1873
- (_c = (_b = (_a = context.callback) === null || _a === void 0 ? void 0 : _a.hooks) === null || _b === void 0 ? void 0 : _b.onTabCreated) === null || _c === void 0 ? void 0 : _c.call(_b, tab.id);
1873
+ (_c = (_b = (_a = context.callback) === null || _a === undefined ? undefined : _a.hooks) === null || _b === undefined ? undefined : _b.onTabCreated) === null || _c === undefined ? undefined : _c.call(_b, tab.id);
1874
1874
  searchInfo.running++;
1875
1875
  let eventId = taskId + '_' + i + '_' + j;
1876
1876
  // Create a timeout promise
@@ -2044,7 +2044,7 @@ class CancelWorkflow {
2044
2044
  }
2045
2045
  const reason = params.reason;
2046
2046
  console.log("The workflow has been cancelled because: " + reason);
2047
- await ((_a = context.workflow) === null || _a === void 0 ? void 0 : _a.cancel());
2047
+ await ((_a = context.workflow) === null || _a === undefined ? undefined : _a.cancel());
2048
2048
  return;
2049
2049
  }
2050
2050
  }
@@ -2071,7 +2071,7 @@ class HumanInputText {
2071
2071
  }
2072
2072
  const question = params.question;
2073
2073
  console.log("question: " + question);
2074
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputText) === null || _c === void 0 ? void 0 : _c.call(_b, question));
2074
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputText) === null || _c === undefined ? undefined : _c.call(_b, question));
2075
2075
  if (!answer) {
2076
2076
  console.error("Cannot get user's answer.");
2077
2077
  return { status: "Error: Cannot get user's answer.", answer: "" };
@@ -2110,7 +2110,7 @@ class HumanInputSingleChoice {
2110
2110
  const choices = params.choices;
2111
2111
  console.log("question: " + question);
2112
2112
  console.log("choices: " + choices);
2113
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputSingleChoice) === null || _c === void 0 ? void 0 : _c.call(_b, question, choices));
2113
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputSingleChoice) === null || _c === undefined ? undefined : _c.call(_b, question, choices));
2114
2114
  if (!answer) {
2115
2115
  console.error("Cannot get user's answer.");
2116
2116
  return { status: "Error: Cannot get user's answer.", answer: "" };
@@ -2149,7 +2149,7 @@ class HumanInputMultipleChoice {
2149
2149
  const choices = params.choices;
2150
2150
  console.log("question: " + question);
2151
2151
  console.log("choices: " + choices);
2152
- let answer = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanInputMultipleChoice) === null || _c === void 0 ? void 0 : _c.call(_b, question, choices));
2152
+ let answer = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanInputMultipleChoice) === null || _c === undefined ? undefined : _c.call(_b, question, choices));
2153
2153
  if (!answer) {
2154
2154
  console.error("Cannot get user's answer.");
2155
2155
  return { status: "Error: Cannot get user's answer.", answer: [] };
@@ -2182,7 +2182,7 @@ class HumanOperate {
2182
2182
  }
2183
2183
  const reason = params.reason;
2184
2184
  console.log("reason: " + reason);
2185
- let userOperation = await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onHumanOperate) === null || _c === void 0 ? void 0 : _c.call(_b, reason));
2185
+ let userOperation = await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onHumanOperate) === null || _c === undefined ? undefined : _c.call(_b, reason));
2186
2186
  if (!userOperation) {
2187
2187
  console.error("Cannot get user's operation.");
2188
2188
  return { status: "Error: Cannot get user's operation.", userOperation: "" };
@@ -2216,7 +2216,7 @@ class SummaryWorkflow {
2216
2216
  }
2217
2217
  const summary = params.summary;
2218
2218
  console.log("summary: " + summary);
2219
- await ((_c = (_a = context.callback) === null || _a === void 0 ? void 0 : (_b = _a.hooks).onSummaryWorkflow) === null || _c === void 0 ? void 0 : _c.call(_b, summary));
2219
+ await ((_c = (_a = context.callback) === null || _a === undefined ? undefined : (_b = _a.hooks).onSummaryWorkflow) === null || _c === undefined ? undefined : _c.call(_b, summary));
2220
2220
  return { status: "OK" };
2221
2221
  }
2222
2222
  }