@eko-ai/eko 3.1.2-alpha.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SAmxBjC"}
1
+ {"version":3,"file":"build_dom_tree.d.ts","sourceRoot":"","sources":["../../../src/agent/browser/build_dom_tree.ts"],"names":[],"mappings":"AACA,wBAAgB,kBAAkB,SAuxBjC"}
package/dist/index.cjs.js CHANGED
@@ -30777,6 +30777,15 @@ class RetryLanguageModel {
30777
30777
  compatibility: llm.config?.compatibility,
30778
30778
  }).languageModel(llm.model);
30779
30779
  }
30780
+ else if (llm.provider == "modelscope") {
30781
+ return createOpenAICompatible({
30782
+ name: llm.config?.name || llm.model.split("/")[0],
30783
+ apiKey: apiKey,
30784
+ baseURL: baseURL || "https://api-inference.modelscope.cn/v1",
30785
+ fetch: llm.fetch,
30786
+ headers: llm.config?.headers,
30787
+ }).languageModel(llm.model);
30788
+ }
30780
30789
  else {
30781
30790
  return llm.provider.languageModel(llm.model);
30782
30791
  }
@@ -35652,6 +35661,7 @@ function run_build_dom_tree() {
35652
35661
  }
35653
35662
  function build_dom_tree(markHighlightElements) {
35654
35663
  let highlightIndex = 0; // Reset highlight index
35664
+ let duplicates = new Set();
35655
35665
  function highlightElement(element, index, parentIframe = null) {
35656
35666
  // Create or get highlight container
35657
35667
  let container = document.getElementById('eko-highlight-container');
@@ -36018,8 +36028,10 @@ function run_build_dom_tree() {
36018
36028
  }
36019
36029
  // Function to traverse the DOM and create nested JSON
36020
36030
  function buildDomTree(node, parentIframe = null) {
36021
- if (!node)
36031
+ if (!node || duplicates.has(node)) {
36022
36032
  return null;
36033
+ }
36034
+ duplicates.add(node);
36023
36035
  // Special case for text nodes
36024
36036
  if (node.nodeType === Node.TEXT_NODE) {
36025
36037
  const textContent = node.textContent.trim();
@@ -36079,7 +36091,7 @@ function run_build_dom_tree() {
36079
36091
  }
36080
36092
  // Handle shadow DOM
36081
36093
  if (node.shadowRoot) {
36082
- const shadowChildren = Array.from(node.shadowRoot.childNodes).map((child) => buildDomTree(child, parentIframe));
36094
+ const shadowChildren = Array.from(node.shadowRoot.children).map((child) => buildDomTree(child, parentIframe)).filter(child => child !== null);
36083
36095
  nodeData.children.push(...shadowChildren);
36084
36096
  }
36085
36097
  // Handle iframes
@@ -36087,7 +36099,7 @@ function run_build_dom_tree() {
36087
36099
  try {
36088
36100
  const iframeDoc = node.contentDocument || node.contentWindow.document;
36089
36101
  if (iframeDoc) {
36090
- const iframeChildren = Array.from(iframeDoc.body.childNodes).map((child) => buildDomTree(child, node));
36102
+ const iframeChildren = Array.from(iframeDoc.body.children).map((child) => buildDomTree(child, node)).filter(child => child !== null);
36091
36103
  nodeData.children.push(...iframeChildren);
36092
36104
  }
36093
36105
  }
@@ -36097,7 +36109,7 @@ function run_build_dom_tree() {
36097
36109
  }
36098
36110
  else {
36099
36111
  if (isElementExist(node)) {
36100
- const children = Array.from(node.childNodes).map((child) => buildDomTree(child, parentIframe));
36112
+ const children = Array.from(node.children).map((child) => buildDomTree(child, parentIframe)).filter(child => child !== null);
36101
36113
  nodeData.children.push(...children);
36102
36114
  }
36103
36115
  }